[gtk+/portal] file chooser portal: Use the portal helper



commit f40359b9bfb85b10aafcd249caee299a27d1fb51
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jul 4 20:39:06 2016 -0400

    file chooser portal: Use the portal helper
    
    Use the helper function to determine if we are in a sandbox.

 gtk/gtkfilechoosernativeportal.c |   25 +------------------------
 1 files changed, 1 insertions(+), 24 deletions(-)
---
diff --git a/gtk/gtkfilechoosernativeportal.c b/gtk/gtkfilechoosernativeportal.c
index a42748a..4211cdc 100644
--- a/gtk/gtkfilechoosernativeportal.c
+++ b/gtk/gtkfilechoosernativeportal.c
@@ -288,33 +288,10 @@ gtk_file_chooser_native_portal_show (GtkFileChooserNative *self)
   GtkFileChooserAction action;
   gboolean multiple;
   const char *method_name;
-  const char *use_portal;
-  gchar *path;
 
-  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"))
+  if (!gtk_should_use_portal ())
     return FALSE;
 
-  if (!g_str_equal (use_portal, "1"))
-    {
-      if (gtk_file_chooser_get_extra_widget (GTK_FILE_CHOOSER (self)) != NULL)
-        return FALSE;
-
-      update_preview_signal = g_signal_lookup ("update-preview", GTK_TYPE_FILE_CHOOSER);
-      if (g_signal_has_handler_pending (self, update_preview_signal, 0, TRUE))
-        return FALSE;
-    }
-
   connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
   if (connection == NULL)
     return FALSE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]