summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorKarol Kosek <krkk@serenityos.org>2021-11-21 21:23:02 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-11-26 11:30:55 -0800
commit20191b58e2e7edc674601da001ca675b58338b73 (patch)
treedf2c0fd45040dbbef51820be79b51be1e286307c /Userland/Applications
parente56ffd11ce76fed4256b2de72940bf100bd17ee9 (diff)
downloadserenity-20191b58e2e7edc674601da001ca675b58338b73.zip
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!
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp8
1 files 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 <LibGUI/FileSystemModel.h>
#include <LibGUI/IconView.h>
#include <LibGUI/ItemListModel.h>
+#include <LibGUI/MessageBox.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Palette.h>
#include <LibGfx/SystemTheme.h>
@@ -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());
}