]> git.0d.be Git - empathy.git/commitdiff
accounts-dialog: wait that account is prepared before calling accounts_dialog_add_account
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 13 Nov 2009 14:31:34 +0000 (14:31 +0000)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 13 Nov 2009 14:31:34 +0000 (14:31 +0000)
This ensure that EmpathyAccountSettings has been updated and so we don't
add a new row in the model for this account (#601796).

src/empathy-accounts-dialog.c

index e4e963c9ac6df3b677417d788057f87260cde30b..daae3d874c8b713e6b16df0605500bd592bdcb14 100644 (file)
@@ -1236,13 +1236,32 @@ accounts_dialog_add_account (EmpathyAccountsDialog *dialog,
   g_object_unref (settings);
 }
 
+static void
+account_prepare_cb (GObject *source_object,
+    GAsyncResult *result,
+    gpointer user_data)
+{
+  EmpathyAccountsDialog *dialog = EMPATHY_ACCOUNTS_DIALOG (user_data);
+  TpAccount *account = TP_ACCOUNT (source_object);
+  GError *error = NULL;
+
+  if (!tp_account_prepare_finish (account, result, &error))
+    {
+      DEBUG ("Failed to prepare account: %s", error->message);
+      g_error_free (error);
+      return;
+    }
+
+  accounts_dialog_add_account (dialog, account);
+}
+
 static void
 accounts_dialog_account_validity_changed_cb (TpAccountManager *manager,
     TpAccount *account,
     gboolean valid,
     EmpathyAccountsDialog *dialog)
 {
-  accounts_dialog_add_account (dialog, account);
+  tp_account_prepare_async (account, NULL, account_prepare_cb, dialog);
 }
 
 static void