1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:57:44 +00:00

Userland: Prefer non-fallible construction for LibGUI objects

This commit is contained in:
Tim Ledbetter 2023-09-18 06:00:51 +01:00 committed by Andreas Kling
parent a4a94de942
commit a6f6a1afd2
54 changed files with 69 additions and 70 deletions

View file

@ -564,13 +564,13 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
show_pixel_grid_action->set_checked(Config::read_bool("PixelPaint"sv, "PixelGrid"sv, "Show"sv, true));
m_view_menu->add_action(*show_pixel_grid_action);
m_show_rulers_action = TRY(GUI::Action::try_create_checkable(
m_show_rulers_action = GUI::Action::create_checkable(
"Show R&ulers", { Mod_Ctrl, Key_R }, [&](auto& action) {
Config::write_bool("PixelPaint"sv, "Rulers"sv, "Show"sv, action.is_checked());
auto* editor = current_image_editor();
VERIFY(editor);
editor->set_ruler_visibility(action.is_checked());
}));
});
m_show_rulers_action->set_checked(Config::read_bool("PixelPaint"sv, "Rulers"sv, "Show"sv, true));
m_view_menu->add_action(*m_show_rulers_action);