flatpak portal example on github

Winnie Poon winniepoon_home at hotmail.com
Fri Nov 22 20:33:56 UTC 2019


Hi Matthias et al.,

Thanks for all the prompt responses.  I understand what's going on now and it's working the way i want. :)

Thanks again, you guys are awesome!

Regards,
Winnie

________________________________
From: Matthias Clasen <mclasen at redhat.com>
Sent: November 21, 2019 6:18 PM
To: Winnie Poon <winniepoon_home at hotmail.com>
Cc: Jorge García <jgarciao at gmail.com>; Jan Grulich <jgrulich at redhat.com>; Flatpak List <flatpak at lists.freedesktop.org>
Subject: Re: flatpak portal example on github


On Thu, Nov 21, 2019 at 8:48 PM Winnie Poon <winniepoon_home at hotmail.com<mailto:winniepoon_home at hotmail.com>> wrote:
I'm trying to access a file in say /home/user/hello.txt, which is normally not accessible from sandbox without doing (--file-system=/home/user), so i want to access this file via the portal (without the --file-system permission), get the content.

I thought for the portal test example, the file chooser open together with the "Save as ..." button will do that but apparently the "Save as..." only create a new file with a hardcoded "test" content.

e.g. there's a file /home/user/hello.txt
if I open up the --filesystem=/home/user, then i can do g_file_get_contents("/home/user/hello.txt, ...." to see the file, but without the ---filesystem=/home/user, hello.txt cannot be seen.

My understanding is the gtk_file_chooser API will communicate iwth the dbus API to open up permission to hello.txt? but i'm having trouble getting the code to do that.

Sorry i'm a bit confused 🙁


This all seems perfectly correct. Except for "Save As" - if you want to read an existing file, you should use  a file chooser with GTK_FILE_CHOOSER_ACTION_OPEN, not GTK_FILE_CHOOSER_ACTION_SAVE_AS.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/flatpak/attachments/20191122/081644fe/attachment.html>


More information about the Flatpak mailing list