aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-connection-managers.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-06-05 21:16:18 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-06-06 17:33:21 +0800
commit0e095b8af9cd07ae32823f73b889fdbfb47d6f2a (patch)
tree479664f2770b10eaaa6449382f4cbc98c575f9e8 /libempathy/empathy-connection-managers.c
parent505305a0bc8f02ca770014682f0794b8c9353aef (diff)
downloadgsoc2013-empathy-0e095b8af9cd07ae32823f73b889fdbfb47d6f2a.tar
gsoc2013-empathy-0e095b8af9cd07ae32823f73b889fdbfb47d6f2a.tar.gz
gsoc2013-empathy-0e095b8af9cd07ae32823f73b889fdbfb47d6f2a.tar.bz2
gsoc2013-empathy-0e095b8af9cd07ae32823f73b889fdbfb47d6f2a.tar.lz
gsoc2013-empathy-0e095b8af9cd07ae32823f73b889fdbfb47d6f2a.tar.xz
gsoc2013-empathy-0e095b8af9cd07ae32823f73b889fdbfb47d6f2a.tar.zst
gsoc2013-empathy-0e095b8af9cd07ae32823f73b889fdbfb47d6f2a.zip
use tp_list_connection_managers_async()
https://bugzilla.gnome.org/show_bug.cgi?id=677465
Diffstat (limited to 'libempathy/empathy-connection-managers.c')
-rw-r--r--libempathy/empathy-connection-managers.c48
1 files changed, 30 insertions, 18 deletions
diff --git a/libempathy/empathy-connection-managers.c b/libempathy/empathy-connection-managers.c
index a39f3ae80..84a318210 100644
--- a/libempathy/empathy-connection-managers.c
+++ b/libempathy/empathy-connection-managers.c
@@ -208,41 +208,53 @@ empathy_connection_managers_is_ready (EmpathyConnectionManagers *self)
}
static void
-empathy_connection_managers_listed_cb (TpConnectionManager * const *cms,
- gsize n_cms,
- const GError *error,
- gpointer user_data,
- GObject *weak_object)
+empathy_connection_managers_listed_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
{
- EmpathyConnectionManagers *self =
- EMPATHY_CONNECTION_MANAGERS (weak_object);
- EmpathyConnectionManagersPriv *priv = GET_PRIV (self);
- TpConnectionManager * const *iter;
+ TpWeakRef *wr = user_data;
+ GError *error = NULL;
+ EmpathyConnectionManagers *self = tp_weak_ref_dup_object (wr);
+ GList *cms, *l;
+ EmpathyConnectionManagersPriv *priv;
+
+ if (self == NULL)
+ {
+ tp_weak_ref_destroy (wr);
+ return;
+ }
+
+ priv = GET_PRIV (self);
empathy_connection_managers_free_cm_list (self);
+ cms = tp_list_connection_managers_finish (result, &error);
if (error != NULL)
{
DEBUG ("Failed to get connection managers: %s", error->message);
+ g_error_free (error);
goto out;
}
- for (iter = cms ; iter != NULL && *iter != NULL; iter++)
+ for (l = cms ; l != NULL; l = g_list_next (l))
{
+ TpConnectionManager *cm = l->data;
+
/* only list cms that didn't hit errors */
- if (tp_proxy_is_prepared (*iter, TP_CONNECTION_MANAGER_FEATURE_CORE))
- priv->cms = g_list_prepend (priv->cms, g_object_ref (*iter));
+ if (tp_proxy_is_prepared (cm, TP_CONNECTION_MANAGER_FEATURE_CORE))
+ priv->cms = g_list_prepend (priv->cms, g_object_ref (cm));
}
out:
- g_object_ref (weak_object);
if (!priv->ready)
{
priv->ready = TRUE;
- g_object_notify (weak_object, "ready");
+ g_object_notify (G_OBJECT (self), "ready");
}
- g_signal_emit (weak_object, signals[UPDATED], 0);
- g_object_unref (weak_object);
+
+ g_signal_emit (self, signals[UPDATED], 0);
+ g_object_unref (self);
+ tp_weak_ref_destroy (wr);
}
void
@@ -250,9 +262,9 @@ empathy_connection_managers_update (EmpathyConnectionManagers *self)
{
EmpathyConnectionManagersPriv *priv = GET_PRIV (self);
- tp_list_connection_managers (priv->dbus,
+ tp_list_connection_managers_async (priv->dbus,
empathy_connection_managers_listed_cb,
- NULL, NULL, G_OBJECT (self));
+ tp_weak_ref_new (self, NULL, NULL));
}
GList *