[evolution-ews] Bug #695311 - Fill email address even when autodiscovery process is not called



commit c4c270f6c15c0b286085fe569be0c496b2775f88
Author: Fabiano Fidêncio <fabiano fidencio org>
Date:   Wed Mar 6 22:42:57 2013 +0100

    Bug #695311 - Fill email address even when autodiscovery process is not called

 src/configuration/e-mail-config-ews-autodiscover.c |    2 -
 src/configuration/e-mail-config-ews-backend.c      |   31 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/src/configuration/e-mail-config-ews-autodiscover.c 
b/src/configuration/e-mail-config-ews-autodiscover.c
index b396d4d..9dcbd44 100644
--- a/src/configuration/e-mail-config-ews-autodiscover.c
+++ b/src/configuration/e-mail-config-ews-autodiscover.c
@@ -257,8 +257,6 @@ mail_config_ews_autodiscover_try_password_sync (ESourceAuthenticator *auth,
 
        if (local_error == NULL) {
                result = E_SOURCE_AUTHENTICATION_ACCEPTED;
-               camel_ews_settings_set_email (ews_settings, email_address);
-
        } else if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED)) {
                result = E_SOURCE_AUTHENTICATION_REJECTED;
                g_error_free (local_error);
diff --git a/src/configuration/e-mail-config-ews-backend.c b/src/configuration/e-mail-config-ews-backend.c
index 0ef4f30..74c35a7 100644
--- a/src/configuration/e-mail-config-ews-backend.c
+++ b/src/configuration/e-mail-config-ews-backend.c
@@ -340,6 +340,7 @@ mail_config_ews_backend_setup_defaults (EMailConfigServiceBackend *backend)
 
                ews_settings = CAMEL_EWS_SETTINGS (settings);
                camel_ews_settings_set_hosturl (ews_settings, hosturl);
+               camel_ews_settings_set_email (ews_settings, email_address);
 
                network_settings = CAMEL_NETWORK_SETTINGS (settings);
                camel_network_settings_set_user (network_settings, parts[0]);
@@ -390,6 +391,35 @@ mail_config_ews_backend_check_complete (EMailConfigServiceBackend *backend)
 }
 
 static void
+mail_config_ews_backend_commit_changes (EMailConfigServiceBackend *backend)
+{
+       CamelSettings *settings;
+       CamelEwsSettings *ews_settings;
+       EMailConfigServicePage *page;
+       const gchar *email_address;
+
+       page = e_mail_config_service_backend_get_page (backend);
+
+       /* This backend serves double duty.  One instance holds the
+        * mail account source, another holds the mail transport source.
+        * We can differentiate by examining the EMailConfigServicePage
+        * the backend is associated with.  This method only applies to
+        * the Receiving Page. */
+       if (!E_IS_MAIL_CONFIG_RECEIVING_PAGE (page))
+               return;
+
+       /* This needs to come _after_ the page type check so we don't
+        * introduce a backend extension in the mail transport source. */
+       settings = e_mail_config_service_backend_get_settings (backend);
+
+       email_address = e_mail_config_service_page_get_email_address (page);
+       if (email_address != NULL) {
+               ews_settings = CAMEL_EWS_SETTINGS (settings);
+               camel_ews_settings_set_email (ews_settings, email_address);
+       }
+}
+
+static void
 e_mail_config_ews_backend_class_init (EMailConfigEwsBackendClass *class)
 {
        EMailConfigServiceBackendClass *backend_class;
@@ -403,6 +433,7 @@ e_mail_config_ews_backend_class_init (EMailConfigEwsBackendClass *class)
        backend_class->insert_widgets = mail_config_ews_backend_insert_widgets;
        backend_class->setup_defaults = mail_config_ews_backend_setup_defaults;
        backend_class->check_complete = mail_config_ews_backend_check_complete;
+       backend_class->commit_changes = mail_config_ews_backend_commit_changes;
 }
 
 static void


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