[gnome-control-center] wifi: Show the "Wi-Fi disabled" page if it is disabled



commit e047753ea61832a4833da8d803ab6d8a72ba7b60
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Feb 20 18:21:47 2018 +0100

    wifi: Show the "Wi-Fi disabled" page if it is disabled
    
    Rather than an empty "Visible Networks" table.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=793647

 panels/network/cc-wifi-panel.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/panels/network/cc-wifi-panel.c b/panels/network/cc-wifi-panel.c
index 7fceb354a..2c1cd17b7 100644
--- a/panels/network/cc-wifi-panel.c
+++ b/panels/network/cc-wifi-panel.c
@@ -125,7 +125,8 @@ check_main_stack_page (CcWifiPanel *self)
 
   if (!nm_version)
     gtk_stack_set_visible_child_name (self->main_stack, "nm-not-running");
-  else if (self->devices->len == 0)
+  else if (self->devices->len == 0 ||
+           !nm_client_wireless_get_enabled (self->client))
     gtk_stack_set_visible_child_name (self->main_stack, "no-wifi-devices");
   else
     gtk_stack_set_visible_child_name (self->main_stack, "wifi-connections");
@@ -402,6 +403,14 @@ device_removed_cb (NMClient    *client,
   check_main_stack_page (self);
 }
 
+static void
+wireless_enabled_cb (NMClient    *client,
+                     NMDevice    *device,
+                     CcWifiPanel *self)
+{
+  check_main_stack_page (self);
+}
+
 static void
 rfkill_proxy_acquired_cb (GObject      *source_object,
                           GAsyncResult *res,
@@ -622,6 +631,11 @@ cc_wifi_panel_init (CcWifiPanel *self)
                     G_CALLBACK (device_removed_cb),
                     self);
 
+  g_signal_connect (self->client,
+                    "notify::wireless-enabled",
+                    G_CALLBACK (wireless_enabled_cb),
+                    self);
+
   /* Load Wi-Fi devices */
   load_wifi_devices (self);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]