[empathy/next] Adapt for GVariant-based capabilities API
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy/next] Adapt for GVariant-based capabilities API
- Date: Tue, 8 Apr 2014 19:30:29 +0000 (UTC)
commit 8b54b447535adbf1736e4643fb49899cc42c6f40
Author: Simon McVittie <simon mcvittie collabora co uk>
Date: Mon Apr 7 17:20:37 2014 +0100
Adapt for GVariant-based capabilities API
libempathy/empathy-ft-handler.c | 28 ++++++++++++++--------------
libempathy/empathy-tp-chat.c | 2 +-
2 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c
index 21e44d8..cc268f9 100644
--- a/libempathy/empathy-ft-handler.c
+++ b/libempathy/empathy-ft-handler.c
@@ -1067,38 +1067,36 @@ callbacks_data_free (gpointer user_data)
static gboolean
set_content_hash_type_from_classes (EmpathyFTHandler *handler,
- GPtrArray *classes)
+ GVariant *classes)
{
GArray *possible_values;
guint value;
gboolean valid;
EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
gboolean support_ft = FALSE;
- guint i;
+ GVariantIter iter;
+ GVariant *fixed;
possible_values = g_array_new (TRUE, TRUE, sizeof (guint));
- for (i = 0; i < classes->len; i++)
+ g_variant_iter_init (&iter, classes);
+
+ while (g_variant_iter_loop (&iter, "(@a{sv} as)", &fixed, NULL))
{
- GHashTable *fixed;
- GStrv allowed;
const gchar *chan_type;
- tp_value_array_unpack (g_ptr_array_index (classes, i), 2,
- &fixed, &allowed);
-
- chan_type = tp_asv_get_string (fixed, TP_PROP_CHANNEL_CHANNEL_TYPE);
+ chan_type = tp_vardict_get_string (fixed, TP_PROP_CHANNEL_CHANNEL_TYPE);
if (tp_strdiff (chan_type, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1))
continue;
- if (tp_asv_get_uint32 (fixed, TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, NULL) !=
- TP_ENTITY_TYPE_CONTACT)
+ if (tp_vardict_get_uint32 (fixed, TP_PROP_CHANNEL_TARGET_ENTITY_TYPE,
+ NULL) != TP_ENTITY_TYPE_CONTACT)
continue;
support_ft = TRUE;
- value = tp_asv_get_uint32
+ value = tp_vardict_get_uint32
(fixed, TP_PROP_CHANNEL_TYPE_FILE_TRANSFER1_CONTENT_HASH_TYPE,
&valid);
@@ -1156,7 +1154,7 @@ check_hashing (CallbacksData *data)
EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
GError *myerr = NULL;
TpCapabilities *caps;
- GPtrArray *classes;
+ GVariant *classes;
TpConnection *conn;
conn = empathy_contact_get_connection (priv->contact);
@@ -1168,7 +1166,7 @@ check_hashing (CallbacksData *data)
goto out;
}
- classes = tp_capabilities_get_channel_classes (caps);
+ classes = tp_capabilities_dup_channel_classes (caps);
/* set whether we support hash and the type of it */
if (!set_content_hash_type_from_classes (handler, classes))
@@ -1189,6 +1187,8 @@ check_hashing (CallbacksData *data)
data->callback (handler, NULL, data->user_data);
}
+ g_variant_unref (classes);
+
out:
callbacks_data_free (data);
}
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 801c02b..3018fb4 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -1355,7 +1355,7 @@ continue_preparing (EmpathyTpChat *self)
caps = tp_connection_get_capabilities (connection);
g_assert (caps != NULL);
- classes = tp_capabilities_dup_channel_classes_variant (caps);
+ classes = tp_capabilities_dup_channel_classes (caps);
g_variant_iter_init (&iter, classes);
while ((class = g_variant_iter_next_value (&iter)))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]