[gtk+/portal: 7/14] Use the portal when sandboxed
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/portal: 7/14] Use the portal when sandboxed
- Date: Mon, 4 Jul 2016 04:51:43 +0000 (UTC)
commit b33addebbdc100ebe20fdc4ff813e963b352c8e4
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]