summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Jon McCann <mccann@src.gnome.org>2007-05-31 17:39:19 +0000
committerWilliam Jon McCann <mccann@src.gnome.org>2007-05-31 17:39:19 +0000
commite1a7b7cac426f81ea2ab60263907bd92032f1068 (patch)
treee56e4d76b7a386da0a4a4b7f3117bbf51f2b7873
parent7baf40f65e52c651aab4d2c7214672f24195a649 (diff)
downloadgdm-e1a7b7cac426f81ea2ab60263907bd92032f1068.tar.gz
Land the first shot at the new settings framework
svn path=/branches/mccann-gobject/; revision=4946
-rw-r--r--common/Makefile.am76
-rw-r--r--common/gdm-address.h2
-rw-r--r--common/gdm-common-config.c490
-rw-r--r--common/gdm-common-config.h75
-rw-r--r--common/gdm-common.h2
-rw-r--r--common/gdm-config.c1487
-rw-r--r--common/gdm-config.h212
-rw-r--r--common/gdm-marshal.list1
-rw-r--r--common/gdm-settings-backend.c186
-rw-r--r--common/gdm-settings-backend.h92
-rw-r--r--common/gdm-settings-client.c292
-rw-r--r--common/gdm-settings-client.h49
-rw-r--r--common/gdm-settings-desktop-backend.c251
-rw-r--r--common/gdm-settings-desktop-backend.h56
-rw-r--r--common/gdm-settings-direct.c243
-rw-r--r--common/gdm-settings-direct.h48
-rw-r--r--common/gdm-settings-keys.h196
-rw-r--r--common/gdm-settings-utils.c285
-rw-r--r--common/gdm-settings-utils.h53
-rw-r--r--common/gdm-settings.c242
-rw-r--r--common/gdm-settings.h80
-rw-r--r--common/gdm-settings.xml18
-rw-r--r--common/test-config.c303
-rw-r--r--common/test-settings-client.c75
-rw-r--r--common/test-settings-server.c168
-rw-r--r--configure.ac2
-rw-r--r--daemon/Makefile.am4
-rw-r--r--daemon/auth.c1
-rw-r--r--daemon/choose.c19
-rw-r--r--daemon/gdm-daemon-config-entries.h566
-rw-r--r--daemon/gdm-daemon-config-keys.h232
-rw-r--r--daemon/gdm-daemon-config.c2630
-rw-r--r--daemon/gdm-daemon-config.h107
-rw-r--r--daemon/gdm-greeter.c5
-rw-r--r--daemon/gdm-manager.c88
-rw-r--r--daemon/gdm-manager.h2
-rw-r--r--daemon/gdm-master-config.c941
-rw-r--r--daemon/gdm-master-config.h93
-rw-r--r--daemon/gdm-xdmcp-manager.c2
-rw-r--r--daemon/main.c44
-rw-r--r--data/Makefile.am38
-rw-r--r--data/gdm.schemas.in.in738
42 files changed, 3281 insertions, 7213 deletions
diff --git a/common/Makefile.am b/common/Makefile.am
index f28a0e89..d2c67322 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -21,21 +21,49 @@ INCLUDES = \
-DGDM_DEFAULTS_CONF=\"$(GDM_DEFAULTS_CONF)\" \
-DGDM_CUSTOM_CONF=\"$(GDM_CUSTOM_CONF)\" \
-DGDM_OLD_CONF=\"$(GDM_OLD_CONF)\" \
+ $(DBUS_CFLAGS) \
$(GLIB_CFLAGS)
noinst_LIBRARIES = \
libgdmcommon.a \
$(null)
+BUILT_SOURCES = \
+ gdm-settings-glue.h \
+ gdm-marshal.c \
+ gdm-marshal.h \
+ $(NULL)
+
+gdm-settings-glue.h: gdm-settings.xml Makefile.am
+ dbus-binding-tool --prefix=gdm_settings --mode=glib-server --output=gdm-settings-glue.h gdm-settings.xml
+
+gdm-marshal.c: gdm-marshal.list
+ echo "#include \"gdm-marshal.h\"" > $@ && \
+ @GLIB_GENMARSHAL@ $< --prefix=gdm_marshal --body >> $@
+
+gdm-marshal.h: gdm-marshal.list
+ @GLIB_GENMARSHAL@ $< --prefix=gdm_marshal --header > $@
+
libgdmcommon_a_SOURCES = \
gdm-address.h \
gdm-address.c \
+ gdm-marshal.c \
+ gdm-marshal.h \
gdm-common.h \
gdm-common.c \
- gdm-common-config.h \
- gdm-common-config.c \
- gdm-config.h \
- gdm-config.c \
+ gdm-settings.c \
+ gdm-settings.h \
+ gdm-settings-backend.c \
+ gdm-settings-backend.h \
+ gdm-settings-desktop-backend.c \
+ gdm-settings-desktop-backend.h \
+ gdm-settings-keys.h \
+ gdm-settings-utils.h \
+ gdm-settings-utils.c \
+ gdm-settings-direct.c \
+ gdm-settings-direct.h \
+ gdm-settings-client.h \
+ gdm-settings-client.c \
gdm-log.h \
gdm-log.c \
gdm-md5.h \
@@ -47,25 +75,45 @@ libgdmcommon_a_SOURCES = \
$(NULL)
noinst_PROGRAMS = \
- test-config \
+ test-settings-server \
+ test-settings-client \
test-log \
$(NULL)
-test_config_SOURCES = \
- $(top_builddir)/daemon/gdm-daemon-config-entries.h \
- test-config.c \
+test_log_SOURCES = \
+ test-log.c \
$(NULL)
-test_config_LDADD = \
+test_log_LDADD = \
libgdmcommon.a \
$(GLIB_LIBS) \
$(NULL)
-test_log_SOURCES = \
- test-log.c \
+test_settings_server_SOURCES = \
+ test-settings-server.c \
$(NULL)
-test_log_LDADD = \
- libgdmcommon.a \
- $(GLIB_LIBS) \
+test_settings_server_LDADD = \
+ libgdmcommon.a \
+ $(GLIB_LIBS) \
+ $(DBUS_LIBS) \
+ $(NULL)
+
+test_settings_client_SOURCES = \
+ test-settings-client.c \
+ $(NULL)
+
+test_settings_client_LDADD = \
+ libgdmcommon.a \
+ $(GLIB_LIBS) \
+ $(DBUS_LIBS) \
+ $(NULL)
+
+CLEANFILES = \
+ $(BUILT_SOURCES) \
+ $(NULL)
+
+EXTRA_DIST = \
+ gdm-settings.xml \
+ gdm-marshal.list \
$(NULL)
diff --git a/common/gdm-address.h b/common/gdm-address.h
index 14e1ef13..2c6ec2cf 100644
--- a/common/gdm-address.h
+++ b/common/gdm-address.h
@@ -38,7 +38,7 @@ G_BEGIN_DECLS
typedef struct _GdmAddress GdmAddress;
-GType gdm_address_get_type (void);
+GType gdm_address_get_type (void);
GdmAddress * gdm_address_new_from_sockaddr_storage (struct sockaddr_storage *ss);
diff --git a/common/gdm-common-config.c b/common/gdm-common-config.c
deleted file mode 100644
index 2bcc034a..00000000
--- a/common/gdm-common-config.c
+++ /dev/null
@@ -1,490 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <locale.h>
-#include <syslog.h>
-
-#include <glib.h>
-
-#include "gdm-common-config.h"
-
-gboolean
-gdm_common_config_parse_key_string (const char *keystring,
- char **group,
- char **key,
- char **locale,
- char **value)
-{
- char **split1;
- char **split2;
- char *g;
- char *k;
- char *l;
- char *v;
- char *tmp1;
- char *tmp2;
- gboolean ret;
-
- g_return_val_if_fail (keystring != NULL, FALSE);
-
- ret = FALSE;
- g = k = v = l = NULL;
- split1 = split2 = NULL;
-
- g_debug ("Attempting to parse key string: %s", keystring);
-
- split1 = g_strsplit (keystring, "/", 2);
- if (split1 == NULL || split1 [0] == NULL || split1 [1] == NULL) {
- goto out;
- }
-
- g = split1 [0];
-
- split2 = g_strsplit (split1 [1], "=", 2);
- if (split2 == NULL) {
- k = split1 [1];
- } else {
- k = split2 [0];
- v = split2 [1];
- }
-
- /* trim off the locale */
- tmp1 = strchr (k, '[');
- tmp2 = strchr (k, ']');
- if (tmp1 != NULL && tmp2 != NULL && tmp2 > tmp1) {
- l = g_strndup (tmp1 + 1, tmp2 - tmp1 - 1);
- *tmp1 = '\0';
- }
-
- ret = TRUE;
- out:
- if (group != NULL) {
- *group = g_strdup (g);
- }
- if (key != NULL) {
- *key = g_strdup (k);
- }
- if (locale != NULL) {
- *locale = g_strdup (l);
- }
- if (value != NULL) {
- *value = g_strdup (v);
- }
-
- g_strfreev (split1);
- g_strfreev (split2);
-
- return ret;
-}
-
-GKeyFile *
-gdm_common_config_load (const char *filename,
- GError **error)
-{
- GKeyFile *config;
- GError *local_error;
- gboolean res;
-
- config = g_key_file_new ();
-
- local_error = NULL;
- res = g_key_file_load_from_file (config,
- filename,
- G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
- &local_error);
- if (! res) {
- g_propagate_error (error, local_error);
- g_key_file_free (config);
- return NULL;
- }
-
- return config;
-}
-
-GKeyFile *
-gdm_common_config_load_from_dirs (const char *filename,
- const char **dirs,
- GError **error)
-{
- GKeyFile *config;
- int i;
-
- config = NULL;
-
- /* FIXME: hope to have g_key_file_load_from_dirs
- see GNOME bug #355334
- */
-
- for (i = 0; dirs[i] != NULL; i++) {
- char *path;
-
- path = g_build_filename (dirs[i], filename, NULL);
- config = gdm_common_config_load (path, NULL);
- g_free (path);
- if (config != NULL) {
- break;
- }
- }
-
- if (config == NULL) {
- g_set_error (error,
- G_KEY_FILE_ERROR,
- G_KEY_FILE_ERROR_NOT_FOUND,
- "Unable to find file in specified directories");
- }
-
- return config;
-}
-
-gboolean
-gdm_common_config_save (GKeyFile *config,
- const char *filename,
- GError **error)
-{
- GError *local_error;
- gboolean res;
- char *contents;
- gsize length;
-
- local_error = NULL;
- contents = g_key_file_to_data (config, &length, &local_error);
- if (local_error != NULL) {
- g_propagate_error (error, local_error);
- return FALSE;
- }
-
- local_error = NULL;
- res = g_file_set_contents (filename,
- contents,
- length,
- &local_error);
- if (local_error != NULL) {
- g_propagate_error (error, local_error);
- g_free (contents);
- return FALSE;
- }
-
- g_free (contents);
- return TRUE;
-}
-
-gboolean
-gdm_common_config_get_int (GKeyFile *config,
- const char *keystring,
- int *value,
- GError **error)
-{
- char *group;
- char *key;
- char *default_value;
- int val;
- GError *local_error;
- gboolean ret;
-
- ret = FALSE;
-
- group = key = default_value = NULL;
- if (! gdm_common_config_parse_key_string (keystring, &group, &key, NULL, &default_value))
- return FALSE;
-
- local_error = NULL;
- val = g_key_file_get_integer (config,
- group,
- key,
- &local_error);
- if (local_error != NULL) {
- /* use the default */
- if (default_value != NULL) {
- ret = TRUE;
- g_error_free (local_error);
- val = atoi (default_value);
- } else {
- val = 0;
- g_propagate_error (error, local_error);
- }
- } else {
- ret = TRUE;
- }
-
- *value = val;
-
- g_free (key);
- g_free (group);
- g_free (default_value);
-
- return ret;
-}
-
-gboolean
-gdm_common_config_get_translated_string (GKeyFile *config,
- const char *keystring,
- char **value,
- GError **error)
-{
- char *group;
- char *key;
- char *default_value;
- char *val;
- const char * const *langs;
- int i;
- gboolean ret;
-
- ret = FALSE;
-
- val = NULL;
-
- group = key = default_value = NULL;
- if (! gdm_common_config_parse_key_string (keystring, &group, &key, NULL, &default_value))
- return FALSE;
-
- langs = g_get_language_names ();
-
- for (i = 0; langs[i] != NULL; i++) {
- const char *locale;
- locale = langs[i];
-
- val = g_key_file_get_locale_string (config,
- group,
- key,
- locale,
- NULL);
- if (val != NULL) {
- break;
- }
- }
-
- if (val == NULL) {
- /* use the default */
- if (default_value != NULL) {
- val = g_strdup (default_value);
- ret = TRUE;
- }
- } else {
- ret = TRUE;
- }
-
- *value = val;
-
- g_free (key);
- g_free (group);
- g_free (default_value);
-
- return ret;
-}
-
-gboolean
-gdm_common_config_get_string (GKeyFile *config,
- const char *keystring,
- char **value,
- GError **error)
-{
- char *group;
- char *key;
- char *default_value;
- char *val;
- GError *local_error;
- gboolean ret;
-
- ret = FALSE;
-
- group = key = default_value = NULL;
- if (! gdm_common_config_parse_key_string (keystring, &group, &key, NULL, &default_value)) {
- g_set_error (error,
- G_KEY_FILE_ERROR,
- G_KEY_FILE_ERROR_PARSE,
- "Unable to parse key: %s",
- keystring);
- return FALSE;
- }
-
- local_error = NULL;
- val = g_key_file_get_string (config,
- group,
- key,
- &local_error);
- if (local_error != NULL) {
- /* use the default */
- if (default_value != NULL) {
- val = g_strdup (default_value);
- ret = TRUE;
- g_error_free (local_error);
- } else {
- g_propagate_error (error, local_error);
- }
- } else {
- ret = TRUE;
- }
-
- *value = val;
-
- g_free (key);
- g_free (group);
- g_free (default_value);
-
- return ret;
-}
-
-gboolean
-gdm_common_config_get_boolean (GKeyFile *config,
- const char *keystring,
- gboolean *value,
- GError **error)
-{
- char *group;
- char *key;
- char *default_value;
- gboolean val;
- GError *local_error;
- gboolean ret;
-
- ret = FALSE;
-
- group = key = default_value = NULL;
- if (! gdm_common_config_parse_key_string (keystring, &group, &key, NULL, &default_value))
- return FALSE;
-
- local_error = NULL;
- val = g_key_file_get_boolean (config,
- group,
- key,
- &local_error);
- if (local_error != NULL) {
- /* use the default */
- if (default_value != NULL) {
- if ((default_value[0] == 'T' ||
- default_value[0] == 't' ||
- default_value[0] == 'Y' ||
- default_value[0] == 'y' ||
- atoi (default_value) != 0)) {
- val = TRUE;
- } else {
- val = FALSE;
- }
- ret = TRUE;
- g_error_free (local_error);
- } else {
- g_propagate_error (error, local_error);
- }
- } else {
- ret = TRUE;
- }
-
- *value = val;
-
- g_free (key);
- g_free (group);
- g_free (default_value);
-
- return ret;
-}
-
-void
-gdm_common_config_set_string (GKeyFile *config,
- const char *keystring,
- const char *value)
-{
- char *group;
- char *key;
- char *default_value;
-
- group = key = default_value = NULL;
- if (! gdm_common_config_parse_key_string (keystring, &group, &key, NULL, &default_value)) {
- return;
- }
-
- g_key_file_set_string (config, group, key, value);
-
- g_free (key);
- g_free (group);
- g_free (default_value);
-}
-
-void
-gdm_common_config_set_boolean (GKeyFile *config,
- const char *keystring,
- gboolean value)
-{
- char *group;
- char *key;
- char *default_value;
-
- group = key = default_value = NULL;
- if (! gdm_common_config_parse_key_string (keystring, &group, &key, NULL, &default_value)) {
- return;
- }
-
- g_key_file_set_boolean (config, group, key, value);
-
- g_free (key);
- g_free (group);
- g_free (default_value);
-}
-
-void
-gdm_common_config_set_int (GKeyFile *config,
- const char *keystring,
- int value)
-{
- char *group;
- char *key;
- char *default_value;
-
- group = key = default_value = NULL;
- if (! gdm_common_config_parse_key_string (keystring, &group, &key, NULL, &default_value)) {
- return;
- }
-
- g_key_file_set_integer (config, group, key, value);
-
- g_free (key);
- g_free (group);
- g_free (default_value);
-}
-
-void
-gdm_common_config_remove_key (GKeyFile *config,
- const char *keystring,
- GError **error)
-{
- char *group;
- char *key;
- char *default_value;
- GError *local_error;
-
- group = key = default_value = NULL;
- if (! gdm_common_config_parse_key_string (keystring, &group, &key, NULL, &default_value)) {
- return;
- }
-
- local_error = NULL;
- g_key_file_remove_key (config, group, key, &local_error);
- if (local_error != NULL) {
- g_propagate_error (error, local_error);
- }
-
- g_free (key);
- g_free (group);
- g_free (default_value);
-}
diff --git a/common/gdm-common-config.h b/common/gdm-common-config.h
deleted file mode 100644
index b03ed46e..00000000
--- a/common/gdm-common-config.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _GDM_COMMON_CONFIG_H
-#define _GDM_COMMON_CONFIG_H
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-GKeyFile * gdm_common_config_load (const char *filename,
- GError **error);
-GKeyFile * gdm_common_config_load_from_dirs (const char *filename,
- const char **dirs,
- GError **error);
-gboolean gdm_common_config_save (GKeyFile *config,
- const char *filename,
- GError **error);
-
-gboolean gdm_common_config_get_string (GKeyFile *config,
- const char *keystring,
- char **value,
- GError **error);
-gboolean gdm_common_config_get_translated_string (GKeyFile *config,
- const char *keystring,
- char **value,
- GError **error);
-gboolean gdm_common_config_get_int (GKeyFile *config,
- const char *keystring,
- int *value,
- GError **error);
-gboolean gdm_common_config_get_boolean (GKeyFile *config,
- const char *keystring,
- gboolean *value,
- GError **error);
-gboolean gdm_common_config_parse_key_string (const char *keystring,
- char **group,
- char **key,
- char **locale,
- char **value);
-
-void gdm_common_config_set_string (GKeyFile *config,
- const char *keystring,
- const char *value);
-void gdm_common_config_set_boolean (GKeyFile *config,
- const char *keystring,
- gboolean value);
-void gdm_common_config_set_int (GKeyFile *config,
- const char *keystring,
- int value);
-
-void gdm_common_config_remove_key (GKeyFile *config,
- const char *keystring,
- GError **error);
-
-G_END_DECLS
-
-#endif /* _GDM_COMMON_CONFIG_H */
diff --git a/common/gdm-common.h b/common/gdm-common.h
index 66b04bf7..8b6b2fe8 100644
--- a/common/gdm-common.h
+++ b/common/gdm-common.h
@@ -33,8 +33,6 @@
#include <netdb.h>
#include "ve-signal.h"
-#include "gdm-common-config.h"
-#include "gdm-config.h"
G_BEGIN_DECLS
diff --git a/common/gdm-config.c b/common/gdm-config.c
deleted file mode 100644
index b21ab7ff..00000000
--- a/common/gdm-config.c
+++ /dev/null
@@ -1,1487 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <locale.h>
-#include <syslog.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-#include <glib.h>
-#include <glib/gstdio.h>
-#include <glib/gi18n.h>
-
-#include "gdm-config.h"
-
-struct _GdmConfig
-{
- char *mandatory_filename;
- char *default_filename;
- char *custom_filename;
-
- gboolean mandatory_loaded;
- gboolean default_loaded;
- gboolean custom_loaded;
-
- GKeyFile *mandatory_key_file;
- GKeyFile *default_key_file;
- GKeyFile *custom_key_file;
-
- time_t mandatory_mtime;
- time_t default_mtime;
- time_t custom_mtime;
-
- GPtrArray *entries;
-
- GHashTable *value_hash;
-
- GdmConfigFunc validate_func;
- gpointer validate_func_data;
- GdmConfigFunc notify_func;
- gpointer notify_func_data;
-};
-
-
-typedef struct _GdmConfigRealValue
-{
- GdmConfigValueType type;
- union {
- gboolean bool;
- int integer;
- char *str;
- char **array;
- } val;
-} GdmConfigRealValue;
-
-#define REAL_VALUE(x) ((GdmConfigRealValue *)(x))
-
-GQuark
-gdm_config_error_quark (void)
-{
- return g_quark_from_static_string ("gdm-config-error-quark");
-}
-
-GdmConfigEntry *
-gdm_config_entry_copy (const GdmConfigEntry *src)
-{
- GdmConfigEntry *dest;
-
- dest = g_new0 (GdmConfigEntry, 1);
- dest->group = g_strdup (src->group);
- dest->key = g_strdup (src->key);
- dest->default_value = g_strdup (src->default_value);
- dest->type = src->type;
- dest->id = src->id;
-
- return dest;
-}
-
-void
-gdm_config_entry_free (GdmConfigEntry *entry)
-{
- g_free (entry->group);
- g_free (entry->key);
- g_free (entry->default_value);
-
- g_free (entry);
-}
-
-GdmConfigValue *
-gdm_config_value_new (GdmConfigValueType type)
-{
- GdmConfigValue *value;
-
- g_return_val_if_fail (type != GDM_CONFIG_VALUE_INVALID, NULL);
-
- value = (GdmConfigValue *) g_slice_new0 (GdmConfigRealValue);
- value->type = type;
-
- return value;
-}
-
-void
-gdm_config_value_free (GdmConfigValue *value)
-{
- GdmConfigRealValue *real;
-
- real = REAL_VALUE (value);
-
- switch (real->type) {
- case GDM_CONFIG_VALUE_INVALID:
- case GDM_CONFIG_VALUE_BOOL:
- case GDM_CONFIG_VALUE_INT:
- break;
- case GDM_CONFIG_VALUE_STRING:
- case GDM_CONFIG_VALUE_LOCALE_STRING:
- g_free (real->val.str);
- break;
- case GDM_CONFIG_VALUE_STRING_ARRAY:
- case GDM_CONFIG_VALUE_LOCALE_STRING_ARRAY:
- g_strfreev (real->val.array);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- g_slice_free (GdmConfigRealValue, real);
-}
-
-static void
-set_string (char **dest,
- const char *src)
-{
- if (*dest != NULL) {
- g_free (*dest);
- }
-
- *dest = src ? g_strdup (src) : NULL;
-}
-
-static void
-set_string_array (char ***dest,
- const char **src)
-{
- if (*dest != NULL) {
- g_strfreev (*dest);
- }
-
- *dest = src ? g_strdupv ((char **)src) : NULL;
-}
-
-GdmConfigValue *
-gdm_config_value_copy (const GdmConfigValue *src)
-{
- GdmConfigRealValue *dest;
- GdmConfigRealValue *real;
-
- g_return_val_if_fail (src != NULL, NULL);
-
- real = REAL_VALUE (src);
- dest = REAL_VALUE (gdm_config_value_new (src->type));
-
- switch (real->type) {
- case GDM_CONFIG_VALUE_INT:
- case GDM_CONFIG_VALUE_BOOL:
- case GDM_CONFIG_VALUE_INVALID:
- dest->val = real->val;
- break;
- case GDM_CONFIG_VALUE_STRING:
- case GDM_CONFIG_VALUE_LOCALE_STRING:
- set_string (&dest->val.str, real->val.str);
- break;
- case GDM_CONFIG_VALUE_STRING_ARRAY:
- case GDM_CONFIG_VALUE_LOCALE_STRING_ARRAY:
- set_string_array (&dest->val.array, (const char **)real->val.array);
- break;
- default:
- g_assert_not_reached();
- }
-
- return (GdmConfigValue *) dest;
-}
-
-const char *
-gdm_config_value_get_string (const GdmConfigValue *value)
-{
- g_return_val_if_fail (value != NULL, NULL);
- g_return_val_if_fail (value->type == GDM_CONFIG_VALUE_STRING, NULL);
- return REAL_VALUE (value)->val.str;
-}
-
-const char *
-gdm_config_value_get_locale_string (const GdmConfigValue *value)
-{
- g_return_val_if_fail (value != NULL, NULL);
- g_return_val_if_fail (value->type == GDM_CONFIG_VALUE_LOCALE_STRING, NULL);
- return REAL_VALUE (value)->val.str;
-}
-
-const char **
-gdm_config_value_get_string_array (const GdmConfigValue *value)
-{
- g_return_val_if_fail (value != NULL, NULL);
- g_return_val_if_fail (value->type == GDM_CONFIG_VALUE_STRING_ARRAY, NULL);
- return (const char **)REAL_VALUE (value)->val.array;
-}
-
-gboolean
-gdm_config_value_get_bool (const GdmConfigValue *value)
-{
- g_return_val_if_fail (value != NULL, FALSE);
- g_return_val_if_fail (value->type == GDM_CONFIG_VALUE_BOOL, FALSE);
- return REAL_VALUE (value)->val.bool;
-}
-
-int
-gdm_config_value_get_int (const GdmConfigValue *value)
-{
- g_return_val_if_fail (value != NULL, 0);
- g_return_val_if_fail (value->type == GDM_CONFIG_VALUE_INT, 0);
- return REAL_VALUE (value)->val.integer;
-}
-
-static gint
-safe_strcmp (const char *a,
- const char *b)
-{
- return strcmp (a ? a : "", b ? b : "");
-}
-
-/* based on code from gconf */
-int
-gdm_config_value_compare (const GdmConfigValue *value_a,
- const GdmConfigValue *value_b)
-{
- g_return_val_if_fail (value_a != NULL, 0);
- g_return_val_if_fail (value_b != NULL, 0);
-
- if (value_a->type < value_b->type) {
- return -1;
- } else if (value_a->type > value_b->type) {
- return 1;
- }
-
- switch (value_a->type) {
- case GDM_CONFIG_VALUE_INT:
- if (gdm_config_value_get_int (value_a) < gdm_config_value_get_int (value_b)) {
- return -1;
- } else if (gdm_config_value_get_int (value_a) > gdm_config_value_get_int (value_b)) {
- return 1;
- } else {
- return 0;
- }
- case GDM_CONFIG_VALUE_STRING:
- return safe_strcmp (gdm_config_value_get_string (value_a),
- gdm_config_value_get_string (value_b));
- case GDM_CONFIG_VALUE_LOCALE_STRING:
- return safe_strcmp (gdm_config_value_get_locale_string (value_a),
- gdm_config_value_get_locale_string (value_b));
- case GDM_CONFIG_VALUE_STRING_ARRAY:
- case GDM_CONFIG_VALUE_LOCALE_STRING_ARRAY:
- {
- char *str_a;
- char *str_b;
- int res;
-
- str_a = gdm_config_value_to_string (value_a);
- str_b = gdm_config_value_to_string (value_a);
- res = safe_strcmp (str_a, str_b);
- g_free (str_a);
- g_free (str_b);
-
- return res;
- }
- case GDM_CONFIG_VALUE_BOOL:
- if (gdm_config_value_get_bool (value_a) == gdm_config_value_get_bool (value_b)) {
- return 0;
- } else if (gdm_config_value_get_bool (value_a)) {
- return 1;
- } else {
- return -1;
- }
- case GDM_CONFIG_VALUE_INVALID:
- default:
- g_assert_not_reached ();
- break;
- }
-
- return 0;
-}
-
-/* based on code from gconf */
-GdmConfigValue *
-gdm_config_value_new_from_string (GdmConfigValueType type,
- const char *value_str,
- GError **error)
-{
- GdmConfigValue *value;
-
- g_return_val_if_fail (type != GDM_CONFIG_VALUE_INVALID, NULL);
- g_return_val_if_fail (value_str != NULL, NULL);
-
- value = gdm_config_value_new (type);
-
- switch (value->type) {
- case GDM_CONFIG_VALUE_INT:
- {
- char* endptr = NULL;
- glong result;
-
- errno = 0;
- result = strtol (value_str, &endptr, 10);
- if (endptr == value_str) {
- g_set_error (error,
- GDM_CONFIG_ERROR,
- GDM_CONFIG_ERROR_PARSE_ERROR,
- _("Didn't understand `%s' (expected integer)"),
- value_str);
- gdm_config_value_free (value);
- value = NULL;
- } else if (errno == ERANGE) {
- g_set_error (error,
- GDM_CONFIG_ERROR,
- GDM_CONFIG_ERROR_PARSE_ERROR,
- _("Integer `%s' is too large or small"),
- value_str);
- gdm_config_value_free (value);
- value = NULL;
- } else {
- gdm_config_value_set_int (value, result);
- }
- }
- break;
- case GDM_CONFIG_VALUE_BOOL:
- switch (*value_str) {
- case 't':
- case 'T':
- case '1':
- case 'y':
- case 'Y':
- gdm_config_value_set_bool (value, TRUE);
- break;
-
- case 'f':
- case 'F':
- case '0':
- case 'n':
- case 'N':
- gdm_config_value_set_bool (value, FALSE);
- break;
- default:
- g_set_error (error,
- GDM_CONFIG_ERROR,
- GDM_CONFIG_ERROR_PARSE_ERROR,
- _("Didn't understand `%s' (expected true or false)"),
- value_str);
- gdm_config_value_free (value);
- value = NULL;
- break;
- }
- break;
- case GDM_CONFIG_VALUE_STRING:
- if (! g_utf8_validate (value_str, -1, NULL)) {
- g_set_error (error,
- GDM_CONFIG_ERROR,
- GDM_CONFIG_ERROR_PARSE_ERROR,
- _("Text contains invalid UTF-8"));
- gdm_config_value_free (value);
- value = NULL;
- } else {
- gdm_config_value_set_string (value, value_str);
- }
- break;
- case GDM_CONFIG_VALUE_LOCALE_STRING:
- if (! g_utf8_validate (value_str, -1, NULL)) {
- g_set_error (error,
- GDM_CONFIG_ERROR,
- GDM_CONFIG_ERROR_PARSE_ERROR,
- _("Text contains invalid UTF-8"));
- gdm_config_value_free (value);
- value = NULL;
- } else {
- gdm_config_value_set_locale_string (value, value_str);
- }
- break;
- case GDM_CONFIG_VALUE_STRING_ARRAY:
- if (! g_utf8_validate (value_str, -1, NULL)) {
- g_set_error (error,
- GDM_CONFIG_ERROR,
- GDM_CONFIG_ERROR_PARSE_ERROR,
- _("Text contains invalid UTF-8"));
- gdm_config_value_free (value);
- value = NULL;
- } else {
- char **split;
- split = g_strsplit (value_str, ";", -1);
- gdm_config_value_set_string_array (value, (const char **)split);
- g_strfreev (split);
- }
- break;
- case GDM_CONFIG_VALUE_LOCALE_STRING_ARRAY:
- if (! g_utf8_validate (value_str, -1, NULL)) {
- g_set_error (error,
- GDM_CONFIG_ERROR,
- GDM_CONFIG_ERROR_PARSE_ERROR,
- _("Text contains invalid UTF-8"));
- gdm_config_value_free (value);
- value = NULL;
- } else {
- char **split;
- split = g_strsplit (value_str, ";", -1);
- gdm_config_value_set_locale_string_array (value, (const char **)split);
- g_strfreev (split);
- }
- break;
- case GDM_CONFIG_VALUE_INVALID:
- default:
- g_assert_not_reached ();
- break;
- }
-
- return value;
-}
-
-void
-gdm_config_value_set_string_array (GdmConfigValue *value,
- const char **array)
-{
- GdmConfigRealValue *real;
-
- g_return_if_fail (value != NULL);
- g_return_if_fail (value->type == GDM_CONFIG_VALUE_STRING_ARRAY);
-
- real = REAL_VALUE (value);
-
- g_strfreev (real->val.array);
- real->val.array = g_strdupv ((char **)array);
-}
-
-void
-gdm_config_value_set_locale_string_array (GdmConfigValue *value,
- const char **array)
-{
- GdmConfigRealValue *real;
-
- g_return_if_fail (value != NULL);
- g_return_if_fail (value->type == GDM_CONFIG_VALUE_LOCALE_STRING_ARRAY);
-
- real = REAL_VALUE (value);
-
- g_strfreev (real->val.array);
- real->val.array = g_strdupv ((char **)array);
-}
-
-void
-gdm_config_value_set_int (GdmConfigValue *value,
- int integer)
-{
- GdmConfigRealValue *real;
-
- g_return_if_fail (value != NULL);
- g_return_if_fail (value->type == GDM_CONFIG_VALUE_INT);
-
- real = REAL_VALUE (value);
-
- real->val.integer = integer;
-}
-
-void
-gdm_config_value_set_bool (GdmConfigValue *value,
- gboolean bool)
-{
- GdmConfigRealValue *real;
-
- g_return_if_fail (value != NULL);
- g_return_if_fail (value->type == GDM_CONFIG_VALUE_BOOL);
-
- real = REAL_VALUE (value);
-
- real->val.bool = bool;
-}
-
-void
-gdm_config_value_set_string (GdmConfigValue *value,
- const char *str)
-{
- GdmConfigRealValue *real;
-
- g_return_if_fail (value != NULL);
- g_return_if_fail (value->type == GDM_CONFIG_VALUE_STRING);
-
- real = REAL_VALUE (value);
-
- g_free (real->val.str);
- real->val.str = g_strdup (str);
-}
-
-void
-gdm_config_value_set_locale_string (GdmConfigValue *value,
- const char *str)
-{
- GdmConfigRealValue *real;
-
- g_return_if_fail (value != NULL);
- g_return_if_fail (value->type == GDM_CONFIG_VALUE_LOCALE_STRING);
-
- real = REAL_VALUE (value);
-
- g_free (real->val.str);
- real->val.str = g_strdup (str);
-}
-
-char *
-gdm_config_value_to_string (const GdmConfigValue *value)
-{
- GdmConfigRealValue *real;
- char *ret;
-
- g_return_val_if_fail (value != NULL, NULL);
-
- ret = NULL;
- real = REAL_VALUE (value);
-
- switch (real->type) {
- case GDM_CONFIG_VALUE_INVALID:
- break;
- case GDM_CONFIG_VALUE_BOOL:
- ret = real->val.bool ? g_strdup ("true") : g_strdup ("false");
- break;
- case GDM_CONFIG_VALUE_INT:
- ret = g_strdup_printf ("%d", real->val.integer);
- break;
- case GDM_CONFIG_VALUE_STRING:
- case GDM_CONFIG_VALUE_LOCALE_STRING:
- ret = g_strdup (real->val.str);
- break;
- case GDM_CONFIG_VALUE_STRING_ARRAY:
- case GDM_CONFIG_VALUE_LOCALE_STRING_ARRAY:
- ret = g_strjoinv (";", real->val.array);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
- return ret;
-}
-
-static void
-gdm_config_init (GdmConfig *config)
-{
- config->entries = g_ptr_array_new ();
- config->value_hash = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- (GDestroyNotify)g_free,
- (GDestroyNotify)gdm_config_value_free);
-}
-
-GdmConfig *
-gdm_config_new (void)
-{
- GdmConfig *config;
-
- config = g_slice_new0 (GdmConfig);
- gdm_config_init (config);
-
- return config;
-}
-
-void
-gdm_config_free (GdmConfig *config)
-{
- g_return_if_fail (config != NULL);
-
- g_ptr_array_foreach (config->entries, (GFunc)gdm_config_entry_free, NULL);
- g_ptr_array_free (config->entries, TRUE);
-
- g_free (config->mandatory_filename);
- g_free (config->default_filename);
- g_free (config->custom_filename);
-
- if (config->mandatory_key_file != NULL) {
- g_key_file_free (config->mandatory_key_file);
- }
- if (config->default_key_file != NULL) {
- g_key_file_free (config->default_key_file);
- }
- if (config->custom_key_file != NULL) {
- g_key_file_free (config->custom_key_file);
- }
- if (config->value_hash != NULL) {
- g_hash_table_destroy (config->value_hash);
- }
-
- g_slice_free (GdmConfig, config);
-}
-
-const GdmConfigEntry *
-gdm_config_lookup_entry (GdmConfig *config,
- const char *group,
- const char *key)
-{
- int i;
- const GdmConfigEntry *entry;
-
- g_return_val_if_fail (config != NULL, NULL);
- g_return_val_if_fail (group != NULL, NULL);
- g_return_val_if_fail (key != NULL, NULL);
-
- entry = NULL;
-
- for (i = 0; i < config->entries->len; i++) {
- GdmConfigEntry *this;
- this = g_ptr_array_index (config->entries, i);
- if (strcmp (this->group, group) == 0
- && strcmp (this->key, key) == 0) {
- entry = (const GdmConfigEntry *)this;
- break;
- }
- }
-
- return entry;
-}
-
-const GdmConfigEntry *
-gdm_config_lookup_entry_for_id (GdmConfig *config,
- int id)
-{
- int i;
- const GdmConfigEntry *entry;
-
- g_return_val_if_fail (config != NULL, NULL);
-
- entry = NULL;
-
- for (i = 0; i < config->entries->len; i++) {
- GdmConfigEntry *this;
- this = g_ptr_array_index (config->entries, i);
- if (this->id == id) {
- entry = (const GdmConfigEntry *)this;
- break;
- }
- }
-
- return entry;
-}
-
-void
-gdm_config_add_entry (GdmConfig *config,
- const GdmConfigEntry *entry)
-{
- GdmConfigEntry *new_entry;
-
- g_return_if_fail (config != NULL);
- g_return_if_fail (entry != NULL);
-
- new_entry = gdm_config_entry_copy (entry);
- g_ptr_array_add (config->entries, new_entry);
-}
-
-void
-gdm_config_add_static_entries (GdmConfig *config,
- const GdmConfigEntry *entries)
-{
- int i;
-
- g_return_if_fail (config != NULL);
- g_return_if_fail (entries != NULL);
-
- for (i = 0; entries[i].group != NULL; i++) {
- gdm_config_add_entry (config, &entries[i]);
- }
-}
-
-void
-gdm_config_set_validate_func (GdmConfig *config,
- GdmConfigFunc func,
- gpointer data)
-{
- g_return_if_fail (config != NULL);
-
- config->validate_func = func;
- config->validate_func_data = data;
-}
-
-void
-gdm_config_set_mandatory_file (GdmConfig *config,
- const char *name)
-{
- g_return_if_fail (config != NULL);
-
- g_free (config->mandatory_filename);
- config->mandatory_filename = g_strdup (name);
-}
-
-void
-gdm_config_set_default_file (GdmConfig *config,
- const char *name)
-{
- g_return_if_fail (config != NULL);
-
- g_free (config->default_filename);
- config->default_filename = g_strdup (name);
-}
-
-void
-gdm_config_set_custom_file (GdmConfig *config,
- const char *name)
-{
- g_return_if_fail (config != NULL);
-
- g_free (config->custom_filename);
- config->custom_filename = g_strdup (name);
-}
-
-void
-gdm_config_set_notify_func (GdmConfig *config,
- GdmConfigFunc func,
- gpointer data)
-{
- g_return_if_fail (config != NULL);
-
- config->notify_func = func;
- config->notify_func_data = data;
-}
-
-static gboolean
-key_file_get_value (GdmConfig *config,
- GKeyFile *key_file,
- const char *group,
- const char *key,
- GdmConfigValueType type,
- GdmConfigValue **valuep)
-{
- char *val;
- GError *error;
- GdmConfigValue *value;
- gboolean ret;
-
- ret = FALSE;
- value = NULL;
-
- error = NULL;
- if (type == GDM_CONFIG_VALUE_LOCALE_STRING ||
- type == GDM_CONFIG_VALUE_LOCALE_STRING_ARRAY) {
- /* Use NULL locale to detect current locale */
- val = g_key_file_get_locale_string (key_file,
- group,
- key,
- NULL,
- &error);
- g_debug ("Loading locale string: %s %s", key, val ? val : "(null)");
-
- if (error != NULL) {
- g_debug ("%s", error->message);
- g_error_free (error);
- }
- if (val == NULL) {
- error = NULL;
- val = g_key_file_get_value (key_file,
- group,
- key,
- &error);
- g_debug ("Loading non-locale string: %s %s", key, val ? val : "(null)");
- }
- } else {
- val = g_key_file_get_value (key_file,
- group,
- key,
- &error);
- }
-
- if (error != NULL) {
- g_error_free (error);
- goto out;
- }
-
- if (val == NULL) {
- goto out;
- }
-
- error = NULL;
- value = gdm_config_value_new_from_string (type, val, &error);
- if (error != NULL) {
- g_warning ("%s", error->message);
- g_error_free (error);
- goto out;
- }
-
- ret = TRUE;
-
- out:
- *valuep = value;
-
- return ret;
-}
-
-static void
-entry_get_default_value (GdmConfig *config,
- const GdmConfigEntry *entry,
- GdmConfigValue **valuep)
-{
- GdmConfigValue *value;
- GError *error;
-
- error = NULL;
- value = gdm_config_value_new_from_string (entry->type,
- entry->default_value ? entry->default_value : "",
- &error);
- if (error != NULL) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
-
- *valuep = value;
-}
-
-static gboolean
-load_value_entry (GdmConfig *config,
- const GdmConfigEntry *entry,
- GdmConfigValue **valuep,
- GdmConfigSourceType *sourcep)
-{
- GdmConfigValue *value;
- GdmConfigSourceType source;
- gboolean ret;
- gboolean res;
-
- value = NULL;
-
- /* Look for the first occurence of the key in:
- mandatory file, custom file, default file, or built-in-default
- */
-
- if (config->mandatory_filename != NULL) {
- source = GDM_CONFIG_SOURCE_MANDATORY;
- res = key_file_get_value (config,
- config->mandatory_key_file,
- entry->group,
- entry->key,
- entry->type,
- &value);
- if (res) {
- goto done;
- }
- }
- if (config->custom_filename != NULL) {
- source = GDM_CONFIG_SOURCE_CUSTOM;
- res = key_file_get_value (config,
- config->custom_key_file,
- entry->group,
- entry->key,
- entry->type,
- &value);
- if (res) {
- goto done;
- }
- }
- if (config->default_filename != NULL) {
- source = GDM_CONFIG_SOURCE_DEFAULT;
- res = key_file_get_value (config,
- config->default_key_file,
- entry->group,
- entry->key,
- entry->type,
- &value);
- if (res) {
- goto done;
- }
- }
-
-
- source = GDM_CONFIG_SOURCE_BUILT_IN;
- entry_get_default_value (config, entry, &value);
-
- done:
-
- if (value != NULL) {
- ret = TRUE;
- } else {
- ret = FALSE;
- }
-
- *valuep = value;
- *sourcep = source;
-
- return ret;
-}
-
-static int
-lookup_id_for_key (GdmConfig *config,
- const char *group,
- const char *key)
-{
- int id;
- const GdmConfigEntry *entry;
-
- id = GDM_CONFIG_INVALID_ID;
- entry = gdm_config_lookup_entry (config, group, key);
- if (entry != NULL) {
- id = entry->id;
- }
-
- return id;
-}
-
-static void
-internal_set_value (GdmConfig *config,
- GdmConfigSourceType source,
- const char *group,
- const char *key,
- GdmConfigValue *value)
-{
- char *key_path;
- int id;
- GdmConfigValue *v;
- gboolean res;
-
- g_return_if_fail (config != NULL);
-
- key_path = g_strdup_printf ("%s/%s", group, key);
-
- v = NULL;
- res = g_hash_table_lookup_extended (config->value_hash,
- key_path,
- NULL,
- (gpointer *)&v);
-
- if (res) {
- if (v != NULL && gdm_config_value_compare (v, value) == 0) {
- /* value is the same - don't update */
- goto out;
- }
- }
-
- g_hash_table_insert (config->value_hash,
- g_strdup (key_path),
- gdm_config_value_copy (value));
-
- id = lookup_id_for_key (config, group, key);
-
- if (config->notify_func) {
- (* config->notify_func) (config, source, group, key, value, id, config->notify_func_data);
- }
- out:
- g_free (key_path);
-}
-
-static void
-store_entry_value (GdmConfig *config,
- const GdmConfigEntry *entry,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- internal_set_value (config, source, entry->group, entry->key, value);
-}
-
-static gboolean
-load_entry (GdmConfig *config,
- const GdmConfigEntry *entry)
-{
- GdmConfigValue *value;
- GdmConfigSourceType source;
- gboolean res;
-
- value = NULL;
- source = GDM_CONFIG_SOURCE_INVALID;
-
- res = load_value_entry (config, entry, &value, &source);
- if (!res) {
- return FALSE;
- }
-
- res = TRUE;
- if (config->validate_func) {
- res = (* config->validate_func) (config, source, entry->group, entry->key, value, entry->id, config->validate_func_data);
- }
-
- if (res) {
- /* store runs notify */
- store_entry_value (config, entry, source, value);
- }
-
- return TRUE;
-}
-
-static void
-add_keys_to_hash (GKeyFile *key_file,
- const char *group_name,
- GHashTable *hash)
-{
- GError *local_error;
- char **keys;
- gsize len;
- int i;
-
- local_error = NULL;
- len = 0;
- keys = g_key_file_get_keys (key_file,
- group_name,
- &len,
- &local_error);
- if (local_error != NULL) {
- g_error_free (local_error);
- return;
- }
-
- for (i = 0; i < len; i++) {
- g_hash_table_insert (hash, keys[i], GINT_TO_POINTER (1));
- }
-}
-
-static void
-collect_hash_keys (const char *key,
- gpointer value,
- GPtrArray **array)
-{
- g_message ("Adding %s", key);
- g_ptr_array_add (*array, g_strdup (key));
-}
-
-char **
-gdm_config_get_keys_for_group (GdmConfig *config,
- const char *group,
- gsize *length,
- GError **error)
-{
- GHashTable *hash;
- gsize len;
- GPtrArray *array;
-
- hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-
- if (config->mandatory_filename != NULL) {
- add_keys_to_hash (config->mandatory_key_file, group, hash);
- }
-
- if (config->default_filename != NULL) {
- add_keys_to_hash (config->default_key_file, group, hash);
- }
-
- if (config->custom_filename != NULL) {
- add_keys_to_hash (config->custom_key_file, group, hash);
- }
-
- len = g_hash_table_size (hash);
- array = g_ptr_array_sized_new (len);
-
- g_hash_table_foreach (hash, (GHFunc)collect_hash_keys, &array);
- g_ptr_array_add (array, NULL);
-
- g_hash_table_destroy (hash);
-
- if (length != NULL) {
- *length = array->len - 1;
- }
-
- return (char **)g_ptr_array_free (array, FALSE);
-}
-
-static gboolean
-load_backend (GdmConfig *config,
- const char *filename,
- GKeyFile **key_file,
- time_t *mtime)
-{
- GError *local_error;
- gboolean res;
- gboolean ret;
- struct stat statbuf;
- GKeyFile *kf;
- time_t lmtime;
-
- if (filename == NULL) {
- return FALSE;
- }
-
- if (g_stat (filename, &statbuf) != 0) {
- return FALSE;
- }
- lmtime = statbuf.st_mtime;
-
- /* if already loaded check whether reload is necessary */
- if (*key_file != NULL) {
- if (lmtime > *mtime) {
- /* needs an update */
- g_key_file_free (*key_file);
- } else {
- /* no reload necessary so we're done */
- return TRUE;
- }
- }
-
- kf = g_key_file_new ();
-
- local_error = NULL;
- res = g_key_file_load_from_file (kf,
- filename,
- G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
- &local_error);
- if (! res) {
- g_error_free (local_error);
- g_key_file_free (kf);
- kf = NULL;
- lmtime = 0;
- ret = FALSE;
- } else {
- ret = TRUE;
- }
-
- *key_file = kf;
- *mtime = lmtime;
-
- return ret;
-}
-
-gboolean
-gdm_config_load (GdmConfig *config,
- GError **error)
-{
- g_return_val_if_fail (config != NULL, FALSE);
-
- config->mandatory_loaded = load_backend (config,
- config->mandatory_filename,
- &config->mandatory_key_file,
- &config->mandatory_mtime);
- config->default_loaded = load_backend (config,
- config->default_filename,
- &config->default_key_file,
- &config->default_mtime);
- config->custom_loaded = load_backend (config,
- config->custom_filename,
- &config->custom_key_file,
- &config->custom_mtime);
-
- return TRUE;
-}
-
-static gboolean
-process_entries (GdmConfig *config,
- const GdmConfigEntry **entries,
- gsize n_entries,
- GError **error)
-{
- gboolean ret;
- int i;
-
- ret = TRUE;
-
- for (i = 0; i < n_entries; i++) {
- load_entry (config, entries[i]);
- }
-
- return ret;
-}
-
-gboolean
-gdm_config_process_entry (GdmConfig *config,
- const GdmConfigEntry *entry,
- GError **error)
-{
- gboolean ret;
-
- g_return_val_if_fail (config != NULL, FALSE);
- g_return_val_if_fail (entry != NULL, FALSE);
-
- ret = load_entry (config, entry);
-
- return ret;
-}
-
-gboolean
-gdm_config_process_entries (GdmConfig *config,
- const GdmConfigEntry **entries,
- gsize n_entries,
- GError **error)
-{
- gboolean ret;
-
- g_return_val_if_fail (config != NULL, FALSE);
- g_return_val_if_fail (entries != NULL, FALSE);
- g_return_val_if_fail (n_entries > 0, FALSE);
-
- ret = process_entries (config, entries, n_entries, error);
-
- return ret;
-}
-
-gboolean
-gdm_config_process_all (GdmConfig *config,
- GError **error)
-{
- gboolean ret;
-
- g_return_val_if_fail (config != NULL, FALSE);
-
- ret = process_entries (config,
- (const GdmConfigEntry **)config->entries->pdata,
- config->entries->len,
- error);
-
- return ret;
-}
-
-gboolean
-gdm_config_peek_value (GdmConfig *config,
- const char *group,
- const char *key,
- const GdmConfigValue **valuep)
-{
- gboolean ret;
- char *key_path;
- const GdmConfigValue *value;
-
- g_return_val_if_fail (config != NULL, FALSE);
-
- key_path = g_strdup_printf ("%s/%s", group, key);
- value = NULL;
- ret = g_hash_table_lookup_extended (config->value_hash,
- key_path,
- NULL,
- (gpointer *)&value);
- g_free (key_path);
-
- if (valuep != NULL) {
- if (ret) {
- *valuep = value;
- } else {
- *valuep = NULL;
- }
- }
-
- return ret;
-}
-
-gboolean
-gdm_config_get_value (GdmConfig *config,
- const char *group,
- const char *key,
- GdmConfigValue **valuep)
-{
- gboolean res;
- const GdmConfigValue *value;
-
- res = gdm_config_peek_value (config, group, key, &value);
- if (valuep != NULL) {
- *valuep = (value == NULL) ? NULL : gdm_config_value_copy (value);
- }
-
- return res;
-}
-
-gboolean
-gdm_config_set_value (GdmConfig *config,
- const char *group,
- const char *key,
- GdmConfigValue *value)
-{
- g_return_val_if_fail (config != NULL, FALSE);
- g_return_val_if_fail (group != NULL, FALSE);
- g_return_val_if_fail (key != NULL, FALSE);
- g_return_val_if_fail (value != NULL, FALSE);
-
- internal_set_value (config, GDM_CONFIG_SOURCE_RUNTIME_USER, group, key, value);
-
- return TRUE;
-}
-
-static gboolean
-gdm_config_peek_value_for_id (GdmConfig *config,
- int id,
- const GdmConfigValue **valuep)
-{
- const GdmConfigEntry *entry;
-
- g_return_val_if_fail (config != NULL, FALSE);
-
- entry = gdm_config_lookup_entry_for_id (config, id);
- if (entry == NULL) {
- return FALSE;
- }
-
- return gdm_config_peek_value (config, entry->group, entry->key, valuep);
-}
-
-gboolean
-gdm_config_get_value_for_id (GdmConfig *config,
- int id,
- GdmConfigValue **valuep)
-{
- const GdmConfigEntry *entry;
-
- g_return_val_if_fail (config != NULL, FALSE);
-
- entry = gdm_config_lookup_entry_for_id (config, id);
- if (entry == NULL) {
- return FALSE;
- }
-
- return gdm_config_get_value (config, entry->group, entry->key, valuep);
-}
-
-gboolean
-gdm_config_set_value_for_id (GdmConfig *config,
- int id,
- GdmConfigValue *valuep)
-{
- const GdmConfigEntry *entry;
-
- g_return_val_if_fail (config != NULL, FALSE);
-
- entry = gdm_config_lookup_entry_for_id (config, id);
- if (entry == NULL) {
- return FALSE;
- }
-
- return gdm_config_set_value (config, entry->group, entry->key, valuep);
-}
-
-gboolean
-gdm_config_peek_string_for_id (GdmConfig *config,
- int id,
- const char **strp)
-{
- const GdmConfigValue *value;
- const char *str;
- gboolean res;
-
- g_return_val_if_fail (config != NULL, FALSE);
-
- res = gdm_config_peek_value_for_id (config, id, &value);
- if (! res) {
- return FALSE;
- }
-
- str = gdm_config_value_get_string (value);
- if (strp != NULL) {
- *strp = str;
- }
-
- return res;
-}
-
-gboolean
-gdm_config_get_string_for_id (GdmConfig *config,
- int id,
- char **strp)
-{
- gboolean res;
- const char *str;
-
- res = gdm_config_peek_string_for_id (config, id, &str);
- if (strp != NULL) {
- *strp = g_strdup (str);
- }
-
- return res;
-}
-
-gboolean
-gdm_config_get_bool_for_id (GdmConfig *config,
- int id,
- gboolean *boolp)
-{
- GdmConfigValue *value;
- gboolean bool;
- gboolean res;
-
- g_return_val_if_fail (config != NULL, FALSE);
-
- res = gdm_config_get_value_for_id (config, id, &value);
- if (! res) {
- return FALSE;
- }
-
- bool = gdm_config_value_get_bool (value);
- if (boolp != NULL) {
- *boolp = bool;
- }
-
- gdm_config_value_free (value);
-
- return res;
-}
-
-gboolean
-gdm_config_get_int_for_id (GdmConfig *config,
- int id,
- int *integerp)
-{
- GdmConfigValue *value;
- gboolean integer;
- gboolean res;
-
- g_return_val_if_fail (config != NULL, FALSE);
-
- res = gdm_config_get_value_for_id (config, id, &value);
- if (! res) {
- return FALSE;
- }
-
- integer = gdm_config_value_get_int (value);
- if (integerp != NULL) {
- *integerp = integer;
- }
-
- gdm_config_value_free (value);
-
- return res;
-}
-
-gboolean
-gdm_config_set_string_for_id (GdmConfig *config,
- int id,
- char *str)
-{
- GdmConfigValue *value;
- gboolean res;
-
- g_return_val_if_fail (config != NULL, FALSE);
-
- value = gdm_config_value_new (GDM_CONFIG_VALUE_STRING);
- gdm_config_value_set_string (value, str);
-
- res = gdm_config_set_value_for_id (config, id, value);
- gdm_config_value_free (value);
-
- return res;
-}
-
-gboolean
-gdm_config_set_bool_for_id (GdmConfig *config,
- int id,
- gboolean bool)
-{
- GdmConfigValue *value;
- gboolean res;
-
- g_return_val_if_fail (config != NULL, FALSE);
-
- value = gdm_config_value_new (GDM_CONFIG_VALUE_BOOL);
- gdm_config_value_set_bool (value, bool);
-
- res = gdm_config_set_value_for_id (config, id, value);
- gdm_config_value_free (value);
-
- return res;
-}
-
-gboolean
-gdm_config_set_int_for_id (GdmConfig *config,
- int id,
- int integer)
-{
- GdmConfigValue *value;
- gboolean res;
-
- g_return_val_if_fail (config != NULL, FALSE);
-
- value = gdm_config_value_new (GDM_CONFIG_VALUE_INT);
- gdm_config_value_set_int (value, integer);
-
- res = gdm_config_set_value_for_id (config, id, value);
- gdm_config_value_free (value);
-
- return res;
-}
diff --git a/common/gdm-config.h b/common/gdm-config.h
deleted file mode 100644
index 5fc184c1..00000000
--- a/common/gdm-config.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _GDM_CONFIG_H
-#define _GDM_CONFIG_H
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-typedef struct _GdmConfig GdmConfig;
-
-typedef enum {
- GDM_CONFIG_VALUE_INVALID,
- GDM_CONFIG_VALUE_BOOL,
- GDM_CONFIG_VALUE_INT,
- GDM_CONFIG_VALUE_STRING,
- GDM_CONFIG_VALUE_LOCALE_STRING,
- GDM_CONFIG_VALUE_STRING_ARRAY,
- GDM_CONFIG_VALUE_LOCALE_STRING_ARRAY,
-} GdmConfigValueType;
-
-typedef enum {
- GDM_CONFIG_SOURCE_INVALID,
- GDM_CONFIG_SOURCE_MANDATORY,
- GDM_CONFIG_SOURCE_DEFAULT,
- GDM_CONFIG_SOURCE_CUSTOM,
- GDM_CONFIG_SOURCE_BUILT_IN,
- GDM_CONFIG_SOURCE_RUNTIME_USER,
-} GdmConfigSourceType;
-
-#define GDM_CONFIG_INVALID_ID -1
-
-struct _GdmConfigValue
-{
- GdmConfigValueType type;
-};
-
-typedef struct _GdmConfigValue GdmConfigValue;
-
-typedef gboolean (* GdmConfigFunc) (GdmConfig *config,
- GdmConfigSourceType source,
- const char *group,
- const char *key,
- GdmConfigValue *value,
- int id,
- gpointer data);
-
-typedef struct {
- char *group;
- char *key;
- GdmConfigValueType type;
- char *default_value;
- int id;
-} GdmConfigEntry;
-
-#define GDM_CONFIG_ERROR (gdm_config_error_quark ())
-
-typedef enum
-{
- GDM_CONFIG_ERROR_UNKNOWN_OPTION,
- GDM_CONFIG_ERROR_BAD_VALUE,
- GDM_CONFIG_ERROR_PARSE_ERROR,
- GDM_CONFIG_ERROR_FAILED
-} GdmConfigError;
-
-GQuark gdm_config_error_quark (void);
-
-GdmConfig * gdm_config_new (void);
-void gdm_config_free (GdmConfig *config);
-
-void gdm_config_set_validate_func (GdmConfig *config,
- GdmConfigFunc func,
- gpointer data);
-void gdm_config_set_notify_func (GdmConfig *config,
- GdmConfigFunc func,
- gpointer data);
-void gdm_config_set_default_file (GdmConfig *config,
- const char *name);
-void gdm_config_set_mandatory_file (GdmConfig *config,
- const char *name);
-void gdm_config_set_custom_file (GdmConfig *config,
- const char *name);
-void gdm_config_add_entry (GdmConfig *config,
- const GdmConfigEntry *entry);
-void gdm_config_add_static_entries (GdmConfig *config,
- const GdmConfigEntry *entries);
-const GdmConfigEntry * gdm_config_lookup_entry (GdmConfig *config,
- const char *group,
- const char *key);
-const GdmConfigEntry * gdm_config_lookup_entry_for_id (GdmConfig *config,
- int id);
-
-gboolean gdm_config_load (GdmConfig *config,
- GError **error);
-gboolean gdm_config_process_all (GdmConfig *config,
- GError **error);
-gboolean gdm_config_process_entry (GdmConfig *config,
- const GdmConfigEntry *entry,
- GError **error);
-gboolean gdm_config_process_entries (GdmConfig *config,
- const GdmConfigEntry **entries,
- gsize n_entries,
- GError **error);
-
-gboolean gdm_config_save_custom_file (GdmConfig *config,
- GError **error);
-char ** gdm_config_get_keys_for_group (GdmConfig *config,
- const gchar *group_name,
- gsize *length,
- GError **error);
-
-gboolean gdm_config_peek_value (GdmConfig *config,
- const char *group,
- const char *key,
- const GdmConfigValue **value);
-gboolean gdm_config_get_value (GdmConfig *config,
- const char *group,
- const char *key,
- GdmConfigValue **value);
-gboolean gdm_config_set_value (GdmConfig *config,
- const char *group,
- const char *key,
- GdmConfigValue *value);
-
-/* convenience functions */
-gboolean gdm_config_get_value_for_id (GdmConfig *config,
- int id,
- GdmConfigValue **value);
-gboolean gdm_config_set_value_for_id (GdmConfig *config,
- int id,
- GdmConfigValue *value);
-
-gboolean gdm_config_peek_string_for_id (GdmConfig *config,
- int id,
- const char **str);
-gboolean gdm_config_get_string_for_id (GdmConfig *config,
- int id,
- char **str);
-gboolean gdm_config_get_bool_for_id (GdmConfig *config,
- int id,
- gboolean *bool);
-gboolean gdm_config_get_int_for_id (GdmConfig *config,
- int id,
- int *integer);
-gboolean gdm_config_set_string_for_id (GdmConfig *config,
- int id,
- char *str);
-gboolean gdm_config_set_bool_for_id (GdmConfig *config,
- int id,
- gboolean bool);
-gboolean gdm_config_set_int_for_id (GdmConfig *config,
- int id,
- int integer);
-
-/* Config Values */
-
-GdmConfigValue * gdm_config_value_new (GdmConfigValueType type);
-void gdm_config_value_free (GdmConfigValue *value);
-GdmConfigValue * gdm_config_value_copy (const GdmConfigValue *value);
-int gdm_config_value_compare (const GdmConfigValue *value_a,
- const GdmConfigValue *value_b);
-
-GdmConfigValue * gdm_config_value_new_from_string (GdmConfigValueType type,
- const char *str,
- GError **error);
-const char * gdm_config_value_get_string (const GdmConfigValue *value);
-const char * gdm_config_value_get_locale_string (const GdmConfigValue *value);
-const char ** gdm_config_value_get_string_array (const GdmConfigValue *value);
-
-int gdm_config_value_get_int (const GdmConfigValue *value);
-gboolean gdm_config_value_get_bool (const GdmConfigValue *value);
-
-void gdm_config_value_set_string (GdmConfigValue *value,
- const char *str);
-void gdm_config_value_set_locale_string (GdmConfigValue *value,
- const char *str);
-
-void gdm_config_value_set_string_array (GdmConfigValue *value,
- const char **array);
-void gdm_config_value_set_locale_string_array (GdmConfigValue *value,
- const char **array);
-void gdm_config_value_set_int (GdmConfigValue *value,
- int integer);
-void gdm_config_value_set_bool (GdmConfigValue *value,
- gboolean bool);
-char * gdm_config_value_to_string (const GdmConfigValue *value);
-
-/* Config Entries */
-GdmConfigEntry * gdm_config_entry_copy (const GdmConfigEntry *entry);
-void gdm_config_entry_free (GdmConfigEntry *entry);
-
-G_END_DECLS
-
-#endif /* _GDM_CONFIG_H */
diff --git a/common/gdm-marshal.list b/common/gdm-marshal.list
new file mode 100644
index 00000000..41e40276
--- /dev/null
+++ b/common/gdm-marshal.list
@@ -0,0 +1 @@
+VOID:STRING,STRING,STRING
diff --git a/common/gdm-settings-backend.c b/common/gdm-settings-backend.c
new file mode 100644
index 00000000..760592b7
--- /dev/null
+++ b/common/gdm-settings-backend.c
@@ -0,0 +1,186 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib-object.h>
+
+#include "gdm-settings-backend.h"
+
+#include "gdm-marshal.h"
+
+#define GDM_SETTINGS_BACKEND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SETTINGS_BACKEND, GdmSettingsBackendPrivate))
+
+struct GdmSettingsBackendPrivate
+{
+ gpointer dummy;
+};
+
+enum {
+ VALUE_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint signals [LAST_SIGNAL] = { 0, };
+
+static void gdm_settings_backend_class_init (GdmSettingsBackendClass *klass);
+static void gdm_settings_backend_init (GdmSettingsBackend *settings_backend);
+static void gdm_settings_backend_finalize (GObject *object);
+
+static gpointer settings_backend_object = NULL;
+
+G_DEFINE_ABSTRACT_TYPE (GdmSettingsBackend, gdm_settings_backend, G_TYPE_OBJECT)
+
+GQuark
+gdm_settings_backend_error_quark (void)
+{
+ static GQuark ret = 0;
+ if (ret == 0) {
+ ret = g_quark_from_static_string ("gdm_settings_backend_error");
+ }
+
+ return ret;
+}
+
+static gboolean
+gdm_settings_backend_real_get_value (GdmSettingsBackend *settings_backend,
+ const char *key,
+ char **value,
+ GError **error)
+{
+ g_return_val_if_fail (GDM_IS_SETTINGS_BACKEND (settings_backend), FALSE);
+
+ return FALSE;
+}
+
+static gboolean
+gdm_settings_backend_real_set_value (GdmSettingsBackend *settings_backend,
+ const char *key,
+ const char *value,
+ GError **error)
+{
+ g_return_val_if_fail (GDM_IS_SETTINGS_BACKEND (settings_backend), FALSE);
+
+ return FALSE;
+}
+
+gboolean
+gdm_settings_backend_get_value (GdmSettingsBackend *settings_backend,
+ const char *key,
+ char **value,
+ GError **error)
+{
+ gboolean ret;
+
+ g_return_val_if_fail (GDM_IS_SETTINGS_BACKEND (settings_backend), FALSE);
+
+ g_object_ref (settings_backend);
+ ret = GDM_SETTINGS_BACKEND_GET_CLASS (settings_backend)->get_value (settings_backend, key, value, error);
+ g_object_unref (settings_backend);
+
+ return ret;
+}
+
+gboolean
+gdm_settings_backend_set_value (GdmSettingsBackend *settings_backend,
+ const char *key,
+ const char *value,
+ GError **error)
+{
+ gboolean ret;
+
+ g_return_val_if_fail (GDM_IS_SETTINGS_BACKEND (settings_backend), FALSE);
+
+ g_object_ref (settings_backend);
+ ret = GDM_SETTINGS_BACKEND_GET_CLASS (settings_backend)->set_value (settings_backend, key, value, error);
+ g_object_unref (settings_backend);
+
+ return ret;
+}
+
+void
+gdm_settings_backend_value_changed (GdmSettingsBackend *settings_backend,
+ const char *key,
+ const char *old_value,
+ const char *new_value)
+{
+ g_return_if_fail (GDM_IS_SETTINGS_BACKEND (settings_backend));
+
+ g_signal_emit (settings_backend, signals[VALUE_CHANGED], 0, key, old_value, new_value);
+}
+
+static void
+gdm_settings_backend_class_init (GdmSettingsBackendClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gdm_settings_backend_finalize;
+
+ klass->get_value = gdm_settings_backend_real_get_value;
+ klass->set_value = gdm_settings_backend_real_set_value;
+
+ signals [VALUE_CHANGED] =
+ g_signal_new ("value-changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GdmSettingsBackendClass, value_changed),
+ NULL,
+ NULL,
+ gdm_marshal_VOID__STRING_STRING_STRING,
+ G_TYPE_NONE,
+ 3,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
+
+ g_type_class_add_private (klass, sizeof (GdmSettingsBackendPrivate));
+}
+
+static void
+gdm_settings_backend_init (GdmSettingsBackend *settings_backend)
+{
+ settings_backend->priv = GDM_SETTINGS_BACKEND_GET_PRIVATE (settings_backend);
+}
+
+static void
+gdm_settings_backend_finalize (GObject *object)
+{
+ GdmSettingsBackend *settings_backend;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (GDM_IS_SETTINGS_BACKEND (object));
+
+ settings_backend = GDM_SETTINGS_BACKEND (object);
+
+ g_return_if_fail (settings_backend->priv != NULL);
+
+ G_OBJECT_CLASS (gdm_settings_backend_parent_class)->finalize (object);
+}
diff --git a/common/gdm-settings-backend.h b/common/gdm-settings-backend.h
new file mode 100644
index 00000000..18198638
--- /dev/null
+++ b/common/gdm-settings-backend.h
@@ -0,0 +1,92 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifndef __GDM_SETTINGS_BACKEND_H
+#define __GDM_SETTINGS_BACKEND_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GDM_TYPE_SETTINGS_BACKEND (gdm_settings_backend_get_type ())
+#define GDM_SETTINGS_BACKEND(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SETTINGS_BACKEND, GdmSettingsBackend))
+#define GDM_SETTINGS_BACKEND_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SETTINGS_BACKEND, GdmSettingsBackendClass))
+#define GDM_IS_SETTINGS_BACKEND(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SETTINGS_BACKEND))
+#define GDM_IS_SETTINGS_BACKEND_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_SETTINGS_BACKEND))
+#define GDM_SETTINGS_BACKEND_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_SETTINGS_BACKEND, GdmSettingsBackendClass))
+
+typedef struct GdmSettingsBackendPrivate GdmSettingsBackendPrivate;
+
+typedef struct
+{
+ GObject parent;
+ GdmSettingsBackendPrivate *priv;
+} GdmSettingsBackend;
+
+typedef struct
+{
+ GObjectClass parent_class;
+
+ /* methods */
+ gboolean (*get_value) (GdmSettingsBackend *settings_backend,
+ const char *key,
+ char **value,
+ GError **error);
+ gboolean (*set_value) (GdmSettingsBackend *settings_backend,
+ const char *key,
+ const char *value,
+ GError **error);
+
+ /* signals */
+ void (* value_changed) (GdmSettingsBackend *settings_backend,
+ const char *key,
+ const char *old_value,
+ const char **new_value);
+} GdmSettingsBackendClass;
+
+typedef enum
+{
+ GDM_SETTINGS_BACKEND_ERROR_GENERAL,
+ GDM_SETTINGS_BACKEND_ERROR_KEY_NOT_FOUND
+} GdmSettingsBackendError;
+
+#define GDM_SETTINGS_BACKEND_ERROR gdm_settings_backend_error_quark ()
+
+GQuark gdm_settings_backend_error_quark (void);
+GType gdm_settings_backend_get_type (void);
+
+gboolean gdm_settings_backend_get_value (GdmSettingsBackend *settings_backend,
+ const char *key,
+ char **value,
+ GError **error);
+gboolean gdm_settings_backend_set_value (GdmSettingsBackend *settings_backend,
+ const char *key,
+ const char *value,
+ GError **error);
+
+void gdm_settings_backend_value_changed (GdmSettingsBackend *settings_backend,
+ const char *key,
+ const char *old_value,
+ const char *new_value);
+
+G_END_DECLS
+
+#endif /* __GDM_SETTINGS_BACKEND_H */
diff --git a/common/gdm-settings-client.c b/common/gdm-settings-client.c
new file mode 100644
index 00000000..1eb6701a
--- /dev/null
+++ b/common/gdm-settings-client.c
@@ -0,0 +1,292 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#define DBUS_API_SUBJECT_TO_CHANGE
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <glib-object.h>
+
+#include "gdm-settings-client.h"
+#include "gdm-settings-utils.h"
+
+#define SETTINGS_DBUS_NAME "org.gnome.DisplayManager"
+#define SETTINGS_DBUS_PATH "/org/gnome/DisplayManager/Settings"
+#define SETTINGS_DBUS_INTERFACE "org.gnome.DisplayManager.Settings"
+
+static char *schemas_file = NULL;
+static char *schemas_root = NULL;
+static GHashTable *schemas = NULL;
+static DBusGProxy *settings_proxy = NULL;
+static DBusGConnection *connection = NULL;
+
+static GdmSettingsEntry *
+get_entry_for_key (const char *key)
+{
+ GdmSettingsEntry *entry;
+
+ entry = g_hash_table_lookup (schemas, key);
+
+ return entry;
+}
+
+static gboolean
+get_value (const char *key,
+ char **value)
+{
+ GError *error;
+ char *str;
+ gboolean res;
+
+ error = NULL;
+ res = dbus_g_proxy_call (settings_proxy,
+ "GetValue",
+ &error,
+ G_TYPE_STRING, key,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &str,
+ G_TYPE_INVALID);
+ if (! res) {
+ if (error != NULL) {
+ g_warning ("Failed to get value for %s: %s", key, error->message);
+ g_error_free (error);
+ } else {
+ g_warning ("Failed to get value for %s", key);
+ }
+
+ return FALSE;
+ }
+
+ if (value != NULL) {
+ *value = g_strdup (str);
+ }
+
+ g_free (str);
+
+ return TRUE;
+}
+
+static void
+assert_signature (GdmSettingsEntry *entry,
+ const char *signature)
+{
+ const char *sig;
+
+ sig = gdm_settings_entry_get_signature (entry);
+
+ g_assert (sig != NULL);
+ g_assert (signature != NULL);
+ g_assert (strcmp (signature, sig) == 0);
+}
+
+gboolean
+gdm_settings_client_get_string (const char *key,
+ char **value)
+{
+ GdmSettingsEntry *entry;
+ gboolean ret;
+ gboolean res;
+ char *str;
+
+ g_return_val_if_fail (key != NULL, FALSE);
+
+ entry = get_entry_for_key (key);
+ g_assert (entry != NULL);
+
+ assert_signature (entry, "s");
+
+ ret = FALSE;
+
+ res = get_value (key, &str);
+
+ if (! res) {
+ /* use the default */
+ str = g_strdup (gdm_settings_entry_get_default_value (entry));
+ }
+
+ if (value != NULL) {
+ *value = g_strdup (str);
+ }
+
+ g_free (str);
+
+ return ret;
+}
+
+gboolean
+gdm_settings_client_get_boolean (const char *key,
+ gboolean *value)
+{
+ GdmSettingsEntry *entry;
+ gboolean ret;
+ gboolean res;
+ char *str;
+
+ g_return_val_if_fail (key != NULL, FALSE);
+
+ entry = get_entry_for_key (key);
+ g_assert (entry != NULL);
+
+ assert_signature (entry, "b");
+
+ ret = FALSE;
+
+ res = get_value (key, &str);
+
+ if (! res) {
+ /* use the default */
+ str = g_strdup (gdm_settings_entry_get_default_value (entry));
+ }
+
+ ret = gdm_settings_parse_value_as_boolean (str, value);
+
+ g_free (str);
+
+ return ret;
+}
+
+gboolean
+gdm_settings_client_get_int (const char *key,
+ int *value)
+{
+ GdmSettingsEntry *entry;
+ gboolean ret;
+ gboolean res;
+ char *str;
+
+ g_return_val_if_fail (key != NULL, FALSE);
+
+ entry = get_entry_for_key (key);
+ g_assert (entry != NULL);
+
+ assert_signature (entry, "i");
+
+ ret = FALSE;
+
+ res = get_value (key, &str);
+
+ if (! res) {
+ /* use the default */
+ str = g_strdup (gdm_settings_entry_get_default_value (entry));
+ }
+
+ ret = gdm_settings_parse_value_as_integer (str, value);
+
+ g_free (str);
+
+ return ret;
+}
+
+gboolean
+gdm_settings_client_set_int (const char *key,
+ int value)
+{
+ g_return_val_if_fail (key != NULL, FALSE);
+ return TRUE;
+}
+
+gboolean
+gdm_settings_client_set_string (const char *key,
+ const char *value)
+{
+ g_return_val_if_fail (key != NULL, FALSE);
+ return TRUE;
+}
+
+gboolean
+gdm_settings_client_set_boolean (const char *key,
+ gboolean value)
+{
+ g_return_val_if_fail (key != NULL, FALSE);
+ return TRUE;
+}
+
+static void
+hashify_list (GdmSettingsEntry *entry,
+ gpointer data)
+{
+ g_hash_table_insert (schemas, g_strdup (gdm_settings_entry_get_key (entry)), entry);
+}
+
+gboolean
+gdm_settings_client_init (const char *file,
+ const char *root)
+{
+ GError *error;
+ GSList *list;
+
+ g_return_val_if_fail (file != NULL, FALSE);
+ g_return_val_if_fail (root != NULL, FALSE);
+
+ g_assert (schemas == NULL);
+
+ error = NULL;
+ connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+ if (connection == NULL) {
+ if (error != NULL) {
+ g_warning ("error getting system bus: %s", error->message);
+ g_error_free (error);
+ }
+ return FALSE;
+ }
+
+ settings_proxy = dbus_g_proxy_new_for_name (connection,
+ SETTINGS_DBUS_NAME,
+ SETTINGS_DBUS_PATH,
+ SETTINGS_DBUS_INTERFACE);
+ if (settings_proxy == NULL) {
+ g_warning ("Unable to connect to settings server");
+ return FALSE;
+ }
+
+ list = NULL;
+ if (! gdm_settings_parse_schemas (file, root, &list)) {
+ g_warning ("Unable to parse schemas");
+ return FALSE;
+ }
+
+ schemas = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)gdm_settings_entry_free);
+ g_slist_foreach (list, (GFunc)hashify_list, NULL);
+
+ schemas_file = g_strdup (file);
+ schemas_root = g_strdup (root);
+
+ return TRUE;
+}
+
+void
+gdm_settings_client_shutdown (void)
+{
+
+}
diff --git a/common/gdm-settings-client.h b/common/gdm-settings-client.h
new file mode 100644
index 00000000..234ca859
--- /dev/null
+++ b/common/gdm-settings-client.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifndef __GDM_SETTINGS_CLIENT_H
+#define __GDM_SETTINGS_CLIENT_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+gboolean gdm_settings_client_init (const char *schemas_file,
+ const char *root);
+void gdm_settings_client_shutdown (void);
+
+gboolean gdm_settings_client_get_int (const char *key,
+ int *value);
+gboolean gdm_settings_client_get_boolean (const char *key,
+ gboolean *value);
+gboolean gdm_settings_client_get_string (const char *key,
+ char **value);
+
+gboolean gdm_settings_client_set_int (const char *key,
+ int value);
+gboolean gdm_settings_client_set_boolean (const char *key,
+ gboolean value);
+gboolean gdm_settings_client_set_string (const char *key,
+ const char *value);
+
+G_END_DECLS
+
+#endif /* __GDM_SETTINGS_CLIENT_H */
diff --git a/common/gdm-settings-desktop-backend.c b/common/gdm-settings-desktop-backend.c
new file mode 100644
index 00000000..d710f481
--- /dev/null
+++ b/common/gdm-settings-desktop-backend.c
@@ -0,0 +1,251 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <glib-object.h>
+
+#include "gdm-settings-desktop-backend.h"
+
+#include "gdm-marshal.h"
+
+#define GDM_SETTINGS_DESKTOP_BACKEND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SETTINGS_DESKTOP_BACKEND, GdmSettingsDesktopBackendPrivate))
+
+struct GdmSettingsDesktopBackendPrivate
+{
+ char *filename;
+ GKeyFile *key_file;
+ GHashTable *values;
+};
+
+static void gdm_settings_desktop_backend_class_init (GdmSettingsDesktopBackendClass *klass);
+static void gdm_settings_desktop_backend_init (GdmSettingsDesktopBackend *settings_desktop_backend);
+static void gdm_settings_desktop_backend_finalize (GObject *object);
+
+G_DEFINE_TYPE (GdmSettingsDesktopBackend, gdm_settings_desktop_backend, GDM_TYPE_SETTINGS_BACKEND)
+
+static gboolean
+parse_key_string (const char *keystring,
+ char **group,
+ char **key,
+ char **locale,
+ char **value)
+{
+ char **split1;
+ char **split2;
+ char *g;
+ char *k;
+ char *l;
+ char *v;
+ char *tmp1;
+ char *tmp2;
+ gboolean ret;
+
+ g_return_val_if_fail (keystring != NULL, FALSE);
+
+ ret = FALSE;
+ g = k = v = l = NULL;
+ split1 = split2 = NULL;
+
+ g_debug ("Attempting to parse key string: %s", keystring);
+
+ split1 = g_strsplit (keystring, "/", 2);
+ if (split1 == NULL || split1 [0] == NULL || split1 [1] == NULL) {
+ goto out;
+ }
+
+ g = split1 [0];
+
+ split2 = g_strsplit (split1 [1], "=", 2);
+ if (split2 == NULL) {
+ k = split1 [1];
+ } else {
+ k = split2 [0];
+ v = split2 [1];
+ }
+
+ /* trim off the locale */
+ tmp1 = strchr (k, '[');
+ tmp2 = strchr (k, ']');
+ if (tmp1 != NULL && tmp2 != NULL && tmp2 > tmp1) {
+ l = g_strndup (tmp1 + 1, tmp2 - tmp1 - 1);
+ *tmp1 = '\0';
+ }
+
+ ret = TRUE;
+ out:
+ if (group != NULL) {
+ *group = g_strdup (g);
+ }
+ if (key != NULL) {
+ *key = g_strdup (k);
+ }
+ if (locale != NULL) {
+ *locale = g_strdup (l);
+ }
+ if (value != NULL) {
+ *value = g_strdup (v);
+ }
+
+ g_strfreev (split1);
+ g_strfreev (split2);
+
+ return ret;
+}
+
+static gboolean
+gdm_settings_desktop_backend_get_value (GdmSettingsBackend *backend,
+ const char *key,
+ char **value,
+ GError **error)
+{
+ GError *local_error;
+ char *val;
+ char *g;
+ char *k;
+ char *l;
+
+ g_return_val_if_fail (GDM_IS_SETTINGS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (key != NULL, FALSE);
+
+ if (value != NULL) {
+ *value = NULL;
+ }
+
+ /*GDM_SETTINGS_BACKEND_CLASS (gdm_settings_desktop_backend_parent_class)->get_value (display);*/
+ if (! parse_key_string (key, &g, &k, &l, NULL)) {
+ g_set_error (error, GDM_SETTINGS_BACKEND_ERROR, GDM_SETTINGS_BACKEND_ERROR_KEY_NOT_FOUND, "Key not found");
+ return FALSE;
+ }
+
+ g_debug ("Getting key: %s %s %s", g, k, l);
+ local_error = NULL;
+ val = g_key_file_get_value (GDM_SETTINGS_DESKTOP_BACKEND (backend)->priv->key_file,
+ g,
+ k,
+ &local_error);
+ if (local_error != NULL) {
+ g_error_free (local_error);
+ g_set_error (error, GDM_SETTINGS_BACKEND_ERROR, GDM_SETTINGS_BACKEND_ERROR_KEY_NOT_FOUND, "Key not found");
+ return FALSE;
+ }
+
+ if (value != NULL) {
+ *value = g_strdup (val);
+ }
+
+ g_free (val);
+
+ return TRUE;
+}
+
+static gboolean
+gdm_settings_desktop_backend_set_value (GdmSettingsBackend *settings_backend,
+ const char *key,
+ const char *value,
+ GError **error)
+{
+ g_return_val_if_fail (GDM_IS_SETTINGS_BACKEND (settings_backend), FALSE);
+ g_return_val_if_fail (key != NULL, FALSE);
+
+ g_debug ("Setting key %s", key);
+
+ return FALSE;
+}
+
+static void
+gdm_settings_desktop_backend_class_init (GdmSettingsDesktopBackendClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdmSettingsBackendClass *backend_class = GDM_SETTINGS_BACKEND_CLASS (klass);
+
+ object_class->finalize = gdm_settings_desktop_backend_finalize;
+
+ backend_class->get_value = gdm_settings_desktop_backend_get_value;
+ backend_class->set_value = gdm_settings_desktop_backend_set_value;
+
+ g_type_class_add_private (klass, sizeof (GdmSettingsDesktopBackendPrivate));
+}
+
+static void
+gdm_settings_desktop_backend_init (GdmSettingsDesktopBackend *backend)
+{
+ gboolean res;
+ GError *error;
+
+ backend->priv = GDM_SETTINGS_DESKTOP_BACKEND_GET_PRIVATE (backend);
+
+ backend->priv->key_file = g_key_file_new ();
+ backend->priv->filename = g_strdup (GDMCONFDIR "/custom.conf");
+
+ backend->priv->values = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ (GDestroyNotify)g_free,
+ (GDestroyNotify)g_free);
+
+ error = NULL;
+ res = g_key_file_load_from_file (backend->priv->key_file,
+ backend->priv->filename,
+ G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
+ &error);
+ if (! res) {
+ g_warning ("Unable to load file '%s': %s", backend->priv->filename, error->message);
+ }
+}
+
+static void
+gdm_settings_desktop_backend_finalize (GObject *object)
+{
+ GdmSettingsDesktopBackend *backend;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (GDM_IS_SETTINGS_DESKTOP_BACKEND (object));
+
+ backend = GDM_SETTINGS_DESKTOP_BACKEND (object);
+
+ g_return_if_fail (backend->priv != NULL);
+
+ g_key_file_free (backend->priv->key_file);
+ g_hash_table_destroy (backend->priv->values);
+
+ G_OBJECT_CLASS (gdm_settings_desktop_backend_parent_class)->finalize (object);
+}
+
+GdmSettingsBackend *
+gdm_settings_desktop_backend_new (void)
+{
+ GObject *object;
+
+ object = g_object_new (GDM_TYPE_SETTINGS_DESKTOP_BACKEND, NULL);
+
+ return GDM_SETTINGS_BACKEND (object);
+}
diff --git a/common/gdm-settings-desktop-backend.h b/common/gdm-settings-desktop-backend.h
new file mode 100644
index 00000000..fae0bd30
--- /dev/null
+++ b/common/gdm-settings-desktop-backend.h
@@ -0,0 +1,56 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifndef __GDM_SETTINGS_DESKTOP_BACKEND_H
+#define __GDM_SETTINGS_DESKTOP_BACKEND_H
+
+#include <glib-object.h>
+#include "gdm-settings-backend.h"
+
+G_BEGIN_DECLS
+
+#define GDM_TYPE_SETTINGS_DESKTOP_BACKEND (gdm_settings_desktop_backend_get_type ())
+#define GDM_SETTINGS_DESKTOP_BACKEND(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SETTINGS_DESKTOP_BACKEND, GdmSettingsDesktopBackend))
+#define GDM_SETTINGS_DESKTOP_BACKEND_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SETTINGS_DESKTOP_BACKEND, GdmSettingsDesktopBackendClass))
+#define GDM_IS_SETTINGS_DESKTOP_BACKEND(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SETTINGS_DESKTOP_BACKEND))
+#define GDM_IS_SETTINGS_DESKTOP_BACKEND_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_SETTINGS_DESKTOP_BACKEND))
+#define GDM_SETTINGS_DESKTOP_BACKEND_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_SETTINGS_DESKTOP_BACKEND, GdmSettingsDesktopBackendClass))
+
+typedef struct GdmSettingsDesktopBackendPrivate GdmSettingsDesktopBackendPrivate;
+
+typedef struct
+{
+ GdmSettingsBackend parent;
+ GdmSettingsDesktopBackendPrivate *priv;
+} GdmSettingsDesktopBackend;
+
+typedef struct
+{
+ GdmSettingsBackendClass parent_class;
+} GdmSettingsDesktopBackendClass;
+
+GType gdm_settings_desktop_backend_get_type (void);
+
+GdmSettingsBackend *gdm_settings_desktop_backend_new (void);
+
+G_END_DECLS
+
+#endif /* __GDM_SETTINGS_DESKTOP_BACKEND_H */
diff --git a/common/gdm-settings-direct.c b/common/gdm-settings-direct.c
new file mode 100644
index 00000000..99b2498e
--- /dev/null
+++ b/common/gdm-settings-direct.c
@@ -0,0 +1,243 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <glib-object.h>
+
+#include "gdm-settings.h"
+#include "gdm-settings-utils.h"
+#include "gdm-settings-direct.h"
+
+static char *schemas_file;
+static char *schemas_root;
+static GHashTable *schemas;
+static GdmSettings *settings_object;
+
+static GdmSettingsEntry *
+get_entry_for_key (const char *key)
+{
+ GdmSettingsEntry *entry;
+
+ entry = g_hash_table_lookup (schemas, key);
+
+ return entry;
+}
+
+static void
+assert_signature (GdmSettingsEntry *entry,
+ const char *signature)
+{
+ const char *sig;
+
+ sig = gdm_settings_entry_get_signature (entry);
+
+ g_assert (sig != NULL);
+ g_assert (signature != NULL);
+ g_assert (strcmp (signature, sig) == 0);
+}
+
+static gboolean
+get_value (const char *key,
+ char **value)
+{
+ GError *error;
+ char *str;
+ gboolean res;
+
+ error = NULL;
+ res = gdm_settings_get_value (settings_object, key, &str, &error);
+ if (! res) {
+ if (error != NULL) {
+ g_warning ("Failed to get value for %s: %s", key, error->message);
+ g_error_free (error);
+ } else {
+ g_warning ("Failed to get value for %s", key);
+ }
+
+ return FALSE;
+ }
+
+ if (value != NULL) {
+ *value = g_strdup (str);
+ }
+
+ g_free (str);
+
+ return TRUE;
+}
+
+gboolean
+gdm_settings_direct_get_int (const char *key,
+ int *value)
+{
+ GdmSettingsEntry *entry;
+ gboolean ret;
+ gboolean res;
+ char *str;
+
+ g_return_val_if_fail (key != NULL, FALSE);
+
+ entry = get_entry_for_key (key);
+ g_assert (entry != NULL);
+
+ assert_signature (entry, "i");
+
+ ret = FALSE;
+
+ res = get_value (key, &str);
+
+ if (! res) {
+ /* use the default */
+ str = g_strdup (gdm_settings_entry_get_default_value (entry));
+ }
+
+ ret = gdm_settings_parse_value_as_integer (str, value);
+
+ g_free (str);
+
+ return ret;
+}
+
+gboolean
+gdm_settings_direct_get_boolean (const char *key,
+ gboolean *value)
+{
+ GdmSettingsEntry *entry;
+ gboolean ret;
+ gboolean res;
+ char *str;
+
+ g_return_val_if_fail (key != NULL, FALSE);
+
+ entry = get_entry_for_key (key);
+ g_assert (entry != NULL);
+
+ assert_signature (entry, "b");
+
+ ret = FALSE;
+
+ res = get_value (key, &str);
+
+ if (! res) {
+ /* use the default */
+ str = g_strdup (gdm_settings_entry_get_default_value (entry));
+ }
+
+ ret = gdm_settings_parse_value_as_boolean (str, value);
+
+ g_free (str);
+
+ return ret;
+}
+
+gboolean
+gdm_settings_direct_get_string (const char *key,
+ char **value)
+{
+ GdmSettingsEntry *entry;
+ gboolean ret;
+ gboolean res;
+ char *str;
+
+ g_return_val_if_fail (key != NULL, FALSE);
+
+ entry = get_entry_for_key (key);
+ g_assert (entry != NULL);
+
+ assert_signature (entry, "s");
+
+ ret = FALSE;
+
+ res = get_value (key, &str);
+
+ if (! res) {
+ /* use the default */
+ str = g_strdup (gdm_settings_entry_get_default_value (entry));
+ }
+
+ if (value != NULL) {
+ *value = g_strdup (str);
+ }
+
+ g_free (str);
+
+ return ret;
+}
+
+gboolean
+gdm_settings_direct_set (const char *key,
+ GValue *value)
+{
+ return TRUE;
+}
+
+static void
+hashify_list (GdmSettingsEntry *entry,
+ gpointer data)
+{
+ g_hash_table_insert (schemas, g_strdup (gdm_settings_entry_get_key (entry)), entry);
+}
+
+gboolean
+gdm_settings_direct_init (GdmSettings *settings,
+ const char *file,
+ const char *root)
+{
+ GSList *list;
+
+ g_return_val_if_fail (file != NULL, FALSE);
+ g_return_val_if_fail (root != NULL, FALSE);
+
+ g_assert (schemas == NULL);
+
+ if (! gdm_settings_parse_schemas (file, root, &list)) {
+ g_warning ("Unable to parse schemas");
+ return FALSE;
+ }
+
+ schemas = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)gdm_settings_entry_free);
+ g_slist_foreach (list, (GFunc)hashify_list, NULL);
+
+ schemas_file = g_strdup (file);
+ schemas_root = g_strdup (root);
+
+ settings_object = settings;
+
+ return TRUE;
+}
+
+void
+gdm_settings_direct_shutdown (void)
+{
+
+}
diff --git a/common/gdm-settings-direct.h b/common/gdm-settings-direct.h
new file mode 100644
index 00000000..38e9bb76
--- /dev/null
+++ b/common/gdm-settings-direct.h
@@ -0,0 +1,48 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifndef __GDM_SETTINGS_DIRECT_H
+#define __GDM_SETTINGS_DIRECT_H
+
+#include <glib-object.h>
+#include "gdm-settings.h"
+
+G_BEGIN_DECLS
+
+gboolean gdm_settings_direct_init (GdmSettings *settings,
+ const char *schemas_file,
+ const char *root);
+void gdm_settings_direct_shutdown (void);
+
+gboolean gdm_settings_direct_get (const char *key,
+ GValue *value);
+gboolean gdm_settings_direct_set (const char *key,
+ GValue *value);
+gboolean gdm_settings_direct_get_int (const char *key,
+ int *value);
+gboolean gdm_settings_direct_get_boolean (const char *key,
+ gboolean *value);
+gboolean gdm_settings_direct_get_string (const char *key,
+ char **value);
+
+G_END_DECLS
+
+#endif /* __GDM_SETTINGS_DIRECT_H */
diff --git a/common/gdm-settings-keys.h b/common/gdm-settings-keys.h
new file mode 100644
index 00000000..a349564a
--- /dev/null
+++ b/common/gdm-settings-keys.h
@@ -0,0 +1,196 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _GDM_SETTINGS_KEYS_H
+#define _GDM_SETTINGS_KEYS_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#define GDM_KEY_CHOOSER "daemon/Chooser"
+#define GDM_KEY_AUTOMATIC_LOGIN_ENABLE "daemon/AutomaticLoginEnable"
+#define GDM_KEY_AUTOMATIC_LOGIN "daemon/AutomaticLogin"
+#define GDM_KEY_GREETER "daemon/Greeter"
+#define GDM_KEY_REMOTE_GREETER "daemon/RemoteGreeter"
+#define GDM_KEY_ADD_GTK_MODULES "daemon/AddGtkModules"
+#define GDM_KEY_GTK_MODULES_LIST "daemon/GtkModulesList"
+#define GDM_KEY_GROUP "daemon/Group"
+#define GDM_KEY_HALT "daemon/HaltCommand"
+#define GDM_KEY_DISPLAY_INIT_DIR "daemon/DisplayInitDir"
+#define GDM_KEY_KILL_INIT_CLIENTS "daemon/KillInitClients"
+#define GDM_KEY_LOG_DIR "daemon/LogDir"
+#define GDM_KEY_PATH "daemon/DefaultPath"
+#define GDM_KEY_PID_FILE "daemon/PidFile"
+#define GDM_KEY_POSTSESSION "daemon/PostSessionScriptDir"
+#define GDM_KEY_PRESESSION "daemon/PreSessionScriptDir"
+#define GDM_KEY_POSTLOGIN "daemon/PostLoginScriptDir"
+#define GDM_KEY_FAILSAFE_XSERVER "daemon/FailsafeXServer"
+#define GDM_KEY_X_KEEPS_CRASHING "daemon/XKeepsCrashing"
+#define GDM_KEY_REBOOT "daemon/RebootCommand"
+#define GDM_KEY_CUSTOM_CMD_TEMPLATE "customcommand/CustomCommand"
+#define GDM_KEY_CUSTOM_CMD_LABEL_TEMPLATE "customcommand/CustomCommandLabel"
+#define GDM_KEY_CUSTOM_CMD_LR_LABEL_TEMPLATE "customcommand/CustomCommandLRLabel"
+#define GDM_KEY_CUSTOM_CMD_TEXT_TEMPLATE "customcommand/CustomCommandText"
+#define GDM_KEY_CUSTOM_CMD_TOOLTIP_TEMPLATE "customcommand/CustomCommandTooltip"
+#define GDM_KEY_CUSTOM_CMD_NO_RESTART_TEMPLATE "customcommand/CustomCommandNoRestart"
+#define GDM_KEY_CUSTOM_CMD_IS_PERSISTENT_TEMPLATE "customcommand/CustomCommandIsPersistent"
+#define GDM_KEY_ROOT_PATH "daemon/RootPath"
+#define GDM_KEY_SERV_AUTHDIR "daemon/ServAuthDir"
+#define GDM_KEY_SESSION_DESKTOP_DIR "daemon/SessionDesktopDir"
+#define GDM_KEY_BASE_XSESSION "daemon/BaseXsession"
+#define GDM_KEY_DEFAULT_SESSION "daemon/DefaultSession"
+#define GDM_KEY_SUSPEND "daemon/SuspendCommand"
+#define GDM_KEY_USER_AUTHDIR "daemon/UserAuthDir"
+#define GDM_KEY_USER_AUTHDIR_FALLBACK "daemon/UserAuthFBDir"
+#define GDM_KEY_USER_AUTHFILE "daemon/UserAuthFile"
+#define GDM_KEY_USER "daemon/User"
+#define GDM_KEY_CONSOLE_NOTIFY "daemon/ConsoleNotify"
+#define GDM_KEY_DOUBLE_LOGIN_WARNING "daemon/DoubleLoginWarning"
+#define GDM_KEY_ALWAYS_LOGIN_CURRENT_SESSION "daemon/AlwaysLoginCurrentSession"
+#define GDM_KEY_DISPLAY_LAST_LOGIN "daemon/DisplayLastLogin"
+#define GDM_KEY_TIMED_LOGIN_ENABLE "daemon/TimedLoginEnable"
+#define GDM_KEY_TIMED_LOGIN "daemon/TimedLogin"
+#define GDM_KEY_TIMED_LOGIN_DELAY "daemon/TimedLoginDelay"
+#define GDM_KEY_FLEXI_REAP_DELAY_MINUTES "daemon/FlexiReapDelayMinutes"
+#define GDM_KEY_STANDARD_XSERVER "daemon/StandardXServer"
+#define GDM_KEY_FLEXIBLE_XSERVERS "daemon/FlexibleXServers"
+#define GDM_KEY_DYNAMIC_XSERVERS "daemon/DynamicXServers"
+#define GDM_KEY_XNEST "daemon/Xnest"
+#define GDM_KEY_XNEST_UNSCALED_FONT_PATH "daemon/XnestUnscaledFontPath"
+#define GDM_KEY_FIRST_VT "daemon/FirstVT"
+#define GDM_KEY_VT_ALLOCATION "daemon/VTAllocation"
+#define GDM_KEY_CONSOLE_CANNOT_HANDLE "daemon/ConsoleCannotHandle"
+#define GDM_KEY_XSERVER_TIMEOUT "daemon/GdmXserverTimeout"
+#define GDM_KEY_SYSTEM_COMMANDS_IN_MENU "daemon/SystemCommandsInMenu"
+#define GDM_KEY_ALLOW_LOGOUT_ACTIONS "daemon/AllowLogoutActions"
+#define GDM_KEY_RBAC_SYSTEM_COMMAND_KEYS "daemon/RBACSystemCommandKeys"
+
+#define GDM_KEY_ALLOW_ROOT "security/AllowRoot"
+#define GDM_KEY_ALLOW_REMOTE_ROOT "security/AllowRemoteRoot"
+#define GDM_KEY_ALLOW_REMOTE_AUTOLOGIN "security/AllowRemoteAutoLogin"
+#define GDM_KEY_USER_MAX_FILE "security/UserMaxFile"
+#define GDM_KEY_RELAX_PERM "security/RelaxPermissions"
+#define GDM_KEY_CHECK_DIR_OWNER "security/CheckDirOwner"
+#define GDM_KEY_SUPPORT_AUTOMOUNT "security/SupportAutomount"
+#define GDM_KEY_RETRY_DELAY "security/RetryDelay"
+#define GDM_KEY_DISALLOW_TCP "security/DisallowTCP"
+#define GDM_KEY_PAM_STACK "security/PamStack"
+#define GDM_KEY_NEVER_PLACE_COOKIES_ON_NFS "security/NeverPlaceCookiesOnNFS"
+#define GDM_KEY_PASSWORD_REQUIRED "security/PasswordRequired"
+#define GDM_KEY_XDMCP "xdmcp/Enable"
+#define GDM_KEY_MAX_PENDING "xdmcp/MaxPending"
+#define GDM_KEY_MAX_SESSIONS "xdmcp/MaxSessions"
+#define GDM_KEY_MAX_WAIT "xdmcp/MaxWait"
+#define GDM_KEY_DISPLAYS_PER_HOST "xdmcp/DisplaysPerHost"
+#define GDM_KEY_UDP_PORT "xdmcp/Port"
+#define GDM_KEY_INDIRECT "xdmcp/HonorIndirect"
+#define GDM_KEY_MAX_INDIRECT "xdmcp/MaxPendingIndirect"
+#define GDM_KEY_MAX_WAIT_INDIRECT "xdmcp/MaxWaitIndirect"
+#define GDM_KEY_PING_INTERVAL "xdmcp/PingIntervalSeconds"
+#define GDM_KEY_WILLING "xdmcp/Willing"
+#define GDM_KEY_XDMCP_PROXY "xdmcp/EnableProxy"
+#define GDM_KEY_XDMCP_PROXY_XSERVER "xdmcp/ProxyXServer"
+#define GDM_KEY_XDMCP_PROXY_RECONNECT "xdmcp/ProxyReconnect"
+#define GDM_KEY_GTK_THEME "gui/GtkTheme"
+#define GDM_KEY_GTKRC "gui/GtkRC"
+#define GDM_KEY_MAX_ICON_WIDTH "gui/MaxIconWidth"
+#define GDM_KEY_MAX_ICON_HEIGHT "gui/MaxIconHeight"
+#define GDM_KEY_ALLOW_GTK_THEME_CHANGE "gui/AllowGtkThemeChange"
+#define GDM_KEY_GTK_THEMES_TO_ALLOW "gui/GtkThemesToAllow"
+#define GDM_KEY_BROWSER "greeter/Browser"
+#define GDM_KEY_INCLUDE "greeter/Include"
+#define GDM_KEY_EXCLUDE "greeter/Exclude"
+#define GDM_KEY_INCLUDE_ALL "greeter/IncludeAll"
+#define GDM_KEY_MINIMAL_UID "greeter/MinimalUID"
+#define GDM_KEY_DEFAULT_FACE "greeter/DefaultFace"
+#define GDM_KEY_GLOBAL_FACE_DIR "greeter/GlobalFaceDir"
+#define GDM_KEY_LOCALE_FILE "greeter/LocaleFile"
+#define GDM_KEY_LOGO "greeter/Logo"
+#define GDM_KEY_CHOOSER_BUTTON_LOGO "greeter/ChooserButtonLogo"
+#define GDM_KEY_QUIVER "greeter/Quiver"
+#define GDM_KEY_SYSTEM_MENU "greeter/SystemMenu"
+#define GDM_KEY_CONFIGURATOR "daemon/Configurator"
+#define GDM_KEY_CONFIG_AVAILABLE "greeter/ConfigAvailable"
+#define GDM_KEY_CHOOSER_BUTTON "greeter/ChooserButton"
+#define GDM_KEY_TITLE_BAR "greeter/TitleBar"
+#define GDM_KEY_DEFAULT_WELCOME "greeter/DefaultWelcome"
+#define GDM_KEY_DEFAULT_REMOTE_WELCOME "greeter/DefaultRemoteWelcome"
+#define GDM_KEY_WELCOME "greeter/Welcome"
+#define GDM_KEY_REMOTE_WELCOME "greeter/RemoteWelcome"
+#define GDM_KEY_XINERAMA_SCREEN "greeter/XineramaScreen"
+#define GDM_KEY_BACKGROUND_PROGRAM "greeter/BackgroundProgram"
+#define GDM_KEY_RUN_BACKGROUND_PROGRAM_ALWAYS "greeter/RunBackgroundProgramAlways"
+#define GDM_KEY_BACKGROUND_PROGRAM_INITIAL_DELAY "greeter/BackgroundProgramInitialDelay"
+#define GDM_KEY_RESTART_BACKGROUND_PROGRAM "greeter/RestartBackgroundProgram"
+#define GDM_KEY_BACKGROUND_PROGRAM_RESTART_DELAY "greeter/BackgroundProgramRestartDelay"
+#define GDM_KEY_BACKGROUND_IMAGE "greeter/BackgroundImage"
+#define GDM_KEY_BACKGROUND_COLOR "greeter/BackgroundColor"
+#define GDM_KEY_BACKGROUND_TYPE "greeter/BackgroundType"
+#define GDM_KEY_BACKGROUND_SCALE_TO_FIT "greeter/BackgroundScaleToFit"
+#define GDM_KEY_BACKGROUND_REMOTE_ONLY_COLOR "greeter/BackgroundRemoteOnlyColor"
+#define GDM_KEY_LOCK_POSITION "greeter/LockPosition"
+#define GDM_KEY_SET_POSITION "greeter/SetPosition"
+#define GDM_KEY_POSITION_X "greeter/PositionX"
+#define GDM_KEY_POSITION_Y "greeter/PositionY"
+#define GDM_KEY_USE_24_CLOCK "greeter/Use24Clock"
+#define GDM_KEY_ENTRY_CIRCLES "greeter/UseCirclesInEntry"
+#define GDM_KEY_ENTRY_INVISIBLE "greeter/UseInvisibleInEntry"
+#define GDM_KEY_GRAPHICAL_THEME "greeter/GraphicalTheme"
+#define GDM_KEY_GRAPHICAL_THEMES "greeter/GraphicalThemes"
+#define GDM_KEY_GRAPHICAL_THEME_RAND "greeter/GraphicalThemeRand"
+#define GDM_KEY_GRAPHICAL_THEME_DIR "greeter/GraphicalThemeDir"
+#define GDM_KEY_GRAPHICAL_THEMED_COLOR "greeter/GraphicalThemedColor"
+#define GDM_KEY_INFO_MSG_FILE "greeter/InfoMsgFile"
+#define GDM_KEY_INFO_MSG_FONT "greeter/InfoMsgFont"
+#define GDM_KEY_PRE_FETCH_PROGRAM "greeter/PreFetchProgram"
+#define GDM_KEY_SOUND_ON_LOGIN "greeter/SoundOnLogin"
+#define GDM_KEY_SOUND_ON_LOGIN_SUCCESS "greeter/SoundOnLoginSuccess"
+#define GDM_KEY_SOUND_ON_LOGIN_FAILURE "greeter/SoundOnLoginFailure"
+#define GDM_KEY_SOUND_ON_LOGIN_FILE "greeter/SoundOnLoginFile"
+#define GDM_KEY_SOUND_ON_LOGIN_SUCCESS_FILE "greeter/SoundOnLoginSuccessFile"
+#define GDM_KEY_SOUND_ON_LOGIN_FAILURE_FILE "greeter/SoundOnLoginFailureFile"
+#define GDM_KEY_SOUND_PROGRAM "daemon/SoundProgram"
+#define GDM_KEY_SCAN_TIME "chooser/ScanTime"
+#define GDM_KEY_DEFAULT_HOST_IMG "chooser/DefaultHostImg"
+#define GDM_KEY_HOST_IMAGE_DIR "chooser/HostImageDir"
+#define GDM_KEY_HOSTS "chooser/Hosts"
+#define GDM_KEY_MULTICAST "chooser/Multicast"
+#define GDM_KEY_MULTICAST_ADDR "chooser/MulticastAddr"
+#define GDM_KEY_BROADCAST "chooser/Broadcast"
+#define GDM_KEY_ALLOW_ADD "chooser/AllowAdd"
+#define GDM_KEY_DEBUG "debug/Enable"
+#define GDM_KEY_DEBUG_GESTURES "debug/Gestures"
+#define GDM_KEY_SHOW_GNOME_FAILSAFE "greeter/ShowGnomeFailsafeSession"
+#define GDM_KEY_SHOW_XTERM_FAILSAFE "greeter/ShowXtermFailsafeSession"
+#define GDM_KEY_SHOW_LAST_SESSION "greeter/ShowLastSession"
+
+#define GDM_KEY_SERVER_PREFIX "server-"
+#define GDM_KEY_SERVER_NAME "name"
+#define GDM_KEY_SERVER_COMMAND "command"
+#define GDM_KEY_SERVER_FLEXIBLE "flexible"
+#define GDM_KEY_SERVER_CHOOSABLE "choosable"
+#define GDM_KEY_SERVER_HANDLED "handled"
+#define GDM_KEY_SERVER_CHOOSER "chooser"
+#define GDM_KEY_SERVER_PRIORITY "priority"
+
+G_END_DECLS
+
+#endif /* _GDM_SETTINGS_KEYS_H */
diff --git a/common/gdm-settings-utils.c b/common/gdm-settings-utils.c
new file mode 100644
index 00000000..65e979e7
--- /dev/null
+++ b/common/gdm-settings-utils.c
@@ -0,0 +1,285 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <errno.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <glib-object.h>
+
+#include "gdm-settings-utils.h"
+
+struct _GdmSettingsEntry
+{
+ char *key;
+ char *signature;
+ char *default_value;
+ GSList *notifiers;
+};
+
+GdmSettingsEntry *
+gdm_settings_entry_new (void)
+{
+ GdmSettingsEntry *entry = NULL;
+
+ entry = g_new0 (GdmSettingsEntry, 1);
+ entry->key = NULL;
+ entry->signature = NULL;
+ entry->notifiers = NULL;
+ entry->default_value = NULL;
+
+ return entry;
+}
+
+const char *
+gdm_settings_entry_get_key (GdmSettingsEntry *entry)
+{
+ return entry->key;
+}
+
+const char *
+gdm_settings_entry_get_signature (GdmSettingsEntry *entry)
+{
+ return entry->signature;
+}
+
+const char *
+gdm_settings_entry_get_default_value (GdmSettingsEntry *entry)
+{
+ return entry->default_value;
+}
+
+void
+gdm_settings_entry_free (GdmSettingsEntry *entry)
+{
+ g_free (entry->key);
+ g_free (entry->signature);
+ g_free (entry->default_value);
+ g_slist_free (entry->notifiers);
+ g_free (entry);
+}
+
+typedef struct {
+ GSList *list;
+ GdmSettingsEntry *entry;
+ gboolean in_key;
+ gboolean in_signature;
+ gboolean in_default;
+} ParserInfo;
+
+static void
+start_element_cb (GMarkupParseContext *ctx,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ gpointer user_data,
+ GError **error)
+{
+ ParserInfo *info;
+
+ info = (ParserInfo *) user_data;
+
+ /*g_debug ("parsing start: '%s'", element_name);*/
+
+ if (strcmp (element_name, "schema") == 0) {
+ info->entry = gdm_settings_entry_new ();
+ } else if (strcmp (element_name, "key") == 0) {
+ info->in_key = TRUE;
+ } else if (strcmp (element_name, "signature") == 0) {
+ info->in_signature = TRUE;
+ } else if (strcmp (element_name, "default") == 0) {
+ info->in_default = TRUE;
+ }
+}
+
+static void
+add_schema_entry (ParserInfo *info)
+{
+ g_debug ("Inserting entry %s", info->entry->key);
+
+ info->list = g_slist_prepend (info->list, info->entry);
+}
+
+static void
+end_element_cb (GMarkupParseContext *ctx,
+ const char *element_name,
+ gpointer user_data,
+ GError **error)
+{
+ ParserInfo *info;
+
+ info = (ParserInfo *) user_data;
+
+ /*g_debug ("parsing end: '%s'", element_name);*/
+
+ if (strcmp (element_name, "schema") == 0) {
+ add_schema_entry (info);
+ } else if (strcmp (element_name, "key") == 0) {
+ info->in_key = FALSE;
+ } else if (strcmp (element_name, "signature") == 0) {
+ info->in_signature = FALSE;
+ } else if (strcmp (element_name, "default") == 0) {
+ info->in_default = FALSE;
+ }
+}
+
+static void
+text_cb (GMarkupParseContext *ctx,
+ const char *text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error)
+{
+ ParserInfo *info;
+ char *t;
+
+ info = (ParserInfo *) user_data;
+
+ t = g_strndup (text, text_len);
+
+ if (info->in_key) {
+ info->entry->key = g_strdup (t);
+ } else if (info->in_signature) {
+ info->entry->signature = g_strdup (t);
+ } else if (info->in_default) {
+ info->entry->default_value = g_strdup (t);
+ }
+
+ g_free (t);
+
+}
+
+static void
+error_cb (GMarkupParseContext *ctx,
+ GError *error,
+ gpointer user_data)
+{
+}
+
+static GMarkupParser parser = {
+ start_element_cb,
+ end_element_cb,
+ text_cb,
+ NULL,
+ error_cb
+};
+
+gboolean
+gdm_settings_parse_schemas (const char *file,
+ const char *root,
+ GSList **schemas)
+{
+ GMarkupParseContext *ctx;
+ ParserInfo *info;
+ char *contents;
+ gsize len;
+ GError *error;
+
+ g_return_val_if_fail (file != NULL, FALSE);
+ g_return_val_if_fail (root != NULL, FALSE);
+
+ g_assert (schemas != NULL);
+
+ error = NULL;
+ if (! g_file_get_contents (file, &contents, &len, &error)) {
+ g_warning ("Unable to read schemas file: %s", error->message);
+ g_error_free (error);
+ return FALSE;
+ }
+
+ info = g_new0 (ParserInfo, 1);
+ ctx = g_markup_parse_context_new (&parser, 0, info, NULL);
+ g_markup_parse_context_parse (ctx, contents, len, NULL);
+
+ *schemas = info->list;
+
+ g_free (info);
+
+ return TRUE;
+}
+
+/* adapted from GKeyFile */
+gboolean
+gdm_settings_parse_value_as_boolean (const char *value,
+ gboolean *bool)
+{
+ if (strcmp (value, "true") == 0 || strcmp (value, "1") == 0) {
+ *bool = TRUE;
+ return TRUE;
+ } else if (strcmp (value, "false") == 0 || strcmp (value, "0") == 0) {
+ *bool = FALSE;
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+gboolean
+gdm_settings_parse_value_as_integer (const char *value,
+ int *intval)
+{
+ char *end_of_valid_int;
+ glong long_value;
+ gint int_value;
+
+ errno = 0;
+ long_value = strtol (value, &end_of_valid_int, 10);
+
+ if (*value == '\0' || *end_of_valid_int != '\0') {
+ return FALSE;
+ }
+
+ int_value = long_value;
+ if (int_value != long_value || errno == ERANGE) {
+ return FALSE;
+ }
+
+ *intval = int_value;
+
+ return TRUE;
+}
+
+gboolean
+gdm_settings_parse_value_as_double (const char *value,
+ gdouble *doubleval)
+{
+ char *end_of_valid_d;
+ gdouble double_value = 0;
+
+ double_value = g_ascii_strtod (value, &end_of_valid_d);
+
+ if (*end_of_valid_d != '\0' || end_of_valid_d == value) {
+ return FALSE;
+ }
+
+ *doubleval = double_value;
+ return TRUE;
+}
diff --git a/common/gdm-settings-utils.h b/common/gdm-settings-utils.h
new file mode 100644
index 00000000..b6fdec9b
--- /dev/null
+++ b/common/gdm-settings-utils.h
@@ -0,0 +1,53 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifndef __GDM_SETTINGS_UTILS_H
+#define __GDM_SETTINGS_UTILS_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GdmSettingsEntry GdmSettingsEntry;
+
+GdmSettingsEntry * gdm_settings_entry_new (void);
+GdmSettingsEntry * gdm_settings_entry_copy (GdmSettingsEntry *entry);
+void gdm_settings_entry_free (GdmSettingsEntry *entry);
+
+const char * gdm_settings_entry_get_key (GdmSettingsEntry *entry);
+const char * gdm_settings_entry_get_signature (GdmSettingsEntry *entry);
+const char * gdm_settings_entry_get_default_value (GdmSettingsEntry *entry);
+
+gboolean gdm_settings_parse_schemas (const char *file,
+ const char *root,
+ GSList **list);
+
+gboolean gdm_settings_parse_value_as_boolean (const char *value,
+ gboolean *bool);
+gboolean gdm_settings_parse_value_as_integer (const char *value,
+ int *intval);
+gboolean gdm_settings_parse_value_as_double (const char *value,
+ gdouble *doubleval);
+
+
+G_END_DECLS
+
+#endif /* __GDM_SETTINGS_UTILS_H */
diff --git a/common/gdm-settings.c b/common/gdm-settings.c
new file mode 100644
index 00000000..ee8f0864
--- /dev/null
+++ b/common/gdm-settings.c
@@ -0,0 +1,242 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <glib-object.h>
+#define DBUS_API_SUBJECT_TO_CHANGE
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include "gdm-settings.h"
+#include "gdm-settings-glue.h"
+
+#include "gdm-settings-desktop-backend.h"
+
+#include "gdm-marshal.h"
+
+#define GDM_DBUS_PATH "/org/gnome/DisplayManager"
+#define GDM_SETTINGS_DBUS_PATH GDM_DBUS_PATH "/Settings"
+#define GDM_SETTINGS_DBUS_NAME "org.gnome.DisplayManager.Settings"
+
+#define GDM_SETTINGS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SETTINGS, GdmSettingsPrivate))
+
+struct GdmSettingsPrivate
+{
+ DBusGConnection *connection;
+ GdmSettingsBackend *backend;
+};
+
+enum {
+ VALUE_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint signals [LAST_SIGNAL] = { 0, };
+
+static void gdm_settings_class_init (GdmSettingsClass *klass);
+static void gdm_settings_init (GdmSettings *settings);
+static void gdm_settings_finalize (GObject *object);
+
+static gpointer settings_object = NULL;
+
+G_DEFINE_TYPE (GdmSettings, gdm_settings, G_TYPE_OBJECT)
+
+GQuark
+gdm_settings_error_quark (void)
+{
+ static GQuark ret = 0;
+ if (ret == 0) {
+ ret = g_quark_from_static_string ("gdm_settings_error");
+ }
+
+ return ret;
+}
+
+gboolean
+gdm_settings_get_value (GdmSettings *settings,
+ const char *key,
+ char **value,
+ GError **error)
+{
+ GError *local_error;
+ gboolean res;
+
+ g_return_val_if_fail (GDM_IS_SETTINGS (settings), FALSE);
+ g_return_val_if_fail (key != NULL, FALSE);
+
+ g_debug ("Getting key %s", key);
+
+ local_error = NULL;
+ res = gdm_settings_backend_get_value (settings->priv->backend,
+ key,
+ value,
+ &local_error);
+ if (! res) {
+ g_propagate_error (error, local_error);
+ }
+
+ return res;
+}
+
+gboolean
+gdm_settings_set_value (GdmSettings *settings,
+ const char *key,
+ const char *value,
+ GError **error)
+{
+ g_return_val_if_fail (GDM_IS_SETTINGS (settings), FALSE);
+ g_return_val_if_fail (key != NULL, FALSE);
+
+ g_debug ("Setting key %s", key);
+
+ return FALSE;
+}
+
+static gboolean
+register_settings (GdmSettings *settings)
+{
+ GError *error = NULL;
+
+ error = NULL;
+ settings->priv->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+ if (settings->priv->connection == NULL) {
+ if (error != NULL) {
+ g_critical ("error getting system bus: %s", error->message);
+ g_error_free (error);
+ }
+ exit (1);
+ }
+
+ dbus_g_connection_register_g_object (settings->priv->connection, GDM_SETTINGS_DBUS_PATH, G_OBJECT (settings));
+
+ return TRUE;
+}
+
+/*
+dbus-send --system --print-reply --dest=org.gnome.DisplayManager /org/gnome/DisplayManager/Settings org.freedesktop.DBus.Introspectable.Introspect
+*/
+
+static void
+gdm_settings_class_init (GdmSettingsClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gdm_settings_finalize;
+
+ signals [VALUE_CHANGED] =
+ g_signal_new ("value-changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GdmSettingsClass, value_changed),
+ NULL,
+ NULL,
+ gdm_marshal_VOID__STRING_STRING_STRING,
+ G_TYPE_NONE,
+ 3,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
+
+ g_type_class_add_private (klass, sizeof (GdmSettingsPrivate));
+
+ dbus_g_object_type_install_info (GDM_TYPE_SETTINGS, &dbus_glib_gdm_settings_object_info);
+}
+
+static void
+backend_value_changed (GdmSettingsBackend *backend,
+ const char *key,
+ const char *old_value,
+ const char *new_value,
+ GdmSettings *settings)
+{
+ /* just proxy it */
+ g_signal_emit (settings,
+ signals [VALUE_CHANGED],
+ 0,
+ key,
+ old_value,
+ new_value);
+}
+
+static void
+gdm_settings_init (GdmSettings *settings)
+{
+ settings->priv = GDM_SETTINGS_GET_PRIVATE (settings);
+
+ settings->priv->backend = gdm_settings_desktop_backend_new ();
+ g_signal_connect (settings->priv->backend,
+ "value-changed",
+ G_CALLBACK (backend_value_changed),
+ settings);
+}
+
+static void
+gdm_settings_finalize (GObject *object)
+{
+ GdmSettings *settings;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (GDM_IS_SETTINGS (object));
+
+ settings = GDM_SETTINGS (object);
+
+ g_return_if_fail (settings->priv != NULL);
+
+ if (settings->priv->backend != NULL) {
+ g_object_unref (settings->priv->backend);
+ }
+
+ G_OBJECT_CLASS (gdm_settings_parent_class)->finalize (object);
+}
+
+GdmSettings *
+gdm_settings_new (void)
+{
+ if (settings_object != NULL) {
+ g_object_ref (settings_object);
+ } else {
+ gboolean res;
+
+ settings_object = g_object_new (GDM_TYPE_SETTINGS, NULL);
+ g_object_add_weak_pointer (settings_object,
+ (gpointer *) &settings_object);
+ res = register_settings (settings_object);
+ if (! res) {
+ g_warning ("Unable to register settings");
+ g_object_unref (settings_object);
+ return NULL;
+ }
+ }
+
+ return GDM_SETTINGS (settings_object);
+}
diff --git a/common/gdm-settings.h b/common/gdm-settings.h
new file mode 100644
index 00000000..efd9cb68
--- /dev/null
+++ b/common/gdm-settings.h
@@ -0,0 +1,80 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifndef __GDM_SETTINGS_H
+#define __GDM_SETTINGS_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GDM_TYPE_SETTINGS (gdm_settings_get_type ())
+#define GDM_SETTINGS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SETTINGS, GdmSettings))
+#define GDM_SETTINGS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SETTINGS, GdmSettingsClass))
+#define GDM_IS_SETTINGS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SETTINGS))
+#define GDM_IS_SETTINGS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_SETTINGS))
+#define GDM_SETTINGS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_SETTINGS, GdmSettingsClass))
+
+typedef struct GdmSettingsPrivate GdmSettingsPrivate;
+
+typedef struct
+{
+ GObject parent;
+ GdmSettingsPrivate *priv;
+} GdmSettings;
+
+typedef struct
+{
+ GObjectClass parent_class;
+
+ void (* value_changed) (GdmSettings *settings,
+ const char *key,
+ const char *old_value,
+ const char **new_value);
+} GdmSettingsClass;
+
+typedef enum
+{
+ GDM_SETTINGS_ERROR_GENERAL,
+ GDM_SETTINGS_ERROR_KEY_NOT_FOUND
+} GdmSettingsError;
+
+#define GDM_SETTINGS_ERROR gdm_settings_error_quark ()
+
+GQuark gdm_settings_error_quark (void);
+GType gdm_settings_get_type (void);
+
+GdmSettings * gdm_settings_new (void);
+
+/* exported */
+
+gboolean gdm_settings_get_value (GdmSettings *settings,
+ const char *key,
+ char **value,
+ GError **error);
+gboolean gdm_settings_set_value (GdmSettings *settings,
+ const char *key,
+ const char *value,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __GDM_SETTINGS_H */
diff --git a/common/gdm-settings.xml b/common/gdm-settings.xml
new file mode 100644
index 00000000..bb83dfa3
--- /dev/null
+++ b/common/gdm-settings.xml
@@ -0,0 +1,18 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node name="/org/gnome/DisplayManager/Settings">
+ <interface name="org.gnome.DisplayManager.Settings">
+ <method name="GetValue">
+ <arg name="key" direction="in" type="s"/>
+ <arg name="value" direction="out" type="s"/>
+ </method>
+ <method name="SetValue">
+ <arg name="key" direction="in" type="s"/>
+ <arg name="value" direction="out" type="s"/>
+ </method>
+ <signal name="ValueChanged">
+ <arg name="key" type="s"/>
+ <arg name="old_value" type="s"/>
+ <arg name="new_value" type="s"/>
+ </signal>
+ </interface>
+</node>
diff --git a/common/test-config.c b/common/test-config.c
deleted file mode 100644
index 60194d35..00000000
--- a/common/test-config.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <pwd.h>
-#include <string.h>
-#include <errno.h>
-
-#include <locale.h>
-
-#include <glib.h>
-
-#include "gdm-common.h"
-
-#include "../daemon/gdm-daemon-config-entries.h"
-
-static const char *
-source_to_name (GdmConfigSourceType source)
-{
- const char *name;
-
- switch (source) {
- case GDM_CONFIG_SOURCE_DEFAULT:
- name = "default";
- break;
- case GDM_CONFIG_SOURCE_MANDATORY:
- name = "mandatory";
- break;
- case GDM_CONFIG_SOURCE_CUSTOM:
- name = "custom";
- break;
- case GDM_CONFIG_SOURCE_BUILT_IN:
- name = "built-in";
- break;
- case GDM_CONFIG_SOURCE_RUNTIME_USER:
- name = "runtime-user";
- break;
- case GDM_CONFIG_SOURCE_INVALID:
- name = "Invalid";
- break;
- default:
- name = "Unknown";
- break;
- }
-
- return name;
-}
-
-static const char *
-type_to_name (GdmConfigValueType type)
-{
- const char *name;
-
- switch (type) {
- case GDM_CONFIG_VALUE_INT:
- name = "int";
- break;
- case GDM_CONFIG_VALUE_BOOL:
- name = "boolean";
- break;
- case GDM_CONFIG_VALUE_STRING:
- name = "string";
- break;
- case GDM_CONFIG_VALUE_LOCALE_STRING:
- name = "locale-string";
- break;
- case GDM_CONFIG_VALUE_STRING_ARRAY:
- name = "string-array";
- break;
- case GDM_CONFIG_VALUE_LOCALE_STRING_ARRAY:
- name = "locale-string-array";
- break;
- case GDM_CONFIG_VALUE_INVALID:
- name = "invalid";
- break;
- default:
- name = "unknown";
- break;
- }
-
- return name;
-}
-
-static gboolean
-notify_cb (GdmConfig *config,
- GdmConfigSourceType source,
- const char *group,
- const char *key,
- GdmConfigValue *value,
- int id,
- gpointer data)
-{
- char *str;
-
- if (value == NULL) {
- return FALSE;
- }
-
- str = gdm_config_value_to_string (value);
-
- g_print ("SOURCE=%s GROUP=%s KEY=%s ID=%d TYPE=%s VALUE=%s\n", source_to_name (source), group, key, id, type_to_name (value->type), str);
- if (strcmp (group, GDM_CONFIG_GROUP_CUSTOM_CMD) == 0 &&
- g_str_has_prefix (key, "CustomCommand") &&
- strlen (key) == 14) {
- g_message ("NOTIFY: Custom command");
- }
-
- g_free (str);
- return TRUE;
-}
-
-static gboolean
-validate_cb (GdmConfig *config,
- GdmConfigSourceType source,
- const char *group,
- const char *key,
- GdmConfigValue *value,
- int id,
- gpointer data)
-{
- /* Here you can do validation or override the values */
-
- switch (id) {
- case GDM_ID_SOUND_PROGRAM:
- gdm_config_value_set_string (value, "NONE");
- break;
- case GDM_ID_NONE:
- default:
- /* doesn't have an ID : match group/key */
- break;
- }
-
- return TRUE;
-}
-
-static void
-load_servers_group (GdmConfig *config)
-{
- char **keys;
- gsize len;
- int i;
-
- keys = gdm_config_get_keys_for_group (config, GDM_CONFIG_GROUP_SERVERS, &len, NULL);
- g_message ("Got %d keys for group %s", (int)len, GDM_CONFIG_GROUP_SERVERS);
-
- /* now construct entries for these groups */
- for (i = 0; i < len; i++) {
- GdmConfigEntry entry;
- GdmConfigValue *value;
- char *new_group;
- gboolean res;
- int j;
-
- entry.group = GDM_CONFIG_GROUP_SERVERS;
- entry.key = keys[i];
- entry.type = GDM_CONFIG_VALUE_STRING;
- entry.default_value = NULL;
- entry.id = GDM_CONFIG_INVALID_ID;
-
- gdm_config_add_entry (config, &entry);
- gdm_config_process_entry (config, &entry, NULL);
-
- res = gdm_config_get_value (config, entry.group, entry.key, &value);
- if (! res) {
- continue;
- }
-
- new_group = g_strdup_printf ("server-%s", gdm_config_value_get_string (value));
- gdm_config_value_free (value);
-
- for (j = 0; j < G_N_ELEMENTS (gdm_daemon_server_config_entries); j++) {
- GdmConfigEntry *srv_entry;
- if (gdm_daemon_server_config_entries[j].key == NULL) {
- continue;
- }
- srv_entry = gdm_config_entry_copy (&gdm_daemon_server_config_entries[j]);
- g_free (srv_entry->group);
- srv_entry->group = g_strdup (new_group);
- gdm_config_process_entry (config, srv_entry, NULL);
- gdm_config_entry_free (srv_entry);
- }
- g_free (new_group);
- }
-}
-
-static void
-test_config (void)
-{
- GdmConfig *config;
- GError *error;
- int i;
-
- config = gdm_config_new ();
-
- gdm_config_set_notify_func (config, notify_cb, NULL);
- gdm_config_set_validate_func (config, validate_cb, NULL);
-
- gdm_config_add_static_entries (config, gdm_daemon_config_entries);
-
- /* At first try loading with only defaults */
- gdm_config_set_default_file (config, DATADIR "/gdm/defaults.conf");
-
- g_message ("Loading configuration: Default source only");
-
- /* load the data files */
- error = NULL;
- gdm_config_load (config, &error);
- if (error != NULL) {
- g_warning ("Unable to load configuration: %s", error->message);
- g_error_free (error);
- } else {
- /* populate the database with all specified entries */
- gdm_config_process_all (config, &error);
- }
-
- g_message ("Getting all standard values");
- /* now test retrieving these values */
- for (i = 0; gdm_daemon_config_entries [i].group != NULL; i++) {
- GdmConfigValue *value;
- const GdmConfigEntry *entry;
- gboolean res;
- char *str;
-
- entry = &gdm_daemon_config_entries [i];
-
- res = gdm_config_get_value (config, entry->group, entry->key, &value);
- if (! res) {
- g_warning ("Unable to lookup entry g=%s k=%s", entry->group, entry->key);
- continue;
- }
-
- str = gdm_config_value_to_string (value);
-
- g_print ("Got g=%s k=%s: %s\n", entry->group, entry->key, str);
-
- g_free (str);
- gdm_config_value_free (value);
- }
-
- g_message ("Setting values");
- /* now test setting a few values */
- {
- GdmConfigValue *value;
- value = gdm_config_value_new_from_string (GDM_CONFIG_VALUE_BOOL, "false", NULL);
- gdm_config_set_value (config, "greeter", "ShowLastSession", value);
- /* should only see one notification */
- gdm_config_set_value (config, "greeter", "ShowLastSession", value);
- gdm_config_value_free (value);
- }
-
- g_message ("Loading the server entries");
- load_servers_group (config);
-
- g_message ("Loading configuration: Default and Custom sources");
- /* Now try adding a custom config */
- gdm_config_set_custom_file (config, GDMCONFDIR "/custom.conf");
- /* load the data files */
- error = NULL;
- gdm_config_load (config, &error);
- if (error != NULL) {
- g_warning ("Unable to load configuration: %s", error->message);
- g_error_free (error);
- } else {
- /* populate the database with all specified entries */
- gdm_config_process_all (config, &error);
- }
-
-
- /* Test translated keys */
-
- gdm_config_free (config);
-}
-
-int
-main (int argc, char **argv)
-{
-
- test_config ();
-
- return 0;
-}
diff --git a/common/test-settings-client.c b/common/test-settings-client.c
new file mode 100644
index 00000000..74a8725b
--- /dev/null
+++ b/common/test-settings-client.c
@@ -0,0 +1,75 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <string.h>
+#include <errno.h>
+
+#include <locale.h>
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "gdm-settings-client.h"
+#include "gdm-settings-keys.h"
+
+static gboolean
+test_settings_client (void)
+{
+ char *strval;
+ gboolean boolval;
+ int intval;
+ gboolean res;
+
+ if (! gdm_settings_client_init (GDMCONFDIR "/gdm.schemas", "/")) {
+ exit (1);
+ }
+
+ strval = NULL;
+ res = gdm_settings_client_get_string (GDM_KEY_GREETER, &strval);
+ g_message ("Got res=%d %s=%s", res, GDM_KEY_GREETER, strval);
+ g_free (strval);
+
+ res = gdm_settings_client_get_boolean (GDM_KEY_XDMCP, &boolval);
+ g_message ("Got res=%d %s=%s", res, GDM_KEY_XDMCP, boolval ? "true" : "false");
+
+ /* This should assert */
+ strval = NULL;
+ res = gdm_settings_client_get_string (GDM_KEY_XDMCP, &strval);
+ g_message ("Got res=%d %s=%s", res, GDM_KEY_XDMCP, strval);
+ g_free (strval);
+
+ gdm_settings_client_shutdown ();
+
+ return FALSE;
+}
+
+int
+main (int argc, char **argv)
+{
+ g_type_init ();
+ test_settings_client ();
+ return 0;
+}
diff --git a/common/test-settings-server.c b/common/test-settings-server.c
new file mode 100644
index 00000000..cc2f609e
--- /dev/null
+++ b/common/test-settings-server.c
@@ -0,0 +1,168 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <string.h>
+#include <errno.h>
+
+#include <locale.h>
+
+#include <glib.h>
+
+#define DBUS_API_SUBJECT_TO_CHANGE
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include "gdm-settings.h"
+
+#define GDM_DBUS_NAME "org.gnome.DisplayManager"
+
+static GdmSettings *settings = NULL;
+
+static gboolean
+acquire_name_on_proxy (DBusGProxy *bus_proxy)
+{
+ GError *error;
+ guint result;
+ gboolean res;
+ gboolean ret;
+
+ ret = FALSE;
+
+ if (bus_proxy == NULL) {
+ goto out;
+ }
+
+ error = NULL;
+ res = dbus_g_proxy_call (bus_proxy,
+ "RequestName",
+ &error,
+ G_TYPE_STRING, GDM_DBUS_NAME,
+ G_TYPE_UINT, 0,
+ G_TYPE_INVALID,
+ G_TYPE_UINT, &result,
+ G_TYPE_INVALID);
+ if (! res) {
+ if (error != NULL) {
+ g_warning ("Failed to acquire %s: %s", GDM_DBUS_NAME, error->message);
+ g_error_free (error);
+ } else {
+ g_warning ("Failed to acquire %s", GDM_DBUS_NAME);
+ }
+ goto out;
+ }
+
+ if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
+ if (error != NULL) {
+ g_warning ("Failed to acquire %s: %s", GDM_DBUS_NAME, error->message);
+ g_error_free (error);
+ } else {
+ g_warning ("Failed to acquire %s", GDM_DBUS_NAME);
+ }
+ goto out;
+ }
+
+ ret = TRUE;
+
+ out:
+ return ret;
+}
+
+static DBusGProxy *
+get_bus_proxy (DBusGConnection *connection)
+{
+ DBusGProxy *bus_proxy;
+
+ bus_proxy = dbus_g_proxy_new_for_name (connection,
+ DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS,
+ DBUS_INTERFACE_DBUS);
+ return bus_proxy;
+}
+
+static DBusGConnection *
+get_system_bus (void)
+{
+ GError *error;
+ DBusGConnection *bus;
+ DBusConnection *connection;
+
+ error = NULL;
+ bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+ if (bus == NULL) {
+ g_warning ("Couldn't connect to system bus: %s",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ connection = dbus_g_connection_get_connection (bus);
+ dbus_connection_set_exit_on_disconnect (connection, FALSE);
+
+ out:
+ return bus;
+}
+
+int
+main (int argc, char **argv)
+{
+ GMainLoop *main_loop;
+ DBusGConnection *connection;
+ DBusGProxy *bus_proxy;
+
+ g_type_init ();
+
+ connection = get_system_bus ();
+ if (connection == NULL) {
+ goto out;
+ }
+
+ bus_proxy = get_bus_proxy (connection);
+ if (bus_proxy == NULL) {
+ g_warning ("Could not construct bus_proxy object; bailing out");
+ goto out;
+ }
+
+ if (! acquire_name_on_proxy (bus_proxy) ) {
+ g_warning ("Could not acquire name; bailing out");
+ goto out;
+ }
+
+ settings = gdm_settings_new ();
+ if (settings == NULL) {
+ g_warning ("Unable to initialize settings");
+ exit (1);
+ }
+
+ main_loop = g_main_loop_new (NULL, FALSE);
+ g_main_loop_run (main_loop);
+
+ g_main_loop_unref (main_loop);
+
+ g_object_unref (settings);
+
+ out:
+ return 0;
+}
diff --git a/configure.ac b/configure.ac
index 7e4de566..b6585331 100644
--- a/configure.ac
+++ b/configure.ac
@@ -151,6 +151,8 @@ AC_STDC_HEADERS
dnl AC_ARG_PROGRAM
AM_PROG_LIBTOOL
+AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
+
AC_PATH_XTRA
dnl socklen_t may be declared, but not in a "standard" C header location
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 8879ee2b..2b1489da 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -93,9 +93,6 @@ sbin_PROGRAMS = \
gdm_binary_SOURCES = \
gdm.h \
main.c \
- gdm-master-config.c \
- gdm-master-config.h \
- gdm-daemon-config-entries.h \
gdm-display-store.c \
gdm-display-store.h \
gdm-display.c \
@@ -108,7 +105,6 @@ gdm_binary_SOURCES = \
gdm-manager.h \
gdm-slave-proxy.c \
gdm-slave-proxy.h \
- gdm-daemon-config-keys.h \
gdm-socket-protocol.h \
auth.c \
auth.h \
diff --git a/daemon/auth.c b/daemon/auth.c
index f0730138..0a63fb06 100644
--- a/daemon/auth.c
+++ b/daemon/auth.c
@@ -43,7 +43,6 @@
#include "gdm-common.h"
#include "gdm-log.h"
-#include "gdm-master-config.h"
/* Ensure we know about FamilyInternetV6 even if what we're compiling
against doesn't */
diff --git a/daemon/choose.c b/daemon/choose.c
index a460b31e..ad5e653b 100644
--- a/daemon/choose.c
+++ b/daemon/choose.c
@@ -45,11 +45,12 @@
#include "gdm-address.h"
#include "gdm-common.h"
#include "gdm-log.h"
-#include "gdm-master-config.h"
-#include "gdm-daemon-config-entries.h"
#include "gdm-socket-protocol.h"
+#include "gdm-settings-keys.h"
+#include "gdm-settings-direct.h"
+
static gint ipending = 0;
static GSList *indirect = NULL;
@@ -132,15 +133,11 @@ get_first_address_for_node (const char *node,
}
static int
-get_config_int (int id)
+get_config_int (char *key)
{
- GdmDaemonConfig *dc;
- int val;
-
- dc = gdm_daemon_config_new ();
- gdm_daemon_config_get_int_for_id (dc, id, &val);
+ int val;
- g_object_unref (dc);
+ gdm_settings_direct_get_int (key, &val);
return val;
}
@@ -190,7 +187,7 @@ gdm_choose_data (const char *data)
GdmIndirectDisplay *idisp = li->data;
if (idisp->id == id) {
/* whack the oldest if more then allowed */
- while (ipending >= get_config_int (GDM_ID_MAX_INDIRECT) &&
+ while (ipending >= get_config_int (GDM_KEY_MAX_INDIRECT) &&
remove_oldest_pending ())
;
@@ -319,7 +316,7 @@ gdm_choose_indirect_lookup (GdmAddress *address)
continue;
if (id->acctime > 0 &&
- curtime > id->acctime + get_config_int (GDM_ID_MAX_WAIT_INDIRECT)) {
+ curtime > id->acctime + get_config_int (GDM_KEY_MAX_WAIT_INDIRECT)) {
gdm_address_get_numeric_info (address, &host, NULL);
g_debug ("gdm_choose_indirect_check: Disposing stale INDIRECT query from %s",
diff --git a/daemon/gdm-daemon-config-entries.h b/daemon/gdm-daemon-config-entries.h
deleted file mode 100644
index ca9aa42c..00000000
--- a/daemon/gdm-daemon-config-entries.h
+++ /dev/null
@@ -1,566 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _GDM_DAEMON_CONFIG_ENTRIES_H
-#define _GDM_DAEMON_CONFIG_ENTRIES_H
-
-#include <glib.h>
-
-#include "gdm-config.h"
-
-G_BEGIN_DECLS
-
-#define GDM_CONFIG_GROUP_NONE NULL
-#define GDM_CONFIG_GROUP_DAEMON "daemon"
-#define GDM_CONFIG_GROUP_SECURITY "security"
-#define GDM_CONFIG_GROUP_XDMCP "xdmcp"
-#define GDM_CONFIG_GROUP_GREETER "greeter"
-#define GDM_CONFIG_GROUP_GUI "gui"
-#define GDM_CONFIG_GROUP_CUSTOM_CMD "customcommand"
-#define GDM_CONFIG_GROUP_CHOOSER "chooser"
-#define GDM_CONFIG_GROUP_SERVERS "servers"
-#define GDM_CONFIG_GROUP_DEBUG "debug"
-
-#define GDM_CONFIG_GROUP_SERVER_PREFIX "server-"
-
-#include "gdm-daemon-config-keys.h"
-
-typedef enum {
- GDM_ID_NONE,
- GDM_ID_DEBUG,
- GDM_ID_DEBUG_GESTURES,
- GDM_ID_CHOOSER,
- GDM_ID_AUTOMATIC_LOGIN_ENABLE,
- GDM_ID_AUTOMATIC_LOGIN,
- GDM_ID_GREETER,
- GDM_ID_REMOTE_GREETER,
- GDM_ID_ADD_GTK_MODULES,
- GDM_ID_GTK_MODULES_LIST,
- GDM_ID_GROUP,
- GDM_ID_HALT,
- GDM_ID_DISPLAY_INIT_DIR,
- GDM_ID_KILL_INIT_CLIENTS,
- GDM_ID_LOG_DIR,
- GDM_ID_PATH,
- GDM_ID_POSTSESSION,
- GDM_ID_PRESESSION,
- GDM_ID_POSTLOGIN,
- GDM_ID_FAILSAFE_XSERVER,
- GDM_ID_X_KEEPS_CRASHING,
- GDM_ID_REBOOT ,
- GDM_ID_CUSTOM_CMD_TEMPLATE,
- GDM_ID_CUSTOM_CMD_LABEL_TEMPLATE,
- GDM_ID_CUSTOM_CMD_LR_LABEL_TEMPLATE,
- GDM_ID_CUSTOM_CMD_TEXT_TEMPLATE,
- GDM_ID_CUSTOM_CMD_TOOLTIP_TEMPLATE,
- GDM_ID_CUSTOM_CMD_NO_RESTART_TEMPLATE,
- GDM_ID_CUSTOM_CMD_IS_PERSISTENT_TEMPLATE,
- GDM_ID_ROOT_PATH,
- GDM_ID_SESSION_DESKTOP_DIR,
- GDM_ID_BASE_XSESSION,
- GDM_ID_DEFAULT_SESSION,
- GDM_ID_SUSPEND,
- GDM_ID_USER_AUTHDIR,
- GDM_ID_USER_AUTHDIR_FALLBACK,
- GDM_ID_USER_AUTHFILE,
- GDM_ID_USER,
- GDM_ID_CONSOLE_NOTIFY,
- GDM_ID_DOUBLE_LOGIN_WARNING,
- GDM_ID_ALWAYS_LOGIN_CURRENT_SESSION,
- GDM_ID_DISPLAY_LAST_LOGIN,
- GDM_ID_TIMED_LOGIN_ENABLE,
- GDM_ID_TIMED_LOGIN,
- GDM_ID_TIMED_LOGIN_DELAY,
- GDM_ID_FLEXI_REAP_DELAY_MINUTES,
- GDM_ID_STANDARD_XSERVER,
- GDM_ID_FLEXIBLE_XSERVERS,
- GDM_ID_DYNAMIC_XSERVERS,
- GDM_ID_XNEST,
- GDM_ID_XNEST_UNSCALED_FONT_PATH,
- GDM_ID_FIRST_VT,
- GDM_ID_VT_ALLOCATION,
- GDM_ID_CONSOLE_CANNOT_HANDLE,
- GDM_ID_XSERVER_TIMEOUT,
- GDM_ID_SERVER_PREFIX,
- GDM_ID_SERVER_NAME,
- GDM_ID_SERVER_COMMAND,
- GDM_ID_SERVER_FLEXIBLE,
- GDM_ID_SERVER_CHOOSABLE,
- GDM_ID_SERVER_HANDLED,
- GDM_ID_SERVER_CHOOSER,
- GDM_ID_SERVER_PRIORITY,
- GDM_ID_ALLOW_ROOT,
- GDM_ID_ALLOW_REMOTE_ROOT,
- GDM_ID_ALLOW_REMOTE_AUTOLOGIN,
- GDM_ID_USER_MAX_FILE,
- GDM_ID_RELAX_PERM,
- GDM_ID_CHECK_DIR_OWNER,
- GDM_ID_SUPPORT_AUTOMOUNT,
- GDM_ID_RETRY_DELAY,
- GDM_ID_DISALLOW_TCP,
- GDM_ID_PAM_STACK,
- GDM_ID_NEVER_PLACE_COOKIES_ON_NFS,
- GDM_ID_PASSWORD_REQUIRED,
- GDM_ID_XDMCP,
- GDM_ID_MAX_PENDING,
- GDM_ID_MAX_SESSIONS,
- GDM_ID_MAX_WAIT,
- GDM_ID_DISPLAYS_PER_HOST,
- GDM_ID_UDP_PORT,
- GDM_ID_INDIRECT,
- GDM_ID_MAX_INDIRECT,
- GDM_ID_MAX_WAIT_INDIRECT,
- GDM_ID_PING_INTERVAL,
- GDM_ID_WILLING,
- GDM_ID_XDMCP_PROXY,
- GDM_ID_XDMCP_PROXY_XSERVER,
- GDM_ID_XDMCP_PROXY_RECONNECT,
- GDM_ID_GTK_THEME,
- GDM_ID_GTKRC,
- GDM_ID_MAX_ICON_WIDTH,
- GDM_ID_MAX_ICON_HEIGHT,
- GDM_ID_ALLOW_GTK_THEME_CHANGE,
- GDM_ID_GTK_THEMES_TO_ALLOW,
- GDM_ID_BROWSER,
- GDM_ID_INCLUDE,
- GDM_ID_EXCLUDE,
- GDM_ID_INCLUDE_ALL,
- GDM_ID_MINIMAL_UID,
- GDM_ID_DEFAULT_FACE,
- GDM_ID_GLOBAL_FACE_DIR,
- GDM_ID_LOCALE_FILE,
- GDM_ID_LOGO,
- GDM_ID_CHOOSER_BUTTON_LOGO,
- GDM_ID_QUIVER,
- GDM_ID_SYSTEM_MENU,
- GDM_ID_CONFIGURATOR,
- GDM_ID_CONFIG_AVAILABLE,
- GDM_ID_CHOOSER_BUTTON,
- GDM_ID_TITLE_BAR,
- GDM_ID_DEFAULT_WELCOME,
- GDM_ID_DEFAULT_REMOTE_WELCOME,
- GDM_ID_WELCOME,
- GDM_ID_REMOTE_WELCOME,
- GDM_ID_XINERAMA_SCREEN,
- GDM_ID_BACKGROUND_PROGRAM,
- GDM_ID_RUN_BACKGROUND_PROGRAM_ALWAYS,
- GDM_ID_BACKGROUND_PROGRAM_INITIAL_DELAY,
- GDM_ID_RESTART_BACKGROUND_PROGRAM,
- GDM_ID_BACKGROUND_PROGRAM_RESTART_DELAY,
- GDM_ID_BACKGROUND_IMAGE,
- GDM_ID_BACKGROUND_COLOR,
- GDM_ID_BACKGROUND_TYPE,
- GDM_ID_BACKGROUND_SCALE_TO_FIT,
- GDM_ID_BACKGROUND_REMOTE_ONLY_COLOR,
- GDM_ID_LOCK_POSITION,
- GDM_ID_SET_POSITION,
- GDM_ID_POSITION_X,
- GDM_ID_POSITION_Y,
- GDM_ID_USE_24_CLOCK,
- GDM_ID_ENTRY_CIRCLES,
- GDM_ID_ENTRY_INVISIBLE,
- GDM_ID_GRAPHICAL_THEME,
- GDM_ID_GRAPHICAL_THEMES,
- GDM_ID_GRAPHICAL_THEME_RAND,
- GDM_ID_GRAPHICAL_THEME_DIR,
- GDM_ID_GRAPHICAL_THEMED_COLOR,
- GDM_ID_INFO_MSG_FILE,
- GDM_ID_INFO_MSG_FONT,
- GDM_ID_PRE_FETCH_PROGRAM,
- GDM_ID_SOUND_ON_LOGIN,
- GDM_ID_SOUND_ON_LOGIN_SUCCESS,
- GDM_ID_SOUND_ON_LOGIN_FAILURE,
- GDM_ID_SOUND_ON_LOGIN_FILE,
- GDM_ID_SOUND_ON_LOGIN_SUCCESS_FILE,
- GDM_ID_SOUND_ON_LOGIN_FAILURE_FILE,
- GDM_ID_SOUND_PROGRAM,
- GDM_ID_SCAN_TIME,
- GDM_ID_DEFAULT_HOST_IMG,
- GDM_ID_HOST_IMAGE_DIR,
- GDM_ID_HOSTS,
- GDM_ID_MULTICAST,
- GDM_ID_MULTICAST_ADDR,
- GDM_ID_BROADCAST,
- GDM_ID_ALLOW_ADD,
- GDM_ID_SECTION_GREETER,
- GDM_ID_SECTION_SERVERS,
- GDM_ID_SHOW_GNOME_FAILSAFE,
- GDM_ID_SHOW_XTERM_FAILSAFE,
- GDM_ID_SHOW_LAST_SESSION,
- GDM_ID_SYSTEM_COMMANDS_IN_MENU,
- GDM_ID_ALLOW_LOGOUT_ACTIONS,
- GDM_ID_RBAC_SYSTEM_COMMAND_KEYS,
- GDK_ID_LAST
-} GdmConfigKey;
-
-
-/*
- * The following section contains keys used by the GDM configuration files.
- * The key/value pairs defined in the GDM configuration files are considered
- * "stable" interface and should only change in ways that are backwards
- * compatible. Please keep this in mind when changing GDM configuration.
- *
- * Developers who add new configuration options should ensure that they do the
- * following:
- *
- * + Add the key to config/gdm.conf.in file and specify the default value.
- * Include comments explaining what the key does.
- *
- * + Add the key as a #define to daemon/gdm-daemon-config-keys.h with
- * the same default value.
- *
- * + Update the GdmConfigKey enumeration and gdm_daemon_config_entries[] to
- * add the new key. Include some documentation about the new key,
- * following the style of existing comments.
- *
- * + Add any validation to the validate_cb function in
- * gdm-daemon-config.c, if validation is needed.
- *
- * + If GDM_UPDATE_CONFIG should not respond to this configuration setting,
- * update the gdm_daemon_config_update_key function in gdmconfig.c to
- * return FALSE for this key. Examples include changing the ServAuthDir
- * or other values that GDM should not change until it is restarted. If
- * this is true, the next bullet can be ignored.
- *
- * + If the option should cause the greeter (gdmlogin/gdmgreeter) program to
- * be updated immediately, update the notify_cb and lookup_notify_key
- * functions to handle this key.
- *
- * + Add the key to the gdm_read_config and gdm_reread_config functions in
- * gui/gdmlogin.c, gui/gdmchooser.c, and gui/greeter/greeter.c
- * if the key is used by those programs. Note that all GDM slaves load
- * all their configuration data between calls to gdmcomm_comm_bulk_start()
- * and gdmcomm_comm_bulk_stop(). This makes sure that the slave only uses
- * a single sockets connection to get all configuration data. If a new
- * config value is read by a slave, make sure to load the key in this
- * code section for best performance.
- *
- * + The gui/gdmsetup.c program should be updated to support the new option
- * unless there's a good reason not to.
- *
- * + Currently GDM treats any key in the "gui" and "greeter" categories,
- * and security/PamStack as available for per-display configuration.
- * If a key is appropriate for per-display configuration, and is not
- * in the "gui" or "greeter" categories, then it will need to be added
- * to the gdm_config_key_to_string_per_display function. It may make
- * sense for some keys used by the daemon to be per-display so this
- * will need to be coded (refer to GDM_ID_PAM_STACK for an example).
- *
- * + Update the docs/C/gdm.xml file to include information about the new
- * option. Include information about any other interfaces (such as
- * ENVIRONMENT variables) that may affect the configuration option.
- * Patches without documentation will not be accepted.
- *
- * Please do this work *before* submitting an patch. Patches that are not
- * complete will not likely be accepted.
- */
-
-#define GDM_DEFAULT_WELCOME_MSG "Welcome"
-#define GDM_DEFAULT_REMOTE_WELCOME_MSG "Welcome to %n"
-
-/* These are processed in order so debug should always be first */
-static const GdmConfigEntry gdm_daemon_config_entries [] = {
- { GDM_CONFIG_GROUP_DEBUG, "Gestures", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_DEBUG_GESTURES },
-
-
- { GDM_CONFIG_GROUP_DAEMON, "Chooser", GDM_CONFIG_VALUE_STRING, LIBEXECDIR "/gdmchooser", GDM_ID_CHOOSER },
- { GDM_CONFIG_GROUP_DAEMON, "AutomaticLoginEnable", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_AUTOMATIC_LOGIN_ENABLE },
- { GDM_CONFIG_GROUP_DAEMON, "AutomaticLogin", GDM_CONFIG_VALUE_STRING, "", GDM_ID_AUTOMATIC_LOGIN },
-
- /* The SDTLOGIN feature is Solaris specific, and causes the Xserver to be
- * run with user permissionsinstead of as root, which adds security but,
- * disables the AlwaysRestartServer option as highlighted in the gdm
- * documentation */
-
- { GDM_CONFIG_GROUP_DAEMON, "Greeter", GDM_CONFIG_VALUE_STRING, LIBEXECDIR "/gdmlogin", GDM_ID_GREETER },
- { GDM_CONFIG_GROUP_DAEMON, "RemoteGreeter", GDM_CONFIG_VALUE_STRING, LIBEXECDIR "/gdmlogin", GDM_ID_REMOTE_GREETER },
- { GDM_CONFIG_GROUP_DAEMON, "AddGtkModules", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_ADD_GTK_MODULES },
- { GDM_CONFIG_GROUP_DAEMON, "GtkModulesList", GDM_CONFIG_VALUE_STRING, NULL, GDM_ID_GTK_MODULES_LIST },
-
- { GDM_CONFIG_GROUP_DAEMON, "User", GDM_CONFIG_VALUE_STRING, "gdm", GDM_ID_USER },
- { GDM_CONFIG_GROUP_DAEMON, "Group", GDM_CONFIG_VALUE_STRING, "gdm", GDM_ID_GROUP },
-
- { GDM_CONFIG_GROUP_DAEMON, "HaltCommand", GDM_CONFIG_VALUE_STRING_ARRAY, HALT_COMMAND, GDM_ID_HALT },
- { GDM_CONFIG_GROUP_DAEMON, "RebootCommand", GDM_CONFIG_VALUE_STRING_ARRAY, REBOOT_COMMAND, GDM_ID_REBOOT },
- { GDM_CONFIG_GROUP_DAEMON, "SuspendCommand", GDM_CONFIG_VALUE_STRING_ARRAY, SUSPEND_COMMAND, GDM_ID_SUSPEND },
-
- { GDM_CONFIG_GROUP_DAEMON, "DisplayInitDir", GDM_CONFIG_VALUE_STRING, GDMCONFDIR "/Init", GDM_ID_DISPLAY_INIT_DIR },
- { GDM_CONFIG_GROUP_DAEMON, "KillInitClients", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_KILL_INIT_CLIENTS },
- { GDM_CONFIG_GROUP_DAEMON, "LogDir", GDM_CONFIG_VALUE_STRING, LOGDIR, GDM_ID_LOG_DIR },
- { GDM_CONFIG_GROUP_DAEMON, "DefaultPath", GDM_CONFIG_VALUE_STRING, GDM_USER_PATH, GDM_ID_PATH },
- { GDM_CONFIG_GROUP_DAEMON, "PostSessionScriptDir", GDM_CONFIG_VALUE_STRING, GDMCONFDIR "/PostSession/", GDM_ID_POSTSESSION },
- { GDM_CONFIG_GROUP_DAEMON, "PreSessionScriptDir", GDM_CONFIG_VALUE_STRING, GDMCONFDIR "/PreSession/", GDM_ID_PRESESSION },
- { GDM_CONFIG_GROUP_DAEMON, "PostLoginScriptDir", GDM_CONFIG_VALUE_STRING, GDMCONFDIR "/PreSession/", GDM_ID_POSTLOGIN },
- { GDM_CONFIG_GROUP_DAEMON, "FailsafeXServer", GDM_CONFIG_VALUE_STRING, NULL, GDM_ID_FAILSAFE_XSERVER },
- { GDM_CONFIG_GROUP_DAEMON, "XKeepsCrashing", GDM_CONFIG_VALUE_STRING, GDMCONFDIR "/XKeepsCrashing", GDM_ID_X_KEEPS_CRASHING },
- { GDM_CONFIG_GROUP_DAEMON, "RootPath", GDM_CONFIG_VALUE_STRING, "/sbin:/usr/sbin:" GDM_USER_PATH, GDM_ID_ROOT_PATH },
- { GDM_CONFIG_GROUP_DAEMON, "SessionDesktopDir", GDM_CONFIG_VALUE_STRING, "/etc/X11/sessions/:" DMCONFDIR "/Sessions/:" DATADIR "/gdm/BuiltInSessions/:" DATADIR "/xsessions/", GDM_ID_SESSION_DESKTOP_DIR },
- { GDM_CONFIG_GROUP_DAEMON, "BaseXsession", GDM_CONFIG_VALUE_STRING, GDMCONFDIR "/Xsession", GDM_ID_BASE_XSESSION },
- { GDM_CONFIG_GROUP_DAEMON, "DefaultSession", GDM_CONFIG_VALUE_STRING, "gnome.desktop", GDM_ID_DEFAULT_SESSION },
-
- { GDM_CONFIG_GROUP_DAEMON, "UserAuthDir", GDM_CONFIG_VALUE_STRING, "", GDM_ID_USER_AUTHDIR },
- { GDM_CONFIG_GROUP_DAEMON, "UserAuthFBDir", GDM_CONFIG_VALUE_STRING, "/tmp", GDM_ID_USER_AUTHDIR_FALLBACK },
- { GDM_CONFIG_GROUP_DAEMON, "UserAuthFile", GDM_CONFIG_VALUE_STRING, ".Xauthority", GDM_ID_USER_AUTHFILE },
- { GDM_CONFIG_GROUP_DAEMON, "ConsoleNotify", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_CONSOLE_NOTIFY },
-
- { GDM_CONFIG_GROUP_DAEMON, "DoubleLoginWarning", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_DOUBLE_LOGIN_WARNING },
- { GDM_CONFIG_GROUP_DAEMON, "AlwaysLoginCurrentSession", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_ALWAYS_LOGIN_CURRENT_SESSION },
-
- { GDM_CONFIG_GROUP_DAEMON, "DisplayLastLogin", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_DISPLAY_LAST_LOGIN },
-
- { GDM_CONFIG_GROUP_DAEMON, "TimedLoginEnable", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_TIMED_LOGIN_ENABLE },
- { GDM_CONFIG_GROUP_DAEMON, "TimedLogin", GDM_CONFIG_VALUE_STRING, "", GDM_ID_TIMED_LOGIN },
- { GDM_CONFIG_GROUP_DAEMON, "TimedLoginDelay", GDM_CONFIG_VALUE_INT, "30", GDM_ID_TIMED_LOGIN_DELAY },
-
- { GDM_CONFIG_GROUP_DAEMON, "FlexiReapDelayMinutes", GDM_CONFIG_VALUE_INT, "5", GDM_ID_FLEXI_REAP_DELAY_MINUTES },
-
- { GDM_CONFIG_GROUP_DAEMON, "StandardXServer", GDM_CONFIG_VALUE_STRING, X_SERVER, GDM_ID_STANDARD_XSERVER },
- { GDM_CONFIG_GROUP_DAEMON, "FlexibleXServers", GDM_CONFIG_VALUE_INT, "5", GDM_ID_FLEXIBLE_XSERVERS },
- { GDM_CONFIG_GROUP_DAEMON, "DynamicXServers", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_DYNAMIC_XSERVERS },
- { GDM_CONFIG_GROUP_DAEMON, "Xnest", GDM_CONFIG_VALUE_STRING, X_XNEST_CMD ", " X_XNEST_CONFIG_OPTIONS, GDM_ID_XNEST },
- { GDM_CONFIG_GROUP_DAEMON, "XnestUnscaledFontPath", GDM_CONFIG_VALUE_BOOL, X_XNEST_UNSCALED_FONTPATH, GDM_ID_XNEST_UNSCALED_FONT_PATH },
-
- /* Keys for automatic VT allocation rather then letting it up to the X server */
- { GDM_CONFIG_GROUP_DAEMON, "FirstVT", GDM_CONFIG_VALUE_INT, "7", GDM_ID_FIRST_VT },
- { GDM_CONFIG_GROUP_DAEMON, "VTAllocation", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_VT_ALLOCATION },
-
- { GDM_CONFIG_GROUP_DAEMON, "ConsoleCannotHandle", GDM_CONFIG_VALUE_STRING, "am,ar,az,bn,el,fa,gu,hi,ja,ko,ml,mr,pa,ta,zh", GDM_ID_CONSOLE_CANNOT_HANDLE },
-
- /* How long to wait before assuming an Xserver has timed out */
- { GDM_CONFIG_GROUP_DAEMON, "GdmXserverTimeout", GDM_CONFIG_VALUE_INT, "10", GDM_ID_XSERVER_TIMEOUT },
-
- { GDM_CONFIG_GROUP_DAEMON, "SystemCommandsInMenu", GDM_CONFIG_VALUE_STRING_ARRAY, "HALT;REBOOT;SUSPEND;CUSTOM_CMD", GDM_ID_SYSTEM_COMMANDS_IN_MENU },
- { GDM_CONFIG_GROUP_DAEMON, "AllowLogoutActions", GDM_CONFIG_VALUE_STRING_ARRAY, "HALT;REBOOT;SUSPEND;CUSTOM_CMD", GDM_ID_ALLOW_LOGOUT_ACTIONS },
- { GDM_CONFIG_GROUP_DAEMON, "RBACSystemCommandKeys", GDM_CONFIG_VALUE_STRING_ARRAY, GDM_RBAC_SYSCMD_KEYS, GDM_ID_RBAC_SYSTEM_COMMAND_KEYS },
-
- { GDM_CONFIG_GROUP_SECURITY, "AllowRoot", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_ALLOW_ROOT },
- { GDM_CONFIG_GROUP_SECURITY, "AllowRemoteRoot", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_ALLOW_REMOTE_ROOT },
- { GDM_CONFIG_GROUP_SECURITY, "AllowRemoteAutoLogin", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_ALLOW_REMOTE_AUTOLOGIN },
- { GDM_CONFIG_GROUP_SECURITY, "UserMaxFile", GDM_CONFIG_VALUE_INT, "65536", GDM_ID_USER_MAX_FILE },
- { GDM_CONFIG_GROUP_SECURITY, "RelaxPermissions", GDM_CONFIG_VALUE_INT, "0", GDM_ID_RELAX_PERM },
- { GDM_CONFIG_GROUP_SECURITY, "CheckDirOwner", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_CHECK_DIR_OWNER },
- { GDM_CONFIG_GROUP_SECURITY, "SupportAutomount", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_SUPPORT_AUTOMOUNT },
- { GDM_CONFIG_GROUP_SECURITY, "RetryDelay", GDM_CONFIG_VALUE_INT, "1", GDM_ID_RETRY_DELAY },
- { GDM_CONFIG_GROUP_SECURITY, "DisallowTCP", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_DISALLOW_TCP },
- { GDM_CONFIG_GROUP_SECURITY, "PamStack", GDM_CONFIG_VALUE_STRING, "gdm", GDM_ID_PAM_STACK },
-
- { GDM_CONFIG_GROUP_SECURITY, "NeverPlaceCookiesOnNFS", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_NEVER_PLACE_COOKIES_ON_NFS },
- { GDM_CONFIG_GROUP_SECURITY, "PasswordRequired", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_PASSWORD_REQUIRED },
-
- { GDM_CONFIG_GROUP_XDMCP, "Enable", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_XDMCP },
- { GDM_CONFIG_GROUP_XDMCP, "MaxPending", GDM_CONFIG_VALUE_INT, "4", GDM_ID_MAX_PENDING },
- { GDM_CONFIG_GROUP_XDMCP, "MaxSessions", GDM_CONFIG_VALUE_INT, "16", GDM_ID_MAX_SESSIONS },
- { GDM_CONFIG_GROUP_XDMCP, "MaxWait", GDM_CONFIG_VALUE_INT, "15", GDM_ID_MAX_WAIT },
- { GDM_CONFIG_GROUP_XDMCP, "DisplaysPerHost", GDM_CONFIG_VALUE_INT, "2", GDM_ID_DISPLAYS_PER_HOST },
- { GDM_CONFIG_GROUP_XDMCP, "Port", GDM_CONFIG_VALUE_INT, "177", GDM_ID_UDP_PORT },
- { GDM_CONFIG_GROUP_XDMCP, "HonorIndirect", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_INDIRECT },
- { GDM_CONFIG_GROUP_XDMCP, "MaxPendingIndirect", GDM_CONFIG_VALUE_INT, "4", GDM_ID_MAX_INDIRECT },
- { GDM_CONFIG_GROUP_XDMCP, "MaxWaitIndirect", GDM_CONFIG_VALUE_INT, "15", GDM_ID_MAX_WAIT_INDIRECT },
- { GDM_CONFIG_GROUP_XDMCP, "PingIntervalSeconds", GDM_CONFIG_VALUE_INT, "15", GDM_ID_PING_INTERVAL },
- { GDM_CONFIG_GROUP_XDMCP, "Willing", GDM_CONFIG_VALUE_STRING, GDMCONFDIR "/Xwilling", GDM_ID_WILLING },
-
- { GDM_CONFIG_GROUP_XDMCP, "EnableProxy", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_XDMCP_PROXY },
- { GDM_CONFIG_GROUP_XDMCP, "ProxyXServer", GDM_CONFIG_VALUE_STRING, "", GDM_ID_XDMCP_PROXY_XSERVER },
- { GDM_CONFIG_GROUP_XDMCP, "ProxyReconnect", GDM_CONFIG_VALUE_STRING, "", GDM_ID_XDMCP_PROXY_RECONNECT },
-
- { GDM_CONFIG_GROUP_GUI, "GtkTheme", GDM_CONFIG_VALUE_STRING, "Default", GDM_ID_GTK_THEME },
- { GDM_CONFIG_GROUP_GUI, "GtkRC", GDM_CONFIG_VALUE_STRING, DATADIR "/themes/Default/gtk-2.0/gtkrc", GDM_ID_GTKRC },
- { GDM_CONFIG_GROUP_GUI, "MaxIconWidth", GDM_CONFIG_VALUE_INT, "128", GDM_ID_MAX_ICON_WIDTH },
- { GDM_CONFIG_GROUP_GUI, "MaxIconHeight", GDM_CONFIG_VALUE_INT, "128", GDM_ID_MAX_ICON_HEIGHT },
-
- { GDM_CONFIG_GROUP_GUI, "AllowGtkThemeChange", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_ALLOW_GTK_THEME_CHANGE },
- { GDM_CONFIG_GROUP_GUI, "GtkThemesToAllow", GDM_CONFIG_VALUE_STRING, "all", GDM_ID_GTK_THEMES_TO_ALLOW },
-
- { GDM_CONFIG_GROUP_GREETER, "Browser", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_BROWSER },
- { GDM_CONFIG_GROUP_GREETER, "Include", GDM_CONFIG_VALUE_STRING, "", GDM_ID_INCLUDE },
- { GDM_CONFIG_GROUP_GREETER, "Exclude", GDM_CONFIG_VALUE_STRING, "bin,daemon,adm,lp,sync,shutdown,halt,mail,news,uucp,operator,nobody,gdm,postgres,pvm,rpm,nfsnobody,pcap", GDM_ID_EXCLUDE },
- { GDM_CONFIG_GROUP_GREETER, "IncludeAll", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_INCLUDE_ALL },
- { GDM_CONFIG_GROUP_GREETER, "MinimalUID", GDM_CONFIG_VALUE_INT, "100", GDM_ID_MINIMAL_UID },
- { GDM_CONFIG_GROUP_GREETER, "DefaultFace", GDM_CONFIG_VALUE_STRING, PIXMAPDIR "/nobody.png", GDM_ID_DEFAULT_FACE },
- { GDM_CONFIG_GROUP_GREETER, "GlobalFaceDir", GDM_CONFIG_VALUE_STRING, DATADIR "/pixmaps/faces/", GDM_ID_GLOBAL_FACE_DIR },
- { GDM_CONFIG_GROUP_GREETER, "LocaleFile", GDM_CONFIG_VALUE_STRING, GDMLOCALEDIR "/locale.alias", GDM_ID_LOCALE_FILE },
- { GDM_CONFIG_GROUP_GREETER, "Logo", GDM_CONFIG_VALUE_STRING, PIXMAPDIR "/gdm-foot-logo.png", GDM_ID_LOGO },
- { GDM_CONFIG_GROUP_GREETER, "ChooserButtonLogo", GDM_CONFIG_VALUE_STRING, PIXMAPDIR "/gdm-foot-logo.png", GDM_ID_CHOOSER_BUTTON_LOGO },
- { GDM_CONFIG_GROUP_GREETER, "Quiver", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_QUIVER },
- { GDM_CONFIG_GROUP_GREETER, "SystemMenu", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_SYSTEM_MENU },
- { GDM_CONFIG_GROUP_DAEMON, "Configurator", GDM_CONFIG_VALUE_STRING, SBINDIR "/gdmsetup --disable-sound --disable-crash-dialog", GDM_ID_CONFIGURATOR },
- { GDM_CONFIG_GROUP_GREETER, "ConfigAvailable", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_CONFIG_AVAILABLE },
- { GDM_CONFIG_GROUP_GREETER, "ChooserButton", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_CHOOSER_BUTTON },
- { GDM_CONFIG_GROUP_GREETER, "TitleBar", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_TITLE_BAR },
-
- /*
- * For backwards compatibility, do not set values for DEFAULT_WELCOME or
- * DEFAULT_REMOTEWELCOME. This will cause these values to always be
- * read from the config file, and will cause them to return FALSE if
- * no value is set in the config file. We want the value, "FALSE" if
- * the values don't exist in the config file. The daemon will compare
- * the Welcome/RemoveWelcome value with the default string and
- * automatically translate the text if the string is the same as the
- * default string. We set the default values of GDM_ID_WELCOME and
- * GDM_ID_REMOTEWELCOME so that the default value is returned when
- * you run GET_CONFIG on these keys.
- */
- { GDM_CONFIG_GROUP_GREETER, "DefaultWelcome", GDM_CONFIG_VALUE_BOOL, "", GDM_ID_DEFAULT_WELCOME },
- { GDM_CONFIG_GROUP_GREETER, "DefaultRemoteWelcome", GDM_CONFIG_VALUE_BOOL, "", GDM_ID_DEFAULT_REMOTE_WELCOME },
- { GDM_CONFIG_GROUP_GREETER, "Welcome", GDM_CONFIG_VALUE_LOCALE_STRING, GDM_DEFAULT_WELCOME_MSG, GDM_ID_WELCOME },
- { GDM_CONFIG_GROUP_GREETER, "RemoteWelcome", GDM_CONFIG_VALUE_LOCALE_STRING, GDM_DEFAULT_REMOTE_WELCOME_MSG, GDM_ID_REMOTE_WELCOME },
- { GDM_CONFIG_GROUP_GREETER, "XineramaScreen", GDM_CONFIG_VALUE_INT, "0", GDM_ID_XINERAMA_SCREEN },
- { GDM_CONFIG_GROUP_GREETER, "BackgroundProgram", GDM_CONFIG_VALUE_STRING, "", GDM_ID_BACKGROUND_PROGRAM },
- { GDM_CONFIG_GROUP_GREETER, "RunBackgroundProgramAlways", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_RUN_BACKGROUND_PROGRAM_ALWAYS },
- { GDM_CONFIG_GROUP_GREETER, "BackgroundProgramInitialDelay", GDM_CONFIG_VALUE_INT, "30", GDM_ID_BACKGROUND_PROGRAM_INITIAL_DELAY },
- { GDM_CONFIG_GROUP_GREETER, "RestartBackgroundProgram", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_RESTART_BACKGROUND_PROGRAM },
- { GDM_CONFIG_GROUP_GREETER, "BackgroundProgramRestartDelay", GDM_CONFIG_VALUE_INT, "30", GDM_ID_BACKGROUND_PROGRAM_RESTART_DELAY },
- { GDM_CONFIG_GROUP_GREETER, "BackgroundImage", GDM_CONFIG_VALUE_STRING, "", GDM_ID_BACKGROUND_IMAGE },
- { GDM_CONFIG_GROUP_GREETER, "BackgroundColor", GDM_CONFIG_VALUE_STRING, "#76848F", GDM_ID_BACKGROUND_COLOR },
- { GDM_CONFIG_GROUP_GREETER, "BackgroundType", GDM_CONFIG_VALUE_INT, "2", GDM_ID_BACKGROUND_TYPE },
- { GDM_CONFIG_GROUP_GREETER, "BackgroundScaleToFit", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_BACKGROUND_SCALE_TO_FIT },
- { GDM_CONFIG_GROUP_GREETER, "BackgroundRemoteOnlyColor", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_BACKGROUND_REMOTE_ONLY_COLOR },
- { GDM_CONFIG_GROUP_GREETER, "LockPosition", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_LOCK_POSITION },
- { GDM_CONFIG_GROUP_GREETER, "SetPosition", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_SET_POSITION },
- { GDM_CONFIG_GROUP_GREETER, "PositionX", GDM_CONFIG_VALUE_INT, "0", GDM_ID_POSITION_X },
- { GDM_CONFIG_GROUP_GREETER, "PositionY", GDM_CONFIG_VALUE_INT, "0", GDM_ID_POSITION_Y },
- { GDM_CONFIG_GROUP_GREETER, "Use24Clock", GDM_CONFIG_VALUE_STRING, "auto", GDM_ID_USE_24_CLOCK },
- { GDM_CONFIG_GROUP_GREETER, "UseCirclesInEntry", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_ENTRY_CIRCLES },
- { GDM_CONFIG_GROUP_GREETER, "UseInvisibleInEntry", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_ENTRY_INVISIBLE },
- { GDM_CONFIG_GROUP_GREETER, "GraphicalTheme", GDM_CONFIG_VALUE_STRING, "circles", GDM_ID_GRAPHICAL_THEME },
- { GDM_CONFIG_GROUP_GREETER, "GraphicalThemes", GDM_CONFIG_VALUE_STRING, "circles/:happygnome", GDM_ID_GRAPHICAL_THEMES },
- { GDM_CONFIG_GROUP_GREETER, "GraphicalThemeRand", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_GRAPHICAL_THEME_RAND },
- { GDM_CONFIG_GROUP_GREETER, "GraphicalThemeDir", GDM_CONFIG_VALUE_STRING, DATADIR "/gdm/themes/", GDM_ID_GRAPHICAL_THEME_DIR },
- { GDM_CONFIG_GROUP_GREETER, "GraphicalThemedColor", GDM_CONFIG_VALUE_STRING, "#76848F", GDM_ID_GRAPHICAL_THEMED_COLOR },
-
- { GDM_CONFIG_GROUP_GREETER, "InfoMsgFile", GDM_CONFIG_VALUE_STRING, "", GDM_ID_INFO_MSG_FILE },
- { GDM_CONFIG_GROUP_GREETER, "InfoMsgFont", GDM_CONFIG_VALUE_STRING, "", GDM_ID_INFO_MSG_FONT },
-
- { GDM_CONFIG_GROUP_GREETER, "PreFetchProgram", GDM_CONFIG_VALUE_STRING, "", GDM_ID_PRE_FETCH_PROGRAM },
-
- { GDM_CONFIG_GROUP_GREETER, "SoundOnLogin", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_SOUND_ON_LOGIN },
- { GDM_CONFIG_GROUP_GREETER, "SoundOnLoginSuccess", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_SOUND_ON_LOGIN_SUCCESS },
- { GDM_CONFIG_GROUP_GREETER, "SoundOnLoginFailure", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_SOUND_ON_LOGIN_FAILURE },
- { GDM_CONFIG_GROUP_GREETER, "SoundOnLoginFile", GDM_CONFIG_VALUE_STRING, "", GDM_ID_SOUND_ON_LOGIN_FILE },
- { GDM_CONFIG_GROUP_GREETER, "SoundOnLoginSuccessFile", GDM_CONFIG_VALUE_STRING, "", GDM_ID_SOUND_ON_LOGIN_SUCCESS_FILE },
- { GDM_CONFIG_GROUP_GREETER, "SoundOnLoginFailureFile", GDM_CONFIG_VALUE_STRING, "", GDM_ID_SOUND_ON_LOGIN_FAILURE_FILE },
- { GDM_CONFIG_GROUP_DAEMON, "SoundProgram", GDM_CONFIG_VALUE_STRING, SOUND_PROGRAM, GDM_ID_SOUND_PROGRAM },
-
- { GDM_CONFIG_GROUP_CHOOSER, "ScanTime", GDM_CONFIG_VALUE_INT, "4", GDM_ID_SCAN_TIME },
- { GDM_CONFIG_GROUP_CHOOSER, "DefaultHostImg", GDM_CONFIG_VALUE_STRING, PIXMAPDIR "/nohost.png", GDM_ID_DEFAULT_HOST_IMG },
- { GDM_CONFIG_GROUP_CHOOSER, "HostImageDir", GDM_CONFIG_VALUE_STRING, DATADIR "/hosts/", GDM_ID_HOST_IMAGE_DIR },
- { GDM_CONFIG_GROUP_CHOOSER, "Hosts", GDM_CONFIG_VALUE_STRING, "", GDM_ID_HOSTS },
- { GDM_CONFIG_GROUP_CHOOSER, "Multicast", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_MULTICAST },
- { GDM_CONFIG_GROUP_CHOOSER, "MulticastAddr", GDM_CONFIG_VALUE_STRING, "ff02::1", GDM_ID_MULTICAST_ADDR },
- { GDM_CONFIG_GROUP_CHOOSER, "Broadcast", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_BROADCAST },
- { GDM_CONFIG_GROUP_CHOOSER, "AllowAdd", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_ALLOW_ADD },
-
- { GDM_CONFIG_GROUP_GREETER, "ShowGnomeFailsafeSession", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_SHOW_GNOME_FAILSAFE },
- { GDM_CONFIG_GROUP_GREETER, "ShowXtermFailsafeSession", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_SHOW_XTERM_FAILSAFE },
- { GDM_CONFIG_GROUP_GREETER, "ShowLastSession", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_SHOW_LAST_SESSION },
-
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommand0", GDM_CONFIG_VALUE_STRING, NULL, GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLabel0", GDM_CONFIG_VALUE_STRING, "Custom_0", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLRLabel0", GDM_CONFIG_VALUE_STRING, "Execute custom command _0", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandText0", GDM_CONFIG_VALUE_STRING, "Are you sure?", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandTooltip0", GDM_CONFIG_VALUE_STRING, "Execute custom command 0", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandNoRestart0", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandIsPersistent0", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommand1", GDM_CONFIG_VALUE_STRING, NULL, GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLabel1", GDM_CONFIG_VALUE_STRING, "Custom_1", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLRLabel1", GDM_CONFIG_VALUE_STRING, "Execute custom command _1", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandText1", GDM_CONFIG_VALUE_STRING, "Are you sure?", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandTooltip1", GDM_CONFIG_VALUE_STRING, "Execute custom command 1", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandNoRestart1", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandIsPersistent1", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommand2", GDM_CONFIG_VALUE_STRING, NULL, GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLabel2", GDM_CONFIG_VALUE_STRING, "Custom_2", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLRLabel2", GDM_CONFIG_VALUE_STRING, "Execute custom command _2", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandText2", GDM_CONFIG_VALUE_STRING, "Are you sure?", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandTooltip2", GDM_CONFIG_VALUE_STRING, "Execute custom command 2", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandNoRestart2", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandIsPersistent2", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommand3", GDM_CONFIG_VALUE_STRING, NULL, GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLabel3", GDM_CONFIG_VALUE_STRING, "Custom_3", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLRLabel3", GDM_CONFIG_VALUE_STRING, "Execute custom command _3", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandText3", GDM_CONFIG_VALUE_STRING, "Are you sure?", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandTooltip3", GDM_CONFIG_VALUE_STRING, "Execute custom command 3", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandNoRestart3", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandIsPersistent3", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommand4", GDM_CONFIG_VALUE_STRING, NULL, GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLabel4", GDM_CONFIG_VALUE_STRING, "Custom_4", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLRLabel4", GDM_CONFIG_VALUE_STRING, "Execute custom command _4", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandText4", GDM_CONFIG_VALUE_STRING, "Are you sure?", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandTooltip4", GDM_CONFIG_VALUE_STRING, "Execute custom command 4", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandNoRestart4", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandIsPersistent4", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommand5", GDM_CONFIG_VALUE_STRING, NULL, GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLabel5", GDM_CONFIG_VALUE_STRING, "Custom_5", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLRLabel5", GDM_CONFIG_VALUE_STRING, "Execute custom command _5", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandText5", GDM_CONFIG_VALUE_STRING, "Are you sure?", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandTooltip5", GDM_CONFIG_VALUE_STRING, "Execute custom command 5", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandNoRestart5", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandIsPersistent5", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommand6", GDM_CONFIG_VALUE_STRING, NULL, GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLabel6", GDM_CONFIG_VALUE_STRING, "Custom_6", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLRLabel6", GDM_CONFIG_VALUE_STRING, "Execute custom command _6", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandText6", GDM_CONFIG_VALUE_STRING, "Are you sure?", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandTooltip6", GDM_CONFIG_VALUE_STRING, "Execute custom command 6", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandNoRestart6", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandIsPersistent6", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommand7", GDM_CONFIG_VALUE_STRING, NULL, GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLabel7", GDM_CONFIG_VALUE_STRING, "Custom_7", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLRLabel7", GDM_CONFIG_VALUE_STRING, "Execute custom command _7", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandText7", GDM_CONFIG_VALUE_STRING, "Are you sure?", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandTooltip7", GDM_CONFIG_VALUE_STRING, "Execute custom command 7", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandNoRestart7", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandIsPersistent7", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommand8", GDM_CONFIG_VALUE_STRING, NULL, GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLabel8", GDM_CONFIG_VALUE_STRING, "Custom_8", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLRLabel8", GDM_CONFIG_VALUE_STRING, "Execute custom command _8", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandText8", GDM_CONFIG_VALUE_STRING, "Are you sure?", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandTooltip8", GDM_CONFIG_VALUE_STRING, "Execute custom command 8", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandNoRestart8", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandIsPersistent8", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommand9", GDM_CONFIG_VALUE_STRING, NULL, GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLabel9", GDM_CONFIG_VALUE_STRING, "Custom_9", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandLRLabel9", GDM_CONFIG_VALUE_STRING, "Execute custom command _9", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandText9", GDM_CONFIG_VALUE_STRING, "Are you sure?", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandTooltip9", GDM_CONFIG_VALUE_STRING, "Execute custom command 9", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandNoRestart9", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
- { GDM_CONFIG_GROUP_CUSTOM_CMD, "CustomCommandIsPersistent9", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_NONE },
-
- { NULL }
-};
-
-static const GdmConfigEntry gdm_daemon_server_config_entries [] = {
- /* Per server definitions */
- { GDM_CONFIG_GROUP_NONE, "name", GDM_CONFIG_VALUE_STRING, "Standard server", GDM_ID_SERVER_NAME },
- { GDM_CONFIG_GROUP_NONE, "command", GDM_CONFIG_VALUE_STRING, X_SERVER, GDM_ID_SERVER_COMMAND },
- /* runnable as flexi server */
- { GDM_CONFIG_GROUP_NONE, "flexible", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_SERVER_FLEXIBLE },
- /* choosable from the login screen */
- { GDM_CONFIG_GROUP_NONE, "choosable", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_SERVER_CHOOSABLE },
- /* Login is handled by gdm, otherwise it's a remote server */
- { GDM_CONFIG_GROUP_NONE, "handled", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_SERVER_HANDLED },
- /* Instead of the greeter run the chooser */
- { GDM_CONFIG_GROUP_NONE, "chooser", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_SERVER_CHOOSER },
- /* select a nice level to run the X server at */
- { GDM_CONFIG_GROUP_NONE, "priority", GDM_CONFIG_VALUE_INT, "0", GDM_ID_SERVER_PRIORITY },
-};
-
-G_END_DECLS
-
-#endif /* _GDM_DAEMON_CONFIG_ENTRIES_H */
diff --git a/daemon/gdm-daemon-config-keys.h b/daemon/gdm-daemon-config-keys.h
deleted file mode 100644
index c34b85cc..00000000
--- a/daemon/gdm-daemon-config-keys.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _GDM_DAEMON_CONFIG_KEYS_H
-#define _GDM_DAEMON_CONFIG_KEYS_H
-
-#include <glib.h>
-
-#include "gdm-config.h"
-
-G_BEGIN_DECLS
-
-/* BEGIN LEGACY KEYS */
-#define GDM_KEY_CHOOSER "daemon/Chooser=" LIBEXECDIR "/gdmchooser"
-#define GDM_KEY_AUTOMATIC_LOGIN_ENABLE "daemon/AutomaticLoginEnable=false"
-#define GDM_KEY_AUTOMATIC_LOGIN "daemon/AutomaticLogin="
-#define GDM_KEY_GREETER "daemon/Greeter=" LIBEXECDIR "/gdmlogin"
-#define GDM_KEY_REMOTE_GREETER "daemon/RemoteGreeter=" LIBEXECDIR "/gdmlogin"
-#define GDM_KEY_ADD_GTK_MODULES "daemon/AddGtkModules=false"
-#define GDM_KEY_GTK_MODULES_LIST "daemon/GtkModulesList="
-#define GDM_KEY_GROUP "daemon/Group=gdm"
-#define GDM_KEY_HALT "daemon/HaltCommand=" HALT_COMMAND
-#define GDM_KEY_DISPLAY_INIT_DIR "daemon/DisplayInitDir=" GDMCONFDIR "/Init"
-#define GDM_KEY_KILL_INIT_CLIENTS "daemon/KillInitClients=true"
-#define GDM_KEY_LOG_DIR "daemon/LogDir=" LOGDIR
-#define GDM_KEY_PATH "daemon/DefaultPath=" GDM_USER_PATH
-#define GDM_KEY_PID_FILE "daemon/PidFile=" GDM_PID_FILE
-#define GDM_KEY_POSTSESSION "daemon/PostSessionScriptDir=" GDMCONFDIR "/PostSession/"
-#define GDM_KEY_PRESESSION "daemon/PreSessionScriptDir=" GDMCONFDIR "/PreSession/"
-#define GDM_KEY_POSTLOGIN "daemon/PostLoginScriptDir=" GDMCONFDIR "/PreSession/"
-#define GDM_KEY_FAILSAFE_XSERVER "daemon/FailsafeXServer="
-#define GDM_KEY_X_KEEPS_CRASHING "daemon/XKeepsCrashing=" GDMCONFDIR "/XKeepsCrashing"
-#define GDM_KEY_REBOOT "daemon/RebootCommand=" REBOOT_COMMAND
-#define GDM_KEY_CUSTOM_CMD_TEMPLATE "customcommand/CustomCommand"
-#define GDM_KEY_CUSTOM_CMD_LABEL_TEMPLATE "customcommand/CustomCommandLabel"
-#define GDM_KEY_CUSTOM_CMD_LR_LABEL_TEMPLATE "customcommand/CustomCommandLRLabel"
-#define GDM_KEY_CUSTOM_CMD_TEXT_TEMPLATE "customcommand/CustomCommandText"
-#define GDM_KEY_CUSTOM_CMD_TOOLTIP_TEMPLATE "customcommand/CustomCommandTooltip"
-#define GDM_KEY_CUSTOM_CMD_NO_RESTART_TEMPLATE "customcommand/CustomCommandNoRestart"
-#define GDM_KEY_CUSTOM_CMD_IS_PERSISTENT_TEMPLATE "customcommand/CustomCommandIsPersistent"
-#define GDM_KEY_ROOT_PATH "daemon/RootPath=/sbin:/usr/sbin:" GDM_USER_PATH
-#define GDM_KEY_SERV_AUTHDIR "daemon/ServAuthDir=" AUTHDIR
-#define GDM_KEY_SESSION_DESKTOP_DIR "daemon/SessionDesktopDir=/etc/X11/sessions/:" DMCONFDIR "/Sessions/:" DATADIR "/gdm/BuiltInSessions/:" DATADIR "/xsessions/"
-#define GDM_KEY_BASE_XSESSION "daemon/BaseXsession=" GDMCONFDIR "/Xsession"
-#define GDM_KEY_DEFAULT_SESSION "daemon/DefaultSession=gnome.desktop"
-#define GDM_KEY_SUSPEND "daemon/SuspendCommand=" SUSPEND_COMMAND
-#define GDM_KEY_USER_AUTHDIR "daemon/UserAuthDir="
-#define GDM_KEY_USER_AUTHDIR_FALLBACK "daemon/UserAuthFBDir=/tmp"
-#define GDM_KEY_USER_AUTHFILE "daemon/UserAuthFile=.Xauthority"
-#define GDM_KEY_USER "daemon/User=gdm"
-#define GDM_KEY_CONSOLE_NOTIFY "daemon/ConsoleNotify=true"
-#define GDM_KEY_DOUBLE_LOGIN_WARNING "daemon/DoubleLoginWarning=true"
-#define GDM_KEY_ALWAYS_LOGIN_CURRENT_SESSION "daemon/AlwaysLoginCurrentSession=true"
-#define GDM_KEY_DISPLAY_LAST_LOGIN "daemon/DisplayLastLogin=false"
-#define GDM_KEY_TIMED_LOGIN_ENABLE "daemon/TimedLoginEnable=false"
-#define GDM_KEY_TIMED_LOGIN "daemon/TimedLogin="
-#define GDM_KEY_TIMED_LOGIN_DELAY "daemon/TimedLoginDelay=30"
-#define GDM_KEY_FLEXI_REAP_DELAY_MINUTES "daemon/FlexiReapDelayMinutes=5"
-#define GDM_KEY_STANDARD_XSERVER "daemon/StandardXServer=" X_SERVER
-#define GDM_KEY_FLEXIBLE_XSERVERS "daemon/FlexibleXServers=5"
-#define GDM_KEY_DYNAMIC_XSERVERS "daemon/DynamicXServers=false"
-#define GDM_KEY_XNEST "daemon/Xnest=" X_XNEST_CMD " " X_XNEST_CONFIG_OPTIONS
-#define GDM_KEY_XNEST_UNSCALED_FONT_PATH "daemon/XnestUnscaledFontPath=" X_XNEST_UNSCALED_FONTPATH
-#define GDM_KEY_FIRST_VT "daemon/FirstVT=7"
-#define GDM_KEY_VT_ALLOCATION "daemon/VTAllocation=true"
-#define GDM_KEY_CONSOLE_CANNOT_HANDLE "daemon/ConsoleCannotHandle=am,ar,az,bn,el,fa,gu,hi,ja,ko,ml,mr,pa,ta,zh"
-#define GDM_KEY_XSERVER_TIMEOUT "daemon/GdmXserverTimeout=10"
-#define GDM_KEY_SYSTEM_COMMANDS_IN_MENU "daemon/SystemCommandsInMenu=HALT;REBOOT;SUSPEND;CUSTOM_CMD"
-#define GDM_KEY_ALLOW_LOGOUT_ACTIONS "daemon/AllowLogoutActions=HALT;REBOOT;SUSPEND;CUSTOM_CMD"
-#define GDM_KEY_RBAC_SYSTEM_COMMAND_KEYS "daemon/RBACSystemCommandKeys=" GDM_RBAC_SYSCMD_KEYS
-
-#define GDM_KEY_SERVER_PREFIX "server-"
-#define GDM_KEY_SERVER_NAME "name=Standard server"
-#define GDM_KEY_SERVER_COMMAND "command=" X_SERVER
-#define GDM_KEY_SERVER_FLEXIBLE "flexible=true"
-#define GDM_KEY_SERVER_CHOOSABLE "choosable=false"
-#define GDM_KEY_SERVER_HANDLED "handled=true"
-#define GDM_KEY_SERVER_CHOOSER "chooser=false"
-#define GDM_KEY_SERVER_PRIORITY "priority=0"
-
-#define GDM_KEY_ALLOW_ROOT "security/AllowRoot=true"
-#define GDM_KEY_ALLOW_REMOTE_ROOT "security/AllowRemoteRoot=false"
-#define GDM_KEY_ALLOW_REMOTE_AUTOLOGIN "security/AllowRemoteAutoLogin=false"
-#define GDM_KEY_USER_MAX_FILE "security/UserMaxFile=65536"
-#define GDM_KEY_RELAX_PERM "security/RelaxPermissions=0"
-#define GDM_KEY_CHECK_DIR_OWNER "security/CheckDirOwner=true"
-#define GDM_KEY_SUPPORT_AUTOMOUNT "security/SupportAutomount=false"
-#define GDM_KEY_RETRY_DELAY "security/RetryDelay=1"
-#define GDM_KEY_DISALLOW_TCP "security/DisallowTCP=true"
-#define GDM_KEY_PAM_STACK "security/PamStack=gdm"
-#define GDM_KEY_NEVER_PLACE_COOKIES_ON_NFS "security/NeverPlaceCookiesOnNFS=true"
-#define GDM_KEY_PASSWORD_REQUIRED "security/PasswordRequired=false"
-#define GDM_KEY_XDMCP "xdmcp/Enable=false"
-#define GDM_KEY_MAX_PENDING "xdmcp/MaxPending=4"
-#define GDM_KEY_MAX_SESSIONS "xdmcp/MaxSessions=16"
-#define GDM_KEY_MAX_WAIT "xdmcp/MaxWait=15"
-#define GDM_KEY_DISPLAYS_PER_HOST "xdmcp/DisplaysPerHost=2"
-#define GDM_KEY_UDP_PORT "xdmcp/Port=177"
-#define GDM_KEY_INDIRECT "xdmcp/HonorIndirect=true"
-#define GDM_KEY_MAX_INDIRECT "xdmcp/MaxPendingIndirect=4"
-#define GDM_KEY_MAX_WAIT_INDIRECT "xdmcp/MaxWaitIndirect=15"
-#define GDM_KEY_PING_INTERVAL "xdmcp/PingIntervalSeconds=15"
-#define GDM_KEY_WILLING "xdmcp/Willing=" GDMCONFDIR "/Xwilling"
-#define GDM_KEY_XDMCP_PROXY "xdmcp/EnableProxy=false"
-#define GDM_KEY_XDMCP_PROXY_XSERVER "xdmcp/ProxyXServer="
-#define GDM_KEY_XDMCP_PROXY_RECONNECT "xdmcp/ProxyReconnect="
-#define GDM_KEY_GTK_THEME "gui/GtkTheme=Default"
-#define GDM_KEY_GTKRC "gui/GtkRC=" DATADIR "/themes/Default/gtk-2.0/gtkrc"
-#define GDM_KEY_MAX_ICON_WIDTH "gui/MaxIconWidth=128"
-#define GDM_KEY_MAX_ICON_HEIGHT "gui/MaxIconHeight=128"
-#define GDM_KEY_ALLOW_GTK_THEME_CHANGE "gui/AllowGtkThemeChange=true"
-#define GDM_KEY_GTK_THEMES_TO_ALLOW "gui/GtkThemesToAllow=all"
-#define GDM_KEY_BROWSER "greeter/Browser=false"
-#define GDM_KEY_INCLUDE "greeter/Include="
-#define GDM_KEY_EXCLUDE "greeter/Exclude=bin,daemon,adm,lp,sync,shutdown,halt,mail,news,uucp,operator,nobody,gdm,postgres,pvm,rpm,nfsnobody,pcap"
-#define GDM_KEY_INCLUDE_ALL "greeter/IncludeAll=false"
-#define GDM_KEY_MINIMAL_UID "greeter/MinimalUID=100"
-#define GDM_KEY_DEFAULT_FACE "greeter/DefaultFace=" PIXMAPDIR "/nobody.png"
-#define GDM_KEY_GLOBAL_FACE_DIR "greeter/GlobalFaceDir=" DATADIR "/pixmaps/faces/"
-#define GDM_KEY_LOCALE_FILE "greeter/LocaleFile=" GDMLOCALEDIR "/locale.alias"
-#define GDM_KEY_LOGO "greeter/Logo=" PIXMAPDIR "/gdm-foot-logo.png"
-#define GDM_KEY_CHOOSER_BUTTON_LOGO "greeter/ChooserButtonLogo=" PIXMAPDIR "/gdm-foot-logo.png"
-#define GDM_KEY_QUIVER "greeter/Quiver=true"
-#define GDM_KEY_SYSTEM_MENU "greeter/SystemMenu=true"
-#define GDM_KEY_CONFIGURATOR "daemon/Configurator=" SBINDIR "/gdmsetup --disable-sound --disable-crash-dialog"
-#define GDM_KEY_CONFIG_AVAILABLE "greeter/ConfigAvailable=true"
-#define GDM_KEY_CHOOSER_BUTTON "greeter/ChooserButton=true"
-#define GDM_KEY_TITLE_BAR "greeter/TitleBar=true"
-#define GDM_DEFAULT_WELCOME_MSG "Welcome"
-#define GDM_DEFAULT_REMOTE_WELCOME_MSG "Welcome to %n"
-#define GDM_KEY_DEFAULT_WELCOME "greeter/DefaultWelcome="
-#define GDM_KEY_DEFAULT_REMOTE_WELCOME "greeter/DefaultRemoteWelcome="
-#define GDM_KEY_WELCOME "greeter/Welcome=" GDM_DEFAULT_WELCOME_MSG
-#define GDM_KEY_REMOTE_WELCOME "greeter/RemoteWelcome=" GDM_DEFAULT_REMOTE_WELCOME_MSG
-#define GDM_KEY_XINERAMA_SCREEN "greeter/XineramaScreen=0"
-#define GDM_KEY_BACKGROUND_PROGRAM "greeter/BackgroundProgram="
-#define GDM_KEY_RUN_BACKGROUND_PROGRAM_ALWAYS "greeter/RunBackgroundProgramAlways=false"
-#define GDM_KEY_BACKGROUND_PROGRAM_INITIAL_DELAY "greeter/BackgroundProgramInitialDelay=30"
-#define GDM_KEY_RESTART_BACKGROUND_PROGRAM "greeter/RestartBackgroundProgram=true"
-#define GDM_KEY_BACKGROUND_PROGRAM_RESTART_DELAY "greeter/BackgroundProgramRestartDelay=30"
-#define GDM_KEY_BACKGROUND_IMAGE "greeter/BackgroundImage="
-#define GDM_KEY_BACKGROUND_COLOR "greeter/BackgroundColor=#76848F"
-#define GDM_KEY_BACKGROUND_TYPE "greeter/BackgroundType=2"
-#define GDM_KEY_BACKGROUND_SCALE_TO_FIT "greeter/BackgroundScaleToFit=true"
-#define GDM_KEY_BACKGROUND_REMOTE_ONLY_COLOR "greeter/BackgroundRemoteOnlyColor=true"
-#define GDM_KEY_LOCK_POSITION "greeter/LockPosition=false"
-#define GDM_KEY_SET_POSITION "greeter/SetPosition=false"
-#define GDM_KEY_POSITION_X "greeter/PositionX=0"
-#define GDM_KEY_POSITION_Y "greeter/PositionY=0"
-#define GDM_KEY_USE_24_CLOCK "greeter/Use24Clock=auto"
-#define GDM_KEY_ENTRY_CIRCLES "greeter/UseCirclesInEntry=false"
-#define GDM_KEY_ENTRY_INVISIBLE "greeter/UseInvisibleInEntry=false"
-#define GDM_KEY_GRAPHICAL_THEME "greeter/GraphicalTheme=circles"
-#define GDM_KEY_GRAPHICAL_THEMES "greeter/GraphicalThemes=circles/:happygnome"
-#define GDM_KEY_GRAPHICAL_THEME_RAND "greeter/GraphicalThemeRand=false"
-#define GDM_KEY_GRAPHICAL_THEME_DIR "greeter/GraphicalThemeDir=" DATADIR "/gdm/themes/"
-#define GDM_KEY_GRAPHICAL_THEMED_COLOR "greeter/GraphicalThemedColor=#76848F"
-#define GDM_KEY_INFO_MSG_FILE "greeter/InfoMsgFile="
-#define GDM_KEY_INFO_MSG_FONT "greeter/InfoMsgFont="
-#define GDM_KEY_PRE_FETCH_PROGRAM "greeter/PreFetchProgram="
-#define GDM_KEY_SOUND_ON_LOGIN "greeter/SoundOnLogin=true"
-#define GDM_KEY_SOUND_ON_LOGIN_SUCCESS "greeter/SoundOnLoginSuccess=false"
-#define GDM_KEY_SOUND_ON_LOGIN_FAILURE "greeter/SoundOnLoginFailure=false"
-#define GDM_KEY_SOUND_ON_LOGIN_FILE "greeter/SoundOnLoginFile="
-#define GDM_KEY_SOUND_ON_LOGIN_SUCCESS_FILE "greeter/SoundOnLoginSuccessFile="
-#define GDM_KEY_SOUND_ON_LOGIN_FAILURE_FILE "greeter/SoundOnLoginFailureFile="
-#define GDM_KEY_SOUND_PROGRAM "daemon/SoundProgram=" SOUND_PROGRAM
-#define GDM_KEY_SCAN_TIME "chooser/ScanTime=4"
-#define GDM_KEY_DEFAULT_HOST_IMG "chooser/DefaultHostImg=" PIXMAPDIR "/nohost.png"
-#define GDM_KEY_HOST_IMAGE_DIR "chooser/HostImageDir=" DATADIR "/hosts/"
-#define GDM_KEY_HOSTS "chooser/Hosts="
-#define GDM_KEY_MULTICAST "chooser/Multicast=false"
-#define GDM_KEY_MULTICAST_ADDR "chooser/MulticastAddr=ff02::1"
-#define GDM_KEY_BROADCAST "chooser/Broadcast=true"
-#define GDM_KEY_ALLOW_ADD "chooser/AllowAdd=true"
-#define GDM_KEY_DEBUG "debug/Enable=false"
-#define GDM_KEY_DEBUG_GESTURES "debug/Gestures=false"
-#define GDM_KEY_SECTION_GREETER "greeter"
-#define GDM_KEY_SECTION_SERVERS "servers"
-#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"
-/* END LEGACY KEYS */
-
-/* Notification protocol */
-/* keys */
-#define GDM_NOTIFY_ALLOW_REMOTE_ROOT "AllowRemoteRoot" /* <true/false as int> */
-#define GDM_NOTIFY_ALLOW_ROOT "AllowRoot" /* <true/false as int> */
-#define GDM_NOTIFY_ALLOW_REMOTE_AUTOLOGIN "AllowRemoteAutoLogin" /* <true/false as int> */
-#define GDM_NOTIFY_SYSTEM_MENU "SystemMenu" /* <true/false as int> */
-#define GDM_NOTIFY_CONFIG_AVAILABLE "ConfigAvailable" /* <true/false as int> */
-#define GDM_NOTIFY_CHOOSER_BUTTON "ChooserButton" /* <true/false as int> */
-#define GDM_NOTIFY_RETRY_DELAY "RetryDelay" /* <seconds> */
-#define GDM_NOTIFY_GREETER "Greeter" /* <greeter binary> */
-#define GDM_NOTIFY_REMOTE_GREETER "RemoteGreeter" /* <greeter binary> */
-#define GDM_NOTIFY_TIMED_LOGIN "TimedLogin" /* <login> */
-#define GDM_NOTIFY_TIMED_LOGIN_DELAY "TimedLoginDelay" /* <seconds> */
-#define GDM_NOTIFY_TIMED_LOGIN_ENABLE "TimedLoginEnable" /* <true/false as int> */
-#define GDM_NOTIFY_DISALLOW_TCP "DisallowTCP" /* <true/false as int> */
-#define GDM_NOTIFY_SOUND_ON_LOGIN_FILE "SoundOnLoginFile" /* <sound file> */
-#define GDM_NOTIFY_SOUND_ON_LOGIN_SUCCESS_FILE "SoundOnLoginSuccessFile" /* <sound file> */
-#define GDM_NOTIFY_SOUND_ON_LOGIN_FAILURE_FILE "SoundOnLoginFailureFile" /* <sound file> */
-#define GDM_NOTIFY_ADD_GTK_MODULES "AddGtkModules" /* <true/false as int> */
-#define GDM_NOTIFY_GTK_MODULES_LIST "GtkModulesList" /* <modules list> */
-#define GDM_NOTIFY_CUSTOM_CMD_TEMPLATE "CustomCommand" /* <custom command path> */
-
-/* commands, seel GDM_SLAVE_NOTIFY_COMMAND */
-#define GDM_NOTIFY_DIRTY_SERVERS "DIRTY_SERVERS"
-#define GDM_NOTIFY_SOFT_RESTART_SERVERS "SOFT_RESTART_SERVERS"
-#define GDM_NOTIFY_GO "GO"
-#define GDM_NOTIFY_TWIDDLE_POINTER "TWIDDLE_POINTER"
-
-G_END_DECLS
-
-#endif /* _GDM_DAEMON_CONFIG_KEYS_H */
diff --git a/daemon/gdm-daemon-config.c b/daemon/gdm-daemon-config.c
deleted file mode 100644
index 323b8fd8..00000000
--- a/daemon/gdm-daemon-config.c
+++ /dev/null
@@ -1,2630 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * GDM - The GNOME Display Manager
- * Copyright (C) 1998, 1999, 2000 Martin K. Petersen <mkp@mkp.net>
- * Copyright (C) 2005 Brian Cameron <brian.cameron@sun.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * gdm-daemon-config.c isolates most logic that interacts with GDM
- * configuration into a single file and provides a mechanism for
- * interacting with GDM configuration optins via access functions for
- * getting/setting values. This logic also ensures that the same
- * configuration validation happens when loading the values initially
- * or setting them via the GDM_UPDATE_CONFIG socket command.
- *
- * When adding a new configuration option, simply add the new option
- * to gdm-daemon-config-entries.h. Any validation for the
- * configuration option should be placed in the validate_cb function.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/resource.h>
-#include <signal.h>
-#include <pwd.h>
-#include <grp.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-
-#include "gdm.h"
-#include "verify.h"
-#include "gdm-net.h"
-#include "misc.h"
-#include "server.h"
-#include "filecheck.h"
-#include "slave.h"
-
-#include "gdm-common.h"
-#include "gdm-config.h"
-#include "gdm-log.h"
-#include "gdm-daemon-config.h"
-
-#include "gdm-socket-protocol.h"
-
-static GdmConfig *daemon_config = NULL;
-
-static GSList *displays = NULL;
-static GSList *xservers = NULL;
-
-static gint high_display_num = 0;
-static char *custom_config_file = NULL;
-
-static uid_t GdmUserId; /* Userid under which gdm should run */
-static gid_t GdmGroupId; /* Gruopid under which gdm should run */
-
-/**
- * is_key
- *
- * Since GDM keys sometimes have default values defined in the gdm.h header
- * file (e.g. key=value), this function strips off the "=value" from both
- * keys passed and compares them, returning TRUE if they are the same,
- * FALSE otherwise.
- */
-static gboolean
-is_key (const gchar *key1, const gchar *key2)
-{
- gchar *key1d, *key2d, *p;
-
- key1d = g_strdup (key1);
- key2d = g_strdup (key2);
-
- g_strstrip (key1d);
- p = strchr (key1d, '=');
- if (p != NULL)
- *p = '\0';
-
- g_strstrip (key2d);
- p = strchr (key2d, '=');
- if (p != NULL)
- *p = '\0';
-
- if (strcmp (ve_sure_string (key1d), ve_sure_string (key2d)) == 0) {
- g_free (key1d);
- g_free (key2d);
- return TRUE;
- } else {
- g_free (key1d);
- g_free (key2d);
- return FALSE;
- }
-}
-
-/**
- * gdm_daemon_config_get_per_display_custom_config_file
- *
- * Returns the per-display config file for a given display
- * This is always the custom config file name with the display
- * appended, and never gdm.conf.
- */
-static gchar *
-gdm_daemon_config_get_per_display_custom_config_file (const gchar *display)
-{
- return g_strdup_printf ("%s%s", custom_config_file, display);
-}
-
-/**
- * gdm_daemon_config_get_custom_config_file
- *
- * Returns the custom config file being used.
- */
-gchar *
-gdm_daemon_config_get_custom_config_file (void)
-{
- return custom_config_file;
-}
-
-/**
- * gdm_daemon_config_get_display_list
- *
- * Returns the list of displays being used.
- */
-GSList *
-gdm_daemon_config_get_display_list (void)
-{
- return displays;
-}
-
-GSList *
-gdm_daemon_config_display_list_append (GdmDisplay *display)
-{
- displays = g_slist_append (displays, display);
- return displays;
-}
-
-GSList *
-gdm_daemon_config_display_list_insert (GdmDisplay *display)
-{
- displays = g_slist_insert_sorted (displays,
- display,
- gdm_daemon_config_compare_displays);
- return displays;
-}
-
-GSList *
-gdm_daemon_config_display_list_remove (GdmDisplay *display)
-{
- displays = g_slist_remove (displays, display);
-
- return displays;
-}
-
-/**
- * gdm_daemon_config_get_value_int
- *
- * Gets an integer configuration option by key. The option must
- * first be loaded, say, by calling gdm_config_parse.
- */
-gint
-gdm_daemon_config_get_value_int (const char *keystring)
-{
- gboolean res;
- GdmConfigValue *value;
- char *group;
- char *key;
- int result;
-
- result = 0;
-
- res = gdm_common_config_parse_key_string (keystring,
- &group,
- &key,
- NULL,
- NULL);
- if (! res) {
- gdm_error ("Could not parse configuration key %s", keystring);
- goto out;
- }
-
- res = gdm_config_get_value (daemon_config,
- group,
- key,
- &value);
- if (! res) {
- gdm_error ("Request for invalid configuration key %s", keystring);
- goto out;
- }
-
- if (value->type != GDM_CONFIG_VALUE_INT) {
- gdm_error ("Request for configuration key %s, but not type INT", keystring);
- goto out;
- }
-
- result = gdm_config_value_get_int (value);
- out:
- g_free (group);
- g_free (key);
-
- return result;
-}
-
-/**
- * gdm_daemon_config_get_value_string
- *
- * Gets a string configuration option by key. The option must
- * first be loaded, say, by calling gdm_daemon_config_parse.
- */
-const char *
-gdm_daemon_config_get_value_string (const char *keystring)
-{
- gboolean res;
- GdmConfigValue *value;
- char *group;
- char *key;
- const char *result;
-
- result = NULL;
-
- res = gdm_common_config_parse_key_string (keystring,
- &group,
- &key,
- NULL,
- NULL);
- if (! res) {
- gdm_error ("Could not parse configuration key %s", keystring);
- goto out;
- }
-
- res = gdm_config_get_value (daemon_config,
- group,
- key,
- &value);
- if (! res) {
- gdm_error ("Request for invalid configuration key %s", keystring);
- goto out;
- }
-
- if (value->type != GDM_CONFIG_VALUE_STRING) {
- gdm_error ("Request for configuration key %s, but not type STRING", keystring);
- goto out;
- }
-
- result = gdm_config_value_get_string (value);
- out:
- g_free (group);
- g_free (key);
-
- return result;
-}
-
-/**
- * gdm_daemon_config_get_value_string_array
- *
- * Gets a string configuration option by key. The option must
- * first be loaded, say, by calling gdm_daemon_config_parse.
- */
-const char **
-gdm_daemon_config_get_value_string_array (const char *keystring)
-{
- gboolean res;
- GdmConfigValue *value;
- char *group;
- char *key;
- const char **result;
-
- result = NULL;
-
- res = gdm_common_config_parse_key_string (keystring,
- &group,
- &key,
- NULL,
- NULL);
- if (! res) {
- gdm_error ("Could not parse configuration key %s", keystring);
- goto out;
- }
-
- res = gdm_config_get_value (daemon_config,
- group,
- key,
- &value);
- if (! res) {
- gdm_error ("Request for invalid configuration key %s", keystring);
- goto out;
- }
-
- if (value->type != GDM_CONFIG_VALUE_STRING_ARRAY) {
- gdm_error ("Request for configuration key %s, but not type STRING-ARRAY", keystring);
- goto out;
- }
-
- result = gdm_config_value_get_string_array (value);
- out:
- g_free (group);
- g_free (key);
-
- return result;
-}
-
-/**
- * gdm_daemon_config_get_bool_for_id
- *
- * Gets a boolean configuration option by ID. The option must
- * first be loaded, say, by calling gdm_daemon_config_parse.
- */
-gboolean
-gdm_daemon_config_get_bool_for_id (int id)
-{
- gboolean val;
-
- val = FALSE;
- gdm_config_get_bool_for_id (daemon_config, id, &val);
-
- return val;
-}
-
-/**
- * gdm_daemon_config_get_int_for_id
- *
- * Gets a integer configuration option by ID. The option must
- * first be loaded, say, by calling gdm_daemon_config_parse.
- */
-int
-gdm_daemon_config_get_int_for_id (int id)
-{
- int val;
-
- val = -1;
- gdm_config_get_int_for_id (daemon_config, id, &val);
-
- return val;
-}
-
-/**
- * gdm_daemon_config_get_string_for_id
- *
- * Gets a string configuration option by ID. The option must
- * first be loaded, say, by calling gdm_daemon_config_parse.
- */
-const char *
-gdm_daemon_config_get_string_for_id (int id)
-{
- const char *val;
-
- val = NULL;
- gdm_config_peek_string_for_id (daemon_config, id, &val);
-
- return val;
-}
-
-/**
- * gdm_daemon_config_get_value_bool
- *
- * Gets a boolean configuration option by key. The option must
- * first be loaded, say, by calling gdm_daemon_config_parse.
- */
-gboolean
-gdm_daemon_config_get_value_bool (const char *keystring)
-{
- gboolean res;
- GdmConfigValue *value;
- char *group;
- char *key;
- gboolean result;
-
- result = FALSE;
-
- res = gdm_common_config_parse_key_string (keystring,
- &group,
- &key,
- NULL,
- NULL);
- if (! res) {
- gdm_error ("Could not parse configuration key %s", keystring);
- goto out;
- }
-
- res = gdm_config_get_value (daemon_config,
- group,
- key,
- &value);
- if (! res) {
- gdm_error ("Request for invalid configuration key %s", keystring);
- goto out;
- }
-
- if (value->type != GDM_CONFIG_VALUE_BOOL) {
- gdm_error ("Request for configuration key %s, but not type BOOLEAN", keystring);
- goto out;
- }
-
- result = gdm_config_value_get_bool (value);
- out:
- g_free (group);
- g_free (key);
-
- return result;
-}
-
-/**
- * Note that some GUI configuration parameters are read by the daemon,
- * and in order for them to work, it is necessary for the daemon to
- * access a few keys in a per-display fashion. These access functions
- * allow the daemon to access these keys properly.
- */
-
-/**
- * gdm_daemon_config_get_value_int_per_display
- *
- * Gets the per-display version of the configuration, or the default
- * value if none exists.
- */
-int
-gdm_daemon_config_get_value_int_per_display (const char *key,
- const char *display)
-{
- char *perdispval;
- gboolean res;
-
- res = gdm_daemon_config_key_to_string_per_display (key, display, &perdispval);
-
- if (res) {
- int val;
- val = atoi (perdispval);
- g_free (perdispval);
- return val;
- } else {
- return gdm_daemon_config_get_value_int (key);
- }
-}
-
-/**
- * gdm_daemon_config_get_value_bool_per_display
- *
- * Gets the per-display version of the configuration, or the default
- * value if none exists.
- */
-gboolean
-gdm_daemon_config_get_value_bool_per_display (const char *key,
- const char *display)
-{
- char *perdispval;
- gboolean res;
-
- res = gdm_daemon_config_key_to_string_per_display (key, display, &perdispval);
-
- if (res) {
- if (perdispval[0] == 'T' ||
- perdispval[0] == 't' ||
- perdispval[0] == 'Y' ||
- perdispval[0] == 'y' ||
- atoi (perdispval) != 0) {
- g_free (perdispval);
- return TRUE;
- } else {
- return FALSE;
- }
- } else {
- return gdm_daemon_config_get_value_bool (key);
- }
-}
-
-/**
- * gdm_daemon_config_get_value_string_per_display
- *
- * Gets the per-display version of the configuration, or the default
- * value if none exists. Note that this value needs to be freed,
- * unlike the non-per-display version.
- */
-char *
-gdm_daemon_config_get_value_string_per_display (const char *key,
- const char *display)
-{
- char *perdispval;
- gboolean res;
-
- res = gdm_daemon_config_key_to_string_per_display (key, display, &perdispval);
-
- if (res) {
- return perdispval;
- } else {
- return g_strdup (gdm_daemon_config_get_value_string (key));
- }
-}
-
-/**
- * gdm_daemon_config_key_to_string_per_display
- *
- * If the key makes sense to be per-display, return the value,
- * otherwise return NULL. Keys that only apply to the daemon
- * process do not make sense for per-display configuration
- * Valid keys include any key in the greeter or gui categories,
- * and the GDM_KEY_PAM_STACK key.
- *
- * If additional keys make sense for per-display usage, make
- * sure they are added to the if-test below.
- */
-gboolean
-gdm_daemon_config_key_to_string_per_display (const char *keystring,
- const char *display,
- char **retval)
-{
- char *file;
- char *group;
- char *key;
- gboolean res;
- gboolean ret;
-
- ret = FALSE;
-
- *retval = NULL;
- group = key = NULL;
-
- if (display == NULL) {
- goto out;
- }
-
- g_debug ("Looking up per display value for %s", keystring);
-
- res = gdm_common_config_parse_key_string (keystring,
- &group,
- &key,
- NULL,
- NULL);
- if (! res) {
- goto out;
- }
-
- file = gdm_daemon_config_get_per_display_custom_config_file (display);
-
- if (strcmp (group, "greeter") == 0 ||
- strcmp (group, "gui") == 0 ||
- is_key (keystring, GDM_KEY_PAM_STACK)) {
- ret = gdm_daemon_config_key_to_string (file, keystring, retval);
- }
-
- g_free (file);
-
- out:
- g_free (group);
- g_free (key);
-
- return ret;
-}
-
-/**
- * gdm_daemon_config_key_to_string
- *
- * Gets a specific key from the config file.
- * Note this returns the value in string form, so the caller needs
- * to parse it properly if it is a bool or int.
- *
- * Returns TRUE if successful..
- */
-gboolean
-gdm_daemon_config_key_to_string (const char *file,
- const char *keystring,
- char **retval)
-{
- GKeyFile *config;
- GdmConfigValueType type;
- gboolean res;
- gboolean ret;
- char *group;
- char *key;
- char *locale;
- char *result;
- const GdmConfigEntry *entry;
-
- if (retval != NULL) {
- *retval = NULL;
- }
-
- ret = FALSE;
- result = NULL;
-
- group = key = locale = NULL;
- res = gdm_common_config_parse_key_string (keystring,
- &group,
- &key,
- &locale,
- NULL);
- g_debug ("Requesting group=%s key=%s locale=%s", group, key, locale ? locale : "(null)");
-
- if (! res) {
- gdm_error ("Could not parse configuration key %s", keystring);
- goto out;
- }
-
- entry = gdm_config_lookup_entry (daemon_config, group, key);
- if (entry == NULL) {
- gdm_error ("Request for invalid configuration key %s", keystring);
- goto out;
- }
- type = entry->type;
-
- config = gdm_common_config_load (file, NULL);
- /* If file doesn't exist, then just return */
- if (config == NULL) {
- goto out;
- }
-
- gdm_debug ("Returning value for key <%s>\n", keystring);
-
- switch (type) {
- case GDM_CONFIG_VALUE_BOOL:
- {
- gboolean value;
- res = gdm_common_config_get_boolean (config, keystring, &value, NULL);
- if (res) {
- if (value) {
- result = g_strdup ("true");
- } else {
- result = g_strdup ("false");
- }
- }
- }
- break;
- case GDM_CONFIG_VALUE_INT:
- {
- int value;
- res = gdm_common_config_get_int (config, keystring, &value, NULL);
- if (res) {
- result = g_strdup_printf ("%d", value);
- }
- }
- break;
- case GDM_CONFIG_VALUE_STRING:
- {
- char *value;
- res = gdm_common_config_get_string (config, keystring, &value, NULL);
- if (res) {
- result = value;
- }
- }
- break;
- case GDM_CONFIG_VALUE_LOCALE_STRING:
- {
- char *value;
- res = gdm_common_config_get_string (config, keystring, &value, NULL);
- if (res) {
- result = value;
- }
- }
- break;
- default:
- break;
- }
-
- if (res) {
- if (retval != NULL) {
- *retval = g_strdup (result);
- }
- ret = TRUE;
- }
-
- g_key_file_free (config);
- out:
- g_free (result);
- g_free (group);
- g_free (key);
- g_free (locale);
-
- return ret;
-}
-
-/**
- * gdm_daemon_config_to_string
- *
- * Returns a configuration option as a string. Used by GDM's
- * GET_CONFIG socket command.
- */
-gboolean
-gdm_daemon_config_to_string (const char *keystring,
- const char *display,
- char **retval)
-{
- gboolean res;
- gboolean ret;
- GdmConfigValue *value;
- char *group;
- char *key;
- char *locale;
- char *result;
-
- /*
- * See if there is a per-display config file, returning that value
- * if it exists.
- */
- if (display != NULL) {
- res = gdm_daemon_config_key_to_string_per_display (keystring, display, retval);
- if (res) {
- g_debug ("Using per display value for key: %s", keystring);
- return TRUE;
- }
- }
-
- ret = FALSE;
- result = NULL;
-
- g_debug ("Looking up key: %s", keystring);
-
- group = NULL;
- key = NULL;
- locale = NULL;
- res = gdm_common_config_parse_key_string (keystring,
- &group,
- &key,
- &locale,
- NULL);
- if (! res) {
- gdm_error ("Could not parse configuration key %s", keystring);
- goto out;
- }
-
- if (group == NULL || key == NULL) {
- gdm_error ("Request for invalid configuration key %s", keystring);
- goto out;
- }
-
- /* Backward Compatibility */
- if ((strcmp (group, "daemon") == 0) &&
- (strcmp (key, "PidFile") == 0)) {
- result = g_strdup (GDM_PID_FILE);
- goto out;
- } else if ((strcmp (group, "daemon") == 0) &&
- (strcmp (key, "AlwaysRestartServer") == 0)) {
- result = g_strdup ("true");
- }
-
- res = gdm_config_get_value (daemon_config,
- group,
- key,
- &value);
-
- if (! res) {
- gdm_error ("Request for invalid configuration key %s", keystring);
- goto out;
- }
-
- result = gdm_config_value_to_string (value);
- ret = TRUE;
-
- out:
- g_free (group);
- g_free (key);
- g_free (locale);
-
-
- *retval = result;
-
- return ret;
-}
-
-/**
- * gdm_daemon_config_compare_displays
- *
- * Support function for loading displays from the configuration
- * file
- */
-int
-gdm_daemon_config_compare_displays (gconstpointer a, gconstpointer b)
-{
- const GdmDisplay *d1 = a;
- const GdmDisplay *d2 = b;
- if (d1->dispnum < d2->dispnum)
- return -1;
- else if (d1->dispnum > d2->dispnum)
- return 1;
- else
- return 0;
-}
-
-static char *
-lookup_notify_key (GdmConfig *config,
- const char *group,
- const char *key)
-{
- char *nkey;
- char *keystring;
-
- keystring = g_strdup_printf ("%s/%s", group, key);
-
- /* pretty lame but oh well */
- nkey = NULL;
-
- /* bools */
- if (is_key (keystring, GDM_KEY_ALLOW_ROOT))
- nkey = g_strdup (GDM_NOTIFY_ALLOW_ROOT);
- else if (is_key (keystring, GDM_KEY_ALLOW_REMOTE_ROOT))
- nkey = g_strdup (GDM_NOTIFY_ALLOW_REMOTE_ROOT);
- else if (is_key (keystring, GDM_KEY_ALLOW_REMOTE_AUTOLOGIN))
- nkey = g_strdup (GDM_NOTIFY_ALLOW_REMOTE_AUTOLOGIN);
- else if (is_key (keystring, GDM_KEY_SYSTEM_MENU))
- nkey = g_strdup (GDM_NOTIFY_SYSTEM_MENU);
- else if (is_key (keystring, GDM_KEY_CONFIG_AVAILABLE))
- nkey = g_strdup (GDM_NOTIFY_CONFIG_AVAILABLE);
- else if (is_key (keystring, GDM_KEY_CHOOSER_BUTTON))
- nkey = g_strdup (GDM_NOTIFY_CHOOSER_BUTTON);
- else if (is_key (keystring, GDM_KEY_DISALLOW_TCP))
- nkey = g_strdup (GDM_NOTIFY_DISALLOW_TCP);
- else if (is_key (keystring, GDM_KEY_ADD_GTK_MODULES))
- nkey = g_strdup (GDM_NOTIFY_ADD_GTK_MODULES);
- else if (is_key (keystring, GDM_KEY_TIMED_LOGIN_ENABLE))
- nkey = g_strdup (GDM_NOTIFY_TIMED_LOGIN_ENABLE);
- /* ints */
- else if (is_key (keystring, GDM_KEY_RETRY_DELAY))
- nkey = g_strdup (GDM_NOTIFY_RETRY_DELAY);
- else if (is_key (keystring, GDM_KEY_TIMED_LOGIN_DELAY))
- nkey = g_strdup (GDM_NOTIFY_TIMED_LOGIN_DELAY);
- /* strings */
- else if (is_key (keystring, GDM_KEY_GREETER))
- nkey = g_strdup (GDM_NOTIFY_GREETER);
- else if (is_key (keystring, GDM_KEY_REMOTE_GREETER))
- nkey = g_strdup (GDM_NOTIFY_REMOTE_GREETER);
- else if (is_key (keystring, GDM_KEY_SOUND_ON_LOGIN_FILE))
- nkey = g_strdup (GDM_NOTIFY_SOUND_ON_LOGIN_FILE);
- else if (is_key (keystring, GDM_KEY_SOUND_ON_LOGIN_SUCCESS_FILE))
- nkey = g_strdup (GDM_NOTIFY_SOUND_ON_LOGIN_SUCCESS_FILE);
- else if (is_key (keystring, GDM_KEY_SOUND_ON_LOGIN_FAILURE_FILE))
- nkey = g_strdup (GDM_NOTIFY_SOUND_ON_LOGIN_FAILURE_FILE);
- else if (is_key (keystring, GDM_KEY_GTK_MODULES_LIST))
- nkey = g_strdup (GDM_NOTIFY_GTK_MODULES_LIST);
- else if (is_key (keystring, GDM_KEY_TIMED_LOGIN))
- nkey = g_strdup (GDM_NOTIFY_TIMED_LOGIN);
- else if (strcmp (group, GDM_CONFIG_GROUP_CUSTOM_CMD) == 0 &&
- g_str_has_prefix (key, "CustomCommand") &&
- strlen (key) == 14) {
- /* this should match 'CustomCommandN' */
- nkey = g_strdup (key);
- }
- g_free (keystring);
-
- return nkey;
-}
-
-/**
- * notify_displays_value
- *
- * This will notify the slave programs
- * (gdmgreeter, gdmlogin, etc.) that a configuration option has
- * been changed so the slave can update with the new option
- * value. GDM does this notify when it receives a
- * GDM_CONFIG_UPDATE socket command from gdmsetup or from the
- * gdmflexiserver --command option.
- */
-static void
-notify_displays_value (GdmConfig *config,
- const char *group,
- const char *key,
- GdmConfigValue *value)
-{
- GSList *li;
- char *valstr;
- char *keystr;
-
- keystr = lookup_notify_key (config, group, key);
-
- /* unfortunately, can't always gdm_config_value_to_string()
- * here because booleans need to be sent as ints
- */
- switch (value->type) {
- case GDM_CONFIG_VALUE_BOOL:
- if (gdm_config_value_get_bool (value)) {
- valstr = g_strdup ("1");
- } else {
- valstr = g_strdup ("0");
- }
- break;
- default:
- valstr = gdm_config_value_to_string (value);
- break;
- }
-
- if (valstr == NULL) {
- valstr = g_strdup (" ");
- }
-
- for (li = displays; li != NULL; li = li->next) {
- GdmDisplay *disp = li->data;
-
- if (disp->master_notify_fd < 0) {
- /* no point */
- continue;
- }
-
- gdm_fdprintf (disp->master_notify_fd,
- "%c%s %s\n",
- GDM_SLAVE_NOTIFY_KEY,
- keystr,
- valstr);
-
- if (disp != NULL && disp->slavepid > 1) {
- kill (disp->slavepid, SIGUSR2);
- }
- }
-
- g_free (keystr);
- g_free (valstr);
-}
-
-/* The following were used to internally set the
- * stored configuration values. Now we'll just
- * ask the GdmConfig to store the entry. */
-void
-gdm_daemon_config_set_value_string (const gchar *keystring,
- const gchar *value_in)
-{
- char *group;
- char *key;
- gboolean res;
- GdmConfigValue *value;
-
- res = gdm_common_config_parse_key_string (keystring, &group, &key, NULL, NULL);
- if (! res) {
- gdm_error ("Could not parse configuration key %s", keystring);
- return;
- }
-
- value = gdm_config_value_new (GDM_CONFIG_VALUE_STRING);
- gdm_config_value_set_string (value, value_in);
-
- res = gdm_config_set_value (daemon_config, group, key, value);
-
- gdm_config_value_free (value);
- g_free (group);
- g_free (key);
-}
-
-void
-gdm_daemon_config_set_value_bool (const gchar *keystring,
- gboolean value_in)
-{
- char *group;
- char *key;
- gboolean res;
- GdmConfigValue *value;
-
- res = gdm_common_config_parse_key_string (keystring, &group, &key, NULL, NULL);
- if (! res) {
- gdm_error ("Could not parse configuration key %s", keystring);
- return;
- }
-
- value = gdm_config_value_new (GDM_CONFIG_VALUE_BOOL);
- gdm_config_value_set_bool (value, value_in);
-
- res = gdm_config_set_value (daemon_config, group, key, value);
-
- gdm_config_value_free (value);
- g_free (group);
- g_free (key);
-}
-
-void
-gdm_daemon_config_set_value_int (const gchar *keystring,
- gint value_in)
-{
- char *group;
- char *key;
- gboolean res;
- GdmConfigValue *value;
-
- res = gdm_common_config_parse_key_string (keystring, &group, &key, NULL, NULL);
- if (! res) {
- gdm_error ("Could not parse configuration key %s", keystring);
- return;
- }
-
- value = gdm_config_value_new (GDM_CONFIG_VALUE_INT);
- gdm_config_value_set_int (value, value_in);
-
- res = gdm_config_set_value (daemon_config, group, key, value);
-
- gdm_config_value_free (value);
- g_free (group);
- g_free (key);
-}
-
-/**
- * gdm_daemon_config_find_xserver
- *
- * Return an xserver with a given ID, or NULL if not found.
- */
-GdmXserver *
-gdm_daemon_config_find_xserver (const gchar *id)
-{
- GSList *li;
-
- if (xservers == NULL)
- return NULL;
-
- if (id == NULL)
- return xservers->data;
-
- for (li = xservers; li != NULL; li = li->next) {
- GdmXserver *svr = li->data;
- if (strcmp (ve_sure_string (svr->id), ve_sure_string (id)) == 0)
- return svr;
- }
-
- return NULL;
-}
-
-/**
- * gdm_daemon_config_get_xservers
- *
- * Prepare a string to be returned for the GET_SERVER_LIST
- * sockets command.
- */
-gchar *
-gdm_daemon_config_get_xservers (void)
-{
- GSList *li;
- gchar *retval = NULL;
-
- if (xservers == NULL)
- return NULL;
-
- for (li = xservers; li != NULL; li = li->next) {
- GdmXserver *svr = li->data;
- if (retval != NULL)
- retval = g_strconcat (retval, ";", svr->id, NULL);
- else
- retval = g_strdup (svr->id);
- }
-
- return retval;
-}
-
-/* PRIO_MIN and PRIO_MAX are not defined on Solaris, but are -20 and 20 */
-#if sun
-#ifndef PRIO_MIN
-#define PRIO_MIN -20
-#endif
-#ifndef PRIO_MAX
-#define PRIO_MAX 20
-#endif
-#endif
-
-/**
- * gdm_daemon_config_load_xserver
- *
- * Load [server-foo] sections from a configuration file.
- */
-static void
-gdm_daemon_config_load_xserver (GdmConfig *config,
- const char *key,
- const char *name)
-{
- GdmXserver *svr;
- int n;
- char *group;
- gboolean res;
- GdmConfigValue *value;
-
- /*
- * See if we already loaded a server with this id, skip if
- * one already exists.
- */
- if (gdm_daemon_config_find_xserver (name) != NULL) {
- return;
- }
-
- svr = g_new0 (GdmXserver, 1);
- svr->id = g_strdup (name);
-
- if (isdigit (*key)) {
- svr->number = atoi (key);
- }
-
- group = g_strdup_printf ("server-%s", name);
-
- /* string */
- res = gdm_config_get_value (config, group, "name", &value);
- if (res) {
- svr->name = g_strdup (gdm_config_value_get_string (value));
- }
- res = gdm_config_get_value (config, group, "command", &value);
- if (res) {
- svr->command = g_strdup (gdm_config_value_get_string (value));
- }
-
- gdm_debug ("Adding new server id=%s name=%s command=%s", name, svr->name, svr->command);
-
-
- /* bool */
- res = gdm_config_get_value (config, group, "flexible", &value);
- if (res) {
- svr->flexible = gdm_config_value_get_bool (value);
- }
- res = gdm_config_get_value (config, group, "choosable", &value);
- if (res) {
- svr->choosable = gdm_config_value_get_bool (value);
- }
- res = gdm_config_get_value (config, group, "handled", &value);
- if (res) {
- svr->handled = gdm_config_value_get_bool (value);
- }
- res = gdm_config_get_value (config, group, "chooser", &value);
- if (res) {
- svr->chooser = gdm_config_value_get_bool (value);
- }
-
- /* int */
- res = gdm_config_get_value (config, group, "priority", &value);
- if (res) {
- svr->priority = gdm_config_value_get_int (value);
- }
-
- /* do some bounds checking */
- n = svr->priority;
- if (n < PRIO_MIN)
- n = PRIO_MIN;
- else if (n > PRIO_MAX)
- n = PRIO_MAX;
-
- if (n != svr->priority) {
- gdm_error (_("%s: Priority out of bounds; changed to %d"),
- "gdm_config_parse", n);
- svr->priority = n;
- }
-
- if (ve_string_empty (svr->command)) {
- gdm_error (_("%s: Empty server command; "
- "using standard command."), "gdm_config_parse");
- g_free (svr->command);
- svr->command = g_strdup (X_SERVER);
- }
-
- xservers = g_slist_append (xservers, svr);
-}
-
-static void
-gdm_daemon_config_unload_xservers (GdmConfig *config)
-{
- GSList *xli;
-
- /* Free list if already loaded */
- for (xli = xservers; xli != NULL; xli = xli->next) {
- GdmXserver *xsvr = xli->data;
-
- g_free (xsvr->id);
- g_free (xsvr->name);
- g_free (xsvr->command);
- }
-
- if (xservers != NULL) {
- g_slist_free (xservers);
- xservers = NULL;
- }
-}
-
-static void
-gdm_daemon_config_ensure_one_xserver (GdmConfig *config)
-{
- /* If no "Standard" server was created, then add it */
- if (xservers == NULL || gdm_daemon_config_find_xserver (GDM_STANDARD) == NULL) {
- GdmXserver *svr = g_new0 (GdmXserver, 1);
-
- svr->id = g_strdup (GDM_STANDARD);
- svr->name = g_strdup ("Standard server");
- svr->command = g_strdup (X_SERVER);
- svr->flexible = TRUE;
- svr->choosable = TRUE;
- svr->handled = TRUE;
- svr->priority = 0;
-
- xservers = g_slist_append (xservers, svr);
- }
-}
-
-static void
-load_xservers_group (GdmConfig *config)
-{
- char **keys;
- gsize len;
- int i;
-
- keys = gdm_config_get_keys_for_group (config, GDM_CONFIG_GROUP_SERVERS, &len, NULL);
-
- /* now construct entries for these groups */
- for (i = 0; i < len; i++) {
- GdmConfigEntry entry;
- GdmConfigValue *value;
- char *new_group;
- gboolean res;
- int j;
- const char *name;
-
- entry.group = GDM_CONFIG_GROUP_SERVERS;
- entry.key = keys[i];
- entry.type = GDM_CONFIG_VALUE_STRING;
- entry.default_value = NULL;
- entry.id = GDM_CONFIG_INVALID_ID;
-
- gdm_config_add_entry (config, &entry);
- gdm_config_process_entry (config, &entry, NULL);
-
- res = gdm_config_get_value (config, entry.group, entry.key, &value);
- if (! res) {
- continue;
- }
-
- name = gdm_config_value_get_string (value);
- if (name == NULL || name[0] == '\0') {
- gdm_config_value_free (value);
- continue;
- }
-
- /* skip servers marked as inactive */
- if (g_ascii_strcasecmp (name, "inactive") == 0) {
- gdm_config_value_free (value);
- continue;
- }
-
- new_group = g_strdup_printf ("server-%s", name);
- for (j = 0; j < G_N_ELEMENTS (gdm_daemon_server_config_entries); j++) {
- GdmConfigEntry *srv_entry;
- if (gdm_daemon_server_config_entries[j].key == NULL) {
- continue;
- }
- srv_entry = gdm_config_entry_copy (&gdm_daemon_server_config_entries[j]);
- g_free (srv_entry->group);
- srv_entry->group = g_strdup (new_group);
- gdm_config_process_entry (config, srv_entry, NULL);
- gdm_config_entry_free (srv_entry);
- }
- g_free (new_group);
-
- /* now we can add this server */
- gdm_daemon_config_load_xserver (config, entry.key, gdm_config_value_get_string (value));
-
- gdm_config_value_free (value);
- }
-}
-
-static void
-gdm_daemon_config_load_xservers (GdmConfig *config)
-{
- gdm_daemon_config_unload_xservers (config);
- load_xservers_group (config);
- gdm_daemon_config_ensure_one_xserver (config);
-}
-
-/**
- * gdm_daemon_config_update_key
- *
- * Will cause a the GDM daemon to re-read the key from the configuration
- * file and cause notify signal to be sent to the slaves for the
- * specified key, if appropriate.
- * Obviously notification is not needed for configuration options only
- * used by the daemon. This function is called when the UPDDATE_CONFIG
- * sockets command is called.
- *
- * To add a new notification, a GDM_NOTIFY_* argument will need to be
- * defined in gdm-daemon-config-keys.h, supporting logic placed in the
- * notify_cb function and in the gdm_slave_handle_notify function
- * in slave.c.
- */
-gboolean
-gdm_daemon_config_update_key (const char *keystring)
-{
- gboolean rc;
- gboolean res;
- char *group;
- char *key;
- char *locale;
- const GdmConfigEntry *entry;
-
- rc = FALSE;
- group = key = locale = NULL;
-
- /*
- * Do not allow these keys to be updated, since GDM would need
- * additional work, or at least heavy testing, to make these keys
- * flexible enough to be changed at runtime.
- */
- if (is_key (keystring, GDM_KEY_PID_FILE) ||
- is_key (keystring, GDM_KEY_CONSOLE_NOTIFY) ||
- is_key (keystring, GDM_KEY_USER) ||
- is_key (keystring, GDM_KEY_GROUP) ||
- is_key (keystring, GDM_KEY_LOG_DIR) ||
- is_key (keystring, GDM_KEY_SERV_AUTHDIR) ||
- is_key (keystring, GDM_KEY_USER_AUTHDIR) ||
- is_key (keystring, GDM_KEY_USER_AUTHFILE) ||
- is_key (keystring, GDM_KEY_USER_AUTHDIR_FALLBACK)) {
- return FALSE;
- }
-
- /* reload backend files if necessary */
- gdm_config_load (daemon_config, NULL);
-
- /* Shortcut for updating all XDMCP parameters */
- if (is_key (keystring, "xdmcp/PARAMETERS")) {
- rc = gdm_daemon_config_update_key (GDM_KEY_DISPLAYS_PER_HOST);
- if (rc == TRUE)
- rc = gdm_daemon_config_update_key (GDM_KEY_MAX_PENDING);
- if (rc == TRUE)
- rc = gdm_daemon_config_update_key (GDM_KEY_MAX_WAIT);
- if (rc == TRUE)
- rc = gdm_daemon_config_update_key (GDM_KEY_MAX_SESSIONS);
- if (rc == TRUE)
- rc = gdm_daemon_config_update_key (GDM_KEY_INDIRECT);
- if (rc == TRUE)
- rc = gdm_daemon_config_update_key (GDM_KEY_MAX_INDIRECT);
- if (rc == TRUE)
- rc = gdm_daemon_config_update_key (GDM_KEY_MAX_WAIT_INDIRECT);
- if (rc == TRUE)
- rc = gdm_daemon_config_update_key (GDM_KEY_PING_INTERVAL);
- goto out;
- }
-
- /* find the entry for the key */
- res = gdm_common_config_parse_key_string (keystring,
- &group,
- &key,
- &locale,
- NULL);
- if (! res) {
- gdm_error ("Could not parse configuration key %s", keystring);
- goto out;
- }
-
- entry = gdm_config_lookup_entry (daemon_config, group, key);
- if (entry == NULL) {
- gdm_error ("Request for invalid configuration key %s", keystring);
- goto out;
- }
-
- rc = gdm_config_process_entry (daemon_config, entry, NULL);
-
- out:
- g_free (group);
- g_free (key);
- g_free (locale);
-
- return rc;
-}
-
-/**
- * check_logdir
- * check_servauthdir
- *
- * Support functions for gdm_config_parse.
- */
-static void
-check_logdir (void)
-{
- struct stat statbuf;
- int r;
- char *log_path;
- const char *auth_path;
- GdmConfigValue *value;
-
- log_path = NULL;
- auth_path = NULL;
-
- gdm_config_get_string_for_id (daemon_config, GDM_ID_LOG_DIR, &log_path);
-
- gdm_config_get_value_for_id (daemon_config, GDM_ID_SERV_AUTHDIR, &value);
- auth_path = gdm_config_value_get_string (value);
-
- VE_IGNORE_EINTR (r = g_stat (log_path, &statbuf));
- if (r < 0 || ! S_ISDIR (statbuf.st_mode)) {
- gdm_error (_("%s: Logdir %s does not exist or isn't a directory. Using ServAuthDir %s."),
- "gdm_config_parse",
- log_path,
- auth_path);
- gdm_config_set_value_for_id (daemon_config, GDM_ID_LOG_DIR, value);
- }
-
- g_free (log_path);
- gdm_config_value_free (value);
-}
-
-static void
-check_servauthdir (const char *auth_path,
- struct stat *statbuf)
-{
- int r;
- gboolean console_notify;
-
- console_notify = FALSE;
- gdm_config_get_bool_for_id (daemon_config, GDM_ID_CONSOLE_NOTIFY, &console_notify);
-
- /* Enter paranoia mode */
- VE_IGNORE_EINTR (r = g_stat (auth_path, statbuf));
- if G_UNLIKELY (r < 0) {
- if (console_notify) {
- gchar *s = g_strdup_printf (C_(N_("Server Authorization directory "
- "(daemon/ServAuthDir) is set to %s "
- "but this does not exist. Please "
- "correct GDM configuration and "
- "restart GDM.")),
- auth_path);
-
- gdm_text_message_dialog (s);
- g_free (s);
- }
-
- gdm_fail (_("%s: Authdir %s does not exist. Aborting."), "gdm_config_parse", auth_path);
- }
-
- if G_UNLIKELY (! S_ISDIR (statbuf->st_mode)) {
- if (console_notify) {
- gchar *s = g_strdup_printf (C_(N_("Server Authorization directory "
- "(daemon/ServAuthDir) is set to %s "
- "but this is not a directory. Please "
- "correct GDM configuration and "
- "restart GDM.")),
- auth_path);
-
- gdm_text_message_dialog (s);
- g_free (s);
- }
-
- gdm_fail (_("%s: Authdir %s is not a directory. Aborting."), "gdm_config_parse", auth_path);
- }
-}
-
-static gboolean
-have_display_for_number (int number)
-{
- GSList *l;
-
- for (l = displays; l != NULL; l = l->next) {
- GdmDisplay *disp = l->data;
- if (disp->dispnum == number) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static void
-gdm_daemon_config_load_displays (GdmConfig *config)
-{
- GSList *l;
-
- for (l = xservers; l != NULL; l = l->next) {
- GdmXserver *xserver;
- GdmDisplay *disp;
-
- xserver = l->data;
-
- gdm_debug ("Loading display for key '%d'", xserver->number);
-
- gdm_debug ("Got name for server: %s", xserver->id);
- /* Do not add if already in the list */
- if (have_display_for_number (xserver->number)) {
- continue;
- }
-
- disp = gdm_display_alloc (xserver->number, xserver->id);
- if (disp == NULL) {
- continue;
- }
-
- displays = g_slist_insert_sorted (displays, disp, gdm_daemon_config_compare_displays);
- if (xserver->number > high_display_num) {
- high_display_num = xserver->number;
- }
- }
-}
-
-static gboolean
-validate_path (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- char *str;
-
- /* If the /etc/default has a PATH use that */
- str = gdm_read_default ("PATH=");
- if (str != NULL) {
- gdm_config_value_set_string (value, str);
- g_free (str);
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_root_path (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- char *str;
-
- /* If the /etc/default has a PATH use that */
- str = gdm_read_default ("SUPATH=");
- if (str != NULL) {
- gdm_config_value_set_string (value, str);
- g_free (str);
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_base_xsession (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- const char *str;
-
- str = gdm_config_value_get_string (value);
- if (str == NULL || str[0] == '\0') {
- char *path;
- path = g_build_filename (GDMCONFDIR, "gdm", "Xsession", NULL);
- gdm_info (_("%s: BaseXsession empty; using %s"), "gdm_config_parse", path);
- gdm_config_value_set_string (value, path);
- g_free (path);
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_power_action (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- /* FIXME: should weed out the commands that don't work */
-
- return TRUE;
-}
-
-static gboolean
-validate_standard_xserver (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- gboolean res;
- gboolean is_ok;
- const char *str;
- char *new;
-
- is_ok = FALSE;
- new = NULL;
- str = gdm_config_value_get_string (value);
-
- if (str != NULL) {
- char **argv;
-
- if (g_shell_parse_argv (str, NULL, &argv, NULL)) {
- if (g_access (argv[0], X_OK) == 0) {
- is_ok = TRUE;
- }
- g_strfreev (argv);
- }
- }
-
- if G_UNLIKELY (! is_ok) {
- gdm_info (_("%s: Standard X server not found; trying alternatives"), "gdm_config_parse");
- if (g_access ("/usr/X11R6/bin/X", X_OK) == 0) {
- new = g_strdup ("/usr/X11R6/bin/X");
- } else if (g_access ("/opt/X11R6/bin/X", X_OK) == 0) {
- new = g_strdup ("/opt/X11R6/bin/X");
- } else if (g_access ("/usr/bin/X11/X", X_OK) == 0) {
- new = g_strdup ("/usr/bin/X11/X");
- }
- }
-
- if (new != NULL) {
- gdm_config_value_set_string (value, new);
- g_free (new);
- }
-
- res = TRUE;
-
- return res;
-}
-
-static gboolean
-validate_graphical_theme_dir (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- const char *str;
-
- str = gdm_config_value_get_string (value);
-
- if (str == NULL || !g_file_test (str, G_FILE_TEST_IS_DIR)) {
- gdm_config_value_set_string (value, GREETERTHEMEDIR);
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_graphical_theme (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- const char *str;
-
- str = gdm_config_value_get_string (value);
-
- if (str == NULL || str[0] == '\0') {
- gdm_config_value_set_string (value, "circles");
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_greeter (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- const char *str;
-
- str = gdm_config_value_get_string (value);
-
- if (str == NULL || str[0] == '\0') {
- gdm_error (_("%s: No greeter specified."), "gdm_config_parse");
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_remote_greeter (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- const char *str;
-
- str = gdm_config_value_get_string (value);
-
- if (str == NULL || str[0] == '\0') {
- gdm_error (_("%s: No remote greeter specified."), "gdm_config_parse");
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_session_desktop_dir (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- const char *str;
-
- str = gdm_config_value_get_string (value);
-
- if (str == NULL || str[0] == '\0') {
- gdm_error (_("%s: No sessions directory specified."), "gdm_config_parse");
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_password_required (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- char *str;
-
- str = gdm_read_default ("PASSREQ=");
- if (str != NULL && str[0] == '\0') {
- gboolean val;
- val = (g_ascii_strcasecmp (str, "YES") == 0);
- gdm_config_value_set_bool (value, val);
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_allow_remote_root (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- char *str;
-
- str = gdm_read_default ("CONSOLE=");
- if (str != NULL && str[0] == '\0') {
- gboolean val;
- val = (g_ascii_strcasecmp (str, "/dev/console") != 0);
- gdm_config_value_set_bool (value, val);
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_xdmcp (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
-
-#ifndef HAVE_LIBXDMCP
- if (gdm_config_value_get_bool (value)) {
- gdm_info (_("%s: XDMCP was enabled while there is no XDMCP support; turning it off"), "gdm_config_parse");
- gdm_config_value_set_bool (value, FALSE);
- }
-#endif
-
- return TRUE;
-}
-
-static gboolean
-validate_at_least_int (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value,
- int minval,
- int defval)
-{
- if (gdm_config_value_get_int (value) < minval) {
- gdm_config_value_set_int (value, defval);
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_cb (GdmConfig *config,
- GdmConfigSourceType source,
- const char *group,
- const char *key,
- GdmConfigValue *value,
- int id,
- gpointer data)
-{
- gboolean res;
-
- res = TRUE;
-
- switch (id) {
- case GDM_ID_PATH:
- res = validate_path (config, source, value);
- break;
- case GDM_ID_ROOT_PATH:
- res = validate_root_path (config, source, value);
- break;
- case GDM_ID_BASE_XSESSION:
- res = validate_base_xsession (config, source, value);
- break;
- case GDM_ID_HALT:
- case GDM_ID_REBOOT:
- case GDM_ID_SUSPEND:
- res = validate_power_action (config, source, value);
- break;
- case GDM_ID_STANDARD_XSERVER:
- res = validate_standard_xserver (config, source, value);
- break;
- case GDM_ID_GRAPHICAL_THEME_DIR:
- res = validate_graphical_theme_dir (config, source, value);
- break;
- case GDM_ID_GRAPHICAL_THEME:
- res = validate_graphical_theme (config, source, value);
- break;
- case GDM_ID_GREETER:
- res = validate_greeter (config, source, value);
- break;
- case GDM_ID_REMOTE_GREETER:
- res = validate_remote_greeter (config, source, value);
- break;
- case GDM_ID_SESSION_DESKTOP_DIR:
- res = validate_session_desktop_dir (config, source, value);
- break;
- case GDM_ID_PASSWORD_REQUIRED:
- res = validate_password_required (config, source, value);
- break;
- case GDM_ID_ALLOW_REMOTE_ROOT:
- res = validate_allow_remote_root (config, source, value);
- break;
- case GDM_ID_XDMCP:
- res = validate_xdmcp (config, source, value);
- break;
- case GDM_ID_MAX_INDIRECT:
- case GDM_ID_XINERAMA_SCREEN:
- res = validate_at_least_int (config, source, value, 0, 0);
- break;
- case GDM_ID_TIMED_LOGIN_DELAY:
- res = validate_at_least_int (config, source, value, 5, 5);
- break;
- case GDM_ID_MAX_ICON_WIDTH:
- case GDM_ID_MAX_ICON_HEIGHT:
- res = validate_at_least_int (config, source, value, 0, 128);
- break;
- case GDM_ID_SCAN_TIME:
- res = validate_at_least_int (config, source, value, 1, 1);
- break;
- case GDM_ID_NONE:
- case GDM_CONFIG_INVALID_ID:
- break;
- default:
- break;
- }
-
- return res;
-}
-
-static const char *
-source_to_name (GdmConfigSourceType source)
-{
- const char *name;
-
- switch (source) {
- case GDM_CONFIG_SOURCE_DEFAULT:
- name = "default";
- break;
- case GDM_CONFIG_SOURCE_MANDATORY:
- name = "mandatory";
- break;
- case GDM_CONFIG_SOURCE_CUSTOM:
- name = "custom";
- break;
- case GDM_CONFIG_SOURCE_BUILT_IN:
- name = "built-in";
- break;
- case GDM_CONFIG_SOURCE_RUNTIME_USER:
- name = "runtime-user";
- break;
- case GDM_CONFIG_SOURCE_INVALID:
- name = "Invalid";
- break;
- default:
- name = "Unknown";
- break;
- }
-
- return name;
-}
-
-static gboolean
-notify_cb (GdmConfig *config,
- GdmConfigSourceType source,
- const char *group,
- const char *key,
- GdmConfigValue *value,
- int id,
- gpointer data)
-{
- char *valstr;
-
- switch (id) {
- case GDM_ID_GREETER:
- case GDM_ID_REMOTE_GREETER:
- case GDM_ID_SOUND_ON_LOGIN_FILE:
- case GDM_ID_SOUND_ON_LOGIN_SUCCESS_FILE:
- case GDM_ID_SOUND_ON_LOGIN_FAILURE_FILE:
- case GDM_ID_GTK_MODULES_LIST:
- case GDM_ID_TIMED_LOGIN:
- case GDM_ID_ALLOW_ROOT:
- case GDM_ID_ALLOW_REMOTE_ROOT:
- case GDM_ID_ALLOW_REMOTE_AUTOLOGIN:
- case GDM_ID_SYSTEM_MENU:
- case GDM_ID_CONFIG_AVAILABLE:
- case GDM_ID_CHOOSER_BUTTON:
- case GDM_ID_DISALLOW_TCP:
- case GDM_ID_ADD_GTK_MODULES:
- case GDM_ID_TIMED_LOGIN_ENABLE:
- case GDM_ID_RETRY_DELAY:
- case GDM_ID_TIMED_LOGIN_DELAY:
- notify_displays_value (config, group, key, value);
- break;
- case GDM_ID_NONE:
- case GDM_CONFIG_INVALID_ID:
- {
- /* doesn't have an ID : match group/key */
- if (group != NULL) {
- if (strcmp (group, GDM_CONFIG_GROUP_SERVERS) == 0) {
- /* FIXME: handle this? */
- } else if (strcmp (group, GDM_CONFIG_GROUP_CUSTOM_CMD) == 0) {
- notify_displays_value (config, group, key, value);
- }
- }
- }
- break;
- default:
- break;
- }
-
- valstr = gdm_config_value_to_string (value);
- gdm_debug ("Got config %s/%s=%s <%s>\n",
- group,
- key,
- valstr,
- source_to_name (source));
- g_free (valstr);
-
- return TRUE;
-}
-
-static void
-handle_no_displays (GdmConfig *config,
- gboolean no_console)
-{
- const char *server;
- gboolean console_notify;
-
- console_notify = FALSE;
- gdm_config_get_bool_for_id (daemon_config, GDM_ID_CONSOLE_NOTIFY, &console_notify);
-
- /*
- * If we requested no static servers (there is no console),
- * then don't display errors in console messages
- */
- if (no_console) {
- gdm_fail (_("%s: XDMCP disabled and no static servers defined. Aborting!"), "gdm_config_parse");
- }
-
- server = X_SERVER;
- if G_LIKELY (g_access (server, X_OK) == 0) {
- } else if (g_access ("/usr/bin/X11/X", X_OK) == 0) {
- server = "/usr/bin/X11/X";
- } else if (g_access ("/usr/X11R6/bin/X", X_OK) == 0) {
- server = "/usr/X11R6/bin/X";
- } else if (g_access ("/opt/X11R6/bin/X", X_OK) == 0) {
- server = "/opt/X11R6/bin/X";
- }
-
- /* yay, we can add a backup emergency server */
- if (server != NULL) {
- GdmDisplay *d;
-
- int num = gdm_get_free_display (0 /* start */, 0 /* server uid */);
-
- gdm_error (_("%s: XDMCP disabled and no static servers defined. Adding %s on :%d to allow configuration!"),
- "gdm_config_parse", server, num);
-
- d = gdm_display_alloc (num, server);
- d->is_emergency_server = TRUE;
-
- displays = g_slist_append (displays, d);
-
- /* ALWAYS run the greeter and don't log anyone in,
- * this is just an emergency session */
- gdm_config_set_string_for_id (daemon_config, GDM_ID_AUTOMATIC_LOGIN, NULL);
- gdm_config_set_string_for_id (daemon_config, GDM_ID_TIMED_LOGIN, NULL);
-
- } else {
- if (console_notify) {
- gchar *s = g_strdup_printf (C_(N_("XDMCP is disabled and GDM "
- "cannot find any static server "
- "to start. Aborting! Please "
- "correct the configuration "
- "and restart GDM.")));
- gdm_text_message_dialog (s);
- g_free (s);
- }
-
- gdm_fail (_("%s: XDMCP disabled and no static servers defined. Aborting!"), "gdm_config_parse");
- }
-}
-
-static void
-gdm_daemon_change_user (GdmConfig *config,
- uid_t *uidp,
- gid_t *gidp)
-{
- gboolean console_notify;
- char *username;
- char *groupname;
- uid_t uid;
- gid_t gid;
- struct passwd *pwent;
- struct group *grent;
-
- console_notify = FALSE;
- username = NULL;
- groupname = NULL;
- uid = 0;
- gid = 0;
-
- gdm_config_get_bool_for_id (daemon_config, GDM_ID_CONSOLE_NOTIFY, &console_notify);
- gdm_config_get_string_for_id (daemon_config, GDM_ID_USER, &username);
- gdm_config_get_string_for_id (daemon_config, GDM_ID_GROUP, &groupname);
-
- /* Lookup user and groupid for the GDM user */
- pwent = getpwnam (username);
-
- /* Set uid and gid */
- if G_UNLIKELY (pwent == NULL) {
-
- if (console_notify) {
- gchar *s = g_strdup_printf (C_(N_("The GDM user '%s' does not exist. "
- "Please correct GDM configuration "
- "and restart GDM.")),
- username);
- gdm_text_message_dialog (s);
- g_free (s);
- }
-
- gdm_fail (_("%s: Can't find the GDM user '%s'. Aborting!"), "gdm_config_parse", username);
- } else {
- uid = pwent->pw_uid;
- }
-
- if G_UNLIKELY (uid == 0) {
- if (console_notify) {
- gchar *s = g_strdup_printf (C_(N_("The GDM user is set to be root, but "
- "this is not allowed since it can "
- "pose a security risk. Please "
- "correct GDM configuration and "
- "restart GDM.")));
-
- gdm_text_message_dialog (s);
- g_free (s);
- }
-
- gdm_fail (_("%s: The GDM user should not be root. Aborting!"), "gdm_config_parse");
- }
-
- grent = getgrnam (groupname);
-
- if G_UNLIKELY (grent == NULL) {
- if (console_notify) {
- gchar *s = g_strdup_printf (C_(N_("The GDM group '%s' does not exist. "
- "Please correct GDM configuration "
- "and restart GDM.")),
- groupname);
- gdm_text_message_dialog (s);
- g_free (s);
- }
-
- gdm_fail (_("%s: Can't find the GDM group '%s'. Aborting!"), "gdm_config_parse", groupname);
- } else {
- gid = grent->gr_gid;
- }
-
- if G_UNLIKELY (gid == 0) {
- if (console_notify) {
- gchar *s = g_strdup_printf (C_(N_("The GDM group is set to be root, but "
- "this is not allowed since it can "
- "pose a security risk. Please "
- "correct GDM configuration and "
- "restart GDM.")));
- gdm_text_message_dialog (s);
- g_free (s);
- }
-
- gdm_fail (_("%s: The GDM group should not be root. Aborting!"), "gdm_config_parse");
- }
-
- /* gid remains `gdm' */
- NEVER_FAILS_root_set_euid_egid (uid, gid);
-
- if (uidp != NULL) {
- *uidp = uid;
- }
-
- if (gidp != NULL) {
- *gidp = gid;
- }
-
- g_free (username);
- g_free (groupname);
-}
-
-static void
-gdm_daemon_check_permissions (GdmConfig *config,
- uid_t uid,
- gid_t gid)
-{
- struct stat statbuf;
- char *auth_path;
- gboolean console_notify;
-
- console_notify = FALSE;
- gdm_config_get_bool_for_id (daemon_config, GDM_ID_CONSOLE_NOTIFY, &console_notify);
- auth_path = NULL;
- gdm_config_get_string_for_id (config, GDM_ID_LOG_DIR, &auth_path);
-
- /* Enter paranoia mode */
- check_servauthdir (auth_path, &statbuf);
-
- NEVER_FAILS_root_set_euid_egid (0, 0);
-
- /* Now set things up for us as */
- chown (auth_path, 0, gid);
- g_chmod (auth_path, (S_IRWXU|S_IRWXG|S_ISVTX));
-
- NEVER_FAILS_root_set_euid_egid (uid, gid);
-
- /* Again paranoid */
- check_servauthdir (auth_path, &statbuf);
-
- if G_UNLIKELY (statbuf.st_uid != 0 || statbuf.st_gid != gid) {
- if (console_notify) {
- gchar *s = g_strdup_printf (C_(N_("Server Authorization directory "
- "(daemon/ServAuthDir) is set to %s "
- "but is not owned by user %d and group "
- "%d. Please correct the ownership or "
- "GDM configuration and restart "
- "GDM.")),
- auth_path,
- (int)uid,
- (int)gid);
- gdm_text_message_dialog (s);
- g_free (s);
- }
-
- gdm_fail (_("%s: Authdir %s is not owned by user %d, group %d. Aborting."),
- "gdm_config_parse",
- auth_path,
- (int)uid,
- (int)gid);
- }
-
- if G_UNLIKELY (statbuf.st_mode != (S_IFDIR|S_IRWXU|S_IRWXG|S_ISVTX)) {
- if (console_notify) {
- gchar *s = g_strdup_printf (C_(N_("Server Authorization directory "
- "(daemon/ServAuthDir) is set to %s "
- "but has the wrong permissions: it "
- "should have permissions of %o. "
- "Please correct the permissions or "
- "the GDM configuration and "
- "restart GDM.")),
- auth_path,
- (S_IRWXU|S_IRWXG|S_ISVTX));
- gdm_text_message_dialog (s);
- g_free (s);
- }
-
- gdm_fail (_("%s: Authdir %s has wrong permissions %o. Should be %o. Aborting."),
- "gdm_config_parse",
- auth_path,
- statbuf.st_mode,
- (S_IRWXU|S_IRWXG|S_ISVTX));
- }
-
- g_free (auth_path);
-}
-
-/**
- * gdm_daemon_config_parse
- *
- * Loads initial configuration settings.
- */
-void
-gdm_daemon_config_parse (const char *config_file,
- gboolean no_console)
-{
- uid_t uid;
- gid_t gid;
- GError *error;
- gboolean xdmcp_enabled;
- gboolean dynamic_enabled;
-
- displays = NULL;
- high_display_num = 0;
-
- /* Not NULL if config_file was set by command-line option. */
- if (config_file == NULL) {
- config_file = GDM_DEFAULTS_CONF;
- }
- custom_config_file = g_strdup (GDM_CUSTOM_CONF);
-
- daemon_config = gdm_config_new ();
-
- gdm_config_set_notify_func (daemon_config, notify_cb, NULL);
- gdm_config_set_validate_func (daemon_config, validate_cb, NULL);
-
- gdm_config_add_static_entries (daemon_config, gdm_daemon_config_entries);
-
- gdm_config_set_default_file (daemon_config, config_file);
- gdm_config_set_custom_file (daemon_config, custom_config_file);
-
- /* load the data files */
- error = NULL;
- gdm_config_load (daemon_config, &error);
- if (error != NULL) {
- gdm_error ("Unable to load configuration: %s", error->message);
- g_error_free (error);
- }
-
- /* populate the database with all specified entries */
- gdm_config_process_all (daemon_config, &error);
-
- gdm_daemon_config_load_xservers (daemon_config);
-
- /* Only read the list if no_console is FALSE at this stage */
- if (! no_console) {
- gdm_daemon_config_load_displays (daemon_config);
- }
-
- xdmcp_enabled = FALSE;
- gdm_config_get_bool_for_id (daemon_config, GDM_ID_XDMCP, &xdmcp_enabled);
- dynamic_enabled = FALSE;
- gdm_config_get_bool_for_id (daemon_config, GDM_ID_DYNAMIC_XSERVERS, &dynamic_enabled);
- if G_UNLIKELY ((displays == NULL) && (! xdmcp_enabled) && (! dynamic_enabled)) {
- handle_no_displays (daemon_config, no_console);
- }
-
- /* If no displays were found, then obviously
- we're in a no console mode */
- if (displays == NULL) {
- no_console = TRUE;
- }
-
- if (no_console) {
- gdm_config_set_bool_for_id (daemon_config, GDM_ID_CONSOLE_NOTIFY, FALSE);
- }
-
- gdm_daemon_change_user (daemon_config, &uid, &gid);
-
- gdm_daemon_check_permissions (daemon_config, uid, gid);
-
- NEVER_FAILS_root_set_euid_egid (0, 0);
-
- check_logdir ();
-
- GdmUserId = uid;
- GdmGroupId = gid;
-
- /* Check that user authentication is properly configured */
- gdm_verify_check ();
-}
-
-/**
- * gdm_daemon_config_get_gdmuid
- * gdm_daemon_config_get_gdmgid
- *
- * Access functions for getting the GDM user ID and group ID.
- */
-uid_t
-gdm_daemon_config_get_gdmuid (void)
-{
- return GdmUserId;
-}
-
-gid_t
-gdm_daemon_config_get_gdmgid (void)
-{
- return GdmGroupId;
-}
-
-/**
- * gdm_daemon_config_get_high_display_num
- * gdm_daemon_config_get_high_display_num
- *
- * Access functions for getting the high display number.
- */
-gint
-gdm_daemon_config_get_high_display_num (void)
-{
- return high_display_num;
-}
-
-void
-gdm_daemon_config_set_high_display_num (gint val)
-{
- high_display_num = val;
-}
-
-/**
- * gdm_is_valid_key
- *
- * Returns TRUE if the key is a valid key, FALSE otherwise.
- */
-gboolean
-gdm_daemon_config_is_valid_key (const char *keystring)
-{
- char *group;
- char *key;
- gboolean ret;
- const GdmConfigEntry *entry;
-
- ret = gdm_common_config_parse_key_string (keystring,
- &group,
- &key,
- NULL,
- NULL);
- if (! ret) {
- goto out;
- }
-
-
- entry = gdm_config_lookup_entry (daemon_config, group, key);
- ret = (entry != NULL);
-
- g_free (group);
- g_free (key);
- out:
- return ret;
-}
-
-/**
- * gdm_signal_terminthup_was_notified
- *
- * returns TRUE if signal SIGTERM, SIGINT, or SIGHUP was received.
- * This just hides these vicious-extensions functions from the
- * other files
- */
-gboolean
-gdm_daemon_config_signal_terminthup_was_notified (void)
-{
- if (ve_signal_was_notified (SIGTERM) ||
- ve_signal_was_notified (SIGINT) ||
- ve_signal_was_notified (SIGHUP)) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-
-static gboolean
-is_prog_in_path (const char *prog)
-{
- char *f;
- gboolean ret;
-
- f = g_find_program_in_path (prog);
- ret = (f != NULL);
- g_free (f);
- return ret;
-}
-
-/**
- * gdm_daemon_config_get_session_exec
- *
- * This function accesses the GDM session desktop file and returns
- * the execution command for starting the session.
- *
- * Must be called with the PATH set correctly to find session exec.
- */
-char *
-gdm_daemon_config_get_session_exec (const char *session_name,
- gboolean check_try_exec)
-{
- char *session_filename;
- const char *path_str;
- char **search_dirs;
- GKeyFile *cfg;
- static char *exec;
- static char *cached = NULL;
- gboolean hidden;
- char *ret;
-
- cfg = NULL;
-
- /* clear cache */
- if (session_name == NULL) {
- g_free (exec);
- exec = NULL;
- g_free (cached);
- cached = NULL;
- return NULL;
- }
-
- if (cached != NULL && strcmp (ve_sure_string (session_name), ve_sure_string (cached)) == 0)
- return g_strdup (exec);
-
- g_free (exec);
- exec = NULL;
- g_free (cached);
- cached = g_strdup (session_name);
-
- /* Some ugly special casing for legacy "Default.desktop", oh well,
- * we changed to "default.desktop" */
- if (g_ascii_strcasecmp (session_name, "default") == 0 ||
- g_ascii_strcasecmp (session_name, "default.desktop") == 0) {
- session_filename = g_strdup ("default.desktop");
- } else {
- session_filename = gdm_ensure_extension (session_name, ".desktop");
- }
-
- path_str = gdm_daemon_config_get_value_string (GDM_KEY_SESSION_DESKTOP_DIR);
- if (path_str == NULL) {
- gdm_error ("No session desktop directories defined");
- goto out;
- }
-
- search_dirs = g_strsplit (path_str, ":", -1);
-
- cfg = gdm_common_config_load_from_dirs (session_filename,
- (const char **)search_dirs,
- NULL);
- g_strfreev (search_dirs);
-
- if (cfg == NULL) {
- if (gdm_is_session_magic (session_name)) {
- exec = g_strdup (session_name);
- } else {
- g_free (exec);
- exec = NULL;
- }
- goto out;
- }
-
- hidden = FALSE;
- gdm_common_config_get_boolean (cfg, "Desktop Entry/Hidden=false", &hidden, NULL);
- if (hidden) {
- g_free (exec);
- exec = NULL;
- goto out;
- }
-
- if (check_try_exec) {
- char *tryexec;
-
- tryexec = NULL;
- gdm_common_config_get_string (cfg, "Desktop Entry/TryExec", &tryexec, NULL);
-
- if (tryexec != NULL &&
- tryexec[0] != '\0' &&
- ! is_prog_in_path (tryexec)) {
- g_free (tryexec);
- g_free (exec);
- exec = NULL;
- goto out;
- }
- g_free (tryexec);
- }
-
- exec = NULL;
- gdm_common_config_get_string (cfg, "Desktop Entry/Exec", &exec, NULL);
-
- out:
-
- ret = g_strdup (exec);
-
- g_key_file_free (cfg);
-
- return ret;
-}
-
-/**
- * gdm_daemon_config_get_session_xserver_args
- *
- * This function accesses the GDM session desktop file and returns
- * additional Xserver arguments to be used with this session
- */
-char *
-gdm_daemon_config_get_session_xserver_args (const char *session_name)
-{
- char *session_filename;
- const char *path_str;
- char **search_dirs;
- GKeyFile *cfg;
- static char *xserver_args;
- static char *cached = NULL;
- gboolean hidden;
- char *ret;
-
- cfg = NULL;
-
- /* clear cache */
- if (session_name == NULL) {
- g_free (xserver_args);
- xserver_args = NULL;
- g_free (cached);
- cached = NULL;
- return NULL;
- }
-
- if (cached != NULL && strcmp (ve_sure_string (session_name), ve_sure_string (cached)) == 0)
- return g_strdup (xserver_args);
-
- g_free (xserver_args);
- xserver_args = NULL;
- g_free (cached);
- cached = g_strdup (session_name);
-
- /* Some ugly special casing for legacy "Default.desktop", oh well,
- * we changed to "default.desktop" */
- if (g_ascii_strcasecmp (session_name, "default") == 0 ||
- g_ascii_strcasecmp (session_name, "default.desktop") == 0) {
- session_filename = g_strdup ("default.desktop");
- } else {
- session_filename = gdm_ensure_extension (session_name, ".desktop");
- }
-
- path_str = gdm_daemon_config_get_value_string (GDM_KEY_SESSION_DESKTOP_DIR);
- if (path_str == NULL) {
- gdm_error ("No session desktop directories defined");
- goto out;
- }
-
- search_dirs = g_strsplit (path_str, ":", -1);
-
- cfg = gdm_common_config_load_from_dirs (session_filename,
- (const char **)search_dirs,
- NULL);
- g_strfreev (search_dirs);
-
- xserver_args = NULL;
- gdm_common_config_get_string (cfg, "Desktop Entry/X-Gdm-XserverArgs", &xserver_args, NULL);
-
- out:
-
- ret = g_strdup (xserver_args);
-
- g_key_file_free (cfg);
-
- return ret;
-}
-
-/**
- * gdm_daemon_config_get_user_session_lang
- *
- * These functions get and set the user's language and setting in their
- * $HOME/.dmrc file.
- */
-void
-gdm_daemon_config_set_user_session_lang (gboolean savesess,
- gboolean savelang,
- const char *home_dir,
- const char *save_session,
- const char *save_language)
-{
- GKeyFile *dmrc;
- gchar *cfgstr;
-
- cfgstr = g_build_filename (home_dir, ".dmrc", NULL);
-
- dmrc = gdm_common_config_load (cfgstr, NULL);
- if (dmrc == NULL) {
- return;
- }
-
- if (savesess) {
- g_key_file_set_string (dmrc, "Desktop", "Session", ve_sure_string (save_session));
- }
-
- if (savelang) {
- if (ve_string_empty (save_language)) {
- /* we chose the system default language so wipe the
- * lang key */
- g_key_file_remove_key (dmrc, "Desktop", "Language", NULL);
- } else {
- g_key_file_set_string (dmrc, "Desktop", "Language", save_language);
- }
- }
-
- if (dmrc != NULL) {
- mode_t oldmode;
- oldmode = umask (077);
- gdm_common_config_save (dmrc, cfgstr, NULL);
- umask (oldmode);
- }
-
- g_free (cfgstr);
- g_key_file_free (dmrc);
-}
-
-void
-gdm_daemon_config_get_user_session_lang (char **usrsess,
- char **usrlang,
- const char *home_dir,
- gboolean *savesess)
-{
- char *p;
- char *cfgfile;
- GKeyFile *cfg;
- char *session;
- char *lang;
- gboolean save;
-
- cfgfile = g_build_filename (home_dir, ".dmrc", NULL);
- cfg = gdm_common_config_load (cfgfile, NULL);
- g_free (cfgfile);
-
- save = FALSE;
- session = NULL;
-
- gdm_common_config_get_string (cfg, "Desktop/Session", &session, NULL);
- if (session == NULL) {
- session = g_strdup ("");
- }
-
- /* this is just being truly anal about what users give us, and in case
- * it looks like they may have included a path whack it. */
- p = strrchr (session, '/');
- if (p != NULL) {
- char *tmp = g_strdup (p + 1);
- g_free (session);
- session = tmp;
- }
-
- /* ugly workaround for migration */
- if (strcmp (session, "Default") == 0 ||
- strcmp (session, "Default.desktop") == 0) {
- g_free (session);
- session = g_strdup ("default");
- save = TRUE;
- }
-
- gdm_common_config_get_string (cfg, "Desktop/Language", &lang, NULL);
- if (lang == NULL) {
- lang = g_strdup ("");
- }
-
- if (usrsess != NULL) {
- *usrsess = g_strdup (session);
- }
- g_free (session);
-
- if (savesess != NULL) {
- *savesess = save;
- }
-
- if (usrlang != NULL) {
- *usrlang = g_strdup (lang);
- }
- g_free (lang);
-
- g_key_file_free (cfg);
-}
diff --git a/daemon/gdm-daemon-config.h b/daemon/gdm-daemon-config.h
deleted file mode 100644
index d15d6f10..00000000
--- a/daemon/gdm-daemon-config.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * GDM - The GNOME Display Manager
- * Copyright (C) 1998, 1999, 2000 Martin K. Petersen <mkp@mkp.net>
- * Copyright (C) 2005 Brian Cameron <brian.cameron@sun.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef _GDM_DAEMON_CONFIG_H
-#define _GDM_DAEMON_CONFIG_H
-
-#include "gdm-daemon-config-entries.h"
-
-G_BEGIN_DECLS
-
-const char * gdm_daemon_config_get_string_for_id (int id);
-gboolean gdm_daemon_config_get_bool_for_id (int id);
-int gdm_daemon_config_get_int_for_id (int id);
-
-void gdm_daemon_config_parse (const char *config_file,
- gboolean no_console);
-GdmXserver * gdm_daemon_config_find_xserver (const char *id);
-char * gdm_daemon_config_get_xservers (void);
-GSList * gdm_daemon_config_get_display_list (void);
-GSList * gdm_daemon_config_display_list_append (GdmDisplay *display);
-GSList * gdm_daemon_config_display_list_insert (GdmDisplay *display);
-GSList * gdm_daemon_config_display_list_remove (GdmDisplay *display);
-uid_t gdm_daemon_config_get_gdmuid (void);
-uid_t gdm_daemon_config_get_gdmgid (void);
-gint gdm_daemon_config_get_high_display_num (void);
-void gdm_daemon_config_set_high_display_num (gint val);
-
-/* deprecated */
-char * gdm_daemon_config_get_display_custom_config_file (const char *display);
-char * gdm_daemon_config_get_custom_config_file (void);
-
-
-const char * gdm_daemon_config_get_value_string (const char *key);
-const char ** gdm_daemon_config_get_value_string_array (const char *key);
-gboolean gdm_daemon_config_get_value_bool (const char *key);
-gint gdm_daemon_config_get_value_int (const char *key);
-char * gdm_daemon_config_get_value_string_per_display (const char *key,
- const char *display);
-gboolean gdm_daemon_config_get_value_bool_per_display (const char *key,
- const char *display);
-gint gdm_daemon_config_get_value_int_per_display (const char *key,
- const char *display);
-
-void gdm_daemon_config_set_value_string (const char *key,
- const char *value);
-void gdm_daemon_config_set_value_bool (const char *key,
- gboolean value);
-void gdm_daemon_config_set_value_int (const char *key,
- gint value);
-
-
-gboolean gdm_daemon_config_key_to_string_per_display (const char *display,
- const char *key,
- char **retval);
-gboolean gdm_daemon_config_key_to_string (const char *file,
- const char *key,
- char **retval);
-gboolean gdm_daemon_config_to_string (const char *key,
- const char *display,
- char **retval);
-gboolean gdm_daemon_config_update_key (const char *key);
-
-
-int gdm_daemon_config_compare_displays (gconstpointer a,
- gconstpointer b);
-gboolean gdm_daemon_config_is_valid_key (const char *key);
-gboolean gdm_daemon_config_signal_terminthup_was_notified (void);
-
-char * gdm_daemon_config_get_facefile_from_home (const char *homedir,
- guint uid);
-char * gdm_daemon_config_get_facefile_from_global (const char *username,
- guint uid);
-void gdm_daemon_config_get_user_session_lang (char **usrsess,
- char **usrlang,
- const char *homedir,
- gboolean *savesess);
-void gdm_daemon_config_set_user_session_lang (gboolean savesess,
- gboolean savelang,
- const char *home_dir,
- const char *save_session,
- const char *save_language);
-char * gdm_daemon_config_get_session_exec (const char *session_name,
- gboolean check_try_exec);
-char * gdm_daemon_config_get_session_xserver_args (const char *session_name);
-
-
-G_END_DECLS
-
-#endif /* _GDM_DAEMON_CONFIG_H */
diff --git a/daemon/gdm-greeter.c b/daemon/gdm-greeter.c
index 7d6b8a06..58e8326f 100644
--- a/daemon/gdm-greeter.c
+++ b/daemon/gdm-greeter.c
@@ -578,11 +578,12 @@ get_facefile_from_gnome2_dir_config (const char *homedir,
char *cfgfile;
cfgfile = g_build_filename (homedir, ".gnome2", "gdm", NULL);
- cfg = gdm_common_config_load (cfgfile, NULL);
+ cfg = g_key_file_new ();
+ g_key_file_load_from_file (cfg, cfgfile, 0, NULL);
g_free (cfgfile);
if (cfg != NULL) {
- gdm_common_config_get_string (cfg, "face/picture=", &picfile, NULL);
+ picfile = g_key_file_get_string (cfg, "face", "picture", NULL);
g_key_file_free (cfg);
}
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 6863af79..49568076 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -44,9 +44,6 @@
#include "gdm-static-display.h"
-#include "gdm-master-config.h"
-#include "gdm-daemon-config-entries.h"
-
#define GDM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_MANAGER, GdmManagerPrivate))
#define GDM_DBUS_PATH "/org/gnome/DisplayManager"
@@ -56,7 +53,6 @@
struct GdmManagerPrivate
{
GdmDisplayStore *display_store;
- GdmDaemonConfig *daemon_config;
GdmXdmcpManager *xdmcp_manager;
gboolean xdmcp_enabled;
@@ -70,6 +66,11 @@ struct GdmManagerPrivate
};
enum {
+ PROP_0,
+ PROP_XDMCP_ENABLED
+};
+
+enum {
DISPLAY_ADDED,
DISPLAY_REMOVED,
LAST_SIGNAL
@@ -169,7 +170,6 @@ make_global_cookie (GdmManager *manager)
{
FILE *fp;
char *file;
- GString *cookie;
gdm_generate_cookie (manager->priv->global_cookie);
@@ -200,17 +200,11 @@ make_global_cookie (GdmManager *manager)
static void
load_static_displays_from_file (GdmManager *manager)
{
- GSList *xservers;
- GSList *l;
-
- xservers = gdm_daemon_config_get_xserver_list (manager->priv->daemon_config);
+#if 0
for (l = xservers; l != NULL; l = l->next) {
- GdmXserver *xserver;
GdmDisplay *display;
- xserver = l->data;
-
g_debug ("Loading display for '%d' %s", xserver->number, xserver->id);
display = gdm_static_display_new (xserver->number);
@@ -225,6 +219,7 @@ load_static_displays_from_file (GdmManager *manager)
/* let store own the ref */
g_object_unref (display);
}
+#endif
}
static void
@@ -361,11 +356,62 @@ register_manager (GdmManager *manager)
return TRUE;
}
+void
+gdm_manager_set_xdmcp_enabled (GdmManager *manager,
+ gboolean enabled)
+{
+ g_return_if_fail (GDM_IS_MANAGER (manager));
+
+ manager->priv->xdmcp_enabled = enabled;
+}
+
+static void
+gdm_manager_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GdmManager *self;
+
+ self = GDM_MANAGER (object);
+
+ switch (prop_id) {
+ case PROP_XDMCP_ENABLED:
+ gdm_manager_set_xdmcp_enabled (self, g_value_get_boolean (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gdm_manager_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GdmManager *self;
+
+ self = GDM_MANAGER (object);
+
+ switch (prop_id) {
+ case PROP_XDMCP_ENABLED:
+ g_value_set_boolean (value, self->priv->xdmcp_enabled);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
static void
gdm_manager_class_init (GdmManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->get_property = gdm_manager_get_property;
+ object_class->set_property = gdm_manager_set_property;
object_class->finalize = gdm_manager_finalize;
signals [DISPLAY_ADDED] =
@@ -389,6 +435,14 @@ gdm_manager_class_init (GdmManagerClass *klass)
G_TYPE_NONE,
1, G_TYPE_STRING);
+ g_object_class_install_property (object_class,
+ PROP_XDMCP_ENABLED,
+ g_param_spec_boolean ("xdmcp-enabled",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
g_type_class_add_private (klass, sizeof (GdmManagerPrivate));
dbus_g_object_type_install_info (GDM_TYPE_MANAGER, &dbus_glib_gdm_manager_object_info);
@@ -400,16 +454,10 @@ gdm_manager_init (GdmManager *manager)
manager->priv = GDM_MANAGER_GET_PRIVATE (manager);
- manager->priv->daemon_config = gdm_daemon_config_new ();
-
manager->priv->global_cookie = g_string_new (NULL);
make_global_cookie (manager);
- gdm_daemon_config_get_bool_for_id (manager->priv->daemon_config,
- GDM_ID_XDMCP,
- &manager->priv->xdmcp_enabled);
-
manager->priv->display_store = gdm_display_store_new ();
if (manager->priv->xdmcp_enabled) {
@@ -436,10 +484,6 @@ gdm_manager_finalize (GObject *object)
gdm_display_store_clear (manager->priv->display_store);
g_object_unref (manager->priv->display_store);
- if (manager->priv->daemon_config != NULL) {
- g_object_unref (manager->priv->daemon_config);
- }
-
g_string_free (manager->priv->global_cookie, TRUE);
G_OBJECT_CLASS (gdm_manager_parent_class)->finalize (object);
diff --git a/daemon/gdm-manager.h b/daemon/gdm-manager.h
index 99187b77..afdc3392 100644
--- a/daemon/gdm-manager.h
+++ b/daemon/gdm-manager.h
@@ -66,6 +66,8 @@ void gdm_manager_start (GdmManager *mana
void gdm_manager_set_wait_for_go (GdmManager *manager,
gboolean wait_for_go);
+void gdm_manager_set_xdmcp_enabled (GdmManager *manager,
+ gboolean enabled);
gboolean gdm_manager_get_displays (GdmManager *manager,
GPtrArray **displays,
GError **error);
diff --git a/daemon/gdm-master-config.c b/daemon/gdm-master-config.c
deleted file mode 100644
index 77278c71..00000000
--- a/daemon/gdm-master-config.c
+++ /dev/null
@@ -1,941 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/resource.h> /* for PRIO_MIN */
-#include <ctype.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glib/gstdio.h>
-#include <glib-object.h>
-
-#include "gdm-config.h"
-#include "gdm-master-config.h"
-#include "gdm-daemon-config-entries.h"
-
-#define GDM_STANDARD "Standard"
-
-/* PRIO_MIN and PRIO_MAX are not defined on Solaris, but are -20 and 20 */
-#if sun
-#ifndef PRIO_MIN
-#define PRIO_MIN -20
-#endif
-#ifndef PRIO_MAX
-#define PRIO_MAX 20
-#endif
-#endif
-
-#define GDM_DAEMON_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_DAEMON_CONFIG, GdmDaemonConfigPrivate))
-
-struct GdmDaemonConfigPrivate
-{
- GdmConfig *config;
- GSList *xservers;
-
- char *default_file;
- char *custom_file;
-};
-
-static void gdm_daemon_config_class_init (GdmDaemonConfigClass *klass);
-static void gdm_daemon_config_init (GdmDaemonConfig *daemon_config);
-static void gdm_daemon_config_finalize (GObject *object);
-
-static gpointer daemon_config_object = NULL;
-
-G_DEFINE_TYPE (GdmDaemonConfig, gdm_daemon_config, G_TYPE_OBJECT)
-
-GQuark
-gdm_daemon_config_error_quark (void)
-{
- static GQuark ret = 0;
- if (ret == 0) {
- ret = g_quark_from_static_string ("gdm_daemon_config_error");
- }
-
- return ret;
-}
-
-/*
- * gdm_read_default
- *
- * This function is used to support systems that have the /etc/default/login
- * interface to control programs that affect security. This is a Solaris
- * thing, though some users on other systems may find it useful.
- */
-static char *
-gdm_read_default (char *key)
-{
-#ifdef HAVE_DEFOPEN
- gchar *retval = NULL;
-
- if (defopen ("/etc/default/login") == 0) {
- int flags = defcntl (DC_GETFLAGS, 0);
-
- TURNOFF (flags, DC_CASE);
- (void) defcntl (DC_SETFLAGS, flags); /* ignore case */
- retval = g_strdup (defread (key));
- (void) defopen ((char *)NULL);
- }
- return retval;
-#else
- return NULL;
-#endif
-}
-
-/**
- * gdm_daemon_config_get_bool_for_id
- *
- * Gets a boolean configuration option by ID. The option must
- * first be loaded, say, by calling gdm_daemon_config_parse.
- */
-gboolean
-gdm_daemon_config_get_bool_for_id (GdmDaemonConfig *config,
- int id,
- gboolean *val)
-{
- return gdm_config_get_bool_for_id (config->priv->config, id, val);
-}
-
-/**
- * gdm_daemon_config_get_int_for_id
- *
- * Gets a integer configuration option by ID. The option must
- * first be loaded, say, by calling gdm_daemon_config_parse.
- */
-gboolean
-gdm_daemon_config_get_int_for_id (GdmDaemonConfig *config,
- int id,
- int *val)
-{
- return gdm_config_get_int_for_id (config->priv->config, id, val);
-}
-
-/**
- * gdm_daemon_config_get_string_for_id
- *
- * Gets a string configuration option by ID. The option must
- * first be loaded, say, by calling gdm_daemon_config_parse.
- */
-gboolean
-gdm_daemon_config_get_string_for_id (GdmDaemonConfig *config,
- int id,
- char **val)
-{
- return gdm_config_get_string_for_id (config->priv->config, id, val);
-}
-
-static void
-gdm_daemon_config_class_init (GdmDaemonConfigClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = gdm_daemon_config_finalize;
-
- g_type_class_add_private (klass, sizeof (GdmDaemonConfigPrivate));
-}
-
-static gboolean
-validate_path (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- char *str;
-
- /* If the /etc/default has a PATH use that */
- str = gdm_read_default ("PATH=");
- if (str != NULL) {
- gdm_config_value_set_string (value, str);
- g_free (str);
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_root_path (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- char *str;
-
- /* If the /etc/default has a PATH use that */
- str = gdm_read_default ("SUPATH=");
- if (str != NULL) {
- gdm_config_value_set_string (value, str);
- g_free (str);
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_base_xsession (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- const char *str;
-
- str = gdm_config_value_get_string (value);
- if (str == NULL || str[0] == '\0') {
- char *path;
- path = g_build_filename (GDMCONFDIR, "gdm", "Xsession", NULL);
- g_debug (_("BaseXsession empty; using %s"), path);
- gdm_config_value_set_string (value, path);
- g_free (path);
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_power_action (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- /* FIXME: should weed out the commands that don't work */
-
- return TRUE;
-}
-
-static gboolean
-validate_standard_xserver (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- gboolean res;
- gboolean is_ok;
- const char *str;
- char *new;
-
- is_ok = FALSE;
- new = NULL;
- str = gdm_config_value_get_string (value);
-
- if (str != NULL) {
- char **argv;
-
- if (g_shell_parse_argv (str, NULL, &argv, NULL)) {
- if (g_access (argv[0], X_OK) == 0) {
- is_ok = TRUE;
- }
- g_strfreev (argv);
- }
- }
-
- if G_UNLIKELY (! is_ok) {
- g_debug (_("Standard X server not found; trying alternatives"));
- if (g_access ("/usr/X11R6/bin/X", X_OK) == 0) {
- new = g_strdup ("/usr/X11R6/bin/X");
- } else if (g_access ("/opt/X11R6/bin/X", X_OK) == 0) {
- new = g_strdup ("/opt/X11R6/bin/X");
- } else if (g_access ("/usr/bin/X11/X", X_OK) == 0) {
- new = g_strdup ("/usr/bin/X11/X");
- }
- }
-
- if (new != NULL) {
- gdm_config_value_set_string (value, new);
- g_free (new);
- }
-
- res = TRUE;
-
- return res;
-}
-
-static gboolean
-validate_graphical_theme_dir (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- const char *str;
-
- str = gdm_config_value_get_string (value);
-
- if (str == NULL || !g_file_test (str, G_FILE_TEST_IS_DIR)) {
- gdm_config_value_set_string (value, GREETERTHEMEDIR);
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_graphical_theme (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- const char *str;
-
- str = gdm_config_value_get_string (value);
-
- if (str == NULL || str[0] == '\0') {
- gdm_config_value_set_string (value, "circles");
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_greeter (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- const char *str;
-
- str = gdm_config_value_get_string (value);
-
- if (str == NULL || str[0] == '\0') {
- g_warning (_("%s: No greeter specified."), "gdm_config_parse");
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_remote_greeter (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- const char *str;
-
- str = gdm_config_value_get_string (value);
-
- if (str == NULL || str[0] == '\0') {
- g_warning (_("%s: No remote greeter specified."), "gdm_config_parse");
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_session_desktop_dir (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- const char *str;
-
- str = gdm_config_value_get_string (value);
-
- if (str == NULL || str[0] == '\0') {
- g_warning (_("%s: No sessions directory specified."), "gdm_config_parse");
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_password_required (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- char *str;
-
- str = gdm_read_default ("PASSREQ=");
- if (str != NULL && str[0] == '\0') {
- gboolean val;
- val = (g_ascii_strcasecmp (str, "YES") == 0);
- gdm_config_value_set_bool (value, val);
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_allow_remote_root (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
- char *str;
-
- str = gdm_read_default ("CONSOLE=");
- if (str != NULL && str[0] == '\0') {
- gboolean val;
- val = (g_ascii_strcasecmp (str, "/dev/console") != 0);
- gdm_config_value_set_bool (value, val);
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_xdmcp (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value)
-{
-
-#ifndef HAVE_LIBXDMCP
- if (gdm_config_value_get_bool (value)) {
- g_debug (_("XDMCP was enabled while there is no XDMCP support; turning it off"));
- gdm_config_value_set_bool (value, FALSE);
- }
-#endif
-
- return TRUE;
-}
-
-static gboolean
-validate_at_least_int (GdmConfig *config,
- GdmConfigSourceType source,
- GdmConfigValue *value,
- int minval,
- int defval)
-{
- if (gdm_config_value_get_int (value) < minval) {
- gdm_config_value_set_int (value, defval);
- }
-
- return TRUE;
-}
-
-static gboolean
-validate_cb (GdmConfig *config,
- GdmConfigSourceType source,
- const char *group,
- const char *key,
- GdmConfigValue *value,
- int id,
- gpointer data)
-{
- gboolean res;
-
- res = TRUE;
-
- switch (id) {
- case GDM_ID_PATH:
- res = validate_path (config, source, value);
- break;
- case GDM_ID_ROOT_PATH:
- res = validate_root_path (config, source, value);
- break;
- case GDM_ID_BASE_XSESSION:
- res = validate_base_xsession (config, source, value);
- break;
- case GDM_ID_HALT:
- case GDM_ID_REBOOT:
- case GDM_ID_SUSPEND:
- res = validate_power_action (config, source, value);
- break;
- case GDM_ID_STANDARD_XSERVER:
- res = validate_standard_xserver (config, source, value);
- break;
- case GDM_ID_GRAPHICAL_THEME_DIR:
- res = validate_graphical_theme_dir (config, source, value);
- break;
- case GDM_ID_GRAPHICAL_THEME:
- res = validate_graphical_theme (config, source, value);
- break;
- case GDM_ID_GREETER:
- res = validate_greeter (config, source, value);
- break;
- case GDM_ID_REMOTE_GREETER:
- res = validate_remote_greeter (config, source, value);
- break;
- case GDM_ID_SESSION_DESKTOP_DIR:
- res = validate_session_desktop_dir (config, source, value);
- break;
- case GDM_ID_PASSWORD_REQUIRED:
- res = validate_password_required (config, source, value);
- break;
- case GDM_ID_ALLOW_REMOTE_ROOT:
- res = validate_allow_remote_root (config, source, value);
- break;
- case GDM_ID_XDMCP:
- res = validate_xdmcp (config, source, value);
- break;
- case GDM_ID_MAX_INDIRECT:
- case GDM_ID_XINERAMA_SCREEN:
- res = validate_at_least_int (config, source, value, 0, 0);
- break;
- case GDM_ID_TIMED_LOGIN_DELAY:
- res = validate_at_least_int (config, source, value, 5, 5);
- break;
- case GDM_ID_MAX_ICON_WIDTH:
- case GDM_ID_MAX_ICON_HEIGHT:
- res = validate_at_least_int (config, source, value, 0, 128);
- break;
- case GDM_ID_SCAN_TIME:
- res = validate_at_least_int (config, source, value, 1, 1);
- break;
- case GDM_ID_NONE:
- case GDM_CONFIG_INVALID_ID:
- break;
- default:
- break;
- }
-
- return res;
-}
-
-static const char *
-source_to_name (GdmConfigSourceType source)
-{
- const char *name;
-
- switch (source) {
- case GDM_CONFIG_SOURCE_DEFAULT:
- name = "default";
- break;
- case GDM_CONFIG_SOURCE_MANDATORY:
- name = "mandatory";
- break;
- case GDM_CONFIG_SOURCE_CUSTOM:
- name = "custom";
- break;
- case GDM_CONFIG_SOURCE_BUILT_IN:
- name = "built-in";
- break;
- case GDM_CONFIG_SOURCE_RUNTIME_USER:
- name = "runtime-user";
- break;
- case GDM_CONFIG_SOURCE_INVALID:
- name = "Invalid";
- break;
- default:
- name = "Unknown";
- break;
- }
-
- return name;
-}
-
-static gboolean
-notify_cb (GdmConfig *config,
- GdmConfigSourceType source,
- const char *group,
- const char *key,
- GdmConfigValue *value,
- int id,
- gpointer data)
-{
- char *valstr;
-
- /* FIXME: need a better approach */
-#if 0
- switch (id) {
- case GDM_ID_GREETER:
- case GDM_ID_REMOTE_GREETER:
- case GDM_ID_SOUND_ON_LOGIN_FILE:
- case GDM_ID_SOUND_ON_LOGIN_SUCCESS_FILE:
- case GDM_ID_SOUND_ON_LOGIN_FAILURE_FILE:
- case GDM_ID_GTK_MODULES_LIST:
- case GDM_ID_TIMED_LOGIN:
- case GDM_ID_ALLOW_ROOT:
- case GDM_ID_ALLOW_REMOTE_ROOT:
- case GDM_ID_ALLOW_REMOTE_AUTOLOGIN:
- case GDM_ID_SYSTEM_MENU:
- case GDM_ID_CONFIG_AVAILABLE:
- case GDM_ID_CHOOSER_BUTTON:
- case GDM_ID_DISALLOW_TCP:
- case GDM_ID_ADD_GTK_MODULES:
- case GDM_ID_TIMED_LOGIN_ENABLE:
- case GDM_ID_RETRY_DELAY:
- case GDM_ID_TIMED_LOGIN_DELAY:
- notify_displays_value (config, group, key, value);
- break;
- case GDM_ID_NONE:
- case GDM_CONFIG_INVALID_ID:
- {
- /* doesn't have an ID : match group/key */
- if (group != NULL) {
- if (strcmp (group, GDM_CONFIG_GROUP_SERVERS) == 0) {
- /* FIXME: handle this? */
- } else if (strcmp (group, GDM_CONFIG_GROUP_CUSTOM_CMD) == 0) {
- notify_displays_value (config, group, key, value);
- }
- }
- }
- break;
- default:
- break;
- }
-#endif
-
- valstr = gdm_config_value_to_string (value);
- g_debug ("Got config %s/%s=%s <%s>\n",
- group,
- key,
- valstr,
- source_to_name (source));
- g_free (valstr);
-
- return TRUE;
-}
-
-/**
- * gdm_daemon_config_find_xserver
- *
- * Return an xserver with a given ID, or NULL if not found.
- */
-GdmXserver *
-gdm_daemon_config_find_xserver (GdmDaemonConfig *config,
- const char *id)
-{
- GSList *li;
-
- if (config->priv->xservers == NULL) {
- return NULL;
- }
-
- if (id == NULL) {
- return config->priv->xservers->data;
- }
-
- for (li = config->priv->xservers; li != NULL; li = li->next) {
- GdmXserver *svr = li->data;
- if (svr->id != NULL && strcmp (svr->id, id) == 0) {
- return svr;
- }
- }
-
- return NULL;
-}
-
-/**
- * gdm_daemon_config_get_xservers
- *
- * Prepare a string to be returned for the GET_SERVER_LIST
- * sockets command.
- */
-gchar *
-gdm_daemon_config_get_xservers (GdmDaemonConfig *config)
-{
- GSList *li;
- char *retval = NULL;
-
- if (config->priv->xservers == NULL) {
- return NULL;
- }
-
- for (li = config->priv->xservers; li != NULL; li = li->next) {
- GdmXserver *svr = li->data;
- if (retval != NULL)
- retval = g_strconcat (retval, ";", svr->id, NULL);
- else
- retval = g_strdup (svr->id);
- }
-
- return retval;
-}
-
-/**
- * gdm_daemon_config_get_xserver_list
- *
- * Returns the list of xservers being used.
- */
-GSList *
-gdm_daemon_config_get_xserver_list (GdmDaemonConfig *config)
-{
- return config->priv->xservers;
-}
-
-
-static void
-gdm_daemon_config_load_xserver (GdmDaemonConfig *config,
- const char *key,
- const char *name)
-{
- GdmXserver *svr;
- int n;
- char *group;
- gboolean res;
- GdmConfigValue *value;
-
- /*
- * See if we already loaded a server with this id, skip if
- * one already exists.
- */
- if (gdm_daemon_config_find_xserver (config, name) != NULL) {
- return;
- }
-
- svr = g_new0 (GdmXserver, 1);
- svr->id = g_strdup (name);
-
- if (isdigit (*key)) {
- svr->number = atoi (key);
- }
-
- group = g_strdup_printf ("server-%s", name);
-
- /* string */
- res = gdm_config_get_value (config->priv->config, group, "name", &value);
- if (res) {
- svr->name = g_strdup (gdm_config_value_get_string (value));
- }
- res = gdm_config_get_value (config->priv->config, group, "command", &value);
- if (res) {
- svr->command = g_strdup (gdm_config_value_get_string (value));
- }
-
- g_debug ("Adding new server id=%s name=%s command=%s", name, svr->name, svr->command);
-
-
- /* bool */
- res = gdm_config_get_value (config->priv->config, group, "flexible", &value);
- if (res) {
- svr->flexible = gdm_config_value_get_bool (value);
- }
- res = gdm_config_get_value (config->priv->config, group, "choosable", &value);
- if (res) {
- svr->choosable = gdm_config_value_get_bool (value);
- }
- res = gdm_config_get_value (config->priv->config, group, "handled", &value);
- if (res) {
- svr->handled = gdm_config_value_get_bool (value);
- }
- res = gdm_config_get_value (config->priv->config, group, "chooser", &value);
- if (res) {
- svr->chooser = gdm_config_value_get_bool (value);
- }
-
- /* int */
- res = gdm_config_get_value (config->priv->config, group, "priority", &value);
- if (res) {
- svr->priority = gdm_config_value_get_int (value);
- }
-
- /* do some bounds checking */
- n = svr->priority;
- if (n < PRIO_MIN) {
- n = PRIO_MIN;
- } else if (n > PRIO_MAX) {
- n = PRIO_MAX;
- }
-
- if (n != svr->priority) {
- g_warning (_("%s: Priority out of bounds; changed to %d"),
- "gdm_config_parse", n);
- svr->priority = n;
- }
-
- if (svr->command == NULL || svr->command[0] == '\0') {
- g_warning (_("Empty server command; using standard command."));
- g_free (svr->command);
- svr->command = g_strdup (X_SERVER);
- }
-
- config->priv->xservers = g_slist_append (config->priv->xservers, svr);
-}
-
-static void
-gdm_daemon_config_unload_xservers (GdmDaemonConfig *config)
-{
- GSList *xli;
-
- /* Free list if already loaded */
- for (xli = config->priv->xservers; xli != NULL; xli = xli->next) {
- GdmXserver *xsvr = xli->data;
-
- g_free (xsvr->id);
- g_free (xsvr->name);
- g_free (xsvr->command);
- }
-
- if (config->priv->xservers != NULL) {
- g_slist_free (config->priv->xservers);
- config->priv->xservers = NULL;
- }
-}
-
-static void
-gdm_daemon_config_ensure_one_xserver (GdmDaemonConfig *config)
-{
- /* If no "Standard" server was created, then add it */
- if (config->priv->xservers == NULL || gdm_daemon_config_find_xserver (config, GDM_STANDARD) == NULL) {
- GdmXserver *svr = g_new0 (GdmXserver, 1);
-
- svr->id = g_strdup (GDM_STANDARD);
- svr->name = g_strdup ("Standard server");
- svr->command = g_strdup (X_SERVER);
- svr->flexible = TRUE;
- svr->choosable = TRUE;
- svr->handled = TRUE;
- svr->priority = 0;
-
- config->priv->xservers = g_slist_append (config->priv->xservers, svr);
- }
-}
-
-static void
-load_xservers_group (GdmDaemonConfig *config)
-{
- char **keys;
- gsize len;
- int i;
-
- keys = gdm_config_get_keys_for_group (config->priv->config, GDM_CONFIG_GROUP_SERVERS, &len, NULL);
-
- /* now construct entries for these groups */
- for (i = 0; i < len; i++) {
- GdmConfigEntry entry;
- GdmConfigValue *value;
- char *new_group;
- gboolean res;
- int j;
- const char *name;
-
- entry.group = GDM_CONFIG_GROUP_SERVERS;
- entry.key = keys[i];
- entry.type = GDM_CONFIG_VALUE_STRING;
- entry.default_value = NULL;
- entry.id = GDM_CONFIG_INVALID_ID;
-
- gdm_config_add_entry (config->priv->config, &entry);
- gdm_config_process_entry (config->priv->config, &entry, NULL);
-
- res = gdm_config_get_value (config->priv->config, entry.group, entry.key, &value);
- if (! res) {
- continue;
- }
-
- name = gdm_config_value_get_string (value);
- if (name == NULL || name[0] == '\0') {
- gdm_config_value_free (value);
- continue;
- }
-
- /* skip servers marked as inactive */
- if (g_ascii_strcasecmp (name, "inactive") == 0) {
- gdm_config_value_free (value);
- continue;
- }
-
- new_group = g_strdup_printf ("server-%s", name);
- for (j = 0; j < G_N_ELEMENTS (gdm_daemon_server_config_entries); j++) {
- GdmConfigEntry *srv_entry;
- if (gdm_daemon_server_config_entries[j].key == NULL) {
- continue;
- }
- srv_entry = gdm_config_entry_copy (&gdm_daemon_server_config_entries[j]);
- g_free (srv_entry->group);
- srv_entry->group = g_strdup (new_group);
- gdm_config_process_entry (config->priv->config, srv_entry, NULL);
- gdm_config_entry_free (srv_entry);
- }
- g_free (new_group);
-
- /* now we can add this server */
- gdm_daemon_config_load_xserver (config, entry.key, gdm_config_value_get_string (value));
-
- gdm_config_value_free (value);
- }
-}
-
-static void
-gdm_daemon_config_load_xservers (GdmDaemonConfig *config)
-{
- gdm_daemon_config_unload_xservers (config);
- load_xservers_group (config);
- gdm_daemon_config_ensure_one_xserver (config);
-}
-
-static void
-load_config (GdmDaemonConfig *config)
-{
- GError *error;
-
- config->priv->config = gdm_config_new ();
-
- gdm_config_set_notify_func (config->priv->config, notify_cb, NULL);
- gdm_config_set_validate_func (config->priv->config, validate_cb, NULL);
-
- gdm_config_add_static_entries (config->priv->config, gdm_daemon_config_entries);
-
- gdm_config_set_default_file (config->priv->config, config->priv->default_file);
- gdm_config_set_custom_file (config->priv->config, config->priv->custom_file);
-
- /* load the data files */
- error = NULL;
- gdm_config_load (config->priv->config, &error);
- if (error != NULL) {
- g_warning ("Unable to load configuration: %s", error->message);
- g_error_free (error);
- }
-
- /* populate the database with all specified entries */
- gdm_config_process_all (config->priv->config, &error);
-
- gdm_daemon_config_load_xservers (config);
-}
-
-void
-gdm_daemon_config_load (GdmDaemonConfig *config)
-{
- g_return_if_fail (GDM_IS_DAEMON_CONFIG (config));
-
- if (config->priv->config != NULL) {
- return;
- }
-
- load_config (config);
-}
-
-static void
-gdm_daemon_config_init (GdmDaemonConfig *config)
-{
-
- config->priv = GDM_DAEMON_CONFIG_GET_PRIVATE (config);
-
- config->priv->default_file = GDM_DEFAULTS_CONF;
- config->priv->custom_file = GDM_CUSTOM_CONF;
-}
-
-static void
-gdm_daemon_config_finalize (GObject *object)
-{
- GdmDaemonConfig *config;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GDM_IS_DAEMON_CONFIG (object));
-
- config = GDM_DAEMON_CONFIG (object);
-
- g_return_if_fail (config->priv != NULL);
-
- if (config->priv->xservers != NULL) {
- g_slist_free (config->priv->xservers);
- }
-
- G_OBJECT_CLASS (gdm_daemon_config_parent_class)->finalize (object);
-}
-
-GdmDaemonConfig *
-gdm_daemon_config_new (void)
-{
- if (daemon_config_object != NULL) {
- g_object_ref (daemon_config_object);
- } else {
- daemon_config_object = g_object_new (GDM_TYPE_DAEMON_CONFIG, NULL);
- g_object_add_weak_pointer (daemon_config_object,
- (gpointer *) &daemon_config_object);
- }
-
- return GDM_DAEMON_CONFIG (daemon_config_object);
-}
diff --git a/daemon/gdm-master-config.h b/daemon/gdm-master-config.h
deleted file mode 100644
index 54e1f8a7..00000000
--- a/daemon/gdm-master-config.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#ifndef __GDM_DAEMON_CONFIG_H
-#define __GDM_DAEMON_CONFIG_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define GDM_TYPE_DAEMON_CONFIG (gdm_daemon_config_get_type ())
-#define GDM_DAEMON_CONFIG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_DAEMON_CONFIG, GdmDaemonConfig))
-#define GDM_DAEMON_CONFIG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_DAEMON_CONFIG, GdmDaemonConfigClass))
-#define GDM_IS_DAEMON_CONFIG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_DAEMON_CONFIG))
-#define GDM_IS_DAEMON_CONFIG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_DAEMON_CONFIG))
-#define GDM_DAEMON_CONFIG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_DAEMON_CONFIG, GdmDaemonConfigClass))
-
-typedef struct GdmDaemonConfigPrivate GdmDaemonConfigPrivate;
-
-typedef struct
-{
- GObject parent;
- GdmDaemonConfigPrivate *priv;
-} GdmDaemonConfig;
-
-typedef struct
-{
- GObjectClass parent_class;
-} GdmDaemonConfigClass;
-
-typedef enum
-{
- GDM_DAEMON_CONFIG_ERROR_GENERAL
-} GdmDaemonConfigError;
-
-#define GDM_DAEMON_CONFIG_ERROR gdm_daemon_config_error_quark ()
-
-typedef struct _GdmXserver GdmXserver;
-
-struct _GdmXserver
-{
- char *id;
- char *name;
- char *command;
- gboolean flexible;
- gboolean choosable; /* not implemented yet */
- gboolean chooser; /* instead of greeter, run chooser */
- gboolean handled;
- int number;
- int priority;
-};
-
-GQuark gdm_daemon_config_error_quark (void);
-GType gdm_daemon_config_get_type (void);
-
-GdmDaemonConfig * gdm_daemon_config_new (void);
-void gdm_daemon_config_load (GdmDaemonConfig *config);
-gboolean gdm_daemon_config_get_bool_for_id (GdmDaemonConfig *config,
- int id,
- gboolean *value);
-gboolean gdm_daemon_config_get_int_for_id (GdmDaemonConfig *config,
- int id,
- int *value);
-gboolean gdm_daemon_config_get_string_for_id (GdmDaemonConfig *config,
- int id,
- char **value);
-
-GdmXserver * gdm_daemon_config_find_xserver (GdmDaemonConfig *config,
- const char *id);
-char * gdm_daemon_config_get_xservers (GdmDaemonConfig *config);
-GSList * gdm_daemon_config_get_xserver_list (GdmDaemonConfig *config);
-
-G_END_DECLS
-
-#endif /* __GDM_DAEMON_CONFIG_H */
diff --git a/daemon/gdm-xdmcp-manager.c b/daemon/gdm-xdmcp-manager.c
index 822db905..e0b40da6 100644
--- a/daemon/gdm-xdmcp-manager.c
+++ b/daemon/gdm-xdmcp-manager.c
@@ -57,8 +57,6 @@
#include "auth.h"
#include "choose.h"
-#include "gdm-master-config.h"
-#include "gdm-daemon-config-entries.h"
/*
* On Sun, we need to define allow_severity and deny_severity to link
diff --git a/daemon/main.c b/daemon/main.c
index 936cc93e..67c71ac0 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -45,8 +45,9 @@
#include "gdm-manager.h"
#include "gdm-log.h"
#include "gdm-signal-handler.h"
-#include "gdm-master-config.h"
-#include "gdm-daemon-config-entries.h"
+
+#include "gdm-settings.h"
+#include "gdm-settings-direct.h"
#include "misc.h"
@@ -61,7 +62,7 @@ static char **stored_argv = NULL;
static int stored_argc = 0;
static GList *stored_env = NULL;
static GdmManager *manager = NULL;
-static GdmDaemonConfig *daemon_config = NULL;
+static GdmSettings *settings = NULL;
static uid_t gdm_uid = -1;
static gid_t gdm_gid = -1;
@@ -315,17 +316,14 @@ check_logdir (void)
{
struct stat statbuf;
int r;
- char *log_path;
+ const char *log_path;
- log_path = NULL;
- gdm_daemon_config_get_string_for_id (daemon_config, GDM_ID_LOG_DIR, &log_path);
+ log_path = LOGDIR;
VE_IGNORE_EINTR (r = g_stat (log_path, &statbuf));
if (r < 0 || ! S_ISDIR (statbuf.st_mode)) {
gdm_fail (_("Logdir %s does not exist or isn't a directory."), log_path);
}
-
- g_free (log_path);
}
static void
@@ -350,10 +348,9 @@ gdm_daemon_check_permissions (uid_t uid,
gid_t gid)
{
struct stat statbuf;
- char *auth_path;
+ const char *auth_path;
- auth_path = NULL;
- gdm_daemon_config_get_string_for_id (daemon_config, GDM_ID_LOG_DIR, &auth_path);
+ auth_path = LOGDIR;
/* Enter paranoia mode */
check_servauthdir (auth_path, &statbuf);
@@ -382,8 +379,6 @@ gdm_daemon_check_permissions (uid_t uid,
statbuf.st_mode,
(S_IRWXU|S_IRWXG|S_ISVTX));
}
-
- g_free (auth_path);
}
static void
@@ -402,8 +397,10 @@ gdm_daemon_change_user (uid_t *uidp,
uid = 0;
gid = 0;
+#if 0
gdm_daemon_config_get_string_for_id (daemon_config, GDM_ID_USER, &username);
gdm_daemon_config_get_string_for_id (daemon_config, GDM_ID_GROUP, &groupname);
+#endif
/* Lookup user and groupid for the GDM user */
pwent = getpwnam (username);
@@ -524,9 +521,9 @@ main (int argc,
int ret;
int i;
gboolean res;
- gboolean debug;
GdmSignalHandler *signal_handler;
static char *config_file = NULL;
+ static gboolean debug = FALSE;
static gboolean no_daemon = FALSE;
static gboolean no_console = FALSE;
static gboolean do_timed_exit = FALSE;
@@ -608,8 +605,16 @@ main (int argc,
gdm_log_init ();
- daemon_config = gdm_daemon_config_new ();
- gdm_daemon_config_load (daemon_config);
+ settings = gdm_settings_new ();
+ if (settings == NULL) {
+ g_warning ("Unable to initialize settings");
+ goto out;
+ }
+
+ if (! gdm_settings_direct_init (settings, GDMCONFDIR "/gdm.schemas", "/")) {
+ g_warning ("Unable to initialize settings");
+ goto out;
+ }
gdm_log_set_debug (debug);
@@ -642,6 +647,9 @@ main (int argc,
goto out;
}
+ /* FIXME: pull from settings */
+ gdm_manager_set_xdmcp_enabled (manager, TRUE);
+
g_signal_connect (bus_proxy,
"destroy",
G_CALLBACK (bus_proxy_destroyed_cb),
@@ -673,8 +681,8 @@ main (int argc,
g_object_unref (manager);
}
- if (daemon_config != NULL) {
- g_object_unref (daemon_config);
+ if (settings != NULL) {
+ g_object_unref (settings);
}
if (signal_handler != NULL) {
diff --git a/data/Makefile.am b/data/Makefile.am
index 2693503c..8b26d41a 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -3,10 +3,48 @@ NULL =
dbusconfdir = $(DBUS_SYS_DIR)
dbusconf_DATA = gdm.conf
+@INTLTOOL_SCHEMAS_RULE@
+
+schemasdir = $(gdmconfdir)
+schemas_in_files = gdm.schemas.in
+schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
+
+gdm.schemas.in: $(srcdir)/gdm.schemas.in.in
+ sed -e 's,[@]GDMPREFETCHCMD[@],$(GDMPREFETCHCMD),g' \
+ -e 's,[@]GDM_CUSTOM_CONF[@],$(GDM_CUSTOM_CONF),g' \
+ -e 's,[@]GDM_USER_PATH[@],$(GDM_USER_PATH),g' \
+ -e 's,[@]HALT_COMMAND[@],$(HALT_COMMAND),g' \
+ -e 's,[@]REBOOT_COMMAND[@],$(REBOOT_COMMAND),g' \
+ -e 's,[@]SOUND_PROGRAM[@],$(SOUND_PROGRAM),g' \
+ -e 's,[@]SUSPEND_COMMAND[@],$(SUSPEND_COMMAND),g' \
+ -e 's,[@]XEVIE_OPTION[@],$(XEVIE_OPTION),g' \
+ -e 's,[@]ALWAYS_RESTART_SERVER[@],$(ALWAYS_RESTART_SERVER),g' \
+ -e 's,[@]X_CONFIG_OPTIONS[@],$(X_CONFIG_OPTIONS),g' \
+ -e 's,[@]X_SERVER[@],$(X_SERVER),g' \
+ -e 's,[@]X_XNEST_CMD[@],$(X_XNEST_CMD),g' \
+ -e 's,[@]X_XNEST_CONFIG_OPTIONS[@],$(X_XNEST_CONFIG_OPTIONS),g' \
+ -e 's,[@]X_XNEST_UNSCALED_FONTPATH[@],$(X_XNEST_UNSCALED_FONTPATH),g' \
+ -e 's,[@]GDM_RBAC_SYSCMD_KEYS[@],$(GDM_RBAC_SYSCMD_KEYS),g' \
+ -e 's,[@]authdir[@],$(authdir),g' \
+ -e 's,[@]datadir[@],$(datadir),g' \
+ -e 's,[@]dmconfdir[@],$(dmconfdir),g' \
+ -e 's,[@]gdmconfdir[@],$(gdmconfdir),g' \
+ -e 's,[@]libdir[@],$(libdir),g' \
+ -e 's,[@]libexecdir[@],$(libexecdir),g' \
+ -e 's,[@]gdmlocaledir[@],$(gdmlocaledir),g' \
+ -e 's,[@]logdir[@],$(logdir),g' \
+ -e 's,[@]pixmapdir[@],$(pixmapdir),g' \
+ -e 's,[@]sbindir[@],$(sbindir),g' \
+ <$(srcdir)/gdm.schemas.in.in >gdm.schemas.in
+
EXTRA_DIST = \
+ $(schemas_DATA) \
$(dbusconf_DATA) \
$(NULL)
+CLEANFILES = \
+ $(NULL)
+
MAINTAINERCLEANFILES = \
*~ \
Makefile.in
diff --git a/data/gdm.schemas.in.in b/data/gdm.schemas.in.in
new file mode 100644
index 00000000..1858b171
--- /dev/null
+++ b/data/gdm.schemas.in.in
@@ -0,0 +1,738 @@
+<gdmschemafile>
+ <schemalist>
+
+ <schema>
+ <key>daemon/AddGtkModules</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>daemon/AutomaticLoginEnable</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+
+ <schema>
+ <key>daemon/AutomaticLogin</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+ <schema>
+ <key>daemon/Chooser</key>
+ <signature>s</signature>
+ <default>@libexecdir@/gdmchooser</default>
+ </schema>
+
+ <schema>
+ <key>daemon/Greeter</key>
+ <signature>s</signature>
+ <default>@libexecdir@/gdmlogin</default>
+ </schema>
+ <schema>
+ <key>daemon/RemoteGreeter</key>
+ <signature>s</signature>
+ <default>@libexecdir@/gdmlogin</default>
+ </schema>
+ <schema>
+ <key>daemon/GtkModulesList</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+
+ <schema>
+ <key>daemon/User</key>
+ <signature>s</signature>
+ <default>gdm</default>
+ </schema>
+ <schema>
+ <key>daemon/Group</key>
+ <signature>s</signature>
+ <default>gdm</default>
+ </schema>
+
+ <schema>
+ <key>daemon/HaltCommand</key>
+ <signature>as</signature>
+ <default>@HALT_COMMAND@</default>
+ </schema>
+ <schema>
+ <key>daemon/RebootCommand</key>
+ <signature>as</signature>
+ <default>@REBOOT_COMMAND@</default>
+ </schema>
+ <schema>
+ <key>daemon/SuspendCommand</key>
+ <signature>as</signature>
+ <default>@SUSPEND_COMMAND@</default>
+ </schema>
+
+ <schema>
+ <key>daemon/DisplayInitDir</key>
+ <signature>s</signature>
+ <default>@gdmconfdir@/Init</default>
+ </schema>
+ <schema>
+ <key>daemon/KillInitClients</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>daemon/DefaultPath</key>
+ <signature>s</signature>
+ <default>@GDM_USER_PATH@</default>
+ </schema>
+ <schema>
+ <key>daemon/PostSessionScriptDir</key>
+ <signature>s</signature>
+ <default>@gdmconfdir@/PostSession/</default>
+ </schema>
+ <schema>
+ <key>daemon/PreSessionScriptDir</key>
+ <signature>s</signature>
+ <default>@gdmconfdir@/PreSession/</default>
+ </schema>
+ <schema>
+ <key>daemon/PostLoginScriptDir</key>
+ <signature>s</signature>
+ <default>@gdmconfdir@/PreSession/</default>
+ </schema>
+ <schema>
+ <key>daemon/FailsafeXServer</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+ <schema>
+ <key>daemon/XKeepsCrashing</key>
+ <signature>s</signature>
+ <default>@gdmconfdir@/XKeepsCrashing</default>
+ </schema>
+ <schema>
+ <key>daemon/RootPath</key>
+ <signature>s</signature>
+ <default>/sbin:/usr/sbin:@GDM_USER_PATH@</default>
+ </schema>
+ <schema>
+ <key>daemon/SessionDesktopDir</key>
+ <signature>s</signature>
+ <default>/etc/X11/sessions/:@dmconfdir@/Sessions/:@datadir@/gdm/BuiltInSessions/:@datadir@/xsessions/</default>
+ </schema>
+ <schema>
+ <key>daemon/BaseXsession</key>
+ <signature>s</signature>
+ <default>@gdmconfdir@/Xsession</default>
+ </schema>
+ <schema>
+ <key>daemon/DefaultSession</key>
+ <signature>s</signature>
+ <default>gnome.desktop</default>
+ </schema>
+
+ <schema>
+ <key>daemon/UserAuthDir</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+ <schema>
+ <key>daemon/UserAuthFBDir</key>
+ <signature>s</signature>
+ <default>/tmp</default>
+ </schema>
+ <schema>
+ <key>daemon/UserAuthFile</key>
+ <signature>s</signature>
+ <default>.Xauthority</default>
+ </schema>
+ <schema>
+ <key>daemon/ConsoleNotify</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+
+ <schema>
+ <key>daemon/DoubleLoginWarning</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>daemon/AlwaysLoginCurrentSession</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+
+ <schema>
+ <key>daemon/DisplayLastLogin</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+
+ <schema>
+ <key>daemon/TimedLoginEnable</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>daemon/TimedLogin</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+ <schema>
+ <key>daemon/TimedLoginDelay</key>
+ <signature>i</signature>
+ <default>30</default>
+ </schema>
+
+ <schema>
+ <key>daemon/FlexiReapDelayMinutes</key>
+ <signature>i</signature>
+ <default>5</default>
+ </schema>
+
+ <schema>
+ <key>daemon/StandardXServer</key>
+ <signature>s</signature>
+ <default>X_SERVER</default>
+ </schema>
+ <schema>
+ <key>daemon/FlexibleXServers</key>
+ <signature>i</signature>
+ <default>5</default>
+ </schema>
+ <schema>
+ <key>daemon/DynamicXServers</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>daemon/Xnest</key>
+ <signature>s</signature>
+ <default>@X_XNEST_CMD@, @X_XNEST_CONFIG_OPTIONS@</default>
+ </schema>
+ <schema>
+ <key>daemon/XnestUnscaledFontPath</key>
+ <signature>b</signature>
+ <default>@X_XNEST_UNSCALED_FONTPATH@</default>
+ </schema>
+
+ <schema>
+ <key>daemon/FirstVT</key>
+ <signature>i</signature>
+ <default>7</default>
+ </schema>
+ <schema>
+ <key>daemon/VTAllocation</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+
+ <schema>
+ <key>daemon/ConsoleCannotHandle</key>
+ <signature>s</signature>
+ <default>am,ar,az,bn,el,fa,gu,hi,ja,ko,ml,mr,pa,ta,zh</default>
+ </schema>
+
+ <schema>
+ <key>daemon/GdmXserverTimeout</key>
+ <signature>i</signature>
+ <default>10</default>
+ </schema>
+
+ <schema>
+ <key>daemon/SystemCommandsInMenu</key>
+ <signature>as</signature>
+ <default>HALT;REBOOT;SUSPEND;CUSTOM_CMD</default>
+ </schema>
+ <schema>
+ <key>daemon/AllowLogoutActions</key>
+ <signature>as</signature>
+ <default>HALT;REBOOT;SUSPEND;</default>
+ </schema>
+ <schema>
+ <key>daemon/RBACSystemCommandKeys</key>
+ <signature>as</signature>
+ <default>@GDM_RBAC_SYSCMD_KEYS@</default>
+ </schema>
+
+ <schema>
+ <key>daemon/SoundProgram</key>
+ <signature>s</signature>
+ <default>@SOUND_PROGRAM@</default>
+ </schema>
+
+ <schema>
+ <key>daemon/Configurator</key>
+ <signature>s</signature>
+ <default>@sbindir@/gdmsetup --disable-sound --disable-crash-dialog</default>
+ </schema>
+
+
+ <schema>
+ <key>security/AllowRoot</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>security/AllowRemoteRoot</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>security/AllowRemoteAutoLogin</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>security/UserMaxFile</key>
+ <signature>i</signature>
+ <default>65536</default>
+ </schema>
+ <schema>
+ <key>security/RelaxPermissions</key>
+ <signature>i</signature>
+ <default>0</default>
+ </schema>
+ <schema>
+ <key>security/CheckDirOwner</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>security/SupportAutomount</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>security/RetryDelay</key>
+ <signature>i</signature>
+ <default>1</default>
+ </schema>
+ <schema>
+ <key>security/DisallowTCP</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>security/PamStack</key>
+ <signature>s</signature>
+ <default>gdm</default>
+ </schema>
+
+ <schema>
+ <key>security/NeverPlaceCookiesOnNFS</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>security/PasswordRequired</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+
+ <schema>
+ <key>xdmcp/Enable</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>xdmcp/MaxPending</key>
+ <signature>i</signature>
+ <default>4</default>
+ </schema>
+ <schema>
+ <key>xdmcp/MaxSessions</key>
+ <signature>i</signature>
+ <default>16</default>
+ </schema>
+ <schema>
+ <key>xdmcp/MaxWait</key>
+ <signature>i</signature>
+ <default>15</default>
+ </schema>
+ <schema>
+ <key>xdmcp/DisplaysPerHost</key>
+ <signature>i</signature>
+ <default>2</default>
+ </schema>
+ <schema>
+ <key>xdmcp/Port</key>
+ <signature>i</signature>
+ <default>177</default>
+ </schema>
+ <schema>
+ <key>xdmcp/HonorIndirect</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>xdmcp/MaxPendingIndirect</key>
+ <signature>i</signature>
+ <default>4</default>
+ </schema>
+ <schema>
+ <key>xdmcp/MaxWaitIndirect</key>
+ <signature>i</signature>
+ <default>15</default>
+ </schema>
+ <schema>
+ <key>xdmcp/PingIntervalSeconds</key>
+ <signature>i</signature>
+ <default>15</default>
+ </schema>
+ <schema>
+ <key>xdmcp/Willing</key>
+ <signature>s</signature>
+ <default>@gdmconfdir@/Xwilling</default>
+ </schema>
+
+ <schema>
+ <key>xdmcp/EnableProxy</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>xdmcp/ProxyXServer</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+ <schema>
+ <key>xdmcp/ProxyReconnect</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+
+ <schema>
+ <key>gui/GtkTheme</key>
+ <signature>s</signature>
+ <default>Default</default>
+ </schema>
+ <schema>
+ <key>gui/GtkRC</key>
+ <signature>s</signature>
+ <default>@datadir@/themes/Default/gtk-2.0/gtkrc</default>
+ </schema>
+ <schema>
+ <key>gui/MaxIconWidth</key>
+ <signature>i</signature>
+ <default>128</default>
+ </schema>
+ <schema>
+ <key>gui/MaxIconHeight</key>
+ <signature>i</signature>
+ <default>128</default>
+ </schema>
+
+ <schema>
+ <key>gui/AllowGtkThemeChange</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>gui/GtkThemesToAllow</key>
+ <signature>s</signature>
+ <default>all</default>
+ </schema>
+
+ <schema>
+ <key>greeter/Browser</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>greeter/Include</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+ <schema>
+ <key>greeter/Exclude</key>
+ <signature>s</signature>
+ <default>bin,daemon,adm,lp,sync,shutdown,halt,mail,news,uucp,operator,nobody,gdm,postgres,pvm,rpm,nfsnobody,pcap</default>
+ </schema>
+ <schema>
+ <key>greeter/IncludeAll</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>greeter/MinimalUID</key>
+ <signature>i</signature>
+ <default>100</default>
+ </schema>
+ <schema>
+ <key>greeter/DefaultFace</key>
+ <signature>s</signature>
+ <default>@pixmapdir@/nobody.png</default>
+ </schema>
+ <schema>
+ <key>greeter/GlobalFaceDir</key>
+ <signature>s</signature>
+ <default>@datadir@/pixmaps/faces/</default>
+ </schema>
+ <schema>
+ <key>greeter/LocaleFile</key>
+ <signature>s</signature>
+ <default>@gdmlocaledir@/locale.alias</default>
+ </schema>
+ <schema>
+ <key>greeter/Logo</key>
+ <signature>s</signature>
+ <default>@pixmapdir@/gdm-foot-logo.png</default>
+ </schema>
+ <schema>
+ <key>greeter/ChooserButtonLogo</key>
+ <signature>s</signature>
+ <default>@pixmapdir@/gdm-foot-logo.png</default>
+ </schema>
+ <schema>
+ <key>greeter/Quiver</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>greeter/SystemMenu</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>greeter/ConfigAvailable</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>greeter/ChooserButton</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>greeter/TitleBar</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+
+ <schema>
+ <key>greeter/DefaultWelcome</key>
+ <signature>b</signature>
+ <default></default>
+ </schema>
+
+ <schema>
+ <key>greeter/XineramaScreen</key>
+ <signature>i</signature>
+ <default>0</default>
+ </schema>
+ <schema>
+ <key>greeter/BackgroundProgram</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+ <schema>
+ <key>greeter/RunBackgroundProgramAlways</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>greeter/BackgroundProgramInitialDelay</key>
+ <signature>i</signature>
+ <default>30</default>
+ </schema>
+ <schema>
+ <key>greeter/RestartBackgroundProgram</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>greeter/BackgroundProgramRestartDelay</key>
+ <signature>i</signature>
+ <default>30</default>
+ </schema>
+ <schema>
+ <key>greeter/BackgroundImage</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+ <schema>
+ <key>greeter/BackgroundColor</key>
+ <signature>s</signature>
+ <default>#76848F</default>
+ </schema>
+ <schema>
+ <key>greeter/BackgroundType</key>
+ <signature>i</signature>
+ <default>2</default>
+ </schema>
+ <schema>
+ <key>greeter/BackgroundScaleToFit</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>greeter/BackgroundRemoteOnlyColor</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>greeter/LockPosition</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>greeter/SetPosition</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>greeter/PositionX</key>
+ <signature>i</signature>
+ <default>0</default>
+ </schema>
+ <schema>
+ <key>greeter/PositionY</key>
+ <signature>i</signature>
+ <default>0</default>
+ </schema>
+ <schema>
+ <key>greeter/Use24Clock</key>
+ <signature>s</signature>
+ <default>auto</default>
+ </schema>
+ <schema>
+ <key>greeter/UseCirclesInEntry</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>greeter/UseInvisibleInEntry</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>greeter/GraphicalTheme</key>
+ <signature>s</signature>
+ <default>circles</default>
+ </schema>
+ <schema>
+ <key>greeter/GraphicalThemes</key>
+ <signature>s</signature>
+ <default>circles/:happygnome</default>
+ </schema>
+ <schema>
+ <key>greeter/GraphicalThemeRand</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>greeter/GraphicalThemeDir</key>
+ <signature>s</signature>
+ <default>@datadir@/gdm/themes/</default>
+ </schema>
+ <schema>
+ <key>greeter/GraphicalThemedColor</key>
+ <signature>s</signature>
+ <default>#76848F</default>
+ </schema>
+
+ <schema>
+ <key>greeter/InfoMsgFile</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+ <schema>
+ <key>greeter/InfoMsgFont</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+
+ <schema>
+ <key>greeter/PreFetchProgram</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+
+ <schema>
+ <key>greeter/SoundOnLogin</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>greeter/SoundOnLoginSuccess</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>greeter/SoundOnLoginFailure</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>greeter/SoundOnLoginFile</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+ <schema>
+ <key>greeter/SoundOnLoginSuccessFile</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+ <schema>
+ <key>greeter/SoundOnLoginFailureFile</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+
+ <schema>
+ <key>chooser/ScanTime</key>
+ <signature>i</signature>
+ <default>4</default>
+ </schema>
+ <schema>
+ <key>chooser/DefaultHostImg</key>
+ <signature>s</signature>
+ <default>@pixmapdir@/nohost.png</default>
+ </schema>
+ <schema>
+ <key>chooser/HostImageDir</key>
+ <signature>s</signature>
+ <default>@datadir@/hosts/</default>
+ </schema>
+ <schema>
+ <key>chooser/Hosts</key>
+ <signature>s</signature>
+ <default></default>
+ </schema>
+ <schema>
+ <key>chooser/Multicast</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
+ <schema>
+ <key>chooser/MulticastAddr</key>
+ <signature>s</signature>
+ <default>ff02::1</default>
+ </schema>
+ <schema>
+ <key>chooser/Broadcast</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>chooser/AllowAdd</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+
+ <schema>
+ <key>greeter/ShowGnomeFailsafeSession</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>greeter/ShowXtermFailsafeSession</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+ <schema>
+ <key>greeter/ShowLastSession</key>
+ <signature>b</signature>
+ <default>true</default>
+ </schema>
+
+ </schemalist>
+</gdmschemafile>