From bbf6e41d9f753d8c02535725453ef2ff8ba5f4ef Mon Sep 17 00:00:00 2001 From: Sander Sweers Date: Thu, 17 Oct 2024 14:16:52 +0200 Subject: [PATCH] ManagerToolbar: Include bluetooth switch when updating sensitive It was sensitive even when no adapter was present. --- blueman/gui/manager/ManagerToolbar.py | 4 ++++ data/ui/manager-main.ui | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/blueman/gui/manager/ManagerToolbar.py b/blueman/gui/manager/ManagerToolbar.py index c87f5fdb8..2c49d2bd4 100644 --- a/blueman/gui/manager/ManagerToolbar.py +++ b/blueman/gui/manager/ManagerToolbar.py @@ -49,6 +49,8 @@ def __init__(self, blueman: "Blueman") -> None: self.b_send.connect("clicked", self.on_action, self.blueman.send) self.b_send.set_homogeneous(False) + self.b_bluetooth_status = blueman.builder.get_widget("sw_bluetooth_status", Gtk.Switch) + self.on_adapter_changed(blueman.List, blueman.List.get_adapter_path()) def on_action(self, _button: Gtk.ToolButton, func: Callable[[Device], None]) -> None: @@ -84,12 +86,14 @@ def _update_buttons(self, adapter: Optional[Adapter]) -> None: self.b_trust.props.sensitive = False self.b_remove.props.sensitive = False self.b_send.props.sensitive = False + self.b_bluetooth_status.props.sensitive = False else: row = self.blueman.List.get(tree_iter, "paired", "trusted", "objpush") self.b_bond.props.sensitive = powered and not row["paired"] self.b_trust.props.sensitive = True self.b_remove.props.sensitive = True self.b_send.props.sensitive = powered and row["objpush"] + self.b_bluetooth_status.props.sensitive = True icon_name = "blueman-untrust-symbolic" if row["trusted"] else "blueman-trust-symbolic" self.b_trust.props.icon_widget = Gtk.Image(icon_name=icon_name, pixel_size=24, visible=True) diff --git a/data/ui/manager-main.ui b/data/ui/manager-main.ui index 7b99578bf..79bc13495 100644 --- a/data/ui/manager-main.ui +++ b/data/ui/manager-main.ui @@ -412,7 +412,7 @@ - + True True center