[gtk+/wip/alexl/file-chooser-portal] Use the portal when sandboxed
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/alexl/file-chooser-portal] Use the portal when sandboxed
- Date: Tue, 14 Jun 2016 03:44:14 +0000 (UTC)
commit 32457cded3b5b16af7d07eb6d560ef2148b2150f
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jun 13 23:43:12 2016 -0400
Use the portal when sandboxed
flatpak creates a file called /run/user/1000/flatpak-info that we
can use to determine whether we are in a sandbox or not.
gtk/gtkfilechoosernativeportal.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkfilechoosernativeportal.c b/gtk/gtkfilechoosernativeportal.c
index cd875d3..b8e83fc 100644
--- a/gtk/gtkfilechoosernativeportal.c
+++ b/gtk/gtkfilechoosernativeportal.c
@@ -278,10 +278,18 @@ gtk_file_chooser_native_portal_show (GtkFileChooserNative *self)
const char *signal_name;
GDBusSignalCallback signal_callback;
const char *use_portal;
+ gchar *path;
- use_portal = g_getenv ("GTK_USE_PORTAL");
- if (!use_portal)
- use_portal = "";
+ path = g_strdup_printf ("/run/user/%d/flatpak-info", getuid());
+ if (g_file_test (path, G_FILE_TEST_EXISTS))
+ use_portal = "1";
+ else
+ {
+ use_portal = g_getenv ("GTK_USE_PORTAL");
+ if (!use_portal)
+ use_portal = "";
+ }
+ g_free (path);
if (g_str_equal (use_portal, "0"))
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]