From 5fc16e172814745c2f40dffb35bb04c3d4f75f2b Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 11 Jan 2010 15:57:16 +0000 Subject: factor out connect_account --- libempathy/empathy-dispatcher.c | 21 ++++++++++++++------- 1 file 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 @@ -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); } -- cgit v1.2.3