aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-backend.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-22 04:21:19 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-23 02:21:22 +0800
commitc881b5bc5e61d04b18d4ab46ad70533e7340d15b (patch)
treee70a3ed0d2f93dacfe20d856de4d29578beb2e50 /shell/e-shell-backend.c
parentf0714755e2fa8b06425907c2cf189abd3a1b7119 (diff)
downloadgsoc2013-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 'shell/e-shell-backend.c')
-rw-r--r--shell/e-shell-backend.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/shell/e-shell-backend.c b/shell/e-shell-backend.c
index 0d7ff020c7..c2abb470a2 100644
--- a/shell/e-shell-backend.c
+++ b/shell/e-shell-backend.c
@@ -398,19 +398,30 @@ void
e_shell_backend_add_activity (EShellBackend *shell_backend,
EActivity *activity)
{
- GCancellable *cancellable;
+ EActivityState state;
g_return_if_fail (E_IS_SHELL_BACKEND (shell_backend));
g_return_if_fail (E_IS_ACTIVITY (activity));
- cancellable = e_activity_get_cancellable (activity);
+ state = e_activity_get_state (activity);
- /* Skip cancelled activities. */
- if (g_cancellable_is_cancelled (cancellable))
+ /* Disregard cancelled or completed activities. */
+
+ if (state == E_ACTIVITY_CANCELLED)
+ return;
+
+ if (state == E_ACTIVITY_COMPLETED)
return;
g_queue_push_tail (shell_backend->priv->activities, activity);
+ /* Emit the "activity-added" signal before adding a weak reference
+ * to the EActivity because EShellTaskbar's signal handler also adds
+ * a weak reference to the EActivity, and we want its GWeakNotify
+ * to run before ours, since ours may destroy the EShellTaskbar
+ * during application shutdown. */
+ g_signal_emit (shell_backend, signals[ACTIVITY_ADDED], 0, activity);
+
/* We reference the backend on every activity to
* guarantee the backend outlives the activity. */
g_object_weak_ref (
@@ -418,8 +429,6 @@ e_shell_backend_add_activity (EShellBackend *shell_backend,
shell_backend_activity_finalized_cb,
g_object_ref (shell_backend));
- g_signal_emit (shell_backend, signals[ACTIVITY_ADDED], 0, activity);
-
/* Only emit "notify::busy" when switching from idle to busy. */
if (g_queue_get_length (shell_backend->priv->activities) == 1)
g_object_notify (G_OBJECT (shell_backend), "busy");