aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-nm.c
diff options
context:
space:
mode:
authorChenthill Palanisamy <pchenthill@novell.com>2009-07-03 02:12:52 +0800
committerChenthill Palanisamy <pchenthill@novell.com>2009-07-03 02:15:11 +0800
commite2bf5a174aee32d888b96f04ef6e1da11f9f5f50 (patch)
tree75ab2089f453e9c70140c233fb9515db3225c7ab /shell/e-shell-nm.c
parentafea64785f1fbcb9852fa520f67f3a60f303c372 (diff)
downloadgsoc2013-evolution-e2bf5a174aee32d888b96f04ef6e1da11f9f5f50.tar
gsoc2013-evolution-e2bf5a174aee32d888b96f04ef6e1da11f9f5f50.tar.gz
gsoc2013-evolution-e2bf5a174aee32d888b96f04ef6e1da11f9f5f50.tar.bz2
gsoc2013-evolution-e2bf5a174aee32d888b96f04ef6e1da11f9f5f50.tar.lz
gsoc2013-evolution-e2bf5a174aee32d888b96f04ef6e1da11f9f5f50.tar.xz
gsoc2013-evolution-e2bf5a174aee32d888b96f04ef6e1da11f9f5f50.tar.zst
gsoc2013-evolution-e2bf5a174aee32d888b96f04ef6e1da11f9f5f50.zip
Set the start_in_offline state only when the user chooses to go
offline and not when network goes offline.
Diffstat (limited to 'shell/e-shell-nm.c')
-rw-r--r--shell/e-shell-nm.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/shell/e-shell-nm.c b/shell/e-shell-nm.c
index c8b449bed1..12f446b536 100644
--- a/shell/e-shell-nm.c
+++ b/shell/e-shell-nm.c
@@ -102,6 +102,34 @@ e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED,
return DBUS_HANDLER_RESULT_HANDLED;
}
+static void
+check_initial_state (EShell *shell)
+{
+ DBusMessage *message = NULL, *response = NULL;
+ guint32 state = -1;
+ DBusError error = DBUS_ERROR_INIT;
+
+ message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "state");
+
+ /* assuming this should be safe to call syncronously */
+ response = dbus_connection_send_with_reply_and_block (dbus_connection, message, 100, &error);
+
+ if (response)
+ dbus_message_get_args (response, &error, DBUS_TYPE_UINT32, &state, DBUS_TYPE_INVALID);
+ else {
+ g_warning ("%s \n", error.message);
+ dbus_error_free (&error);
+ return;
+ }
+
+ /* update the state only in the absence of network connection else let the old state prevail */
+ if (state == NM_STATE_DISCONNECTED)
+ e_shell_set_line_status (shell, GNOME_Evolution_FORCED_OFFLINE);
+
+ dbus_message_unref (message);
+ dbus_message_unref (response);
+}
+
gboolean
e_shell_dbus_initialise (EShell *shell)
{
@@ -123,6 +151,8 @@ e_shell_dbus_initialise (EShell *shell)
if (!dbus_connection_add_filter (dbus_connection, e_shell_network_monitor, shell, NULL))
goto exception;
+ check_initial_state (shell);
+
dbus_bus_add_match (dbus_connection,
"type='signal',"
"interface='" NM_DBUS_INTERFACE "',"