Skip to content

Commit

Permalink
ManagerToolbar: Include bluetooth switch when updating sensitive
Browse files Browse the repository at this point in the history
It was sensitive even when no adapter was present.
  • Loading branch information
infirit committed Oct 17, 2024
1 parent 8a44e9f commit bbf6e41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions blueman/gui/manager/ManagerToolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion data/ui/manager-main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
</packing>
</child>
<child>
<object class="GtkSwitch">
<object class="GtkSwitch" id="sw_bluetooth_status">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="halign">center</property>
Expand Down

0 comments on commit bbf6e41

Please sign in to comment.