diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2014-01-16 12:25:46 +0100 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2014-01-20 15:01:07 +0100 |
commit | e4ce8663faa4ecbc9a8d6b4431281d19d48b02da (patch) | |
tree | e597ae922d4ad046b466f8a174269f3fa0169d0b | |
parent | 731bba2da83fbac62c6819b8ee0d336f338dd71f (diff) |
util: factor out tp_tests_dup_channel_props_asv()
-rw-r--r-- | tests/lib/util.c | 30 | ||||
-rw-r--r-- | tests/lib/util.h | 2 |
2 files changed, 24 insertions, 8 deletions
diff --git a/tests/lib/util.c b/tests/lib/util.c index 7e0aca689..2f902ea04 100644 --- a/tests/lib/util.c +++ b/tests/lib/util.c @@ -681,21 +681,36 @@ tp_tests_channel_new_from_properties (TpConnection *conn, object_path, immutable_properties, error); } +GHashTable * +tp_tests_dup_channel_props_asv (TpChannel *channel) +{ + GVariant *variant; + GHashTable *asv; + GValue v = G_VALUE_INIT; + + g_assert (channel != NULL); + + variant = tp_channel_dup_immutable_properties (channel); + dbus_g_value_parse_g_variant (variant, &v); + asv = g_value_dup_boxed (&v); + + g_variant_unref (variant); + g_value_unset (&v); + + return asv; +} + void tp_tests_add_channel_to_ptr_array (GPtrArray *arr, TpChannel *channel) { GValueArray *tmp; - GVariant *variant; - GValue v = G_VALUE_INIT; GHashTable *asv; g_assert (arr != NULL); g_assert (channel != NULL); - variant = tp_channel_dup_immutable_properties (channel); - dbus_g_value_parse_g_variant (variant, &v); - asv = g_value_get_boxed (&v); + asv = tp_tests_dup_channel_props_asv (channel); tmp = tp_value_array_build (2, DBUS_TYPE_G_OBJECT_PATH, tp_proxy_get_object_path (channel), @@ -703,7 +718,6 @@ tp_tests_add_channel_to_ptr_array (GPtrArray *arr, G_TYPE_INVALID); g_ptr_array_add (arr, tmp); - g_variant_unref (variant); - g_value_unset (&v); -} + g_hash_table_unref (asv); +} diff --git a/tests/lib/util.h b/tests/lib/util.h index 183e00f00..05ded50f8 100644 --- a/tests/lib/util.h +++ b/tests/lib/util.h @@ -109,4 +109,6 @@ TpChannel *tp_tests_channel_new_from_properties (TpConnection *conn, void tp_tests_add_channel_to_ptr_array (GPtrArray *arr, TpChannel *channel); +GHashTable * tp_tests_dup_channel_props_asv (TpChannel *channel); + #endif /* #ifndef __TP_TESTS_LIB_UTIL_H__ */ |