From 763156e9f8b1e68768afb52cb70df9ee9fd6cd28 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis <george.kiagiadakis@collabora.com> Date: Fri, 20 Mar 2020 14:44:32 +0200 Subject: [PATCH] session-item: add an _activate_finish() method --- lib/wp/session-item.c | 21 +++++++++++++++++++-- lib/wp/session-item.h | 4 ++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lib/wp/session-item.c b/lib/wp/session-item.c index 9d4937c3..0a7d9f9e 100644 --- a/lib/wp/session-item.c +++ b/lib/wp/session-item.c @@ -295,8 +295,8 @@ on_transition_completed (WpTransition * transition, GParamSpec * pspec, * that calls into #WpSessionItemClass.get_next_step() and * #WpSessionItemClass.execute_step() to advance. * - * You can use wp_transition_finish() in the @callback to figure out the - * result of this operation. + * You can use wp_session_item_activate_finish() in the @callback to figure out + * the result of this operation. * * Normally this function is called internally by the session; there is no need * to activate an item externally, except for unit testing purposes. @@ -326,6 +326,23 @@ wp_session_item_activate (WpSessionItem * self, wp_transition_advance (transition); } +/** + * wp_session_item_activate_finish: + * @self: the session item + * @res: the async operation result + * @error: (out) (optional): the error of the operation, if any + * + * Returns: %TRUE if the item is now activateed, %FALSE if there was an error + */ +gboolean +wp_session_item_activate_finish (WpSessionItem * self, GAsyncResult * res, + GError ** error) +{ + g_return_val_if_fail ( + g_async_result_is_tagged (res, wp_session_item_activate), FALSE); + return wp_transition_finish (res, error); +} + /** * wp_session_item_reset: (virtual reset) * @self: the session item diff --git a/lib/wp/session-item.h b/lib/wp/session-item.h index 9cf24d15..5446581e 100644 --- a/lib/wp/session-item.h +++ b/lib/wp/session-item.h @@ -114,6 +114,10 @@ WP_API void wp_session_item_activate (WpSessionItem * self, GAsyncReadyCallback callback, gpointer callback_data); +WP_API +gboolean wp_session_item_activate_finish (WpSessionItem * self, + GAsyncResult * res, GError ** error); + WP_API void wp_session_item_reset (WpSessionItem * self); -- GitLab