1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

LibGfx+Userland: Make Gfx::SystemTheme propagate errors

This patch introduces error propagation to Gfx::SystemTheme to remove
instances of release_value_but_fixme_should_propagate_errors().

Userland applications that have been affected by this change have been
updated to utilise this propagation and as a result 4 such instances of
the aforementioned method have been removed.
This commit is contained in:
Cygnix Proto 2022-12-06 16:26:13 +00:00 committed by Linus Groh
parent bdd9bc16de
commit 806a55eda1
15 changed files with 64 additions and 39 deletions

View file

@ -2064,9 +2064,12 @@ void WindowManager::invalidate_after_theme_or_font_change()
bool WindowManager::update_theme(DeprecatedString theme_path, DeprecatedString theme_name, bool keep_desktop_background)
{
auto new_theme = Gfx::load_system_theme(theme_path);
if (!new_theme.is_valid())
auto error_or_new_theme = Gfx::load_system_theme(theme_path);
if (error_or_new_theme.is_error()) {
dbgln("WindowManager: Updating theme failed, error {}", error_or_new_theme.error());
return false;
}
auto new_theme = error_or_new_theme.release_value();
m_theme_overridden = false;
Gfx::set_system_theme(new_theme);
m_palette = Gfx::PaletteImpl::create_with_anonymous_buffer(new_theme);
@ -2101,8 +2104,7 @@ void WindowManager::clear_theme_override()
{
m_theme_overridden = false;
auto previous_theme_name = m_config->read_entry("Theme", "Name");
auto previous_theme = Gfx::load_system_theme(DeprecatedString::formatted("/res/themes/{}.ini", previous_theme_name));
VERIFY(previous_theme.is_valid());
auto previous_theme = MUST(Gfx::load_system_theme(DeprecatedString::formatted("/res/themes/{}.ini", previous_theme_name)));
Gfx::set_system_theme(previous_theme);
m_palette = Gfx::PaletteImpl::create_with_anonymous_buffer(previous_theme);
invalidate_after_theme_or_font_change();