Portal support in GTK / GLib

Hi,

i try to use my Formiko application use in Flatpak. So i found may
documentation how can I do, and what can i use to do application in
best practice way, but:

* I want to create backup files before saving, so writing to
  filesystem without GTK Dialogs.
* I need to open other files like images which are linked with
  Forimiko dokuments - in Webkit.

And this is about complete using own file system wrapper, which is not
implemented in GTK portal support now. So, question is:

* Can I disable portal using in Native widgets, like
  FileChooserNative ? Yes, I know, that at this moment, I could
  use FileChooserDialog, but FileChooserButton use Native
  widget now. And what in the future?
* Is planned to do some wrapper about filesystem, like
  FileIOStream in Gio or something like that?

Thanks a lot

PS: Formiko use GTK3 at this moment.

For backup files, saving them to $XDG_DATA_HOME or $XDG_CACHE_HOME should work.

As for opening files linked with a document, I don’t think it’s possible. See this similar issue for Celluloid: https://github.com/celluloid-player/celluloid/issues/436. You either have to let the user choose the files, or require host filesystem access.

For documentation on how to request filesystem access, see http://docs.flatpak.org/en/latest/sandbox-permissions.html#filesystem-access.

Use $XDG_DATA_HOME or $XDG_CACHE_HOME is bad idea i many ways.

  • user can’t find the file in same directory
  • user could edit file with same file name in more directories
  • there is one place, where files will be only append

But question is, is it possible to disable portal using in Native widgets ?

And this situation means, that portal/sandbox widgets are nice, but half path solution. Some applications must work with other users data, which are linked with original document. And using sandboxes file paths crash they functionality in Flatpak.

True, but you can provide a window in your app to let users view the backup files.

You can use a hash or other ways to generate file names that don’t clash.

Setting --filesystem=host should be what you want. It will give you unlimited access to the entire filesystem (except some blacklisted system directories).