refilter if the TpConnection of a TpAccount is changed
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 24 Oct 2011 13:53:34 +0000 (15:53 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 27 Oct 2011 11:44:30 +0000 (13:44 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=662609

libempathy-gtk/empathy-account-chooser.c

index c0df6a6a60b7313558889edeadf2d3cb92bdf793..f743db99e3e65ff32096c4628d34c1219e6a268f 100644 (file)
@@ -247,6 +247,14 @@ account_cmp (GtkTreeModel *model,
   return result;
 }
 
+static void
+account_connection_notify_cb (TpAccount *account,
+    GParamSpec *spec,
+    EmpathyAccountChooser *self)
+{
+  update_account (self, account);
+}
+
 static void
 account_manager_prepared_cb (GObject *source_object,
     GAsyncResult *result,
@@ -275,6 +283,14 @@ account_manager_prepared_cb (GObject *source_object,
       tp_g_signal_connect_object (account, "status-changed",
           G_CALLBACK (account_chooser_status_changed_cb),
           self, 0);
+
+      /* We generally use the TpConnection from the account to filter it so,
+       * just relying on the account status is not enough. In some case we the
+       * status change can be notified while the TpConnection is still
+       * preparing. */
+      tp_g_signal_connect_object (account, "notify::connection",
+          G_CALLBACK (account_connection_notify_cb),
+          self, 0);
     }
 
   g_list_free (accounts);