File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
cosmic-settings/src/pages/bluetooth Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,8 @@ impl PartialEq for Adapter {
158158
159159impl Eq for Adapter { }
160160
161+ const default_device_icon: & str = "bluetooth-symbolic" ;
162+
161163fn device_type_to_icon ( device_type : & str ) -> & ' static str {
162164 match device_type {
163165 "computer" => "laptop-symbolic" ,
@@ -173,7 +175,7 @@ fn device_type_to_icon(device_type: &str) -> &'static str {
173175 "input-mouse" => "input-mouse-symbolic" ,
174176 "printer" => "printer-network-symbolic" ,
175177 "camera-photo" => "camera-photo-symbolic" ,
176- _ => "bluetooth-symbolic" ,
178+ _ => default_device_icon ,
177179 }
178180}
179181
@@ -266,6 +268,10 @@ impl Device {
266268 self . alias . is_some ( )
267269 }
268270 #[ must_use]
271+ pub fn is_known_device_type ( & self ) -> bool {
272+ self . icon != default_device_icon
273+ }
274+ #[ must_use]
269275 pub fn alias_or_addr ( & self ) -> & str {
270276 self . alias . as_ref ( ) . unwrap_or ( & self . address )
271277 }
Original file line number Diff line number Diff line change @@ -746,6 +746,10 @@ fn available_devices() -> Section<crate::pages::Message> {
746746 return None :: < Element < ' _ , Message > > ;
747747 }
748748
749+ if !device. is_known_device_type ( ) && !device. has_alias ( ) {
750+ return None :: < Element < ' _ , Message > > ;
751+ }
752+
749753 let mut items = vec ! [
750754 widget:: icon:: from_name( device. icon) . size( 16 ) . into( ) ,
751755 text( device. alias_or_addr( ) ) . wrapping( Wrapping :: Word ) . into( ) ,
You can’t perform that action at this time.
0 commit comments