mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:07:46 +00:00
FlappyBug: Add link to help pages in menu
This commit is contained in:
parent
ef30e5832a
commit
570d63b601
2 changed files with 10 additions and 1 deletions
|
@ -10,4 +10,4 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_app(FlappyBug ICON app-flappybug)
|
serenity_app(FlappyBug ICON app-flappybug)
|
||||||
target_link_libraries(FlappyBug LibGUI LibConfig LibMain)
|
target_link_libraries(FlappyBug LibGUI LibConfig LibMain LibDesktop)
|
||||||
|
|
|
@ -5,8 +5,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
#include <AK/URL.h>
|
||||||
#include <LibConfig/Client.h>
|
#include <LibConfig/Client.h>
|
||||||
#include <LibCore/System.h>
|
#include <LibCore/System.h>
|
||||||
|
#include <LibDesktop/Launcher.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/Icon.h>
|
#include <LibGUI/Icon.h>
|
||||||
#include <LibGUI/Menu.h>
|
#include <LibGUI/Menu.h>
|
||||||
|
@ -23,9 +25,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
Config::pledge_domains("FlappyBug");
|
Config::pledge_domains("FlappyBug");
|
||||||
|
|
||||||
|
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_protocol("/usr/share/man/man6/FlappyBug.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));
|
||||||
|
|
||||||
u32 high_score = Config::read_i32("FlappyBug", "Game", "HighScore", 0);
|
u32 high_score = Config::read_i32("FlappyBug", "Game", "HighScore", 0);
|
||||||
|
@ -55,6 +61,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/FlappyBug.md"), "/bin/Help");
|
||||||
|
})));
|
||||||
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Flappy Bug", app_icon, window)));
|
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Flappy Bug", app_icon, window)));
|
||||||
|
|
||||||
window->show();
|
window->show();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue