1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 12:25:06 +00:00

LibGUI: Simplify GCommonActions a bit

Use the same callback signature as GAction so we can just forward it
to GAction instead of chaining callbacks.
This commit is contained in:
Andreas Kling 2019-09-14 22:10:44 +02:00
parent b7bedab28a
commit e83390387c
14 changed files with 45 additions and 65 deletions

View file

@ -118,14 +118,14 @@ TextEditorWidget::TextEditorWidget()
m_new_action = GAction::create("New", { Mod_Ctrl, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/new.png"), [this](const GAction&) {
if (m_document_dirty) {
GMessageBox save_document_first_box("Save Document First?", "Warning", GMessageBox::Type::Warning, GMessageBox::InputType::OKCancel, window());
GMessageBox save_document_first_box("Save Document First?", "Warning", GMessageBox::Type::Warning, GMessageBox::InputType::OKCancel, window());
auto save_document_first_result = save_document_first_box.exec();
if (save_document_first_result != GDialog::ExecResult::ExecOK)
return;
return;
m_save_action->activate();
}
m_document_dirty = false;
m_editor->set_text(StringView());
set_path(FileSystemPath());
@ -184,7 +184,7 @@ TextEditorWidget::TextEditorWidget()
app_menu->add_action(*m_save_action);
app_menu->add_action(*m_save_as_action);
app_menu->add_separator();
app_menu->add_action(GCommonActions::make_quit_action([this] {
app_menu->add_action(GCommonActions::make_quit_action([this](auto&) {
if (!request_close())
return;
GApplication::the().quit(0);