diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-07-08 02:20:50 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-09-14 20:08:35 +0800 |
commit | 7c6570c99aeadc3305eec5b77bf47c07c386a91c (patch) | |
tree | abebd9e50d372135dd3d04b6fea6507dec08bd76 /modules/network-manager | |
parent | ae5c5a6e58866e07801c8dec22b8994f6b1348c4 (diff) | |
download | gsoc2013-evolution-7c6570c99aeadc3305eec5b77bf47c07c386a91c.tar gsoc2013-evolution-7c6570c99aeadc3305eec5b77bf47c07c386a91c.tar.gz gsoc2013-evolution-7c6570c99aeadc3305eec5b77bf47c07c386a91c.tar.bz2 gsoc2013-evolution-7c6570c99aeadc3305eec5b77bf47c07c386a91c.tar.lz gsoc2013-evolution-7c6570c99aeadc3305eec5b77bf47c07c386a91c.tar.xz gsoc2013-evolution-7c6570c99aeadc3305eec5b77bf47c07c386a91c.tar.zst gsoc2013-evolution-7c6570c99aeadc3305eec5b77bf47c07c386a91c.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; |