Commit 44fbd356 authored by Milan Crha's avatar Milan Crha

I#729 - New Mail account wizard ignores email address change

Closes GNOME/evolution#729
parent a4f2d8e2
......@@ -1069,7 +1069,26 @@ mail_config_assistant_prepare (GtkAssistant *assistant,
e_named_parameters_free (params);
}
if (E_IS_MAIL_CONFIG_RECEIVING_PAGE (page) && first_visit) {
if (!first_visit && E_IS_MAIL_CONFIG_IDENTITY_PAGE (page)) {
ESource *source;
ESourceMailIdentity *extension;
const gchar *email_address;
const gchar *extension_name;
source = priv->identity_source;
extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
extension = e_source_get_extension (source, extension_name);
email_address = e_source_mail_identity_get_address (extension);
/* Set the value to an empty string when going back to the identity page,
thus when moving away from it the source's display name is updated
with the new address, in case it changed. Do not modify the display
name when the user changed it. */
if (g_strcmp0 (e_mail_config_summary_page_get_account_name (priv->summary_page), email_address) == 0)
e_source_set_display_name (source, "");
}
if (E_IS_MAIL_CONFIG_RECEIVING_PAGE (page)) {
ESource *source;
ESourceMailIdentity *extension;
const gchar *email_address;
......@@ -1084,7 +1103,9 @@ mail_config_assistant_prepare (GtkAssistant *assistant,
extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
extension = e_source_get_extension (source, extension_name);
email_address = e_source_mail_identity_get_address (extension);
e_source_set_display_name (source, email_address);
if (first_visit || g_strcmp0 (e_source_get_display_name (source), "") == 0)
e_source_set_display_name (source, email_address);
}
if (first_visit && (
......
......@@ -53,6 +53,8 @@ struct _EMailConfigSummaryPagePrivate {
GtkLabel *send_user_label;
GtkLabel *send_security_label;
GtkEntry *account_name_entry;
GBinding *account_name_binding;
};
enum {
......@@ -549,9 +551,6 @@ mail_config_summary_page_refresh (EMailConfigSummaryPage *page)
const gchar *extension_name;
const gchar *value;
value = e_source_get_display_name (source);
gtk_entry_set_text (priv->account_name_entry, value);
extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
extension = e_source_get_extension (source, extension_name);
......@@ -830,6 +829,14 @@ e_mail_config_summary_page_get_internal_box (EMailConfigSummaryPage *page)
return page->priv->main_box;
}
const gchar *
e_mail_config_summary_page_get_account_name (EMailConfigSummaryPage *page)
{
g_return_val_if_fail (E_IS_MAIL_CONFIG_SUMMARY_PAGE (page), NULL);
return gtk_entry_get_text (page->priv->account_name_entry);
}
void
e_mail_config_summary_page_refresh (EMailConfigSummaryPage *page)
{
......@@ -934,6 +941,11 @@ e_mail_config_summary_page_set_identity_source (EMailConfigSummaryPage *page,
page->priv->identity_source = identity_source;
page->priv->identity_source_changed_id = 0;
if (page->priv->account_name_binding) {
g_binding_unbind (page->priv->account_name_binding);
page->priv->account_name_binding = NULL;
}
if (identity_source != NULL) {
gulong handler_id;
......@@ -943,6 +955,11 @@ e_mail_config_summary_page_set_identity_source (EMailConfigSummaryPage *page,
page);
page->priv->identity_source_changed_id = handler_id;
page->priv->account_name_binding =
e_binding_bind_property (identity_source, "display-name",
page->priv->account_name_entry, "text",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
}
g_object_notify (G_OBJECT (page), "identity-source");
......
......@@ -68,6 +68,8 @@ EMailConfigPage *
e_mail_config_summary_page_new (void);
GtkBox * e_mail_config_summary_page_get_internal_box
(EMailConfigSummaryPage *page);
const gchar * e_mail_config_summary_page_get_account_name
(EMailConfigSummaryPage *page);
void e_mail_config_summary_page_refresh
(EMailConfigSummaryPage *page);
EMailConfigServiceBackend *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment