diff options
-rw-r--r-- | docs/reference/telepathy-glib/telepathy-glib-sections.txt | 2 | ||||
-rw-r--r-- | telepathy-glib/account-channel-request.c | 10 | ||||
-rw-r--r-- | telepathy-glib/account-manager.c | 6 | ||||
-rw-r--r-- | telepathy-glib/account-request.c | 6 | ||||
-rw-r--r-- | telepathy-glib/account.c | 10 | ||||
-rw-r--r-- | telepathy-glib/base-client.c | 8 | ||||
-rw-r--r-- | telepathy-glib/base-connection.c | 2 | ||||
-rw-r--r-- | telepathy-glib/channel.c | 4 | ||||
-rw-r--r-- | telepathy-glib/client-factory.c | 4 | ||||
-rw-r--r-- | telepathy-glib/connection.c | 4 | ||||
-rw-r--r-- | telepathy-glib/contact.c | 4 | ||||
-rw-r--r-- | telepathy-glib/dbus-tube-channel.c | 6 | ||||
-rw-r--r-- | telepathy-glib/message.c | 4 | ||||
-rw-r--r-- | telepathy-glib/protocol.c | 2 | ||||
-rw-r--r-- | telepathy-glib/stream-tube-channel.c | 6 | ||||
-rw-r--r-- | telepathy-glib/tls-certificate.c | 6 | ||||
-rw-r--r-- | telepathy-glib/variant-util-internal.h | 4 | ||||
-rw-r--r-- | telepathy-glib/variant-util.c | 23 | ||||
-rw-r--r-- | telepathy-glib/variant-util.h | 4 | ||||
-rw-r--r-- | tests/asv.c | 2 |
20 files changed, 63 insertions, 54 deletions
diff --git a/docs/reference/telepathy-glib/telepathy-glib-sections.txt b/docs/reference/telepathy-glib/telepathy-glib-sections.txt index bd0b6ebf8..44771aa8e 100644 --- a/docs/reference/telepathy-glib/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib/telepathy-glib-sections.txt @@ -1893,6 +1893,8 @@ tp_variant_convert <FILE>vardict</FILE> <TITLE>vardict</TITLE> <INCLUDE>telepathy-glib/telepathy-glib.h</INCLUDE> +tp_asv_from_vardict +tp_asv_to_vardict tp_vardict_get_boolean tp_vardict_get_double tp_vardict_get_int32 diff --git a/telepathy-glib/account-channel-request.c b/telepathy-glib/account-channel-request.c index ec239d844..1ea225cdf 100644 --- a/telepathy-glib/account-channel-request.c +++ b/telepathy-glib/account-channel-request.c @@ -86,7 +86,7 @@ #include <telepathy-glib/simple-handler.h> #include <telepathy-glib/util.h> #include <telepathy-glib/util-internal.h> -#include <telepathy-glib/variant-util-internal.h> +#include <telepathy-glib/variant-util.h> #define DEBUG_FLAG TP_DEBUG_CLIENT #include "telepathy-glib/debug-internal.h" @@ -283,7 +283,7 @@ tp_account_channel_request_set_property (GObject *object, /* Construct-only and mutually exclusive with request */ g_return_if_fail (self->priv->request == NULL); - hash = _tp_asv_from_vardict (g_value_get_variant (value)); + hash = tp_asv_from_vardict (g_value_get_variant (value)); self->priv->request = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) tp_g_value_slice_free); @@ -552,7 +552,7 @@ tp_account_channel_request_dup_request ( { g_return_val_if_fail (TP_IS_ACCOUNT_CHANNEL_REQUEST (self), NULL); - return _tp_asv_to_vardict (self->priv->request); + return tp_asv_to_vardict (self->priv->request); } /** @@ -938,7 +938,7 @@ request_and_handle_channel_async (TpAccountChannelRequest *self, cd = tp_channel_dispatcher_new (self->priv->dbus); - hints = _tp_asv_from_vardict (self->priv->hints); + hints = tp_asv_from_vardict (self->priv->hints); if (ensure) { @@ -1188,7 +1188,7 @@ request_channel_async (TpAccountChannelRequest *self, cd = tp_channel_dispatcher_new (self->priv->dbus); - hints = _tp_asv_from_vardict (self->priv->hints); + hints = tp_asv_from_vardict (self->priv->hints); if (ensure) { diff --git a/telepathy-glib/account-manager.c b/telepathy-glib/account-manager.c index f17c8fed1..643d4303a 100644 --- a/telepathy-glib/account-manager.c +++ b/telepathy-glib/account-manager.c @@ -31,7 +31,7 @@ #include <telepathy-glib/proxy-subclass.h> #include <telepathy-glib/util-internal.h> #include <telepathy-glib/util.h> -#include <telepathy-glib/variant-util-internal.h> +#include <telepathy-glib/variant-util.h> #include "telepathy-glib/account-manager.h" @@ -1275,10 +1275,10 @@ tp_account_manager_create_account_async (TpAccountManager *manager, tp_account_manager_create_account_finish); g_variant_ref_sink (parameters); - params_asv = _tp_asv_from_vardict (parameters); + params_asv = tp_asv_from_vardict (parameters); g_variant_ref_sink (properties); - props_asv = _tp_asv_from_vardict (properties); + props_asv = tp_asv_from_vardict (properties); tp_cli_account_manager_call_create_account (manager, -1, connection_manager, protocol, display_name, params_asv, diff --git a/telepathy-glib/account-request.c b/telepathy-glib/account-request.c index 4f2309724..9909604b2 100644 --- a/telepathy-glib/account-request.c +++ b/telepathy-glib/account-request.c @@ -32,7 +32,7 @@ #include "telepathy-glib/dbus-internal.h" #include "telepathy-glib/debug-internal.h" #include "telepathy-glib/util-internal.h" -#include "telepathy-glib/variant-util-internal.h" +#include "telepathy-glib/variant-util.h" /** * SECTION:account-request @@ -210,10 +210,10 @@ tp_account_request_get_property (GObject *object, g_value_set_string (value, self->priv->display_name); break; case PROP_PARAMETERS: - g_value_take_variant (value, _tp_asv_to_vardict (self->priv->parameters)); + g_value_take_variant (value, tp_asv_to_vardict (self->priv->parameters)); break; case PROP_PROPERTIES: - g_value_take_variant (value, _tp_asv_to_vardict (self->priv->properties)); + g_value_take_variant (value, tp_asv_to_vardict (self->priv->properties)); break; case PROP_ICON_NAME: g_value_set_string (value, diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c index b407134c7..b578ee66b 100644 --- a/telepathy-glib/account.c +++ b/telepathy-glib/account.c @@ -42,7 +42,7 @@ #include "telepathy-glib/proxy-internal.h" #include "telepathy-glib/client-factory-internal.h" #include <telepathy-glib/util-internal.h> -#include "telepathy-glib/variant-util-internal.h" +#include "telepathy-glib/variant-util.h" /** * SECTION:account @@ -930,7 +930,7 @@ _tp_account_update (TpAccount *account, if (priv->parameters != NULL) g_variant_unref (priv->parameters); - priv->parameters = _tp_asv_to_vardict (parameters); + priv->parameters = tp_asv_to_vardict (parameters); /* this isn't a property, so we don't notify */ } @@ -2739,7 +2739,7 @@ tp_account_update_parameters_async (TpAccount *account, g_return_if_fail (TP_IS_ACCOUNT (account)); - hash = _tp_asv_from_vardict (parameters); + hash = tp_asv_from_vardict (parameters); result = g_simple_async_result_new (G_OBJECT (account), callback, user_data, tp_account_update_parameters_async); @@ -3649,7 +3649,7 @@ tp_account_dup_detailed_error (TpAccount *self, return NULL; if (details != NULL) - *details = _tp_asv_to_vardict (self->priv->error_details); + *details = tp_asv_to_vardict (self->priv->error_details); return g_strdup (self->priv->error); } @@ -3730,7 +3730,7 @@ _tp_account_get_storage_specific_information_cb (TpProxy *self, GHashTable *asv = g_value_get_boxed (value); g_simple_async_result_set_op_res_gpointer (result, - _tp_asv_to_vardict (asv), (GDestroyNotify) g_variant_unref); + tp_asv_to_vardict (asv), (GDestroyNotify) g_variant_unref); } g_simple_async_result_complete (result); diff --git a/telepathy-glib/base-client.c b/telepathy-glib/base-client.c index 9fc9f1a8f..8f61d70c0 100644 --- a/telepathy-glib/base-client.c +++ b/telepathy-glib/base-client.c @@ -194,7 +194,7 @@ #include "telepathy-glib/debug-internal.h" #include "telepathy-glib/client-factory-internal.h" #include "telepathy-glib/util-internal.h" -#include "telepathy-glib/variant-util-internal.h" +#include "telepathy-glib/variant-util.h" static void observer_iface_init (gpointer, gpointer); static void approver_iface_init (gpointer, gpointer); @@ -385,7 +385,7 @@ tp_base_client_add_observer_filter (TpBaseClient *self, g_return_if_fail (g_variant_is_of_type (filter, G_VARIANT_TYPE_VARDICT)); g_variant_ref_sink (filter); - tp_base_client_take_observer_filter (self, _tp_asv_from_vardict (filter)); + tp_base_client_take_observer_filter (self, tp_asv_from_vardict (filter)); g_variant_unref (filter); } @@ -536,7 +536,7 @@ tp_base_client_add_approver_filter (TpBaseClient *self, g_return_if_fail (g_variant_is_of_type (filter, G_VARIANT_TYPE_VARDICT)); g_variant_ref_sink (filter); - tp_base_client_take_approver_filter (self, _tp_asv_from_vardict (filter)); + tp_base_client_take_approver_filter (self, tp_asv_from_vardict (filter)); g_variant_unref (filter); } @@ -627,7 +627,7 @@ tp_base_client_add_handler_filter (TpBaseClient *self, g_return_if_fail (g_variant_is_of_type (filter, G_VARIANT_TYPE_VARDICT)); g_variant_ref_sink (filter); - tp_base_client_take_handler_filter (self, _tp_asv_from_vardict (filter)); + tp_base_client_take_handler_filter (self, tp_asv_from_vardict (filter)); g_variant_unref (filter); } diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c index 457471646..290ea1ae2 100644 --- a/telepathy-glib/base-connection.c +++ b/telepathy-glib/base-connection.c @@ -1781,7 +1781,7 @@ tp_base_connection_disconnect_with_dbus_error (TpBaseConnection *self, } else { - hash = _tp_asv_from_vardict (details); + hash = tp_asv_from_vardict (details); } tp_svc_connection_emit_connection_error (self, error_name, hash); diff --git a/telepathy-glib/channel.c b/telepathy-glib/channel.c index aef035858..e212aca08 100644 --- a/telepathy-glib/channel.c +++ b/telepathy-glib/channel.c @@ -38,7 +38,7 @@ #include "telepathy-glib/debug-internal.h" #include "telepathy-glib/proxy-internal.h" #include "telepathy-glib/client-factory-internal.h" -#include "telepathy-glib/variant-util-internal.h" +#include "telepathy-glib/variant-util.h" /** * SECTION:channel @@ -345,7 +345,7 @@ tp_channel_dup_immutable_properties (TpChannel *self) { g_return_val_if_fail (TP_IS_CHANNEL (self), NULL); - return _tp_asv_to_vardict (self->priv->channel_properties); + return tp_asv_to_vardict (self->priv->channel_properties); } /** diff --git a/telepathy-glib/client-factory.c b/telepathy-glib/client-factory.c index 34cf124c7..0e5f602d6 100644 --- a/telepathy-glib/client-factory.c +++ b/telepathy-glib/client-factory.c @@ -125,7 +125,7 @@ #include "telepathy-glib/debug-internal.h" #include "telepathy-glib/client-factory-internal.h" #include "telepathy-glib/util-internal.h" -#include "telepathy-glib/variant-util-internal.h" +#include "telepathy-glib/variant-util.h" struct _TpClientFactoryPrivate { @@ -1158,7 +1158,7 @@ _tp_client_factory_ensure_channel_request (TpClientFactory *self, if (request != NULL) return g_object_ref (request); - props = _tp_asv_to_vardict (immutable_properties); + props = tp_asv_to_vardict (immutable_properties); request = _tp_channel_request_new_with_factory (self, self->priv->dbus, object_path, props, error); diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c index 160d43da3..09ee97df2 100644 --- a/telepathy-glib/connection.c +++ b/telepathy-glib/connection.c @@ -50,7 +50,7 @@ #include "telepathy-glib/client-factory-internal.h" #include "telepathy-glib/contact-internal.h" #include "telepathy-glib/util-internal.h" -#include "telepathy-glib/variant-util-internal.h" +#include "telepathy-glib/variant-util.h" /** * SECTION:connection @@ -2633,7 +2633,7 @@ tp_connection_dup_detailed_error (TpConnection *self, return NULL; if (details != NULL) - *details = _tp_asv_to_vardict (asv); + *details = tp_asv_to_vardict (asv); return g_strdup (error); } diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c index b828f1e8f..7c2768981 100644 --- a/telepathy-glib/contact.c +++ b/telepathy-glib/contact.c @@ -40,7 +40,7 @@ #include "telepathy-glib/contact-internal.h" #include "telepathy-glib/debug-internal.h" #include "telepathy-glib/util-internal.h" -#include "telepathy-glib/variant-util-internal.h" +#include "telepathy-glib/variant-util.h" static const gchar * nonnull (const gchar *s) @@ -1812,7 +1812,7 @@ contact_maybe_set_location (TpContact *self, g_hash_table_ref (location); self->priv->has_features |= CONTACT_FEATURE_FLAG_LOCATION; - self->priv->location = _tp_asv_to_vardict (location); + self->priv->location = tp_asv_to_vardict (location); g_object_notify ((GObject *) self, "location"); g_hash_table_unref (location); } diff --git a/telepathy-glib/dbus-tube-channel.c b/telepathy-glib/dbus-tube-channel.c index 6ef193a49..8dbe50c4b 100644 --- a/telepathy-glib/dbus-tube-channel.c +++ b/telepathy-glib/dbus-tube-channel.c @@ -99,7 +99,7 @@ #include "telepathy-glib/automatic-client-factory-internal.h" #include "telepathy-glib/channel-internal.h" #include "telepathy-glib/debug-internal.h" -#include "telepathy-glib/variant-util-internal.h" +#include "telepathy-glib/variant-util.h" #include <stdio.h> #include <glib/gstdio.h> @@ -313,7 +313,7 @@ tp_dbus_tube_channel_constructed (GObject *obj) } else { - self->priv->parameters = _tp_asv_to_vardict (params); + self->priv->parameters = tp_asv_to_vardict (params); } } @@ -600,7 +600,7 @@ proxy_prepare_offer_cb (GObject *source, g_object_notify (G_OBJECT (self), "parameters"); - params_asv = _tp_asv_from_vardict (self->priv->parameters); + params_asv = tp_asv_from_vardict (self->priv->parameters); /* TODO: provide a way to use TP_SOCKET_ACCESS_CONTROL_LOCALHOST if you're in * an environment where you need to disable authentication. tp-glib can't diff --git a/telepathy-glib/message.c b/telepathy-glib/message.c index 6611a2ba0..2d6a3bbda 100644 --- a/telepathy-glib/message.c +++ b/telepathy-glib/message.c @@ -39,7 +39,7 @@ #include <telepathy-glib/dbus.h> #include <telepathy-glib/gtypes.h> #include <telepathy-glib/util.h> -#include <telepathy-glib/variant-util-internal.h> +#include <telepathy-glib/variant-util.h> #define DEBUG_FLAG TP_DEBUG_MISC #include "telepathy-glib/debug-internal.h" @@ -179,7 +179,7 @@ tp_message_dup_part (TpMessage *self, if (part >= self->parts->len) return NULL; - return _tp_asv_to_vardict (g_ptr_array_index (self->parts, part)); + return tp_asv_to_vardict (g_ptr_array_index (self->parts, part)); } diff --git a/telepathy-glib/protocol.c b/telepathy-glib/protocol.c index 7be088936..ab26ebd4f 100644 --- a/telepathy-glib/protocol.c +++ b/telepathy-glib/protocol.c @@ -2079,7 +2079,7 @@ tp_protocol_identify_account_async (TpProtocol *self, task = g_task_new (self, cancellable, callback, user_data); g_task_set_source_tag (task, tp_protocol_identify_account_async); g_variant_ref_sink (vardict); - asv = _tp_asv_from_vardict (vardict); + asv = tp_asv_from_vardict (vardict); tp_cli_protocol_call_identify_account (self, -1, asv, tp_protocol_async_string_cb, task, g_object_unref, NULL); g_hash_table_unref (asv); diff --git a/telepathy-glib/stream-tube-channel.c b/telepathy-glib/stream-tube-channel.c index af695151c..c6f0e8718 100644 --- a/telepathy-glib/stream-tube-channel.c +++ b/telepathy-glib/stream-tube-channel.c @@ -60,7 +60,7 @@ #include <telepathy-glib/stream-tube-connection-internal.h> #include <telepathy-glib/util-internal.h> #include <telepathy-glib/util.h> -#include <telepathy-glib/variant-util-internal.h> +#include <telepathy-glib/variant-util.h> #define DEBUG_FLAG TP_DEBUG_CHANNEL #include "telepathy-glib/channel-internal.h" @@ -398,7 +398,7 @@ tp_stream_tube_channel_constructed (GObject *obj) } else { - self->priv->parameters = _tp_asv_to_vardict (params); + self->priv->parameters = tp_asv_to_vardict (params); } } @@ -1182,7 +1182,7 @@ _offer_with_address (TpStreamTubeChannel *self, g_object_notify (G_OBJECT (self), "parameters"); - params_asv = _tp_asv_from_vardict (self->priv->parameters); + params_asv = tp_asv_from_vardict (self->priv->parameters); /* Call Offer */ tp_cli_channel_type_stream_tube1_call_offer (TP_CHANNEL (self), -1, diff --git a/telepathy-glib/tls-certificate.c b/telepathy-glib/tls-certificate.c index 5b6efb8db..35a600aaa 100644 --- a/telepathy-glib/tls-certificate.c +++ b/telepathy-glib/tls-certificate.c @@ -36,7 +36,7 @@ #include <telepathy-glib/util.h> #include <telepathy-glib/util-internal.h> #include <telepathy-glib/tls-certificate-rejection-internal.h> -#include "telepathy-glib/variant-util-internal.h" +#include "telepathy-glib/variant-util.h" #define DEBUG_FLAG TP_DEBUG_TLS #include "debug-internal.h" @@ -182,7 +182,7 @@ tp_tls_certificate_rejected_cb (TpTLSCertificate *self, tp_proxy_dbus_error_to_gerror (self, error_name, tp_asv_get_string (details, "debug-message"), &error); - vardict = _tp_asv_to_vardict (details); + vardict = tp_asv_to_vardict (details); rej = _tp_tls_certificate_rejection_new (error, reason, error_name, vardict); @@ -727,7 +727,7 @@ tp_tls_certificate_add_rejection (TpTLSCertificate *self, } else { - hash = _tp_asv_from_vardict (details); + hash = tp_asv_from_vardict (details); g_variant_ref_sink (details); } diff --git a/telepathy-glib/variant-util-internal.h b/telepathy-glib/variant-util-internal.h index 16257e55e..06c06defd 100644 --- a/telepathy-glib/variant-util-internal.h +++ b/telepathy-glib/variant-util-internal.h @@ -25,12 +25,8 @@ #include <glib.h> #include <gio/gio.h> -GVariant *_tp_asv_to_vardict (const GHashTable *asv); - GVariant * _tp_boxed_to_variant (GType gtype, const gchar *variant_type, gpointer boxed); -GHashTable * _tp_asv_from_vardict (GVariant *variant); - #endif /* __TP_VARIANT_UTIL_INTERNAL_H__ */ diff --git a/telepathy-glib/variant-util.c b/telepathy-glib/variant-util.c index 2e7230458..fd8ef4535 100644 --- a/telepathy-glib/variant-util.c +++ b/telepathy-glib/variant-util.c @@ -49,13 +49,17 @@ #define DEBUG_FLAG TP_DEBUG_MISC #include "debug-internal.h" -/* - * _tp_asv_to_vardict: +/** + * 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: (transfer full): a #GVariant of type %G_VARIANT_TYPE_VARDICT - */ + **/ GVariant * -_tp_asv_to_vardict (const GHashTable *asv) +tp_asv_to_vardict (const GHashTable *asv) { return _tp_boxed_to_variant (TP_HASH_TYPE_STRING_VARIANT_MAP, "a{sv}", (gpointer) asv); } @@ -81,15 +85,18 @@ _tp_boxed_to_variant (GType gtype, return g_variant_ref_sink (ret); } -/* - * _tp_asv_from_vardict: +/** + * 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) +tp_asv_from_vardict (GVariant *variant) { GValue v = G_VALUE_INIT; GHashTable *result; diff --git a/telepathy-glib/variant-util.h b/telepathy-glib/variant-util.h index 191cc3b67..2a9b517c7 100644 --- a/telepathy-glib/variant-util.h +++ b/telepathy-glib/variant-util.h @@ -35,6 +35,10 @@ 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); + const gchar *tp_vardict_get_string (GVariant *variant, const gchar *key); const gchar *tp_vardict_get_object_path (GVariant *variant, diff --git a/tests/asv.c b/tests/asv.c index 390304f80..3c04bdb2e 100644 --- a/tests/asv.c +++ b/tests/asv.c @@ -113,7 +113,7 @@ int main (int argc, char **argv) tp_asv_dump (hash); - vardict = _tp_asv_to_vardict (hash); + vardict = tp_asv_to_vardict (hash); /* Tests: tp_asv_get_boolean */ |