summaryrefslogtreecommitdiff
path: root/proxy
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@igalia.com>2018-02-12 18:28:55 -0600
committerMichael Catanzaro <mcatanzaro@igalia.com>2018-02-12 19:27:46 -0600
commit89c45b82b85daef0f1e679dbd15a9c7c893deb17 (patch)
tree785b9b8c896b58f605271af078cd2da5e9d48544 /proxy
parenta1733e8969b464da3a6cd5c323caed509a43b358 (diff)
downloadglib-networking-89c45b82b85daef0f1e679dbd15a9c7c893deb17.tar.gz
proxy: Use XDG_CURRENT_DESKTOP to determine which proxy module to load
This will somewhat reduce the odds that that we'll load libproxy in the gnome-shell greeter process, causing libproxy's old version of mozjs to be loaded into the same process as gjs's newer version, causing the login screen to crash in a spectacular loop of sadness, causing coredumpctl to thrash the system... yeah. This is already fixed in gnome-session by https://git.gnome.org/browse/gnome-session/commit/?id=5f920253dfb2c0f2c4b742690f306cfea2ac6613 but I figure I should do my civic duty here to make it easier to remove these environment variables in the future. https://bugzilla.gnome.org/show_bug.cgi?id=790387
Diffstat (limited to 'proxy')
-rw-r--r--proxy/gnome/gproxyresolvergnome.c16
-rw-r--r--proxy/tests/gnome.c2
2 files changed, 9 insertions, 9 deletions
diff --git a/proxy/gnome/gproxyresolvergnome.c b/proxy/gnome/gproxyresolvergnome.c
index f9dba49..c3b3a7b 100644
--- a/proxy/gnome/gproxyresolvergnome.c
+++ b/proxy/gnome/gproxyresolvergnome.c
@@ -315,17 +315,17 @@ update_settings (GProxyResolverGnome *resolver)
static gboolean
g_proxy_resolver_gnome_is_supported (GProxyResolver *object)
{
- const char *session;
+ const char *desktop;
- if (g_getenv ("GNOME_DESKTOP_SESSION_ID"))
- return TRUE;
-
- session = g_getenv ("DESKTOP_SESSION");
- if (session == NULL)
+ desktop = g_getenv ("XDG_CURRENT_DESKTOP");
+ if (desktop == NULL)
return FALSE;
- return g_str_has_prefix (session, "gnome") ||
- strcmp (session, "ubuntu") == 0;
+ /* Remember that XDG_CURRENT_DESKTOP is a list of strings. Desktops that
+ * pretend to be GNOME, like Unity, add themselves here. That's fine, but
+ * if so they'd better really support our proxy settings.
+ */
+ return strstr (desktop, "GNOME") != NULL;
}
static inline gchar **
diff --git a/proxy/tests/gnome.c b/proxy/tests/gnome.c
index de91aaf..6603db3 100644
--- a/proxy/tests/gnome.c
+++ b/proxy/tests/gnome.c
@@ -163,7 +163,7 @@ main (int argc,
g_setenv ("GIO_EXTRA_MODULES", TOP_BUILDDIR "/proxy/gnome/.libs", TRUE);
g_setenv ("GIO_USE_PROXY_RESOLVER", "gnome", TRUE);
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
- g_setenv ("DESKTOP_SESSION", "gnome", TRUE);
+ g_setenv ("XDG_CURRENT_DESKTOP", "GNOME", TRUE);
g_test_add_vtable ("/proxy/gnome/uri", 0, NULL,
reset_proxy_settings, test_proxy_uri, NULL);