rename button

This commit is contained in:
takotori 2023-12-06 19:50:22 +01:00
parent 0184fba8b4
commit 4142f3f3a8
3 changed files with 8 additions and 8 deletions

View file

@ -295,14 +295,14 @@ pub fn start_bluetooth_listener(listeners: Arc<Listeners>, bluetooth_box: Arc<Bl
list_entry
.0
.imp()
.button
.remove_device_button
.borrow()
.set_sensitive(true);
} else {
list_entry
.0
.imp()
.button
.remove_device_button
.borrow()
.set_sensitive(false);
}

View file

@ -31,20 +31,20 @@ impl BluetoothEntry {
entry.set_subtitle(&device.address);
entry.set_activatable(true);
entry_imp.button.replace(Button::builder().icon_name("user-trash-symbolic").valign(Align::Center).build());
entry.add_suffix(entry_imp.button.borrow().deref());
entry_imp.remove_device_button.replace(Button::builder().icon_name("user-trash-symbolic").valign(Align::Center).build());
entry.add_suffix(entry_imp.remove_device_button.borrow().deref());
if device.icon.is_empty() {
entry.add_prefix(&Image::from_icon_name("dialog-question-symbolic"));
} else {
entry.add_prefix(&Image::from_icon_name(&device.icon));
}
if device.connected || device.paired {
entry_imp.button.borrow().set_sensitive(true);
entry_imp.remove_device_button.borrow().set_sensitive(true);
} else {
entry_imp.button.borrow().set_sensitive(false);
entry_imp.remove_device_button.borrow().set_sensitive(false);
}
let path = Arc::new(device.path.clone());
entry_imp.button.borrow().connect_clicked(move |_| {
entry_imp.remove_device_button.borrow().connect_clicked(move |_| {
remove_device_pairing((*path).clone());
});
let gesture = GestureClick::new();

View file

@ -9,7 +9,7 @@ use std::cell::RefCell;
#[derive(Default, CompositeTemplate)]
#[template(resource = "/org/Xetibo/ReSet/resetBluetoothEntry.ui")]
pub struct BluetoothEntry {
pub button: RefCell<Button>,
pub remove_device_button: RefCell<Button>,
pub device_name: RefCell<String>,
}