aboutsummaryrefslogtreecommitdiff
path: root/src/bluez.vala
diff options
context:
space:
mode:
authorMuhammad <thevancedgamer@mentallysanemainliners.org>2026-03-10 01:37:25 +0500
committerMuhammad <thevancedgamer@mentallysanemainliners.org>2026-03-10 01:37:25 +0500
commit36d77944f2e7707eefd60ea208c6f4bc55a3f961 (patch)
treed6074f6903687b3b278d90abab2d62dcd057d5a8 /src/bluez.vala
parent6c7c62d7c6d153293c8aea8dd1c71faabdef3b3e (diff)
downloadayatana-indicator-bluetooth-36d77944f2e7707eefd60ea208c6f4bc55a3f961.tar.gz
ayatana-indicator-bluetooth-36d77944f2e7707eefd60ea208c6f4bc55a3f961.tar.bz2
ayatana-indicator-bluetooth-36d77944f2e7707eefd60ea208c6f4bc55a3f961.zip
agent: add proper support for AuthorizeService
Signed-off-by: Muhammad <thevancedgamer@mentallysanemainliners.org>
Diffstat (limited to 'src/bluez.vala')
-rw-r--r--src/bluez.vala26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/bluez.vala b/src/bluez.vala
index 8d481f2..353b1a2 100644
--- a/src/bluez.vala
+++ b/src/bluez.vala
@@ -325,6 +325,10 @@ public class Bluez: Bluetooth, Object
v = device_proxy.get_cached_property ("Connected");
var is_connected = (v != null) && v.get_boolean ();
+ // look up whether the device is trusted
+ v = device_proxy.get_cached_property ("Trusted");
+ var is_trusted = (v != null) && v.get_boolean ();
+
// derive the uuid-related attributes we care about
v = device_proxy.get_cached_property ("UUIDs");
uint16[] uuids = {};
@@ -344,6 +348,7 @@ public class Bluez: Bluetooth, Object
icon,
true,
is_connected,
+ is_trusted,
supports_browsing,
supports_file_transfer));
@@ -415,6 +420,19 @@ public class Bluez: Bluetooth, Object
}
}
+ public void set_device_trusted (uint id, bool trusted)
+ {
+ var device = id_to_device.lookup (id);
+ var path = id_to_path.lookup (id);
+ var proxy = (path != null) ? path_to_device_proxy.lookup (path) : null;
+
+ if ((device != null)
+ && (device.is_trusted != trusted))
+ {
+ proxy.trusted = trusted;
+ }
+ }
+
public void try_set_discoverable (bool b)
{
if (discoverable != b)
@@ -440,6 +458,11 @@ public class Bluez: Bluetooth, Object
return id_to_device.get_values();
}
+ public Device get_device (ObjectPath path)
+ {
+ return id_to_device.lookup(path_to_id.lookup(path));
+ }
+
public bool supported { get; protected set; default = false; }
public bool discoverable { get; protected set; default = false; }
public bool enabled { get; protected set; default = false; }
@@ -509,6 +532,9 @@ private interface BluezDevice : DBusProxy {
[DBus (name = "Disconnect")]
public abstract void disconnect_() throws DBusError, IOError;
+
+ [DBus (name = "Trusted")]
+ public abstract bool trusted { get; set; }
}
[DBus (name = "org.bluez.AgentManager1")]