[empathy] accounts_dialog_enable_account_cb: use the usual async cb pattern



commit a787e76bd5803c0f5821c93cf5203c2c03d45001
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Fri Mar 30 13:44:13 2012 +0200

    accounts_dialog_enable_account_cb: use the usual async cb pattern
    
    No semantic change.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=673162

 src/empathy-accounts-dialog.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index b776e16..5a17df2 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -220,26 +220,25 @@ accounts_dialog_status_infobar_set_message (EmpathyAccountsDialog *dialog,
 }
 
 static void
-accounts_dialog_enable_account_cb (GObject *account,
+accounts_dialog_enable_account_cb (GObject *object,
     GAsyncResult *result,
     gpointer user_data)
 {
+  TpAccount *account = TP_ACCOUNT (object);
   GError *error = NULL;
+  TpAccountManager *am;
 
-  tp_account_set_enabled_finish (TP_ACCOUNT (account), result, &error);
-
-  if (error != NULL)
+  if (!tp_account_set_enabled_finish (account, result, &error))
     {
       DEBUG ("Could not enable the account: %s", error->message);
       g_error_free (error);
+      return;
     }
-  else
-    {
-      TpAccountManager *am = tp_account_manager_dup ();
 
-      empathy_connect_new_account (TP_ACCOUNT (account), am);
-      g_object_unref (am);
-    }
+  am = tp_account_manager_dup ();
+
+  empathy_connect_new_account (account, am);
+  g_object_unref (am);
 }
 
 static void



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