diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-07-08 02:20:50 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-07-08 02:39:35 +0800 |
commit | e868dd4bfdeb80090c42a8188ebadbc0d75ca308 (patch) | |
tree | 9abbf226d907846b74fb6c33d82c024b51f6b101 /modules/network-manager | |
parent | 42b4f85ec5263c1715f5dfd01d0f3c289b8a9c68 (diff) | |
download | gsoc2013-evolution-e868dd4bfdeb80090c42a8188ebadbc0d75ca308.tar.gz gsoc2013-evolution-e868dd4bfdeb80090c42a8188ebadbc0d75ca308.tar.zst gsoc2013-evolution-e868dd4bfdeb80090c42a8188ebadbc0d75ca308.zip |
network-manager: Keep network availablility state accurate.
We track Evolution's online state separately from network availability
these days. I think there was still logic here from when we set online
state directly. Don't lie about network availability.
Diffstat (limited to 'modules/network-manager')
-rw-r--r-- | modules/network-manager/evolution-network-manager.c | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/modules/network-manager/evolution-network-manager.c b/modules/network-manager/evolution-network-manager.c index 139847812b..3168b9adf1 100644 --- a/modules/network-manager/evolution-network-manager.c +++ b/modules/network-manager/evolution-network-manager.c @@ -91,25 +91,9 @@ nm_connection_closed_cb (GDBusConnection *connection, } static void -network_manager_signal_cb (GDBusConnection *connection, - const gchar *sender_name, - const gchar *object_path, - const gchar *interface_name, - const gchar *signal_name, - GVariant *parameters, - gpointer user_data) +network_manager_handle_state (EShell *shell, + guint32 state) { - ENetworkManager *extension = user_data; - EShell *shell; - guint32 state; - - shell = network_manager_get_shell (extension); - - if (g_strcmp0 (interface_name, NM_DBUS_INTERFACE) != 0 - || g_strcmp0 (signal_name, "StateChanged") != 0) - return; - - g_variant_get (parameters, "(u)", &state); switch (state) { #if NM_CHECK_VERSION(0,8,992) case NM_STATE_CONNECTED_LOCAL: @@ -133,7 +117,30 @@ network_manager_signal_cb (GDBusConnection *connection, } static void -network_manager_check_initial_state (ENetworkManager *extension) +network_manager_signal_cb (GDBusConnection *connection, + const gchar *sender_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + ENetworkManager *extension = user_data; + EShell *shell; + guint32 state; + + shell = network_manager_get_shell (extension); + + if (g_strcmp0 (interface_name, NM_DBUS_INTERFACE) != 0 + || g_strcmp0 (signal_name, "StateChanged") != 0) + return; + + g_variant_get (parameters, "(u)", &state); + network_manager_handle_state (shell, state); +} + +static void +network_manager_query_state (ENetworkManager *extension) { EShell *shell; GDBusMessage *message = NULL; @@ -171,11 +178,7 @@ network_manager_check_initial_state (ENetworkManager *extension) body = g_dbus_message_get_body (response); g_variant_get (body, "(u)", &state); - - /* Update the state only in the absence of a network connection, - * otherwise let the old state prevail. */ - if (state == NM_STATE_ASLEEP || state == NM_STATE_DISCONNECTED) - e_shell_set_network_available (shell, FALSE); + network_manager_handle_state (shell, state); g_object_unref (response); } @@ -224,7 +227,7 @@ network_manager_connect (ENetworkManager *extension) extension->connection, "closed", G_CALLBACK (nm_connection_closed_cb), extension); - network_manager_check_initial_state (extension); + network_manager_query_state (extension); return FALSE; |