summaryrefslogtreecommitdiff
path: root/telepathy-glib/dbus.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-03-08 12:49:09 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-03-09 16:17:22 +0000
commitc978190ff2c5b87e363c4a41dd400c51566327ed (patch)
treea0515c222a46eedc8b90904ec4e5e5ef151c83d5 /telepathy-glib/dbus.c
parent8b3f45676451e8c6d03db131cfc1b60005136ca4 (diff)
downloadtelepathy-glib-c978190ff2c5b87e363c4a41dd400c51566327ed.tar.gz
Add _tp_asv_to_vardict, a utility function to convert a{sv} representations
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=30422 Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'telepathy-glib/dbus.c')
-rw-r--r--telepathy-glib/dbus.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/telepathy-glib/dbus.c b/telepathy-glib/dbus.c
index 25246c935..8e40db45c 100644
--- a/telepathy-glib/dbus.c
+++ b/telepathy-glib/dbus.c
@@ -64,6 +64,7 @@
#include <gobject/gvaluecollector.h>
#include <telepathy-glib/errors.h>
+#include <telepathy-glib/gtypes.h>
#include <telepathy-glib/util.h>
#define DEBUG_FLAG TP_DEBUG_MISC
@@ -1951,3 +1952,25 @@ tp_asv_dump (GHashTable *asv)
g_debug ("}");
}
+
+/*
+ * _tp_asv_to_vardict:
+ *
+ * Returns: (transfer full): a #GVariant of type %G_VARIANT_TYPE_VARDICT
+ */
+GVariant *
+_tp_asv_to_vardict (const GHashTable *asv)
+{
+ GValue v = G_VALUE_INIT;
+ GVariant *ret;
+
+ g_value_init (&v, TP_HASH_TYPE_STRING_VARIANT_MAP);
+ g_value_set_boxed (&v, asv);
+
+ ret = dbus_g_value_build_g_variant (&v);
+ g_assert (!tp_strdiff (g_variant_get_type_string (ret), "a{sv}"));
+
+ g_value_unset (&v);
+
+ return g_variant_ref_sink (ret);
+}