From 5bc6c2035ae3fe109f4e753bde1fb8a961251579 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 2 Oct 2023 15:00:23 +0100 Subject: [PATCH] gio: Rename GTK_USE_PORTAL to GIO_USE_PORTALS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `GTK_USE_PORTAL` environment variable has started to be misused by users, which is causing deployment issues (such as portal services themselves ending up being forced to use portals, which is never going to work). Try and sidestep users’ broken configurations by renaming the environment variable, and also separating it from the old GTK environment variable, since the GLib one affects a lot more processes. This environment variable is meant to be used for debugging and development, and never in production. GTK already renamed their environment variable in https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4829, so keeping the `GTK_USE_PORTAL` name in GLib doesn’t make sense anyway. Signed-off-by: Philip Withnall Fixes: #3107 --- docs/reference/gio/overview.xml | 10 ++++++++++ gio/gportalsupport.c | 2 +- gio/tests/memory-monitor-portal.py.in | 2 +- gio/tests/portal-support-env-var.c | 2 +- gio/tests/power-profile-monitor-portal.py.in | 2 +- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/reference/gio/overview.xml b/docs/reference/gio/overview.xml index b93a17a09..cdcca8763 100644 --- a/docs/reference/gio/overview.xml +++ b/docs/reference/gio/overview.xml @@ -428,6 +428,16 @@ Gvfs is also heavily distributed and relies on a session bus to be present. + + <envar>GIO_USE_PORTALS</envar> + + + This variable can be set to override detection of portals and force them + to be used to provide various bits of GIO functionality, for testing and + debugging. This variable is not intended to be used in production. + + + <envar>GIO_MODULE_DIR</envar> diff --git a/gio/gportalsupport.c b/gio/gportalsupport.c index 7e1da2273..b002e93f6 100644 --- a/gio/gportalsupport.c +++ b/gio/gportalsupport.c @@ -125,7 +125,7 @@ sandbox_info_read (void) { const char *var; - var = g_getenv ("GTK_USE_PORTAL"); + var = g_getenv ("GIO_USE_PORTALS"); if (var && var[0] == '1') use_portal = TRUE; network_available = TRUE; diff --git a/gio/tests/memory-monitor-portal.py.in b/gio/tests/memory-monitor-portal.py.in index 748cee850..7fdf3c750 100755 --- a/gio/tests/memory-monitor-portal.py.in +++ b/gio/tests/memory-monitor-portal.py.in @@ -73,7 +73,7 @@ try: raise # subprocess.Popen(['gdbus', 'monitor', '--session', '--dest', 'org.freedesktop.portal.Desktop']) - os.environ['GTK_USE_PORTAL'] = "1" + os.environ['GIO_USE_PORTALS'] = "1" self.memory_monitor = Gio.MemoryMonitor.dup_default() assert("GMemoryMonitorPortal" in str(self.memory_monitor)) self.memory_monitor.connect("low-memory-warning", self.portal_memory_warning_cb) diff --git a/gio/tests/portal-support-env-var.c b/gio/tests/portal-support-env-var.c index b1d3fd3c3..50982bd8b 100644 --- a/gio/tests/portal-support-env-var.c +++ b/gio/tests/portal-support-env-var.c @@ -37,7 +37,7 @@ main (int argc, char **argv) { g_test_init (&argc, &argv, NULL); - g_setenv ("GTK_USE_PORTAL", "1", TRUE); + g_setenv ("GIO_USE_PORTALS", "1", TRUE); g_test_add_func ("/portal-support/env-var", test_portal_support_env_var); diff --git a/gio/tests/power-profile-monitor-portal.py.in b/gio/tests/power-profile-monitor-portal.py.in index 09e9a450d..d094ada42 100755 --- a/gio/tests/power-profile-monitor-portal.py.in +++ b/gio/tests/power-profile-monitor-portal.py.in @@ -79,7 +79,7 @@ try: raise # subprocess.Popen(['gdbus', 'monitor', '--session', '--dest', 'org.freedesktop.portal.Desktop']) - os.environ['GTK_USE_PORTAL'] = "1" + os.environ['GIO_USE_PORTALS'] = "1" self.power_profile_monitor = Gio.PowerProfileMonitor.dup_default() assert("GPowerProfileMonitorPortal" in str(self.power_profile_monitor)) self.power_profile_monitor.connect("notify::power-saver-enabled", self.power_saver_enabled_cb)