1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:07:46 +00:00

LibCore+Everywhere: Return ErrorOr from ConfigFile::sync()

Currently this method always succeeds, but that won't be true once we
switch to the Core::Stream API. :^)

Some of these places would ideally show an error message to the user,
since failure to save a file is significant, but let's not get
distracted right now.
This commit is contained in:
Sam Atkins 2022-02-06 14:26:33 +00:00 committed by Tim Flynn
parent b90dc408bd
commit cd0ffe5460
10 changed files with 39 additions and 24 deletions

View file

@ -783,26 +783,26 @@ bool Compositor::set_background_color(const String& background_color)
auto& wm = WindowManager::the();
wm.config()->write_entry("Background", "Color", background_color);
bool ret_val = wm.config()->sync();
bool succeeded = !wm.config()->sync().is_error();
if (ret_val)
if (succeeded)
Compositor::invalidate_screen();
return ret_val;
return succeeded;
}
bool Compositor::set_wallpaper_mode(const String& mode)
{
auto& wm = WindowManager::the();
wm.config()->write_entry("Background", "Mode", mode);
bool ret_val = wm.config()->sync();
bool succeeded = !wm.config()->sync().is_error();
if (ret_val) {
if (succeeded) {
m_wallpaper_mode = mode_to_enum(mode);
Compositor::invalidate_screen();
}
return ret_val;
return succeeded;
}
bool Compositor::set_wallpaper(RefPtr<Gfx::Bitmap> bitmap)