[gnome-bluetooth/wip/hadess/lib-changes: 3/8] lib: Add BluetoothDevice helper to get object path




commit 1dc15299db2d2f8f071fb22e2e541069b5dab520
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Nov 19 15:16:02 2021 +0100

    lib: Add BluetoothDevice helper to get object path
    
    From the stored GDBusProxy.

 lib/bluetooth-device.c | 10 ++++++++++
 lib/bluetooth-device.h |  1 +
 2 files changed, 11 insertions(+)
---
diff --git a/lib/bluetooth-device.c b/lib/bluetooth-device.c
index 5821ee30..4ba8b774 100644
--- a/lib/bluetooth-device.c
+++ b/lib/bluetooth-device.c
@@ -208,6 +208,16 @@ bluetooth_device_init (BluetoothDevice *device)
 {
 }
 
+const char *
+bluetooth_device_get_object_path (BluetoothDevice *device)
+{
+       g_return_val_if_fail (BLUETOOTH_IS_DEVICE (device), NULL);
+
+       if (device->proxy == NULL)
+               return NULL;
+       return g_dbus_proxy_get_object_path (device->proxy);
+}
+
 #define BOOL_STR(x) (x ? "True" : "False")
 
 void
diff --git a/lib/bluetooth-device.h b/lib/bluetooth-device.h
index 89a1e608..46408a44 100644
--- a/lib/bluetooth-device.h
+++ b/lib/bluetooth-device.h
@@ -13,4 +13,5 @@
 #define BLUETOOTH_TYPE_DEVICE (bluetooth_device_get_type())
 G_DECLARE_FINAL_TYPE (BluetoothDevice, bluetooth_device, BLUETOOTH, DEVICE, GObject)
 
+const char *bluetooth_device_get_object_path (BluetoothDevice *device);
 void bluetooth_device_dump_device (BluetoothDevice *device);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]