summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2018-07-22 19:56:57 -0300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2018-07-22 20:01:27 -0300
commit1a9846ba05db1b69fcbbfe594b2ba9658cfa1632 (patch)
tree69771875025f21d5cfd7a7947671cafa8ef35a71
parenta2bc36fd4cd9dcedebb9a7e32c544d72503a82c1 (diff)
downloadgnome-control-center-gbsneto/wifi-behavior.tar.gz
wi-fi: Add empty state for Airplane Modegbsneto/wifi-behavior
According to the most recent mockups [1], when Airplane Mode is switched on, the Wi-Fi connection will be turned off and the Wi-Fi panel should show an empty state for Airplane Mode. This is currently not implemented in the codebase. This commit adds an Airplane Mode empty state for the Wi-Fi panel, and a small logic adjustment to show it under these circumstances.
-rw-r--r--panels/network/cc-wifi-panel.c11
-rw-r--r--panels/network/cc-wifi-panel.ui47
2 files changed, 55 insertions, 3 deletions
diff --git a/panels/network/cc-wifi-panel.c b/panels/network/cc-wifi-panel.c
index fb77d2e1a..2448f87a2 100644
--- a/panels/network/cc-wifi-panel.c
+++ b/panels/network/cc-wifi-panel.c
@@ -183,17 +183,21 @@ static void
check_main_stack_page (CcWifiPanel *self)
{
const gchar *nm_version;
+ gboolean airplane_mode_active;
+ gboolean wireless_enabled;
nm_version = nm_client_get_version (self->client);
+ wireless_enabled = nm_client_wireless_get_enabled (self->client);
+ airplane_mode_active = gtk_switch_get_active (self->rfkill_switch);
if (!nm_version)
gtk_stack_set_visible_child_name (self->main_stack, "nm-not-running");
- else if (self->devices->len == 0 ||
- !nm_client_wireless_get_enabled (self->client))
+ else if (!wireless_enabled && airplane_mode_active)
+ gtk_stack_set_visible_child_name (self->main_stack, "airplane-mode");
+ else if (!wireless_enabled || self->devices->len == 0)
gtk_stack_set_visible_child_name (self->main_stack, "no-wifi-devices");
else
gtk_stack_set_visible_child_name (self->main_stack, "wifi-connections");
-
}
static void
@@ -247,6 +251,7 @@ sync_airplane_mode_switch (CcWifiPanel *self)
rfkill_switch_notify_activate_cb,
self);
gtk_switch_set_active (self->rfkill_switch, enabled);
+ check_main_stack_page (self);
g_signal_handlers_unblock_by_func (self->rfkill_switch,
rfkill_switch_notify_activate_cb,
self);
diff --git a/panels/network/cc-wifi-panel.ui b/panels/network/cc-wifi-panel.ui
index b50f4eb71..ffc034a72 100644
--- a/panels/network/cc-wifi-panel.ui
+++ b/panels/network/cc-wifi-panel.ui
@@ -175,6 +175,53 @@
</packing>
</child>
+ <!-- "Airplane Mode" page -->
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="expand">True</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">airplane-mode-symbolic</property>
+ <property name="pixel_size">256</property>
+ <property name="margin-bottom">18</property>
+ <style>
+ <class name="dim-label" />
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="wrap">True</property>
+ <property name="label" translatable="yes">Airplane Mode On</property>
+ <attributes>
+ <attribute name="weight" value="bold" />
+ <attribute name="scale" value="1.2" />
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="wrap">True</property>
+ <property name="label" translatable="yes">Turn off to use Wi-Fi</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="name">airplane-mode</property>
+ </packing>
+ </child>
+
<!-- Wi-Fi connections and devices -->
<child>
<object class="GtkBox">