Enhance API for adw_view_stack_page
I'm using gtk4-rs
with Relm4
to create libadwaita
applications. Currently I'm struggling with creating a ViewStack using the view!
macro as there is no constructor on ViewStack.
For a widget I'm trying to create a ViewStack the following way:
append: stack = &adw::ViewStack {
add_titled(Some("First"), "First Page") = >k::Label {
set_label: "This is the start page",
},
Which basically creates a ViewStack
using the new
constructor and then calls add_titled
, with the provided parameters. Detailed information on how the macro works can be found here.
The limitation is now unfortunately, that it not possible to do further modifications on ViewStackPage
by calling functions like set_icon_name
.
Ideally it would be possible to use the macro the following way:
append: stack = &adw::ViewStack {
add: &adw::ViewStackPage {
set_child: = >k::Label {
set_label: "This is the start page",
},
set_icon_name: Some("icon_name"),
set_badge_number: 3,
},
Like this it would be easy to provide further properties with the creation of the ViewStackPage
.
In order to facilitate this, one would need a constructor (view_stack_page_new
) and a possibility to set the child widget after initialisation (view_stack_page_set_child
).
That would make working with ViewStack
really cool with this way.
What do you think about that? Would this be possible/make sense for you?