SUMMARY We're trying to add an API close open file pickers in Firefox (I can give more reasoning for that if wanted). However the KDE file picker doesn't react to the `Close` method. We're using `gtk_native_dialog_hide` / `_destroy`, which sends a `Close` method to the portal, see [here](https://gitlab.gnome.org/GNOME/gtk/-/blob/bcab0e4254ace10bb2b3de8d4c10bc25ef3368ce/gtk/gtkfilechoosernativeportal.c#L219-222) for gtk4, and [here](https://gitlab.gnome.org/GNOME/gtk/-/blob/65b0c289b03680b825101b68a5c4b11e99e31b43/gtk/gtkfilechoosernativeportal.c#L187-190) for the gtk3 equivalent. I was filing this as a bug when I noticed that `Close` is not documented [here](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.FileChooser.html), so maybe it should be an enhancement request? I filed https://github.com/flatpak/xdg-desktop-portal/issues/1225 on it not being documented. My _guess_ is that this should be fairly easy to implement, happy to give it a go with some pointers. Thanks :)
Ah, I was pointed out in the GitHub issue that this is, indeed defined in https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Request.html#org-freedesktop-portal-request-close So it is a bug in the KDE portal impl after all.
What version of Plasma are you testing? As far as I can tell this should work since Plasma 5.25 (https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/merge_requests/90)
(In reply to Nicolas Fella from comment #2) > What version of Plasma are you testing? As far as I can tell this should > work since Plasma 5.25 > (https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/merge_requests/90) KDE Plasma Version: 5.27.9 KDE Frameworks Version: 5.112.0 Qt Version: 5.15.11 Kernel Version: 6.6.2-arch1-1 (64-bit) Graphics Platform: Wayland A coworker of mine could repro on Fedora as well, though not sure the exact version.
Created attachment 163443 [details] Example program. Build with: gcc $(pkg-config --cflags --libs gtk+-3.0) hello-world.c -o hello-world Run with: GTK_USE_PORTAL=1 ./hello-world And click the button. ER: KDE file picker appears, then disappears in 3 seconds. AR: File picker stays open.
Created attachment 163445 [details] Gtk4 program that works. Hmm, sorry, this does work. I think it's a gtk3 bug and I must have mistested in GNOME.
Running your example and dbus-monitor I get method call time=1700873953.362815 sender=:1.1276 -> destination=org.freedesktop.portal.Desktop serial=97 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.FileChooser; member=Close object path "/org/freedesktop/portal/desktop/request/1_1276/gtk458574415" method call time=1700873953.362947 sender=:1.1276 -> destination=org.freedesktop.DBus serial=98 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch string "type='signal',interface='ca.desrt.dconf.Writer',path='/ca/desrt/dconf/Writer/user',arg0path='/org/gtk/settings/file-chooser/'" method return time=1700873953.362985 sender=org.freedesktop.DBus -> destination=:1.1276 serial=4294967295 reply_serial=98 error time=1700873953.363167 sender=:1.27 -> destination=:1.1276 error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=97 string "No such method “Close”" so yes, it looks like the app is doing something not right
(In reply to Emilio Cobos Álvarez (:emilio) from comment #5) > Created attachment 163445 [details] > Gtk4 program that works. > > Hmm, sorry, this does work. I think it's a gtk3 bug and I must have > mistested in GNOME. Indeed, that works for me too
Yeah, they seem to be sending the request to the wrong interface. https://gitlab.gnome.org/GNOME/gtk/-/blob/65b0c289b03680b825101b68a5c4b11e99e31b43/gtk/gtkfilechoosernativeportal.c#L189 Should be "org.freedesktop.portal.Request". Will file there. Thanks
(In reply to Nicolas Fella from comment #7) > Indeed, that works for me too Hah, this _seems_ to work, but actually doesn't. But I still think it's not KDE's fault...
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6611
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6613 for GTK4 (which suffered from a slightly different issue)