[empathy] emit account-created signal outside enabled_cb



commit 53a0fc1ae74070e6268173294ba986bc2c7e3e07
Author: Felix Kaser <f kaser gmx net>
Date:   Tue Nov 24 18:13:17 2009 +0100

    emit account-created signal outside enabled_cb
    
    the account-created signal should be emitted independently from enabled-callback. the signal should be emitted even if for some reason the account could not be enabled.

 libempathy-gtk/empathy-account-widget.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index f69f041..a5b5b79 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -652,21 +652,14 @@ account_widget_account_enabled_cb (GObject *source_object,
 {
   GError *error = NULL;
   TpAccount *account = TP_ACCOUNT (source_object);
-  EmpathyAccountWidget *widget = EMPATHY_ACCOUNT_WIDGET (user_data);
-  EmpathyAccountWidgetPriv *priv = GET_PRIV (widget);
 
   tp_account_set_enabled_finish (account, res, &error);
 
   if (error != NULL)
     {
-      DEBUG ("Could not automatically enable new account: %s", error->message);
+      DEBUG ("Could not enable the account: %s", error->message);
       g_error_free (error);
     }
-  else
-    {
-      priv->account_created = TRUE;
-      g_signal_emit (widget, signals[ACCOUNT_CREATED], 0);
-    }
 }
 
 static void
@@ -697,7 +690,9 @@ account_widget_applied_cb (GObject *source_object,
         {
           /* By default, when an account is created, we enable it. */
           tp_account_set_enabled_async (account, TRUE,
-              account_widget_account_enabled_cb, widget);
+              account_widget_account_enabled_cb, NULL);
+          priv->account_created = TRUE;
+          g_signal_emit (widget, signals[ACCOUNT_CREATED], 0);
         }
       else if (priv->enabled_checkbox != NULL)
         {



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