mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:07:35 +00:00
GameOfLife: Add link to help pages in menu
This commit is contained in:
parent
ecdcf4f293
commit
2cb0a35dbe
2 changed files with 10 additions and 1 deletions
|
@ -15,4 +15,4 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_app(GameOfLife ICON app-gameoflife)
|
serenity_app(GameOfLife ICON app-gameoflife)
|
||||||
target_link_libraries(GameOfLife LibGUI LibMain)
|
target_link_libraries(GameOfLife LibGUI LibMain LibDesktop)
|
||||||
|
|
|
@ -6,8 +6,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "BoardWidget.h"
|
#include "BoardWidget.h"
|
||||||
|
#include <AK/URL.h>
|
||||||
#include <Games/GameOfLife/GameOfLifeGML.h>
|
#include <Games/GameOfLife/GameOfLifeGML.h>
|
||||||
#include <LibCore/System.h>
|
#include <LibCore/System.h>
|
||||||
|
#include <LibDesktop/Launcher.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/BoxLayout.h>
|
#include <LibGUI/BoxLayout.h>
|
||||||
#include <LibGUI/Button.h>
|
#include <LibGUI/Button.h>
|
||||||
|
@ -29,9 +31,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
auto app = TRY(GUI::Application::try_create(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/GameOfLife.md") }));
|
||||||
|
TRY(Desktop::Launcher::seal_allowlist());
|
||||||
|
|
||||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd"));
|
TRY(Core::System::pledge("stdio rpath recvfd sendfd"));
|
||||||
|
|
||||||
TRY(Core::System::unveil("/res", "r"));
|
TRY(Core::System::unveil("/res", "r"));
|
||||||
|
TRY(Core::System::unveil("/tmp/portal/launch", "rw"));
|
||||||
TRY(Core::System::unveil(nullptr, nullptr));
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
|
|
||||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-gameoflife"));
|
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-gameoflife"));
|
||||||
|
@ -133,6 +139,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
})));
|
})));
|
||||||
|
|
||||||
auto help_menu = TRY(window->try_add_menu("&Help"));
|
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/GameOfLife.md"), "/bin/Help");
|
||||||
|
})));
|
||||||
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Game Of Life", app_icon, window)));
|
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Game Of Life", app_icon, window)));
|
||||||
|
|
||||||
board_widget->on_running_state_change = [&]() {
|
board_widget->on_running_state_change = [&]() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue