aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-08-12 17:30:03 +0800
committerMilan Crha <mcrha@redhat.com>2011-08-12 17:30:03 +0800
commitb7cfbb7d677010cd7948d14563b8e88c7da0d9b3 (patch)
tree66d950cb79e2429dfd106b39af72b2f220d6bf91 /mail
parent0e264ffcfba09c882d39ccd386475fcfcfd531e3 (diff)
downloadgsoc2013-evolution-b7cfbb7d677010cd7948d14563b8e88c7da0d9b3.tar
gsoc2013-evolution-b7cfbb7d677010cd7948d14563b8e88c7da0d9b3.tar.gz
gsoc2013-evolution-b7cfbb7d677010cd7948d14563b8e88c7da0d9b3.tar.bz2
gsoc2013-evolution-b7cfbb7d677010cd7948d14563b8e88c7da0d9b3.tar.lz
gsoc2013-evolution-b7cfbb7d677010cd7948d14563b8e88c7da0d9b3.tar.xz
gsoc2013-evolution-b7cfbb7d677010cd7948d14563b8e88c7da0d9b3.tar.zst
gsoc2013-evolution-b7cfbb7d677010cd7948d14563b8e88c7da0d9b3.zip
Bug #656267 - Checking for auth types doesn't work properly
Diffstat (limited to 'mail')
-rw-r--r--mail/em-account-editor.c42
-rw-r--r--mail/mail.error.xml5
2 files changed, 33 insertions, 14 deletions
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 5ae0b9ea1f..3a391eae0e 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -1937,6 +1937,8 @@ emae_check_authtype_done (CamelService *camel_service,
GAsyncResult *result,
EMAccountEditorService *service)
{
+ EMailBackend *backend;
+ EMailSession *session;
GtkWidget *editor;
GList *auth_types;
GError *error = NULL;
@@ -1944,13 +1946,15 @@ emae_check_authtype_done (CamelService *camel_service,
auth_types = camel_service_query_auth_types_finish (
camel_service, result, &error);
+ editor = E_CONFIG (service->emae->config)->window;
+
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_warn_if_fail (auth_types == NULL);
g_error_free (error);
} else if (error != NULL) {
g_warn_if_fail (auth_types == NULL);
- g_warning ("%s", error->message);
+ e_alert_run_dialog_for_args (GTK_WINDOW (service->check_dialog), "mail:checking-service-error", error->message, NULL);
g_error_free (error);
} else {
@@ -1962,11 +1966,15 @@ emae_check_authtype_done (CamelService *camel_service,
gtk_widget_destroy (service->check_dialog);
service->check_dialog = NULL;
- editor = E_CONFIG (service->emae->config)->window;
-
if (editor != NULL)
gtk_widget_set_sensitive (editor, TRUE);
+ backend = em_account_editor_get_backend (service->emae);
+ session = e_mail_backend_get_session (backend);
+
+ /* drop the temporary CamelService */
+ camel_session_remove_service (CAMEL_SESSION (session), camel_service_get_uid (camel_service));
+
g_object_unref (service->emae);
}
@@ -1989,6 +1997,8 @@ emae_check_authtype (GtkWidget *w,
GtkWidget *editor;
gpointer parent;
gchar *uid;
+ const gchar *url_string;
+ GError *error = NULL;
account = em_account_editor_get_modified_account (service->emae);
editor = E_CONFIG (service->emae->config)->window;
@@ -1996,16 +2006,25 @@ emae_check_authtype (GtkWidget *w,
backend = em_account_editor_get_backend (service->emae);
session = e_mail_backend_get_session (backend);
- if (service->type == CAMEL_PROVIDER_TRANSPORT)
- uid = g_strconcat (account->uid, "-transport", NULL);
- else
- uid = g_strdup (account->uid);
+ uid = g_strdup_printf ("emae-check-authtype-%p", service);
+ url_string = e_account_get_string (account, emae_service_info[service->type].account_uri_key);
- camel_service = camel_session_get_service (
- CAMEL_SESSION (session), uid);
+ /* to test on actual data, not on previously used */
+ camel_service = camel_session_add_service (CAMEL_SESSION (session), uid, url_string, service->type, &error);
g_free (uid);
+ if (editor != NULL)
+ parent = gtk_widget_get_toplevel (editor);
+ else
+ parent = gtk_widget_get_toplevel (w);
+
+ if (error) {
+ e_alert_run_dialog_for_args (parent, "mail:checking-service-error", error->message, NULL);
+ g_clear_error (&error);
+ return;
+ }
+
g_return_if_fail (CAMEL_IS_SERVICE (camel_service));
if (service->checking != NULL) {
@@ -2015,11 +2034,6 @@ emae_check_authtype (GtkWidget *w,
service->checking = g_cancellable_new ();
- if (editor != NULL)
- parent = gtk_widget_get_toplevel (editor);
- else
- parent = gtk_widget_get_toplevel (w);
-
service->check_dialog = e_alert_dialog_new_for_args (
parent, "mail:checking-service", NULL);
diff --git a/mail/mail.error.xml b/mail/mail.error.xml
index 0fa46c726c..f32b4ce688 100644
--- a/mail/mail.error.xml
+++ b/mail/mail.error.xml
@@ -404,6 +404,11 @@ An mbox account will be created to preserve the old mbox folders. You can delete
<button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
</error>
+ <error id="checking-service-error" type="error">
+ <_primary>Failed to query server for a list of supported authentication mechanisms.</_primary>
+ <secondary xml:space="preserve">{0}</secondary>
+ </error>
+
<error id="gw-accountsetup-error" type="error">
<_primary>Unable to connect to the GroupWise server.</_primary>
<_secondary xml:space="preserve">Please check your account settings and try again.</_secondary>