diff --git a/cosmic-settings/src/pages/desktop/appearance/mod.rs b/cosmic-settings/src/pages/desktop/appearance/mod.rs index 8b85570..e5b0eeb 100644 --- a/cosmic-settings/src/pages/desktop/appearance/mod.rs +++ b/cosmic-settings/src/pages/desktop/appearance/mod.rs @@ -17,14 +17,14 @@ use cosmic::cosmic_theme::{ CornerRadii, Density, Spacing, Theme, ThemeBuilder, ThemeMode, DARK_THEME_BUILDER_ID, LIGHT_THEME_BUILDER_ID, }; -use cosmic::iced_core::{alignment, Color, Length}; +use cosmic::iced_core::{Alignment, Color, Length}; use cosmic::iced_widget::scrollable::{Direction, Scrollbar}; use cosmic::widget::icon::{from_name, icon}; use cosmic::widget::{ button, color_picker::ColorPickerUpdate, container, flex_row, horizontal_space, radio, row, scrollable, settings, spin_button, text, ColorPickerModel, }; -use cosmic::{Apply, Element, Task}; +use cosmic::{widget, Apply, Element, Task}; #[cfg(feature = "wayland")] use cosmic_panel_config::CosmicPanelConfig; use cosmic_settings_page::Section; @@ -286,7 +286,7 @@ pub enum Message { FontConfig(font_config::Message), FontSearch(String), FontSelect(bool, Arc), - GapSize(i32), + GapSize(u32), IconTheme(usize), #[cfg(feature = "ashpd")] ImportError, @@ -305,7 +305,7 @@ pub enum Message { #[cfg(feature = "ashpd")] StartImport, UseDefaultWindowHint(bool), - WindowHintSize(i32), + WindowHintSize(u32), Daytime(bool), } @@ -560,14 +560,14 @@ impl Page { if self .theme_builder - .set_active_hint(config, active_hint as u32) + .set_active_hint(config, active_hint) .unwrap_or_default() { self.theme_config_write("active_hint", active_hint); } } - Message::GapSize(new_gap_size) => { + Message::GapSize(gap) => { needs_sync = true; let Some(config) = self.theme_builder_config.as_ref() else { @@ -576,7 +576,7 @@ impl Page { let mut gaps = self.theme_builder.gaps; - gaps.1 = new_gap_size as u32; + gaps.1 = gap; if self .theme_builder @@ -1307,8 +1307,6 @@ impl Page { // TODO: cache panel and dock configs so that they needn't be re-read #[cfg(feature = "wayland")] fn update_panel_radii(roundness: Roundness) { - use cosmic_config::CosmicConfigEntry; - let panel_config_helper = CosmicPanelConfig::cosmic_config("Panel").ok(); let dock_config_helper = CosmicPanelConfig::cosmic_config("Dock").ok(); @@ -1355,8 +1353,6 @@ impl Page { #[cfg(feature = "wayland")] fn update_panel_spacing(density: Density) { - use cosmic_config::CosmicConfigEntry; - let panel_config_helper = CosmicPanelConfig::cosmic_config("Panel").ok(); let dock_config_helper = CosmicPanelConfig::cosmic_config("Dock").ok(); let mut panel_config = panel_config_helper.as_ref().and_then(|config_helper| { @@ -1423,7 +1419,7 @@ impl page::Page for Page { .push(button::standard(fl!("export")).on_press(Message::StartExport)) .apply(container) .width(Length::Fill) - .align_x(alignment::Horizontal::Right) + .align_x(Alignment::End) .apply(Element::from) .map(crate::pages::Message::Appearance); @@ -1601,7 +1597,7 @@ pub fn mode_and_colors() -> Section { ] .spacing(space_xxs) .width(Length::FillPortion(1)) - .align_x(cosmic::iced_core::Alignment::Center), + .align_x(Alignment::Center), cosmic::iced::widget::column![ button::custom( icon(light_mode_illustration.clone(),) @@ -1616,14 +1612,13 @@ pub fn mode_and_colors() -> Section { ] .spacing(space_xxs) .width(Length::FillPortion(1)) - .align_x(cosmic::iced_core::Alignment::Center) + .align_x(Alignment::Center) ] .spacing(48) - .align_y(cosmic::iced_core::Alignment::Center) + .align_y(Alignment::Center) .width(Length::Fixed(424.0)), ) - .width(Length::Fill) - .align_x(cosmic::iced_core::alignment::Horizontal::Center), + .center_x(Length::Fill), ) .add( settings::item::builder(&descriptions[auto_switch]) @@ -1856,7 +1851,7 @@ pub fn style() -> Section { ] .spacing(8) .width(Length::FillPortion(1)) - .align_x(cosmic::iced_core::Alignment::Center), + .align_x(Alignment::Center), cosmic::iced::widget::column![ button::custom( icon( @@ -1878,7 +1873,7 @@ pub fn style() -> Section { ] .spacing(8) .width(Length::FillPortion(1)) - .align_x(cosmic::iced_core::Alignment::Center), + .align_x(Alignment::Center), cosmic::iced::widget::column![ button::custom( icon( @@ -1900,15 +1895,14 @@ pub fn style() -> Section { text::body(&descriptions[square]) ] .spacing(8) - .align_x(cosmic::iced_core::Alignment::Center) + .align_x(Alignment::Center) .width(Length::FillPortion(1)) ] .spacing(12) .width(Length::Fixed(628.0)) - .align_y(cosmic::iced_core::Alignment::Center), + .align_y(Alignment::Center), ) - .width(Length::Fill) - .align_x(cosmic::iced_core::alignment::Horizontal::Center), + .center_x(Length::Fill), ) .apply(Element::from) .map(crate::pages::Message::Appearance) @@ -1976,26 +1970,26 @@ pub fn window_management() -> Section { settings::section() .title(§ion.title) - .add( - settings::item::builder(&descriptions[active_hint]).control(spin_button( - page.theme.active_hint.to_string(), + .add(settings::item::builder(&descriptions[active_hint]).control( + cosmic::widget::spin_button( + page.theme_builder.active_hint.to_string(), 1, - page.theme.active_hint as i32, + page.theme.active_hint, 0, 500, Message::WindowHintSize, - )), - ) - .add( - settings::item::builder(&descriptions[gaps]).control(spin_button( - page.theme.gaps.1.to_string(), + ), + )) + .add(settings::item::builder(&descriptions[gaps]).control( + cosmic::widget::spin_button( + page.theme_builder.gaps.1.to_string(), + page.theme_builder.gaps.1.to_string(), 1, - page.theme.gaps.1 as i32, - 0, + page.theme.active_hint, 500, Message::GapSize, - )), - ) + ), + )) .apply(Element::from) .map(crate::pages::Message::Appearance) }) @@ -2084,4 +2078,4 @@ pub fn color_button<'a, Message: 'a + Clone>( .width(Length::Fixed(f32::from(width))) .height(Length::Fixed(f32::from(height))) .into() -} +} \ No newline at end of file