[glib/wip/kdbus-junk: 26/37] [kdbus] Add possibility to unsubscribe NameAcquired and NameLost signals
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/kdbus-junk: 26/37] [kdbus] Add possibility to unsubscribe NameAcquired and NameLost signals
- Date: Wed, 10 Dec 2014 15:59:24 +0000 (UTC)
commit defb6c810ad5b8be047539969862e0ce1ff6fcd5
Author: Lukasz Skalski <l skalski samsung com>
Date: Wed Oct 29 14:15:15 2014 +0000
[kdbus] Add possibility to unsubscribe NameAcquired and NameLost signals
gio/gdbusconnection.c | 5 +++-
gio/gkdbus.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
gio/gkdbus.h | 4 +++
3 files changed, 59 insertions(+), 1 deletions(-)
---
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index 680062e..09b5598 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -4184,7 +4184,10 @@ unsubscribe_id_internal (GDBusConnection *connection,
{
if (G_IS_KDBUS_CONNECTION (connection->stream))
{
- //_g_kdbus_unsubscribe_name_lost_and_acquired (connection, arg0);
+ if (g_strcmp0 (signal_data->member, "NameAcquired") == 0)
+ _g_kdbus_unsubscribe_name_acquired (connection);
+ else if (g_strcmp0 (signal_data->member, "NameLost") == 0)
+ _g_kdbus_unsubscribe_name_lost (connection);
}
}
diff --git a/gio/gkdbus.c b/gio/gkdbus.c
index a2cde10..fa5083c 100644
--- a/gio/gkdbus.c
+++ b/gio/gkdbus.c
@@ -1236,6 +1236,29 @@ _g_kdbus_GetConnectionUnixUser (GDBusConnection *connection,
/*
+ * _g_kdbus_match_remove:
+ *
+ */
+static void
+_g_kdbus_match_remove (GDBusConnection *connection,
+ guint cookie)
+{
+ GKdbus *kdbus;
+ struct kdbus_cmd_match cmd_match = {};
+ gint ret;
+
+ kdbus = _g_kdbus_connection_get_kdbus (G_KDBUS_CONNECTION (g_dbus_connection_get_stream (connection)));
+
+ cmd_match.size = sizeof (cmd_match);
+ cmd_match.cookie = cookie;
+
+ ret = ioctl(kdbus->priv->fd, KDBUS_CMD_MATCH_REMOVE, &cmd_match);
+ if (ret < 0)
+ g_warning ("ERROR - %d\n", (int) errno);
+}
+
+
+/*
* _g_kdbus_subscribe_name_acquired:
*
*/
@@ -1400,6 +1423,34 @@ _g_kdbus_subscribe_name_lost (GDBusConnection *connection,
}
+/*
+ * _g_kdbus_unsubscribe_name_acquired:
+ *
+ */
+void
+_g_kdbus_unsubscribe_name_acquired (GDBusConnection *connection)
+{
+ guint64 cookie;
+
+ cookie = 0xbeefbeefbeefbeef;
+ _g_kdbus_match_remove (connection, cookie);
+}
+
+
+/*
+ * _g_kdbus_unsubscribe_name_lost:
+ *
+ */
+void
+_g_kdbus_unsubscribe_name_lost (GDBusConnection *connection)
+{
+ guint64 cookie;
+
+ cookie = 0xdeafdeafdeafdeaf;
+ _g_kdbus_match_remove (connection, cookie);
+}
+
+
/**
* g_kdbus_decode_kernel_msg:
*
diff --git a/gio/gkdbus.h b/gio/gkdbus.h
index df2acb5..48e3add 100644
--- a/gio/gkdbus.h
+++ b/gio/gkdbus.h
@@ -115,6 +115,10 @@ void _g_kdbus_subscribe_name_acquired (GDB
void _g_kdbus_subscribe_name_lost (GDBusConnection *connection,
const gchar *name);
+void _g_kdbus_unsubscribe_name_acquired (GDBusConnection *connection);
+
+void _g_kdbus_unsubscribe_name_lost (GDBusConnection *connection);
+
gssize _g_kdbus_receive (GKdbus *kdbus,
GCancellable *cancellable,
GError **error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]