Add ThemeChanged variant to Event in iced_sentinel
This commit is contained in:
parent
7f7c5ea337
commit
c856d2b513
13 changed files with 69 additions and 4 deletions
|
|
@ -11,10 +11,11 @@ categories.workspace = true
|
|||
keywords.workspace = true
|
||||
|
||||
[features]
|
||||
enable = ["iced_sentinel", "once_cell"]
|
||||
enable = ["dep:iced_sentinel", "dep:once_cell"]
|
||||
|
||||
[dependencies]
|
||||
iced_core.workspace = true
|
||||
iced_style.workspace = true
|
||||
|
||||
iced_sentinel.workspace = true
|
||||
iced_sentinel.optional = true
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
pub use iced_core as core;
|
||||
pub use iced_style as style;
|
||||
|
||||
use crate::style::theme;
|
||||
|
||||
pub use internal::Timer;
|
||||
|
||||
|
|
@ -6,6 +9,10 @@ pub fn open_axe() {}
|
|||
|
||||
pub fn log_message(_message: &impl std::fmt::Debug) {}
|
||||
|
||||
pub fn theme_changed(palette: theme::Palette) {
|
||||
internal::theme_changed(palette);
|
||||
}
|
||||
|
||||
pub fn boot_time() -> Timer {
|
||||
internal::boot_time()
|
||||
}
|
||||
|
|
@ -41,6 +48,7 @@ pub fn time(name: impl AsRef<str>) -> Timer {
|
|||
#[cfg(feature = "enable")]
|
||||
mod internal {
|
||||
use crate::core::time::Instant;
|
||||
use crate::style::theme;
|
||||
|
||||
use iced_sentinel::client::{self, Client};
|
||||
use iced_sentinel::timing::{self, Timing};
|
||||
|
|
@ -48,6 +56,10 @@ mod internal {
|
|||
use once_cell::sync::Lazy;
|
||||
use std::sync::{Mutex, MutexGuard};
|
||||
|
||||
pub fn theme_changed(palette: theme::Palette) {
|
||||
lock().sentinel.report_theme_change(palette);
|
||||
}
|
||||
|
||||
pub fn boot_time() -> Timer {
|
||||
timer(timing::Stage::Boot)
|
||||
}
|
||||
|
|
@ -120,6 +132,10 @@ mod internal {
|
|||
|
||||
#[cfg(not(feature = "enable"))]
|
||||
mod internal {
|
||||
use crate::style::theme;
|
||||
|
||||
pub fn theme_changed(_palette: theme::Palette) {}
|
||||
|
||||
pub fn boot_time() -> Timer {
|
||||
Timer
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue