1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:37:37 +00:00

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.
This commit is contained in:
Sam Atkins 2023-01-06 16:48:37 +00:00 committed by Andrew Kaster
parent d223477bc6
commit 0c24522635
121 changed files with 441 additions and 449 deletions

View file

@ -92,8 +92,8 @@ EmojiInputDialog::EmojiInputDialog(Window* parent_window)
: Dialog(parent_window)
, m_category_action_group(make<ActionGroup>())
{
auto& main_widget = set_main_widget<Frame>();
if (!main_widget.load_from_gml(emoji_input_dialog_gml))
auto main_widget = set_main_widget<Frame>().release_value_but_fixme_should_propagate_errors();
if (!main_widget->load_from_gml(emoji_input_dialog_gml))
VERIFY_NOT_REACHED();
set_window_type(GUI::WindowType::Popup);
@ -101,10 +101,10 @@ EmojiInputDialog::EmojiInputDialog(Window* parent_window)
set_blocks_emoji_input(true);
resize(400, 300);
auto& scrollable_container = *main_widget.find_descendant_of_type_named<GUI::ScrollableContainerWidget>("scrollable_container"sv);
m_search_box = main_widget.find_descendant_of_type_named<GUI::TextBox>("search_box"sv);
m_toolbar = main_widget.find_descendant_of_type_named<GUI::Toolbar>("toolbar"sv);
m_emojis_widget = main_widget.find_descendant_of_type_named<GUI::Widget>("emojis"sv);
auto& scrollable_container = *main_widget->find_descendant_of_type_named<GUI::ScrollableContainerWidget>("scrollable_container"sv);
m_search_box = main_widget->find_descendant_of_type_named<GUI::TextBox>("search_box"sv);
m_toolbar = main_widget->find_descendant_of_type_named<GUI::Toolbar>("toolbar"sv);
m_emojis_widget = main_widget->find_descendant_of_type_named<GUI::Widget>("emojis"sv);
m_emojis = supported_emoji();
m_category_action_group->set_exclusive(true);