cpw.gillux.detachablepurple: 1945499a: purple_gvariant_to_gvalue_closure_args()...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Fri May 25 15:46:50 EDT 2012


----------------------------------------------------------------------
Revision: 1945499a5666a886a2b049a0260de03406f2c68d
Parent:   916b38c70b2aa2f73c3d627dd51b1f31cb69d4fb
Author:   gillux at soc.pidgin.im
Date:     05/25/12 14:22:18
Branch:   im.pidgin.cpw.gillux.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/1945499a5666a886a2b049a0260de03406f2c68d

Changelog: 

purple_gvariant_to_gvalue_closure_args() now accepts
either an array of GVariant or a tuple.
Will be useful for PurpleDBusCallback's RunCallback signal.

Changes against parent 916b38c70b2aa2f73c3d627dd51b1f31cb69d4fb

  patched  libpurple/util.c
  patched  libpurple/util.h

-------------- next part --------------
============================================================
--- libpurple/util.c	c9c7350b30a026305b8dca1a284bc9009cce679b
+++ libpurple/util.c	ff0de7a3897221078bf611bb3f9715a6a44fb8df
@@ -5271,7 +5271,7 @@ purple_gvariant_to_gvalue_closure_args(g
 purple_gvariant_to_gvalue_closure_args(gpointer object, GVariant *params,
                                        GValue **paramv, guint *num_params)
 {
-	GVariant *next;
+	GVariant *next, *boxed;
 	GVariantIter iter;
 	GValue *gval;
 	guint i;
@@ -5285,9 +5285,18 @@ purple_gvariant_to_gvalue_closure_args(g
 	/* Then the others, if any. */
 	i = 1;
 	g_variant_iter_init (&iter, params);
-	while ((next = g_variant_iter_next_value(&iter)) != NULL) {
-		g_dbus_gvariant_to_gvalue(next, &gval[i++]);
-		g_variant_unref(next);
+	if (g_variant_is_of_type(params, G_VARIANT_TYPE_ARRAY)) {
+		while ((next = g_variant_iter_next_value(&iter)) != NULL) {
+			boxed = g_variant_get_variant(next);
+			g_dbus_gvariant_to_gvalue(boxed, &gval[i++]);
+			g_variant_unref(boxed);
+			g_variant_unref(next);
+		}
+	} else if (g_variant_is_of_type(params, G_VARIANT_TYPE_TUPLE)) {
+		while ((next = g_variant_iter_next_value(&iter)) != NULL) {
+			g_dbus_gvariant_to_gvalue(next, &gval[i++]);
+			g_variant_unref(next);
+		}
 	}
 }
 
============================================================
--- libpurple/util.h	256dca350296c9bc185478bfc6e5194c1b3e092f
+++ libpurple/util.h	d8c527202b831c2b912a33bbff6663139a2cb09f
@@ -1531,7 +1531,8 @@ gchar *purple_http_digest_calculate_resp
  * object prepended. Useful to prepare parameters for a g_closure_invoke().
  *
  * @param object The object instance prepended to the parameters.
- * @param params The parameters in a GVariant array.
+ * @param params The parameters in a GVariant. Either a tuple, or an array of
+ *               GVariants.
  * @param paramv A pointer to an array of GValues that will be created. It
  *               must be freed with something like:
  *               for (i = 0; i < num_params; i++)


More information about the Commits mailing list