From 0aa6d685c397a8fb93c27e4237de6f55cd36d747 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 24 Apr 2013 18:26:43 -0400 Subject: Add e_activity_cancel(). Convenience function cancels the activity's GCancellable. (cherry picked from commit 8b245838de22f470e867b28631240a018a0bc36b) --- e-util/e-activity.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'e-util/e-activity.c') 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 @@ -382,6 +382,33 @@ e_activity_new (void) return g_object_new (E_TYPE_ACTIVITY, NULL); } +/** + * e_activity_cancel: + * @activity: an #EActivity + * + * Convenience function cancels @activity's #EActivity:cancellable. + * + * + * + * 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". + * + * + **/ +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 -- cgit v1.2.3