Clean up desktop page definition and add notifications

This commit is contained in:
Jeremy Soller 2022-12-21 09:12:18 -07:00
parent 0681c1edea
commit 193d032519
No known key found for this signature in database
GPG key ID: 87F211AF2BE4C2FE

View file

@ -25,6 +25,7 @@ pub enum DesktopPage {
Appearance, Appearance,
DockAndTopPanel, DockAndTopPanel,
Workspaces, Workspaces,
Notifications,
} }
#[derive(Clone, Copy, Debug, Eq, PartialEq)] #[derive(Clone, Copy, Debug, Eq, PartialEq)]
@ -199,95 +200,72 @@ impl Window {
} }
fn view_desktop_root(&self) -> Element<Message> { fn view_desktop_root(&self) -> Element<Message> {
//TODO: rename and move to libcosmic
let desktop_page_button = |icon_name, title, description, desktop_page| {
iced::widget::Button::new(
container(settings::item_row(vec![
icon(icon_name, 20).style(theme::Svg::Symbolic).into(),
column!(
text(title).size(18),
text(description).size(12),
).spacing(2).into(),
horizontal_space(iced::Length::Fill).into(),
icon("go-next-symbolic", 20).style(theme::Svg::Symbolic).into(),
]).spacing(16))
.padding([20, 24])
.style(theme::Container::Custom(list::column::style))
)
.padding(0)
.style(theme::Button::Transparent)
.on_press(Message::Page(Page::Desktop(desktop_page)))
};
settings::view_column(vec![ settings::view_column(vec![
text("Desktop").size(30).into(), text("Desktop").size(30).into(),
//TODO: simplify these buttons! //TODO: simplify these buttons!
column!( column!(
iced::widget::Button::new( desktop_page_button(
container(settings::item_row(vec![ "video-display-symbolic",
icon("video-display-symbolic", 20).style(theme::Svg::Symbolic).into(), "Desktop Options",
column!( "Super Key action, hot corners, window control options.",
text("Desktop Options").size(18), DesktopPage::DesktopOptions
text("Super Key action, hot corners, window control options.").size(12), ),
).spacing(2).into(),
horizontal_space(iced::Length::Fill).into(),
icon("go-next-symbolic", 20).style(theme::Svg::Symbolic).into(),
]).spacing(16))
.padding([20, 24])
.style(theme::Container::Custom(list::column::style))
)
.padding(0)
.style(theme::Button::Transparent)
.on_press(Message::Page(Page::Desktop(DesktopPage::DesktopOptions))),
iced::widget::Button::new( desktop_page_button(
container(settings::item_row(vec![ "preferences-desktop-wallpaper-symbolic",
icon("preferences-desktop-wallpaper-symbolic", 20).style(theme::Svg::Symbolic).into(), "Wallpaper",
column!( "Background images, colors, and slideshow options.",
text("Wallpaper").size(18), DesktopPage::Wallpaper
text("Background images, colors, and slideshow options.").size(12), ),
).spacing(2).into(),
horizontal_space(iced::Length::Fill).into(),
icon("go-next-symbolic", 20).style(theme::Svg::Symbolic).into(),
]).spacing(16))
.padding([20, 24])
.style(theme::Container::Custom(list::column::style))
)
.padding(0)
.style(theme::Button::Transparent)
.on_press(Message::Page(Page::Desktop(DesktopPage::Wallpaper))),
iced::widget::Button::new( desktop_page_button(
container(settings::item_row(vec![ "preferences-pop-desktop-appearance-symbolic",
icon("preferences-pop-desktop-appearance-symbolic", 20).style(theme::Svg::Symbolic).into(), "Appearance",
column!( "Accent colors and COSMIC theming",
text("Appearance").size(18), DesktopPage::Appearance
text("Accent colors and COSMIC theming").size(12), ),
).spacing(2).into(),
horizontal_space(iced::Length::Fill).into(),
icon("go-next-symbolic", 20).style(theme::Svg::Symbolic).into(),
]).spacing(16))
.padding([20, 24])
.style(theme::Container::Custom(list::column::style))
)
.padding(0)
.style(theme::Button::Transparent)
.on_press(Message::Page(Page::Desktop(DesktopPage::Appearance))),
iced::widget::Button::new( desktop_page_button(
container(settings::item_row(vec![ "preferences-pop-desktop-dock-symbolic",
icon("preferences-pop-desktop-dock-symbolic", 20).style(theme::Svg::Symbolic).into(), "Dock & Top Panel",
column!( "Customize size, positions, and more for Dock and Top Panel.",
text("Dock & Top Panel").size(18), DesktopPage::DockAndTopPanel
text("Customize size, positions, and more for Dock and Top Panel.").size(12), ),
).spacing(2).into(),
horizontal_space(iced::Length::Fill).into(),
icon("go-next-symbolic", 20).style(theme::Svg::Symbolic).into(),
]).spacing(16))
.padding([20, 24])
.style(theme::Container::Custom(list::column::style))
)
.padding(0)
.style(theme::Button::Transparent)
.on_press(Message::Page(Page::Desktop(DesktopPage::DockAndTopPanel))),
iced::widget::Button::new( desktop_page_button(
container(settings::item_row(vec![ "preferences-pop-desktop-workspaces-symbolic",
icon("preferences-pop-desktop-workspaces-symbolic", 20).style(theme::Svg::Symbolic).into(), "Workspaces",
column!( "Set workspace number, behavior, and placement.",
text("Workspaces").size(18), DesktopPage::Workspaces
text("Set workspace number, behavior, and placement.").size(12), ),
).spacing(2).into(),
horizontal_space(iced::Length::Fill).into(), desktop_page_button(
icon("go-next-symbolic", 20).style(theme::Svg::Symbolic).into(), "preferences-system-notifications-symbolic",
]).spacing(16)) "Notifications",
.padding([20, 24]) "Do Not Disturb, lockscreen notifications, and per-application settings.",
.style(theme::Container::Custom(list::column::style)) DesktopPage::Notifications
) ),
.padding(0)
.style(theme::Button::Transparent)
.on_press(Message::Page(Page::Desktop(DesktopPage::Workspaces))),
).spacing(16).into() ).spacing(16).into()
]) ])
.into() .into()