Add theme and theme_changes functions to system

This commit is contained in:
Héctor Ramón Jiménez 2025-09-08 14:32:24 +02:00
parent 9518573fce
commit 09c604c92d
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
24 changed files with 186 additions and 102 deletions

View file

@ -37,7 +37,7 @@ impl Events {
}
Message::EventOccurred(event) => {
if let Event::Window(window::Event::CloseRequested) = event {
window::get_latest().and_then(window::close)
window::latest().and_then(window::close)
} else {
Task::none()
}
@ -47,7 +47,7 @@ impl Events {
Task::none()
}
Message::Exit => window::get_latest().and_then(window::close),
Message::Exit => window::latest().and_then(window::close),
}
}

View file

@ -20,7 +20,7 @@ enum Message {
impl Exit {
fn update(&mut self, message: Message) -> Task<Message> {
match message {
Message::Confirm => window::get_latest().and_then(window::close),
Message::Confirm => window::latest().and_then(window::close),
Message::Exit => {
self.show_confirm = true;

View file

@ -66,7 +66,7 @@ impl Example {
return Task::none();
};
window::get_position(*last_window)
window::position(*last_window)
.then(|last_position| {
let position = last_position.map_or(
window::Position::Default,

View file

@ -49,7 +49,7 @@ impl Example {
fn update(&mut self, message: Message) -> Task<Message> {
match message {
Message::Screenshot => {
return window::get_latest()
return window::latest()
.and_then(window::screenshot)
.map(Message::Screenshotted);
}

View file

@ -7,6 +7,6 @@ publish = false
[dependencies]
iced.workspace = true
iced.features = ["system"]
iced.features = ["sysinfo"]
bytesize = "1.1"

View file

@ -1,5 +1,6 @@
use iced::system;
use iced::widget::{button, center, column, text};
use iced::{Element, Task, system};
use iced::{Element, Task};
pub fn main() -> iced::Result {
iced::application(Example::new, Example::update, Example::view).run()
@ -26,7 +27,7 @@ impl Example {
fn new() -> (Self, Task<Message>) {
(
Self::Loading,
system::fetch_information().map(Message::InformationReceived),
system::information().map(Message::InformationReceived),
)
}

View file

@ -151,7 +151,7 @@ impl Todos {
widget::focus_next()
}
}
Message::ToggleFullscreen(mode) => window::get_latest()
Message::ToggleFullscreen(mode) => window::latest()
.and_then(move |window| window::set_mode(window, mode)),
Message::Loaded(_) => Command::none(),
};