fix: add page headers to parentless pages

This commit is contained in:
Michael Aaron Murphy 2024-05-08 16:11:57 +02:00 committed by Michael Murphy
parent b79e4a250a
commit fb85200e58
2 changed files with 10 additions and 16 deletions

View file

@ -624,9 +624,9 @@ impl SettingsApp {
fn page_view(&self, content: &[section::Entity]) -> cosmic::Element<Message> {
let page = &self.pages.page[self.active_page];
let page_info = &self.pages.info[self.active_page];
let mut column_widgets = Vec::with_capacity(1);
let mut column_widgets = Vec::with_capacity(1 + content.len());
if let Some(parent) = page_info.parent {
column_widgets.push(if let Some(parent) = page_info.parent {
let page_header = crate::widget::sub_page_header(
page_info.title.as_str(),
self.pages.info[parent].title.as_str(),
@ -642,10 +642,11 @@ impl SettingsApp {
page_header_content = page_header_content.push(element.map(Message::from));
}
column_widgets.push(page_header_content.into());
}
page_header_content.into()
} else {
cosmic::widget::text::title3(&page_info.title).into()
});
column_widgets.reserve_exact(1 + content.len());
for id in content.iter().copied() {
let section = &self.pages.sections[id];
let model = &self.pages.page[self.active_page];

View file

@ -1,20 +1,13 @@
use crate::app;
use clap::builder::OsStr;
use cosmic::{
cosmic_config::{self, ConfigGet, ConfigSet},
iced::{self, wayland::actions::window::SctkWindowSettings, window},
iced_sctk::commands,
iced_widget::core::layout,
iced,
};
use cosmic_comp_config::{
input::{
AccelConfig, AccelProfile, ClickMethod, InputConfig, ScrollConfig, ScrollMethod,
TapButtonMap, TapConfig,
},
XkbConfig,
use cosmic_comp_config::input::{
AccelConfig, AccelProfile, ClickMethod, InputConfig, ScrollConfig, ScrollMethod,
TapButtonMap, TapConfig,
};
use cosmic_settings_page as page;
use itertools::Itertools;
use tracing::error;
pub mod keyboard;