diff options
author | Aylur <[email protected]> | 2024-08-04 01:31:19 +0200 |
---|---|---|
committer | Aylur <[email protected]> | 2024-08-04 01:31:19 +0200 |
commit | 652e23a6fd7da58461bbf0a1b022be0d0a0896f4 (patch) | |
tree | 996c1acc7ce181e16c98573300520339ff4b9771 /src/accesspoint.vala | |
parent | 99e46734e2a23a2bb9d1aa6e1775eda85105ce0e (diff) |
feat: accesspoint icons
Diffstat (limited to 'src/accesspoint.vala')
-rw-r--r-- | src/accesspoint.vala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/accesspoint.vala b/src/accesspoint.vala index cc2eb4b..3c51018 100644 --- a/src/accesspoint.vala +++ b/src/accesspoint.vala @@ -8,6 +8,7 @@ public class AstalNetwork.AccessPoint : Object { public int last_seen { get { return ap.last_seen; } } public uint max_bitrate { get { return ap.max_bitrate; } } public uint8 strength { get { return ap.strength; } } + public string icon_name { get; private set; } public NM.80211Mode mode { get { return ap.mode; } } public NM.80211ApFlags flags { get { return ap.flags; } } public NM.80211ApSecurityFlags rsn_flags { get { return ap.rsn_flags; } } @@ -28,7 +29,18 @@ public class AstalNetwork.AccessPoint : Object { ap.notify.connect((pspec) => { if (get_class().find_property(pspec.name) != null) notify_property(pspec.name); + if (pspec.name == "strength") + icon_name = _icon(); }); + icon_name = _icon(); + } + + private string _icon() { + if (strength >= 80) return Wifi.ICON_EXCELLENT; + if (strength >= 60) return Wifi.ICON_GOOD; + if (strength >= 40) return Wifi.ICON_OK; + if (strength >= 20) return Wifi.ICON_WEAK; + return Wifi.ICON_NONE; } // TODO: connect to ap |