summaryrefslogtreecommitdiff
path: root/Userland/Games
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-01-06 16:48:37 +0000
committerAndrew Kaster <andrewdkaster@gmail.com>2023-01-06 13:36:02 -0700
commit0c24522635ec7f07e1fb69d9e1cd350d81e2248f (patch)
tree391782374bada7ee7a986674229551c2ec21f75a /Userland/Games
parentd223477bc650e271008ccc339fc1e2c0fcc079e7 (diff)
downloadserenity-0c24522635ec7f07e1fb69d9e1cd350d81e2248f.zip
LibGUI+Everywhere: Use fallible Window::set_main_widget() everywhere :^)
Rip that bandaid off! This does the following, in one big, awkward jump: - Replace all uses of `set_main_widget<Foo>()` with the `try` version. - Remove `set_main_widget<Foo>()`. - Rename the `try` version to just be `set_main_widget` because it's now the only one. The majority of places that call `set_main_widget<Foo>()` are inside constructors, so this unfortunately gives us a big batch of new `release_value_but_fixme_should_propagate_errors()` calls.
Diffstat (limited to 'Userland/Games')
-rw-r--r--Userland/Games/2048/GameSizeDialog.cpp18
-rw-r--r--Userland/Games/2048/main.cpp8
-rw-r--r--Userland/Games/BrickGame/main.cpp2
-rw-r--r--Userland/Games/Chess/PromotionDialog.cpp10
-rw-r--r--Userland/Games/Chess/main.cpp2
-rw-r--r--Userland/Games/ColorLines/main.cpp2
-rw-r--r--Userland/Games/FlappyBug/main.cpp2
-rw-r--r--Userland/Games/Flood/SettingsDialog.cpp12
-rw-r--r--Userland/Games/Flood/main.cpp8
-rw-r--r--Userland/Games/GameOfLife/main.cpp2
-rw-r--r--Userland/Games/Hearts/Game.cpp10
-rw-r--r--Userland/Games/Hearts/SettingsDialog.cpp10
-rw-r--r--Userland/Games/Hearts/main.cpp2
-rw-r--r--Userland/Games/MasterWord/main.cpp2
-rw-r--r--Userland/Games/Minesweeper/CustomGameDialog.cpp14
-rw-r--r--Userland/Games/Minesweeper/main.cpp2
-rw-r--r--Userland/Games/Snake/main.cpp2
-rw-r--r--Userland/Games/Solitaire/main.cpp2
-rw-r--r--Userland/Games/Spider/main.cpp2
19 files changed, 56 insertions, 56 deletions
diff --git a/Userland/Games/2048/GameSizeDialog.cpp b/Userland/Games/2048/GameSizeDialog.cpp
index 20c21b4cef..a2ef18d80b 100644
--- a/Userland/Games/2048/GameSizeDialog.cpp
+++ b/Userland/Games/2048/GameSizeDialog.cpp
@@ -25,16 +25,16 @@ GameSizeDialog::GameSizeDialog(GUI::Window* parent, size_t board_size, size_t ta
set_icon(parent->icon());
set_resizable(false);
- auto& main_widget = set_main_widget<GUI::Widget>();
- if (!main_widget.load_from_gml(game_size_dialog_gml))
+ auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
+ if (!main_widget->load_from_gml(game_size_dialog_gml))
VERIFY_NOT_REACHED();
- auto board_size_spinbox = main_widget.find_descendant_of_type_named<GUI::SpinBox>("board_size_spinbox");
+ auto board_size_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("board_size_spinbox");
board_size_spinbox->set_value(m_board_size);
- auto tile_value_label = main_widget.find_descendant_of_type_named<GUI::Label>("tile_value_label");
+ auto tile_value_label = main_widget->find_descendant_of_type_named<GUI::Label>("tile_value_label");
tile_value_label->set_text(DeprecatedString::number(target_tile()));
- auto target_spinbox = main_widget.find_descendant_of_type_named<GUI::SpinBox>("target_spinbox");
+ auto target_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("target_spinbox");
target_spinbox->set_max(Game::max_power_for_board(m_board_size));
target_spinbox->set_value(m_target_tile_power);
@@ -48,20 +48,20 @@ GameSizeDialog::GameSizeDialog(GUI::Window* parent, size_t board_size, size_t ta
tile_value_label->set_text(DeprecatedString::number(target_tile()));
};
- auto evil_ai_checkbox = main_widget.find_descendant_of_type_named<GUI::CheckBox>("evil_ai_checkbox");
+ auto evil_ai_checkbox = main_widget->find_descendant_of_type_named<GUI::CheckBox>("evil_ai_checkbox");
evil_ai_checkbox->set_checked(m_evil_ai);
evil_ai_checkbox->on_checked = [this](auto checked) { m_evil_ai = checked; };
- auto temporary_checkbox = main_widget.find_descendant_of_type_named<GUI::CheckBox>("temporary_checkbox");
+ auto temporary_checkbox = main_widget->find_descendant_of_type_named<GUI::CheckBox>("temporary_checkbox");
temporary_checkbox->set_checked(m_temporary);
temporary_checkbox->on_checked = [this](auto checked) { m_temporary = checked; };
- auto cancel_button = main_widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
+ auto cancel_button = main_widget->find_descendant_of_type_named<GUI::Button>("cancel_button");
cancel_button->on_click = [this](auto) {
done(ExecResult::Cancel);
};
- auto ok_button = main_widget.find_descendant_of_type_named<GUI::Button>("ok_button");
+ auto ok_button = main_widget->find_descendant_of_type_named<GUI::Button>("ok_button");
ok_button->on_click = [this](auto) {
done(ExecResult::OK);
};
diff --git a/Userland/Games/2048/main.cpp b/Userland/Games/2048/main.cpp
index d92cb70f83..935190bb8c 100644
--- a/Userland/Games/2048/main.cpp
+++ b/Userland/Games/2048/main.cpp
@@ -66,15 +66,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_title("2048");
window->resize(315, 336);
- auto& main_widget = window->set_main_widget<GUI::Widget>();
- if (!main_widget.load_from_gml(game_window_gml))
+ auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
+ if (!main_widget->load_from_gml(game_window_gml))
VERIFY_NOT_REACHED();
Game game { board_size, target_tile, evil_ai };
- auto board_view = TRY(main_widget.find_descendant_of_type_named<GUI::Widget>("board_view_container")->try_add<BoardView>(&game.board()));
+ auto board_view = TRY(main_widget->find_descendant_of_type_named<GUI::Widget>("board_view_container")->try_add<BoardView>(&game.board()));
board_view->set_focus(true);
- auto statusbar = main_widget.find_descendant_of_type_named<GUI::Statusbar>("statusbar");
+ auto statusbar = main_widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar");
app->on_action_enter = [&](GUI::Action& action) {
auto text = action.status_tip();
diff --git a/Userland/Games/BrickGame/main.cpp b/Userland/Games/BrickGame/main.cpp
index 28576493f6..4ca23c4c1e 100644
--- a/Userland/Games/BrickGame/main.cpp
+++ b/Userland/Games/BrickGame/main.cpp
@@ -49,7 +49,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->resize(360, 462);
window->set_resizable(false);
- auto game = TRY(window->try_set_main_widget<BrickGame>(app_name));
+ auto game = TRY(window->set_main_widget<BrickGame>(app_name));
auto game_menu = TRY(window->try_add_menu("&Game"));
diff --git a/Userland/Games/Chess/PromotionDialog.cpp b/Userland/Games/Chess/PromotionDialog.cpp
index f20ab09148..06e742ae24 100644
--- a/Userland/Games/Chess/PromotionDialog.cpp
+++ b/Userland/Games/Chess/PromotionDialog.cpp
@@ -17,13 +17,13 @@ PromotionDialog::PromotionDialog(ChessWidget& chess_widget)
set_icon(chess_widget.window()->icon());
resize(70 * 4, 70);
- auto& main_widget = set_main_widget<GUI::Frame>();
- main_widget.set_frame_shape(Gfx::FrameShape::Container);
- main_widget.set_fill_with_background_color(true);
- main_widget.set_layout<GUI::HorizontalBoxLayout>();
+ auto main_widget = set_main_widget<GUI::Frame>().release_value_but_fixme_should_propagate_errors();
+ main_widget->set_frame_shape(Gfx::FrameShape::Container);
+ main_widget->set_fill_with_background_color(true);
+ main_widget->set_layout<GUI::HorizontalBoxLayout>();
for (auto const& type : { Chess::Type::Queen, Chess::Type::Knight, Chess::Type::Rook, Chess::Type::Bishop }) {
- auto& button = main_widget.add<GUI::Button>("");
+ auto& button = main_widget->add<GUI::Button>("");
button.set_fixed_height(70);
button.set_icon(chess_widget.get_piece_graphic({ chess_widget.board().turn(), type }));
button.on_click = [this, type](auto) {
diff --git a/Userland/Games/Chess/main.cpp b/Userland/Games/Chess/main.cpp
index 5dfa1145fd..8e40931ec3 100644
--- a/Userland/Games/Chess/main.cpp
+++ b/Userland/Games/Chess/main.cpp
@@ -34,7 +34,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-chess"sv));
auto window = TRY(GUI::Window::try_create());
- auto widget = TRY(window->try_set_main_widget<ChessWidget>());
+ auto widget = TRY(window->set_main_widget<ChessWidget>());
TRY(Core::System::unveil("/sys/kernel/processes", "r"));
TRY(Core::System::unveil("/res", "r"));
diff --git a/Userland/Games/ColorLines/main.cpp b/Userland/Games/ColorLines/main.cpp
index 163a39ea21..d73a033065 100644
--- a/Userland/Games/ColorLines/main.cpp
+++ b/Userland/Games/ColorLines/main.cpp
@@ -48,7 +48,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->resize(436, 481);
window->set_resizable(false);
- auto game = TRY(window->try_set_main_widget<ColorLines>(app_name));
+ auto game = TRY(window->set_main_widget<ColorLines>(app_name));
auto game_menu = TRY(window->try_add_menu("&Game"));
diff --git a/Userland/Games/FlappyBug/main.cpp b/Userland/Games/FlappyBug/main.cpp
index 9a1a0c0c84..9f7e720543 100644
--- a/Userland/Games/FlappyBug/main.cpp
+++ b/Userland/Games/FlappyBug/main.cpp
@@ -43,7 +43,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_title("Flappy Bug");
window->set_double_buffering_enabled(false);
window->set_resizable(false);
- auto widget = TRY(window->try_set_main_widget<FlappyBug::Game>(TRY(FlappyBug::Game::Bug::construct()), TRY(FlappyBug::Game::Cloud::construct())));
+ auto widget = TRY(window->set_main_widget<FlappyBug::Game>(TRY(FlappyBug::Game::Bug::construct()), TRY(FlappyBug::Game::Cloud::construct())));
widget->on_game_end = [&](u32 score) {
if (score <= high_score)
diff --git a/Userland/Games/Flood/SettingsDialog.cpp b/Userland/Games/Flood/SettingsDialog.cpp
index 2dcad063c8..873cab5ede 100644
--- a/Userland/Games/Flood/SettingsDialog.cpp
+++ b/Userland/Games/Flood/SettingsDialog.cpp
@@ -27,30 +27,30 @@ SettingsDialog::SettingsDialog(GUI::Window* parent, size_t board_rows, size_t bo
set_icon(parent->icon());
set_resizable(false);
- auto& main_widget = set_main_widget<GUI::Widget>();
- if (!main_widget.load_from_gml(settings_dialog_gml))
+ auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
+ if (!main_widget->load_from_gml(settings_dialog_gml))
VERIFY_NOT_REACHED();
- auto board_rows_spinbox = main_widget.find_descendant_of_type_named<GUI::SpinBox>("board_rows_spinbox");
+ auto board_rows_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("board_rows_spinbox");
board_rows_spinbox->set_value(m_board_rows);
board_rows_spinbox->on_change = [&](auto value) {
m_board_rows = value;
};
- auto board_columns_spinbox = main_widget.find_descendant_of_type_named<GUI::SpinBox>("board_columns_spinbox");
+ auto board_columns_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("board_columns_spinbox");
board_columns_spinbox->set_value(m_board_columns);
board_columns_spinbox->on_change = [&](auto value) {
m_board_columns = value;
};
- auto cancel_button = main_widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
+ auto cancel_button = main_widget->find_descendant_of_type_named<GUI::Button>("cancel_button");
cancel_button->on_click = [this](auto) {
done(ExecResult::Cancel);
};
- auto ok_button = main_widget.find_descendant_of_type_named<GUI::Button>("ok_button");
+ auto ok_button = main_widget->find_descendant_of_type_named<GUI::Button>("ok_button");
ok_button->on_click = [this](auto) {
done(ExecResult::OK);
};
diff --git a/Userland/Games/Flood/main.cpp b/Userland/Games/Flood/main.cpp
index f6a208201b..de902a1414 100644
--- a/Userland/Games/Flood/main.cpp
+++ b/Userland/Games/Flood/main.cpp
@@ -82,16 +82,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_title("Flood");
window->resize(304, 325);
- auto& main_widget = window->set_main_widget<GUI::Widget>();
- if (!main_widget.load_from_gml(flood_window_gml))
+ auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
+ if (!main_widget->load_from_gml(flood_window_gml))
VERIFY_NOT_REACHED();
- auto board_widget = TRY(main_widget.find_descendant_of_type_named<GUI::Widget>("board_widget_container")->try_add<BoardWidget>(board_rows, board_columns));
+ auto board_widget = TRY(main_widget->find_descendant_of_type_named<GUI::Widget>("board_widget_container")->try_add<BoardWidget>(board_rows, board_columns));
board_widget->board()->randomize();
int ai_moves = get_number_of_moves_from_ai(*board_widget->board());
int moves_made = 0;
- auto statusbar = main_widget.find_descendant_of_type_named<GUI::Statusbar>("statusbar");
+ auto statusbar = main_widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar");
app->on_action_enter = [&](GUI::Action& action) {
auto text = action.status_tip();
diff --git a/Userland/Games/GameOfLife/main.cpp b/Userland/Games/GameOfLife/main.cpp
index 5b2428e5c2..2ab0f5c143 100644
--- a/Userland/Games/GameOfLife/main.cpp
+++ b/Userland/Games/GameOfLife/main.cpp
@@ -52,7 +52,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_double_buffering_enabled(false);
window->set_title("Game Of Life");
- auto main_widget = TRY(window->try_set_main_widget<GUI::Widget>());
+ auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->load_from_gml(game_of_life_gml);
main_widget->set_fill_with_background_color(true);
diff --git a/Userland/Games/Hearts/Game.cpp b/Userland/Games/Hearts/Game.cpp
index c62dc48858..4afcdb770f 100644
--- a/Userland/Games/Hearts/Game.cpp
+++ b/Userland/Games/Hearts/Game.cpp
@@ -122,16 +122,16 @@ void Game::show_score_card(bool game_over)
score_dialog->set_resizable(false);
score_dialog->set_icon(window()->icon());
- auto& score_widget = score_dialog->set_main_widget<GUI::Widget>();
- score_widget.set_fill_with_background_color(true);
- auto& layout = score_widget.set_layout<GUI::HorizontalBoxLayout>();
+ auto score_widget = score_dialog->set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
+ score_widget->set_fill_with_background_color(true);
+ auto& layout = score_widget->set_layout<GUI::HorizontalBoxLayout>();
layout.set_margins(10);
layout.set_spacing(15);
- auto& card_container = score_widget.add<GUI::Widget>();
+ auto& card_container = score_widget->add<GUI::Widget>();
auto& score_card = card_container.add<ScoreCard>(m_players, game_over);
- auto& button_container = score_widget.add<GUI::Widget>();
+ auto& button_container = score_widget->add<GUI::Widget>();
button_container.set_shrink_to_fit(true);
button_container.set_layout<GUI::VerticalBoxLayout>();
diff --git a/Userland/Games/Hearts/SettingsDialog.cpp b/Userland/Games/Hearts/SettingsDialog.cpp
index f218d9b337..f96482f0cd 100644
--- a/Userland/Games/Hearts/SettingsDialog.cpp
+++ b/Userland/Games/Hearts/SettingsDialog.cpp
@@ -19,13 +19,13 @@ SettingsDialog::SettingsDialog(GUI::Window* parent, DeprecatedString player_name
set_icon(parent->icon());
set_resizable(false);
- auto& main_widget = set_main_widget<GUI::Widget>();
- main_widget.set_fill_with_background_color(true);
+ auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
+ main_widget->set_fill_with_background_color(true);
- auto& layout = main_widget.set_layout<GUI::VerticalBoxLayout>();
+ auto& layout = main_widget->set_layout<GUI::VerticalBoxLayout>();
layout.set_margins(4);
- auto& name_box = main_widget.add<GUI::Widget>();
+ auto& name_box = main_widget->add<GUI::Widget>();
auto& input_layout = name_box.set_layout<GUI::HorizontalBoxLayout>();
input_layout.set_spacing(4);
@@ -38,7 +38,7 @@ SettingsDialog::SettingsDialog(GUI::Window* parent, DeprecatedString player_name
m_player_name = textbox.text();
};
- auto& button_box = main_widget.add<GUI::Widget>();
+ auto& button_box = main_widget->add<GUI::Widget>();
auto& button_layout = button_box.set_layout<GUI::HorizontalBoxLayout>();
button_layout.set_spacing(10);
diff --git a/Userland/Games/Hearts/main.cpp b/Userland/Games/Hearts/main.cpp
index d954994caa..30617193fe 100644
--- a/Userland/Games/Hearts/main.cpp
+++ b/Userland/Games/Hearts/main.cpp
@@ -50,7 +50,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto window = TRY(GUI::Window::try_create());
window->set_title("Hearts");
- auto widget = TRY(window->try_set_main_widget<GUI::Widget>());
+ auto widget = TRY(window->set_main_widget<GUI::Widget>());
widget->load_from_gml(hearts_gml);
auto& game = *widget->find_descendant_of_type_named<Hearts::Game>("game");
diff --git a/Userland/Games/MasterWord/main.cpp b/Userland/Games/MasterWord/main.cpp
index e377fd437f..4801e06ec6 100644
--- a/Userland/Games/MasterWord/main.cpp
+++ b/Userland/Games/MasterWord/main.cpp
@@ -46,7 +46,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_title("MasterWord");
window->set_resizable(false);
- auto main_widget = TRY(window->try_set_main_widget<GUI::Widget>());
+ auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->load_from_gml(master_word_gml);
auto& game = *main_widget->find_descendant_of_type_named<MasterWord::WordGame>("word_game");
auto& statusbar = *main_widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar");
diff --git a/Userland/Games/Minesweeper/CustomGameDialog.cpp b/Userland/Games/Minesweeper/CustomGameDialog.cpp
index 6020499248..081b7eb3ce 100644
--- a/Userland/Games/Minesweeper/CustomGameDialog.cpp
+++ b/Userland/Games/Minesweeper/CustomGameDialog.cpp
@@ -45,15 +45,15 @@ CustomGameDialog::CustomGameDialog(Window* parent_window)
set_resizable(false);
set_title("Custom game");
- auto& main_widget = set_main_widget<GUI::Widget>();
- if (!main_widget.load_from_gml(minesweeper_custom_game_window_gml))
+ auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
+ if (!main_widget->load_from_gml(minesweeper_custom_game_window_gml))
VERIFY_NOT_REACHED();
- m_columns_spinbox = *main_widget.find_descendant_of_type_named<GUI::SpinBox>("columns_spinbox");
- m_rows_spinbox = *main_widget.find_descendant_of_type_named<GUI::SpinBox>("rows_spinbox");
- m_mines_spinbox = *main_widget.find_descendant_of_type_named<GUI::SpinBox>("mines_spinbox");
- m_ok_button = *main_widget.find_descendant_of_type_named<GUI::Button>("ok_button");
- m_cancel_button = *main_widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
+ m_columns_spinbox = *main_widget->find_descendant_of_type_named<GUI::SpinBox>("columns_spinbox");
+ m_rows_spinbox = *main_widget->find_descendant_of_type_named<GUI::SpinBox>("rows_spinbox");
+ m_mines_spinbox = *main_widget->find_descendant_of_type_named<GUI::SpinBox>("mines_spinbox");
+ m_ok_button = *main_widget->find_descendant_of_type_named<GUI::Button>("ok_button");
+ m_cancel_button = *main_widget->find_descendant_of_type_named<GUI::Button>("cancel_button");
m_columns_spinbox->on_change = [this](auto) {
set_max_mines();
diff --git a/Userland/Games/Minesweeper/main.cpp b/Userland/Games/Minesweeper/main.cpp
index 2215d90882..49e1062f77 100644
--- a/Userland/Games/Minesweeper/main.cpp
+++ b/Userland/Games/Minesweeper/main.cpp
@@ -49,7 +49,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_title("Minesweeper");
window->resize(139, 177);
- auto widget = TRY(window->try_set_main_widget<GUI::Widget>());
+ auto widget = TRY(window->set_main_widget<GUI::Widget>());
widget->load_from_gml(minesweeper_window_gml);
auto& separator = *widget->find_descendant_of_type_named<GUI::HorizontalSeparator>("separator");
diff --git a/Userland/Games/Snake/main.cpp b/Userland/Games/Snake/main.cpp
index ecbdaa08c1..6efd749f8c 100644
--- a/Userland/Games/Snake/main.cpp
+++ b/Userland/Games/Snake/main.cpp
@@ -48,7 +48,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_title("Snake");
window->resize(324, 345);
- auto widget = TRY(window->try_set_main_widget<GUI::Widget>());
+ auto widget = TRY(window->set_main_widget<GUI::Widget>());
TRY(widget->try_load_from_gml(snake_gml));
auto& game = *widget->find_descendant_of_type_named<Snake::Game>("game");
diff --git a/Userland/Games/Solitaire/main.cpp b/Userland/Games/Solitaire/main.cpp
index f2f5e8b0dd..a2800e7809 100644
--- a/Userland/Games/Solitaire/main.cpp
+++ b/Userland/Games/Solitaire/main.cpp
@@ -83,7 +83,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (mode >= Solitaire::Mode::__Count)
update_mode(Solitaire::Mode::SingleCardDraw);
- auto widget = TRY(window->try_set_main_widget<GUI::Widget>());
+ auto widget = TRY(window->set_main_widget<GUI::Widget>());
TRY(widget->try_load_from_gml(solitaire_gml));
auto& game = *widget->find_descendant_of_type_named<Solitaire::Game>("game");
diff --git a/Userland/Games/Spider/main.cpp b/Userland/Games/Spider/main.cpp
index 6bd101e05c..afbfcc20c2 100644
--- a/Userland/Games/Spider/main.cpp
+++ b/Userland/Games/Spider/main.cpp
@@ -117,7 +117,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (statistic_display >= StatisticDisplay::__Count)
update_statistic_display(StatisticDisplay::HighScore);
- auto widget = TRY(window->try_set_main_widget<GUI::Widget>());
+ auto widget = TRY(window->set_main_widget<GUI::Widget>());
TRY(widget->try_load_from_gml(spider_gml));
auto& game = *widget->find_descendant_of_type_named<Spider::Game>("game");