From 9820682c57b8d5fb29218e35822254e6189be69e Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 12 May 2014 14:32:00 +0200 Subject: [PATCH 11/11] base-client: pass a GVariant to ensure_account_connection_channel() No more vardict conversions in TpBaseClient \o/ --- telepathy-glib/base-client.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/telepathy-glib/base-client.c b/telepathy-glib/base-client.c index 4266fbe..dacf608 100644 --- a/telepathy-glib/base-client.c +++ b/telepathy-glib/base-client.c @@ -1528,7 +1528,7 @@ ensure_account_connection_channel (TpBaseClient *self, const gchar *account_path, const gchar *connection_path, const gchar *chan_path, - GHashTable *chan_props, + GVariant *chan_props, TpAccount **account, TpConnection **connection, TpChannel **channel, @@ -1557,7 +1557,7 @@ ensure_account_connection_channel (TpBaseClient *self, _tp_connection_set_account (*connection, *account); *channel = tp_client_factory_ensure_channel (self->priv->factory, - *connection, chan_path, tp_asv_to_vardict (chan_props), error); + *connection, chan_path, chan_props, error); if (*channel == NULL) goto error; @@ -1630,7 +1630,6 @@ _tp_base_client_observe_channel (_TpGDBusClientObserverSkeleton *skeleton, GArray *account_features; GArray *connection_features; GArray *channel_features; - GHashTable *asv = NULL; if (cls->observe_channel == NULL) { @@ -1641,9 +1640,8 @@ _tp_base_client_observe_channel (_TpGDBusClientObserverSkeleton *skeleton, return TRUE; } - asv = tp_asv_from_vardict (channel_props); if (!ensure_account_connection_channel (self, account_path, - connection_path, channel_path, asv, &account, &connection, + connection_path, channel_path, channel_props, &account, &connection, &channel, &error)) goto out; @@ -1689,7 +1687,6 @@ out: g_clear_object (&account); g_clear_object (&connection); g_clear_object (&channel); - g_clear_pointer (&asv, g_hash_table_unref); if (dispatch_operation != NULL) g_object_unref (dispatch_operation); @@ -1788,7 +1785,6 @@ _tp_base_client_add_dispatch_operation (_TpGDBusClientApprover *skeleton, const gchar *account_path; const gchar *connection_path; const gchar *chan_path; - GHashTable *chan_props = NULL; GError *error = NULL; TpAccount *account = NULL; TpConnection *connection = NULL; @@ -1798,7 +1794,7 @@ _tp_base_client_add_dispatch_operation (_TpGDBusClientApprover *skeleton, GArray *connection_features; GArray *channel_features; GVariantDict dict; - GVariant *v; + GVariant *chan_props; if (cls->add_dispatch_operation == NULL) { @@ -1839,10 +1835,10 @@ _tp_base_client_add_dispatch_operation (_TpGDBusClientApprover *skeleton, goto out; } - v = g_variant_dict_lookup_value (&dict, + chan_props = g_variant_dict_lookup_value (&dict, TP_PROP_CHANNEL_DISPATCH_OPERATION_CHANNEL_PROPERTIES, G_VARIANT_TYPE_VARDICT); - if (v == NULL) + if (chan_props == NULL) { g_set_error (&error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "Properties doesn't contain 'ChannelProperties'"); @@ -1850,7 +1846,6 @@ _tp_base_client_add_dispatch_operation (_TpGDBusClientApprover *skeleton, goto out; } - chan_props = tp_asv_from_vardict (v); if (!ensure_account_connection_channel (self, account_path, connection_path, chan_path, chan_props, &account, &connection, &channel, &error)) @@ -1890,7 +1885,6 @@ out: g_clear_object (&connection); g_clear_object (&channel); g_variant_dict_clear (&dict); - g_clear_pointer (&chan_props, g_hash_table_unref); if (dispatch_operation != NULL) g_object_unref (dispatch_operation); @@ -2151,7 +2145,6 @@ _tp_base_client_handle_channel (_TpGDBusClientHandler *skeleton, GArray *account_features; GArray *connection_features; GArray *channel_features; - GHashTable *asv; if (cls->handle_channel == NULL) { @@ -2162,10 +2155,8 @@ _tp_base_client_handle_channel (_TpGDBusClientHandler *skeleton, return TRUE; } - asv = tp_asv_from_vardict (channel_props); - if (!ensure_account_connection_channel (self, account_path, - connection_path, channel_path, asv, &account, &connection, + connection_path, channel_path, channel_props, &account, &connection, &channel, &error)) if (channel == NULL) goto out; @@ -2190,7 +2181,6 @@ _tp_base_client_handle_channel (_TpGDBusClientHandler *skeleton, g_array_unref (account_features); g_array_unref (connection_features); g_array_unref (channel_features); - g_clear_pointer (&asv, g_hash_table_unref); out: g_clear_object (&account); -- 1.9.0