flxzt / rnote

Sketch and take handwritten notes.
https://rnote.flxzt.net
GNU General Public License v3.0
6.42k stars 215 forks source link

file dialog filters not working as expected #1114

Open Doublonmousse opened 3 weeks ago

Doublonmousse commented 3 weeks ago

Describe the bug

After #1075, filters still don't work as expected.

On windows, applying the filters make gtk not even use the windows native file picker https://gitlab.gnome.org/GNOME/gtk/-/issues/6717.

On linux, the filter appears but you can still save a file without the file extension. The filename portion is the only part selected so it's harder to achieve but is still possible. image

Expected behavior
Have the filter work in a way that makes it impossible to have a filename saved without any extensions and using the native file picker on all platforms.

Libreoffice works around this by adding themselves the .odt if the extension is not there in the file picker Screenshot 2024-06-08 105938

One issue on the gtk repo talks about this issue as well https://gitlab.gnome.org/GNOME/gtk/-/issues/5367

To have something that uses the native file picker everywhere, no mime type nor custom filters can be used. Now the question is whether using add_pattern over add_mime_type will work

Desktop (please complete the following information):

Doublonmousse commented 3 weeks ago

Edit : with filter.add_pattern only, this seems to work.

This also works with filter.add_pattern and filter.add_suffix. (although the extension is shown twice in that case)

The extension is added automatically on windows with the native file picker and the file filter is shown as well.

I might try to use only patterns or patterns+suffix everywhere and removing all mimetypes, test on Windows (this should work), then on the other twos (linux + mac) to see

flxzt commented 2 weeks ago

Thanks for investigating this so thoroughly and reporting the issue upstream!

Hopefully it will be fixed in Gtk at some point so that it just works as expected on windows as well