1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 11:47:34 +00:00

Userland: Replace all uses of load_from_gml with try_load_from_gml

MOAR FIXMES! ;^)
This commit is contained in:
Sam Atkins 2023-01-07 12:33:53 +00:00 committed by Linus Groh
parent 703da34947
commit 54b1326165
78 changed files with 94 additions and 111 deletions

View file

@ -119,7 +119,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
editor->on_change = [&] {
preview->remove_all_children();
preview->load_from_gml(editor->text(), [](DeprecatedString const& class_name) -> ErrorOr<NonnullRefPtr<Core::Object>> {
// FIXME: Parsing errors happen while the user is typing. What should we do about them?
(void)preview->try_load_from_gml(editor->text(), [](DeprecatedString const& class_name) -> ErrorOr<NonnullRefPtr<Core::Object>> {
return UnregisteredWidget::try_create(class_name);
});
};

View file

@ -18,7 +18,7 @@ GitCommitDialog::GitCommitDialog(GUI::Window* parent)
set_icon(parent->icon());
auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
widget->load_from_gml(git_commit_dialog_gml);
widget->try_load_from_gml(git_commit_dialog_gml).release_value_but_fixme_should_propagate_errors();
m_message_editor = widget->find_descendant_of_type_named<GUI::TextEditor>("message_editor");
m_cancel_button = widget->find_descendant_of_type_named<GUI::Button>("cancel_button");

View file

@ -50,7 +50,7 @@ NewProjectDialog::NewProjectDialog(GUI::Window* parent)
set_title("New project");
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
main_widget->load_from_gml(new_project_dialog_gml);
main_widget->try_load_from_gml(new_project_dialog_gml).release_value_but_fixme_should_propagate_errors();
m_icon_view_container = *main_widget->find_descendant_of_type_named<GUI::Widget>("icon_view_container");
m_icon_view = m_icon_view_container->add<GUI::IconView>();

View file

@ -27,7 +27,8 @@ void GMLPreviewWidget::load_gml(DeprecatedString const& gml)
return;
}
load_from_gml(gml, [](DeprecatedString const& name) -> ErrorOr<NonnullRefPtr<Core::Object>> {
// FIXME: Parsing errors happen while the user is typing. What should we do about them?
(void)try_load_from_gml(gml, [](DeprecatedString const& name) -> ErrorOr<NonnullRefPtr<Core::Object>> {
return GUI::Label::try_create(DeprecatedString::formatted("{} is not registered as a GML element!", name));
});

View file

@ -61,8 +61,7 @@ static Vector<DeprecatedString> lookup_database_names()
MainWidget::MainWidget()
{
if (!load_from_gml(sql_studio_gml))
VERIFY_NOT_REACHED();
try_load_from_gml(sql_studio_gml).release_value_but_fixme_should_propagate_errors();
m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
open_new_script();