callbacks/policycheck_state: update theme, popup
* popup handling update * handling of themes Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -59,7 +59,7 @@ struct Environment {
|
||||
rust_log: String,
|
||||
}
|
||||
|
||||
/// Handles the requests of the `PolicyCheckView`.
|
||||
/// Handles the requests from `PolicyCheckView`.
|
||||
#[derive(AsAny, Default)]
|
||||
pub struct PolicyCheckState {
|
||||
action: Option<Action>,
|
||||
@@ -74,7 +74,7 @@ pub struct PolicyCheckState {
|
||||
policy_numbers: HashMap<u64, PolicyCode>,
|
||||
progress_bar: Entity,
|
||||
progress_count: f64,
|
||||
theme: String
|
||||
theme_name: String
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "light"))]
|
||||
@@ -593,20 +593,20 @@ impl State for PolicyCheckState {
|
||||
self.set_entry(entity, ctx);
|
||||
}
|
||||
Action::ToggleTheme(_entity) => {
|
||||
if self.theme == "light" {
|
||||
self.theme = "dark_theme".to_string();
|
||||
} else {
|
||||
self.theme = "light_theme".to_string();
|
||||
}
|
||||
//match &self.theme {
|
||||
// light => { self.theme = "dark_theme".to_string(); }
|
||||
// dark => { self.theme = "light_theme".to_string(); }
|
||||
// _ => { debug!(target: "advotracker", "theme not supported!"); }
|
||||
// }
|
||||
println!{"Switch theme to {:?}", self.theme}
|
||||
if self.theme_name == "light" {
|
||||
let theme = dark_theme();
|
||||
self.theme_name = "dark".to_string();
|
||||
ctx.switch_theme(theme);
|
||||
}
|
||||
|
||||
if self.theme_name == "dark" {
|
||||
let theme = light_theme();
|
||||
self.theme_name = "light".to_string();
|
||||
ctx.switch_theme(theme);
|
||||
};
|
||||
|
||||
println!{"Switch theme to {:?}", self.theme_name};
|
||||
}
|
||||
}
|
||||
}
|
||||
// Reset action
|
||||
|
||||
Reference in New Issue
Block a user