gnome: improve session detection.
authorGiovanni Campagna <gcampagna@src.gnome.org>
Sat, 18 May 2013 21:57:55 +0000 (23:57 +0200)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Mon, 20 May 2013 16:02:56 +0000 (18:02 +0200)
Detect anything beginning with "gnome". Handles gnome-classic,
and custom gnome-jhbuild or similar sessions.

https://bugzilla.gnome.org/show_bug.cgi?id=700607

proxy/gnome/gproxyresolvergnome.c

index 724455f..3a7e82e 100644 (file)
@@ -313,8 +313,14 @@ update_settings (GProxyResolverGnome *resolver)
 static gboolean
 g_proxy_resolver_gnome_is_supported (GProxyResolver *object)
 {
-  return !g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "gnome") ||
-         !g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "ubuntu");
+  const char *session;
+
+  session = g_getenv ("DESKTOP_SESSION");
+  if (session == NULL)
+    return FALSE;
+
+  return g_str_has_prefix (session, "gnome") ||
+         strcmp (session, "ubuntu") == 0;
 }
 
 static inline gchar **