diff options
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 |