aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-04-25 06:26:43 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-04-26 00:04:21 +0800
commit0aa6d685c397a8fb93c27e4237de6f55cd36d747 (patch)
treeca2aa3cd853ac3c8568e61ea818ef37438c9336f /e-util
parent2ba45b09fd68ad4a25f682dd80fd828bd53fdbc8 (diff)
downloadgsoc2013-evolution-0aa6d685c397a8fb93c27e4237de6f55cd36d747.tar
gsoc2013-evolution-0aa6d685c397a8fb93c27e4237de6f55cd36d747.tar.gz
gsoc2013-evolution-0aa6d685c397a8fb93c27e4237de6f55cd36d747.tar.bz2
gsoc2013-evolution-0aa6d685c397a8fb93c27e4237de6f55cd36d747.tar.lz
gsoc2013-evolution-0aa6d685c397a8fb93c27e4237de6f55cd36d747.tar.xz
gsoc2013-evolution-0aa6d685c397a8fb93c27e4237de6f55cd36d747.tar.zst
gsoc2013-evolution-0aa6d685c397a8fb93c27e4237de6f55cd36d747.zip
Add e_activity_cancel().
Convenience function cancels the activity's GCancellable. (cherry picked from commit 8b245838de22f470e867b28631240a018a0bc36b)
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-activity-bar.c4
-rw-r--r--e-util/e-activity-proxy.c4
-rw-r--r--e-util/e-activity.c27
-rw-r--r--e-util/e-activity.h1
4 files changed, 30 insertions, 6 deletions
diff --git a/e-util/e-activity-bar.c b/e-util/e-activity-bar.c
index b90996bd9b..51435d3dda 100644
--- a/e-util/e-activity-bar.c
+++ b/e-util/e-activity-bar.c
@@ -150,13 +150,11 @@ static void
activity_bar_cancel (EActivityBar *bar)
{
EActivity *activity;
- GCancellable *cancellable;
activity = e_activity_bar_get_activity (bar);
g_return_if_fail (E_IS_ACTIVITY (activity));
- cancellable = e_activity_get_cancellable (activity);
- g_cancellable_cancel (cancellable);
+ e_activity_cancel (activity);
activity_bar_update (bar);
}
diff --git a/e-util/e-activity-proxy.c b/e-util/e-activity-proxy.c
index 43c77a522f..aeef5d2cd8 100644
--- a/e-util/e-activity-proxy.c
+++ b/e-util/e-activity-proxy.c
@@ -156,13 +156,11 @@ static void
activity_proxy_cancel (EActivityProxy *proxy)
{
EActivity *activity;
- GCancellable *cancellable;
activity = e_activity_proxy_get_activity (proxy);
g_return_if_fail (E_IS_ACTIVITY (activity));
- cancellable = e_activity_get_cancellable (activity);
- g_cancellable_cancel (cancellable);
+ e_activity_cancel (activity);
activity_proxy_update (proxy);
}
diff --git a/e-util/e-activity.c b/e-util/e-activity.c
index e4c121308b..87b84495db 100644
--- a/e-util/e-activity.c
+++ b/e-util/e-activity.c
@@ -383,6 +383,33 @@ e_activity_new (void)
}
/**
+ * e_activity_cancel:
+ * @activity: an #EActivity
+ *
+ * Convenience function cancels @activity's #EActivity:cancellable.
+ *
+ * <para>
+ * <note>
+ * This function will not set @activity's #EActivity:state to
+ * @E_ACTIVITY_CANCELLED. It merely requests that the associated
+ * operation be cancelled. Only after the operation finishes with
+ * a @G_IO_ERROR_CANCELLED should the @activity's #EActivity:state
+ * be changed (see e_activity_handle_cancellation()). During this
+ * interim period e_activity_describe() will indicate the activity
+ * is "cancelling".
+ * </note>
+ * </para>
+ **/
+void
+e_activity_cancel (EActivity *activity)
+{
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ /* This function handles NULL gracefully. */
+ g_cancellable_cancel (activity->priv->cancellable);
+}
+
+/**
* e_activity_describe:
* @activity: an #EActivity
*
diff --git a/e-util/e-activity.h b/e-util/e-activity.h
index 0ba5753528..9309fe1fb0 100644
--- a/e-util/e-activity.h
+++ b/e-util/e-activity.h
@@ -70,6 +70,7 @@ struct _EActivityClass {
GType e_activity_get_type (void) G_GNUC_CONST;
EActivity * e_activity_new (void);
+void e_activity_cancel (EActivity *activity);
gchar * e_activity_describe (EActivity *activity);
EAlertSink * e_activity_get_alert_sink (EActivity *activity);
void e_activity_set_alert_sink (EActivity *activity,