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

LibGUI: Remove Menu::try_add_submenu()

And fall back to the infallible add_submenu().
This commit is contained in:
Andreas Kling 2023-08-14 09:04:41 +02:00
parent 1525fa3b8f
commit eec328e2ab
18 changed files with 94 additions and 104 deletions

View file

@ -362,11 +362,11 @@ bool add_launch_handler_actions_to_menu(RefPtr<GUI::Menu>& menu, DirectoryView c
if (current_file_launch_handlers.size() > 1) {
added_open_menu_items = true;
auto& file_open_with_menu = menu->add_submenu("Open with"_string);
auto file_open_with_menu = menu->add_submenu("Open with"_string);
for (auto& handler : current_file_launch_handlers) {
if (handler == default_file_handler)
continue;
file_open_with_menu.add_action(handler->create_launch_action([&, full_path = move(full_path)](auto& launcher_handler) {
file_open_with_menu->add_action(handler->create_launch_action([&, full_path = move(full_path)](auto& launcher_handler) {
directory_view.launch(URL::create_with_file_scheme(full_path), launcher_handler);
}));
}
@ -1045,7 +1045,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
show_dotfiles_in_view(show_dotfiles);
auto view_menu = TRY(window->try_add_menu("&View"_string));
auto layout_menu = TRY(view_menu->try_add_submenu("&Layout"_string));
auto layout_menu = view_menu->add_submenu("&Layout"_string);
TRY(layout_menu->try_add_action(*layout_toolbar_action));
TRY(layout_menu->try_add_action(*layout_location_action));
TRY(layout_menu->try_add_action(*layout_statusbar_action));