FileManager: Silence the "not found" error when setting no wallpaper

If we're setting the path to "" then we can just set the wallpaper to
nullptr and carry on with our day. :^)
This commit is contained in:
Sam Atkins 2022-12-07 15:37:45 +00:00 committed by Linus Groh
parent f0ab127a41
commit 81fe2ef178
Notes: sideshowbarker 2024-07-17 22:01:16 +09:00

View file

@ -540,6 +540,10 @@ ErrorOr<int> run_in_desktop_mode()
virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override
{
if (domain == "WindowManager" && group == "Background" && key == "Wallpaper") {
if (value.is_empty()) {
GUI::Desktop::the().set_wallpaper(nullptr, {});
return;
}
auto wallpaper_bitmap_or_error = Gfx::Bitmap::try_load_from_file(value);
if (wallpaper_bitmap_or_error.is_error())
dbgln("Failed to load wallpaper bitmap from path: {}", wallpaper_bitmap_or_error.error());