Skip to content

Commit

Permalink
DeviceSelectorDialog: Set initial selected device
Browse files Browse the repository at this point in the history
The list is already populated so we can't rely on the device-selected
signal to set the selected device. fixes #2500
  • Loading branch information
infirit committed Sep 27, 2024
1 parent 97eaf6a commit 136e947
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion blueman/gui/DeviceSelectorDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@


class DeviceSelectorDialog(Gtk.Dialog):
selection: Optional[Tuple[str, Optional[Device]]]

def __init__(self, title: str = _("Select Device"), parent: Optional[Gtk.Container] = None, discover: bool = True,
adapter_name: Optional[str] = None) -> None:
super().__init__(title=title, name="DeviceSelectorDialog", parent=parent, icon_name="blueman", resizable=False)
Expand All @@ -25,7 +27,11 @@ def __init__(self, title: str = _("Select Device"), parent: Optional[Gtk.Contain
self.selector = DeviceSelectorWidget(adapter_name=adapter_name, visible=True)
self.vbox.pack_start(self.selector, True, True, 0)

self.selection: Optional[Tuple[str, Optional[Device]]] = None
selected_device = self.selector.List.get_selected_device()
if selected_device is not None:
self.selection = selected_device["Adapter"], selected_device
else:
self.selection = None

self.selector.List.connect("device-selected", self.on_device_selected)
self.selector.List.connect("adapter-changed", self.on_adapter_changed)
Expand Down

0 comments on commit 136e947

Please sign in to comment.