Export dialog: Rework, fix for snap package
In the Linux snap package format, we are running in a "sandboxed" environment
without direct access to the host filesystem. Furthermore, we don't see the real
host system paths. If the user selects /home/user/something.svg we only get a
replacement path like /run/user/.../docs/a32d9f/something.svg. If the user edits
the path in the filename entry textbox to e.g. something2.svg, this will not work.
Therefore, make the smallest reasonable changes so that the Export dialog remains as similar to before if used outside snap, and does not confuse the user within snap.
If a sandboxed environment is detected:
- Make the text field for the single file export read-only
- In single- and batch-export, show "translated" paths
so that we don't confuse the user with
/run/user/.... Currently this translation is very simplified, we just remove everything except for the last filename / folder name.
Necessary modifications and bugfixes:
- In the single file export, change "choose file" from an icon inside the textbox to a button. Otherwise this would have been very confusing if the text box is read-only.
- Fix the logic to determine previous export paths. Before, the right path was only shown about half of the time.
- Clarifications regarding UTF8 vs platform-native encoding of file paths
- Refactoring
Before this change, normal installation (not Snap package):
After, normal installation (not Snap package): Note that the choose file and export format box have been rearranged and that there is an extra button to choose the file.
After, in Snap package (simulated with GTK_USE_PORTAL=1 due to other issues):
Note that the filename edit box is read-only and looks almost like a label. (You can still select the text but not edit).
After choosing the file: (confusing "raw path" /run/user/1000/... is not shown):
The batch export looks unchanged, except that when running in Snap it only displays a single directory name (here, implementation) instead of the "raw path":
Improving the batch export UX is out of scope here, I only want to change what is absolutely necessary to avoid confusion when Inkscape is run as Snap package.




