aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-backend.c4
-rw-r--r--mail/e-mail-reader-utils.c4
-rw-r--r--mail/em-composer-utils.c38
-rw-r--r--mail/mail-mt.c4
4 files changed, 15 insertions, 35 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index 3addb64011..eaf3bd05b1 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -446,8 +446,8 @@ mail_backend_job_finished_cb (CamelSession *session,
activity = g_hash_table_lookup (priv->jobs, cancellable);
description = e_activity_get_text (activity);
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- /* ignore cancellations */
+ if (e_activity_handle_cancellation (activity, error)) {
+ /* nothing to do */
} else if (error != NULL) {
EShell *shell;
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 81712b82f0..0311b3d429 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -369,10 +369,8 @@ mail_reader_remove_duplicates_cb (CamelFolder *folder,
duplicates = e_mail_folder_find_duplicate_messages_finish (
folder, result, &error);
- /* Ignore cancellations. */
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ if (e_activity_handle_cancellation (context->activity, error)) {
g_warn_if_fail (duplicates == NULL);
- e_activity_set_state (context->activity, E_ACTIVITY_CANCELLED);
async_context_free (context);
g_error_free (error);
return;
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 1431975b63..c91870ff5b 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -503,9 +503,7 @@ composer_send_completed (EMailSession *session,
e_mail_session_send_to_finish (session, result, &error);
- /* Ignore cancellations. */
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- e_activity_set_state (context->activity, E_ACTIVITY_CANCELLED);
+ if (e_activity_handle_cancellation (context->activity, error)) {
g_error_free (error);
goto exit;
}
@@ -606,8 +604,7 @@ composer_save_to_drafts_complete (EMailSession *session,
e_mail_session_handle_draft_headers_finish (session, result, &error);
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- e_activity_set_state (context->activity, E_ACTIVITY_CANCELLED);
+ if (e_activity_handle_cancellation (context->activity, error)) {
g_error_free (error);
} else if (error != NULL) {
@@ -645,15 +642,13 @@ composer_save_to_drafts_cleanup (CamelFolder *drafts_folder,
e_mail_folder_append_message_finish (
drafts_folder, result, &context->message_uid, &error);
- /* Ignore cancellations. */
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ if (e_activity_handle_cancellation (context->activity, error)) {
g_warn_if_fail (context->message_uid == NULL);
async_context_free (context);
g_error_free (error);
return;
- }
- if (error != NULL) {
+ } else if (error != NULL) {
g_warn_if_fail (context->message_uid == NULL);
e_alert_submit (
alert_sink,
@@ -715,15 +710,13 @@ composer_save_to_drafts_got_folder (EMailSession *session,
drafts_folder = e_mail_session_uri_to_folder_finish (
session, result, &error);
- /* Ignore cancellations. */
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ if (e_activity_handle_cancellation (context->activity, error)) {
g_warn_if_fail (drafts_folder == NULL);
async_context_free (context);
g_error_free (error);
return;
- }
- if (error != NULL) {
+ } else if (error != NULL) {
gint response;
g_warn_if_fail (drafts_folder == NULL);
@@ -807,14 +800,11 @@ composer_save_to_outbox_completed (CamelFolder *outbox_folder,
e_mail_folder_append_message_finish (
outbox_folder, result, NULL, &error);
- /* Ignore cancellations. */
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- e_activity_set_state (context->activity, E_ACTIVITY_CANCELLED);
+ if (e_activity_handle_cancellation (context->activity, error)) {
g_error_free (error);
goto exit;
- }
- if (error != NULL) {
+ } else if (error != NULL) {
e_alert_submit (
alert_sink,
"mail-composer:append-to-outbox-error",
@@ -1265,10 +1255,8 @@ edit_messages_cb (CamelFolder *folder,
hash_table = e_mail_folder_get_multiple_messages_finish (
folder, result, &error);
- /* Ignore cancellations. */
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ if (e_activity_handle_cancellation (context->activity, error)) {
g_warn_if_fail (hash_table == NULL);
- e_activity_set_state (context->activity, E_ACTIVITY_CANCELLED);
async_context_free (context);
g_error_free (error);
return;
@@ -1466,11 +1454,9 @@ forward_attached_cb (CamelFolder *folder,
part = e_mail_folder_build_attachment_finish (
folder, result, &subject, &error);
- /* Ignore cancellations. */
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ if (e_activity_handle_cancellation (context->activity, error)) {
g_warn_if_fail (part == NULL);
g_warn_if_fail (subject == NULL);
- e_activity_set_state (context->activity, E_ACTIVITY_CANCELLED);
async_context_free (context);
g_error_free (error);
return;
@@ -1629,10 +1615,8 @@ forward_got_messages_cb (CamelFolder *folder,
hash_table = e_mail_folder_get_multiple_messages_finish (
folder, result, &error);
- /* Ignore cancellations. */
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ if (e_activity_handle_cancellation (context->activity, error)) {
g_warn_if_fail (hash_table == NULL);
- e_activity_set_state (context->activity, E_ACTIVITY_CANCELLED);
async_context_free (context);
g_error_free (error);
return;
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index a65f6e3c9e..53ff132545 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -208,10 +208,8 @@ mail_msg_check_error (gpointer msg)
checkmem (m->priv);
#endif
- if (g_error_matches (m->error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- e_activity_set_state (m->activity, E_ACTIVITY_CANCELLED);
+ if (e_activity_handle_cancellation (m->activity, m->error))
return;
- }
e_activity_set_state (m->activity, E_ACTIVITY_COMPLETED);