* Manage all authentication errors in the account store
authorSergio Villar Senin <svillar@igalia.com>
Mon, 16 Jun 2008 12:04:47 +0000 (12:04 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 16 Jun 2008 12:04:47 +0000 (12:04 +0000)
pmo-trunk-r4689

src/modest-tny-account-store.c
src/modest-ui-actions.c

index 2e6c748..acee4be 100644 (file)
@@ -511,16 +511,8 @@ show_wrong_password_dialog (TnyAccount *account)
 { 
        /* This is easier than using a struct for the user_data: */
        ModestTnyAccountStore *self = modest_runtime_get_account_store();
-       GtkWidget *main_window;
        GtkWidget *dialog = NULL;
 
-       main_window = (GtkWidget *) modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (),
-                                                                      FALSE); /* don't create */
-       if (!main_window) {
-               g_warning ("%s: password was wrong; ignoring because no main window", __FUNCTION__);
-               return;
-       }
-
        if (g_object_get_data (G_OBJECT (account), "connection_specific") != NULL) {
                modest_ui_actions_on_smtp_servers (NULL, NULL);
        } else {
index c7e72d5..fa0672c 100644 (file)
@@ -5867,9 +5867,12 @@ modest_ui_actions_on_send_queue_error_happened (TnySendQueue *self,
        TnyTransportAccount *server_account;
        gchar *message = NULL;
 
-       /* Don't show anything if the user cancelled something or the send receive request is not
-        * interactive */
+       /* Don't show anything if the user cancelled something or the
+        * send receive request is not interactive. Authentication
+        * errors are managed by the account store so no need to show
+        * a dialog here again */
        if (err->code == TNY_SYSTEM_ERROR_CANCEL ||
+           err->code == TNY_SERVICE_ERROR_AUTHENTICATE ||
            !modest_tny_send_queue_get_requested_send_receive (MODEST_TNY_SEND_QUEUE (self)))
                return;
 
@@ -5887,9 +5890,6 @@ modest_ui_actions_on_send_queue_error_happened (TnySendQueue *self,
        case TNY_SERVICE_ERROR_CONNECT:
                message = g_strdup_printf (_("emev_ib_ui_smtp_server_invalid"), server_name);
                break;
-       case TNY_SERVICE_ERROR_AUTHENTICATE:
-               message = g_strdup_printf (_("emev_ni_ui_smtp_authentication_fail_error"), server_name);
-               break;
        case TNY_SERVICE_ERROR_SEND:
                message = g_strdup (dgettext("hildon-common-strings", "sfil_ib_unable_to_send"));
                break;
@@ -5902,10 +5902,6 @@ modest_ui_actions_on_send_queue_error_happened (TnySendQueue *self,
                message = g_strdup (dgettext("hildon-common-strings", "sfil_ib_unable_to_send"));
                break;  
        }
-       
-       /* TODO if the username or the password where not defined we
-          should show the Accounts Settings dialog or the Connection
-          specific SMTP server window */
 
        modest_platform_run_information_dialog (NULL, message, FALSE);
        g_free (message);