[empathy] account_assistant_apply_account_and_finish: explicitely ask to set the display name



commit 6cdc040da5561c019ed87cc0a3c6ac10eb5b9223
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Fri Apr 9 10:01:45 2010 +0200

    account_assistant_apply_account_and_finish: explicitely ask to set the display name
    
    Checking if priv->current_widget_object is NULL or not isn't right because if
    we create a normal account before the Salut one, this pointer is not NULL and
    we rename the Salut account to the same name that the standard one.
    
    This patch adds an extra argument account_assistant_apply_account_and_finish
    saying if we should set a new display name or not. It's more clear and avoid
    to rely on side effects.
    
    Fixes bug #615058

 src/empathy-account-assistant.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/src/empathy-account-assistant.c b/src/empathy-account-assistant.c
index 9860259..f516692 100644
--- a/src/empathy-account-assistant.c
+++ b/src/empathy-account-assistant.c
@@ -339,7 +339,8 @@ account_assistant_apply_account_cb (GObject *source,
 
 static void
 account_assistant_apply_account_and_finish (EmpathyAccountAssistant *self,
-    EmpathyAccountSettings *settings)
+    EmpathyAccountSettings *settings,
+    gboolean set_display_name)
 {
   EmpathyAccountAssistantPriv *priv = GET_PRIV (self);
 
@@ -348,9 +349,7 @@ account_assistant_apply_account_and_finish (EmpathyAccountAssistant *self,
 
   priv->is_creating = TRUE;
 
-  /* set default display name, if there is no current widget then assume the
-   * display name was already set correctly. e.g. salut account creation */
-  if (priv->current_widget_object != NULL)
+  if (set_display_name)
     {
       gchar *display_name;
 
@@ -896,14 +895,17 @@ impl_signal_apply (GtkAssistant *assistant)
   if (current_page == PAGE_SALUT)
     {
       if (priv->create_salut_account)
-        account_assistant_apply_account_and_finish (self, priv->salut_settings);
+        /* create_salut_account_settings() already set the display name of the
+         * account so there is no need to set it again. */
+        account_assistant_apply_account_and_finish (self, priv->salut_settings,
+            FALSE);
       return;
     }
   else if (current_page == PAGE_ENTER_CREATE &&
       priv->settings != NULL &&
       empathy_account_settings_is_valid (priv->settings))
     {
-      account_assistant_apply_account_and_finish (self, priv->settings);
+      account_assistant_apply_account_and_finish (self, priv->settings, TRUE);
     }
 }
 
@@ -948,7 +950,8 @@ impl_signal_prepare (GtkAssistant *assistant,
       if (priv->settings != NULL &&
           empathy_account_settings_is_valid (priv->settings))
         {
-          account_assistant_apply_account_and_finish (self, priv->settings);
+          account_assistant_apply_account_and_finish (self, priv->settings,
+              TRUE);
           g_object_unref (priv->settings);
           priv->settings = NULL;
         }



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