diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-09-19 03:57:27 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-09-19 04:40:19 +0800 |
commit | a98c07a569292fa66f91d3fa4bd32f32adff1880 (patch) | |
tree | 98caa43594f61662289fd696b409978946e92255 /shell | |
parent | b145c0a2522c5c9942c0827bf03baefea68f5d99 (diff) | |
download | gsoc2013-evolution-a98c07a569292fa66f91d3fa4bd32f32adff1880.tar gsoc2013-evolution-a98c07a569292fa66f91d3fa4bd32f32adff1880.tar.gz gsoc2013-evolution-a98c07a569292fa66f91d3fa4bd32f32adff1880.tar.bz2 gsoc2013-evolution-a98c07a569292fa66f91d3fa4bd32f32adff1880.tar.lz gsoc2013-evolution-a98c07a569292fa66f91d3fa4bd32f32adff1880.tar.xz gsoc2013-evolution-a98c07a569292fa66f91d3fa4bd32f32adff1880.tar.zst gsoc2013-evolution-a98c07a569292fa66f91d3fa4bd32f32adff1880.zip |
Add a GCancellable to EActivity.
EActivity now uses a GCancellable to manage cancellations, instead of
having its own redundant cancellation API. API changes are as follows:
+ e_activity_get_cancellable()
+ e_activity_set_cancellable()
- e_activity_cancel()
- e_activity_is_cancelled()
- e_activity_get_allow_cancel()
- e_activity_set_allow_cancel()
EActivity's "cancelled" signal remains, but only as a repeater for
GCancellable::cancelled signals. It should not be emitted directly.
The presence of a GCancellable implies that cancellation is allowed.
EActivity does not create its own default GCancellable, it has to be
given one.
If a CamelOperation (cast as a GCancellable) is given, EActivity will
configure itself to listen for status updates from the CamelOperation
and propagate the information to its own "primary-text" and "percent"
properties.
These changes allowed me to start cleaning up some of the incredibly
convoluted logic in mail-mt.c -- in particular, mail_operation_status()
is completely gone now. mail-mt.c is still in a transitional state --
much more significant changes coming soon.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/e-shell-taskbar.c | 21 | ||||
-rw-r--r-- | shell/e-shell.c | 21 |
2 files changed, 26 insertions, 16 deletions
diff --git a/shell/e-shell-taskbar.c b/shell/e-shell-taskbar.c index a82d3d6246..47f900ae3e 100644 --- a/shell/e-shell-taskbar.c +++ b/shell/e-shell-taskbar.c @@ -96,12 +96,13 @@ shell_taskbar_activity_add (EShellTaskbar *shell_taskbar, GtkBox *box; GtkWidget *proxy; + /* Proxy widgets manage their own visibility. + * Don't call gtk_widget_show() on it here. */ proxy = e_activity_proxy_new (activity); box = GTK_BOX (shell_taskbar->priv->hbox); gtk_box_pack_start (box, proxy, TRUE, TRUE, 0); gtk_box_reorder_child (box, proxy, 0); gtk_widget_show (GTK_WIDGET (box)); - gtk_widget_show (proxy); g_hash_table_insert ( shell_taskbar->priv->proxy_table, @@ -176,13 +177,14 @@ shell_taskbar_get_property (GObject *object, } static gboolean -disconnect_remove (EActivity *activity, - EActivityProxy *proxy, - EShellTaskbar *shell_taskbar) +disconnect_remove (EActivity *activity, + EActivityProxy *proxy, + EShellTaskbar *shell_taskbar) { - g_signal_handlers_disconnect_matched - (activity, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, shell_taskbar); + g_signal_handlers_disconnect_matched ( + activity, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, shell_taskbar); + return TRUE; } @@ -217,9 +219,8 @@ shell_taskbar_dispose (GObject *object) priv->hbox = NULL; } - g_hash_table_foreach_remove (priv->proxy_table, - (GHRFunc) disconnect_remove, - object); + g_hash_table_foreach_remove ( + priv->proxy_table, (GHRFunc) disconnect_remove, object); /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (e_shell_taskbar_parent_class)->dispose (object); diff --git a/shell/e-shell.c b/shell/e-shell.c index 93832ec7fe..28abe028dc 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -240,8 +240,11 @@ shell_prepare_for_offline (EShell *shell) if (shell->priv->preparing_for_line_change != NULL) return; - shell->priv->preparing_for_line_change = - e_activity_new (_("Preparing to go offline...")); + shell->priv->preparing_for_line_change = e_activity_new (); + + e_activity_set_primary_text ( + shell->priv->preparing_for_line_change, + _("Preparing to go offline...")); g_object_add_toggle_ref ( G_OBJECT (shell->priv->preparing_for_line_change), @@ -290,8 +293,11 @@ shell_prepare_for_online (EShell *shell) if (shell->priv->preparing_for_line_change != NULL) return; - shell->priv->preparing_for_line_change = - e_activity_new (_("Preparing to go online...")); + shell->priv->preparing_for_line_change = e_activity_new (); + + e_activity_set_primary_text ( + shell->priv->preparing_for_line_change, + _("Preparing to go online...")); g_object_add_toggle_ref ( G_OBJECT (shell->priv->preparing_for_line_change), @@ -349,8 +355,11 @@ shell_prepare_for_quit (EShell *shell) if (shell->priv->preparing_for_quit != NULL) return; - shell->priv->preparing_for_quit = - e_activity_new (_("Preparing to quit...")); + shell->priv->preparing_for_quit = e_activity_new (); + + e_activity_set_primary_text ( + shell->priv->preparing_for_quit, + _("Preparing to quit...")); g_object_add_toggle_ref ( G_OBJECT (shell->priv->preparing_for_quit), |