From 0269d2e3fcd608881a48b00f41515020d4130bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 20 Jun 2024 19:52:39 -0700 Subject: [PATCH] WifiPage: show SSID in sidebar when connected (#403) --- data/network.metainfo.xml.in | 1 + src/Views/WifiPage.vala | 31 +++++++++++++++++++++++++++++++ src/Widgets/Page.vala | 8 ++------ 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/data/network.metainfo.xml.in b/data/network.metainfo.xml.in index 91b91bfa..1ff6152b 100644 --- a/data/network.metainfo.xml.in +++ b/data/network.metainfo.xml.in @@ -33,6 +33,7 @@

Minor updates

diff --git a/src/Views/WifiPage.vala b/src/Views/WifiPage.vala index e5a2c976..0202b986 100644 --- a/src/Views/WifiPage.vala +++ b/src/Views/WifiPage.vala @@ -427,6 +427,37 @@ public class Network.WifiInterface : Network.Widgets.Page { } } + protected override void update_status () { + switch (device.state) { + case ACTIVATED: + status_type = SUCCESS; + break; + case DISCONNECTED: + status_type = OFFLINE; + break; + case FAILED: + status_type = ERROR; + break; + default: + status_type = WARNING; + break; + } + + switch (device.state) { + case UNAVAILABLE: + status = _("Disabled"); + break; + case ACTIVATED: + status = NM.Utils.ssid_to_utf8 ( + ((NM.DeviceWifi) device).active_access_point.get_ssid ().get_data () + ); + break; + default: + status = Utils.state_to_string (device.state); + break; + } + } + protected override void update_switch () { status_switch.active = !software_locked; } diff --git a/src/Widgets/Page.vala b/src/Widgets/Page.vala index 1d737939..84d056b4 100644 --- a/src/Widgets/Page.vala +++ b/src/Widgets/Page.vala @@ -59,7 +59,7 @@ namespace Network.Widgets { show_end_title_buttons = true; } - private void update_status () { + public virtual void update_status () { switch (device.state) { case ACTIVATED: status_type = SUCCESS; @@ -75,11 +75,7 @@ namespace Network.Widgets { break; } - if (device is NM.DeviceWifi && state == UNAVAILABLE) { - status = _("Disabled"); - } else { - status = Utils.state_to_string (device.state); - } + status = Utils.state_to_string (device.state); } public virtual void update () {