mirror of
https://github.com/an-anime-team/sleepy-launcher.git
synced 2025-02-17 02:09:46 +03:00
fix(ui): 🐛 added background downloading on style's change from settings
Previously launcher wasn't downloading background picture if the style was changed from the settings. This lead to situation when the window size and components position is updated, but background is fully transparent. With this change launcher will try to download picture if default background file doesn't exist. Not that launcher won't try to update this picture and this will happen only after restart, which is not an issue, I think
This commit is contained in:
parent
6024ef885e
commit
b7e85b7a8f
2 changed files with 15 additions and 0 deletions
|
@ -16,6 +16,8 @@ use super::finish::*;
|
|||
|
||||
pub static mut MAIN_WINDOW: Option<adw::Window> = None;
|
||||
|
||||
// TODO: add special page for launcher style selection
|
||||
|
||||
pub struct FirstRunApp {
|
||||
welcome: AsyncController<WelcomeApp>,
|
||||
tos_warning: AsyncController<TosWarningApp>,
|
||||
|
|
|
@ -532,6 +532,19 @@ impl SimpleAsyncComponent for GeneralApp {
|
|||
|
||||
#[allow(unused_must_use)]
|
||||
GeneralAppMsg::UpdateLauncherStyle(style) => {
|
||||
if style == LauncherStyle::Classic && !BACKGROUND_FILE.exists() {
|
||||
if let Err(err) = crate::background::download_background() {
|
||||
tracing::error!("Failed to download background picture");
|
||||
|
||||
sender.input(GeneralAppMsg::Toast {
|
||||
title: tr("background-downloading-failed"),
|
||||
description: Some(err.to_string())
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if let Ok(mut config) = config::get() {
|
||||
config.launcher.style = style;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue