Transition from (GTK) FileChooserDialog to FileChooserNative

Bug #1909807 reported by James Carroll
This bug affects 3 people
Affects Status Importance Assigned to Milestone

Bug Description

GTK3 introduced the GTKFileChooserNative class. This class wraps around GtkFileChooserDialog but allows each platform to use its own toolkit, Windows users get Windows' own file picker, MacOS gets MacOS's own filepicker.

In particular, on Linux systems in heavy containment (E.G, Snap/Flatpak), this class facilitates a way to negotiate file access safely through a sandbox, allowing arbitrary access to any location on the computer in a secure manner and without having to do any extra setup in the ideal cases. It also allows using the KDE file picker on KDE systems through the same mechanism. (XDG desktop portals)

(I did try give this a go myself but I have zero GTK experience and it wasn't as trivial as changing the class names alone)

Revision history for this message
Cameron White (cameronwhite91) wrote :

Thanks for the details, it sounds like we should give this a try in the GTK3 branch.
It looks like certain features that we use (e.g. a custom preview widget) might not be available in the native dialog so we'll have to see what the implications are, but those might be reasonable tradeoffs for the benefit of having the standard dialog on each platform.

tags: added: gtk3
Changed in pinta:
importance: Undecided → Medium
milestone: none → 1.8
status: New → Confirmed
Revision history for this message
Cameron White (cameronwhite91) wrote :

I've merged my changes into the GTK3 branch (
If you're able to do some testing with a snap / flatpak package, that would be great!

The only issue I've noticed so far is that prevents us from detecting the selected file filter and auto-filling the extension when FileChooserNative ends up using the standard GTK dialog on Linux (not sure if this also affects the portal case). This was fixed in GTK 3.24.21, but the Ubuntu LTS is still on 3.24.18 (
I'm going to leave this issue open so that we can check the status of this before the release of our GTK3 branch and decide if a workaround is needed.

Revision history for this message
James Carroll (james-carroll) wrote :

The native dialog works as expected in the Snap build and fixes the sandboxing issue on hosts with proper portal support, I've attached a small video so you can see it in action. I'd reasonably expect the Flatpak to work the same provided the maintainer sets the environment variable too.

Revision history for this message
Cameron White (cameronwhite91) wrote :

Great, thank you for confirming!

Revision history for this message
grofaty (grofaty) wrote :

Cameron, is there anything else that has to be done in this bug report or can we mark it as "Fix Commited"?

Revision history for this message
Cameron White (cameronwhite91) wrote :

There is just the issue I mentioned at the end of comment #2 - before the release we need to remember to check what the GTK version is for most distros, in case we need add a workaround for the bug mentioned.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.