diff options
author | Cygnix Proto <99915288+CygnixProto@users.noreply.github.com> | 2022-12-06 16:26:13 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-12-14 18:25:28 +0000 |
commit | 806a55eda1d2e76c52fcea2ef11b81f2967b6e74 (patch) | |
tree | 21533574a8c71ac1a5af844319d2a0b1f8a853d3 /Userland/Libraries/LibGUI | |
parent | bdd9bc16ded4c55e5e479b2b2357afc99ce65da8 (diff) | |
download | serenity-806a55eda1d2e76c52fcea2ef11b81f2967b6e74.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r-- | Userland/Libraries/LibGUI/AbstractThemePreview.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/AbstractThemePreview.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibGUI/AbstractThemePreview.cpp b/Userland/Libraries/LibGUI/AbstractThemePreview.cpp index 9ed8de1dd6..1cd8993fef 100644 --- a/Userland/Libraries/LibGUI/AbstractThemePreview.cpp +++ b/Userland/Libraries/LibGUI/AbstractThemePreview.cpp @@ -85,16 +85,16 @@ void AbstractThemePreview::set_theme(Core::AnonymousBuffer const& theme_buffer) set_preview_palette(m_preview_palette); } -void AbstractThemePreview::set_theme_from_file(Core::File& file) +ErrorOr<void> AbstractThemePreview::set_theme_from_file(Core::File& file) { - auto config_file = Core::ConfigFile::open(file.filename(), file.leak_fd()).release_value_but_fixme_should_propagate_errors(); - auto theme = Gfx::load_system_theme(config_file); - VERIFY(theme.is_valid()); + auto config_file = TRY(Core::ConfigFile::open(file.filename(), file.leak_fd())); + auto theme = TRY(Gfx::load_system_theme(config_file)); m_preview_palette = Gfx::Palette(Gfx::PaletteImpl::create_with_anonymous_buffer(theme)); set_preview_palette(m_preview_palette); if (on_theme_load_from_file) on_theme_load_from_file(file.filename()); + return {}; } void AbstractThemePreview::paint_window(StringView title, Gfx::IntRect const& rect, Gfx::WindowTheme::WindowState state, Gfx::Bitmap const& icon, int button_count) diff --git a/Userland/Libraries/LibGUI/AbstractThemePreview.h b/Userland/Libraries/LibGUI/AbstractThemePreview.h index a502a7c2d7..680dcbe541 100644 --- a/Userland/Libraries/LibGUI/AbstractThemePreview.h +++ b/Userland/Libraries/LibGUI/AbstractThemePreview.h @@ -24,7 +24,7 @@ public: Gfx::Palette const& preview_palette() const { return m_preview_palette; } void set_preview_palette(Gfx::Palette const&); - void set_theme_from_file(Core::File&); + ErrorOr<void> set_theme_from_file(Core::File&); void set_theme(Core::AnonymousBuffer const&); void paint_window(StringView title, Gfx::IntRect const& rect, Gfx::WindowTheme::WindowState, Gfx::Bitmap const& icon, int button_count = 3); |