Commit 108ae05a authored by Matthias Clasen's avatar Matthias Clasen

portal: Allow forcing it off

With GTK_USE_PORTAL=1, try to use the portal even if we if we use
unsupported features. With GTK_USE_PORTAL=0, never use the portal,
as before. What we really want here is to detect the situation
of "sandboxed without full $HOME access" and use the portal in
those cases. If we make the portal smart enough to hand back
direct uris for files that the app can access, we may simplify
the check to just "sandboxed".
parent a2115675
......@@ -277,16 +277,24 @@ gtk_file_chooser_native_portal_show (GtkFileChooserNative *self)
const char *method_name;
const char *signal_name;
GDBusSignalCallback signal_callback;
const char *use_portal;
if (g_getenv ("GTK_USE_PORTAL") == NULL)
return FALSE;
use_portal = g_getenv ("GTK_USE_PORTAL");
if (!use_portal)
use_portal = "";
if (gtk_file_chooser_get_extra_widget (GTK_FILE_CHOOSER (self)) != NULL)
if (g_str_equal (use_portal, "0"))
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;
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment