Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wireplumber
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pkg
wireplumber
Commits
73c6e65a
Commit
73c6e65a
authored
4 years ago
by
Julian Bouzas
Browse files
Options
Downloads
Patches
Plain Diff
session-item: add activate API with closure
parent
89d300ea
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/wp/session-item.c
+31
-10
31 additions, 10 deletions
lib/wp/session-item.c
lib/wp/session-item.h
+3
-0
3 additions, 0 deletions
lib/wp/session-item.h
with
34 additions
and
10 deletions
lib/wp/session-item.c
+
31
−
10
View file @
73c6e65a
...
...
@@ -651,13 +651,12 @@ on_activate_transition_post_completed (gpointer data, GClosure *closure)
}
/**
* wp_session_item_activate:
* wp_session_item_activate
_closure
:
* @self: the session item
* @callback: (scope async): a callback to call when activation is finished
* @callback_data: (closure): data passed to @callback
* @closure: (transfer full): the closure to use when activation is completed
*
* Activates the item asynchronously.
* You can use wp_session_item_activate_finish() in the
@
callback to get
* You can use wp_session_item_activate_finish() in the
closure
callback to get
* the result of this operation.
*
* This internally starts a #WpTransition that calls into
...
...
@@ -682,9 +681,7 @@ on_activate_transition_post_completed (gpointer data, GClosure *closure)
* already activated.
*/
void
wp_session_item_activate
(
WpSessionItem
*
self
,
GAsyncReadyCallback
callback
,
gpointer
callback_data
)
wp_session_item_activate_closure
(
WpSessionItem
*
self
,
GClosure
*
closure
)
{
g_return_if_fail
(
WP_IS_SESSION_ITEM
(
self
));
...
...
@@ -694,9 +691,6 @@ wp_session_item_activate (WpSessionItem * self,
g_return_if_fail
(
!
(
priv
->
flags
&
(
WP_SI_FLAGS_MASK_OPERATION_IN_PROGRESS
|
WP_SI_FLAG_ACTIVE
)));
GClosure
*
closure
=
g_cclosure_new
(
G_CALLBACK
(
callback
),
callback_data
,
NULL
);
/* TODO: add a way to cancel the transition if deactivate() is called in the meantime */
WpTransition
*
transition
=
wp_transition_new_closure
(
wp_si_transition_get_type
(),
self
,
NULL
,
closure
);
...
...
@@ -721,6 +715,33 @@ wp_session_item_activate (WpSessionItem * self,
wp_transition_advance
(
transition
);
}
/**
* wp_session_item_activate:
* @self: the session item
* @callback: (scope async): a callback to call when activation is finished
* @callback_data: (closure): data passed to @callback
*
* @callback and @callback_data version of wp_session_item_activate_closure()
*/
void
wp_session_item_activate
(
WpSessionItem
*
self
,
GAsyncReadyCallback
callback
,
gpointer
callback_data
)
{
g_return_if_fail
(
WP_IS_SESSION_ITEM
(
self
));
WpSessionItemPrivate
*
priv
=
wp_session_item_get_instance_private
(
self
);
g_return_if_fail
(
!
(
priv
->
flags
&
(
WP_SI_FLAGS_MASK_OPERATION_IN_PROGRESS
|
WP_SI_FLAG_ACTIVE
)));
GClosure
*
closure
=
g_cclosure_new
(
G_CALLBACK
(
callback
),
callback_data
,
NULL
);
wp_session_item_activate_closure
(
self
,
closure
);
}
/**
* wp_session_item_activate_finish:
* @self: the session item
...
...
This diff is collapsed.
Click to expand it.
lib/wp/session-item.h
+
3
−
0
View file @
73c6e65a
...
...
@@ -157,6 +157,9 @@ GVariant * wp_session_item_get_configuration (WpSessionItem * self);
/* state management */
WP_API
void
wp_session_item_activate_closure
(
WpSessionItem
*
self
,
GClosure
*
closure
);
WP_API
void
wp_session_item_activate
(
WpSessionItem
*
self
,
GAsyncReadyCallback
callback
,
gpointer
callback_data
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment