factor out update_account()
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 24 Oct 2011 13:51:23 +0000 (15:51 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 27 Oct 2011 11:44:29 +0000 (13:44 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=662609

libempathy-gtk/empathy-account-chooser.c

index e7f2bd5b7df463a6443b2ba408fe2a990c18321e..c0df6a6a60b7313558889edeadf2d3cb92bdf793 100644 (file)
@@ -152,6 +152,8 @@ static gboolean account_chooser_set_account_foreach (GtkTreeModel *model,
     GtkTreePath *path,
     GtkTreeIter *iter,
     SetAccountData *data);
+static void update_account (EmpathyAccountChooser *self,
+    TpAccount *account);
 
 enum {
   PROP_0,
@@ -851,6 +853,16 @@ account_chooser_update_iter (EmpathyAccountChooser *self,
   g_object_unref (account);
 }
 
+static void
+update_account (EmpathyAccountChooser *self,
+    TpAccount *account)
+{
+  GtkTreeIter iter;
+
+  if (account_chooser_find_account (self, account, &iter))
+    account_chooser_update_iter (self, &iter);
+}
+
 static void
 account_chooser_status_changed_cb (TpAccount *account,
     guint old_status,
@@ -861,10 +873,8 @@ account_chooser_status_changed_cb (TpAccount *account,
     gpointer user_data)
 {
   EmpathyAccountChooser *self = user_data;
-  GtkTreeIter iter;
 
-  if (account_chooser_find_account (self, account, &iter))
-    account_chooser_update_iter (self, &iter);
+  update_account (self, account);
 }
 
 static gboolean