aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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) \