Skip to content

Commit

Permalink
chore: finish readAll
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Sep 28, 2023
1 parent d2f64f3 commit a96a9fb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const COLOR_SCHEME: &str = "color-scheme";
const ACCENT_COLOR: &str = "accent-color";

use once_cell::sync::Lazy;
use std::collections::HashMap;
use std::sync::Arc;

pub use self::config::SettingsConfig;
Expand Down Expand Up @@ -64,6 +65,23 @@ impl SettingsBackend {
Err(zbus::fdo::Error::Failed("No such namespace".to_string()))
}

async fn read_all(&self, namespace: String) -> fdo::Result<OwnedValue> {
if namespace != APPEARANCE {
return Err(zbus::fdo::Error::Failed("No such namespace".to_string()));
}
let mut output = HashMap::<String, OwnedValue>::new();
let config = SETTING_CONFIG.lock().await;
output.insert(COLOR_SCHEME.to_string(), config.get_color_scheme().into());
output.insert(
ACCENT_COLOR.to_string(),
AccentColor {
color: config.get_accent_color(),
}
.into(),
);
Ok(output.into())
}

#[dbus_interface(signal)]
pub async fn setting_changed(
ctxt: &SignalContext<'_>,
Expand Down

0 comments on commit a96a9fb

Please sign in to comment.