From 26eeaef0a8211fd666fa3eaa6b12c1c5fe56b93f Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 4 Apr 2020 12:18:40 +0200 Subject: LibGUI: Add MenuBar::add_menu(name) This allows us to construct menus in a more natural way: auto& file_menu = menubar->add_menu("File"); file_menu.add_action(...); Instead of the old way: auto file_menu = GUI::Menu::construct(); file_menu->add_action(...); menubar->add_menu(file_menu); --- Applications/Calendar/main.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Applications/Calendar') diff --git a/Applications/Calendar/main.cpp b/Applications/Calendar/main.cpp index d1a2ef7d64..769cb33d53 100644 --- a/Applications/Calendar/main.cpp +++ b/Applications/Calendar/main.cpp @@ -66,12 +66,11 @@ int main(int argc, char** argv) auto menubar = make(); - auto app_menu = GUI::Menu::construct("Calendar"); - app_menu->add_action(GUI::CommonActions::make_quit_action([](auto&) { + auto& app_menu = menubar->add_menu("Calendar"); + app_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) { GUI::Application::the().quit(0); return; })); - menubar->add_menu(move(app_menu)); app.set_menubar(move(menubar)); app.exec(); -- cgit v1.2.3