From fff64d3f6e8883ab06711e5544de6729a97e1c2e Mon Sep 17 00:00:00 2001 From: Christopher Schramm Date: Wed, 21 Sep 2022 16:43:22 +0200 Subject: [PATCH] Fix per-device applet menu items With #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 #1861 --- blueman/plugins/applet/DisconnectItems.py | 4 ++-- blueman/plugins/applet/PulseAudioProfile.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/blueman/plugins/applet/DisconnectItems.py b/blueman/plugins/applet/DisconnectItems.py index 3ebc6d27c..13a585c0c 100644 --- a/blueman/plugins/applet/DisconnectItems.py +++ b/blueman/plugins/applet/DisconnectItems.py @@ -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()) diff --git a/blueman/plugins/applet/PulseAudioProfile.py b/blueman/plugins/applet/PulseAudioProfile.py index c6c0fdd7a..097a3609a 100644 --- a/blueman/plugins/applet/PulseAudioProfile.py +++ b/blueman/plugins/applet/PulseAudioProfile.py @@ -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