After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 700607 - gnome: improve session detection.
gnome: improve session detection.
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: network
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-05-18 22:00 UTC by Giovanni Campagna
Modified: 2013-05-20 16:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gnome: improve session detection. (1.27 KB, patch)
2013-05-18 22:00 UTC, Giovanni Campagna
none Details | Review
gnome: improve session detection. (1021 bytes, patch)
2013-05-19 17:53 UTC, Giovanni Campagna
needs-work Details | Review
gnome: improve session detection. (1.17 KB, patch)
2013-05-20 15:49 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2013-05-18 22:00:25 UTC
Detect "gnome", or anything beginning with "gnome-". Handles
gnome-classic, and custom gnome-jhbuild or similar sessions.
Comment 1 Giovanni Campagna 2013-05-18 22:00:28 UTC
Created attachment 244683 [details] [review]
gnome: improve session detection.
Comment 2 Matthias Clasen 2013-05-19 04:17:05 UTC
Review of attachment 244683 [details] [review]:

::: proxy/gnome/gproxyresolvergnome.c
@@ +319,3 @@
+
+  return strcmp (session, "gnome") == 0 ||
+         strncmp (session, "gnome-", strlen("gnome-")) == 0;

Missing space between strlen and (.
Alternatively, you could use g_str_has_prefix (session, "gnome-").
You could even be a bit less precise and just 

return g_str_has_prefix (session, "gnome");
Comment 3 Giovanni Campagna 2013-05-19 17:53:19 UTC
Created attachment 244726 [details] [review]
gnome: improve session detection.

Detect anything beginning with "gnome". Handles gnome-classic,
and custom gnome-jhbuild or similar sessions.
Comment 4 Matthias Clasen 2013-05-20 00:25:13 UTC
Review of attachment 244726 [details] [review]:

Looks ok to me (modulo my general unease for this kind of environment checks)
Comment 5 Dan Winship 2013-05-20 12:00:53 UTC
Comment on attachment 244726 [details] [review]
gnome: improve session detection.

This will crash now if DESKTOP_SESSION is unset.

Probably best to just read it once, return FALSE if it's unset, then check against gnome and ubuntu.
Comment 6 Giovanni Campagna 2013-05-20 15:49:33 UTC
Created attachment 244826 [details] [review]
gnome: improve session detection.

Detect anything beginning with "gnome". Handles gnome-classic,
and custom gnome-jhbuild or similar sessions.

How about this one, then?
Comment 7 Dan Winship 2013-05-20 16:00:09 UTC
Comment on attachment 244826 [details] [review]
gnome: improve session detection.

looks good
Comment 8 Giovanni Campagna 2013-05-20 16:03:18 UTC
Attachment 244826 [details] pushed as 1b1e333 - gnome: improve session detection.