fix: paket: adjust viewswitcher in title

This commit is contained in:
jane400 2024-09-19 18:00:16 +02:00 committed by jane400
parent 87befa2f13
commit b9fb7fcea4

View file

@ -63,11 +63,14 @@ impl Component for Ready {
#[wrap(Some)] #[wrap(Some)]
set_child = &adw::NavigationView { set_child = &adw::NavigationView {
add = &adw::NavigationPage { add = &adw::NavigationPage {
set_title: "",
#[wrap(Some)] #[wrap(Some)]
set_child = &adw::ToolbarView { set_child = &adw::ToolbarView {
add_top_bar = ready_headerbar = &adw::HeaderBar { add_top_bar = ready_headerbar = &adw::HeaderBar {
#[wrap(Some)] #[wrap(Some)]
set_title_widget = ready_switchertop = &adw::ViewSwitcher{ set_title_widget = ready_switchertop = &adw::ViewSwitcher{
set_policy: adw::ViewSwitcherPolicy::Wide,
set_stack: Some(&ready_view_stack), set_stack: Some(&ready_view_stack),
} }
}, },
@ -161,30 +164,26 @@ impl Component for Ready {
}); });
} }
let breakpoint_0 = adw::Breakpoint::new(adw::BreakpointCondition::new_length( let breakpoint = adw::Breakpoint::new(adw::BreakpointCondition::new_length(
adw::BreakpointConditionLengthType::MaxWidth, adw::BreakpointConditionLengthType::MaxWidth,
480.0, 450.0,
adw::LengthUnit::Sp,
));
let breakpoint_1 = adw::Breakpoint::new(adw::BreakpointCondition::new_length(
adw::BreakpointConditionLengthType::MaxWidth,
480.0,
adw::LengthUnit::Sp, adw::LengthUnit::Sp,
)); ));
let widgets = view_output!(); let widgets = view_output!();
breakpoint_0.add_setter(widgets.ready_headerbar.widget_ref(), "title-widget", None); breakpoint.add_setter(
sender widgets.ready_headerbar.widget_ref(),
.output(ReadyOutput::AddBreakpoint(breakpoint_0)) "show-title",
.unwrap(); Some(&gtk::glib::Value::from(false)),
breakpoint_1.add_setter( );
breakpoint.add_setter(
widgets.ready_switcherbar.widget_ref(), widgets.ready_switcherbar.widget_ref(),
"reveal", "reveal",
Some(&gtk::glib::Value::from(true)), Some(&gtk::glib::Value::from(true)),
); );
sender sender
.output(ReadyOutput::AddBreakpoint(breakpoint_1)) .output(ReadyOutput::AddBreakpoint(breakpoint))
.unwrap(); .unwrap();
ComponentParts { model, widgets } ComponentParts { model, widgets }