From edaf5b994e5bd6c78e9e395ebfa4f53c631faeae Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Fri, 9 May 2025 13:27:22 -0600 Subject: [PATCH] Expose applet configs, starting with time applet --- Cargo.lock | 10 ++++++++++ Cargo.toml | 1 + cosmic-applet-time/Cargo.toml | 2 ++ cosmic-applet-time/src/config.rs | 4 ++-- cosmic-applets-config/Cargo.toml | 8 ++++++++ cosmic-applets-config/src/lib.rs | 2 ++ 6 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 cosmic-applets-config/Cargo.toml create mode 100644 cosmic-applets-config/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index e5a11bf8..457fdd2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1307,12 +1307,14 @@ version = "0.1.0" dependencies = [ "chrono", "chrono-tz", + "cosmic-config", "i18n-embed", "i18n-embed-fl", "icu", "libcosmic", "once_cell", "rust-embed", + "serde", "timedate-zbus", "tokio", "tracing", @@ -1365,6 +1367,14 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "cosmic-applets-config" +version = "0.1.0" +dependencies = [ + "cosmic-config", + "serde", +] + [[package]] name = "cosmic-client-toolkit" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 10ecb1cb..8d55f656 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,7 @@ members = [ "cosmic-panel-button", "cosmic-applet-input-sources", "cosmic-applet-a11y", + "cosmic-applets-config", ] resolver = "2" diff --git a/cosmic-applet-time/Cargo.toml b/cosmic-applet-time/Cargo.toml index 165a41f9..d4120c0a 100644 --- a/cosmic-applet-time/Cargo.toml +++ b/cosmic-applet-time/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" license = "GPL-3.0-only" [dependencies] +cosmic-config.workspace = true chrono = { version = "0.4.39", features = ["clock"] } chrono-tz = "0.10" i18n-embed-fl.workspace = true @@ -21,5 +22,6 @@ icu = { version = "1.5.0", features = [ "compiled_data", "icu_datetime_experimental", ] } +serde.workspace = true zbus.workspace = true timedate-zbus = { git = "https://github.com/pop-os/dbus-settings-bindings" } diff --git a/cosmic-applet-time/src/config.rs b/cosmic-applet-time/src/config.rs index e16476ba..8a539dcc 100644 --- a/cosmic-applet-time/src/config.rs +++ b/cosmic-applet-time/src/config.rs @@ -1,9 +1,9 @@ // Copyright 2023 System76 // SPDX-License-Identifier: GPL-3.0-only -use cosmic::cosmic_config::{self, cosmic_config_derive::CosmicConfigEntry, CosmicConfigEntry}; +use cosmic_config::{self, cosmic_config_derive::CosmicConfigEntry, CosmicConfigEntry}; -#[derive(Debug, Clone, CosmicConfigEntry, PartialEq, Eq)] +#[derive(Debug, Clone, CosmicConfigEntry, PartialEq, Eq, serde::Deserialize, serde::Serialize)] #[version = 1] pub struct TimeAppletConfig { pub military_time: bool, diff --git a/cosmic-applets-config/Cargo.toml b/cosmic-applets-config/Cargo.toml new file mode 100644 index 00000000..f89f3fe9 --- /dev/null +++ b/cosmic-applets-config/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "cosmic-applets-config" +version = "0.1.0" +edition = "2024" + +[dependencies] +cosmic-config.workspace = true +serde.workspace = true diff --git a/cosmic-applets-config/src/lib.rs b/cosmic-applets-config/src/lib.rs new file mode 100644 index 00000000..eecb44fe --- /dev/null +++ b/cosmic-applets-config/src/lib.rs @@ -0,0 +1,2 @@ +#[path = "../../cosmic-applet-time/src/config.rs"] +pub mod time; \ No newline at end of file