diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-10-22 04:21:19 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-10-23 02:21:22 +0800 |
commit | c881b5bc5e61d04b18d4ab46ad70533e7340d15b (patch) | |
tree | e70a3ed0d2f93dacfe20d856de4d29578beb2e50 /mail/em-composer-utils.c | |
parent | f0714755e2fa8b06425907c2cf189abd3a1b7119 (diff) | |
download | gsoc2013-evolution-c881b5bc5e61d04b18d4ab46ad70533e7340d15b.tar.gz gsoc2013-evolution-c881b5bc5e61d04b18d4ab46ad70533e7340d15b.tar.zst gsoc2013-evolution-c881b5bc5e61d04b18d4ab46ad70533e7340d15b.zip |
Simplify EActivity.
With unintrusive error dialogs gone, we can cut some unnecessary bits
out of EActivity.
I'm also adding a new enum property called "state", which is one of:
E_ACTIVITY_RUNNING
E_ACTIVITY_WAITING
E_ACTIVITY_CANCELLED
E_ACTIVITY_COMPLETED
The state of an activity must be explicitly changed. In particular,
when the user cancels an activity the state should be set only after
confirming the operation has been cancelled and not when cancellation
is requested (e.g. after receiving a G_IO_ERROR_CANCELLED, not when
the GCancellable emits "cancelled"). EActivityBar and EActivityProxy
widgets have been updated to make this distinction clearer in the UI.
E_ACTIVITY_WAITING will be used when activities have to be queued and
dispatched in sequence, which I haven't written yet.
Diffstat (limited to 'mail/em-composer-utils.c')
-rw-r--r-- | mail/em-composer-utils.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 704bd2bd37..f084155362 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -482,6 +482,7 @@ composer_send_completed (EMailSession *session, /* Ignore cancellations. */ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + e_activity_set_state (context->activity, E_ACTIVITY_CANCELLED); g_error_free (error); goto exit; } @@ -495,7 +496,7 @@ composer_send_completed (EMailSession *session, goto exit; } - e_activity_complete (context->activity); + e_activity_set_state (context->activity, E_ACTIVITY_COMPLETED); /* Wait for the EActivity's completion message to * time out and then destroy the composer window. */ @@ -625,13 +626,16 @@ composer_save_draft_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)) + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + e_activity_set_state (context->activity, E_ACTIVITY_CANCELLED); g_error_free (error); - else if (error != NULL) { + } else if (error != NULL) { g_warning ("%s", error->message); g_error_free (error); - } + + } else + e_activity_set_state (context->activity, E_ACTIVITY_COMPLETED); /* Encode the draft message we just saved into the EMsgComposer * as X-Evolution-Draft headers. The message will be marked for @@ -641,8 +645,6 @@ composer_save_draft_complete (EMailSession *session, context->composer, context->folder_uri, context->message_uid); - e_activity_complete (context->activity); - async_context_free (context); } |