[gnome-bluetooth/wip/hadess/lib-changes: 4/18] lib: Add device-added signal
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/wip/hadess/lib-changes: 4/18] lib: Add device-added signal
- Date: Mon, 29 Nov 2021 15:36:14 +0000 (UTC)
commit 8d288594b55e4612cc8a37a734123f4affdd6a09
Author: Bastien Nocera <hadess hadess net>
Date: Fri Nov 26 13:28:35 2021 +0100
lib: Add device-added signal
lib/bluetooth-client.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 0310d36d..751e2e1e 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -77,6 +77,7 @@ enum {
};
enum {
+ DEVICE_ADDED,
DEVICE_REMOVED,
LAST_SIGNAL
};
@@ -474,6 +475,7 @@ device_added (GDBusObjectManager *manager,
"proxy", device,
NULL);
g_list_store_append (client->list_store, device_obj);
+ g_signal_emit (G_OBJECT (client), signals[DEVICE_ADDED], 0, device_obj);
}
}
@@ -611,6 +613,7 @@ add_devices_to_list_store (BluetoothClient *client)
"proxy", DEVICE1 (iface),
NULL);
g_list_store_append (client->list_store, device_obj);
+ g_signal_emit (G_OBJECT (client), signals[DEVICE_ADDED], 0, device_obj);
}
g_list_free_full (object_list, g_object_unref);
}
@@ -1221,6 +1224,23 @@ static void bluetooth_client_class_init(BluetoothClientClass *klass)
object_class->get_property = bluetooth_client_get_property;
object_class->set_property = bluetooth_client_set_property;
+ /**
+ * BluetoothClient::device-added:
+ * @client: a #BluetoothClient object which received the signal
+ * @device: a #BluetoothDevice object
+ *
+ * The #BluetoothClient::device-added signal is launched when a
+ * device gets added to the model.
+ **/
+ signals[DEVICE_ADDED] =
+ g_signal_new ("device-added",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, G_TYPE_OBJECT);
+
/**
* BluetoothClient::device-removed:
* @client: a #BluetoothClient object which received the signal
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]