diff --git a/src/system_settings.rs b/src/system_settings.rs index 9522edfc..47a90137 100644 --- a/src/system_settings.rs +++ b/src/system_settings.rs @@ -12,13 +12,13 @@ const GNOME_DESKTOP_NAMESPACE: &str = "org.gnome.desktop.interface"; mod imp { use std::cell::Cell; - use once_cell::sync::Lazy; - use super::*; - #[derive(Debug)] + #[derive(Debug, glib::Properties)] + #[properties(wrapper_type = super::SystemSettings)] pub struct SystemSettings { /// The clock format setting. + #[property(get, builder(ClockFormat::default()))] pub clock_format: Cell, } @@ -49,26 +49,8 @@ mod imp { type Type = super::SystemSettings; } + #[glib::derived_properties] impl ObjectImpl for SystemSettings { - fn properties() -> &'static [glib::ParamSpec] { - static PROPERTIES: Lazy> = Lazy::new(|| { - vec![glib::ParamSpecEnum::builder::("clock-format") - .read_only() - .build()] - }); - - PROPERTIES.as_ref() - } - - fn property(&self, _id: usize, pspec: &glib::ParamSpec) -> glib::Value { - let obj = self.obj(); - - match pspec.name() { - "clock-format" => obj.clock_format().to_value(), - _ => unimplemented!(), - } - } - fn constructed(&self) { self.parent_constructed(); let obj = self.obj(); @@ -156,11 +138,6 @@ impl SystemSettings { }).await; } - /// The clock format setting. - pub fn clock_format(&self) -> ClockFormat { - self.imp().clock_format.get() - } - /// Set the clock format setting. fn set_clock_format(&self, clock_format: ClockFormat) { if self.clock_format() == clock_format {