1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:07:44 +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

@ -101,7 +101,12 @@ ErrorOr<void> BackgroundSettingsWidget::create_frame()
auto& button = *find_descendant_of_type_named<GUI::Button>("wallpaper_open_button");
button.on_click = [this](auto) {
auto response = FileSystemAccessClient::Client::the().open_file(window(), "Select Wallpaper"sv, "/res/wallpapers"sv, Core::File::OpenMode::Read, { { GUI::FileTypeFilter::image_files(), GUI::FileTypeFilter::all_files() } });
FileSystemAccessClient::OpenFileOptions options {
.window_title = "Select Wallpaper"sv,
.path = "/res/wallpapers"sv,
.allowed_file_types = { { GUI::FileTypeFilter::image_files(), GUI::FileTypeFilter::all_files() } }
};
auto response = FileSystemAccessClient::Client::the().open_file(window(), options);
if (response.is_error())
return;
m_wallpaper_view->selection().clear();