aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-01-11 23:57:16 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-01-12 00:04:47 +0800
commit5fc16e172814745c2f40dffb35bb04c3d4f75f2b (patch)
treef194360dc8f55e3e1671894df1581bd84456a950
parenteab24ccdd00311bd06ce47c36ac388489237ae12 (diff)
downloadgsoc2013-empathy-5fc16e172814745c2f40dffb35bb04c3d4f75f2b.tar
gsoc2013-empathy-5fc16e172814745c2f40dffb35bb04c3d4f75f2b.tar.gz
gsoc2013-empathy-5fc16e172814745c2f40dffb35bb04c3d4f75f2b.tar.bz2
gsoc2013-empathy-5fc16e172814745c2f40dffb35bb04c3d4f75f2b.tar.lz
gsoc2013-empathy-5fc16e172814745c2f40dffb35bb04c3d4f75f2b.tar.xz
gsoc2013-empathy-5fc16e172814745c2f40dffb35bb04c3d4f75f2b.tar.zst
gsoc2013-empathy-5fc16e172814745c2f40dffb35bb04c3d4f75f2b.zip
factor out connect_account
-rw-r--r--libempathy/empathy-dispatcher.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c
index e80f7022f..b0991c1ce 100644
--- a/libempathy/empathy-dispatcher.c
+++ b/libempathy/empathy-dispatcher.c
@@ -1136,6 +1136,19 @@ empathy_dispatcher_class_init (EmpathyDispatcherClass *klass)
}
static void
+connect_account (EmpathyDispatcher *self,
+ TpAccount *account)
+{
+ EmpathyDispatcherPriv *priv = GET_PRIV (self);
+ TpConnection *conn = tp_account_get_connection (account);
+ if (conn != NULL)
+ dispatcher_status_changed_cb (account, 0, 0, 0, NULL, NULL, self);
+
+ id = g_signal_connect (account, "status-changed",
+ G_CALLBACK (dispatcher_status_changed_cb), self);
+}
+
+static void
account_manager_prepared_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
@@ -1156,14 +1169,8 @@ account_manager_prepared_cb (GObject *source_object,
for (l = accounts; l; l = l->next)
{
TpAccount *a = l->data;
- TpConnection *conn = tp_account_get_connection (a);
-
- if (conn != NULL)
- dispatcher_status_changed_cb (a, 0, 0, 0, NULL, NULL, self);
- empathy_signal_connect_weak (a, "status-changed",
- G_CALLBACK (dispatcher_status_changed_cb),
- G_OBJECT (self));
+ connect_account (self, a);
}
g_list_free (accounts);
}