* src/modest-mail-operation.c:
authorAlberto Garcia <agarcia@igalia.com>
Wed, 27 Feb 2008 17:44:51 +0000 (17:44 +0000)
committerAlberto Garcia <agarcia@igalia.com>
Wed, 27 Feb 2008 17:44:51 +0000 (17:44 +0000)
(get_msg_async_cb): If the operation has been canceled by the user,
ignore then error that comes from Tinymail and don't touch the error
code of the mail operation.

* src/modest-mail-operation-queue.c:
(modest_mail_operation_queue_remove): Don't call the error handler if
the operation has been canceled by the user.

Fixes NB#81459

pmo-trunk-r4235

src/modest-mail-operation-queue.c
src/modest-mail-operation.c

index f00e992..d22917f 100644 (file)
@@ -292,7 +292,9 @@ modest_mail_operation_queue_remove (ModestMailOperationQueue *self,
 
        /* Check errors */
        status = modest_mail_operation_get_status (mail_op);
-       if (status != MODEST_MAIL_OPERATION_STATUS_SUCCESS) {
+       if (status == MODEST_MAIL_OPERATION_STATUS_CANCELED) {
+               g_warning ("%s: operation canceled \n", __FUNCTION__);
+       } else if (status != MODEST_MAIL_OPERATION_STATUS_SUCCESS) {
                /* This is a sanity check. Shouldn't be needed, but
                   prevent possible application crashes. It's useful
                   also for detecting mail operations with invalid
@@ -300,13 +302,10 @@ modest_mail_operation_queue_remove (ModestMailOperationQueue *self,
                if (modest_mail_operation_get_error (mail_op) != NULL) {
                        modest_mail_operation_execute_error_handler (mail_op);
                } else {
-                       if (status == MODEST_MAIL_OPERATION_STATUS_CANCELED) 
-                               g_warning ("%s: operation canceled \n", __FUNCTION__);
-                       else
-                               g_warning ("%s: possible error in a mail operation " \
-                                          "implementation. The status is not successful " \
-                                          "but the mail operation does not have any " \
-                                          "error set\n", __FUNCTION__);
+                       g_warning ("%s: possible error in a mail operation " \
+                                  "implementation. The status is not successful " \
+                                  "but the mail operation does not have any " \
+                                  "error set\n", __FUNCTION__);
                }
        }
 
index 7aa6282..55d5c86 100644 (file)
@@ -2151,8 +2151,11 @@ get_msg_async_cb (TnyFolder *folder,
                finished = (priv->done == priv->total) ? TRUE : FALSE;
        }
 
-       /* Check errors */
-       if (canceled || err) {
+       /* If canceled by the user, ignore the error given by Tinymail */
+       if (priv->status == MODEST_MAIL_OPERATION_STATUS_CANCELED) {
+               canceled = TRUE;
+               finished = TRUE;
+       } else if (canceled || err) {
                priv->status = MODEST_MAIL_OPERATION_STATUS_FINISHED_WITH_ERRORS;
                if (err) {
                        priv->error = g_error_copy ((const GError *) err);
@@ -2166,9 +2169,6 @@ get_msg_async_cb (TnyFolder *folder,
        } else if (finished && priv->status == MODEST_MAIL_OPERATION_STATUS_IN_PROGRESS) {
                /* Set the success status before calling the user callback */
                priv->status = MODEST_MAIL_OPERATION_STATUS_SUCCESS;
-       } else if (priv->status == MODEST_MAIL_OPERATION_STATUS_CANCELED) {
-               canceled = TRUE;
-               finished = TRUE;
        }