summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorimplicitfield <114500360+implicitfield@users.noreply.github.com>2023-02-11 19:05:09 +0200
committerAndreas Kling <kling@serenityos.org>2023-03-21 10:06:41 +0100
commit00be9eb210f7be22676517bcb524aa30b81b0b83 (patch)
tree9402c6dec431b8da18b6466f324b95d64058116b
parent1c20cf7bee4afd69895454afe5633fa5beadf52f (diff)
downloadserenity-00be9eb210f7be22676517bcb524aa30b81b0b83.zip
DisplaySettings: Propagate errors in EffectsSettingsWidget
-rw-r--r--Userland/Applications/DisplaySettings/EffectsSettingsWidget.cpp15
-rw-r--r--Userland/Applications/DisplaySettings/EffectsSettingsWidget.h7
2 files changed, 17 insertions, 5 deletions
diff --git a/Userland/Applications/DisplaySettings/EffectsSettingsWidget.cpp b/Userland/Applications/DisplaySettings/EffectsSettingsWidget.cpp
index f6af7d1710..1c7cfad9ac 100644
--- a/Userland/Applications/DisplaySettings/EffectsSettingsWidget.cpp
+++ b/Userland/Applications/DisplaySettings/EffectsSettingsWidget.cpp
@@ -16,9 +16,16 @@ namespace GUI {
namespace DisplaySettings {
-EffectsSettingsWidget::EffectsSettingsWidget()
+ErrorOr<NonnullRefPtr<EffectsSettingsWidget>> EffectsSettingsWidget::try_create()
{
- load_from_gml(effects_settings_gml).release_value_but_fixme_should_propagate_errors();
+ auto effects_settings_widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) EffectsSettingsWidget()));
+ TRY(effects_settings_widget->setup_interface());
+ return effects_settings_widget;
+}
+
+ErrorOr<void> EffectsSettingsWidget::setup_interface()
+{
+ TRY(load_from_gml(effects_settings_gml));
m_geometry_combobox = find_descendant_of_type_named<ComboBox>("geometry_combobox");
m_geometry_combobox->set_only_allow_values_from_model(true);
@@ -29,7 +36,7 @@ EffectsSettingsWidget::EffectsSettingsWidget()
if (auto result = load_settings(); result.is_error()) {
warnln("Failed to load [Effects] from WindowServer.ini");
- return;
+ return {};
}
auto& animate_menus = *find_descendant_of_type_named<GUI::CheckBox>("animate_menus_checkbox");
@@ -92,6 +99,8 @@ EffectsSettingsWidget::EffectsSettingsWidget()
m_system_effects.effects().at(Effects::TooltipShadow) = checked;
set_modified(true);
};
+
+ return {};
}
ErrorOr<void> EffectsSettingsWidget::load_settings()
diff --git a/Userland/Applications/DisplaySettings/EffectsSettingsWidget.h b/Userland/Applications/DisplaySettings/EffectsSettingsWidget.h
index ef941f3b3f..d68ccaf49c 100644
--- a/Userland/Applications/DisplaySettings/EffectsSettingsWidget.h
+++ b/Userland/Applications/DisplaySettings/EffectsSettingsWidget.h
@@ -14,7 +14,9 @@ namespace GUI {
namespace DisplaySettings {
class EffectsSettingsWidget final : public SettingsWindow::Tab {
- C_OBJECT(EffectsSettingsWidget);
+ C_OBJECT_ABSTRACT(EffectsSettingsWidget);
+
+ static ErrorOr<NonnullRefPtr<EffectsSettingsWidget>> try_create();
public:
virtual ~EffectsSettingsWidget() override = default;
@@ -22,7 +24,8 @@ public:
virtual void apply_settings() override;
private:
- EffectsSettingsWidget();
+ EffectsSettingsWidget() = default;
+ ErrorOr<void> setup_interface();
ErrorOr<void> load_settings();