Skip to content

Commit

Permalink
WifiPage: show SSID in sidebar when connected (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored Jun 21, 2024
1 parent cd94f06 commit 0269d2e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
1 change: 1 addition & 0 deletions data/network.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<p>Minor updates</p>
<ul>
<li>Provide description text on the VPN page</li>
<li>Show connected Wi-Fi network name in sidebar</li>
<li>Updated translations</li>
</ul>
</description>
Expand Down
31 changes: 31 additions & 0 deletions src/Views/WifiPage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 2 additions & 6 deletions src/Widgets/Page.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 () {
Expand Down

0 comments on commit 0269d2e

Please sign in to comment.