Skip to content

Commit

Permalink
Move the toggle logic to the StandardItems plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
roket1428 authored and infirit committed May 17, 2024
1 parent 76fd9e5 commit 1bca848
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
12 changes: 3 additions & 9 deletions blueman/main/DBusProxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self) -> None:
object_path="/org/blueman/Manager",
flags=Gio.DBusProxyFlags.DO_NOT_AUTO_START_AT_CONSTRUCTION)

def _activate(self) -> None:
def activate(self) -> None:
try:
param = GLib.Variant('(a{sv})', ({},))
self.call_sync("Activate", param, Gio.DBusCallFlags.NONE, -1, None)
Expand Down Expand Up @@ -79,11 +79,5 @@ def call_finish(proxy: "ManagerService", resp: Gio.AsyncResult) -> None:
param = GLib.Variant('(sava{sv})', (name, [], {}))
self.call('ActivateAction', param, Gio.DBusCallFlags.NONE, -1, None, call_finish)

def startstop(self) -> None:
if Gio.Settings(schema_id='org.blueman.plugins.standarditems')['toggle-manager-onclick']:
if self.get_name_owner() is None:
self._activate()
else:
self._call_action("Quit")
else:
self._activate()
def quit(self) -> None:
self._call_action("Quit")
5 changes: 4 additions & 1 deletion blueman/plugins/applet/StandardItems.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ def on_send(self) -> None:

def on_devices(self) -> None:
m = ManagerService()
m.startstop()
if m.get_name_owner() and self.get_option("toggle-manager-onclick"):
m.quit()
else:
m.activate()

def on_adapters(self) -> None:
launch("blueman-adapters", name=_("Adapter Preferences"))
Expand Down

0 comments on commit 1bca848

Please sign in to comment.