asked the clanker to change the arcidecture a bit
This commit is contained in:
@@ -9,5 +9,6 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
common = { path = "../../common" }
|
||||
service_datatime = { package = "service-datatime", path = "../../services/datatime" }
|
||||
iced = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
toml = { workspace = true }
|
||||
|
||||
@@ -11,6 +11,14 @@ use common::{BarModule, ClockKind, ClockPayload, ModuleEffect, ModuleMsg, Servic
|
||||
const POPUP_W: u32 = 360;
|
||||
const POPUP_H: u32 = 160;
|
||||
|
||||
/// Errors digesting the `module.clock` config table.
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum ClockError {
|
||||
/// Config value was present but not a bool.
|
||||
#[error("module.clock.{0} must be a bool")]
|
||||
NotBool(&'static str),
|
||||
}
|
||||
|
||||
/// A module-local message for the clock.
|
||||
#[derive(Clone)]
|
||||
pub enum ClockMsg {
|
||||
@@ -100,4 +108,12 @@ impl BarModule for Clock {
|
||||
fn popup_size(&self) -> Option<(u32, u32)> {
|
||||
Some((POPUP_W, POPUP_H))
|
||||
}
|
||||
fn config(&mut self, config: toml::Table) -> Result<(), Box<dyn std::error::Error>> {
|
||||
if let toml::Value::Boolean(e) = config["format"] {
|
||||
if e {
|
||||
self.show_seconds = true;
|
||||
};
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user