File tree Expand file tree Collapse file tree 1 file changed +25
-6
lines changed
cosmic-settings/src/pages/networking Expand file tree Collapse file tree 1 file changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -703,11 +703,10 @@ fn devices_view() -> Section<crate::pages::Message> {
703703 } ;
704704
705705 let identifier = widget:: row:: with_capacity ( 3 )
706- . push ( widget:: icon:: from_name ( wifi_icon ( network. strength ) ) )
707- . push_maybe (
708- is_encrypted
709- . then ( || widget:: icon:: from_name ( "connection-secure-symbolic" ) ) ,
710- )
706+ . push ( widget:: icon:: from_name ( wifi_icon (
707+ network. strength ,
708+ is_encrypted,
709+ ) ) )
711710 . push (
712711 widget:: text:: body ( network. ssid . as_ref ( ) ) . wrapping ( Wrapping :: Glyph ) ,
713712 )
@@ -903,7 +902,27 @@ pub fn update_devices(conn: zbus::Connection) -> Task<crate::app::Message> {
903902 } )
904903}
905904
906- fn wifi_icon ( strength : u8 ) -> & ' static str {
905+ fn wifi_icon ( strength : u8 , is_encrypted : bool ) -> & ' static str {
906+ if is_encrypted {
907+ wifi_icon_secure ( strength)
908+ } else {
909+ wifi_icon_open ( strength)
910+ }
911+ }
912+
913+ fn wifi_icon_secure ( strength : u8 ) -> & ' static str {
914+ if strength < 25 {
915+ "network-wireless-secure-signal-weak-symbolic"
916+ } else if strength < 50 {
917+ "network-wireless-secure-signal-ok-symbolic"
918+ } else if strength < 75 {
919+ "network-wireless-secure-signal-good-symbolic"
920+ } else {
921+ "network-wireless-secure-signal-excellent-symbolic"
922+ }
923+ }
924+
925+ fn wifi_icon_open ( strength : u8 ) -> & ' static str {
907926 if strength < 25 {
908927 "network-wireless-signal-weak-symbolic"
909928 } else if strength < 50 {
You can’t perform that action at this time.
0 commit comments