action_entry: Add activate_async helper#903
Open
BrainBlasted wants to merge 1 commit intogtk-rs:mainfrom
Open
Conversation
sdroege
reviewed
Jan 19, 2023
sdroege
reviewed
Jan 19, 2023
This is a helper function in a similar vein to gtk4-rs's `install_action_async ()` for widgets. It allows applications to install actions that use async/await without having to manually create a glib::MainContext in the callback.
ad5f0a4 to
7c20e1b
Compare
Member
|
This should probably just call the helper function from #902 once merged. |
sdroege
reviewed
Jul 5, 2023
|
|
||
| pub fn activate_async<Fut, F>(mut self, callback: F) -> Self | ||
| where | ||
| F: Fn(&O, &SimpleAction, Option<&Variant>) -> Fut + 'static + Clone, |
Member
There was a problem hiding this comment.
Why require Clone here? I think it would be better if you would instead use an Rc instead of a Box for storing the callback. Then you get cloning for free and don't make it the user's problem.
Member
There was a problem hiding this comment.
any chance we resolve this? it would be cool to merge this already without waiting endlessly for #902.
Member
|
re-ping @BrainBlasted ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a helper function in a similar vein to
gtk4-rs's
install_action_async ()for widgets.It allows applications to install actions
that use async/await without having to manually
create a glib::MainContext in the callback.