Skip to content

action_entry: Add activate_async helper#903

Open
BrainBlasted wants to merge 1 commit intogtk-rs:mainfrom
BrainBlasted:actionentry-activate-async
Open

action_entry: Add activate_async helper#903
BrainBlasted wants to merge 1 commit intogtk-rs:mainfrom
BrainBlasted:actionentry-activate-async

Conversation

@BrainBlasted
Copy link
Contributor

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.

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.
@BrainBlasted BrainBlasted force-pushed the actionentry-activate-async branch from ad5f0a4 to 7c20e1b Compare January 19, 2023 17:36
@sdroege sdroege added this to the 0.17.0 milestone Jan 21, 2023
@sdroege
Copy link
Member

sdroege commented Jan 21, 2023

This should probably just call the helper function from #902 once merged.

@sdroege sdroege modified the milestones: 0.17.0, 0.18.0 Feb 8, 2023

pub fn activate_async<Fut, F>(mut self, callback: F) -> Self
where
F: Fn(&O, &SimpleAction, Option<&Variant>) -> Fut + 'static + Clone,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any chance we resolve this? it would be cool to merge this already without waiting endlessly for #902.

@bilelmoussaoui bilelmoussaoui modified the milestones: 0.18.0, 0.20 May 31, 2024
@sdroege sdroege modified the milestones: 0.20, 0.21 Jul 10, 2024
@bilelmoussaoui
Copy link
Member

re-ping @BrainBlasted ?

@sdroege sdroege removed this from the 0.21 milestone Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants