From 20191b58e2e7edc674601da001ca675b58338b73 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Sun, 21 Nov 2021 21:23:02 +0100 Subject: [PATCH] DisplaySettings: Update wallpaper config path only on success The Window Server is ignoring incorrect files since 235f39e449, so let's not update the config when that happens and an error message instead! --- .../DisplaySettings/BackgroundSettingsWidget.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp b/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp index 2c644772ba..8e96fa8725 100644 --- a/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -139,11 +140,12 @@ void BackgroundSettingsWidget::load_current_settings() void BackgroundSettingsWidget::apply_settings() { - Config::write_string("WindowManager", "Background", "Wallpaper", m_monitor_widget->wallpaper()); + if (GUI::Desktop::the().set_wallpaper(m_monitor_widget->wallpaper())) + Config::write_string("WindowManager", "Background", "Wallpaper", m_monitor_widget->wallpaper()); + else + GUI::MessageBox::show_error(window(), String::formatted("Unable to load file {} as wallpaper", m_monitor_widget->wallpaper())); - GUI::Desktop::the().set_wallpaper(m_monitor_widget->wallpaper()); GUI::Desktop::the().set_background_color(m_color_input->text()); - GUI::Desktop::the().set_wallpaper_mode(m_monitor_widget->wallpaper_mode()); }