[next] telepathy-glib: add _tp_boxed_to_variant()
Simon McVittie
smcv at kemper.freedesktop.org
Wed May 2 08:47:09 PDT 2012
Module: telepathy-glib
Branch: next
Commit: 16ab7a71f5e2f3e51549a361be98484554c23025
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=16ab7a71f5e2f3e51549a361be98484554c23025
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date: Wed Apr 25 10:21:14 2012 +0200
add _tp_boxed_to_variant()
https://bugs.freedesktop.org/show_bug.cgi?id=30422
---
telepathy-glib/dbus-internal.h | 4 ++++
telepathy-glib/dbus.c | 21 +++++++++++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/telepathy-glib/dbus-internal.h b/telepathy-glib/dbus-internal.h
index fda71b8..1c34728 100644
--- a/telepathy-glib/dbus-internal.h
+++ b/telepathy-glib/dbus-internal.h
@@ -38,6 +38,10 @@ gboolean _tp_dbus_daemon_is_the_shared_one (TpDBusDaemon *self);
GVariant *_tp_asv_to_vardict (const GHashTable *asv);
+GVariant * _tp_boxed_to_variant (GType gtype,
+ const gchar *variant_type,
+ gpointer boxed);
+
G_END_DECLS
#endif /* __TP_INTERNAL_DBUS_GLIB_H__ */
diff --git a/telepathy-glib/dbus.c b/telepathy-glib/dbus.c
index 8e40db4..8b41484 100644
--- a/telepathy-glib/dbus.c
+++ b/telepathy-glib/dbus.c
@@ -1974,3 +1974,24 @@ _tp_asv_to_vardict (const GHashTable *asv)
return g_variant_ref_sink (ret);
}
+
+GVariant *
+_tp_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);
+}
More information about the telepathy-commits
mailing list