Commit b9562703 authored by Brian Cameron's avatar Brian Cameron Committed by Brian Cameron

Correct Makefile so that if CONSOLE_HELPER is set, we don't try to create

2005-05-03  Brian Cameron  <brian.cameron@sun.com>

        * Makefile.am: Correct Makefile so that if
          CONSOLE_HELPER is set, we don't try to create
          an /sbin/gdmsetup symlink to gdmsetup.  Now
          gdmsetup is already installed to /sbin always.
          Fixes #302319.
        * gui/gdmsetup.c: Fix sensitivity of the
          "Delete Theme" button.
        * daemon/gdm.h, gui/gdmlogin.c, gui/greeter/greeter.c:
          Now only set user/password entry to PAM_MAX_RESP_SIZE
          if HAVE_PAM is defined, otherwise set it to
          GDM_MAX_PASS set to 256 in daemon/gdm.h.  This
          allows gdm to be used on systems that do not have
          PAM.  Fixes #302228.
        * daemon/gdm.h, docs/C/gdm.xml, gui/gdmsetup.c,
          gui/greeter/greeter.c, gui/gdmsetup.glade,
          gui/gdmsetup-strings.c, config/gdm.conf.in:
          Now support random theme.  Fixes #302354.
        * gui/gdmcommon.c, gui/gdmlogin.c,
          gui/greeter/greeter_session.c, gui/Makefile.am,
          added gui/gdmsession.[ch]:  Support better
          sorting for session names.  Fixes #301818.
