Jeremypw/filechooser portal
Experimental full function filechooser portal based on Files widgets rather than Gtk.FileChooserDialog. intended to scope out any problems.
Involves creating more stripped down versions of the main Files widgets in libcore. Ultimately some DRYing can be achieved by basing the main widgets on them but during development they are kept separate hence the very large diff.
Also some changes can be split out and applied independently of this PR.
Reinstituted and extended the previous Portal tester.
Pushing for exposure, but may not merge until after Gtk4 port.
A major limitation is that at the moment we implement the freedesktop filechooser interface fully but `Gtk.FileChooserNative" does not (at least in Gtk3). The Gtk widget does not handle retrieving choices when using the portal. Although it does send the choices through the portal properly it ignores any choice returned.
Mostly working and CI passing but at the cost of losing some styling and actions.
So if the libcore widget Files.FileChooserDialog is used within the Files app itself then the sidebar styling is correct, however if used from another app either through the portal or by depending on libpantheon-files and using the widget explicitly the styling is lost and this warning is given:
(io.elementary.files.portal-tester:46320): Gtk-WARNING **: 17:29:01.111: Theme parsing error: <broken file>:1:0: Failed to import: The resource at "io/elementary/files/SidebarExpander.css" does not exist
Anyone know how to make the gresources compiles by the app from /data/files.gresource.xml available both in the app and in the library? I tried somethings but without success so far.
If I can make the app sidebar derive from the basic sidebar used by the filechooser then presumably the styling only need to be available in the library.
Instead of writing your own portal tester, ASPHD has a comprehensive file chooser portal test page https://flathub.org/en/apps/com.belmoussaoui.ashpd.demo
@danirabbit Thanks, I'll try it. The problem I have at the moment is debugging what is going wrong when the filechooser is running as a portal service - you don't get terminal error messages and can't use gdb afaik. I run my tester as a native app, not using the portal, to make sure that the widgets themselves are working as expected - as well as in a flatpak. That's how I identified the gresource problem. The tester doesn't tell you how to fix it though :disappointed:
Looking at the Granite library (v6.2.0) it doesn't use gresource for its custom styling so perhaps its not possible for libraries in Gtk3? I see granite-7 does complicated stuff with gresources though.
Following @danirabbit's PR moving gresource compilation to the library the portal now has the custom sidebarstyling! I thought I tried something similar but must have messed it up.
Next job is to get some app-settings honored in a portal context. Presumably its not a problem if the app and portal share the same preferences?
Filechooser with Icon view: