Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create view! equivalent macro for buildable files to create AsyncComponent #484

Open
trutas83 opened this issue Jul 1, 2023 · 4 comments

Comments

@trutas83
Copy link

trutas83 commented Jul 1, 2023

Currently, there's no good way to create widgets with .ui files when creating AsyncComponent. This can be done with Components using gtk directly, but the same method cannot be used for AsyncComponent since async traits aren't officially supported.

@AaronErhardt
Copy link
Member

Relm4 re-exports the async_trait crate: https://docs.rs/relm4/latest/relm4/index.html#reexport.async_trait

All you need to do is to use #[relm4::async_trait::async_trait] above your AsyncComponent impl.

@trutas83
Copy link
Author

trutas83 commented Jul 1, 2023

Ah, I'm pretty new to Rust, and I didn't know what re-exports are for. Learned a new thing.

I still think it'd be helpful if there's a macro that generates widgets using .ui files.

Really cool project, by the way. Nice work!

@AaronErhardt
Copy link
Member

I still think it'd be helpful if there's a macro that generates widgets using .ui files.

I think gtk-rs has a macro for this, doesn't it? But I'm open for ideas or examples for using .ui files in Relm4. It's just that most people use the view! macro so we don't get a lot of requests or feedback regarding .ui files.

@trutas83
Copy link
Author

trutas83 commented Jul 1, 2023

I think gtk-rs has a macro for this, doesn't it?

Hmm. I'm not aware of any macro that leverages .ui files, but I could be wrong.

It's just that most people use the view! macro so we don't get a lot of requests or feedback regarding .ui files.

That makes sense. It's just that .ui files are independent to programming languages so reusing widgets is easier. Not to mention that version migrations are trivial with conversion tools.

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

No branches or pull requests

2 participants