[empathy] factor out connect_account



commit 5fc16e172814745c2f40dffb35bb04c3d4f75f2b
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Jan 11 15:57:16 2010 +0000

    factor out connect_account

 libempathy/empathy-dispatcher.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c
index e80f702..b0991c1 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);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]