mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 16:19:23 +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:
parent
bdd9bc16de
commit
806a55eda1
Notes:
sideshowbarker
2024-07-17 10:54:57 +09:00
Author: https://github.com/CygnixProto 🔰
Commit: 806a55eda1
Pull-request: https://github.com/SerenityOS/serenity/pull/16335
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/davidot
Reviewed-by: https://github.com/linusg ✅
15 changed files with 64 additions and 39 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue