mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-03 17:02:56 +00:00
DisplaySettings: Propagate errors in DesktopSettingsWidget
This commit is contained in:
parent
9c7dfd4fd4
commit
c95ec6092b
Notes:
sideshowbarker
2024-07-16 22:38:54 +09:00
Author: https://github.com/implicitfield
Commit: c95ec6092b
Pull-request: https://github.com/SerenityOS/serenity/pull/17893
2 changed files with 13 additions and 9 deletions
|
@ -15,15 +15,16 @@
|
|||
|
||||
namespace DisplaySettings {
|
||||
|
||||
DesktopSettingsWidget::DesktopSettingsWidget()
|
||||
{
|
||||
create_frame();
|
||||
load_current_settings();
|
||||
ErrorOr<NonnullRefPtr<DesktopSettingsWidget>> DesktopSettingsWidget::try_create() {
|
||||
auto desktop_settings_widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) DesktopSettingsWidget()));
|
||||
TRY(desktop_settings_widget->create_frame());
|
||||
desktop_settings_widget->load_current_settings();
|
||||
return desktop_settings_widget;
|
||||
}
|
||||
|
||||
void DesktopSettingsWidget::create_frame()
|
||||
ErrorOr<void> DesktopSettingsWidget::create_frame()
|
||||
{
|
||||
load_from_gml(desktop_settings_gml).release_value_but_fixme_should_propagate_errors();
|
||||
TRY(load_from_gml(desktop_settings_gml));
|
||||
|
||||
m_workspace_rows_spinbox = *find_descendant_of_type_named<GUI::SpinBox>("workspace_rows_spinbox");
|
||||
m_workspace_rows_spinbox->on_change = [&](auto) {
|
||||
|
@ -36,6 +37,8 @@ void DesktopSettingsWidget::create_frame()
|
|||
|
||||
auto& keyboard_shortcuts_label = *find_descendant_of_type_named<GUI::Label>("keyboard_shortcuts_label");
|
||||
keyboard_shortcuts_label.set_text("\xE2\x84\xB9\tCtrl+Alt+{Shift}+Arrows moves between workspaces");
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void DesktopSettingsWidget::load_current_settings()
|
||||
|
|
|
@ -13,17 +13,18 @@
|
|||
namespace DisplaySettings {
|
||||
|
||||
class DesktopSettingsWidget : public GUI::SettingsWindow::Tab {
|
||||
C_OBJECT(DesktopSettingsWidget);
|
||||
C_OBJECT_ABSTRACT(DesktopSettingsWidget);
|
||||
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<DesktopSettingsWidget>> try_create();
|
||||
virtual ~DesktopSettingsWidget() override = default;
|
||||
|
||||
virtual void apply_settings() override;
|
||||
|
||||
private:
|
||||
DesktopSettingsWidget();
|
||||
DesktopSettingsWidget() = default;
|
||||
|
||||
void create_frame();
|
||||
ErrorOr<void> create_frame();
|
||||
void load_current_settings();
|
||||
|
||||
RefPtr<GUI::SpinBox> m_workspace_rows_spinbox;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue