diff --git a/src/components/bluetooth/bluetoothBox.rs b/src/components/bluetooth/bluetoothBox.rs index c10aa6d..a5af1b6 100644 --- a/src/components/bluetooth/bluetoothBox.rs +++ b/src/components/bluetooth/bluetoothBox.rs @@ -12,7 +12,7 @@ use dbus::message::SignalArgs; use dbus::{Error, Path}; use glib::{clone, Cast}; use gtk::glib::Variant; -use gtk::prelude::{ActionableExt, ListBoxRowExt, WidgetExt}; +use gtk::prelude::{ActionableExt, BoxExt, ListBoxRowExt, WidgetExt}; use gtk::{gio, StringObject}; use ReSet_Lib::bluetooth::bluetooth::{BluetoothAdapter, BluetoothDevice}; use ReSet_Lib::signals::{BluetoothDeviceAdded, BluetoothDeviceChanged, BluetoothDeviceRemoved}; @@ -217,7 +217,6 @@ pub fn start_bluetooth_listener(listeners: Arc, bluetooth_box: Arc, bluetooth_box: Arc() { + if let Ok(entry) = x { // todo test this + if let Some(item) = entry.downcast_ref::() { + imp.resetBluetoothAvailableDevices.remove(item); + } + } + }; }); }); println!("stopping bluetooth listener"); diff --git a/src/components/bluetooth/bluetoothBoxImpl.rs b/src/components/bluetooth/bluetoothBoxImpl.rs index 46b2cc5..878f23a 100644 --- a/src/components/bluetooth/bluetoothBoxImpl.rs +++ b/src/components/bluetooth/bluetoothBoxImpl.rs @@ -1,7 +1,7 @@ use adw::{ActionRow, ComboRow}; use dbus::Path; use gtk::subclass::prelude::*; -use gtk::{glib, CompositeTemplate, ListBox, Switch}; +use gtk::{glib, CompositeTemplate, ListBox, Switch, Button}; use gtk::{prelude::*, StringList}; use std::cell::RefCell; use std::collections::HashMap; @@ -22,11 +22,13 @@ pub struct BluetoothBox { #[template_child] pub resetBluetoothSwitch: TemplateChild, #[template_child] - pub resetBluetoothAvailableDevices: TemplateChild, + pub resetBluetoothAvailableDevices: TemplateChild, + #[template_child] + pub resetBluetoothRefreshButton: TemplateChild