summaryrefslogtreecommitdiff
path: root/Userland/Games
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-01-04 20:41:43 -0500
committerSam Atkins <atkinssj@gmail.com>2023-01-05 13:05:13 +0000
commit8c7f6abf58e792bcaca99680dec350d308eb9b97 (patch)
tree884a6bfe5a26407023eb87746fa80cc0e8064b7a /Userland/Games
parent33fd2c1af9dbecb627a091b34b33bd918fd1c6ab (diff)
downloadserenity-8c7f6abf58e792bcaca99680dec350d308eb9b97.zip
Games: Add a Cards Settings menu item to Hearts, Solitaire, and Spider
Diffstat (limited to 'Userland/Games')
-rw-r--r--Userland/Games/Hearts/main.cpp8
-rw-r--r--Userland/Games/Solitaire/main.cpp6
-rw-r--r--Userland/Games/Spider/main.cpp6
3 files changed, 13 insertions, 7 deletions
diff --git a/Userland/Games/Hearts/main.cpp b/Userland/Games/Hearts/main.cpp
index 0b05ed00cf..d954994caa 100644
--- a/Userland/Games/Hearts/main.cpp
+++ b/Userland/Games/Hearts/main.cpp
@@ -35,15 +35,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Config::pledge_domains({ "Games", "Hearts" });
Config::monitor_domain("Games");
- TRY(Core::System::pledge("stdio recvfd sendfd rpath unix"));
+ TRY(Core::System::pledge("stdio recvfd sendfd rpath unix proc exec"));
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man6/Hearts.md") }));
TRY(Desktop::Launcher::seal_allowlist());
- TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
+ TRY(Core::System::pledge("stdio recvfd sendfd rpath proc exec"));
TRY(Core::System::unveil("/tmp/session/%sid/portal/launch", "rw"));
TRY(Core::System::unveil("/res", "r"));
+ TRY(Core::System::unveil("/bin/GamesSettings", "x"));
TRY(Core::System::unveil(nullptr, nullptr));
auto window = TRY(GUI::Window::try_create());
@@ -93,7 +94,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
game.setup(player_name);
})));
TRY(game_menu->try_add_separator());
- TRY(game_menu->try_add_action(GUI::Action::create("&Settings", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv)), [&](auto&) {
+ TRY(game_menu->try_add_action(TRY(Cards::make_cards_settings_action(window))));
+ TRY(game_menu->try_add_action(GUI::Action::create("Hearts &Settings", TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv)), [&](auto&) {
change_settings();
})));
TRY(game_menu->try_add_separator());
diff --git a/Userland/Games/Solitaire/main.cpp b/Userland/Games/Solitaire/main.cpp
index 8d7e3b1123..8f8617ab3f 100644
--- a/Userland/Games/Solitaire/main.cpp
+++ b/Userland/Games/Solitaire/main.cpp
@@ -27,7 +27,7 @@
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
- TRY(Core::System::pledge("stdio recvfd sendfd rpath unix"));
+ TRY(Core::System::pledge("stdio recvfd sendfd rpath unix proc exec"));
auto app = TRY(GUI::Application::try_create(arguments));
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-solitaire"sv));
@@ -40,9 +40,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Config::pledge_domains({ "Games", "Solitaire" });
Config::monitor_domain("Games");
- TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
+ TRY(Core::System::pledge("stdio recvfd sendfd rpath proc exec"));
TRY(Core::System::unveil("/res", "r"));
+ TRY(Core::System::unveil("/bin/GamesSettings", "x"));
TRY(Core::System::unveil(nullptr, nullptr));
auto window = TRY(GUI::Window::try_create());
@@ -204,6 +205,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
undo_action->set_enabled(false);
TRY(game_menu->try_add_action(undo_action));
TRY(game_menu->try_add_separator());
+ TRY(game_menu->try_add_action(TRY(Cards::make_cards_settings_action(window))));
TRY(game_menu->try_add_action(single_card_draw_action));
TRY(game_menu->try_add_action(three_card_draw_action));
TRY(game_menu->try_add_separator());
diff --git a/Userland/Games/Spider/main.cpp b/Userland/Games/Spider/main.cpp
index 4a1d8d8f14..8c65812ae0 100644
--- a/Userland/Games/Spider/main.cpp
+++ b/Userland/Games/Spider/main.cpp
@@ -40,7 +40,7 @@ static DeprecatedString format_seconds(uint64_t seconds_elapsed)
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
- TRY(Core::System::pledge("stdio recvfd sendfd rpath unix"));
+ TRY(Core::System::pledge("stdio recvfd sendfd rpath unix proc exec"));
auto app = TRY(GUI::Application::try_create(arguments));
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-spider"sv));
@@ -48,9 +48,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Config::pledge_domains({ "Games", "Spider" });
Config::monitor_domain("Games");
- TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
+ TRY(Core::System::pledge("stdio recvfd sendfd rpath proc exec"));
TRY(Core::System::unveil("/res", "r"));
+ TRY(Core::System::unveil("/bin/GamesSettings", "x"));
TRY(Core::System::unveil(nullptr, nullptr));
auto window = TRY(GUI::Window::try_create());
@@ -245,6 +246,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
undo_action->set_enabled(false);
TRY(game_menu->try_add_action(undo_action));
TRY(game_menu->try_add_separator());
+ TRY(game_menu->try_add_action(TRY(Cards::make_cards_settings_action(window))));
TRY(game_menu->try_add_action(single_suit_action));
TRY(game_menu->try_add_action(two_suit_action));
TRY(game_menu->try_add_separator());