summaryrefslogtreecommitdiff
path: root/gui/gdmsession.c
diff options
context:
space:
mode:
authorBrian Cameron <Brian.Cameron@sun.com>2005-11-22 07:49:43 +0000
committerBrian Cameron <bcameron@src.gnome.org>2005-11-22 07:49:43 +0000
commitb68ffea6d293f7c453fb9b42c6c8b637d17ea326 (patch)
treef352faccc11772611193fe7fec8e8fa5ceeea8a9 /gui/gdmsession.c
parentb370db3d95e3df789286f5c44b8c0014d1c653ca (diff)
downloadgdm-b68ffea6d293f7c453fb9b42c6c8b637d17ea326.tar.gz
This further improves GDM configuration so that now only the GDM daemon
2005-11-21 Brian Cameron <Brian.Cameron@sun.com> This further improves GDM configuration so that now only the GDM daemon parses and manages the configuration file. Most client programs use the GET_CONFIG command to access needed data. This simplifies the configuration logic and puts all configuration parsing in one place and gets rid of a lot of global variables that were making the code look messy. This also gets rid of several places where gnome_config deprecated functions were being used. I have cleaned up the code so that the vicious-extensions code is more localized in gui/gdmconfig.[ch]. Some work is left to do: gdmflexiserver still uses gnome_config functions and gdmconfig should use the new functions for reading from the configuration file. Some compile issues fixed as highlghted by dmacks@netspace.org to fix bug #322083. * NEWS: Fixed comment. * daemon/gdm.h: Further cleanup of #define's so that they better match the names of the config keys. * daemon/gdm.c: Now GET_CONFIG returns "OK" if the key is valid but has no value when it is a string. Now free return value from gdm_config_to_string. * daemon/Makefile.am, gui/greeter/Makefile.am: Now the daemon validates the greeter's theme directory, so pass the default value into the daemon and not the greeter. * daemon/gdmconfig.h: Added gdm_is_valid_key and corrected prototype for gdm_set_user_session_lang. * daemon/slave.c: Fix warning and compile errors. * daemon/gdmconfig.c: Further fleshed out. Now it supports a few additional keys I overlooked. It now validates all keys used by the slaves. Now handles translated string. Further refactored the code. * gui/Makefile.am: Added gdmconfig.[ch] to common library. * gui/gdmconfig.[ch]: New functions for accessing configuration data for slaves. * gui/gdmXnestchooser.c, gui/gdmlanguages.c, gui/gdmsession.h, gui/gdmuser.h, gui/gdmwm.c, gui/misc.c, gui/greeter/greeter_item_capslock.c: gui/greeter/greeter_item_pam.c: No longer include vicious.h/viciousui.h, instead gdmconfig.h. * gui/gdmcomm.c: Fix gdm_check_comm to no longer require passing in the config file name. * gui/gdmcommon.[ch]: Get rid of old gdm_common_*_same functions that are replaced with new gui/gdmconfig logic. Now functions that access config data use the new functions. * gui/gdmflexiserver.c: Now displays the localized string when you use GET_CONFIG to access a translatable string. * gui/gdmconfig.c: Now calls update_key in addition to update_greeters when updating greeter config data, since the daemon needs to update the values now when they change. * gui/gdmchooser.c, gui/gdmdynamic.c, gui/gdmlogin.c, gui/gdmphotosetup.c, gui/gdmsession.c, gui/gdmuser.c, gui/gdm/gdmXnestchooser.c, gui/greeter/greeter.c, gui/greeter/greeter_action_language.c, gui/greeter/greeter_canvas_item.c, gui/greeter/greeter_item.c, gui/greeter/greeter_item_customlist.c, gui/greeter/greeter_item_timed.c, gui/greeter/greeter_item_list.c, gui/greeter/greeter_parser.c, gui/greeter/greeter_session.c, gui/greeter/greeter_system.c: Updated to use new configuration functions. * vicious-extensions/glade-helper.c: Now include stdlib.h to avoid compiler warnings. * gui/greeter/greeter.c: Remove unused gdm_kill_thingies function.
Diffstat (limited to 'gui/gdmsession.c')
-rw-r--r--gui/gdmsession.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/gui/gdmsession.c b/gui/gdmsession.c
index e9900d57..acc5da6f 100644
--- a/gui/gdmsession.c
+++ b/gui/gdmsession.c
@@ -23,15 +23,16 @@
#include <unistd.h>
#include <dirent.h>
-#include <vicious.h>
#include <syslog.h>
#include <libgnome/libgnome.h>
#include <libgnomeui/libgnomeui.h>
+#include "vicious.h"
+
#include "gdm.h"
#include "gdmsession.h"
-#include "gdmwm.h"
+#include "gdmconfig.h"
GHashTable *sessnames = NULL;
gchar *default_session = NULL;
@@ -42,19 +43,14 @@ GList *sessions = NULL;
* in some way or another */
gboolean session_dir_whacked_out = FALSE;
-extern gchar *GdmDefaultSession;
-extern gboolean GdmShowGnomeFailsafeSession;
-extern gboolean GdmShowXtermFailsafeSession;
-extern gchar *GdmSessionDir;
-
gint
gdm_session_sort_func (const char *a, const char *b)
{
/* Put default and GNOME sessions at the top */
- if (strcmp (a, ve_sure_string (GdmDefaultSession)) == 0)
+ if (strcmp (a, ve_sure_string (gdm_config_get_string (GDM_KEY_DEFAULT_SESSION))) == 0)
return -1;
- if (strcmp (b, ve_sure_string (GdmDefaultSession)) == 0)
+ if (strcmp (b, ve_sure_string (gdm_config_get_string (GDM_KEY_DEFAULT_SESSION))) == 0)
return 1;
if (strcmp (a, "default.desktop") == 0)
@@ -116,6 +112,7 @@ gdm_session_list_init ()
GdmSession *session = NULL;
gboolean some_dir_exists = FALSE;
gboolean searching_for_default = TRUE;
+ gboolean show_xterm_failsafe;
struct dirent *dent;
char **vec;
char *name;
@@ -124,7 +121,7 @@ gdm_session_list_init ()
sessnames = g_hash_table_new (g_str_hash, g_str_equal);
- if (GdmShowGnomeFailsafeSession) {
+ if (gdm_config_get_bool (GDM_KEY_SHOW_GNOME_FAILSAFE)) {
session = g_new0 (GdmSession, 1);
session->name = g_strdup (_("Failsafe _GNOME"));
session->comment = g_strdup (_("This is a failsafe session that will log you "
@@ -135,7 +132,7 @@ gdm_session_list_init ()
g_hash_table_insert (sessnames, g_strdup (GDM_SESSION_FAILSAFE_GNOME), session);
}
- if (GdmShowXtermFailsafeSession) {
+ if (gdm_config_get_bool (GDM_KEY_SHOW_XTERM_FAILSAFE)) {
session = g_new0 (GdmSession, 1);
session->name = g_strdup (_("Failsafe _Terminal"));
session->comment = g_strdup (_("This is a failsafe session that will log you "
@@ -143,10 +140,12 @@ gdm_session_list_init ()
"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);
+ g_hash_table_insert (sessnames, g_strdup (GDM_SESSION_FAILSAFE_XTERM),
+ session);
}
- vec = g_strsplit (GdmSessionDir, ":", -1);
+ vec = g_strsplit (gdm_config_get_string (GDM_KEY_SESSION_DESKTOP_DIR),
+ ":", -1);
for (i = 0; vec != NULL && vec[i] != NULL; i++) {
const char *dir = vec[i];
@@ -234,8 +233,8 @@ gdm_session_list_init ()
}
/* if we found the default session */
- if ( ! ve_string_empty (GdmDefaultSession) &&
- strcmp (dent->d_name, GdmDefaultSession) == 0) {
+ if ( ! ve_string_empty (gdm_config_get_string (GDM_KEY_DEFAULT_SESSION)) &&
+ strcmp (dent->d_name, gdm_config_get_string (GDM_KEY_DEFAULT_SESSION)) == 0) {
g_free (default_session);
default_session = g_strdup (dent->d_name);
searching_for_default = FALSE;
@@ -275,19 +274,23 @@ gdm_session_list_init ()
/* Check that session dir is readable */
if G_UNLIKELY ( ! some_dir_exists) {
syslog (LOG_ERR, _("%s: Session directory %s not found!"),
- "gdm_login_session_init", ve_sure_string (GdmSessionDir));
- GdmShowXtermFailsafeSession = TRUE;
+ "gdm_login_session_init", ve_sure_string
+ (gdm_config_get_string (GDM_KEY_SESSION_DESKTOP_DIR)));
+ show_xterm_failsafe = TRUE;
session_dir_whacked_out = TRUE;
}
if G_UNLIKELY (g_hash_table_size (sessnames) == 0) {
syslog (LOG_WARNING, _("Yikes, nothing found in the session directory."));
session_dir_whacked_out = TRUE;
- GdmShowXtermFailsafeSession = TRUE;
+ show_xterm_failsafe = TRUE;
default_session = g_strdup (GDM_SESSION_FAILSAFE_GNOME);
}
- if (GdmShowGnomeFailsafeSession) {
+ if (gdm_config_get_bool (GDM_KEY_SHOW_XTERM_FAILSAFE))
+ show_xterm_failsafe = TRUE;
+
+ if (show_xterm_failsafe) {
session = g_new0 (GdmSession, 1);
session->name = g_strdup (_("Failsafe _GNOME"));
session->comment = g_strdup (_("This is a failsafe session that will log you "
@@ -298,7 +301,7 @@ gdm_session_list_init ()
g_hash_table_insert (sessnames, g_strdup (GDM_SESSION_FAILSAFE_GNOME), session);
}
- if (GdmShowXtermFailsafeSession) {
+ if (show_xterm_failsafe) {
session = g_new0 (GdmSession, 1);
session->name = g_strdup (_("Failsafe _Terminal"));
session->comment = g_strdup (_("This is a failsafe session that will log you "