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/message-list.c | |
parent | f0714755e2fa8b06425907c2cf189abd3a1b7119 (diff) | |
download | gsoc2013-evolution-c881b5bc5e61d04b18d4ab46ad70533e7340d15b.tar gsoc2013-evolution-c881b5bc5e61d04b18d4ab46ad70533e7340d15b.tar.gz gsoc2013-evolution-c881b5bc5e61d04b18d4ab46ad70533e7340d15b.tar.bz2 gsoc2013-evolution-c881b5bc5e61d04b18d4ab46ad70533e7340d15b.tar.lz gsoc2013-evolution-c881b5bc5e61d04b18d4ab46ad70533e7340d15b.tar.xz 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/message-list.c')
-rw-r--r-- | mail/message-list.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/mail/message-list.c b/mail/message-list.c index 974eb1c295..68e05fc998 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -2218,7 +2218,9 @@ ml_drop_async_desc (struct _drop_msg *m) } static void -ml_drop_async_exec (struct _drop_msg *m) +ml_drop_async_exec (struct _drop_msg *m, + GCancellable *cancellable, + GError **error) { EMailBackend *backend; EMailSession *session; @@ -2231,8 +2233,7 @@ ml_drop_async_exec (struct _drop_msg *m) em_utils_selection_get_uidlist ( m->selection, session, m->folder, m->action == GDK_ACTION_MOVE, - m->base.cancellable, - &m->base.error); + cancellable, error); break; case DND_MESSAGE_RFC822: em_utils_selection_get_message (m->selection, m->folder); @@ -4461,7 +4462,9 @@ regen_list_desc (struct _regen_list_msg *m) } static void -regen_list_exec (struct _regen_list_msg *m) +regen_list_exec (struct _regen_list_msg *m, + GCancellable *cancellable, + GError **error) { GPtrArray *uids, *searchuids = NULL; CamelMessageInfo *info; @@ -4469,6 +4472,7 @@ regen_list_exec (struct _regen_list_msg *m) ETree *tree; gint i; gchar *expr = NULL; + GError *local_error = NULL; if (m->folder != m->ml->folder) return; @@ -4516,7 +4520,7 @@ regen_list_exec (struct _regen_list_msg *m) gboolean store_has_vjunk = folder_store_supports_vjunk_folder (m->folder); searchuids = uids = camel_folder_search_by_expression ( - m->folder, expr, &m->base.error); + m->folder, expr, &local_error); /* If m->changes is not NULL, then it means we are called from folder_changed event, thus we will keep the selected message to be sure it doesn't disappear because it no longer belong to our search filter. */ @@ -4554,13 +4558,15 @@ regen_list_exec (struct _regen_list_msg *m) } } - if (m->base.error != NULL) + if (local_error != NULL) { + g_propagate_error (error, local_error); return; + } e_profile_event_emit("list.threaduids", m->folder->full_name, 0); /* camel_folder_summary_prepare_fetch_all (m->folder->summary, NULL); */ - if (!g_cancellable_is_cancelled (m->base.cancellable)) { + if (!g_cancellable_is_cancelled (cancellable)) { /* update/build a new tree */ if (m->dotree) { ml_sort_uids_by_tree (m->ml, uids); @@ -4596,6 +4602,9 @@ static void regen_list_done (struct _regen_list_msg *m) { ETree *tree; + GCancellable *cancellable; + + cancellable = e_activity_get_cancellable (m->base.activity); if (m->ml->priv->destroyed) return; @@ -4603,7 +4612,7 @@ regen_list_done (struct _regen_list_msg *m) if (!m->complete) return; - if (g_cancellable_is_cancelled (m->base.cancellable)) + if (g_cancellable_is_cancelled (cancellable)) return; if (m->ml->folder != m->folder) @@ -4789,10 +4798,12 @@ mail_regen_cancel (MessageList *ml) l = ml->regen; while (l) { MailMsg *mm = l->data; + GCancellable *cancellable; - if (mm->cancellable) + cancellable = e_activity_get_cancellable (mm->activity); + if (CAMEL_IS_OPERATION (cancellable)) camel_operation_cancel ( - CAMEL_OPERATION (mm->cancellable)); + CAMEL_OPERATION (cancellable)); l = l->next; } |