From 154caa2115e1a3350e0e9d619160c1a04d4b022f Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Wed, 17 Oct 2012 10:06:24 +0300 Subject: [PATCH] Support GValues of type G_TYPE_VARIANT Allow passing more complex types to signon_auth_session_process() by supporting GValues containing a GVariant. http://code.google.com/p/accounts-sso/issues/detail?id=121 --- libsignon-glib/signon-utils.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libsignon-glib/signon-utils.c b/libsignon-glib/signon-utils.c index 4321af2..aff590e 100644 --- a/libsignon-glib/signon-utils.c +++ b/libsignon-glib/signon-utils.c @@ -103,9 +103,17 @@ GVariant *signon_hash_table_to_variant (const GHashTable *hash_table) while (g_hash_table_iter_next (&iter, (gpointer)&key, (gpointer)&value)) { GVariant *val; - const GVariantType *type; - type = signon_gtype_to_variant_type (G_VALUE_TYPE (value)); - val = g_dbus_gvalue_to_gvariant (value, type); + + if (G_VALUE_TYPE (value) == G_TYPE_VARIANT) + { + val = g_value_get_variant (value); + } + else + { + const GVariantType *type; + type = signon_gtype_to_variant_type (G_VALUE_TYPE (value)); + val = g_dbus_gvalue_to_gvariant (value, type); + } g_variant_builder_add (&builder, "{sv}", key, val); } return g_variant_builder_end (&builder); -- 2.34.1