]> git.0d.be Git - empathy.git/commitdiff
factor out connect_account
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 11 Jan 2010 15:57:16 +0000 (15:57 +0000)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 11 Jan 2010 16:04:47 +0000 (16:04 +0000)
libempathy/empathy-dispatcher.c

index e80f7022f82cf75e8c6e3dc75fad8c1c7f20f1d1..b0991c1cefc5f2e6a22562c1c678ed606a321701 100644 (file)
@@ -1135,6 +1135,19 @@ empathy_dispatcher_class_init (EmpathyDispatcherClass *klass)
   g_type_class_add_private (object_class, sizeof (EmpathyDispatcherPriv));
 }
 
+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,
@@ -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);
 }