feat(wallpaper): update slideshow preview in realtime
This commit is contained in:
parent
a813f642db
commit
98404ce604
2 changed files with 15 additions and 2 deletions
|
|
@ -12,7 +12,7 @@ use crate::pages::desktop::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use crate::pages::input::{self, keyboard};
|
use crate::pages::input::{self, keyboard};
|
||||||
use crate::pages::{display, sound, system, time};
|
use crate::pages::{self, display, sound, system, time};
|
||||||
use crate::subscription::desktop_files;
|
use crate::subscription::desktop_files;
|
||||||
use crate::widget::{page_title, search_header};
|
use crate::widget::{page_title, search_header};
|
||||||
use crate::PageCommands;
|
use crate::PageCommands;
|
||||||
|
|
@ -21,7 +21,7 @@ use cosmic::iced::Subscription;
|
||||||
use cosmic::widget::{button, row, text_input};
|
use cosmic::widget::{button, row, text_input};
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
app::{Command, Core},
|
app::{Command, Core},
|
||||||
cosmic_config::config_subscription,
|
cosmic_config::{config_state_subscription, config_subscription},
|
||||||
iced::{
|
iced::{
|
||||||
self,
|
self,
|
||||||
event::{self, wayland, PlatformSpecific},
|
event::{self, wayland, PlatformSpecific},
|
||||||
|
|
@ -228,6 +228,11 @@ impl cosmic::Application for SettingsApp {
|
||||||
|
|
||||||
Message::PanelConfig(update.config)
|
Message::PanelConfig(update.config)
|
||||||
}),
|
}),
|
||||||
|
config_state_subscription(0, cosmic_bg_config::NAME.into(), 1).map(|update| {
|
||||||
|
Message::PageMessage(pages::Message::DesktopWallpaper(
|
||||||
|
pages::desktop::wallpaper::Message::UpdateState(update.config),
|
||||||
|
))
|
||||||
|
}),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,8 @@ pub enum Message {
|
||||||
Select(DefaultKey),
|
Select(DefaultKey),
|
||||||
/// Changes the slideshow parameter.
|
/// Changes the slideshow parameter.
|
||||||
Slideshow(bool),
|
Slideshow(bool),
|
||||||
|
/// State change from cosmic-bg
|
||||||
|
UpdateState(cosmic_bg_config::state::State),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Message> for crate::app::Message {
|
impl From<Message> for crate::app::Message {
|
||||||
|
|
@ -615,6 +617,12 @@ impl Page {
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
pub fn update(&mut self, message: Message) -> Command<crate::app::Message> {
|
pub fn update(&mut self, message: Message) -> Command<crate::app::Message> {
|
||||||
match message {
|
match message {
|
||||||
|
Message::UpdateState(_state) => {
|
||||||
|
if let Choice::Slideshow = self.selection.active {
|
||||||
|
self.cache_display_image();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Message::DragColorDialog => {
|
Message::DragColorDialog => {
|
||||||
return cosmic::iced_sctk::commands::window::start_drag_window(self.color_dialog)
|
return cosmic::iced_sctk::commands::window::start_drag_window(self.color_dialog)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue