diff options
author | Kai-Heng Feng <kai.heng.feng@canonical.com> | 2016-08-30 13:36:28 +0800 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-08-30 15:57:15 +0200 |
commit | c7533cfcd9c761a152a66f608808187df3155521 (patch) | |
tree | f977392054c0cc68a9fe8530b2ddf412264a51ca | |
parent | ca3f60e08892e0abef870a5dbf11df5c9eba35b4 (diff) | |
download | network-manager-applet-c7533cfcd9c761a152a66f608808187df3155521.tar.gz |
applet: fix wrong status for wireless toggle
When "state-changed" signal emits, there's a chance that wireless status has't
update yet, so the "Enable Wi-Fi" toggle shows the wrong status.
This can be solved by updating applet menu whenever "wireless-enabled" changes.
https://mail.gnome.org/archives/networkmanager-list/2016-August/msg00112.html
https://bugzilla.gnome.org/show_bug.cgi?id=770218
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
-rw-r--r-- | src/applet.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/applet.c b/src/applet.c index 08be7720..8b6b6164 100644 --- a/src/applet.c +++ b/src/applet.c @@ -2291,6 +2291,13 @@ foo_manager_permission_changed (NMClient *client, applet->permissions[permission] = result; } +static void +foo_wireless_enabled_changed_cb (NMClient *client, GParamSpec *pspec, NMApplet *applet) +{ + applet_schedule_update_icon (applet); + applet_schedule_update_menu (applet); +} + static gboolean foo_set_initial_state (gpointer data) { @@ -2340,6 +2347,14 @@ foo_client_setup (NMApplet *applet) G_CALLBACK (foo_manager_permission_changed), applet); + g_signal_connect (applet->nm_client, "notify::wireless-enabled", + G_CALLBACK (foo_wireless_enabled_changed_cb), + applet); + + g_signal_connect (applet->nm_client, "notify::wwan-enabled", + G_CALLBACK (foo_wireless_enabled_changed_cb), + applet); + /* Initialize permissions - the initial 'permission-changed' signal is emitted from NMClient constructor, and thus not caught */ for (perm = NM_CLIENT_PERMISSION_NONE + 1; perm <= NM_CLIENT_PERMISSION_LAST; perm++) { applet->permissions[perm] = nm_client_get_permission_result (applet->nm_client, perm); |