[network-manager-applet/nm-1-4] applet: fix wrong status for wireless toggle
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/nm-1-4] applet: fix wrong status for wireless toggle
- Date: Tue, 30 Aug 2016 14:02:44 +0000 (UTC)
commit 28cba2299dae50ebe1a1ef156c288fb415059b97
Author: Kai-Heng Feng <kai heng feng canonical com>
Date: Tue Aug 30 13:36:28 2016 +0800
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>
(cherry picked from commit c7533cfcd9c761a152a66f608808187df3155521)
src/applet.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index 08be772..8b6b616 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]