I am having trouble with the documentation and can not seem to fund a way to add a child widget to a libadwaita::ViewStackPage.
I can not see set_child in the doc page here: ViewStackPage in libadwaita - Rust
This is the snippet that is causing problems:
(though this is new to me and it most likely is completely incorrect)
impl MainWindow {
pub fn new(app: &adw::Application) -> Self {
Object::new(&[("application", app)]).expect("Failed to create window")
}
fn add_pages(&self) {
let contacts_page = ui::contacts_container::ContactsContainer::new();
let leaflet = &contacts_page.imp().leaflet.get();
let page = &self.imp().contacts_page.get();
page.setset_child(Some(&leaflet));
}
}
And I am getting this error:
error[E0599]: the method `set_child` exists for reference `&ViewStackPage`, but its trait bounds were not satisfied
--> src/ui/main_window.rs:75:14
|
75 | page.set_child(Some(&leaflet));
| ^^^^^^^^^
|
::: /home/bill/.cargo/registry/src/github.com-1ecc6299db9ec823/libadwaita-0.1.1/src/auto/view_stack_page.rs:14:1
|
14 | / glib::wrapper! {
15 | | #[doc(alias = "AdwViewStackPage")]
16 | | pub struct ViewStackPage(Object<ffi::AdwViewStackPage, ffi::AdwViewStackPageClass>);
17 | |
... |
20 | | }
21 | | }
| | -
| | |
| | doesn't satisfy `ViewStackPage: IsA<FlowBoxChild>`
| | doesn't satisfy `ViewStackPage: IsA<Frame>`
| | doesn't satisfy `ViewStackPage: IsA<ListBoxRow>`
| | doesn't satisfy `ViewStackPage: IsA<Popover>`
| | doesn't satisfy `ViewStackPage: IsA<gtk4::Button>`
| | doesn't satisfy `ViewStackPage: IsA<gtk4::ComboBox>`
| | doesn't satisfy `ViewStackPage: IsA<gtk4::Window>`
| | doesn't satisfy `ViewStackPage: libadwaita::prelude::ButtonExt`
| | doesn't satisfy `ViewStackPage: libadwaita::prelude::ComboBoxExt`
| | doesn't satisfy `ViewStackPage: libadwaita::prelude::FrameExt`
| | doesn't satisfy `ViewStackPage: libadwaita::prelude::GtkWindowExt`
| | doesn't satisfy `ViewStackPage: libadwaita::prelude::ListBoxRowExt`
| |_doesn't satisfy `ViewStackPage: libadwaita::prelude::PopoverExt`
| doesn't satisfy `_: libadwaita::prelude::FlowBoxChildExt`
|
= note: the following trait bounds were not satisfied:
`ViewStackPage: IsA<gtk4::Button>`
which is required by `ViewStackPage: libadwaita::prelude::ButtonExt`
`ViewStackPage: IsA<gtk4::ComboBox>`
which is required by `ViewStackPage: libadwaita::prelude::ComboBoxExt`
`ViewStackPage: IsA<FlowBoxChild>`
which is required by `ViewStackPage: libadwaita::prelude::FlowBoxChildExt`
`ViewStackPage: IsA<Frame>`
which is required by `ViewStackPage: libadwaita::prelude::FrameExt`
`ViewStackPage: IsA<ListBoxRow>`
which is required by `ViewStackPage: libadwaita::prelude::ListBoxRowExt`
`ViewStackPage: IsA<Popover>`
which is required by `ViewStackPage: libadwaita::prelude::PopoverExt`
`ViewStackPage: IsA<gtk4::Window>`
which is required by `ViewStackPage: libadwaita::prelude::GtkWindowExt`
`&ViewStackPage: IsA<gtk4::Button>`
which is required by `&ViewStackPage: libadwaita::prelude::ButtonExt`
`&ViewStackPage: IsA<gtk4::ComboBox>`
which is required by `&ViewStackPage: libadwaita::prelude::ComboBoxExt`
`&ViewStackPage: IsA<FlowBoxChild>`
which is required by `&ViewStackPage: libadwaita::prelude::FlowBoxChildExt`
`&ViewStackPage: IsA<Frame>`
which is required by `&ViewStackPage: libadwaita::prelude::FrameExt`
`&ViewStackPage: IsA<ListBoxRow>`
which is required by `&ViewStackPage: libadwaita::prelude::ListBoxRowExt`
`&ViewStackPage: IsA<Popover>`
which is required by `&ViewStackPage: libadwaita::prelude::PopoverExt`
`&ViewStackPage: IsA<gtk4::Window>`
which is required by `&ViewStackPage: libadwaita::prelude::GtkWindowExt`