parent b503fd1f
2005-05-03 Brian Cameron <brian.cameron@sun.com>
* Makefile.am: Correct Makefile so that if
CONSOLE_HELPER is set, we don't try to create
an /sbin/gdmsetup symlink to gdmsetup. Now
gdmsetup is already installed to /sbin always.
Fixes #302319.
* gui/gdmsetup.c: Fix sensitivity of the
"Delete Theme" button.
* daemon/gdm.h, gui/gdmlogin.c, gui/greeter/greeter.c:
Now only set user/password entry to PAM_MAX_RESP_SIZE
if HAVE_PAM is defined, otherwise set it to
GDM_MAX_PASS set to 256 in daemon/gdm.h. This
allows gdm to be used on systems that do not have
PAM. Fixes #302228.
* daemon/gdm.h, docs/C/gdm.xml, gui/gdmsetup.c,
gui/greeter/greeter.c, gui/gdmsetup.glade,
gui/gdmsetup-strings.c, config/gdm.conf.in:
Now support random theme. Fixes #302354.
* gui/gdmcommon.c, gui/gdmlogin.c,
gui/greeter/greeter_session.c, gui/Makefile.am,
added gui/gdmsession.[ch]: Support better
sorting for session names. Fixes #301818.
2005-04-26 Brian Cameron <brian.cameron@sun.com> 2005-04-26 Brian Cameron <brian.cameron@sun.com>
* gui/modules/AccessKeyMouseEvents.in: Now use more * gui/modules/AccessKeyMouseEvents.in: Now use more
......
...@@ -33,9 +33,6 @@ install-data-local: gdmsetup-security ...@@ -33,9 +33,6 @@ install-data-local: gdmsetup-security
if CONSOLE_HELPER if CONSOLE_HELPER
$(INSTALL_DATA) -D $(srcdir)/gdmsetup-pam $(DESTDIR)$(PAM_PREFIX)/pam.d/gdmsetup $(INSTALL_DATA) -D $(srcdir)/gdmsetup-pam $(DESTDIR)$(PAM_PREFIX)/pam.d/gdmsetup
$(INSTALL_DATA) -D gdmsetup-security $(DESTDIR)$(PAM_PREFIX)/security/console.apps/gdmsetup $(INSTALL_DATA) -D gdmsetup-security $(DESTDIR)$(PAM_PREFIX)/security/console.apps/gdmsetup
$(INSTALL_DATA) -m 755 -d $(DESTDIR)$(sbindir)
mv -f $(DESTDIR)$(bindir)/gdmsetup $(DESTDIR)$(sbindir)
$(LN_S) @CONSOLE_HELPER@ $(DESTDIR)$(bindir)/gdmsetup
endif endif
DISTCLEANFILES = \ DISTCLEANFILES = \
......
...@@ -236,15 +236,6 @@ Enable=false ...@@ -236,15 +236,6 @@ Enable=false
# or mail details for some user, or some such. # or mail details for some user, or some such.
#Willing=@EXPANDED_SYSCONFDIR@/gdm/Xwilling #Willing=@EXPANDED_SYSCONFDIR@/gdm/Xwilling
# Run XDMCP sessions on a local proxy X server
#EnableProxy=false
# Proxy X server on which XDMCP session should be run
#ProxyXServer=@X_XNEST_PATH@/Xnest @X_XNEST_CONFIG_OPTIONS@ -geometry 768x576
#ProxyXServer=@X_SERVER_PATH@/Xdmx @X_CONFIG_OPTIONS@ -addremovescreens -norender -noglxproxy
# Command which enables the proxy X server to be reconnected
# to another backend display
#ProxyReconnect=@GDM_RECONNECT_PROXY@
[gui] [gui]
# The specific gtkrc file we use. It should be the full path to the gtkrc # The specific gtkrc file we use. It should be the full path to the gtkrc
# that we need. Unless you need a specific gtkrc that doesn't correspond to # that we need. Unless you need a specific gtkrc that doesn't correspond to
...@@ -359,21 +350,8 @@ DefaultRemoteWelcome=true ...@@ -359,21 +350,8 @@ DefaultRemoteWelcome=true
# Program to run to draw the background in the standard greeter. Perhaps # Program to run to draw the background in the standard greeter. Perhaps
# something like an xscreensaver hack or some such. # something like an xscreensaver hack or some such.
#BackgroundProgram= #BackgroundProgram=
# If this is true then the background program is run always, otherwise # if this is true then the background program is run always, otherwise
# it is only run when the BackgroundType is 0 (None) # it is only run when the BackgroundType is 0 (None)
#BackgroundProgramInitialDelay=30
# The background program will be started after at least that many
# seconds of inactivity. Note that in the current implementation, the actual
# delay could be twice as long as the one specified here in the worst case.
# Basically GDM checks from time to time if there was activity and runs
# the program if there was none.
#RestartBackgroundProgram=true
# If set the background program will be restarted when it has exited, after
# the delay described below has elapsed. This option can be useful when you
# wish to run a screen saver program when no user is using the machine.
#BackgroundProgramRestartDelay=30
# The background program will be restarted after at least that many seconds
# of inactivity.
#RunBackgroundProgramAlways=false #RunBackgroundProgramAlways=false
# Show the Failsafe sessions. These are much MUCH nicer (focus for xterm for # 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 # example) and more failsafe then those supplied by scripts so distros should
...@@ -393,9 +371,14 @@ DefaultRemoteWelcome=true ...@@ -393,9 +371,14 @@ DefaultRemoteWelcome=true
# for instance in console, xdm and ssh. # for instance in console, xdm and ssh.
#UseInvisibleInEntry=false #UseInvisibleInEntry=false
# These two keys are for the new greeter. Circles is the standard # These two keys are for the new greeter. Circles is the standard
# shipped theme # shipped theme. If you want gdm to select a random theme from a list
# then provide a list that is delimited by /: to the GraphicalThemes key and
# set GraphicalThemeRand to true. Otherwise use GraphicalTheme and specify
# just one theme.
#GraphicalTheme=circles #GraphicalTheme=circles
#GraphicalThemes=circles/:happygnome
GraphicalThemeDir=@EXPANDED_DATADIR@/gdm/themes/ GraphicalThemeDir=@EXPANDED_DATADIR@/gdm/themes/
GraphicalThemeRand=false
# If InfoMsgFile points to a file, the greeter will display the contents of the # If InfoMsgFile points to a file, the greeter will display the contents of the
# file in a modal dialog box before the user is allowed to log in. # file in a modal dialog box before the user is allowed to log in.
#InfoMsgFile= #InfoMsgFile=
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <time.h> #include <time.h>
#define GDM_MAX_PASS 256 /* Define a value for password length. Glibc
* leaves MAX_PASS undefined. */
#define STX 0x2 /* Start of txt */ #define STX 0x2 /* Start of txt */
#define BEL 0x7 /* Bell, used to interrupt login for #define BEL 0x7 /* Bell, used to interrupt login for
* say timed login or something similar */ * say timed login or something similar */
...@@ -124,6 +127,10 @@ enum { ...@@ -124,6 +127,10 @@ enum {
#define GDM_INTERRUPT_THEME 'H' #define GDM_INTERRUPT_THEME 'H'
#define GDM_INTERRUPT_CANCEL 'X' #define GDM_INTERRUPT_CANCEL 'X'
/* List delimiter for config file lists */
#define GDM_DELIMITER_MODULES ":"
#define GDM_DELIMITER_THEMES "/:"
/* The dreaded miscellaneous category */ /* The dreaded miscellaneous category */
#define FIELD_SIZE 256 #define FIELD_SIZE 256
#define PIPE_SIZE 4096 #define PIPE_SIZE 4096
...@@ -273,6 +280,8 @@ enum { ...@@ -273,6 +280,8 @@ enum {
#define GDM_KEY_ENTRY_CIRCLES "greeter/UseCirclesInEntry=false" #define GDM_KEY_ENTRY_CIRCLES "greeter/UseCirclesInEntry=false"
#define GDM_KEY_ENTRY_INVISIBLE "greeter/UseInvisibleInEntry=false" #define GDM_KEY_ENTRY_INVISIBLE "greeter/UseInvisibleInEntry=false"
#define GDM_KEY_GRAPHICAL_THEME "greeter/GraphicalTheme=circles" #define GDM_KEY_GRAPHICAL_THEME "greeter/GraphicalTheme=circles"
#define GDM_KEY_GRAPHICAL_THEMES "greeter/GraphicalThemes=circles"
#define GDM_KEY_GRAPHICAL_THEME_RAND "greeter/GraphicalThemeRand=false"
#define GDM_KEY_GRAPHICAL_THEME_DIR "greeter/GraphicalThemeDir=" EXPANDED_DATADIR "/gdm/themes/" #define GDM_KEY_GRAPHICAL_THEME_DIR "greeter/GraphicalThemeDir=" EXPANDED_DATADIR "/gdm/themes/"
#define GDM_KEY_INFO_MSG_FILE "greeter/InfoMsgFile=" #define GDM_KEY_INFO_MSG_FILE "greeter/InfoMsgFile="
......
...@@ -2477,6 +2477,35 @@ XKeepsCrashing ...@@ -2477,6 +2477,35 @@ XKeepsCrashing
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>GraphicalThemes</term>
<listitem>
<synopsis>GraphicalThemes=circles</synopsis>
<para>
The graphical themes that the Themed Greeter should use is the
Mode is set on Random Themes. This is a "/:" delimited list.
It should refer to a directory in the theme directory set by
<filename>GraphicalThemeDir</filename>. This is only used if
<filename>GraphicalThemeRand</filename> is set to true.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>GraphicalThemeRand</term>
<listitem>
<synopsis>GraphicalThemeRand=false</synopsis>
<para>
Whether the graphical greeter will use Only One Theme or Random
Theme mode. Only One Theme mode uses themes listed by
<filename>GraphicalTheme</filename>, Random Themes mode uses
themes listed by <filename>GraphicalThemes</filename>. A value
of false sets greeter to use Only One Theme mode, a value of
true sets the greeter to use Random Theme mode.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term>GraphicalThemeDir</term> <term>GraphicalThemeDir</term>
<listitem> <listitem>
......
...@@ -63,6 +63,8 @@ libgdmcommon_a_SOURCES = \ ...@@ -63,6 +63,8 @@ libgdmcommon_a_SOURCES = \
gdmlanguages.h \ gdmlanguages.h \
gdmuser.c \ gdmuser.c \
gdmuser.h \ gdmuser.h \
gdmsession.c \
gdmsession.h \
misc.c \ misc.c \
misc.h \ misc.h \
gdmcommon.c \ gdmcommon.c \
......
...@@ -360,3 +360,4 @@ gdm_setup_blinking_entry (GtkWidget *entry) ...@@ -360,3 +360,4 @@ gdm_setup_blinking_entry (GtkWidget *entry)
entries = g_slist_prepend (entries, eb); entries = g_slist_prepend (entries, eb);
} }
...@@ -50,5 +50,6 @@ void gdm_kill_thingies (void); ...@@ -50,5 +50,6 @@ void gdm_kill_thingies (void);
void gdm_setup_blinking (void); void gdm_setup_blinking (void);
void gdm_setup_blinking_entry (GtkWidget *entry); void gdm_setup_blinking_entry (GtkWidget *entry);
gint gdm_session_sort_func (const char *a, const char *b);
#endif /* GDM_COMMON_H */ #endif /* GDM_COMMON_H */
...@@ -40,13 +40,20 @@ ...@@ -40,13 +40,20 @@
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
#include <pwd.h> #include <pwd.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#if HAVE_PAM
#include <security/pam_appl.h> #include <security/pam_appl.h>
#define PW_ENTRY_SIZE PAM_MAX_RESP_SIZE
#else
#define PW_ENTRY_SIZE GDM_MAX_PASS
#endif
#include <viciousui.h> #include <viciousui.h>
#include "gdm.h" #include "gdm.h"
#include "gdmuser.h" #include "gdmuser.h"
#include "gdmcommon.h" #include "gdmcommon.h"
#include "gdmsession.h"
#include "gdmwm.h" #include "gdmwm.h"
#include "gdmlanguages.h" #include "gdmlanguages.h"
#include "gdmcommon.h" #include "gdmcommon.h"
...@@ -104,7 +111,6 @@ enum { ...@@ -104,7 +111,6 @@ enum {
}; };
static gchar *GdmGtkRC; static gchar *GdmGtkRC;
static gchar *GdmSessionDir; static gchar *GdmSessionDir;
static gchar *GdmDefaultSession;
static gchar *GdmLocaleFile; static gchar *GdmLocaleFile;
static gchar *GdmGlobalFaceDir; static gchar *GdmGlobalFaceDir;
static gchar *GdmDefaultFace; static gchar *GdmDefaultFace;
...@@ -131,6 +137,7 @@ static gboolean GdmUseInvisibleInEntry; ...@@ -131,6 +137,7 @@ static gboolean GdmUseInvisibleInEntry;
static gint GdmFlexiReapDelayMinutes; static gint GdmFlexiReapDelayMinutes;
/* FIXME: Should move everything to externs and move reading to gdmcommon.c */ /* FIXME: Should move everything to externs and move reading to gdmcommon.c */
gchar *GdmDefaultSession;
gchar *GdmInfoMsgFile; gchar *GdmInfoMsgFile;
gchar *GdmInfoMsgFont; gchar *GdmInfoMsgFont;
gboolean GdmSoundOnLoginReady; gboolean GdmSoundOnLoginReady;
...@@ -166,7 +173,7 @@ static GtkWidget *icon_win = NULL; ...@@ -166,7 +173,7 @@ static GtkWidget *icon_win = NULL;
static GtkWidget *sessmenu; static GtkWidget *sessmenu;
static GtkWidget *langmenu; static GtkWidget *langmenu;
static GtkTooltips *tooltips; static GtkTooltips *tooltips;
static GHashTable *sessnames; GHashTable *sessnames;
static gboolean login_is_local = FALSE; static gboolean login_is_local = FALSE;
static gboolean used_defaults = FALSE; static gboolean used_defaults = FALSE;
...@@ -176,7 +183,7 @@ static GtkTreeModel *browser_model; ...@@ -176,7 +183,7 @@ static GtkTreeModel *browser_model;
static GdkPixbuf *defface; static GdkPixbuf *defface;
/* Eew. Loads of global vars. It's hard to be event controlled while maintaining state */ /* Eew. Loads of global vars. It's hard to be event controlled while maintaining state */
static GSList *sessions = NULL; static GList *sessions = NULL;
static GSList *languages = NULL; static GSList *languages = NULL;
static GList *users = NULL; static GList *users = NULL;
static GList *users_string = NULL; static GList *users_string = NULL;
...@@ -1011,7 +1018,7 @@ gdm_login_parse_config (void) ...@@ -1011,7 +1018,7 @@ gdm_login_parse_config (void)
static gboolean static gboolean
gdm_login_list_lookup (GSList *l, const gchar *data) gdm_login_list_lookup (GSList *l, const gchar *data)
{ {
GSList *list = l; GList *list = l;
if (list == NULL || data == NULL) if (list == NULL || data == NULL)
return FALSE; return FALSE;
...@@ -1034,23 +1041,6 @@ gdm_login_list_lookup (GSList *l, const gchar *data) ...@@ -1034,23 +1041,6 @@ gdm_login_list_lookup (GSList *l, const gchar *data)
return FALSE; return FALSE;
} }
static const char *
session_name (const char *name)
{
const char *nm;
/* eek */
if G_UNLIKELY (name == NULL)
return "(null)";
nm = g_hash_table_lookup (sessnames, name);
if (nm != NULL)
return nm;
else
return name;
}
static void static void
gdm_login_session_lookup (const gchar* savedsess) gdm_login_session_lookup (const gchar* savedsess)
{ {
...@@ -1089,8 +1079,8 @@ gdm_login_session_lookup (const gchar* savedsess) ...@@ -1089,8 +1079,8 @@ gdm_login_session_lookup (const gchar* savedsess)
"installed on this machine.\n" "installed on this machine.\n"
"Do you wish to make %s the default for " "Do you wish to make %s the default for "
"future sessions?"), "future sessions?"),
session_name (savedsess), gdm_session_name (savedsess),
session_name (defsess)); gdm_session_name (defsess));
savesess = gdm_common_query (msg, FALSE /* markup */, savesess = gdm_common_query (msg, FALSE /* markup */,
_("Make _Default"), _("Just _Log In"), TRUE); _("Make _Default"), _("Just _Log In"), TRUE);
g_free (msg); g_free (msg);
...@@ -1116,9 +1106,9 @@ gdm_login_session_lookup (const gchar* savedsess) ...@@ -1116,9 +1106,9 @@ gdm_login_session_lookup (const gchar* savedsess)
"setting is %s.\nDo you wish " "setting is %s.\nDo you wish "
"to make %s the default for " "to make %s the default for "
"future sessions?"), "future sessions?"),
session_name (session), gdm_session_name (session),
session_name (savedsess), gdm_session_name (savedsess),
session_name (session)); gdm_session_name (session));
savesess = gdm_common_query (msg, FALSE /* markup */, savesess = gdm_common_query (msg, FALSE /* markup */,
_("Make _Default"), _("Just For _This Session"), TRUE); _("Make _Default"), _("Just For _This Session"), TRUE);
} else if (strcmp (session, defsess) != 0 && } else if (strcmp (session, defsess) != 0 &&
...@@ -1136,8 +1126,8 @@ gdm_login_session_lookup (const gchar* savedsess) ...@@ -1136,8 +1126,8 @@ gdm_login_session_lookup (const gchar* savedsess)
"run the 'switchdesk' utility\n" "run the 'switchdesk' utility\n"
"(System->Desktop Switching Tool from " "(System->Desktop Switching Tool from "
"the panel menu)."), "the panel menu)."),
session_name (session), gdm_session_name (session),
session_name (session)); gdm_session_name (session));
gdm_common_message (msg); gdm_common_message (msg);
} }
savesess = GTK_RESPONSE_NO; savesess = GTK_RESPONSE_NO;
...@@ -1393,7 +1383,7 @@ gdm_login_session_handler (GtkWidget *widget) ...@@ -1393,7 +1383,7 @@ gdm_login_session_handler (GtkWidget *widget)
cursess = g_object_get_data (G_OBJECT (widget), SESSION_NAME); cursess = g_object_get_data (G_OBJECT (widget), SESSION_NAME);
s = g_strdup_printf (_("%s session selected"), session_name (cursess)); s = g_strdup_printf (_("%s session selected"), gdm_session_name (cursess));
gtk_label_set_text (GTK_LABEL (msg), s); gtk_label_set_text (GTK_LABEL (msg), s);
g_free (s); g_free (s);
...@@ -1401,11 +1391,12 @@ gdm_login_session_handler (GtkWidget *widget) ...@@ -1401,11 +1391,12 @@ gdm_login_session_handler (GtkWidget *widget)
login_window_resize (FALSE /* force */); login_window_resize (FALSE /* force */);
} }
static void static void
gdm_login_session_init (GtkWidget *menu) gdm_login_session_init (GtkWidget *menu)
{ {
GSList *sessgrp = NULL; GSList *sessgrp = NULL;
GdmSession *session = NULL;
GList *tmp;
GtkWidget *item; GtkWidget *item;
DIR *sessdir; DIR *sessdir;
struct dirent *dent; struct dirent *dent;
...@@ -1413,6 +1404,8 @@ gdm_login_session_init (GtkWidget *menu) ...@@ -1413,6 +1404,8 @@ gdm_login_session_init (GtkWidget *menu)
int num = 1; int num = 1;
int i; int i;
char **vec; char **vec;
char *label;
char *name;
gboolean some_dir_exists = FALSE; gboolean some_dir_exists = FALSE;
cursess = NULL; cursess = NULL;
...@@ -1441,8 +1434,28 @@ gdm_login_session_init (GtkWidget *menu) ...@@ -1441,8 +1434,28 @@ gdm_login_session_init (GtkWidget *menu)
} }
sessnames = g_hash_table_new (g_str_hash, g_str_equal); sessnames = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_insert (sessnames, GDM_SESSION_FAILSAFE_GNOME, _("Failsafe GNOME"));
g_hash_table_insert (sessnames, GDM_SESSION_FAILSAFE_XTERM, _("Failsafe xterm")); if (GdmShowGnomeFailsafeSession) {
session = g_new0 (GdmSession, 1);
session->name = g_strdup (_("Failsafe _Gnome"));
session->comment = g_strdup (_("This is a failsafe session that will log you "
"into GNOME. No startup scripts will be read "
"and it is only to be used when you can't log "
"in otherwise. GNOME will use the 'Default' "
"session."));
g_hash_table_insert (sessnames, g_strdup (GDM_SESSION_FAILSAFE_GNOME), session);
}
if (GdmShowXtermFailsafeSession) {
session = g_new0 (GdmSession, 1);
session->name = g_strdup (_("Failsafe _Terminal"));
session->comment = g_strdup (_("This is a failsafe session that will log you "
"into a terminal. No startup scripts will be read "
"and it is only to be used when you can't log "
"in otherwise. To exit the terminal, "
"type 'exit'."));
g_hash_table_insert (sessnames, g_strdup (GDM_SESSION_FAILSAFE_XTERM), session);
}
vec = g_strsplit (GdmSessionDir, ":", -1); vec = g_strsplit (GdmSessionDir, ":", -1);
for (i = 0; vec != NULL && vec[i] != NULL; i++) { for (i = 0; vec != NULL && vec[i] != NULL; i++) {
...@@ -1465,10 +1478,8 @@ gdm_login_session_init (GtkWidget *menu) ...@@ -1465,10 +1478,8 @@ gdm_login_session_init (GtkWidget *menu)
while (dent != NULL) { while (dent != NULL) {
VeConfig *cfg; VeConfig *cfg;
char *exec; char *exec;
char *name;
char *comment; char *comment;
char *s; char *s;
char *label;
char *tryexec; char *tryexec;
char *ext; char *ext;
...@@ -1491,7 +1502,9 @@ gdm_login_session_init (GtkWidget *menu) ...@@ -1491,7 +1502,9 @@ gdm_login_session_init (GtkWidget *menu)
g_free (s); g_free (s);
if (ve_config_get_bool (cfg, "Desktop Entry/Hidden=false")) { if (ve_config_get_bool (cfg, "Desktop Entry/Hidden=false")) {
g_hash_table_insert (sessnames, g_strdup (dent->d_name), "foo"); session = g_new0 (GdmSession, 1);
session->name = "foo";
g_hash_table_insert (sessnames, g_strdup (dent->d_name), session);
ve_config_destroy (cfg); ve_config_destroy (cfg);
dent = readdir (sessdir); dent = readdir (sessdir);
continue; continue;
...@@ -1501,7 +1514,10 @@ gdm_login_session_init (GtkWidget *menu) ...@@ -1501,7 +1514,10 @@ gdm_login_session_init (GtkWidget *menu)
if ( ! ve_string_empty (tryexec)) { if ( ! ve_string_empty (tryexec)) {
char *full = g_find_program_in_path (tryexec); char *full = g_find_program_in_path (tryexec);
if (full == NULL) { if (full == NULL) {
g_hash_table_insert (sessnames, g_strdup (dent->d_name), "foo"); session = g_new0 (GdmSession, 1);
session->name = "foo";
g_hash_table_insert (sessnames, g_strdup (dent->d_name),
session);
g_free (tryexec); g_free (tryexec);
ve_config_destroy (cfg); ve_config_destroy (cfg);
dent = readdir (sessdir); dent = readdir (sessdir);
...@@ -1518,7 +1534,9 @@ gdm_login_session_init (GtkWidget *menu) ...@@ -1518,7 +1534,9 @@ gdm_login_session_init (GtkWidget *menu)
ve_config_destroy (cfg); ve_config_destroy (cfg);
if G_UNLIKELY (ve_string_empty (exec) || ve_string_empty (name)) { if G_UNLIKELY (ve_string_empty (exec) || ve_string_empty (name)) {
g_hash_table_insert (sessnames, g_strdup (dent->d_name), "foo"); session = g_new0 (GdmSession, 1);
session->name = "foo";
g_hash_table_insert (sessnames, g_strdup (dent->d_name), session);
g_free (exec); g_free (exec);
g_free (name); g_free (name);
g_free (comment); g_free (comment);
...@@ -1526,31 +1544,6 @@ gdm_login_session_init (GtkWidget *menu) ...@@ -1526,31 +1544,6 @@ gdm_login_session_init (GtkWidget *menu)
continue; continue;
} }
if (num < 10)
label = g_strdup_printf ("_%d. %s", num, name);
else
label = g_strdup (name);
num ++;
item = gtk_radio_menu_item_new_with_mnemonic (sessgrp, label);
g_free (label);
g_object_set_data_full (G_OBJECT (item),
SESSION_NAME,
g_strdup (dent->d_name),
(GDestroyNotify) g_free);
if ( ! ve_string_empty (comment))
gtk_tooltips_set_tip
(tooltips, GTK_WIDGET (item), comment, NULL);
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 we found the default session */
if ( ! ve_string_empty (GdmDefaultSession) && if ( ! ve_string_empty (GdmDefaultSession) &&
strcmp (dent->d_name, GdmDefaultSession) == 0) { strcmp (dent->d_name, GdmDefaultSession) == 0) {
...@@ -1575,11 +1568,12 @@ gdm_login_session_init (GtkWidget *menu) ...@@ -1575,11 +1568,12 @@ gdm_login_session_init (GtkWidget *menu)
} }
g_hash_table_insert (sessnames, g_strdup (dent->d_name), name); session = g_new0 (GdmSession, 1);
session->name = name;
session->comment = comment;
g_hash_table_insert (sessnames, g_strdup (dent->d_name), session);
g_free (exec); g_free (exec);
g_free (comment); g_free (comment);
dent = readdir (sessdir); dent = readdir (sessdir);
} }
...@@ -1591,69 +1585,78 @@ gdm_login_session_init (GtkWidget *menu) ...@@ -1591,69 +1585,78 @@ gdm_login_session_init (GtkWidget *menu)
/* Check that session dir is readable */ /* Check that session dir is readable */
if G_UNLIKELY ( ! some_dir_exists) { if G_UNLIKELY ( ! some_dir_exists) {
syslog (LOG_ERR, _("%s: Session directory %s not found!"), "gdm_login_session_init", ve_sure_string (GdmSessionDir)); syslog (LOG_ERR, _("%s: Session directory %s not found!"),
"gdm_login_session_init", ve_sure_string (GdmSessionDir));
GdmShowXtermFailsafeSession = TRUE; GdmShowXtermFailsafeSession = TRUE;
session_dir_whacked_out = TRUE; session_dir_whacked_out = TRUE;
} }
if G_UNLIKELY (sessions == NULL) { if G_UNLIKELY (g_hash_table_size (sessnames) == 0) {
syslog (LOG_WARNING, _("Yikes, nothing found in the session directory.")); syslog (LOG_WARNING, _("Yikes, nothing found in the session directory."));
session_dir_whacked_out = TRUE; session_dir_whacked_out = TRUE;
GdmShowXtermFailsafeSession = TRUE; GdmShowXtermFailsafeSession = TRUE;
defsess = g_strdup (GDM_SESSION_FAILSAFE_GNOME); defsess = g_strdup (GDM_SESSION_FAILSAFE_GNOME);
} }
if (GdmShowGnomeFailsafeSession) { if (GdmShowGnomeFailsafeSession) {
/* For translators: This is the failsafe login when the user session = g_new0 (GdmSession, 1);
* can't login otherwise */ session->name = g_strdup (_("Failsafe _Gnome"));
item = gtk_radio_menu_item_new_with_mnemonic (sessgrp, session->comment = g_strdup (_("This is a failsafe session that will log you "
_("Failsafe _GNOME")); "into GNOME. No startup scripts will be read "
gtk_tooltips_set_tip (tooltips, GTK_WIDGET (item),
_("This is a failsafe session that will log you "
"into GNOME. No startup scripts will be read "
"and it is only to be used when you can't log " "and it is only to be used when you can't log "
"in otherwise. GNOME will use the 'Default' " "in otherwise. GNOME will use the 'Default' "
"session."), "session."));
NULL); g_hash_table_insert (sessnames, g_strdup (GDM_SESSION_FAILSAFE_GNOME), session);
g_object_set_data (G_OBJECT (item),
SESSION_NAME, GDM_SESSION_FAILSAFE_GNOME);
sessgrp = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
sessions = g_slist_append (sessions,
g_strdup (GDM_SESSION_FAILSAFE_GNOME));
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 (GdmShowXtermFailsafeSession) { if (GdmShowXtermFailsafeSession) {
/* For translators: This is the failsafe login when the user session = g_new0 (GdmSession, 1);
* can't login otherwise */ session->name = g_strdup (_("Failsafe _Terminal"));
item = gtk_radio_menu_item_new_with_mnemonic (sessgrp, session->comment = g_strdup (_("This is a failsafe session that will log you "
_("Failsafe _Terminal")); "into a terminal. No startup scripts will be read "
gtk_tooltips_set_tip (tooltips, GTK_WIDGET (item), "and it is only to be used when you can't log "
_("This is a failsafe session that will log you " "in otherwise. To exit the terminal, "
"into a terminal. No startup scripts will be read " "type 'exit'."));
"and it is only to be used when you can't log " g_hash_table_insert (sessnames, g_strdup (GDM_SESSION_FAILSAFE_XTERM), session);
"in otherwise. To exit the terminal, " }
"type 'exit'."),
NULL);
g_object_set_data (G_OBJECT (item),
SESSION_NAME, GDM_SESSION_FAILSAFE_XTERM);
sessgrp = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); /* Convert to list (which is unsorted) */
sessions = g_slist_append (sessions, g_hash_table_foreach (sessnames, (GHFunc) gdm_session_list_from_hash_table_func, &sessions);
g_strdup (GDM_SESSION_FAILSAFE_XTERM));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); /* Prioritize and sort the list */
g_signal_connect (G_OBJECT (item), "activate", sessions = g_list_sort (sessions, (GCompareFunc) gdm_session_sort_func);
G_CALLBACK (gdm_login_session_handler),
NULL); for (tmp = sessions; tmp != NULL; tmp = tmp->next) {
gtk_widget_show (GTK_WIDGET (item)); GdmSession *session;
char *file;
file = (char *) tmp->data;
session = g_hash_table_lookup (sessnames, file);
if (num < 10 &&
(strcmp (file, GDM_SESSION_FAILSAFE_GNOME) != 0) &&
(strcmp (file, GDM_SESSION_FAILSAFE_XTERM) != 0))
label = g_strdup_printf ("_%d. %s", num, session->name);
else
label = g_strdup (session->name);
num ++;
item = gtk_radio_menu_item_new_with_mnemonic (sessgrp, label);
g_free (label);
g_object_set_data_full (G_OBJECT (item), SESSION_NAME,
g_strdup (file), (GDestroyNotify) g_free);
if ( ! ve_string_empty (session->comment))
gtk_tooltips_set_tip
(tooltips, GTK_WIDGET (item), session->comment, NULL);
sessgrp = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
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 G_UNLIKELY (defsess == NULL) { if G_UNLIKELY (defsess == NULL) {
defsess = g_strdup (GDM_SESSION_FAILSAFE_GNOME); defsess = g_strdup (GDM_SESSION_FAILSAFE_GNOME);
syslog (LOG_WARNING, _("No default session link found. Using Failsafe GNOME.\n")); syslog (LOG_WARNING, _("No default session link found. Using Failsafe GNOME.\n"));
...@@ -2151,7 +2154,7 @@ gdm_login_ctrl_handler (GIOChannel *source, GIOCondition cond, gint fd) ...@@ -2151,7 +2154,7 @@ gdm_login_ctrl_handler (GIOChannel *source, GIOCondition cond, gint fd)
gtk_widget_show (GTK_WIDGET (label)); gtk_widget_show (GTK_WIDGET (label));
gtk_entry_set_text (GTK_ENTRY (entry), ""); gtk_entry_set_text (GTK_ENTRY (entry), "");
gtk_entry_set_max_length (GTK_ENTRY (entry), PAM_MAX_RESP_SIZE); gtk_entry_set_max_length (GTK_ENTRY (entry), PW_ENTRY_SIZE);
gtk_entry_set_visibility (GTK_ENTRY (entry), TRUE); gtk_entry_set_visibility (GTK_ENTRY (entry), TRUE);