[gnome-bluetooth] lib: Add "device-removed" signal
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] lib: Add "device-removed" signal
- Date: Fri, 6 Dec 2013 11:02:45 +0000 (UTC)
commit 574ee78e47e8244bf0876346ab9be9d6583e9ca9
Author: Bastien Nocera <hadess hadess net>
Date: Thu Dec 5 16:28:52 2013 +0100
lib: Add "device-removed" signal
This allows us to easily identify devices that were removed,
which listening to the model's row-deleted doesn't allow us to do.
lib/bluetooth-client.c | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 6290d83..d83c8d6 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -75,6 +75,13 @@ enum {
PROP_DEFAULT_ADAPTER_DISCOVERING
};
+enum {
+ DEVICE_REMOVED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
static const char *connectable_uuids[] = {
"HSP",
"AudioSource",
@@ -430,8 +437,10 @@ device_removed (const char *path,
BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
GtkTreeIter iter;
- if (get_iter_from_path(priv->store, &iter, path) == TRUE)
+ if (get_iter_from_path(priv->store, &iter, path) == TRUE) {
+ g_signal_emit (G_OBJECT (client), signals[DEVICE_REMOVED], 0, path);
gtk_tree_store_remove(priv->store, &iter);
+ }
}
static void
@@ -1130,6 +1139,23 @@ static void bluetooth_client_class_init(BluetoothClientClass *klass)
object_class->set_property = bluetooth_client_set_property;
/**
+ * BluetoothClient::device-removed:
+ * @client: a #BluetoothClient object which received the signal
+ * @device: the D-Bus object path for the now-removed device
+ *
+ * The #BluetoothClient::device-removed signal is launched when a
+ * device gets removed from the model.
+ **/
+ signals[DEVICE_REMOVED] =
+ g_signal_new ("device-removed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
+
+ /**
* BluetoothClient:default-adapter:
*
* The D-Bus path of the default Bluetooth adapter or %NULL.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]