fix(display): hide arrangement section when there is less than two displays

This commit is contained in:
Michael Aaron Murphy 2024-02-15 04:51:51 +01:00 committed by Michael Murphy
parent ced3f2ffd8
commit 219cb36d3c
2 changed files with 29 additions and 9 deletions

View file

@ -624,9 +624,16 @@ impl SettingsApp {
let section = &self.pages.sections[id];
let model = &self.pages.page[self.active_page];
column_widgets.push(
(section.view_fn)(&self.pages, model.as_ref(), section).map(Message::PageMessage),
);
if section
.show_while
.as_ref()
.map_or(true, |func| func(model.as_ref()))
{
column_widgets.push(
(section.view_fn)(&self.pages, model.as_ref(), section)
.map(Message::PageMessage),
);
}
}
settings::view_column(column_widgets).into()
@ -680,12 +687,18 @@ impl SettingsApp {
sections.push(search_header(&self.pages, page));
}
let section = (section.view_fn)(&self.pages, model.as_ref(), section)
.map(Message::PageMessage)
.apply(iced::widget::container)
.padding([0, 0, 0, cosmic::theme::active().cosmic().space_xl()]);
if section
.show_while
.as_ref()
.map_or(true, |func| func(model.as_ref()))
{
let section = (section.view_fn)(&self.pages, model.as_ref(), section)
.map(Message::PageMessage)
.apply(iced::widget::container)
.padding([0, 0, 0, cosmic::theme::active().cosmic().space_xl()]);
sections.push(section.into());
sections.push(section.into());
}
}
settings::view_column(sections).into()