aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-nm.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-12-14 10:14:41 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-12-14 10:14:41 +0800
commitb7333387e8bd19299794e6485e3407d03c2eb73f (patch)
treeeb849e5f839738b0acdce5b4ba519eac521cf1d6 /shell/e-shell-nm.c
parentd158af8cdfa6e4bf85c1e74769e8d61bc469494c (diff)
downloadgsoc2013-evolution-b7333387e8bd19299794e6485e3407d03c2eb73f.tar.gz
gsoc2013-evolution-b7333387e8bd19299794e6485e3407d03c2eb73f.tar.zst
gsoc2013-evolution-b7333387e8bd19299794e6485e3407d03c2eb73f.zip
- Fix NetworkManager connection tracking.
- Implement offline preparation as an EActivity that gets broadcast in a signal to shell modules. Offline preparations are complete when the last EActivity reference is dropped. - Bind some of the composer preferences to EShellSettings properties. svn path=/branches/kill-bonobo/; revision=36875
Diffstat (limited to 'shell/e-shell-nm.c')
-rw-r--r--shell/e-shell-nm.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/shell/e-shell-nm.c b/shell/e-shell-nm.c
index c0cae505dc..48652501da 100644
--- a/shell/e-shell-nm.c
+++ b/shell/e-shell-nm.c
@@ -52,15 +52,14 @@ e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED,
gpointer user_data)
{
DBusError error = DBUS_ERROR_INIT;
- const gchar *object;
EShell *shell = user_data;
- EShellLineStatus line_status;
- gboolean device_active;
+ const gchar *path;
+ guint32 state;
- object = dbus_message_get_path (message);
+ path = dbus_message_get_path (message);
if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected") &&
- object != NULL && strcmp (object, DBUS_PATH_LOCAL) == 0) {
+ path != NULL && strcmp (path, DBUS_PATH_LOCAL) == 0) {
dbus_connection_unref (dbus_connection);
dbus_connection = NULL;
@@ -69,23 +68,29 @@ e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED,
return DBUS_HANDLER_RESULT_HANDLED;
}
- if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive"))
- device_active = FALSE;
- else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive"))
- device_active = TRUE;
- else
+ if (!dbus_message_is_signal (message, NM_DBUS_INTERFACE, "StateChanged"))
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- if (!dbus_message_get_args (message, &error, DBUS_TYPE_OBJECT_PATH,
- &object, DBUS_TYPE_INVALID))
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ dbus_message_get_args (
+ message, &error,
+ DBUS_TYPE_UINT32, &state,
+ DBUS_TYPE_INVALID);
- line_status = e_shell_get_line_status (shell);
+ if (dbus_error_is_set (&error)) {
+ g_warning ("%s", error.message);
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
- if (line_status == E_SHELL_LINE_STATUS_ONLINE && !device_active)
- e_shell_set_line_status (shell, E_SHELL_LINE_STATUS_FORCED_OFFLINE);
- else if (line_status == E_SHELL_LINE_STATUS_FORCED_OFFLINE && device_active)
- e_shell_set_line_status (shell, E_SHELL_LINE_STATUS_ONLINE);
+ switch (state) {
+ case NM_STATE_CONNECTED:
+ e_shell_set_network_available (shell, TRUE);
+ break;
+ case NM_STATE_DISCONNECTED:
+ e_shell_set_network_available (shell, FALSE);
+ break;
+ default:
+ break;
+ }
return DBUS_HANDLER_RESULT_HANDLED;
}