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

Missing Trait Implementations for FlowBox and Potential Conflicts #587

Open
imgurbot12 opened this issue Dec 10, 2023 · 2 comments
Open

Comments

@imgurbot12
Copy link

Hello, I'm enjoying the process of designing an app thus var with relm! However, I've run into an issue when looking for elements that might enable the option for more dynamic layouts like FlowBox.

When trying to place items within FlowBox like this example codeblock:

view! {
   ...
            #[name(overview)]
            gtk::FlowBox::builder()
                .css_classes(vec!["overview"])
                .build()
            {
                set_orientation: gtk::Orientation::Horizontal,
                set_spacing: 10,

                #[name(title)]
                gtk::Label::builder()
                    .label(&self.0.entry.name)
                    .css_classes(vec!["title"])
                    .build(),
                #[name(comment)]
                gtk::Label::builder()
                    .label(&self.0.entry.comment.clone().unwrap_or_else(|| "".to_owned()))
                    .css_classes(vec!["comment"])
                    .visible(self.0.comments)
                    .build(),
            },
   ...
}

rust comes back with the following errors:

error[E0599]: the method `container_add` exists for struct `FlowBox`, but its trait bounds were not satisfied
...
   | |_doesn't satisfy `FlowBox: RelmContainerExt`
   |   doesn't satisfy `FlowBox: RelmSetChildExt`
   |
   = note: the following trait bounds were not satisfied:
           `FlowBox: RelmSetChildExt`
           which is required by `FlowBox: RelmContainerExt`

I'm assuming this is because RelmContainerExt and RelmSetChildExt are not implemented for FlowBox. With little understanding of the codebase, I tried to implement them myself but it seems like there are potential conflicts in doing so:
https://github.com/Relm4/Relm4/blob/main/relm4/src/extensions/remove.rs#L11
https://github.com/Relm4/Relm4/blob/main/relm4/src/extensions/remove.rs#L30

I'm not sure how to proceed. Is it possible to use a FlowBox in the way I want to here? Any feedback is appreciated. Thanks!

@imgurbot12 imgurbot12 changed the title Missing Trait Implementations FlowBox and Conflicts Missing Trait Implementations for FlowBox and Potential Conflicts Dec 10, 2023
@AaronErhardt
Copy link
Member

Regarding this issue, you can read this section in the book: https://relm4.org/book/stable/tricks.html#method-container_add-is-missing

It sounds reasonable to me however, to implement RelmContainerExt for FlowBox using the append method, so you can keep this opened.

@imgurbot12
Copy link
Author

Can't believe I missed that. Thanks again!

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