From b9da351a3dec660e0de3d7e1673383ccd6d2d017 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sun, 22 Jul 2018 19:56:57 -0300 Subject: wi-fi: Add empty state for Airplane Mode 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. --- panels/network/cc-wifi-panel.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'panels/network/cc-wifi-panel.c') 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); -- cgit v1.2.1