LibFSAC+Userland: Pass options for FSAC::open_file() using a struct

It was rather inconvenient having to specify all arguments if you wanted
to modify only the last one.
This commit is contained in:
Karol Kosek 2023-05-28 13:38:15 +02:00 committed by Sam Atkins
commit 27011cf55d
Notes: sideshowbarker 2024-07-17 04:01:41 +09:00
10 changed files with 34 additions and 16 deletions

View file

@ -161,11 +161,14 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
auto open_action = GUI::CommonActions::make_open_action([&](auto&) {
if (request_close() == GUI::Window::CloseRequestDecision::StayOpen)
return;
auto response = FileSystemAccessClient::Client::the().open_file(&window, {}, "/usr/src/serenity/Userland/Applications"sv, Core::File::OpenMode::Read,
Vector {
FileSystemAccessClient::OpenFileOptions options {
.path = "/usr/src/serenity/Userland/Applications"sv,
.allowed_file_types = Vector {
GUI::FileTypeFilter { "GML Files", { { "gml" } } },
GUI::FileTypeFilter::all_files(),
});
}
};
auto response = FileSystemAccessClient::Client::the().open_file(&window, options);
if (response.is_error())
return;