/srv/mercurial-server/detachablepurple: 2e6b5aacce3a: purple_obj...
Gilles Bedel
gillux at cpw.pidgin.im
Fri Jun 15 22:01:33 EDT 2012
Changeset: 2e6b5aacce3a760fbf182614e2e62e4c84f9d5cb
Author: Gilles Bedel <gillux at cpw.pidgin.im>
Date: 2012-05-12 19:14 +0000
Branch: cpw.gillux.detachablepurple
URL: http://hg.pidgin.im/srv/mercurial-server/detachablepurple/rev/2e6b5aacce3a
Description:
purple_object_generic_dbus_method_handler() now handles return values.
This means that any D-Bus method is now able to return values.
The method handler needs to pack its return value in a GVariant, though.
diffstat:
libpurple/pobject.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diffs (42 lines):
diff --git a/libpurple/pobject.c b/libpurple/pobject.c
--- a/libpurple/pobject.c
+++ b/libpurple/pobject.c
@@ -730,6 +730,7 @@
gpointer object)
{
GValue *paramv;
+ GValue ret_val = {0, };
GClosure *closure;
guint i, num_params;
@@ -744,15 +745,27 @@
/* Prepare the closure parameters. */
gvariant_to_gvalue_closure_args(object, params, ¶mv, &num_params);
+/* We don't want to force such a recent version, so keep a shitty workaround. */
+#if GLIB_CHECK_VERSION(2, 32, 1)
+ g_value_init(&ret_val, G_TYPE_VARIANT);
/* Execute the callback. */
- g_closure_invoke(closure, NULL, num_params, paramv, NULL);
- /* TODO: handle output parameters. */
- g_dbus_method_invocation_return_value(invoc, NULL);
+ g_closure_invoke(closure, &ret_val, num_params, paramv, NULL);
+ g_dbus_method_invocation_return_value(invoc,
+ g_value_get_variant(&ret_val));
+#else
+ g_value_init(&ret_val, G_TYPE_POINTER);
+
+ /* Execute the callback. */
+ g_closure_invoke(closure, &ret_val, num_params, paramv, NULL);
+ g_dbus_method_invocation_return_value(invoc,
+ (GVariant*)g_value_get_pointer(&ret_val));
+#endif
for (i = 0; i < num_params; i++)
g_value_unset (¶mv[i]);
g_free (paramv);
+ g_value_unset(&ret_val);
}
GVariant *
More information about the Commits
mailing list