aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
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,