diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-03-31 15:09:57 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-04-03 15:47:12 +0100 |
commit | d7051489e3a50e180d756c255de103aff29878f3 (patch) | |
tree | 5fb0c8fbf2a39e783d4d7598bf1d9a748a4ca5b1 | |
parent | 7b60eaef51b07813edcd640f89fa51aa9b62094a (diff) |
Move tp_asv_to_vardict, tp_asv_from_vardict to dbus library
These functions should be useless in a post-dbus-glib environment.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=76855
Reviewed-by: Xavier Claessens
-rw-r--r-- | telepathy-glib/account-channel-request.c | 1 | ||||
-rw-r--r-- | telepathy-glib/asv.c | 61 | ||||
-rw-r--r-- | telepathy-glib/asv.h | 4 | ||||
-rw-r--r-- | telepathy-glib/automatic-client-factory.c | 1 | ||||
-rw-r--r-- | telepathy-glib/channel-request.c | 1 | ||||
-rw-r--r-- | telepathy-glib/client-factory.c | 1 | ||||
-rw-r--r-- | telepathy-glib/svc-interface-skeleton.c | 1 | ||||
-rw-r--r-- | telepathy-glib/variant-util.c | 45 | ||||
-rw-r--r-- | telepathy-glib/variant-util.h | 4 | ||||
-rw-r--r-- | telepathy-glib/versions/dbus-1.0.abi | 2 | ||||
-rw-r--r-- | telepathy-glib/versions/main-1.0.abi | 2 | ||||
-rw-r--r-- | tests/dbus/dbus-tube.c | 1 | ||||
-rw-r--r-- | tests/dbus/file-transfer-channel.c | 1 | ||||
-rw-r--r-- | tests/dbus/stream-tube.c | 1 |
14 files changed, 75 insertions, 51 deletions
diff --git a/telepathy-glib/account-channel-request.c b/telepathy-glib/account-channel-request.c index a28b4378b..c0f9a7593 100644 --- a/telepathy-glib/account-channel-request.c +++ b/telepathy-glib/account-channel-request.c @@ -78,6 +78,7 @@ #include <dbus/dbus-glib.h> +#include <telepathy-glib/asv.h> #include "telepathy-glib/base-client-internal.h" #include <telepathy-glib/channel-dispatcher.h> #include <telepathy-glib/channel-request.h> diff --git a/telepathy-glib/asv.c b/telepathy-glib/asv.c index dcd325fda..44ab2d3b9 100644 --- a/telepathy-glib/asv.c +++ b/telepathy-glib/asv.c @@ -29,6 +29,7 @@ #include <dbus/dbus-glib.h> +#include <telepathy-glib/gtypes.h> #include <telepathy-glib/sliced-gvalue.h> /* this is the core library, we don't have debug infrastructure yet */ @@ -64,6 +65,66 @@ */ /** + * tp_asv_to_vardict: (skip) + * @asv: a #TP_HASH_TYPE_STRING_VARIANT_MAP + * + * Convert a #TP_HASH_TYPE_STRING_VARIANT_MAP to a #GVariant of type + * %G_VARIANT_TYPE_VARDICT + * + * Returns: a new floating #GVariant of type %G_VARIANT_TYPE_VARDICT + **/ +GVariant * +tp_asv_to_vardict (const GHashTable *asv) +{ + /* This open-codes _tp_boxed_to_variant() because that's in the main + * library, and this is in the dbus library. */ + GValue v = G_VALUE_INIT; + GVariant *ret; + + g_return_val_if_fail (asv != NULL, NULL); + + 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_return_val_if_fail (g_variant_is_of_type (ret, G_VARIANT_TYPE_VARDICT), + NULL); + + g_value_unset (&v); + + return ret; +} + +/** + * tp_asv_from_vardict: (skip) + * @variant: a #GVariant of type %G_VARIANT_TYPE_VARDICT + * + * Convert a #GVariant of type %G_VARIANT_TYPE_VARDICT to a + * #TP_HASH_TYPE_STRING_VARIANT_MAP + * + * Returns: (transfer full): a newly created #GHashTable of + * type #TP_HASH_TYPE_STRING_VARIANT_MAP + **/ +GHashTable * +tp_asv_from_vardict (GVariant *variant) +{ + GValue v = G_VALUE_INIT; + GHashTable *result; + + g_return_val_if_fail (variant != NULL, NULL); + g_return_val_if_fail (g_variant_is_of_type (variant, G_VARIANT_TYPE_VARDICT), + NULL); + + dbus_g_value_parse_g_variant (variant, &v); + g_assert (G_VALUE_HOLDS (&v, TP_HASH_TYPE_STRING_VARIANT_MAP)); + + result = g_value_dup_boxed (&v); + + g_value_unset (&v); + return result; +} + +/** * tp_asv_size: (skip) * @asv: a GHashTable * diff --git a/telepathy-glib/asv.h b/telepathy-glib/asv.h index 7d937222e..a9e4c38fe 100644 --- a/telepathy-glib/asv.h +++ b/telepathy-glib/asv.h @@ -30,6 +30,10 @@ G_BEGIN_DECLS +GVariant * tp_asv_to_vardict (const GHashTable *asv); + +GHashTable * tp_asv_from_vardict (GVariant *variant); + #define tp_asv_size(asv) _tp_asv_size_inline (asv) static inline guint diff --git a/telepathy-glib/automatic-client-factory.c b/telepathy-glib/automatic-client-factory.c index 167067c36..19f20575a 100644 --- a/telepathy-glib/automatic-client-factory.c +++ b/telepathy-glib/automatic-client-factory.c @@ -106,6 +106,7 @@ #include "telepathy-glib/automatic-client-factory.h" +#include <telepathy-glib/asv.h> #include <telepathy-glib/interfaces.h> #include <telepathy-glib/util.h> diff --git a/telepathy-glib/channel-request.c b/telepathy-glib/channel-request.c index 68b4c7f94..ad4289832 100644 --- a/telepathy-glib/channel-request.c +++ b/telepathy-glib/channel-request.c @@ -24,6 +24,7 @@ #include "telepathy-glib/channel-request.h" #include <telepathy-glib/account-manager.h> +#include <telepathy-glib/asv.h> #include <telepathy-glib/channel.h> #include <telepathy-glib/cli-misc.h> #include <telepathy-glib/connection.h> diff --git a/telepathy-glib/client-factory.c b/telepathy-glib/client-factory.c index 617f40ec3..0fb1d1572 100644 --- a/telepathy-glib/client-factory.c +++ b/telepathy-glib/client-factory.c @@ -125,6 +125,7 @@ #include "telepathy-glib/client-factory.h" +#include <telepathy-glib/asv.h> #include <telepathy-glib/automatic-client-factory.h> #include <telepathy-glib/interfaces.h> #include <telepathy-glib/util.h> diff --git a/telepathy-glib/svc-interface-skeleton.c b/telepathy-glib/svc-interface-skeleton.c index 547a360f6..d4dbb5c9f 100644 --- a/telepathy-glib/svc-interface-skeleton.c +++ b/telepathy-glib/svc-interface-skeleton.c @@ -21,6 +21,7 @@ #include <dbus/dbus-glib.h> +#include <telepathy-glib/asv.h> #include <telepathy-glib/dbus-properties-mixin.h> #include <telepathy-glib/variant-util.h> diff --git a/telepathy-glib/variant-util.c b/telepathy-glib/variant-util.c index 8c782982d..b17766e75 100644 --- a/telepathy-glib/variant-util.c +++ b/telepathy-glib/variant-util.c @@ -51,22 +51,6 @@ #define DEBUG_FLAG TP_DEBUG_MISC #include "debug-internal.h" -/** - * tp_asv_to_vardict: (skip) - * @asv: a #TP_HASH_TYPE_STRING_VARIANT_MAP - * - * Convert a #TP_HASH_TYPE_STRING_VARIANT_MAP to a #GVariant of type - * %G_VARIANT_TYPE_VARDICT - * - * Returns: a new floating #GVariant of type %G_VARIANT_TYPE_VARDICT - **/ -GVariant * -tp_asv_to_vardict (const GHashTable *asv) -{ - return _tp_boxed_to_variant (TP_HASH_TYPE_STRING_VARIANT_MAP, "a{sv}", - (gpointer) asv); -} - GVariant * _tp_boxed_to_variant (GType gtype, const gchar *variant_type, @@ -89,35 +73,6 @@ _tp_boxed_to_variant (GType gtype, } /** - * tp_asv_from_vardict: (skip) - * @variant: a #GVariant of type %G_VARIANT_TYPE_VARDICT - * - * Convert a #GVariant of type %G_VARIANT_TYPE_VARDICT to a - * #TP_HASH_TYPE_STRING_VARIANT_MAP - * - * Returns: (transfer full): a newly created #GHashTable of - * type #TP_HASH_TYPE_STRING_VARIANT_MAP - **/ -GHashTable * -tp_asv_from_vardict (GVariant *variant) -{ - GValue v = G_VALUE_INIT; - GHashTable *result; - - g_return_val_if_fail (variant != NULL, NULL); - g_return_val_if_fail (g_variant_is_of_type (variant, G_VARIANT_TYPE_VARDICT), - NULL); - - dbus_g_value_parse_g_variant (variant, &v); - g_assert (G_VALUE_HOLDS (&v, TP_HASH_TYPE_STRING_VARIANT_MAP)); - - result = g_value_dup_boxed (&v); - - g_value_unset (&v); - return result; -} - -/** * tp_variant_type_classify: * @type: a #GVariantType * diff --git a/telepathy-glib/variant-util.h b/telepathy-glib/variant-util.h index e3181d47c..306754e7f 100644 --- a/telepathy-glib/variant-util.h +++ b/telepathy-glib/variant-util.h @@ -35,10 +35,6 @@ GVariantClass tp_variant_type_classify (const GVariantType *type); GVariant *tp_variant_convert (GVariant *variant, const GVariantType *type); -GVariant * tp_asv_to_vardict (const GHashTable *asv); - -GHashTable * tp_asv_from_vardict (GVariant *variant); - gboolean tp_vardict_has_key (GVariant *variant, const gchar *key); diff --git a/telepathy-glib/versions/dbus-1.0.abi b/telepathy-glib/versions/dbus-1.0.abi index 8e57705f9..6f5c671f8 100644 --- a/telepathy-glib/versions/dbus-1.0.abi +++ b/telepathy-glib/versions/dbus-1.0.abi @@ -3,6 +3,7 @@ Extends: - Release: 1.0 tp_asv_dump +tp_asv_from_vardict tp_asv_get_boolean tp_asv_get_boxed tp_asv_get_bytes @@ -34,6 +35,7 @@ tp_asv_take_boxed tp_asv_take_bytes tp_asv_take_object_path tp_asv_take_string +tp_asv_to_vardict tp_cli_account_call_reconnect tp_cli_account_call_remove tp_cli_account_call_update_parameters diff --git a/telepathy-glib/versions/main-1.0.abi b/telepathy-glib/versions/main-1.0.abi index 901b31860..ec93de42b 100644 --- a/telepathy-glib/versions/main-1.0.abi +++ b/telepathy-glib/versions/main-1.0.abi @@ -134,8 +134,6 @@ tp_add_dispatch_operation_context_fail tp_add_dispatch_operation_context_get_type tp_address_g_variant_from_g_socket_address tp_address_variant_from_g_socket_address -tp_asv_from_vardict -tp_asv_to_vardict tp_automatic_client_factory_get_type tp_automatic_client_factory_new tp_avatar_requirements_copy diff --git a/tests/dbus/dbus-tube.c b/tests/dbus/dbus-tube.c index 169a29f9b..1c2486755 100644 --- a/tests/dbus/dbus-tube.c +++ b/tests/dbus/dbus-tube.c @@ -11,6 +11,7 @@ #include <string.h> +#include <telepathy-glib/asv.h> #include <telepathy-glib/dbus-tube-channel.h> #include <telepathy-glib/debug.h> #include <telepathy-glib/defs.h> diff --git a/tests/dbus/file-transfer-channel.c b/tests/dbus/file-transfer-channel.c index 9b473397a..cd56b1ebf 100644 --- a/tests/dbus/file-transfer-channel.c +++ b/tests/dbus/file-transfer-channel.c @@ -13,6 +13,7 @@ #include <glib.h> #include <string.h> +#include <telepathy-glib/asv.h> #include <telepathy-glib/file-transfer-channel.h> #include <telepathy-glib/debug.h> #include <telepathy-glib/defs.h> diff --git a/tests/dbus/stream-tube.c b/tests/dbus/stream-tube.c index 4669051fd..a384297b6 100644 --- a/tests/dbus/stream-tube.c +++ b/tests/dbus/stream-tube.c @@ -11,6 +11,7 @@ #include <string.h> +#include <telepathy-glib/asv.h> #include <telepathy-glib/stream-tube-channel.h> #include <telepathy-glib/debug.h> #include <telepathy-glib/defs.h> |