From 6cdc040da5561c019ed87cc0a3c6ac10eb5b9223 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 9 Apr 2010 10:01:45 +0200 Subject: 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 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/empathy-account-assistant.c b/src/empathy-account-assistant.c index 9860259fa..f516692b9 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; } -- cgit v1.2.3