[empathy] accounts_dialog_accounts_setup: use empathy_connection_managers_prepare_async



commit 386ee2dc8453117ff1a2042ff0428a34d646b952
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Jan 25 14:57:09 2010 +0000

    accounts_dialog_accounts_setup: use empathy_connection_managers_prepare_async
    
    That way we are sure that the callback is called even if the managers is
    already ready (#607925).

 src/empathy-accounts-dialog.c |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index a64363e..190cc96 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -1724,23 +1724,24 @@ accounts_dialog_set_selected_account (EmpathyAccountsDialog *dialog,
 }
 
 static void
-accounts_dialog_cms_ready_cb (EmpathyConnectionManagers *cms,
-    GParamSpec *pspec,
-    EmpathyAccountsDialog *dialog)
+accounts_dialog_cms_prepare_cb (GObject *source,
+    GAsyncResult *result,
+    gpointer user_data)
 {
+  EmpathyConnectionManagers *cms = EMPATHY_CONNECTION_MANAGERS (source);
+  EmpathyAccountsDialog *dialog = user_data;
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
 
-  if (empathy_connection_managers_is_ready (cms))
-    {
-      accounts_dialog_update_settings (dialog, NULL);
+  if (!empathy_connection_managers_prepare_finish (cms, result, NULL))
+    return;
 
-      if (priv->initial_selection != NULL)
-        {
-          accounts_dialog_set_selected_account
-              (dialog, priv->initial_selection);
-          g_object_unref (priv->initial_selection);
-          priv->initial_selection = NULL;
-        }
+  accounts_dialog_update_settings (dialog, NULL);
+
+  if (priv->initial_selection != NULL)
+    {
+      accounts_dialog_set_selected_account (dialog, priv->initial_selection);
+      g_object_unref (priv->initial_selection);
+      priv->initial_selection = NULL;
     }
 }
 
@@ -1777,9 +1778,9 @@ accounts_dialog_accounts_setup (EmpathyAccountsDialog *dialog)
   g_list_free (accounts);
 
   priv->cms = empathy_connection_managers_dup_singleton ();
-  if (!empathy_connection_managers_is_ready (priv->cms))
-    g_signal_connect (priv->cms, "notify::ready",
-        G_CALLBACK (accounts_dialog_cms_ready_cb), dialog);
+
+  empathy_connection_managers_prepare_async (priv->cms,
+      accounts_dialog_cms_prepare_cb, dialog);
 
   accounts_dialog_model_select_first (dialog);
 }



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