From 8ed05d001f888c47a70ba2500febf7b61eae162f Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Fri, 14 Mar 2008 12:34:55 +0000 Subject: [PATCH] * Fixes NB#81095, cancel the retrieval operations before disconnecting the account to remove it * Do not show error messages when the message retrieval is canceled pmo-trunk-r4312 --- src/modest-mail-operation.c | 4 ++-- src/modest-tny-account-store.c | 12 +++++++++--- src/modest-ui-actions.c | 22 ++++++++++++---------- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/modest-mail-operation.c b/src/modest-mail-operation.c index 6f7d2ab..f1ecaa5 100644 --- a/src/modest-mail-operation.c +++ b/src/modest-mail-operation.c @@ -2183,10 +2183,10 @@ get_msg_async_cb (TnyFolder *folder, } /* If canceled by the user, ignore the error given by Tinymail */ - if (priv->status == MODEST_MAIL_OPERATION_STATUS_CANCELED) { + if (priv->status == MODEST_MAIL_OPERATION_STATUS_CANCELED || canceled) { canceled = TRUE; finished = TRUE; - } else if (canceled || err) { + } else if (err) { priv->status = MODEST_MAIL_OPERATION_STATUS_FINISHED_WITH_ERRORS; if (err) { priv->error = g_error_copy ((const GError *) err); diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index 05f8fc2..22bb121 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -1693,12 +1693,12 @@ on_account_disconnect_when_removing (TnyCamelAccount *account, /* Notify the observers */ g_signal_emit (G_OBJECT (self), signals [ACCOUNT_REMOVED_SIGNAL], 0, account); - - /* Unref the extra reference added by get_server_account */ - g_object_unref (account); /* Cancel all pending operations */ tny_account_cancel (TNY_ACCOUNT (account)); + + /* Unref the extra reference added by get_server_account */ + g_object_unref (account); /* Clear the cache if it's an store account */ if (TNY_IS_STORE_ACCOUNT (account)) @@ -1726,6 +1726,9 @@ on_account_removed (ModestAccountMgr *acc_mgr, /* If there was any problem creating the account, for example, with the configuration system this could not exist */ if (store_account) { + /* Cancel all pending operations */ + tny_account_cancel (TNY_ACCOUNT (store_account)); + /* Disconnect before deleting the cache, because the disconnection will rewrite the cache to the disk */ @@ -1759,6 +1762,9 @@ on_account_removed (ModestAccountMgr *acc_mgr, g_warning ("Removing a transport account that has no outbox"); } + /* Cancel all pending operations */ + tny_account_cancel (TNY_ACCOUNT (transport_account)); + /* Disconnect and notify the observers. The callback will free the reference */ tny_camel_account_set_online (TNY_CAMEL_ACCOUNT (transport_account), FALSE, on_account_disconnect_when_removing, self); diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 9cad865..efa8abc 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -981,24 +981,26 @@ modest_ui_actions_disk_operations_error_handler (ModestMailOperation *mail_op, { const GError *error; GObject *win = NULL; + ModestMailOperationStatus status; win = modest_mail_operation_get_source (mail_op); error = modest_mail_operation_get_error (mail_op); + status = modest_mail_operation_get_status (mail_op); - /* Show error */ - if (error->code == TNY_SYSTEM_ERROR_MEMORY || - error->code == TNY_IO_ERROR_WRITE || - error->code == TNY_IO_ERROR_READ) { - ModestMailOperationStatus st = modest_mail_operation_get_status (mail_op); - /* If the mail op has been cancelled then it's not an error: don't show any message */ - if (st != MODEST_MAIL_OPERATION_STATUS_CANCELED) { + /* If the mail op has been cancelled then it's not an error: + don't show any message */ + if (status != MODEST_MAIL_OPERATION_STATUS_CANCELED) { + /* Show error */ + if (error->code == TNY_SYSTEM_ERROR_MEMORY || + error->code == TNY_IO_ERROR_WRITE || + error->code == TNY_IO_ERROR_READ) { modest_platform_information_banner ((GtkWidget *) win, NULL, dgettext("ke-recv", "cerm_device_memory_full")); + } else if (user_data) { + modest_platform_information_banner ((GtkWidget *) win, + NULL, user_data); } - } else if (user_data) { - modest_platform_information_banner ((GtkWidget *) win, - NULL, user_data); } if (win) -- 1.7.9.5