libgdm: Fix session loading precedence
One feature that GDM is supposed to support is a precedence order for loading xsession files.
If someone has a file in /etc/X11/sessions it's supposed to override a file in /usr/share/xsessions.
This works okay from a backend point of view. /etc/X11/sessions can change the command getting run, for instance, but it doesn't work from a front end point of view. Menu items can't get hidden in the session cog.
This is due to a bug in libgdm where it inadvertently gives /usr/share/xsessions higher precedence than /etc/X11/sessions.
This commit fixes that by processing the lists in reverse order, and making sure to remove already added entries if overriding entries are hidden.