GNOME Bugzilla – Bug 659465
gdbusconnection: Add convenience _with_unix_fd_list variant for g_dbus_connection_emit_signal()
Last modified: 2011-09-19 14:44:42 UTC
Created attachment 196931 [details] [review] Proposed patch 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?
No, this wasn't added because a) it's generally not useful (except for benchmarking etc.); and b) you can already do this by just constructing a suitable GDBusMessage and sending it yourself. For future reference, the patch is missing additions to gio/gio.symbols and docs/reference/gio/gio-sections.txt. But no need to update the patch because of a) and b). Thanks anyway.
I was looking at evolution-data-server 3.2 code and it is using g_dbus_connection_emit_signal() to send data back from the server to the client. As a consequence, I felt it would be useful to have an equivalent that supports FD passing. I realize it is possible to do it by constructing the GDBusMessage myself but it felt cleaner to keep using signals as in the rest of the E-D-S code. If you still feel this is not useful, then I'll probably use the alternative. However, the code will be different for some functions just because they use FD passing. I personally don't see much harm in having a _with_unix_fd_list variant for g_dbus_connection_emit_signal() as well.
Nah - it's not really good D-Bus API design to attach file descriptors to signals (especially not multi-cast signals - consider that this puts stress on the bus daemon since it has to duplicate and pass the fd N times - one for each recipient of the signal) so I don't think we should add convenience API for it. The only reason that the _with_unix_fd_list variants were added was to make life simpler for the code generator.