aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-composer-utils.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-12 00:19:17 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:42:12 +0800
commitfb38ed0bf5891b343afd30a5621d0008cd1e687d (patch)
treeebfaff0463064887c815d1bb4e6c82243cbacad8 /mail/em-composer-utils.c
parent312d1b74ca0d2eedd92ead4945deaf9e746fd33b (diff)
downloadgsoc2013-evolution-fb38ed0bf5891b343afd30a5621d0008cd1e687d.tar
gsoc2013-evolution-fb38ed0bf5891b343afd30a5621d0008cd1e687d.tar.gz
gsoc2013-evolution-fb38ed0bf5891b343afd30a5621d0008cd1e687d.tar.bz2
gsoc2013-evolution-fb38ed0bf5891b343afd30a5621d0008cd1e687d.tar.lz
gsoc2013-evolution-fb38ed0bf5891b343afd30a5621d0008cd1e687d.tar.xz
gsoc2013-evolution-fb38ed0bf5891b343afd30a5621d0008cd1e687d.tar.zst
gsoc2013-evolution-fb38ed0bf5891b343afd30a5621d0008cd1e687d.zip
Add e_activity_handle_cancellation().
Convenience function for use in GAsyncReadyCallback functions. This acknowledges the cancellation, so that the activity's description changes from "(cancelling)" to "(cancelled)" and the description appears crossed out in the UI for a moment before disappearing.
Diffstat (limited to 'mail/em-composer-utils.c')
-rw-r--r--mail/em-composer-utils.c38
1 files changed, 11 insertions, 27 deletions
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;