FileManager: Make PropertiesWindow::make_button() non-fallible

This commit is contained in:
Tim Ledbetter 2023-09-22 23:53:28 +01:00 committed by Andreas Kling
parent b4e134cb52
commit 5df88dab07
Notes: sideshowbarker 2024-07-16 19:42:24 +09:00
2 changed files with 7 additions and 7 deletions

View file

@ -84,17 +84,17 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename)
button_widget.add_spacer();
auto ok_button = TRY(make_button("OK"_string, button_widget));
ok_button->on_click = [this](auto) {
auto& ok_button = make_button("OK"_string, button_widget);
ok_button.on_click = [this](auto) {
if (apply_changes())
close();
};
auto cancel_button = TRY(make_button("Cancel"_string, button_widget));
cancel_button->on_click = [this](auto) {
auto& cancel_button = make_button("Cancel"_string, button_widget);
cancel_button.on_click = [this](auto) {
close();
};
m_apply_button = TRY(make_button("Apply"_string, button_widget));
m_apply_button = make_button("Apply"_string, button_widget);
m_apply_button->on_click = [this](auto) { apply_changes(); };
m_apply_button->set_enabled(false);
@ -592,7 +592,7 @@ ErrorOr<void> PropertiesWindow::setup_permission_checkboxes(GUI::CheckBox& box_r
return {};
}
ErrorOr<NonnullRefPtr<GUI::Button>> PropertiesWindow::make_button(String text, GUI::Widget& parent)
GUI::Button& PropertiesWindow::make_button(String text, GUI::Widget& parent)
{
auto& button = parent.add<GUI::Button>(text);
button.set_fixed_size(70, 22);

View file

@ -79,7 +79,7 @@ private:
return "Unknown"sv;
}
static ErrorOr<NonnullRefPtr<GUI::Button>> make_button(String, GUI::Widget& parent);
static GUI::Button& make_button(String, GUI::Widget& parent);
ErrorOr<void> setup_permission_checkboxes(GUI::CheckBox& box_read, GUI::CheckBox& box_write, GUI::CheckBox& box_execute, PermissionMasks masks, mode_t mode);
void permission_changed(mode_t mask, bool set);
bool apply_changes();