summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Lebl <jirka@5z.com>2003-06-10 00:05:53 +0000
committerGeorge Lebl <jirka@src.gnome.org>2003-06-10 00:05:53 +0000
commit360ab4aedc84c5bb5bd01483740b80748a37d7bc (patch)
treee81271fc039c3f2038eb2ce73c74863e7b780504
parent321b5a36a9dca2940ec25821c6128b8c8664804b (diff)
downloadgdm-360ab4aedc84c5bb5bd01483740b80748a37d7bc.tar.gz
use $HOME/.face by default
Mon Jun 09 17:01:27 2003 George Lebl <jirka@5z.com> * daemon/slave.c, gui/gdmphotosetup.c: use $HOME/.face by default * daemon/slave.c: when no home dir, try /tmp as the home and not / * config/*, daemon/gdm.[ch], gui/gdmlogin.c, gui/greeter/greeter.c, gui/greeter/greeter_action_language.c, gui/greeter/greeter_configuration.h, gui/greeter/greeter_session.[ch]: Rework the session setup as discussed with Oswald Buddenhagen, the kdm maintainer. Now the sessions are .desktop files and we have one happy Xsession file which parses that .desktop file and runs the appropriate command. Also store preferences such as last session and language in .dmrc. The session desktops are now in /etc/X11/dm/Sessions since they can be shared by kdm as well in the future. The setup needs a bit more tuning I think and it's not all tested.
-rw-r--r--ChangeLog18
-rwxr-xr-xconfig/Gnome.in130
-rw-r--r--config/Makefile.am41
-rw-r--r--config/Xclients.desktop.in10
-rwxr-xr-xconfig/Xsession.in133
-rw-r--r--config/gdm.conf.in12
-rw-r--r--config/gnome.desktop.in8
-rw-r--r--config/gnomerc.in13
-rw-r--r--daemon/gdm.c8
-rw-r--r--daemon/gdm.h18
-rw-r--r--daemon/slave.c327
-rw-r--r--gdm.spec.in6
-rw-r--r--gui/gdmlogin.c291
-rw-r--r--gui/gdmphotosetup.c2
-rw-r--r--gui/greeter/greeter.c14
-rw-r--r--gui/greeter/greeter_action_language.c6
-rw-r--r--gui/greeter/greeter_configuration.h4
-rw-r--r--gui/greeter/greeter_session.c242
-rw-r--r--gui/greeter/greeter_session.h3
19 files changed, 608 insertions, 678 deletions
diff --git a/ChangeLog b/ChangeLog
index 77699be1..07f77804 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+Mon Jun 09 17:01:27 2003 George Lebl <jirka@5z.com>
+
+ * daemon/slave.c, gui/gdmphotosetup.c: use $HOME/.face by default
+
+ * daemon/slave.c: when no home dir, try /tmp as the home and not /
+
+ * config/*, daemon/gdm.[ch], gui/gdmlogin.c,
+ gui/greeter/greeter.c, gui/greeter/greeter_action_language.c,
+ gui/greeter/greeter_configuration.h,
+ gui/greeter/greeter_session.[ch]: Rework the session setup as
+ discussed with Oswald Buddenhagen, the kdm maintainer. Now the
+ sessions are .desktop files and we have one happy Xsession file
+ which parses that .desktop file and runs the appropriate command.
+ Also store preferences such as last session and language in .dmrc.
+ The session desktops are now in /etc/X11/dm/Sessions since they can
+ be shared by kdm as well in the future. The setup needs a bit
+ more tuning I think and it's not all tested.
+
Mon Jun 09 Brian Cameron <Brian.Cameron@Sun.COM>
* gui/modules/keymouselistener.c: Fixed bug that caused the
diff --git a/config/Gnome.in b/config/Gnome.in
deleted file mode 100755
index 9e8b3fd6..00000000
--- a/config/Gnome.in
+++ /dev/null
@@ -1,130 +0,0 @@
-#!/bin/sh
-
-#
-# Distributors:
-# You should modify the paths here to fit your distro
-# If you need to do so, send me (jirka@5z.com) a patch
-# and I'll try to make the script detect the distro stuff
-#
-
-userresources=$HOME/.Xresources
-usermodmap=$HOME/.Xmodmap
-userxkbmap=$HOME/.Xkbmap
-
-sysresources=/etc/X11/Xresources
-sysmodmap=/etc/X11/Xmodmap
-sysxkbmap=/etc/X11/Xkbmap
-
-rh6sysresources=/etc/X11/xinit/Xresources
-rh6sysmodmap=/etc/X11/xinit/Xmodmap
-
-if [ -x "$HOME/.gnomerc" ]; then
- command="$HOME/.gnomerc"
-elif [ -x @EXPANDED_SYSCONFDIR@/gdm/gnomerc ]; then
- command="@EXPANDED_SYSCONFDIR@/gdm/gnomerc"
-else
- # as fallback in case the config is screwed
- command=`which gnome-session`
-fi
-
-sshagent=`which ssh-agent`
-if [ -n "$sshagent" ] && [ -x "$sshagent" ] && [ -z "$SSH_AUTH_SOCK" ]; then
- command="$sshagent -- $command"
-fi
-
-# merge in defaults
-if [ -f "$rh6sysresources" ]; then
- xrdb -merge "$rh6sysresources"
-fi
-
-if [ -f "$sysresources" ]; then
- xrdb -merge "$sysresources"
-fi
-
-if [ -f "$userresources" ]; then
- xrdb -merge "$userresources"
-fi
-
-# merge in keymaps
-if [ -f "$sysxkbmap" ]; then
- setxkbmap `cat "$sysxkbmap"`
- XKB_IN_USE=yes
-fi
-
-if [ -f "$userxkbmap" ]; then
- setxkbmap `cat "$userxkbmap"`
- XKB_IN_USE=yes
-fi
-
-#
-# Eeek, this seems like too much magic here
-#
-if [ -z "$XKB_IN_USE" ] && [ ! -L /etc/X11/X ]; then
- if grep '^exec.*/Xsun' /etc/X11/X > /dev/null 2>&1 && [ -f /etc/X11/XF86Config ]; then
- xkbsymbols=`sed -n -e 's/^[ ]*XkbSymbols[ ]*"\(.*\)".*$/\1/p' /etc/X11/XF86Config`
- if [ -n "$xkbsymbols" ]; then
- setxkbmap -symbols "$xkbsymbols"
- XKB_IN_USE=yes
- fi
- fi
-fi
-
-# xkb and xmodmap don't play nice together
-if [ -z "$XKB_IN_USE" ]; then
- if [ -f "$rh6sysmodmap" ]; then
- xmodmap "$rh6sysmodmap"
- fi
-
- if [ -f "$sysmodmap" ]; then
- xmodmap "$sysmodmap"
- fi
-
- if [ -f "$usermodmap" ]; then
- xmodmap "$usermodmap"
- fi
-fi
-
-unset XKB_IN_USE
-
-# Normalize languages, some places/distros screw us up in /etc/profile,
-# so in case the user did select a language
-if [ -n "$GDM_LANG" ]; then
- LANG=$GDM_LANG
- export LANG
-
- if [ -n "$LC_ALL" ]; then
- if [ "$LC_ALL" != "$LANG" ]; then
- LC_ALL=$LANG
- fi
- else
- unset LC_ALL
- fi
-
- if [ -n "$LANGUAGE" ]; then
- if [ "$LANGUAGE" != "$LANG" ]; then
- LANGUAGE=$LANG
- fi
- else
- unset LANGUAGE
- fi
-
- if [ -n "$LINGUAS" ]; then
- if [ "$LINGUAS" != "$LANG" ]; then
- LINGUAS=$LANG
- fi
- else
- unset LINGUAS
- fi
-fi
-
-# run all system xinitrc shell scripts.
-if [ -d /etc/X11/xinit/xinitrc.d ]; then
- for i in /etc/X11/xinit/xinitrc.d/* ; do
- if [ -x "$i" ]; then
- . "$i"
- fi
- done
-fi
-
-exec $command
-
diff --git a/config/Makefile.am b/config/Makefile.am
index a5596a7e..a5504cad 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -1,7 +1,7 @@
pixmapdir = $(datadIR)/pixmaps
confdir = $(sysconfdir)/gdm
localedir = $(sysconfdir)/gdm
-sessdir = $(sysconfdir)/gdm/Sessions
+sessdir = $(sysconfdir)/dm/Sessions
initdir = $(sysconfdir)/gdm/Init
authdir = $(localstatedir)/gdm
gnomercdir = $(sysconfdir)/gdm
@@ -14,15 +14,15 @@ noinst_DATA = gdm.conf
EXTRA_DIST = \
gdm.conf.in \
- Gnome.in \
- gnomerc.in \
+ gnome.desktop.in \
+ Xclients.desktop.in \
Xsession.in \
gdm \
gdm-autologin \
locale.alias \
- Default \
- PostSession \
- PreSession \
+ Default.in \
+ PostSession.in \
+ PreSession.in \
PostLogin \
XKeepsCrashing \
gettextfoo.h \
@@ -31,7 +31,9 @@ EXTRA_DIST = \
gettextfoo.h: XKeepsCrashing
cat $^ | $(srcdir)/extract-shell.sh > gettextfoo.h
-install-data-hook: gdm.conf gnomerc Gnome Xsession
+@INTLTOOL_DESKTOP_RULE@
+
+install-data-hook: gdm.conf Xsession gnome.desktop Xclients.desktop Default PostSession PreSession
if test '!' -d $(DESTDIR)$(confdir); then \
$(mkinstalldirs) $(DESTDIR)$(confdir); \
chmod 755 $(DESTDIR)$(confdir); \
@@ -46,6 +48,7 @@ install-data-hook: gdm.conf gnomerc Gnome Xsession
$(INSTALL_DATA) gdm.conf $(DESTDIR)$(confdir)/factory-gdm.conf
$(INSTALL_SCRIPT) $(srcdir)/XKeepsCrashing $(DESTDIR)$(confdir)/XKeepsCrashing
+ $(INSTALL_SCRIPT) $(srcdir)/Xsession $(DESTDIR)$(confdir)/Xsession
-if test -f $(DESTDIR)$(localedir)/locale.alias; then \
cp -f $(DESTDIR)$(localedir)/locale.alias $(DESTDIR)$(localedir)/locale.alias.orig; \
@@ -57,22 +60,15 @@ install-data-hook: gdm.conf gnomerc Gnome Xsession
chmod 755 $(DESTDIR)$(sessdir); \
fi
- -if test -f $(DESTDIR)$(sessdir)/Xsession; then \
- cp -f $(DESTDIR)$(sessdir)/Xsession $(DESTDIR)$(sessdir)/Xsession.orig; \
- fi
- $(INSTALL_SCRIPT) Xsession $(DESTDIR)$(sessdir)/Xsession
-
- -if test -f $(DESTDIR)$(sessdir)/Gnome; then \
- cp -f $(DESTDIR)$(sessdir)/Gnome $(DESTDIR)$(sessdir)/Gnome.orig; \
+ -if test -f $(DESTDIR)$(sessdir)/Xclients.desktop; then \
+ cp -f $(DESTDIR)$(sessdir)/Xclients.desktop $(DESTDIR)$(sessdir)/Xclients.orig; \
fi
- $(INSTALL_SCRIPT) Gnome $(DESTDIR)$(sessdir)/Gnome
+ $(INSTALL_SCRIPT) Xclients.desktop $(DESTDIR)$(sessdir)/Xclients.desktop
- -if test -f /usr/bin/switchdesk; then \
- if test -f $(DESTDIR)$(sessdir)/Default; then \
- cp -f $(DESTDIR)$(sessdir)/Default $(DESTDIR)$(sessdir)/Default.orig; \
- fi; \
- $(LN_S) -f Xsession $(DESTDIR)$(sessdir)/Default; \
+ -if test -f $(DESTDIR)$(sessdir)/gnome.desktop; then \
+ cp -f $(DESTDIR)$(sessdir)/gnome.desktop $(DESTDIR)$(sessdir)/gnome.orig; \
fi
+ $(INSTALL_SCRIPT) gnome.desktop $(DESTDIR)$(sessdir)/gnome.desktop
if test '!' -d $(DESTDIR)$(initdir); then \
$(mkinstalldirs) $(DESTDIR)$(initdir); \
@@ -112,11 +108,6 @@ install-data-hook: gdm.conf gnomerc Gnome Xsession
chmod 755 $(DESTDIR)$(gnomercdir); \
fi
- -if test -f $(DESTDIR)$(gnomercdir)/gnomerc; then \
- cp -f $(DESTDIR)$(gnomercdir)/gnomerc $(DESTDIR)$(gnomercdir)/gnomerc.orig; \
- fi
- $(INSTALL_SCRIPT) gnomerc $(DESTDIR)$(gnomercdir)/gnomerc
-
if test '!' -d $(DESTDIR)$(authdir); then \
$(mkinstalldirs) $(DESTDIR)$(authdir); \
chown gdm.gdm $(DESTDIR)$(authdir); \
diff --git a/config/Xclients.desktop.in b/config/Xclients.desktop.in
new file mode 100644
index 00000000..f1025759
--- /dev/null
+++ b/config/Xclients.desktop.in
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Encoding=UTF-8
+# The names/descriptions should really be better
+_Name=Standard Xclients
+_Comment=This is the standard Xclients session
+Exec=Xclients
+# The Xclients Exec is a very special one and is handled specially in
+# the Xsession script
+Icon=
+Type=Application
diff --git a/config/Xsession.in b/config/Xsession.in
index dee50102..7ff14d52 100755
--- a/config/Xsession.in
+++ b/config/Xsession.in
@@ -1,14 +1,51 @@
#!/bin/sh
+#
+# Note that this is SORT OF LIKE an X session, but not quite. You get a
+# .desktop file as the first argument. You must here then parse the
+# Exec= line out of this file and use that.
+# As a special case, the Exec line can be:
+# failsafe - Run an xterm only
+# Xclients - Run the appropriate Xclients startup (see the code below)
+#
+# You should also handle an argument of 'failsafe'
+#
+# Note that output is ALREADY redirected to .xsession-errors in GDM. This way
+# .xsession-errors actually gets more output such as if the PreSession script
+# is failing. We wish to be robust don't we?
+#
+# Also note that this is not run as a login shell, this is just executed.
+# This is why we source the profile files below.
+#
+# based on:
# $XConsortium: Xsession /main/10 1995/12/18 18:21:28 gildea $
-case $# in
-1)
- case $1 in
- failsafe)
- exec xterm -geometry 80x24+0+0
- ;;
- esac
-esac
+# First read /etc/profile and .profile
+test -f /etc/profile && . /etc/profile
+test -f $HOME/.profile && . $HOME/.profile
+# Second read /etc/xprofile and .xprofile for X specific setup
+test -f /etc/xprofile && . /etc/xprofile
+test -f $HOME/.xprofile && . $HOME/.xprofile
+
+zenity=`which zenity`
+
+command=
+if [ -z "$1" ] || [ x"$1" = xfailsafe ] ; then
+ command=failsafe
+else
+ # Here we parse the .desktop file
+ command=`grep 'Exec=' "$1" | sed 's/^Exec=//'`
+fi
+
+if [ -z "$command" ] ; then
+ command=failsafe
+fi
+
+if [ x"$command" = xfailsafe ] ; then
+ if [ -n "$zenity" ] ; then
+ $zenity --info --text "This is the failsafe xterm session. Windows now have focus only if you have your cursor above them. To get out of this mode type \"exit\" in the window in the upper left corner"
+ fi
+ exec xterm -geometry 80x24+0+0
+fi
# Note: ~/.xsession-errors is now done in the daemon so that it
# works for ALL sessions (except ones named 'Failsafe')
@@ -18,8 +55,6 @@ if which freetemp 2> /dev/null ; then
freetemp
fi
-startup=$HOME/.xsession
-
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
userxkbmap=$HOME/.Xkbmap
@@ -126,56 +161,30 @@ if [ -d /etc/X11/xinit/xinitrc.d ]; then
done
fi
-# now, we see if xdm/gdm/kdm has asked for a specific environment
-case $# in
-1)
- if [ -x "/usr/share/apps/switchdesk/Xclients.$1" ]; then
- exec /bin/sh "/usr/share/apps/switchdesk/Xclients.$1";
- fi;
-
- case $1 in
- failsafe)
- exec xterm -geometry 80x24+0+0
- ;;
- gnome)
- exec -l $SHELL -c "gnome-session"
- if [ -x "$HOME/.gnomerc" ]; then
- exec $HOME/.gnomerc
- elif [ -x @EXPANDED_SYSCONFDIR@/gdm/gnomerc ]; then
- exec @EXPANDED_SYSCONFDIR@/gdm/gnomerc
- else
- # as fallback in case the config is screwed
- exec gnome-session
- fi
- ;;
- kde|kde1|kde2)
- if [ -x "/usr/share/apps/switchdesk/Xclients.kde" ]; then
- exec "/usr/share/apps/switchdesk/Xclients.kde"
- else
- #fallback for non-redhat
- exec startkde
- fi
- ;;
- twm)
- # fall back to twm
- if [ -x "/usr/share/apps/switchdesk/Xclients.twm" ]; then
- exec "/usr/share/apps/switchdesk/Xclients.twm"
- else
- #fallback for non-redhat
- exec twm
- fi
- ;;
- esac
-esac
-
-if [ -x "$startup" ]; then
- exec "$startup"
-elif [ -x "$HOME/.Xclients" ]; then
- exec "$HOME/.Xclients"
-elif [ -x /etc/X11/xinit/Xclients ]; then
- exec /etc/X11/xinit/Xclients
-elif [ -x /etc/X11/Xclients ]; then
- exec /etc/X11/Xclients
-else
- exec xsm
+if [ "x$command" = "xXclients" ] ; then
+ if [ -x "$HOME/.Xclients" ]; then
+ command="$HOME/.Xclients"
+ elif [ -x /etc/X11/xinit/Xclients ]; then
+ command="/etc/X11/xinit/Xclients"
+ elif [ -x /etc/X11/Xclients ]; then
+ command="/etc/X11/Xclients"
+ else
+ echo "Cannot find Xclients"
+ fi
fi
+
+# add ssh-agent if found
+sshagent=`which ssh-agent`
+if [ -n "$sshagent" ] && [ -x "$sshagent" ] && [ -z "$SSH_AUTH_SOCK" ]; then
+ command="$sshagent -- $command"
+fi
+
+exec $command
+
+echo "Executing: $command failed, will run xterm"
+
+if [ -n "$zenity" ] ; then
+ $zenity --info --text "I could not start your session and so I have started the failsafe xterm session. Windows now have focus only if you have your cursor above them. To get out of this mode type \"exit\" in the window in the upper left corner"
+fi
+
+exec xterm -geometry 80x24+0+0
diff --git a/config/gdm.conf.in b/config/gdm.conf.in
index c11bab5b..d26cedd8 100644
--- a/config/gdm.conf.in
+++ b/config/gdm.conf.in
@@ -33,7 +33,6 @@ AlwaysRestartServer=true
# The gdm configuration program that is run from the login screen, you should
# probably leave this alone
Configurator=@EXPANDED_GDMCONFIGDIR@/gdmsetup --disable-sound --disable-crash-dialog
-GnomeDefaultSession=@EXPANDED_DATADIR@/gnome/default.session
# The chooser program. Must output the chosen host on stdout, probably you
# should leave this alone
Chooser=@EXPANDED_BINDIR@/gdmchooser
@@ -86,7 +85,14 @@ HaltCommand=/usr/bin/poweroff;/sbin/poweroff;/sbin/shutdown -h now;/usr/sbin/shu
SuspendCommand=
# Probably should not touch the below this is the standard setup
ServAuthDir=@EXPANDED_AUTHDIR@
-SessionDir=@EXPANDED_SYSCONFDIR@/gdm/Sessions/
+# This is our standard startup script. A bit different from a normal
+# X session, but it shares a lot of stuff with that. See the provided
+# default for more information.
+BaseXsession=@EXPANDED_SYSCONFDIR@/gdm/Xsession
+# This is a directory where .desktop files describing the sessions live
+SessionDesktopDir=@EXPANDED_SYSCONFDIR@/dm/Sessions/
+# This is the default .desktop session. One of the ones in SessionDesktopDir
+DefaultSession=gnome.desktop
# Better leave this blank and HOME will be used. You can use syntax ~/ below
# to indicate home directory of the user
UserAuthDir=
@@ -257,8 +263,6 @@ BackgroundProgram=
# if this is true then the background program is run always, otherwise
# it is only run when the BackgroundType is 0 (None)
RunBackgroundProgramAlways=false
-# Show the chooser (you can choose a specific saved gnome session) session
-ShowGnomeChooserSession=true
# Show the Failsafe sessions. These are much MUCH nicer (focus for xterm for
# example) and more failsafe then those supplied by scripts so distros should
# use this rather then just running an xterm from a script.
diff --git a/config/gnome.desktop.in b/config/gnome.desktop.in
new file mode 100644
index 00000000..ae27a3a0
--- /dev/null
+++ b/config/gnome.desktop.in
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Encoding=UTF-8
+_Name=GNOME
+_Comment=This session logs you into GNOME
+Exec=gnome-session
+# no icon yet, only the top three are currently used
+Icon=
+Type=Application
diff --git a/config/gnomerc.in b/config/gnomerc.in
deleted file mode 100644
index 87b7a03e..00000000
--- a/config/gnomerc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-# Do we have gnome-volume-control?
-# If so we should run it to load the gnome-volume-control settings
-#if command -v gnome-volume-control > /dev/null 2>&1; then
-# gnome-volume-control -i
-#elif [ -x @EXPANDED_BINDIR@/gnome-volume-control ] ; then
-# @EXPANDED_BINDIR@/gnome-volume-control -i
-#fi
-
-# path takes precedence
-exec gnome-session
-exec @EXPANDED_BINDIR@/gnome-session
diff --git a/daemon/gdm.c b/daemon/gdm.c
index b2af1cca..30e02765 100644
--- a/daemon/gdm.c
+++ b/daemon/gdm.c
@@ -102,8 +102,12 @@ int gdm_in_signal = 0;
gchar *GdmUser = NULL;
gchar *GdmGroup = NULL;
gchar *GdmSessDir = NULL;
+gchar *GdmXsession = NULL;
gchar *GdmLocaleFile = NULL;
+#if 0
+/* FIXME: Maybe just whack this */
gchar *GdmGnomeDefaultSession = NULL;
+#endif
gchar *GdmAutomaticLogin = NULL;
gboolean GdmAutomaticLoginEnable = FALSE;
gboolean GdmAlwaysRestartServer = FALSE;
@@ -270,9 +274,13 @@ gdm_config_parse (void)
GdmRootPath = gnome_config_get_string (GDM_KEY_ROOTPATH);
GdmServAuthDir = gnome_config_get_string (GDM_KEY_SERVAUTH);
GdmSessDir = gnome_config_get_string (GDM_KEY_SESSDIR);
+ GdmXsession = gnome_config_get_string (GDM_KEY_BASEXSESSION);
GdmSuspend = gnome_config_get_string (GDM_KEY_SUSPEND);
GdmLocaleFile = gnome_config_get_string (GDM_KEY_LOCFILE);
+#if 0
+/* FIXME: Maybe just whack this */
GdmGnomeDefaultSession = gnome_config_get_string (GDM_KEY_GNOMEDEFAULTSESSION);
+#endif
GdmUser = gnome_config_get_string (GDM_KEY_USER);
GdmUserAuthDir = gnome_config_get_string (GDM_KEY_UAUTHDIR);
GdmUserAuthFile = gnome_config_get_string (GDM_KEY_UAUTHFILE);
diff --git a/daemon/gdm.h b/daemon/gdm.h
index 328c4a44..c66f31f9 100644
--- a/daemon/gdm.h
+++ b/daemon/gdm.h
@@ -89,9 +89,12 @@ enum {
#define GDM_SLANG 'R'
#define GDM_RESET 'A'
#define GDM_QUIT 'P'
-/* Well these aren't as nice as above, oh well */
+#if 0
+/* FIXME: Maybe just whack this */
#define GDM_GNOMESESS '?'
#define GDM_SGNOMESESS '*'
+#endif
+/* Well these aren't as nice as above, oh well */
#define GDM_STARTTIMER 's'
#define GDM_STOPTIMER 'S'
#define GDM_SETLOGIN 'l' /* this just sets the login to be this, just for
@@ -145,9 +148,14 @@ enum {
#define GDM_KEY_XKEEPSCRASHING "daemon/XKeepsCrashing=" EXPANDED_SYSCONFDIR "/gdm/XKeepsCrashing"
#define GDM_KEY_REBOOT "daemon/RebootCommand=/usr/bin/reboot;/sbin/reboot;/sbin/shutdown -r now;/usr/sbin/shutdown -r now"
#define GDM_KEY_ROOTPATH "daemon/RootPath=/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/local/bin:" EXPANDED_BINDIR
+#if 0
+/* FIXME: Maybe just whack this */
#define GDM_KEY_GNOMEDEFAULTSESSION "daemon/GnomeDefaultSession=" EXPANDED_DATADIR "/gnome/default.session"
+#endif
#define GDM_KEY_SERVAUTH "daemon/ServAuthDir=" EXPANDED_AUTHDIR
-#define GDM_KEY_SESSDIR "daemon/SessionDir=" EXPANDED_SYSCONFDIR "/gdm/Sessions/"
+#define GDM_KEY_SESSDIR "daemon/SessionDesktopDir=" EXPANDED_SYSCONFDIR "/dm/Sessions/"
+#define GDM_KEY_BASEXSESSION "daemon/BaseXsession=" EXPANDED_SYSCONFDIR "/gdm/Xsession"
+#define GDM_KEY_DEFAULTSESSION "daemon/DefaultSession=gnome.desktop"
#define GDM_KEY_SUSPEND "daemon/SuspendCommand="
#define GDM_KEY_UAUTHDIR "daemon/UserAuthDir="
@@ -251,14 +259,20 @@ enum {
#define GDM_KEY_SERVERS "servers"
+#if 0
+/* FIXME: Maybe just whack this */
#define GDM_KEY_SHOW_GNOME_CHOOSER "greeter/ShowGnomeChooserSession=true"
+#endif
#define GDM_KEY_SHOW_GNOME_FAILSAFE "greeter/ShowGnomeFailsafeSession=true"
#define GDM_KEY_SHOW_XTERM_FAILSAFE "greeter/ShowXtermFailsafeSession=true"
#define GDM_KEY_SHOW_LAST_SESSION "greeter/ShowLastSession=true"
#define GDM_SESSION_FAILSAFE_GNOME "GDM_Failsafe.GNOME"
#define GDM_SESSION_FAILSAFE_XTERM "GDM_Failsafe.XTERM"
+#if 0
+/* FIXME: Maybe just whack this */
#define GDM_SESSION_GNOME_CHOOSER "Gnome Chooser"
+#endif
#define GDM_STANDARD "Standard"
diff --git a/daemon/slave.c b/daemon/slave.c
index 9dd0bb8e..7267b5ce 100644
--- a/daemon/slave.c
+++ b/daemon/slave.c
@@ -106,8 +106,13 @@ extern int gdm_normal_runlevel;
extern gchar *GdmUser;
extern uid_t GdmUserId;
extern gid_t GdmGroupId;
+#if 0
+/* FIXME: Maybe just whack this */
extern gchar *GdmGnomeDefaultSession;
+#endif
extern gchar *GdmSessDir;
+extern gchar *GdmXsession;
+extern gchar *GdmDefaultSession;
extern gchar *GdmLocaleFile;
extern gchar *GdmAutomaticLogin;
extern gboolean GdmAllowRemoteAutoLogin;
@@ -1332,7 +1337,25 @@ run_pictures (void)
}
g_free (cfgdir);
- /* Nothing found yet */
+ if (picfile == NULL) {
+ picfile = g_strconcat (pwent->pw_dir, "/.face", NULL);
+ if (access (picfile, R_OK) != 0) {
+ g_free (picfile);
+ picfile = NULL;
+ } else if ( ! gdm_file_check ("run_pictures", pwent->pw_uid,
+ pwent->pw_dir, ".face", TRUE, TRUE, GdmUserMaxFile,
+ GdmRelaxPerms)) {
+ g_free (picfile);
+
+ seteuid (0);
+ setegid (GdmGroupId);
+
+ gdm_slave_greeter_ctl_no_ret (GDM_READPIC, "");
+ continue;
+ }
+ }
+
+ /* Nothing found yet, try the old location */
if (picfile == NULL) {
picfile = g_strconcat (pwent->pw_dir, "/.gnome2/photo", NULL);
picdir = g_strconcat (pwent->pw_dir, "/.gnome2", NULL);
@@ -2025,6 +2048,8 @@ gdm_slave_chooser (void)
}
}
+#if 0
+/* FIXME: Maybe just whack this */
static void
read_sessions (FILE *fp, GString *sessions, const char *def, gboolean *got_def)
{
@@ -2145,6 +2170,7 @@ gdm_get_sessions (struct passwd *pwent)
return ret;
}
}
+#endif
static gboolean
is_session_ok (const char *session_name)
@@ -2160,7 +2186,7 @@ is_session_ok (const char *session_name)
return FALSE;
file = g_strconcat (GdmSessDir, "/", session_name, NULL);
- if (access (file, X_OK) == 0) {
+ if (access (file, F_OK) == 0) {
g_free (file);
return TRUE;
}
@@ -2172,14 +2198,14 @@ static char *
find_a_session (void)
{
char *try[] = {
- "Gnome",
- "gnome",
- "GNOME",
- "Default",
- "default",
- "Xsession",
- "Failsafe",
- "failsafe",
+ "Xclients.desktop",
+ "Gnome.desktop",
+ "gnome.desktop",
+ "GNOME.desktop",
+ "kde.desktop",
+ "KDE.desktop",
+ "failsafe.desktop",
+ "Failsafe.desktop",
NULL
};
int i;
@@ -2194,6 +2220,21 @@ find_a_session (void)
}
static char *
+get_session_exec (const char *desktop)
+{
+ char *file;
+ VeConfig *cfg;
+ char *exec;
+
+ file = g_strconcat (GdmSessDir, "/", desktop, NULL);
+ cfg = ve_config_new (file);
+ g_free (file);
+ exec = ve_config_get_string (cfg, "Desktop Entry/Exec");
+ ve_config_destroy (cfg);
+ return exec;
+}
+
+static char *
find_prog (const char *name, const char *args, char **retpath)
{
char *ret;
@@ -2205,6 +2246,7 @@ find_prog (const char *name, const char *args, char **retpath)
"/opt/X11R6/bin/",
"/usr/bin/",
"/usr/local/bin/",
+ "/opt/gnome/bin/",
EXPANDED_BINDIR "/",
NULL
};
@@ -2230,27 +2272,6 @@ find_prog (const char *name, const char *args, char **retpath)
return NULL;
}
-static char *
-dequote (const char *in)
-{
- GString *str;
- char *out;
- const char *p;
-
- str = g_string_new (NULL);
-
- for (p = in; *p != '\0'; p++) {
- if (*p == '\'')
- g_string_append (str, "'\\''");
- else
- g_string_append_c (str, *p);
- }
-
- out = str->str;
- g_string_free (str, FALSE);
- return out;
-}
-
static void
session_child_run (struct passwd *pwent,
const char *home_dir,
@@ -2262,15 +2283,17 @@ session_child_run (struct passwd *pwent,
gboolean usrcfgok,
gboolean savesess,
gboolean savelang,
- gboolean sessoptok,
gboolean savegnomesess)
{
int logfd;
gboolean failsafe = FALSE;
char *sesspath, *sessexec;
- gboolean need_config_sync = FALSE;
+ char *exec;
const char *shell = NULL;
+ VeConfig *dmrc = NULL;
Display *disp;
+ int argc;
+ char **argv;
gdm_unset_signals ();
@@ -2297,7 +2320,8 @@ session_child_run (struct passwd *pwent,
if (strcmp (session, GDM_SESSION_FAILSAFE_GNOME) == 0 ||
strcmp (session, GDM_SESSION_FAILSAFE_XTERM) == 0 ||
/* hack */
- g_ascii_strcasecmp (session, "Failsafe") == 0) {
+ g_ascii_strcasecmp (session, "Failsafe") == 0 ||
+ g_ascii_strcasecmp (session, "Failsafe.desktop") == 0) {
failsafe = TRUE;
}
@@ -2314,12 +2338,10 @@ session_child_run (struct passwd *pwent,
uid_t old = geteuid ();
uid_t oldg = getegid ();
- /* unlink the filename to be anal (as root to get rid of
- * possible old versions with root ownership) */
- unlink (filename);
-
setegid (pwent->pw_gid);
seteuid (pwent->pw_uid);
+ /* unlink to be anal */
+ unlink (filename);
logfd = open (filename, O_CREAT|O_TRUNC|O_WRONLY, 0644);
seteuid (old);
setegid (oldg);
@@ -2442,27 +2464,38 @@ session_child_run (struct passwd *pwent,
/* anality, make sure nothing is in memory for gnome_config
* to write */
gnome_config_drop_all ();
-
+
if (usrcfgok && savesess && home_dir_ok) {
- gchar *cfgstr = g_strconcat ("=", home_dir,
- "/.gnome2/gdm=/session/last", NULL);
- gnome_config_set_string (cfgstr, save_session);
- need_config_sync = TRUE;
+ gchar *cfgstr = g_strconcat (home_dir, "/.dmrc", NULL);
+ if (dmrc == NULL)
+ dmrc = ve_config_new (cfgstr);
+ ve_config_set_string (dmrc, "Desktop/Session",
+ ve_sure_string (save_session));
g_free (cfgstr);
}
if (usrcfgok && savelang && home_dir_ok) {
- gchar *cfgstr = g_strconcat ("=", home_dir,
- "/.gnome2/gdm=/session/lang", NULL);
- /* we chose the system default language so wipe the lang key */
+ gchar *cfgstr = g_strconcat (home_dir, "/.dmrc", NULL);
+ if (dmrc == NULL)
+ dmrc = ve_config_new (cfgstr);
if (ve_string_empty (language))
- gnome_config_clean_key (cfgstr);
+ /* we chose the system default language so wipe the
+ * lang key */
+ ve_config_delete_key (dmrc, "Desktop/Language");
else
- gnome_config_set_string (cfgstr, language);
- need_config_sync = TRUE;
+ ve_config_set_string (dmrc, "Desktop/Language",
+ language);
g_free (cfgstr);
}
+ if (dmrc != NULL) {
+ ve_config_save (dmrc, FALSE);
+ ve_config_destroy (dmrc);
+ dmrc = NULL;
+ }
+
+#if 0
+ /* Maybe just whack this */
if (sessoptok &&
savegnomesess &&
gnome_session != NULL &&
@@ -2472,11 +2505,7 @@ session_child_run (struct passwd *pwent,
need_config_sync = TRUE;
g_free (cfgstr);
}
-
- if (need_config_sync) {
- gnome_config_sync ();
- gnome_config_drop_all ();
- }
+#endif
closelog ();
@@ -2484,23 +2513,64 @@ session_child_run (struct passwd *pwent,
openlog ("gdm", LOG_PID, LOG_DAEMON);
+#if 0
+/* FIXME: Maybe just whack this */
/* If "Gnome Chooser" is still set as a session,
* just change that to "Gnome", since "Gnome Chooser" is a
* fake */
if (strcmp (session, GDM_SESSION_GNOME_CHOOSER) == 0) {
session = "Gnome";
}
-
+#endif
+
sesspath = NULL;
sessexec = NULL;
+ if (strcmp (session, GDM_SESSION_FAILSAFE_XTERM) != 0 &&
+ strcmp (session, GDM_SESSION_FAILSAFE_GNOME) != 0) {
+ exec = get_session_exec (session);
+ if (exec == NULL) {
+ gdm_error (_("%s: No Exec line in the session file: %s, starting failsafe GNOME"),
+ "gdm_slave_session_start",
+ session);
+ session = GDM_SESSION_FAILSAFE_GNOME;
+ gdm_error_box
+ (d, GTK_MESSAGE_ERROR,
+ _("The session you selected does not look valid. I will run the GNOME failsafe session for you."));
+ }
+ } else {
+ exec = NULL;
+ }
+
+ if (strcmp (session, GDM_SESSION_FAILSAFE_XTERM) != 0 &&
+ strcmp (session, GDM_SESSION_FAILSAFE_GNOME) != 0) {
+ if (access (GdmXsession, X_OK) != 0) {
+ gdm_error (_("%s: Cannot find the base Xsession script, will try GNOME failsafe"),
+ "gdm_slave_session_start");
+ session = GDM_SESSION_FAILSAFE_GNOME;
+ gdm_error_box
+ (d, GTK_MESSAGE_ERROR,
+ _("Cannot find a base session script, will try the GNOME failsafe session for you."));
+ } else {
+ sesspath = g_strdup (GdmXsession);
+ /* This is where everything is OK, and note that
+ we really DON'T care about leaks, we are going to
+ exec in just a bit */
+ sessexec = g_strdup_printf
+ ("%s %s/%s",
+ g_shell_quote (GdmXsession),
+ g_shell_quote (GdmSessDir),
+ g_shell_quote (session));
+ }
+ }
+
if (strcmp (session, GDM_SESSION_FAILSAFE_GNOME) == 0) {
sesspath = find_prog ("gnome-session",
"--failsafe",
&sessexec);
if (sesspath == NULL) {
/* yaikes */
- gdm_error (_("%s: gnome-session not found for a failsafe gnome session, trying xterm"),
+ gdm_error (_("%s: gnome-session not found for a failsafe GNOME session, trying xterm"),
"gdm_slave_session_start");
session = GDM_SESSION_FAILSAFE_XTERM;
gdm_error_box
@@ -2550,23 +2620,6 @@ session_child_run (struct passwd *pwent,
failsafe = TRUE;
}
- /* hack */
- if (strcmp (session, "Failsafe") == 0) {
- failsafe = TRUE;
- }
-
- if (sesspath == NULL) {
- if (GdmSessDir != NULL) {
- sesspath = g_strconcat
- ("'", GdmSessDir, "/",
- dequote (session), "'", NULL);
- sessexec = g_strconcat (GdmSessDir, "/",
- session, NULL);
- } else {
- sesspath = g_strdup ("'/Eeeeek! Eeeeek!'");
- }
- }
-
gdm_debug (_("Running %s for %s on %s"),
sesspath, login, d->name);
@@ -2576,8 +2629,7 @@ session_child_run (struct passwd *pwent,
shell = "/bin/sh";
}
- /* just a stupid test, the below would fail, but this gives a better
- * message */
+ /* just a stupid test */
if (strcmp (shell, "/sbin/nologin") == 0 ||
strcmp (shell, "/bin/false") == 0 ||
strcmp (shell, "/bin/true") == 0) {
@@ -2586,56 +2638,42 @@ session_child_run (struct passwd *pwent,
gdm_error_box (d, GTK_MESSAGE_ERROR,
_("The system administrator has\n"
"disabled your account."));
- } else if (access (sessexec != NULL ? sessexec : sesspath, X_OK) != 0) {
- gdm_error (_("%s: Could not find/run session `%s'"),
- "gdm_slave_session_start", sesspath);
+ /* ends as if nothing bad happened */
+ _exit (0);
+ }
+
+ if ( ! g_shell_parse_argv (sessexec, &argc, &argv, NULL)) {
+ /* will go to .xsession-errors */
+ fprintf (stderr, _("%s: Could not parse `%s'"),
+ "gdm_slave_session_start", sessexec);
+ gdm_error (_("%s: Could not parse `%s'"),
+ "gdm_slave_session_start", sessexec);
/* if we can't read and exec the session, then make a nice
* error dialog */
gdm_error_box
(d, GTK_MESSAGE_ERROR,
- _("Cannot start the session, most likely the\n"
- "session does not exist. Please select from\n"
- "the list of available sessions in the login\n"
- "dialog window."));
- } else {
- char *exec = g_strconcat ("exec ", sesspath, NULL);
- char *shellbase = g_path_get_basename (shell);
- char *dashshell = g_strconcat ("-", shellbase, NULL);
- /* FIXME: this is a hack currently this is all screwed up
- * so I won't run the users shell unless it's one of the
- * "listed" ones, I'll just run bash or sh,
- * that's a bit evil but in the end it works out better in
- * fact. In the future we will do our own login setup
- * stuff */
- if (strcmp (shellbase, "sh") != 0 &&
- strcmp (shellbase, "bash") != 0 &&
- strcmp (shellbase, "tcsh") != 0 &&
- strcmp (shellbase, "ksh") != 0 &&
- strcmp (shellbase, "pdksh") != 0 &&
- strcmp (shellbase, "zsh") != 0 &&
- strcmp (shellbase, "csh") != 0 &&
- strcmp (shellbase, "ash") != 0 &&
- strcmp (shellbase, "bsh") != 0 &&
- strcmp (shellbase, "bash2") != 0) {
- if (access ("/bin/bash", R_OK|X_OK) == 0)
- shell = "/bin/bash";
- else if (access ("/bin/bash2", R_OK|X_OK) == 0)
- shell = "/bin/bash2";
- else
- shell = "/bin/sh";
- }
- execl (shell, dashshell, "-c", exec, NULL);
- /* nutcase fallback */
- execl ("/bin/sh", "-sh", "-c", exec, NULL);
-
- gdm_error (_("%s: Could not start session `%s'"),
- "gdm_slave_session_start", sesspath);
- gdm_error_box
- (d, GTK_MESSAGE_ERROR,
- _("Cannot start your shell. It could be that the\n"
- "system administrator has disabled your login.\n"
- "It could also indicate an error with your account.\n"));
+ /* we can't really be any more specific */
+ _("Cannot start the session due to some "
+ "internal error."));
+ /* ends as if nothing bad happened */
+ _exit (0);
}
+
+ execv (sesspath, argv);
+
+ /* will go to .xsession-errors */
+ fprintf (stderr, _("%s: Could not exec %s with as %s"),
+ "gdm_slave_session_start", sesspath, sessexec);
+ gdm_error (_("%s: Could not exec %s with as %s"),
+ "gdm_slave_session_start", sesspath, sessexec);
+
+ /* if we can't read and exec the session, then make a nice
+ * error dialog */
+ gdm_error_box
+ (d, GTK_MESSAGE_ERROR,
+ /* we can't really be any more specific */
+ _("Cannot start the session due to some "
+ "internal error."));
/* ends as if nothing bad happened */
_exit (0);
@@ -2644,12 +2682,11 @@ session_child_run (struct passwd *pwent,
static void
gdm_slave_session_start (void)
{
- struct stat statbuf;
struct passwd *pwent;
char *save_session = NULL, *session = NULL, *language = NULL, *usrsess, *usrlang;
char *gnome_session = NULL;
gboolean savesess = FALSE, savelang = FALSE, savegnomesess = FALSE;
- gboolean usrcfgok = FALSE, sessoptok = FALSE, authok = FALSE;
+ gboolean usrcfgok = FALSE, authok = FALSE;
const char *home_dir = NULL;
gboolean home_dir_ok = FALSE;
time_t session_start_time, end_time;
@@ -2681,7 +2718,7 @@ gdm_slave_session_start (void)
char *msg = g_strdup_printf (
_("Your home directory is listed as:\n'%s'\n"
"but it does not appear to exist.\n"
- "Do you want to log in with the root\n"
+ "Do you want to log in with the /tmp\n"
"directory as your home directory?\n\n"
"It is unlikely anything will work unless\n"
"you use a failsafe session."),
@@ -2702,7 +2739,7 @@ gdm_slave_session_start (void)
g_free (msg);
home_dir_ok = FALSE;
- home_dir = "/";
+ home_dir = "/tmp";
} else {
home_dir_ok = TRUE;
home_dir = pwent->pw_dir;
@@ -2712,19 +2749,12 @@ gdm_slave_session_start (void)
seteuid (pwent->pw_uid);
if (home_dir_ok) {
- char *cfgdir;
- /* Check if ~user/.gnome2 exists. Create it otherwise. */
- cfgdir = g_strconcat (home_dir, "/.gnome2", NULL);
-
- if (stat (cfgdir, &statbuf) == -1) {
- mkdir (cfgdir, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
- chmod (cfgdir, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
- }
-
- /* Sanity check on ~user/.gnome2/gdm */
+ /* Sanity check on ~user/.dmrc */
usrcfgok = gdm_file_check ("gdm_slave_session_start", pwent->pw_uid,
- cfgdir, "gdm", TRUE, FALSE, GdmUserMaxFile,
- GdmRelaxPerms);
+ home_dir, ".dmrc", TRUE, FALSE,
+ GdmUserMaxFile, GdmRelaxPerms);
+#if 0
+ /* FIXME: Maybe just whack this */
/* Sanity check on ~user/.gnome2/session-options */
sessoptok = gdm_file_check ("gdm_slave_session_start", pwent->pw_uid,
cfgdir, "session-options", TRUE, FALSE, GdmUserMaxFile,
@@ -2734,26 +2764,24 @@ gdm_slave_session_start (void)
* nothing we can do about it. So we relax
* the permission checking in this case */
GdmRelaxPerms == 0 ? 1 : GdmRelaxPerms);
- g_free (cfgdir);
+#endif
} else {
usrcfgok = FALSE;
- sessoptok = FALSE;
}
if (usrcfgok) {
- gchar *cfgstr;
+ gchar *cfgfile = g_strconcat (home_dir, "/.dmrc", NULL);
+ VeConfig *cfg = ve_config_new (cfgfile);
+ g_free (cfgfile);
- cfgstr = g_strconcat ("=", home_dir, "/.gnome2/gdm=/session/last", NULL);
- usrsess = gnome_config_get_string (cfgstr);
+ usrsess = ve_config_get_string (cfg, "Desktop/Session");
if (usrsess == NULL)
usrsess = g_strdup ("");
- g_free (cfgstr);
-
- cfgstr = g_strconcat ("=", home_dir, "/.gnome2/gdm=/session/lang", NULL);
- usrlang = gnome_config_get_string (cfgstr);
+ usrlang = ve_config_get_string (cfg, "Desktop/Language");
if (usrlang == NULL)
usrlang = g_strdup ("");
- g_free (cfgstr);
+
+ ve_config_destroy (cfg);
} else {
usrsess = g_strdup ("");
usrlang = g_strdup ("");
@@ -2801,6 +2829,8 @@ gdm_slave_session_start (void)
savelang = TRUE;
g_free (ret);
+#if 0
+/* FIXME: Maybe just whack this */
if (strcmp (session, GDM_SESSION_GNOME_CHOOSER) == 0) {
char *sessions = gdm_get_sessions (pwent);
ret = gdm_slave_greeter_ctl (GDM_GNOMESESS, sessions);
@@ -2820,6 +2850,7 @@ gdm_slave_session_start (void)
}
g_free (ret);
}
+#endif
gdm_debug ("gdm_slave_session_start: Authentication completed. Whacking greeter");
@@ -2868,7 +2899,8 @@ gdm_slave_session_start (void)
if (strcmp (session, GDM_SESSION_FAILSAFE_GNOME) == 0 ||
strcmp (session, GDM_SESSION_FAILSAFE_XTERM) == 0 ||
- g_ascii_strcasecmp (session, "Failsafe") == 0 /* hack */)
+ g_ascii_strcasecmp (session, "Failsafe") == 0 /* hack */ ||
+ g_ascii_strcasecmp (session, "Failsafe.desktop") == 0 /* hack */)
failsafe = TRUE;
/* Write out the Xservers file */
@@ -2902,7 +2934,6 @@ gdm_slave_session_start (void)
usrcfgok,
savesess,
savelang,
- sessoptok,
savegnomesess);
g_assert_not_reached ();
diff --git a/gdm.spec.in b/gdm.spec.in
index fcccddf1..4081ac6c 100644
--- a/gdm.spec.in
+++ b/gdm.spec.in
@@ -108,7 +108,8 @@ exit 0
%{_sbindir}/*
%{_libexecdir}/*
%config %{sysconfdir}/pam.d/*
-%config %{sysconfdir}/X11/*
+%config %{sysconfdir}/X11/dm/Sessions/*
+%config %{sysconfdir}/X11/gdm
%config %{sysconfdir}/security/console.apps/*
%{_datadir}/pixmaps/*
%{_datadir}/gdm
@@ -136,6 +137,9 @@ exit 0
%changelog
+* Mon Jun 9 2003 George Lebl <jirka@5z.com>
+- Updated for the new session setup
+
* Mon May 5 2003 George Lebl <jirka@5z.com>
- Updated the lang stuff, and the file lists
diff --git a/gui/gdmlogin.c b/gui/gdmlogin.c
index 7c2d2cc5..7efa5431 100644
--- a/gui/gdmlogin.c
+++ b/gui/gdmlogin.c
@@ -65,20 +65,6 @@ struct _GdmLoginUser {
GdkPixbuf *picture;
};
-/* Some strings that are in other files that we may want to
- * translate. This is not actually used anywhere, it's just
- * to have gettext know about these strings. */
-const char *session_titles[] = {
- N_("AnotherLevel"),
- N_("Default"),
- N_("Failsafe"),
- N_("Gnome"),
- N_("KDE"),
- N_("XSession"),
- N_("Gnome Chooser"),
- N_("Last")
-};
-
#define LAST_SESSION "Last"
#define LAST_LANGUAGE "Last"
#define DEFAULT_LANGUAGE "Default"
@@ -125,6 +111,7 @@ enum {
static gchar *GdmGtkRC;
static gchar *GdmIcon;
static gchar *GdmSessionDir;
+static gchar *GdmDefaultSession;
static gchar *GdmLocaleFile;
static gchar *GdmExclude;
static int GdmMinimalUID;
@@ -140,7 +127,11 @@ static gint GdmPositionX;
static gint GdmPositionY;
static gboolean GdmTitleBar;
+#if 0
+/* FIXME: maybe just whack this */
static gboolean GdmShowGnomeChooserSession;
+#endif
+
static gboolean GdmShowGnomeFailsafeSession;
static gboolean GdmShowXtermFailsafeSession;
static gboolean GdmShowLastSession;
@@ -162,11 +153,15 @@ static GtkWidget *msg;
static GtkWidget *err_box;
static guint err_box_clear_handler = 0;
static gboolean require_quarter = FALSE;
+#if 0
+/* FIXME: Maybe whack this */
static gboolean remember_gnome_session = FALSE;
+#endif
static GtkWidget *icon_win = NULL;
static GtkWidget *sessmenu;
static GtkWidget *langmenu;
static GtkTooltips *tooltips;
+static GHashTable *sessnames;
static gboolean login_is_local = FALSE;
static gboolean used_defaults = FALSE;
@@ -881,6 +876,7 @@ gdm_login_parse_config (void)
GdmTitleBar = ve_config_get_bool (config, GDM_KEY_TITLE_BAR);
GdmLocaleFile = ve_config_get_string (config, GDM_KEY_LOCFILE);
GdmSessionDir = ve_config_get_string (config, GDM_KEY_SESSDIR);
+ GdmDefaultSession = ve_config_get_string (config, GDM_KEY_DEFAULTSESSION);
GdmWelcome = ve_config_get_translated_string (config, greeter_Welcome_key);
/* A hack! */
if (strcmp (ve_sure_string (GdmWelcome), "Welcome") == 0) {
@@ -914,7 +910,10 @@ gdm_login_parse_config (void)
GdmShowXtermFailsafeSession = ve_config_get_bool (config, GDM_KEY_SHOW_XTERM_FAILSAFE);
GdmShowGnomeFailsafeSession = ve_config_get_bool (config, GDM_KEY_SHOW_GNOME_FAILSAFE);
+#if 0
+ /* FIXME: Maybe just whack this */
GdmShowGnomeChooserSession = ve_config_get_bool (config, GDM_KEY_SHOW_GNOME_CHOOSER);
+#endif
GdmShowLastSession = ve_config_get_bool (config, GDM_KEY_SHOW_LAST_SESSION);
GdmTimedLoginEnable = ve_config_get_bool (config, GDM_KEY_TIMED_LOGIN_ENABLE);
@@ -987,8 +986,10 @@ gdm_login_list_lookup (GSList *l, const gchar *data)
}
static const char *
-translate_session (const char *name)
+session_name (const char *name)
{
+ const char *nm;
+
/* eek */
if (name == NULL)
return "(null)";
@@ -997,18 +998,18 @@ translate_session (const char *name)
return _("Failsafe Gnome");
else if (strcmp (name, GDM_SESSION_FAILSAFE_XTERM) == 0)
return _("Failsafe xterm");
+
+ nm = g_hash_table_lookup (sessnames, name);
+ if (nm != NULL)
+ return nm;
else
- return _(name);
+ return name;
}
static void
gdm_login_session_lookup (const gchar* savedsess)
{
- if (curuser == NULL)
- gdm_login_abort("gdm_login_session_lookup: curuser==NULL. Mail <mkp@mkp.net> with " \
- "information on your PAM and user database setup");
-
/* Don't save session unless told otherwise */
savesess = FALSE;
@@ -1046,8 +1047,8 @@ gdm_login_session_lookup (const gchar* savedsess)
"installed on this machine.\n"
"Do you wish to make %s the default for "
"future sessions?"),
- translate_session (savedsess),
- translate_session (defsess));
+ session_name (savedsess),
+ session_name (defsess));
savesess = gdm_login_query (msg);
g_free (msg);
}
@@ -1060,8 +1061,9 @@ gdm_login_session_lookup (const gchar* savedsess)
/* User's saved session is not the chosen one */
if (strcmp (session, GDM_SESSION_FAILSAFE_GNOME) == 0 ||
strcmp (session, GDM_SESSION_FAILSAFE_XTERM) == 0 ||
- /* bad hack, "Failsafe" is just a name in the session dir */
- strcmp (session, "Failsafe") == 0) {
+ /* bad hack, "Failsafe.desktop" is just a name in the session dir */
+ g_ascii_strcasecmp (session, "Failsafe") == 0 ||
+ g_ascii_strcasecmp (session, "Failsafe.desktop") == 0) {
savesess = FALSE;
} else if (strcmp (savedsess, session) != 0) {
gchar *msg = NULL;
@@ -1072,11 +1074,11 @@ gdm_login_session_lookup (const gchar* savedsess)
"setting is %s.\nDo you wish "
"to make %s the default for "
"future sessions?"),
- translate_session (session),
- translate_session (savedsess),
- translate_session (session));
+ session_name (session),
+ session_name (savedsess),
+ session_name (session));
savesess = gdm_login_query (msg);
- } else if (strcmp (session, "Default") != 0 &&
+ } else if (strcmp (session, "Xclients.desktop") != 0 &&
strcmp (session, LAST_SESSION) != 0) {
/* if !GdmShowLastSession then our saved session is
* irrelevant, we are in "switchdesk mode"
@@ -1089,8 +1091,8 @@ gdm_login_session_lookup (const gchar* savedsess)
"run the 'switchdesk' utility\n"
"(System->Desktop Switching Tool from "
"the panel menu)."),
- translate_session (session),
- translate_session (session));
+ session_name (session),
+ session_name (session));
savesess = FALSE;
gdm_login_message (msg);
}
@@ -1103,10 +1105,6 @@ gdm_login_session_lookup (const gchar* savedsess)
static void
gdm_login_language_lookup (const gchar* savedlang)
{
- if (curuser == NULL)
- gdm_login_abort("gdm_login_language_lookup: curuser==NULL. Mail <mkp@mkp.net> with " \
- "information on your PAM and user database setup");
-
/* Don't save language unless told otherwise */
savelang = FALSE;
@@ -1337,7 +1335,7 @@ gdm_login_session_handler (GtkWidget *widget)
cursess = g_object_get_data (G_OBJECT (widget), SESSION_NAME);
- s = g_strdup_printf (_("%s session selected"), translate_session (cursess));
+ s = g_strdup_printf (_("%s session selected"), session_name (cursess));
gtk_label_set_text (GTK_LABEL (msg), s);
g_free (s);
@@ -1353,9 +1351,7 @@ gdm_login_session_init (GtkWidget *menu)
GtkWidget *item;
DIR *sessdir;
struct dirent *dent;
- struct stat statbuf;
- gint linklen;
- gboolean got_default_link = FALSE;
+ gboolean searching_for_default = TRUE;
cursess = NULL;
@@ -1385,7 +1381,8 @@ gdm_login_session_init (GtkWidget *menu)
/* Check that session dir is readable */
if (GdmSessionDir == NULL ||
access (GdmSessionDir, R_OK|X_OK)) {
- syslog (LOG_ERR, _("gdm_login_session_init: Session script directory not found!"));
+ syslog (LOG_ERR, _("gdm_login_session_init: Session directory %s not found!"), ve_sure_string (GdmSessionDir));
+ GdmShowXtermFailsafeSession = TRUE;
session_dir_whacked_out = TRUE;
}
@@ -1400,125 +1397,120 @@ gdm_login_session_init (GtkWidget *menu)
else
dent = NULL;
+ sessnames = g_hash_table_new (g_str_hash, g_str_equal);
+
while (dent != NULL) {
- gchar *s;
-
- /* Ignore backups and rpmsave files */
- if ((strstr (dent->d_name, "~")) ||
- (strstr (dent->d_name, ".rpmsave")) ||
- (strstr (dent->d_name, ".rpmorig")) ||
- (strstr (dent->d_name, ".dpkg-old")) ||
- (strstr (dent->d_name, ".deleted")) ||
- (strstr (dent->d_name, ".desc")) /* description file */ ||
- (strstr (dent->d_name, ".orig"))) {
- dent = readdir (sessdir);
- continue;
- }
+ VeConfig *cfg;
+ char *exec;
+ char *name;
+ char *comment;
+ char *s;
- s = g_strconcat (GdmSessionDir, "/", dent->d_name, NULL);
- lstat (s, &statbuf);
+ /* ignore everything bug the .desktop files */
+ if (strstr (dent->d_name, ".desktop") == NULL) {
+ dent = readdir (sessdir);
+ continue;
+ }
- /* If default session link exists, find out what it points to */
- if (S_ISLNK (statbuf.st_mode)) {
- if (g_ascii_strcasecmp (dent->d_name, "default") == 0) {
- gchar t[_POSIX_PATH_MAX];
+ s = g_strconcat (GdmSessionDir, "/", dent->d_name, NULL);
+ cfg = ve_config_new (s);
+ g_free (s);
- linklen = readlink (s, t, _POSIX_PATH_MAX);
- t[linklen] = 0;
- g_free (defsess);
- defsess = g_strdup (t);
- got_default_link = TRUE;
- } else {
- /* This may just be a link to somewhere so
- * stat the file itself */
- stat (s, &statbuf);
- }
- }
+ exec = ve_config_get_string (cfg, "Desktop Entry/Exec");
+ name = ve_config_get_translated_string (cfg, "Desktop Entry/Name");
+ comment = ve_config_get_translated_string (cfg, "Desktop Entry/Comment");
- /* If session script is readable/executable add it to the list */
- if (S_ISREG (statbuf.st_mode)) {
+ ve_config_destroy (cfg);
- if ((statbuf.st_mode & (S_IRUSR|S_IXUSR)) == (S_IRUSR|S_IXUSR) &&
- (statbuf.st_mode & (S_IRGRP|S_IXGRP)) == (S_IRGRP|S_IXGRP) &&
- (statbuf.st_mode & (S_IROTH|S_IXOTH)) == (S_IROTH|S_IXOTH))
- {
- item = gtk_radio_menu_item_new_with_label (sessgrp, _(dent->d_name));
- g_object_set_data_full (G_OBJECT (item),
- SESSION_NAME,
- g_strdup (dent->d_name),
- (GDestroyNotify) g_free);
-
- sessgrp = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
- sessions = g_slist_append (sessions, g_strdup (dent->d_name));
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- g_signal_connect (G_OBJECT (item), "activate",
- G_CALLBACK (gdm_login_session_handler),
- NULL);
- gtk_widget_show (GTK_WIDGET (item));
+ if (ve_string_empty (exec) || ve_string_empty (name)) {
+ g_free (exec);
+ g_free (name);
+ g_free (comment);
+ dent = readdir (sessdir);
+ continue;
+ }
- /* if there is a session called Default, use that as default
- * if no link has been made */
- if ( ! got_default_link &&
- g_ascii_strcasecmp (dent->d_name, "Default") == 0) {
- g_free (defsess);
- defsess = g_strdup (dent->d_name);
- }
+ item = gtk_radio_menu_item_new_with_label (sessgrp, name);
+ g_object_set_data_full (G_OBJECT (item),
+ SESSION_NAME,
+ g_strdup (dent->d_name),
+ (GDestroyNotify) g_free);
- if (g_ascii_strcasecmp (dent->d_name, "Gnome") == 0) {
- /* Just in case there is no Default session and
- * no default link, make Gnome the default */
- if (defsess == NULL)
- defsess = g_strdup (dent->d_name);
-
- /* FIXME: when we get descriptions in session files,
- * take this out */
- gtk_tooltips_set_tip
- (tooltips, GTK_WIDGET (item),
- _("This session will log you directly into "
- "GNOME, into your current session."),
- NULL);
+ if ( ! ve_string_empty (comment))
+ gtk_tooltips_set_tip
+ (tooltips, GTK_WIDGET (item), comment, NULL);
- if (GdmShowGnomeChooserSession) {
- /* Add the chooser session, this one doesn't have a
- * script really, it's a fake, it runs the Gnome
- * script */
- /* For translators: This is the login that lets
- * users choose the specific gnome session they
- * want to use */
- item = gtk_radio_menu_item_new_with_label
- (sessgrp, _("Gnome Chooser"));
- gtk_tooltips_set_tip
- (tooltips, GTK_WIDGET (item),
- _("This session will log you into "
- "GNOME and it will let you choose which "
- "one of the GNOME sessions you want to "
- "use."),
- NULL);
- g_object_set_data (G_OBJECT (item),
- SESSION_NAME,
- GDM_SESSION_GNOME_CHOOSER);
-
- sessgrp = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
- sessions = g_slist_append (sessions,
- g_strdup (GDM_SESSION_GNOME_CHOOSER));
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- g_signal_connect (G_OBJECT (item), "activate",
- G_CALLBACK (gdm_login_session_handler),
- NULL);
- gtk_widget_show (GTK_WIDGET (item));
- }
- }
-
+ sessgrp = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
+ sessions = g_slist_append (sessions, g_strdup (dent->d_name));
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ g_signal_connect (G_OBJECT (item), "activate",
+ G_CALLBACK (gdm_login_session_handler),
+ NULL);
+ gtk_widget_show (GTK_WIDGET (item));
+
+ /* if we found the default session */
+ if ( ! ve_string_empty (GdmDefaultSession) &&
+ strcmp (dent->d_name, GdmDefaultSession) == 0) {
+ g_free (defsess);
+ defsess = g_strdup (dent->d_name);
+ searching_for_default = FALSE;
}
- else
- syslog (LOG_ERR, "Wrong permissions on %s/%s. Should be readable/executable for all.",
- GdmSessionDir, dent->d_name);
- }
+ /* if there is a session called Default */
+ if (searching_for_default &&
+ g_ascii_strcasecmp (dent->d_name, "Default.desktop") == 0) {
+ g_free (defsess);
+ defsess = g_strdup (dent->d_name);
+ }
- dent = readdir (sessdir);
- g_free (s);
+ if (searching_for_default &&
+ g_ascii_strcasecmp (dent->d_name, "Gnome.desktop") == 0) {
+ /* Just in case there is no Default session and
+ * no default link, make Gnome the default */
+ if (defsess == NULL)
+ defsess = g_strdup (dent->d_name);
+
+#if 0
+ /* FIXME: maybe just whack this completely */
+ if (GdmShowGnomeChooserSession) {
+ /* Add the chooser session, this one doesn't have a
+ * script really, it's a fake, it runs the Gnome
+ * script */
+ /* For translators: This is the login that lets
+ * users choose the specific gnome session they
+ * want to use */
+ item = gtk_radio_menu_item_new_with_label
+ (sessgrp, _("Gnome Chooser"));
+ gtk_tooltips_set_tip
+ (tooltips, GTK_WIDGET (item),
+ _("This session will log you into "
+ "GNOME and it will let you choose which "
+ "one of the GNOME sessions you want to "
+ "use."),
+ NULL);
+ g_object_set_data (G_OBJECT (item),
+ SESSION_NAME,
+ GDM_SESSION_GNOME_CHOOSER);
+
+ sessgrp = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
+ sessions = g_slist_append (sessions,
+ g_strdup (GDM_SESSION_GNOME_CHOOSER));
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ g_signal_connect (G_OBJECT (item), "activate",
+ G_CALLBACK (gdm_login_session_handler),
+ NULL);
+ gtk_widget_show (GTK_WIDGET (item));
+ }
+#endif
+ }
+
+ g_hash_table_insert (sessnames, g_strdup (dent->d_name), name);
+
+ g_free (exec);
+ g_free (comment);
+
+ dent = readdir (sessdir);
}
if (sessdir != NULL)
@@ -1527,6 +1519,7 @@ gdm_login_session_init (GtkWidget *menu)
if (sessions == NULL) {
syslog (LOG_WARNING, _("Yaikes, nothing found in the session directory."));
session_dir_whacked_out = TRUE;
+ GdmShowXtermFailsafeSession = TRUE;
defsess = g_strdup (GDM_SESSION_FAILSAFE_GNOME);
}
@@ -1792,6 +1785,8 @@ gdm_login_language_menu_new (void)
return menu;
}
+#if 0
+/* FIXME: Maybe whack this */
static void
toggle_sensitize (GtkWidget *w, gpointer data)
{
@@ -1998,6 +1993,7 @@ get_gnome_session (const char *sess_string)
return retval;
}
+#endif
static gboolean
err_box_clear (gpointer data)
@@ -2090,7 +2086,7 @@ greeter_is_capslock_on (void)
unsigned int states;
Display *dsp;
- /* HACK! incredible hack, if this is set we get
+ /* HACK! incredible hack, if GDM_PARENT_DISPLAY is set we get
* indicator state from the parent display, since we must be inside an
* Xnest */
dsp = get_parent_display ();
@@ -2453,6 +2449,8 @@ gdm_login_ctrl_handler (GIOChannel *source, GIOCondition cond, gint fd)
_exit (EXIT_SUCCESS);
break;
+#if 0
+ /* FIXME: Maybe whack this */
case GDM_GNOMESESS:
{
char *sess;
@@ -2490,6 +2488,7 @@ gdm_login_ctrl_handler (GIOChannel *source, GIOCondition cond, gint fd)
fflush (stdout);
break;
+#endif
case GDM_STARTTIMER:
g_io_channel_read_chars (source, buf, PIPE_SIZE-1, &len, NULL); /* Empty */
diff --git a/gui/gdmphotosetup.c b/gui/gdmphotosetup.c
index 7e3f9a70..7a291bd3 100644
--- a/gui/gdmphotosetup.c
+++ b/gui/gdmphotosetup.c
@@ -218,7 +218,7 @@ main (int argc, char *argv[])
char buf[4096];
size_t size;
char *photofile = g_strconcat (g_get_home_dir (),
- "/.gnome2/photo",
+ "/.face",
NULL);
char *cfg_file = g_strconcat (g_get_home_dir (),
"/.gnome2/gdm",
diff --git a/gui/greeter/greeter.c b/gui/greeter/greeter.c
index d68cd139..bd773655 100644
--- a/gui/greeter/greeter.c
+++ b/gui/greeter/greeter.c
@@ -39,11 +39,15 @@ gboolean GDM_IS_LOCAL = FALSE;
char *GdmGraphicalTheme = NULL;
char *GdmGraphicalThemeDir = NULL;
int GdmXineramaScreen = 0;
+#if 0
+/* FIXME: maybe just whack this */
gboolean GdmShowGnomeChooserSession = FALSE;
+#endif
gboolean GdmShowGnomeFailsafeSession = FALSE;
gboolean GdmShowXtermFailsafeSession = FALSE;
gboolean GdmShowLastSession = FALSE;
gchar *GdmSessionDir = NULL;
+gchar *GdmDefaultSession = NULL;
gchar *GdmLocaleFile = NULL;
gchar *GdmHalt = NULL;
gchar *GdmReboot = NULL;
@@ -119,9 +123,13 @@ greeter_parse_config (void)
GdmShowXtermFailsafeSession = ve_config_get_bool (config, GDM_KEY_SHOW_XTERM_FAILSAFE);
GdmShowGnomeFailsafeSession = ve_config_get_bool (config, GDM_KEY_SHOW_GNOME_FAILSAFE);
+#if 0
+ /* FIXME: maybe just whack this */
GdmShowGnomeChooserSession = ve_config_get_bool (config, GDM_KEY_SHOW_GNOME_CHOOSER);
+#endif
GdmShowLastSession = ve_config_get_bool (config, GDM_KEY_SHOW_LAST_SESSION);
GdmSessionDir = ve_config_get_string (config, GDM_KEY_SESSDIR);
+ GdmDefaultSession = ve_config_get_string (config, GDM_KEY_DEFAULTSESSION);
GdmLocaleFile = ve_config_get_string (config, GDM_KEY_LOCFILE);
GdmSystemMenu = ve_config_get_bool (config, GDM_KEY_SYSMENU);
GdmConfigAvailable = ve_config_get_bool (config, GDM_KEY_CONFIG_AVAILABLE);
@@ -405,6 +413,8 @@ greeter_ctrl_handler (GIOChannel *source,
_exit (EXIT_SUCCESS);
break;
+#if 0
+ /* FIXME: Maybe whack this */
case GDM_GNOMESESS:
{
char *sess;
@@ -442,6 +452,7 @@ greeter_ctrl_handler (GIOChannel *source,
fflush (stdout);
break;
+#endif
case GDM_STARTTIMER:
g_io_channel_read_chars (source, buf, PIPE_SIZE-1, &len, NULL); /* Empty */
@@ -904,9 +915,12 @@ greeter_reread_config (int sig, gpointer data)
! bool_same (config,
GdmShowGnomeFailsafeSession,
GDM_KEY_SHOW_GNOME_FAILSAFE) ||
+#if 0
+ /* FIXME: maybe just whack this */
! bool_same (config,
GdmShowGnomeChooserSession,
GDM_KEY_SHOW_GNOME_CHOOSER) ||
+#endif
! string_same (config,
GdmSessionDir,
GDM_KEY_SESSDIR) ||
diff --git a/gui/greeter/greeter_action_language.c b/gui/greeter/greeter_action_language.c
index 4f5f2763..2e05b0e8 100644
--- a/gui/greeter/greeter_action_language.c
+++ b/gui/greeter/greeter_action_language.c
@@ -108,12 +108,6 @@ greeter_language_get_language (const char *old_language)
{
gchar *retval = NULL;
-#if 0
- if (greeter_current_user == NULL)
- greeter_abort ("greeter_language_get_language: curuser==NULL. Mail <mkp@mkp.net> with " \
- "information on your PAM and user database setup");
-#endif
-
/* Don't save language unless told otherwise */
savelang = FALSE;
diff --git a/gui/greeter/greeter_configuration.h b/gui/greeter/greeter_configuration.h
index f885db7e..5adf1ab7 100644
--- a/gui/greeter/greeter_configuration.h
+++ b/gui/greeter/greeter_configuration.h
@@ -2,7 +2,10 @@
#define GREETER_CONFIGURATION_H
extern gboolean GdmUseCirclesInEntry;
+#if 0
+/* FIXME: maybe just whack this */
extern gboolean GdmShowGnomeChooserSession;
+#endif
extern gboolean GdmShowGnomeFailsafeSession;
extern gboolean GdmShowXtermFailsafeSession;
extern gboolean GdmShowLastSession;
@@ -14,6 +17,7 @@ extern gchar *GdmReboot;
extern gchar *GdmSuspend;
extern gchar *GdmConfigurator;
extern gchar *GdmSessionDir;
+extern gchar *GdmDefaultSession;
extern gchar *GdmDefaultLocale;
extern gchar *GdmLocaleFile;
extern gboolean GdmTimedLoginEnable;
diff --git a/gui/greeter/greeter_session.c b/gui/greeter/greeter_session.c
index 49fb6ea5..07e293e8 100644
--- a/gui/greeter/greeter_session.c
+++ b/gui/greeter/greeter_session.c
@@ -10,6 +10,8 @@
#include <gtk/gtk.h>
#include <libgnome/libgnome.h>
+#include "vicious.h"
+
#include "gdm.h"
#include "gdmwm.h"
@@ -27,6 +29,7 @@ static gboolean save_session = FALSE;
static char *current_session = NULL;
static gchar *default_session = NULL;
static GSList *sessions = NULL;
+static GHashTable *sessnames = NULL;
/* This is true if session dir doesn't exist or is whacked out
* in some way or another */
@@ -55,18 +58,24 @@ greeter_login_list_lookup (GSList *l, const gchar *data)
}
static const char *
-translate_session (const char *name)
+session_name (const char *name)
{
+ const char *nm;
+
/* eek */
if (name == NULL)
return "(null)";
if (strcmp (name, GDM_SESSION_FAILSAFE_GNOME) == 0)
- return _("Failsafe Gnome");
+ return _("Failsafe Gnome");
else if (strcmp (name, GDM_SESSION_FAILSAFE_XTERM) == 0)
- return _("Failsafe xterm");
+ return _("Failsafe xterm");
+
+ nm = g_hash_table_lookup (sessnames, name);
+ if (nm != NULL)
+ return nm;
else
- return _(name);
+ return name;
}
char *
@@ -74,14 +83,10 @@ greeter_session_lookup (const char *saved_session)
{
gchar *session = NULL;
- if (greeter_current_user == NULL)
- greeter_abort("greeter_session_lookup: greeter_current_user==NULL. Mail <mkp@mkp.net> with " \
- "information on your PAM and user database setup");
-
/* Don't save session unless told otherwise */
save_session = FALSE;
- /* Previously saved session not found in ~user/.gnome2/gdm */
+ /* Previously saved session not found in ~/.dmrc */
if ( ! (saved_session != NULL &&
strcmp ("(null)", saved_session) != 0 &&
saved_session[0] != '\0')) {
@@ -112,8 +117,8 @@ greeter_session_lookup (const char *saved_session)
"installed on this machine.\n"
"Do you wish to make %s the default for "
"future sessions?"),
- translate_session (saved_session),
- translate_session (default_session));
+ session_name (saved_session),
+ session_name (default_session));
save_session = greeter_query (msg);
g_free (msg);
}
@@ -126,6 +131,7 @@ greeter_session_lookup (const char *saved_session)
if (strcmp (session, GDM_SESSION_FAILSAFE_GNOME) == 0 ||
strcmp (session, GDM_SESSION_FAILSAFE_XTERM) == 0 ||
/* bad hack, "Failsafe" is just a name in the session dir */
+ strcmp (session, "Failsafe.desktop") == 0 ||
strcmp (session, "Failsafe") == 0)
{
save_session = FALSE;
@@ -141,12 +147,12 @@ greeter_session_lookup (const char *saved_session)
"setting is %s.\nDo you wish "
"to make %s the default for "
"future sessions?"),
- translate_session (session),
- translate_session (saved_session),
- translate_session (session));
+ session_name (session),
+ session_name (saved_session),
+ session_name (session));
save_session = greeter_query (msg);
}
- else if (strcmp (session, "Default") != 0 &&
+ else if (strcmp (session, "Xclients.desktop") != 0 &&
strcmp (session, LAST_SESSION) != 0)
{
/* if !GdmShowLastSession then our saved session is
@@ -160,8 +166,8 @@ greeter_session_lookup (const char *saved_session)
"run the 'switchdesk' utility\n"
"(System->Desktop Switching Tool from "
"the panel menu)."),
- translate_session (session),
- translate_session (session));
+ session_name (session),
+ session_name (session));
save_session = FALSE;
greeter_message (msg);
}
@@ -179,6 +185,8 @@ greeter_save_session (void)
}
+#if 0
+ /* FIXME: Maybe whack this */
/* At the moment we don't support the gnome session stuff */
char *
greeter_get_gnome_session (const char *sess_string)
@@ -191,6 +199,7 @@ greeter_save_gnome_session (void)
{
return FALSE;
}
+#endif
void
greeter_session_init (void)
@@ -204,9 +213,7 @@ greeter_session_init (void)
GtkWidget *dialog;
DIR *sessdir;
struct dirent *dent;
- struct stat statbuf;
- gint linklen;
- gboolean got_default_link = FALSE;
+ gboolean searching_for_default = FALSE;
static GtkTooltips *tooltips = NULL;
GtkRequisition req;
char *s;
@@ -281,8 +288,9 @@ greeter_session_init (void)
if (GdmSessionDir == NULL ||
access (GdmSessionDir, R_OK|X_OK))
{
- syslog (LOG_ERR, _("gdm_login_session_init: Session script directory not found!"));
+ syslog (LOG_ERR, _("gdm_login_session_init: Session directory %s not found!"), ve_sure_string (GdmSessionDir));
session_dir_whacked_out = TRUE;
+ GdmShowXtermFailsafeSession = TRUE;
}
/* Read directory entries in session dir */
@@ -297,126 +305,79 @@ greeter_session_init (void)
dent = NULL;
while (dent != NULL) {
- gchar *s;
-
- /* Ignore backups and rpmsave files */
- if ((strstr (dent->d_name, "~")) ||
- (strstr (dent->d_name, ".rpmsave")) ||
- (strstr (dent->d_name, ".rpmorig")) ||
- (strstr (dent->d_name, ".dpkg-old")) ||
- (strstr (dent->d_name, ".deleted")) ||
- (strstr (dent->d_name, ".desc")) /* description file */ ||
- (strstr (dent->d_name, ".orig")))
- {
- dent = readdir (sessdir);
- continue;
- }
-
- s = g_build_filename (GdmSessionDir, dent->d_name, NULL);
- lstat (s, &statbuf);
-
- /* If default session link exists, find out what it points to */
- if (S_ISLNK (statbuf.st_mode))
- {
- if (g_ascii_strcasecmp (dent->d_name, "default") == 0)
- {
- gchar t[_POSIX_PATH_MAX];
-
- linklen = readlink (s, t, _POSIX_PATH_MAX);
- t[linklen] = 0;
- g_free (default_session);
- default_session = g_strdup (t);
-
- got_default_link = TRUE;
- }
- else
- {
- /* This may just be a link to somewhere so
- * stat the file itself */
- stat (s, &statbuf);
- }
- }
-
- /* If session script is readable/executable add it to the list */
- if (S_ISREG (statbuf.st_mode))
- {
-
- if ((statbuf.st_mode & (S_IRUSR|S_IXUSR)) == (S_IRUSR|S_IXUSR) &&
- (statbuf.st_mode & (S_IRGRP|S_IXGRP)) == (S_IRGRP|S_IXGRP) &&
- (statbuf.st_mode & (S_IROTH|S_IXOTH)) == (S_IROTH|S_IXOTH))
- {
- radio = gtk_radio_button_new_with_mnemonic (session_group, _(dent->d_name));
- g_object_set_data_full (G_OBJECT (radio),
- SESSION_NAME,
- g_strdup (dent->d_name),
- (GDestroyNotify) g_free);
- session_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));
- gtk_box_pack_start (GTK_BOX (vbox), radio, FALSE, FALSE, 4);
- gtk_widget_show (radio);
-
- sessions = g_slist_append (sessions, g_strdup (dent->d_name));
-
- /* if there is a session called Default, use that as default
- * if no link has been made */
- if ( ! got_default_link &&
- g_ascii_strcasecmp (dent->d_name, "Default") == 0) {
- g_free (default_session);
- default_session = g_strdup (dent->d_name);
- }
-
- if (g_ascii_strcasecmp (dent->d_name, "Gnome") == 0) {
- /* Just in case there is no Default session and
- * no default link, make Gnome the default */
- if (default_session == NULL)
+ VeConfig *cfg;
+ char *exec;
+ char *name;
+ char *comment;
+ /* ignore everything bug the .desktop files */
+ if (strstr (dent->d_name, ".desktop") == NULL) {
+ dent = readdir (sessdir);
+ continue;
+ }
+
+ s = g_strconcat (GdmSessionDir, "/", dent->d_name, NULL);
+ cfg = ve_config_new (s);
+ g_free (s);
+
+ exec = ve_config_get_string (cfg, "Desktop Entry/Exec");
+ name = ve_config_get_translated_string (cfg, "Desktop Entry/Name");
+ comment = ve_config_get_translated_string (cfg, "Desktop Entry/Comment");
+
+ ve_config_destroy (cfg);
+
+ if (ve_string_empty (exec) || ve_string_empty (name)) {
+ g_free (exec);
+ g_free (name);
+ g_free (comment);
+ dent = readdir (sessdir);
+ continue;
+ }
+
+ radio = gtk_radio_button_new_with_mnemonic (session_group, _(dent->d_name));
+ g_object_set_data_full (G_OBJECT (radio),
+ SESSION_NAME,
+ g_strdup (dent->d_name),
+ (GDestroyNotify) g_free);
+ session_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));
+ gtk_box_pack_start (GTK_BOX (vbox), radio, FALSE, FALSE, 4);
+ gtk_widget_show (radio);
+
+ if ( ! ve_string_empty (comment))
+ gtk_tooltips_set_tip
+ (tooltips, GTK_WIDGET (radio), comment, NULL);
+
+
+ sessions = g_slist_append (sessions, g_strdup (dent->d_name));
+
+ /* if we found the default session */
+ if ( ! ve_string_empty (GdmDefaultSession) &&
+ strcmp (dent->d_name, GdmDefaultSession) == 0) {
+ g_free (default_session);
default_session = g_strdup (dent->d_name);
-
- /* FIXME: when we get descriptions in session files,
- * take this out */
- gtk_tooltips_set_tip
- (tooltips, GTK_WIDGET (radio),
- _("This session will log you directly into "
- "GNOME, into your current session."),
- NULL);
-
-#ifdef NOT_SUPPORTED_YET
- if (GdmShowGnomeChooserSession)
- {
- /* Add the chooser session, this one doesn't have a
- * script really, it's a fake, it runs the Gnome
- * script */
- /* For translators: This is the login that lets
- * users choose the specific gnome session they
- * want to use */
- item = gtk_radio_menu_item_new_with_label
- (sessgrp, _("Gnome Chooser"));
- gtk_tooltips_set_tip
- (tooltips, GTK_WIDGET (item),
- _("This session will log you into "
- "GNOME and it will let you choose which "
- "one of the GNOME sessions you want to "
- "use."),
- NULL);
- g_object_set_data (G_OBJECT (item),
- SESSION_NAME,
- GDM_SESSION_GNOME_CHOOSER);
-
- sessgrp = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
- sessions = g_slist_append (sessions,
- g_strdup (GDM_SESSION_GNOME_CHOOSER));
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (GTK_WIDGET (item));
- }
-#endif
- }
- }
- else
- syslog (LOG_ERR, "Wrong permissions on %s/%s. Should be readable/executable for all.",
- GdmSessionDir, dent->d_name);
-
- }
-
- dent = readdir (sessdir);
- g_free (s);
+ searching_for_default = FALSE;
+ }
+
+ /* if there is a session called Default */
+ if (searching_for_default &&
+ g_ascii_strcasecmp (dent->d_name, "Default.desktop") == 0) {
+ g_free (default_session);
+ default_session = g_strdup (dent->d_name);
+ }
+
+ if (searching_for_default &&
+ g_ascii_strcasecmp (dent->d_name, "Gnome.desktop") == 0) {
+ /* Just in case there is no Default session and
+ * no default link, make Gnome the default */
+ if (default_session == NULL)
+ default_session = g_strdup (dent->d_name);
+ }
+
+ g_hash_table_insert (sessnames, g_strdup (dent->d_name), name);
+
+ g_free (exec);
+ g_free (comment);
+
+ dent = readdir (sessdir);
}
if (sessdir != NULL)
@@ -426,6 +387,7 @@ greeter_session_init (void)
{
syslog (LOG_WARNING, _("Yaikes, nothing found in the session directory."));
session_dir_whacked_out = TRUE;
+ GdmShowXtermFailsafeSession = TRUE;
default_session = g_strdup (GDM_SESSION_FAILSAFE_GNOME);
}
diff --git a/gui/greeter/greeter_session.h b/gui/greeter/greeter_session.h
index abeca4a6..0e16ceaf 100644
--- a/gui/greeter/greeter_session.h
+++ b/gui/greeter/greeter_session.h
@@ -7,7 +7,10 @@ void greeter_item_session_setup (void);
char * greeter_session_lookup (const char *saved_session);
gboolean greeter_save_session (void);
+#if 0
+/* FIXME: Maybe whack this */
char * greeter_get_gnome_session (const char *sess_string);
gboolean greeter_save_gnome_session (void);
+#endif
#endif /* __GREETER_SESSION_H__ */