[GLIB] gdbusconnection: Add convenience _with_unix_fd_list variant for g_dbus_connection_emit_signal()
- From: "Dumez, Christophe" <christophe dumez intel com>
- To: gtk-devel-list gnome org
- Cc: Patrick Ohly <patrick ohly intel com>, davidz redhat com
- Subject: [GLIB] gdbusconnection: Add convenience _with_unix_fd_list variant for g_dbus_connection_emit_signal()
- Date: Mon, 19 Sep 2011 13:57:59 +0300
Hi,
The following commit added support for new org.gtk.GDBus.C.UnixFD annotation as well as convenience _with_unix_fd_list variants to GDBusConnection,
GDBusProxy and GDBusMethodInvocation types to easily support it:
http://git.gnome.org/browse/glib/commit/?id=c404dbed11bc8bf4212d15719ef3a87ebf76efff
However, no _with_unix_fd_list variant was added for g_dbus_connection_emit_signal(). I believe this is useful and should be provided as well.
Please find attached a patch to add g_dbus_connection_emit_signal_with_unix_fd_list() to GDBusConnection.
Could someone please review it and possibly commit it if acceptable?
Thanks in advance,
--
Christophe Dumez
Linux Software Engineer, PhD
Intel Finland Oy - Open Source Technology Center
From b19b949db5cb73bdb6c2753b354e5f53e3df110d Mon Sep 17 00:00:00 2001
From: Christophe Dumez <christophe dumez intel com>
Date: Mon, 19 Sep 2011 13:47:18 +0300
Subject: [PATCH] gdbusconnection: Add convenience _with_unix_fd_list variant
for g_dbus_connection_emit_signal()
Commit c404dbed11bc8bf4212d15719ef3a87ebf76efff added
_with_unix_fd_list variants to GDBusConnection but not for
g_dbus_connection_emit_signal().
---
gio/gdbusconnection.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++
gio/gdbusconnection.h | 8 +++++
2 files changed, 89 insertions(+), 0 deletions(-)
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index a54972b..8e139df 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -4896,6 +4896,87 @@ g_dbus_connection_emit_signal (GDBusConnection *connection,
return ret;
}
+#ifdef G_OS_UNIX
+/**
+ * g_dbus_connection_emit_signal_with_unix_fd_list:
+ * @connection: A #GDBusConnection.
+ * @destination_bus_name: (allow-none): The unique bus name for the destination
+ * for the signal or %NULL to emit to all listeners.
+ * @object_path: Path of remote object.
+ * @interface_name: D-Bus interface to emit a signal on.
+ * @signal_name: The name of the signal to emit.
+ * @parameters: (allow-none): A #GVariant tuple with parameters for the signal
+ * or %NULL if not passing parameters.
+ * @fd_list: (allow-none): A #GUnixFDList or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Like g_dbus_connection_emit_signal() but also takes a #GUnixFDList object.
+ *
+ * This method is only available on UNIX.
+ *
+ * Since: 2.30
+ */
+gboolean
+g_dbus_connection_emit_signal_with_unix_fd_list (GDBusConnection *connection,
+ const gchar *destination_bus_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ GUnixFDList *fd_list,
+ GError **error)
+{
+ GDBusMessage *message;
+ gboolean ret;
+
+ message = NULL;
+ ret = FALSE;
+
+ g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), FALSE);
+ g_return_val_if_fail (destination_bus_name == NULL || g_dbus_is_name (destination_bus_name), FALSE);
+ g_return_val_if_fail (object_path != NULL && g_variant_is_object_path (object_path), FALSE);
+ g_return_val_if_fail (interface_name != NULL && g_dbus_is_interface_name (interface_name), FALSE);
+ g_return_val_if_fail (signal_name != NULL && g_dbus_is_member_name (signal_name), FALSE);
+ g_return_val_if_fail (parameters == NULL || g_variant_is_of_type (parameters, G_VARIANT_TYPE_TUPLE), FALSE);
+ g_return_val_if_fail (fd_list == NULL || G_IS_UNIX_FD_LIST (fd_list), FALSE);
+
+ if (G_UNLIKELY (_g_dbus_debug_emission ()))
+ {
+ _g_dbus_debug_print_lock ();
+ g_print ("========================================================================\n"
+ "GDBus-debug:Emission:\n"
+ " >>>> SIGNAL EMISSION %s.%s()\n"
+ " on object %s\n"
+ " destination %s\n",
+ interface_name, signal_name,
+ object_path,
+ destination_bus_name != NULL ? destination_bus_name : "(none)");
+ _g_dbus_debug_print_unlock ();
+ }
+
+ message = g_dbus_message_new_signal (object_path,
+ interface_name,
+ signal_name);
+
+ if (destination_bus_name != NULL)
+ g_dbus_message_set_header (message,
+ G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION,
+ g_variant_new_string (destination_bus_name));
+
+ if (parameters != NULL)
+ g_dbus_message_set_body (message, parameters);
+
+ if (fd_list != NULL)
+ g_dbus_message_set_unix_fd_list (message, fd_list);
+
+ ret = g_dbus_connection_send_message (connection, message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, error);
+ g_object_unref (message);
+
+ return ret;
+}
+
+#endif
+
static void
add_call_flags (GDBusMessage *message,
GDBusCallFlags flags)
diff --git a/gio/gdbusconnection.h b/gio/gdbusconnection.h
index ac131dc..c1d0986 100644
--- a/gio/gdbusconnection.h
+++ b/gio/gdbusconnection.h
@@ -155,6 +155,14 @@ gboolean g_dbus_connection_emit_signal (GDBusConnection
const gchar *signal_name,
GVariant *parameters,
GError **error);
+gboolean g_dbus_connection_emit_signal_with_unix_fd_list (GDBusConnection *connection,
+ const gchar *destination_bus_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ GUnixFDList *fd_list,
+ GError **error);
void g_dbus_connection_call (GDBusConnection *connection,
const gchar *bus_name,
const gchar *object_path,
--
1.7.6.2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]