diff options
| author | Muhammad <thevancedgamer@mentallysanemainliners.org> | 2025-07-22 21:05:43 +0500 |
|---|---|---|
| committer | Muhammad <thevancedgamer@mentallysanemainliners.org> | 2025-07-22 21:08:52 +0500 |
| commit | 6c7c62d7c6d153293c8aea8dd1c71faabdef3b3e (patch) | |
| tree | f8711ae61fc52604e4cad744d35d5121b1f89494 /src/service.vala | |
| parent | 568f6aa32e290b4e37b61dfd9985ae81a08e2892 (diff) | |
| download | ayatana-indicator-bluetooth-6c7c62d7c6d153293c8aea8dd1c71faabdef3b3e.tar.gz ayatana-indicator-bluetooth-6c7c62d7c6d153293c8aea8dd1c71faabdef3b3e.tar.bz2 ayatana-indicator-bluetooth-6c7c62d7c6d153293c8aea8dd1c71faabdef3b3e.zip | |
agent: Add support for PIN and passkeys on Lomiri
* Passkey/PIN display is slightly wonky right now, BlueZ doesn't call
the Cancel() method once pairing is done, so you have to swipe away
the notification manually. But apart from that, everything else works.
Signed-off-by: Muhammad <thevancedgamer@mentallysanemainliners.org>
Diffstat (limited to 'src/service.vala')
| -rw-r--r-- | src/service.vala | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/service.vala b/src/service.vala index e651811..cff90d3 100644 --- a/src/service.vala +++ b/src/service.vala @@ -30,9 +30,15 @@ public class Service: Object private SimpleActionGroup actions; private HashTable<string,Profile> profiles; private Bluetooth bluetooth; + private Agent agent; private DBusConnection connection; private uint exported_action_id; + + private uint exported_agent_action_id; + private uint exported_agent_menu_id; + private const string OBJECT_PATH = "/org/ayatana/indicator/bluetooth"; + private const string AGENT_OBJECT_PATH = "/org/ayatana/indicator/bluetooth/agent"; private void unexport () { @@ -47,6 +53,18 @@ public class Service: Object connection.unexport_action_group (exported_action_id); exported_action_id = 0; } + + if (exported_agent_menu_id != 0) + { + connection.unexport_menu_model (exported_agent_menu_id); + exported_agent_menu_id = 0; + } + + if (exported_agent_action_id != 0) + { + connection.unexport_action_group (exported_agent_action_id); + exported_agent_action_id = 0; + } } } @@ -54,6 +72,9 @@ public class Service: Object { actions = new SimpleActionGroup (); bluetooth = bluetooth_service; + agent = new Agent (bluetooth); + agent.actions_path = AGENT_OBJECT_PATH; + agent.menu_path = AGENT_OBJECT_PATH; profiles = new HashTable<string,Profile> (str_hash, str_equal); profiles.insert ("phone", new Phone (bluetooth, actions)); @@ -84,7 +105,7 @@ public class Service: Object null); bluetooth.agent_manager_ready.connect (() => { - bluetooth.add_agent ("/agent"); + bluetooth.add_agent (AGENT_OBJECT_PATH); }); loop = new MainLoop (null, false); @@ -101,7 +122,7 @@ public class Service: Object { try { - connection.register_object ("/agent", new Agent (bluetooth)); + connection.register_object (AGENT_OBJECT_PATH, agent); } catch (GLib.IOError pError) { @@ -119,6 +140,11 @@ public class Service: Object debug (@"exporting action group '$(OBJECT_PATH)'"); exported_action_id = connection.export_action_group (OBJECT_PATH, actions); + + exported_agent_action_id = connection.export_action_group (AGENT_OBJECT_PATH, + agent.actions); + exported_agent_menu_id = connection.export_menu_model (AGENT_OBJECT_PATH, + agent.menu); } catch (Error e) { |
