Skip to content

Draft: Use Gtk4 Gtk::FileDialogs (native dialogs on all platforms)

Tavmjong Bah requested to merge Tavmjong/inkscape:file-dialogs into master

Replace all instances of Gtk::FileChooserDialog with Gtk::FileDialog.

For most uses, this was straight forward. The one difficult case was for the dialog used by "Save As" and "Save a Copy". In 1.4.x we rely on the Gtk::FileFilter selected to determine which output extension to use. With Gtk::FileDialog which uses native system dialogs, it is not possible to determine which filter has been selected. We can only use the filename extension. But there are several cases where different output extensions use the same filename extension (e.g. Inkscape SVG, plain SVG). This has been handled by creating only one "generic filter" for each possible filename extension. The first output extension found by searching for an extension that uses the selected filename extension is then used for the output (Inkscape SVG in the case of .svg, DXF 12 for .dxf, etc.).

This merge request does the minimum necessary to use Gtk::FileDialog for saving files. In the long term, it would be desirable to create dialogs like the PDF output dialog to configure SVG, DXF, etc. output. It would also be desirable to limit "Save", "Save As", and "Save a Copy" to exporting only Inkscape SVG. The Export dialog is a much better choice for saving all other file formats. With the Export dialog, one can set the parameters for a given file type and reuse those parameters without having a configuration dialog popping up each time a file is saved.

Problems:

  • Using the Export dialog has been enabled for all output file types. This may or may not cause some problems.
  • Gtk::FileDialog pops up a dialog to ask a user if they want to overwrite an existing file. This duplicates our existing check. This will have to be resolved.

Merge request reports

Loading