mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:37:46 +00:00
Userland: Prefer non-fallible construction for LibGUI objects
This commit is contained in:
parent
a4a94de942
commit
a6f6a1afd2
54 changed files with 69 additions and 70 deletions
|
@ -38,7 +38,7 @@ namespace GUI {
|
|||
|
||||
ErrorOr<Optional<String>> FilePicker::get_filepath(Badge<FileSystemAccessServer::ConnectionFromClient>, i32 window_server_client_id, i32 parent_window_id, Mode mode, StringView window_title, StringView file_basename, StringView path, Optional<Vector<FileTypeFilter>> allowed_file_types)
|
||||
{
|
||||
auto picker = TRY(FilePicker::try_create(nullptr, mode, file_basename, path, ScreenPosition::DoNotPosition, move(allowed_file_types)));
|
||||
auto picker = FilePicker::construct(nullptr, mode, file_basename, path, ScreenPosition::DoNotPosition, move(allowed_file_types));
|
||||
auto parent_rect = ConnectionToWindowServer::the().get_window_rect_from_client(window_server_client_id, parent_window_id);
|
||||
picker->center_within(parent_rect);
|
||||
picker->constrain_to_desktop();
|
||||
|
|
|
@ -23,7 +23,7 @@ ErrorOr<NonnullRefPtr<LinkLabel>> LinkLabel::try_create(String text)
|
|||
{
|
||||
auto label = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) LinkLabel(move(text))));
|
||||
TRY(label->create_actions());
|
||||
TRY(label->create_menus());
|
||||
label->create_menus();
|
||||
return label;
|
||||
}
|
||||
|
||||
|
@ -47,13 +47,12 @@ ErrorOr<void> LinkLabel::create_actions()
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> LinkLabel::create_menus()
|
||||
void LinkLabel::create_menus()
|
||||
{
|
||||
m_context_menu = TRY(Menu::try_create());
|
||||
m_context_menu = Menu::construct();
|
||||
m_context_menu->add_action(*m_open_action);
|
||||
m_context_menu->add_separator();
|
||||
m_context_menu->add_action(*m_copy_action);
|
||||
return {};
|
||||
}
|
||||
|
||||
void LinkLabel::set_hovered(bool hover)
|
||||
|
|
|
@ -22,7 +22,7 @@ private:
|
|||
explicit LinkLabel(String text = {});
|
||||
|
||||
ErrorOr<void> create_actions();
|
||||
ErrorOr<void> create_menus();
|
||||
void create_menus();
|
||||
|
||||
virtual void mousemove_event(MouseEvent&) override;
|
||||
virtual void mousedown_event(MouseEvent&) override;
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace GUI {
|
|||
|
||||
ErrorOr<NonnullRefPtr<PathBreadcrumbbar>> PathBreadcrumbbar::try_create()
|
||||
{
|
||||
auto location_text_box = TRY(TextBox::try_create());
|
||||
auto breadcrumbbar = TRY(Breadcrumbbar::try_create());
|
||||
auto location_text_box = TextBox::construct();
|
||||
auto breadcrumbbar = Breadcrumbbar::construct();
|
||||
|
||||
auto path_breadcrumbbar = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) PathBreadcrumbbar(*location_text_box, *breadcrumbbar)));
|
||||
path_breadcrumbbar->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
|
|
@ -221,7 +221,7 @@ ErrorOr<void> Toolbar::update_overflow_menu()
|
|||
m_overflow_action->set_enabled(true);
|
||||
m_overflow_button->set_visible(true);
|
||||
|
||||
m_overflow_menu = TRY(Menu::try_create());
|
||||
m_overflow_menu = Menu::construct();
|
||||
m_overflow_button->set_menu(m_overflow_menu);
|
||||
|
||||
for (size_t i = marginal_index.value(); i < m_items.size(); ++i) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue