1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +00:00

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
parent 5c07aeb78e
commit 27011cf55d
10 changed files with 34 additions and 16 deletions

View file

@ -133,9 +133,12 @@ ErrorOr<void> MainWidget::create_actions()
m_open_action = GUI::CommonActions::make_open_action([this](auto&) {
if (!request_close())
return;
auto response = FileSystemAccessClient::Client::the().open_file(window(), "Open", "/res/fonts"sv, Core::File::OpenMode::Read,
{ { GUI::FileTypeFilter { "Bitmap Font Files", { { "font" } } },
GUI::FileTypeFilter::all_files() } });
FileSystemAccessClient::OpenFileOptions options {
.window_title = "Open"sv,
.path = "/res/fonts"sv,
.allowed_file_types = { { GUI::FileTypeFilter { "Bitmap Font Files", { { "font" } } }, GUI::FileTypeFilter::all_files() } },
};
auto response = FileSystemAccessClient::Client::the().open_file(window(), options);
if (response.is_error())
return;
auto file = response.release_value();