aboutsummaryrefslogtreecommitdiffstats
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
parent2c910137428ef53609e25a142c5295746074493e (diff)
downloadgsoc2013-empathy-460e6c2e35357e4df5379f5f76378d6833c7c34b.tar
gsoc2013-empathy-460e6c2e35357e4df5379f5f76378d6833c7c34b.tar.gz
gsoc2013-empathy-460e6c2e35357e4df5379f5f76378d6833c7c34b.tar.bz2
gsoc2013-empathy-460e6c2e35357e4df5379f5f76378d6833c7c34b.tar.lz
gsoc2013-empathy-460e6c2e35357e4df5379f5f76378d6833c7c34b.tar.xz
gsoc2013-empathy-460e6c2e35357e4df5379f5f76378d6833c7c34b.tar.zst
gsoc2013-empathy-460e6c2e35357e4df5379f5f76378d6833c7c34b.zip
Add GVariant converters from tp-glib
https://bugzilla.gnome.org/show_bug.cgi?id=676634
-rw-r--r--libempathy/empathy-utils.c29
-rw-r--r--libempathy/empathy-utils.h6
2 files changed, 35 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);
+}
diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h
index dae250608..a31ed34fc 100644
--- a/libempathy/empathy-utils.h
+++ b/libempathy/empathy-utils.h
@@ -130,6 +130,12 @@ FolksIndividual * empathy_ensure_individual_from_tp_contact (
const gchar * const * empathy_individual_get_client_types (
FolksIndividual *individual);
+GVariant * empathy_asv_to_vardict (const GHashTable *asv);
+
+GVariant * empathy_boxed_to_variant (GType gtype,
+ const gchar *variant_type,
+ gpointer boxed);
+
/* Copied from wocky/wocky-utils.h */
#define empathy_implement_finish_void(source, tag) \