diff --git a/Userland/Demos/WidgetGallery/CMakeLists.txt b/Userland/Demos/WidgetGallery/CMakeLists.txt index 71d1e410c8f..3353f9d9654 100644 --- a/Userland/Demos/WidgetGallery/CMakeLists.txt +++ b/Userland/Demos/WidgetGallery/CMakeLists.txt @@ -27,4 +27,4 @@ set(SOURCES ) serenity_app(WidgetGallery ICON app-widget-gallery) -target_link_libraries(WidgetGallery LibGUI LibMain) +target_link_libraries(WidgetGallery LibGUI LibMain LibFileSystemAccessClient) diff --git a/Userland/Demos/WidgetGallery/GalleryWidget.cpp b/Userland/Demos/WidgetGallery/GalleryWidget.cpp index 047f442cc20..b569e90a0b3 100644 --- a/Userland/Demos/WidgetGallery/GalleryWidget.cpp +++ b/Userland/Demos/WidgetGallery/GalleryWidget.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -107,10 +108,10 @@ GalleryWidget::GalleryWidget() m_file_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors()); m_file_button->on_click = [&](auto) { - Optional open_path = GUI::FilePicker::get_open_filepath(window()); - if (!open_path.has_value()) + auto response = FileSystemAccessClient::Client::the().try_open_file(window()); + if (response.is_error()) return; - m_text_editor->set_text(open_path.value()); + m_text_editor->set_text(response.release_value()->filename()); }; m_input_button = basics_tab->find_descendant_of_type_named("input_button"); diff --git a/Userland/Demos/WidgetGallery/main.cpp b/Userland/Demos/WidgetGallery/main.cpp index 9ba23b82a19..7c7681ec86b 100644 --- a/Userland/Demos/WidgetGallery/main.cpp +++ b/Userland/Demos/WidgetGallery/main.cpp @@ -17,9 +17,8 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio recvfd sendfd rpath unix thread")); auto app = TRY(GUI::Application::try_create(arguments, Core::EventLoop::MakeInspectable::Yes)); - TRY(Core::System::pledge("stdio recvfd sendfd rpath thread")); TRY(Core::System::unveil("/res", "r")); - TRY(Core::System::unveil("/home/anon", "r")); + TRY(Core::System::unveil("/tmp/user/%uid/portal/filesystemaccess", "rw")); TRY(Core::System::unveil("/etc/FileIconProvider.ini", "r")); TRY(Core::System::unveil(nullptr, nullptr)); auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-widget-gallery"sv));