aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-utils.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-05-08 17:14:24 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-06-06 22:49:15 +0800
commit460e6c2e35357e4df5379f5f76378d6833c7c34b (patch)
tree8739879aa9a43c20905db0a750aeb71d1333ada7 /libempathy/empathy-utils.c
parent2c910137428ef53609e25a142c5295746074493e (diff)
downloadgsoc2013-empathy-460e6c2e35357e4df5379f5f76378d6833c7c34b.tar.gz
gsoc2013-empathy-460e6c2e35357e4df5379f5f76378d6833c7c34b.tar.zst
gsoc2013-empathy-460e6c2e35357e4df5379f5f76378d6833c7c34b.zip
Add GVariant converters from tp-glib
https://bugzilla.gnome.org/show_bug.cgi?id=676634
Diffstat (limited to 'libempathy/empathy-utils.c')
-rw-r--r--libempathy/empathy-utils.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index 30d40e9a5..7d6c8c06c 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -1273,3 +1273,32 @@ while_finish:
return types;
}
+
+GVariant *
+empathy_asv_to_vardict (const GHashTable *asv)
+{
+ return empathy_boxed_to_variant (TP_HASH_TYPE_STRING_VARIANT_MAP, "a{sv}",
+ (gpointer) asv);
+}
+
+GVariant *
+empathy_boxed_to_variant (GType gtype,
+ const gchar *variant_type,
+ gpointer boxed)
+{
+ GValue v = G_VALUE_INIT;
+ GVariant *ret;
+
+ g_return_val_if_fail (boxed != NULL, NULL);
+
+ g_value_init (&v, gtype);
+ g_value_set_boxed (&v, boxed);
+
+ ret = dbus_g_value_build_g_variant (&v);
+ g_return_val_if_fail (!tp_strdiff (g_variant_get_type_string (ret),
+ variant_type), NULL);
+
+ g_value_unset (&v);
+
+ return g_variant_ref_sink (ret);
+}