diff options
author | Bastien Nocera <hadess@hadess.net> | 2021-11-19 15:13:27 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2021-11-30 11:10:26 +0100 |
commit | 311b9b7dd7fef59ba70aee2e92c94ce8e869a178 (patch) | |
tree | a17cd1463a309a9289dfab6fdf08b3b85503a7e2 /lib | |
parent | 3b4bf5a5b07d82028f70887533e10d3a6718b881 (diff) | |
download | gnome-bluetooth-311b9b7dd7fef59ba70aee2e92c94ce8e869a178.tar.gz |
lib: Add API to access a device-specific list model
The model is not populated yet.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bluetooth-client.c | 21 | ||||
-rw-r--r-- | lib/bluetooth-client.h | 1 | ||||
-rw-r--r-- | lib/gnome-bluetooth.map | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c index d4883cea..fa61c680 100644 --- a/lib/bluetooth-client.c +++ b/lib/bluetooth-client.c @@ -42,6 +42,7 @@ #include "bluetooth-client.h" #include "bluetooth-client-private.h" #include "bluetooth-client-glue.h" +#include "bluetooth-device.h" #include "bluetooth-utils.h" #include "gnome-bluetooth-enum-types.h" #include "pin.h" @@ -54,6 +55,7 @@ struct _BluetoothClient { GObject parent; + GListStore *list_store; GDBusObjectManager *manager; GCancellable *cancellable; GtkTreeStore *store; @@ -905,6 +907,7 @@ static void bluetooth_client_init(BluetoothClient *client) G_TYPE_INT, /* BLUETOOTH_COLUMN_LEGACYPAIRING */ G_TYPE_BOOLEAN, /* BLUETOOTH_COLUMN_POWERED */ G_TYPE_STRV); /* BLUETOOTH_COLUMN_UUIDS */ + client->list_store = g_list_store_new (BLUETOOTH_TYPE_DEVICE); g_dbus_object_manager_client_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START, @@ -1096,6 +1099,7 @@ static void bluetooth_client_finalize(GObject *object) } g_clear_object (&client->manager); g_object_unref (client->store); + g_object_unref (client->list_store); g_clear_pointer (&client->default_adapter, gtk_tree_row_reference_free); @@ -1206,6 +1210,23 @@ BluetoothClient *bluetooth_client_new(void) } /** + * bluetooth_client_get_devices: + * @client: a #BluetoothClient object + * + * Returns an unfiltered #GListStore representing the devices attached to the default + * Bluetooth adapter. + * + * Return value: (transfer full): a #GListStore + **/ +GListStore * +bluetooth_client_get_devices (BluetoothClient *client) +{ + g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), NULL); + + return G_LIST_STORE (g_object_ref (client->list_store)); +} + +/** * bluetooth_client_get_model: * @client: a #BluetoothClient object * diff --git a/lib/bluetooth-client.h b/lib/bluetooth-client.h index 85706c68..82b95f3a 100644 --- a/lib/bluetooth-client.h +++ b/lib/bluetooth-client.h @@ -33,6 +33,7 @@ G_DECLARE_FINAL_TYPE (BluetoothClient, bluetooth_client, BLUETOOTH, CLIENT, GObj BluetoothClient *bluetooth_client_new(void); GtkTreeModel *bluetooth_client_get_model(BluetoothClient *client); +GListStore *bluetooth_client_get_devices (BluetoothClient *client); void bluetooth_client_connect_service (BluetoothClient *client, const char *path, diff --git a/lib/gnome-bluetooth.map b/lib/gnome-bluetooth.map index e9fcb898..d5cfc7fe 100644 --- a/lib/gnome-bluetooth.map +++ b/lib/gnome-bluetooth.map @@ -7,6 +7,7 @@ global: bluetooth_client_dump_device; bluetooth_client_get_type; bluetooth_client_new; + bluetooth_client_get_devices; bluetooth_client_get_model; bluetooth_client_connect_service; bluetooth_client_connect_service_finish; |