summaryrefslogtreecommitdiff
path: root/Userland/Applications/Spreadsheet/main.cpp
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/Applications/Spreadsheet/main.cpp
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/Applications/Spreadsheet/main.cpp')
-rw-r--r--Userland/Applications/Spreadsheet/main.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Applications/Spreadsheet/main.cpp b/Userland/Applications/Spreadsheet/main.cpp
index 1ded04cc03..106ee79fe8 100644
--- a/Userland/Applications/Spreadsheet/main.cpp
+++ b/Userland/Applications/Spreadsheet/main.cpp
@@ -58,13 +58,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->resize(640, 480);
window->set_icon(app_icon.bitmap_for_size(16));
- auto& spreadsheet_widget = window->set_main_widget<Spreadsheet::SpreadsheetWidget>(*window, NonnullRefPtrVector<Spreadsheet::Sheet> {}, filename == nullptr);
+ auto spreadsheet_widget = TRY(window->set_main_widget<Spreadsheet::SpreadsheetWidget>(*window, NonnullRefPtrVector<Spreadsheet::Sheet> {}, filename == nullptr));
- spreadsheet_widget.initialize_menubar(*window);
- spreadsheet_widget.update_window_title();
+ spreadsheet_widget->initialize_menubar(*window);
+ spreadsheet_widget->update_window_title();
window->on_close_request = [&]() -> GUI::Window::CloseRequestDecision {
- if (spreadsheet_widget.request_close())
+ if (spreadsheet_widget->request_close())
return GUI::Window::CloseRequestDecision::Close;
return GUI::Window::CloseRequestDecision::StayOpen;
};
@@ -73,7 +73,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (filename) {
auto file = TRY(FileSystemAccessClient::Client::the().try_request_file_read_only_approved(window, filename));
- spreadsheet_widget.load_file(file);
+ spreadsheet_widget->load_file(file);
}
return app->exec();