mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Pong: Add link to help pages in menu
This commit is contained in:
parent
aa231a1580
commit
3a197eea92
Notes:
sideshowbarker
2024-07-17 20:58:24 +09:00
Author: https://github.com/DavidLindbom Commit: https://github.com/SerenityOS/serenity/commit/3a197eea929 Pull-request: https://github.com/SerenityOS/serenity/pull/11772 Reviewed-by: https://github.com/Rummskartoffel Reviewed-by: https://github.com/bgianfo ✅
2 changed files with 10 additions and 1 deletions
|
@ -10,4 +10,4 @@ set(SOURCES
|
|||
)
|
||||
|
||||
serenity_app(Pong ICON app-pong)
|
||||
target_link_libraries(Pong LibGUI LibMain)
|
||||
target_link_libraries(Pong LibGUI LibMain LibDesktop)
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
*/
|
||||
|
||||
#include "Game.h"
|
||||
#include <AK/URL.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibDesktop/Launcher.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
|
@ -20,9 +22,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_protocol("/usr/share/man/man6/Pong.md") }));
|
||||
TRY(Desktop::Launcher::seal_allowlist());
|
||||
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd"));
|
||||
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
TRY(Core::System::unveil("/tmp/portal/launch", "rw"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto window = TRY(GUI::Window::try_create());
|
||||
|
@ -40,6 +46,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
})));
|
||||
|
||||
auto help_menu = TRY(window->try_add_menu("&Help"));
|
||||
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man6/Pong.md"), "/bin/Help");
|
||||
})));
|
||||
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Pong", app_icon, window)));
|
||||
|
||||
window->show();
|
||||
|
|
Loading…
Reference in a new issue