Skip to content

Commit

Permalink
Fix per-device applet menu items
Browse files Browse the repository at this point in the history
With blueman-project#1847 priorities are expected to be unique. Otherwise the items get merged into one, so that there is only one disconnect and only one audio profile item as no explicit sub-indexes got added there.

Fixes blueman-project#1861
  • Loading branch information
cschramm committed Sep 21, 2022
1 parent 817bdbd commit e41360d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions blueman/plugins/applet/DisconnectItems.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def on_device_property_changed(self, path: str, key: str, value: Any) -> None:
self._render()

def _render(self) -> None:
for device in self.parent.Manager.get_devices():
for idx, device in enumerate(self.parent.Manager.get_devices()):
if device["Connected"]:
self._menu.add(self, 25, text=_("Disconnect %s") % device["Alias"],
self._menu.add(self, (25, idx), text=_("Disconnect %s") % device["Alias"],
icon_name="bluetooth-disconnected-symbolic",
callback=lambda dev=device: dev.disconnect())
2 changes: 1 addition & 1 deletion blueman/plugins/applet/PulseAudioProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _generate_profiles_menu(info: "CardInfo") -> List["SubmenuItemDict"]:
return items

info = self._devices[device['Address']]
menu = self._menu.add(self, 42, _("Audio Profiles for %s") % device['Alias'],
menu = self._menu.add(self, (42, info["index"]), _("Audio Profiles for %s") % device['Alias'],
icon_name="audio-card-symbolic",
submenu_function=lambda: _generate_profiles_menu(info))
self._device_menus[device['Address']] = menu
Expand Down

0 comments on commit e41360d

Please sign in to comment.