From ecc4b3d0f021012a5f46bb7852bb85cc314468b9 Mon Sep 17 00:00:00 2001 From: Felipe Borges Date: Wed, 3 Aug 2022 10:49:05 +0200 Subject: [PATCH] network: Split airplane-mode widget off main Wi-Fi panel stack The airplane-mode widget (rfkill_widget) on the wifi panel was part of the "wifi-connections" stack page, and it would get hidden whenever the panel switched to another page ("nm-not-running" or "no-wifi-devices"). This way, whenever a user would turn airplane-mode ON, the panel would disable wifi and set the main stack page to "no-wifi-devices", making the airplane-mode widget inaccessible, preventing users from turning airplane-mode OFF in gnome-control-center. These changes reorganize the widget hierarchy as such that the airplane-mode widget is now above the main stack and will persist visible as the main stack changes. --- panels/network/cc-wifi-panel.c | 17 ++ panels/network/wifi.ui | 464 +++++++++++++++++---------------- 2 files changed, 255 insertions(+), 226 deletions(-) diff --git a/panels/network/cc-wifi-panel.c b/panels/network/cc-wifi-panel.c index 2c1cd17b7..989506c6a 100644 --- a/panels/network/cc-wifi-panel.c +++ b/panels/network/cc-wifi-panel.c @@ -411,6 +411,17 @@ wireless_enabled_cb (NMClient *client, check_main_stack_page (self); } +static void +on_rfkill_proxy_properties_changed_cb (GDBusProxy *proxy, + GVariant *changed_properties, + GStrv invalidated_properties, + CcWifiPanel *self) +{ + g_debug ("Rfkill properties changed"); + + sync_airplane_mode_switch (self); +} + static void rfkill_proxy_acquired_cb (GObject *source_object, GAsyncResult *res, @@ -436,6 +447,12 @@ rfkill_proxy_acquired_cb (GObject *source_object, self->rfkill_proxy = proxy; + g_signal_connect_object (proxy, + "g-properties-changed", + G_CALLBACK (on_rfkill_proxy_properties_changed_cb), + self, + 0); + sync_airplane_mode_switch (self); } diff --git a/panels/network/wifi.ui b/panels/network/wifi.ui index a3eab3889..c0f8a06b1 100644 --- a/panels/network/wifi.ui +++ b/panels/network/wifi.ui @@ -4,294 +4,306 @@