From 83c3671f0e0b2ff021d3cb8b37653e66c1e38066 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Wed, 27 Feb 2008 17:44:51 +0000 Subject: [PATCH 1/1] * src/modest-mail-operation.c: (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 | 15 +++++++-------- src/modest-mail-operation.c | 10 +++++----- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/modest-mail-operation-queue.c b/src/modest-mail-operation-queue.c index f00e992..d22917f 100644 --- a/src/modest-mail-operation-queue.c +++ b/src/modest-mail-operation-queue.c @@ -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__); } } diff --git a/src/modest-mail-operation.c b/src/modest-mail-operation.c index 7aa6282..55d5c86 100644 --- a/src/modest-mail-operation.c +++ b/src/modest-mail-operation.c @@ -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; } -- 1.7.9.5