summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog32
-rw-r--r--Makefile.am22
-rwxr-xr-xautogen.sh7
-rw-r--r--configure.ac12
-rw-r--r--daemon/Makefile.am4
-rw-r--r--daemon/auth.c6
-rw-r--r--daemon/cookie.c2
-rw-r--r--daemon/display.c2
-rw-r--r--daemon/errorgui.c2
-rw-r--r--daemon/filecheck.c2
-rw-r--r--daemon/gdm-net.c2
-rw-r--r--daemon/gdm.c95
-rw-r--r--daemon/gdmconfig.c837
-rw-r--r--daemon/gdmconfig.h56
-rw-r--r--daemon/getvt.c2
-rw-r--r--daemon/misc.c2
-rw-r--r--daemon/server.c98
-rw-r--r--daemon/server.h6
-rw-r--r--daemon/slave.c66
-rw-r--r--daemon/verify-pam.c2
-rw-r--r--daemon/xdmcp.c2
-rw-r--r--gui/Makefile.am19
-rw-r--r--gui/gdmXnestchooser.c180
-rw-r--r--gui/gdmchooser.c317
-rw-r--r--gui/gdmcomm.c72
-rw-r--r--gui/gdmcommon.c21
-rw-r--r--gui/gdmconfig.c89
-rw-r--r--gui/gdmconfig.h39
-rw-r--r--gui/gdmdynamic.c5
-rw-r--r--gui/gdmflexiserver.c132
-rw-r--r--gui/gdmlanguages.c6
-rw-r--r--gui/gdmlogin.c161
-rw-r--r--gui/gdmphotosetup.c41
-rw-r--r--gui/gdmsession.c36
-rw-r--r--gui/gdmsetup.c1954
-rw-r--r--gui/gdmuser.c2
-rw-r--r--gui/gdmwm.c64
-rw-r--r--gui/greeter/Makefile.am6
-rw-r--r--gui/greeter/greeter.c194
-rw-r--r--gui/greeter/greeter_canvas_item.c3
-rw-r--r--gui/greeter/greeter_item.c2
-rw-r--r--gui/greeter/greeter_item_customlist.c2
-rw-r--r--gui/greeter/greeter_item_pam.c40
-rw-r--r--gui/greeter/greeter_item_timed.c2
-rw-r--r--gui/greeter/greeter_item_ulist.c17
-rw-r--r--gui/greeter/greeter_parser.c18
-rw-r--r--gui/greeter/greeter_session.c2
-rw-r--r--gui/greeter/greeter_system.c13
-rw-r--r--gui/greeter/themes/Makefile.am1
-rw-r--r--gui/misc.c2
50 files changed, 2536 insertions, 2163 deletions
diff --git a/ChangeLog b/ChangeLog
index 624a6c27..58208068 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,37 @@
2006-03-20 Brian Cameron <brian.cameron@sun.com>
+ * configure.ac, autogen.sh, gui/gdmlanguages.c, gui/gdmconfig.h
+ gui/gdmuser.c, gui/gdmwm.c, gui/gdmdynamic.c, gui/gdmlogin.c,
+ gui/gdmphotosetup.c, gui/gdmsession.c, gui/gdmXnestchooser.c,
+ gui/greeter/greeter.c, gui/gdmcommon.c, gui/gdmcomm.c,
+ gui/gdmflexiserver.c, gui/gdmsetup.c, gui/gdmchooser.c,
+ gui/misc.c, gui/gdmmconfig.c, gui/Makefile.am
+ gui/greeter/greeter_item_customlist.c,
+ gui/greeter/greeter_canvas_item.c gui/greeter/greeter_parser.c,
+ gui/greeter/greeter_item.c, gui/greeter/greeter_item_ulist.c,
+ gui/greeter/greeter_item_timed.c, gui/greeter/greeter_session.c,
+ gui/greeter/greeter_system.c, gui/greeter/greeter_item_pam.c,
+ gui/greeter/Makefile.am, gui/greeter/themes/Makefile.am,
+ common/gdm-common.[ch], common/gdm-common-config.[ch],
+ common/ve-signal.[ch], common/Makefile.am, daemon/errorgui.c,
+ daemon/gdmconfig.h, daemon/display.c, daemon/gdm.c, daemon/xdmcp.c,
+ daemon/filecheck.c, daemon/verify-pam.c, daemon/getvt.c,
+ daemon/auth.c, daemon/server.c, daemon/cookie.c, daemon/slave.c,
+ daemon/server.h, daemon/misc.c, daemon/gdm-net.c,
+ daemon/gdmconfig.c, daemon/Makefile.am: Phase 1 of removing
+ vicious-extensions and replacing with a rewrite. Changes include:
+ - Create a common directory to build libgdmcommon, used by the
+ daemon and the GUI's.
+ - Add a convenience layer over GKeyFile for dealing with compound
+ keys.
+ - Replace selected ve functions like ve_split
+ - Remove glade_helper
+ - Code improvements and leaks.
+ Fix by William Jon McCann <mccann@jhu.edu>. Refer to bug
+ #355425.
+
+2006-03-20 Brian Cameron <brian.cameron@sun.com>
+
* config/Xsession.in, daemon/gdm.c, daemon/slave.c,
gui/gdmlanguages.c: Normalize all LC_* settings to LANG and
starts input methods (IIIM->XIM) and starts up XIM if available.
diff --git a/Makefile.am b/Makefile.am
index 3f989c94..e70922f0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,12 +1,16 @@
-SUBDIRS = \
- po \
- config \
- pixmaps \
- vicious-extensions \
- daemon \
- gui \
- utils \
- docs
+NULL =
+
+SUBDIRS = \
+ po \
+ config \
+ pixmaps \
+ common \
+ daemon \
+ gui \
+ utils \
+ docs \
+ $(NULL)
+
# add these when help gets added back
# docs omf-install
diff --git a/autogen.sh b/autogen.sh
index 5de7d607..32046318 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -9,13 +9,6 @@ test -z "$srcdir" && srcdir=.
PKG_NAME="GDM"
-if test ! -d $srcdir/vicious-extensions; then
- echo -n "**Error**: vicious-extensions not found, please do a clean "
- echo "checkout or do:"
- echo "svn co http://svn.gnome.org/svn/vicious-extensions/trunk vicious-extensions"
- exit 1
-fi
-
(test -f $srcdir/configure.ac \
&& test -d $srcdir/daemon \
&& test -f $srcdir/daemon/gdm.h) || {
diff --git a/configure.ac b/configure.ac
index 26789cf0..797b8468 100644
--- a/configure.ac
+++ b/configure.ac
@@ -172,9 +172,9 @@ AC_CHECK_FUNCS(_NSGetEnviron)
GNOME_COMPILE_WARNINGS
CFLAGS="$CFLAGS $WARN_CFLAGS"
-PKG_CHECK_MODULES(VICIOUS, gtk+-2.0 >= $GTK_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED)
-AC_SUBST(VICIOUS_CFLAGS)
-AC_SUBST(VICIOUS_LIBS)
+PKG_CHECK_MODULES(COMMON, gtk+-2.0 >= $GTK_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED)
+AC_SUBST(COMMON_CFLAGS)
+AC_SUBST(COMMON_LIBS)
PKG_CHECK_MODULES(DAEMON, gtk+-2.0 >= $GTK_REQUIRED)
AC_SUBST(DAEMON_CFLAGS)
@@ -268,8 +268,8 @@ AC_CHECK_FUNC(inet_aton,,[
AC_CHECK_LIB(resolv,inet_aton, [
EXTRA_CHOOSER_LIBS="$EXTRA_CHOOSER_LIBS -lresolv"])])
-VICIOUS_GNOME_LIBS="libviciousui.a libviciousui-minimal.a "
-AC_SUBST(VICIOUS_GNOME_LIBS)
+COMMON_GNOME_LIBS="libgdmcommon-ui.a"
+AC_SUBST(COMMON_GNOME_LIBS)
dnl *****************************
dnl IPv6 specific checks
@@ -1169,7 +1169,7 @@ pixmaps/32x32/Makefile
pixmaps/48x48/Makefile
config/Makefile
po/Makefile.in
-vicious-extensions/Makefile
+common/Makefile
docs/Makefile
docs/de/Makefile
docs/es/Makefile
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index b638799c..8600ff29 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -5,7 +5,7 @@
INCLUDES = \
-I. \
-I.. \
- -I$(top_srcdir)/vicious-extensions \
+ -I$(top_srcdir)/common \
-DAUTHDIR=\"$(authdir)\" \
-DBINDIR=\"$(bindir)\" \
-DDATADIR=\"$(datadir)\" \
@@ -91,7 +91,7 @@ gdm_binary_LDADD = \
$(GLIB_LIBS) \
$(GOBJECT_LIBS) \
$(GDK_LIBS) \
- $(top_builddir)/vicious-extensions/libvicious.a \
+ $(top_builddir)/common/libgdmcommon.a \
$(X_LIBS) \
$(XINERAMA_LIBS) \
$(XDMCP_LIBS) \
diff --git a/daemon/auth.c b/daemon/auth.c
index 6c5ac202..ad89cb4c 100644
--- a/daemon/auth.c
+++ b/daemon/auth.c
@@ -24,11 +24,13 @@
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
-#include <netdb.h>
+#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
+#include <errno.h>
+
#include <X11/Xauth.h>
#include <glib/gi18n.h>
@@ -39,6 +41,8 @@
#include "auth.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
/* Ensure we know about FamilyInternetV6 even if what we're compiling
against doesn't */
#ifdef ENABLE_IPV6
diff --git a/daemon/cookie.c b/daemon/cookie.c
index 7da3bea8..375e028e 100644
--- a/daemon/cookie.c
+++ b/daemon/cookie.c
@@ -43,6 +43,8 @@
#include "cookie.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
#define MAXBUFFERSIZE 1024
struct rngs {
diff --git a/daemon/display.c b/daemon/display.c
index 5878f5d3..5d038110 100644
--- a/daemon/display.c
+++ b/daemon/display.c
@@ -41,6 +41,8 @@
#include "gdm-net.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
/* External vars */
extern gint xdmcp_sessions;
extern gint flexi_servers;
diff --git a/daemon/errorgui.c b/daemon/errorgui.c
index 118917d3..5c166d7f 100644
--- a/daemon/errorgui.c
+++ b/daemon/errorgui.c
@@ -43,6 +43,8 @@
#include "errorgui.h"
#include "slave.h"
+#include "gdm-common.h"
+
/* set in the main function */
extern char **stored_argv;
extern int stored_argc;
diff --git a/daemon/filecheck.c b/daemon/filecheck.c
index 526cbc9c..2871f9c2 100644
--- a/daemon/filecheck.c
+++ b/daemon/filecheck.c
@@ -26,6 +26,8 @@
#include "filecheck.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
/**
* gdm_file_check:
* @caller: String to be prepended to syslog error messages.
diff --git a/daemon/gdm-net.c b/daemon/gdm-net.c
index e686bc51..c78cea7a 100644
--- a/daemon/gdm-net.c
+++ b/daemon/gdm-net.c
@@ -37,6 +37,8 @@
#include "gdm-net.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
/*
* Kind of a weird setup, new connections whack old connections.
*
diff --git a/daemon/gdm.c b/daemon/gdm.c
index 982c2ad8..38ac5260 100644
--- a/daemon/gdm.c
+++ b/daemon/gdm.c
@@ -52,7 +52,7 @@
#include <glib-object.h>
/* Needed for signal handling */
-#include <vicious.h>
+#include <gdm-common.h>
#include "gdm.h"
#include "misc.h"
@@ -636,10 +636,15 @@ suspend_machine (void)
/* short sleep to give some processing time to master */
usleep (1000);
- argv = ve_split (suspend);
+ argv = NULL;
+ g_shell_parse_argv (suspend, NULL, &argv, NULL);
+
if (argv != NULL && argv[0] != NULL)
VE_IGNORE_EINTR (execv (argv[0], argv));
+
/* FIXME: what about fail */
+ g_strfreev (argv);
+
_exit (1);
}
}
@@ -678,6 +683,7 @@ static void
halt_machine (void)
{
char **argv;
+ const char *s;
gdm_info (_("Master halting..."));
@@ -688,18 +694,26 @@ halt_machine (void)
change_to_first_and_clear (FALSE);
#endif /* __linux */
- argv = ve_split (gdm_get_value_string (GDM_KEY_HALT));
+ argv = NULL;
+ s = gdm_get_value_string (GDM_KEY_HALT);
+ if (s != NULL) {
+ g_shell_parse_argv (s, NULL, &argv, NULL);
+ }
+
if (argv != NULL && argv[0] != NULL)
VE_IGNORE_EINTR (execv (argv[0], argv));
gdm_error (_("%s: Halt failed: %s"),
"gdm_child_action", strerror (errno));
+
+ g_strfreev (argv);
}
static void
restart_machine (void)
{
char **argv;
+ const char *s;
gdm_info (_("Restarting computer..."));
@@ -710,12 +724,19 @@ restart_machine (void)
change_to_first_and_clear (TRUE);
#endif /* __linux */
- argv = ve_split (gdm_get_value_string (GDM_KEY_REBOOT));
+ argv = NULL;
+ s = gdm_get_value_string (GDM_KEY_REBOOT);
+ if (s != NULL) {
+ g_shell_parse_argv (s, NULL, &argv, NULL);
+ }
+
if (argv != NULL && argv[0] != NULL)
VE_IGNORE_EINTR (execv (argv[0], argv));
gdm_error (_("%s: Restart failed: %s"),
"gdm_child_action", strerror (errno));
+
+ g_strfreev (argv);
}
static void
@@ -741,28 +762,35 @@ custom_cmd (long cmd_id)
static void
custom_cmd_restart (long cmd_id)
-{
+{
gchar * key_string;
char **argv;
+ const char *s;
gdm_info (_("Executing custom command %ld with restart option..."), cmd_id);
gdm_final_cleanup ();
VE_IGNORE_EINTR (g_chdir ("/"));
-
+
#ifdef __linux__
change_to_first_and_clear (TRUE);
#endif /* __linux */
-
+
key_string = g_strdup_printf (_("%s%ld="), GDM_KEY_CUSTOM_CMD_TEMPLATE, cmd_id);
- argv = ve_split (gdm_get_value_string (key_string));
- g_free(key_string);
+
+ argv = NULL;
+ s = gdm_get_value_string (key_string);
+ g_free (key_string);
+ if (s != NULL) {
+ g_shell_parse_argv (s, NULL, &argv, NULL);
+ }
+
if (argv != NULL && argv[0] != NULL)
VE_IGNORE_EINTR (execv (argv[0], argv));
-
- g_strfreev (argv);
-
- gdm_error (_("%s: Execution of custom command failed: %s"),
+
+ g_strfreev (argv);
+
+ gdm_error (_("%s: Execution of custom command failed: %s"),
"gdm_child_action", strerror (errno));
}
@@ -774,7 +802,7 @@ custom_cmd_no_restart (long cmd_id)
gdm_info (_("Executing custom command %ld with no restart option ..."), cmd_id);
pid = fork ();
-
+
if (pid < 0) {
/*failed fork*/
gdm_error (_("custom_cmd: forking process for custom command %ld failed"), cmd_id);
@@ -783,18 +811,26 @@ custom_cmd_no_restart (long cmd_id)
else if (pid == 0) {
/* child */
char **argv;
- gchar * key_string = g_strdup_printf (_("%s%ld="), GDM_KEY_CUSTOM_CMD_TEMPLATE, cmd_id);
- argv = ve_split (gdm_get_value_string (key_string));
- g_free(key_string);
+ const char *s;
+ gchar *key_string;
+
+ key_string = g_strdup_printf (_("%s%ld="), GDM_KEY_CUSTOM_CMD_TEMPLATE, cmd_id);
+
+ argv = NULL;
+ s = gdm_get_value_string (key_string);
+ g_free (key_string);
+ if (s != NULL) {
+ g_shell_parse_argv (s, NULL, &argv, NULL);
+ }
+
if (argv != NULL && argv[0] != NULL)
VE_IGNORE_EINTR (execv (argv[0], argv));
-
- g_strfreev (argv);
-
+
+ g_strfreev (argv);
+
gdm_error (_("%s: Execution of custom command failed: %s"),
"gdm_child_action", strerror (errno));
-
- _exit (0);
+ _exit (0);
}
else {
/* parent */
@@ -804,10 +840,10 @@ custom_cmd_no_restart (long cmd_id)
if G_LIKELY (WIFEXITED (exitstatus)){
status = WEXITSTATUS (exitstatus);
gdm_debug (_("custom_cmd: child %d returned %d"), p_stat, status);
- }
+ }
return;
}
- }
+ }
}
static gboolean
@@ -1865,9 +1901,14 @@ write_x_servers (GdmDisplay *d)
if (SERVER_IS_LOCAL (d)) {
char **argv;
char *command;
- argv = gdm_server_resolve_command_line
- (d, FALSE /* resolve_flags */,
- NULL /* vtarg */);
+ int argc;
+ argc = 0;
+ argv = NULL;
+ gdm_server_resolve_command_line (d,
+ FALSE, /* resolve_flags */
+ NULL, /* vtarg */
+ &argc,
+ &argv);
command = g_strjoinv (" ", argv);
g_strfreev (argv);
VE_IGNORE_EINTR (fprintf (fp, "%s local %s\n", d->name, command));
diff --git a/daemon/gdmconfig.c b/daemon/gdmconfig.c
index d81abf1b..557c90c1 100644
--- a/daemon/gdmconfig.c
+++ b/daemon/gdmconfig.c
@@ -1,4 +1,6 @@
-/* GDM - The GNOME Display Manager
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 3 -*-
+ *
+ * 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>
*
@@ -17,15 +19,15 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/*
- * gdmconfig.c isolates most logic that interacts with vicious-extensions
+/*
+ * gdmconfig.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
+ *
+ * When adding a new configuration option, simply add the new option to
* gdm.h and to the val_hash and type_hash hashes in the gdm_config_init
* function. Any validation for the configuration option should be
* placed in the _gdm_set_value_string, _gdm_set_value_int, or
@@ -48,7 +50,7 @@
#include <glib.h>
#include <glib/gi18n.h>
-#include "vicious.h"
+#include "gdm-common.h"
#include "gdm.h"
#include "gdmconfig.h"
@@ -277,7 +279,8 @@ gdm_config_add_hash (gchar *key, gpointer value, GdmConfigType *type)
* value.
*/
static gpointer
-gdm_config_hash_lookup (GHashTable *hash, gchar *key)
+gdm_config_hash_lookup (GHashTable *hash,
+ const gchar *key)
{
gchar *p;
gpointer *ret;
@@ -573,33 +576,39 @@ gdm_config_init (void)
/**
* gdm_get_config:
*
- * Get config file.
+ * Get config file.
*/
-static VeConfig *
-gdm_get_default_config (struct stat *statbuf)
+static GKeyFile *
+gdm_get_default_config (void)
{
- int r;
+ GKeyFile *config;
+ GError *error;
+ struct stat statbuf;
+ int r;
/* Not NULL if config_file was set by command-line option. */
- if (config_file != NULL) {
- VE_IGNORE_EINTR (r = g_stat (config_file, statbuf));
- if (r < 0) {
- gdm_error (_("%s: No GDM configuration file: %s. Using defaults."),
- "gdm_config_parse", config_file);
- return NULL;
- }
- } else {
- VE_IGNORE_EINTR (r = g_stat (GDM_DEFAULTS_CONF, statbuf));
- if (r < 0) {
- gdm_error (_("%s: No GDM configuration file: %s. Using defaults."),
- "gdm_config_parse", GDM_DEFAULTS_CONF);
- return NULL;
- } else {
- config_file = GDM_DEFAULTS_CONF;
- }
+ if (config_file == NULL) {
+ config_file = GDM_DEFAULTS_CONF;
}
- return ve_config_new (config_file);
+ error = NULL;
+ config = gdm_common_config_load (config_file, &error);
+
+ if (config == NULL) {
+ gdm_error (_("%s: Unable to load configuration from %s: %s"),
+ "gdm_config_parse",
+ config_file,
+ error->message);
+ g_error_free (error);
+ return NULL;
+ }
+
+ VE_IGNORE_EINTR (r = g_stat (config_file, &statbuf));
+ if (r >= 0) {
+ config_file_mtime = statbuf.st_mtime;
+ }
+
+ return config;
}
/**
@@ -608,17 +617,20 @@ gdm_get_default_config (struct stat *statbuf)
* Get the custom config file where gdmsetup saves its changes and
* where users are encouraged to make modifications.
*/
-static VeConfig *
-gdm_get_custom_config (struct stat *statbuf)
+static GKeyFile *
+gdm_get_custom_config (void)
{
- int r;
+ GKeyFile *config;
+ GError *error;
+ struct stat statbuf;
+ int r;
/*
* First check to see if the old configuration file name is on
* the system. If so, use that as the custom configuration
* file. "make install" will move this file aside, and
* distros probably can also manage moving this file on
- * upgrade.
+ * upgrade.
*
* In case this file is on the system, then use it as
* the custom configuration file until the user moves it
@@ -627,19 +639,28 @@ gdm_get_custom_config (struct stat *statbuf)
* file has all the keys in it (except new ones). But
* that would be what the user wants.
*/
- VE_IGNORE_EINTR (r = g_stat (GDM_OLD_CONF, statbuf));
- if (r >= 0) {
+
+ error = NULL;
+ config = gdm_common_config_load (GDM_OLD_CONF, &error);
+ if (config != NULL) {
custom_config_file = g_strdup (GDM_OLD_CONF);
- return ve_config_new (custom_config_file);
+ } else {
+ g_error_free (error);
+ error = NULL;
+ config = gdm_common_config_load (GDM_CUSTOM_CONF, &error);
+ if (config != NULL) {
+ custom_config_file = g_strdup (GDM_CUSTOM_CONF);
+ } else {
+ g_error_free (error);
+ }
}
- VE_IGNORE_EINTR (r = g_stat (GDM_CUSTOM_CONF, statbuf));
+ VE_IGNORE_EINTR (r = g_stat (custom_config_file, &statbuf));
if (r >= 0) {
- custom_config_file = g_strdup (GDM_CUSTOM_CONF);
- return ve_config_new (custom_config_file);
- } else {
- return NULL;
+ custom_config_file_mtime = statbuf.st_mtime;
}
+
+ return config;
}
/**
@@ -673,7 +694,7 @@ gdm_get_custom_config_file (void)
* first be loaded, say, by calling gdm_config_parse.
*/
gint
-gdm_get_value_int (char *key)
+gdm_get_value_int (const char *key)
{
GdmConfigType *type = gdm_config_hash_lookup (type_hash, key);
gpointer val = gdm_config_hash_lookup (val_hash, key);
@@ -697,7 +718,7 @@ gdm_get_value_int (char *key)
* first be loaded, say, by calling gdm_config_parse.
*/
gchar *
-gdm_get_value_string (char *key)
+gdm_get_value_string (const char *key)
{
GdmConfigType *type;
gpointer val;
@@ -733,7 +754,7 @@ gdm_get_value_string (char *key)
* first be loaded, say, by calling gdm_config_parse.
*/
gboolean
-gdm_get_value_bool (char *key)
+gdm_get_value_bool (const char *key)
{
GdmConfigType *type = gdm_config_hash_lookup (type_hash, key);
gpointer val = gdm_config_hash_lookup (val_hash, key);
@@ -763,7 +784,8 @@ gdm_get_value_bool (char *key)
* Gets the per-display version of the configuration, or the default
* value if none exists.
*/
-gint gdm_get_value_int_per_display (gchar *display, gchar *key)
+gint gdm_get_value_int_per_display (const gchar *display,
+ const gchar *key)
{
gchar *perdispval;
@@ -784,7 +806,8 @@ gint gdm_get_value_int_per_display (gchar *display, gchar *key)
* Gets the per-display version of the configuration, or the default
* value if none exists.
*/
-gboolean gdm_get_value_bool_per_display (gchar *display, gchar *key)
+gboolean gdm_get_value_bool_per_display (const gchar *display,
+ const gchar *key)
{
gchar *perdispval;
@@ -813,7 +836,8 @@ gboolean gdm_get_value_bool_per_display (gchar *display, gchar *key)
* value if none exists. Note that this value needs to be freed,
* unlike the non-per-display version.
*/
-gchar * gdm_get_value_string_per_display (const gchar *display, gchar *key)
+gchar * gdm_get_value_string_per_display (const gchar *display,
+ const gchar *key)
{
gchar *perdispval;
@@ -839,10 +863,13 @@ gchar * gdm_get_value_string_per_display (const gchar *display, gchar *key)
* sure they are added to the if-test below.
*/
void
-gdm_config_key_to_string_per_display (const gchar *display, gchar *key, gchar **retval)
+gdm_config_key_to_string_per_display (const gchar *display,
+ const gchar *key,
+ gchar **retval)
{
gchar *file;
gchar **splitstr = g_strsplit (key, "/", 2);
+
*retval = NULL;
if (display == NULL)
@@ -869,50 +896,57 @@ gdm_config_key_to_string_per_display (const gchar *display, gchar *key, gchar **
* to parse it properly if it is a bool or int.
*/
void
-gdm_config_key_to_string (gchar *file, gchar *key, gchar **retval)
+gdm_config_key_to_string (const gchar *file,
+ const gchar *keystring,
+ gchar **retval)
{
- VeConfig *cfg = ve_config_get (file);
- GdmConfigType *type = gdm_config_hash_lookup (type_hash, key);
- gchar **splitstr = g_strsplit (key, "/", 2);
- GList *list;
- *retval = NULL;
+ GKeyFile *config;
+ GdmConfigType *type;
- /* Should not fail, all keys should have a category. */
- if (splitstr[0] == NULL)
- return;
+ if (retval != NULL) {
+ *retval = NULL;
+ }
+ config = gdm_common_config_load (file, NULL);
/* If file doesn't exist, then just return */
- if (cfg == NULL)
+ if (config == NULL)
return;
- list = ve_config_get_keys (cfg, splitstr[0]);
- while (list != NULL) {
- gchar *display_key = (char *)list->data;
- gchar *display_fullkey = g_strdup_printf ("%s/%s", splitstr[0], display_key);
-
- if (is_key (key, display_fullkey)) {
- gdm_debug ("Returning value for key <%s>\n", key);
- if (*type == CONFIG_BOOL) {
- gboolean value = ve_config_get_bool (cfg, key);
- if (value)
- *retval = g_strdup ("true");
- else
- *retval = g_strdup ("false");
- return;
- } else if (*type == CONFIG_INT) {
- gint value = ve_config_get_int (cfg, key);
- *retval = g_strdup_printf ("%d", value);
- return;
- } else if (*type == CONFIG_STRING) {
- gchar *value = ve_config_get_string (cfg, key);
- if (value != NULL)
- *retval = g_strdup (value);
- return;
- }
+ type = gdm_config_hash_lookup (type_hash, keystring);
+
+ gdm_debug ("Returning value for key <%s>\n", keystring);
+
+ switch (*type) {
+ case CONFIG_BOOL:
+ {
+ gboolean value;
+ gdm_common_config_get_boolean (config, keystring, &value, NULL);
+ if (value)
+ *retval = g_strdup ("true");
+ else
+ *retval = g_strdup ("false");
+ }
+ break;
+ case CONFIG_INT:
+ {
+ gint value;
+ gdm_common_config_get_int (config, keystring, &value, NULL);
+ *retval = g_strdup_printf ("%d", value);
}
- g_free (display_fullkey);
- list = list->next;
+ break;
+ case CONFIG_STRING:
+ {
+ gchar *value;
+ gdm_common_config_get_string (config, keystring, &value, NULL);
+ *retval = value;
+ }
+ break;
+ default:
+ break;
}
+
+ g_key_file_free (config);
+
return;
}
@@ -921,9 +955,11 @@ gdm_config_key_to_string (gchar *file, gchar *key, gchar **retval)
*
* Returns a configuration option as a string. Used by GDM's
* GET_CONFIG socket command.
- */
+ */
void
-gdm_config_to_string (gchar *key, gchar *display, gchar **retval)
+gdm_config_to_string (const gchar *key,
+ const gchar *display,
+ gchar **retval)
{
GdmConfigType *type = gdm_config_hash_lookup (type_hash, key);
*retval = NULL;
@@ -1053,12 +1089,14 @@ notify_displays_string (const gchar *key, const gchar *val)
* functions directly.
*/
static void
-_gdm_set_value_string (gchar *key, gchar *value_in, gboolean doing_update)
+_gdm_set_value_string (const gchar *key,
+ const gchar *value_in,
+ gboolean doing_update)
{
gchar **setting = gdm_config_hash_lookup (val_hash, key);
gchar *setting_copy = NULL;
gchar *temp_string;
- gchar *value;
+ const gchar *value;
gint i;
if (! ve_string_empty (value_in))
@@ -1082,7 +1120,7 @@ _gdm_set_value_string (gchar *key, gchar *value_in, gboolean doing_update)
temp_string = gdm_read_default ("PATH=");
if (temp_string != NULL)
- *setting = temp_string;
+ *setting = temp_string;
else if (value != NULL)
*setting = g_strdup (value);
else
@@ -1093,7 +1131,7 @@ _gdm_set_value_string (gchar *key, gchar *value_in, gboolean doing_update)
temp_string = gdm_read_default ("SUPATH=");
if (temp_string != NULL)
- *setting = temp_string;
+ *setting = temp_string;
else if (value != NULL)
*setting = g_strdup (value);
else
@@ -1167,7 +1205,7 @@ _gdm_set_value_string (gchar *key, gchar *value_in, gboolean doing_update)
*setting = g_strdup ("circles");
else
*setting = g_strdup (value);
-
+
/*
* Default Welcome Message. Don't translate here since the
* GDM user may not be running with the same language as the user.
@@ -1192,16 +1230,15 @@ _gdm_set_value_string (gchar *key, gchar *value_in, gboolean doing_update)
/* All others */
} else {
- for (i = 0; i < GDM_CUSTOM_COMMAND_MAX; i++) {
+ for (i = 0; i < GDM_CUSTOM_COMMAND_MAX; i++) {
gchar * key_string = NULL;
- /* For each possible custom command */
+ /* For each possible custom command */
key_string = g_strdup_printf (_("%s%d="), GDM_KEY_CUSTOM_CMD_TEMPLATE, i);
- if(is_key (key, key_string)) {
+ if (is_key (key, key_string)) {
if (value != NULL)
*setting = ve_get_first_working_command (value, FALSE);
else
*setting = NULL;
-
break;
}
g_free(key_string);
@@ -1265,13 +1302,16 @@ _gdm_set_value_string (gchar *key, gchar *value_in, gboolean doing_update)
}
void
-gdm_set_value_string (gchar *key, gchar *value_in)
+gdm_set_value_string (const gchar *key,
+ const gchar *value_in)
{
_gdm_set_value_string (key, value_in, TRUE);
}
static void
-_gdm_set_value_bool (gchar *key, gboolean value, gboolean doing_update)
+_gdm_set_value_bool (const gchar *key,
+ gboolean value,
+ gboolean doing_update)
{
gboolean *setting = gdm_config_hash_lookup (val_hash, key);
gboolean setting_copy = *setting;
@@ -1349,13 +1389,16 @@ _gdm_set_value_bool (gchar *key, gboolean value, gboolean doing_update)
}
void
-gdm_set_value_bool (gchar *key, gboolean value)
+gdm_set_value_bool (const gchar *key,
+ gboolean value)
{
_gdm_set_value_bool (key, value, TRUE);
}
static void
-_gdm_set_value_int (gchar *key, gint value, gboolean doing_update)
+_gdm_set_value_int (const gchar *key,
+ gint value,
+ gboolean doing_update)
{
gint *setting = gdm_config_hash_lookup (val_hash, key);
gint setting_copy = *setting;
@@ -1405,11 +1448,14 @@ _gdm_set_value_int (gchar *key, gint value, gboolean doing_update)
}
void
-gdm_set_value_int (gchar *key, gint value)
+gdm_set_value_int (const gchar *key,
+ gint value)
{
_gdm_set_value_int (key, value, TRUE);
}
+
+
/**
* gdm_set_value
*
@@ -1419,39 +1465,49 @@ gdm_set_value_int (gchar *key, gint value)
* (greeter/Welcome[cs] for example).
*/
static gboolean
-gdm_set_value (VeConfig *cfg, GdmConfigType *type, gchar *key, gboolean doing_update)
+gdm_set_value (GKeyFile *config,
+ GdmConfigType *type,
+ const gchar *fullkey,
+ gboolean doing_update)
{
- gchar * realkey = gdm_config_hash_lookup (realkey_hash, key);
+ gchar * realkey;
gchar *value;
+ realkey = gdm_config_hash_lookup (realkey_hash, fullkey);
+
if (realkey == NULL) {
return FALSE;
}
if (*type == CONFIG_BOOL) {
- gboolean value = ve_config_get_bool (cfg, realkey);
- _gdm_set_value_bool (key, value, doing_update);
- return TRUE;
+ gboolean value;
+ gdm_common_config_get_boolean (config, realkey, &value, NULL);
+ _gdm_set_value_bool (fullkey, value, doing_update);
+ return TRUE;
} else if (*type == CONFIG_INT) {
- gint value = ve_config_get_int (cfg, realkey);
- _gdm_set_value_int (key, value, doing_update);
- return TRUE;
+ gint value;
+ gdm_common_config_get_int (config, realkey, &value, NULL);
+ _gdm_set_value_int (fullkey, value, doing_update);
+ return TRUE;
} else if (*type == CONFIG_STRING) {
- /* Process translated strings */
- if (is_key (key, GDM_KEY_WELCOME) ||
- is_key (key, GDM_KEY_REMOTE_WELCOME)) {
+ /* Process translated strings */
+ if (is_key (fullkey, GDM_KEY_WELCOME) ||
+ is_key (fullkey, GDM_KEY_REMOTE_WELCOME)) {
+ gchar **keys;
+ gsize length;
+ gchar *prefix, *basekey;
+ int i;
- GList *list = ve_config_get_keys (cfg, "greeter");
- gchar *prefix, *basekey;
+ keys = g_key_file_get_keys (config, "greeter", &length, NULL);
- if (is_key (key, GDM_KEY_WELCOME)) {
- basekey = g_strdup ("Welcome");
- prefix = g_strdup ("Welcome[");
- } else {
- basekey = g_strdup ("RemoteWelcome");
- prefix = g_strdup ("RemoteWelcome[");
- }
+ if (is_key (fullkey, GDM_KEY_WELCOME)) {
+ basekey = g_strdup ("Welcome");
+ prefix = g_strdup ("Welcome[");
+ } else {
+ basekey = g_strdup ("RemoteWelcome");
+ prefix = g_strdup ("RemoteWelcome[");
+ }
/*
* Loop over translated keys and put all values into the hash
@@ -1460,18 +1516,22 @@ gdm_set_value (VeConfig *cfg, GdmConfigType *type, gchar *key, gboolean doing_up
* config, GDM won't forget about it until restart. I don't think
* this will happen, or be a real problem if it does.
*/
- while (list != NULL) {
- if (g_str_has_prefix ((char *)list->data, prefix) &&
- g_str_has_suffix ((char *)list->data, "]")) {
- gchar *transkey, *transvalue;
+ for (i = 0; i < length; i++) {
+ gchar *key;
+
+ key = keys[i];
+
+ if (g_str_has_prefix (key, prefix) &&
+ g_str_has_suffix (key, "]")) {
+ gchar *transkey, *transvalue;
- if (translated_hash == NULL)
- translated_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ if (translated_hash == NULL)
+ translated_hash = g_hash_table_new (g_str_hash, g_str_equal);
- transkey = g_strdup_printf ("greeter/%s", (char *)list->data);
- transvalue = ve_config_get_string (cfg, transkey);
+ transkey = g_strdup_printf ("greeter/%s", key);
+ gdm_common_config_get_string (config, transkey, &transvalue, NULL);
- g_hash_table_remove (translated_hash, transkey);
+ g_hash_table_remove (translated_hash, transkey);
/*
* Store translated values in a separate hash. Note that we load
@@ -1479,20 +1539,21 @@ gdm_set_value (VeConfig *cfg, GdmConfigType *type, gchar *key, gboolean doing_up
* we add these to the same hash, we would end up loading these
* values in again a second time.
*/
- g_hash_table_insert (translated_hash, transkey, transvalue);
- }
- list = list->next;
- }
- g_free (basekey);
- g_free (prefix);
- }
+ g_hash_table_insert (translated_hash, transkey, transvalue);
+ }
+ }
+
+ g_strfreev (keys);
+ g_free (basekey);
+ g_free (prefix);
+ }
- /* Handle non-translated strings as normal */
- value = ve_config_get_string (cfg, realkey);
- _gdm_set_value_string (key, value, doing_update);
- return TRUE;
+ /* Handle non-translated strings as normal */
+ gdm_common_config_get_string (config, realkey, &value, NULL);
+ _gdm_set_value_string (fullkey, value, doing_update);
+ return TRUE;
}
-
+
return FALSE;
}
@@ -1562,72 +1623,77 @@ gdm_get_xservers (void)
* Load [server-foo] sections from a configuration file.
*/
static void
-gdm_load_xservers (VeConfig *cfg)
+gdm_load_xservers (GKeyFile *config)
{
- GList *list, *li;
+ int i;
+ gsize length;
+ char **groups;
/* Find server definitions */
- list = ve_config_get_sections (cfg);
- for (li = list; li != NULL; li = li->next) {
- const gchar *sec = li->data;
+ groups = g_key_file_get_groups (config, &length);
- if (strncmp (sec, "server-", strlen ("server-")) == 0) {
- gchar *id;
+ for (i = 0; i < length; i++) {
+ gchar *id;
+ const char *sec = groups [i];
- id = g_strdup (sec + strlen ("server-"));
+ if (strncmp (sec, "server-", strlen ("server-")) != 0) {
+ continue;
+ }
- /*
- * See if we already loaded a server with this id, skip if
- * one already exists.
- */
- if (gdm_find_xserver (id) != NULL) {
- g_free (id);
- } else {
- GdmXserver *svr = g_new0 (GdmXserver, 1);
- gchar buf[256];
- int n;
-
- svr->id = id;
-
- g_snprintf (buf, sizeof (buf), "%s/" GDM_KEY_SERVER_NAME, sec);
- svr->name = ve_config_get_string (cfg, buf);
- g_snprintf (buf, sizeof (buf), "%s/" GDM_KEY_SERVER_COMMAND, sec);
- svr->command = ve_config_get_string (cfg, buf);
- g_snprintf (buf, sizeof (buf), "%s/" GDM_KEY_SERVER_FLEXIBLE, sec);
- svr->flexible = ve_config_get_bool (cfg, buf);
- g_snprintf (buf, sizeof (buf), "%s/" GDM_KEY_SERVER_CHOOSABLE, sec);
- svr->choosable = ve_config_get_bool (cfg, buf);
- g_snprintf (buf, sizeof (buf), "%s/" GDM_KEY_SERVER_HANDLED, sec);
- svr->handled = ve_config_get_bool (cfg, buf);
- g_snprintf (buf, sizeof (buf), "%s/" GDM_KEY_SERVER_CHOOSER, sec);
- svr->chooser = ve_config_get_bool (cfg, buf);
- g_snprintf (buf, sizeof (buf), "%s/" GDM_KEY_SERVER_PRIORITY, sec);
- svr->priority = ve_config_get_int (cfg, buf);
-
- /* 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 (GdmStandardXserver);
- }
+ id = g_strdup (sec + strlen ("server-"));
+
+ /*
+ * See if we already loaded a server with this id, skip if
+ * one already exists.
+ */
+ if (gdm_find_xserver (id) != NULL) {
+ g_free (id);
+ } else {
+ GdmXserver *svr = g_new0 (GdmXserver, 1);
+ gchar buf[256];
+ int n;
+
+ svr->id = id;
+
+ g_snprintf (buf, sizeof (buf), "%s/" GDM_KEY_SERVER_NAME, sec);
+ gdm_common_config_get_string (config, buf, &svr->name, NULL);
+ g_snprintf (buf, sizeof (buf), "%s/" GDM_KEY_SERVER_COMMAND, sec);
+ gdm_common_config_get_string (config, buf, &svr->command, NULL);
+ g_snprintf (buf, sizeof (buf), "%s/" GDM_KEY_SERVER_FLEXIBLE, sec);
+ gdm_common_config_get_boolean (config, buf, &svr->flexible, NULL);
+ g_snprintf (buf, sizeof (buf), "%s/" GDM_KEY_SERVER_CHOOSABLE, sec);
+ gdm_common_config_get_boolean (config, buf, &svr->choosable, NULL);
+ g_snprintf (buf, sizeof (buf), "%s/" GDM_KEY_SERVER_HANDLED, sec);
+ gdm_common_config_get_boolean (config, buf, &svr->handled, NULL);
+ g_snprintf (buf, sizeof (buf), "%s/" GDM_KEY_SERVER_CHOOSER, sec);
+ gdm_common_config_get_boolean (config, buf, &svr->chooser, NULL);
+ g_snprintf (buf, sizeof (buf), "%s/" GDM_KEY_SERVER_PRIORITY, sec);
+ gdm_common_config_get_int (config, buf, &svr->priority, NULL);
+
+ /* 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;
+ }
- xservers = g_slist_append (xservers, svr);
+ 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 (GdmStandardXserver);
}
+
+ xservers = g_slist_append (xservers, svr);
}
}
- ve_config_free_list_of_strings (list);
+
+ g_strfreev (groups);
}
/**
@@ -1636,7 +1702,8 @@ gdm_load_xservers (VeConfig *cfg)
* Reload [server-foo] sections from the configuration files.
*/
static void
-gdm_update_xservers (VeConfig *cfg, VeConfig *custom_cfg)
+gdm_update_xservers (GKeyFile *cfg,
+ GKeyFile *custom_cfg)
{
GSList *xli;
@@ -1677,7 +1744,7 @@ gdm_update_xservers (VeConfig *cfg, VeConfig *custom_cfg)
/**
* gdm_update_config
- *
+ *
* 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. Only specific keys defined in the
@@ -1691,19 +1758,23 @@ gdm_update_xservers (VeConfig *cfg, VeConfig *custom_cfg)
* functions and in the gdm_slave_handle_notify function in slave.c.
*/
gboolean
-gdm_update_config (gchar* key)
+gdm_update_config (const gchar *key)
{
GdmConfigType *type;
struct stat statbuf, custom_statbuf;
- VeConfig *cfg;
- VeConfig *custom_cfg = NULL;
- gboolean rc = FALSE;
+ GKeyFile *cfg;
+ GKeyFile *custom_cfg;
+ gboolean rc;
+
+ rc = FALSE;
+ cfg = NULL;
+ custom_cfg = 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 (key, GDM_KEY_PID_FILE) ||
is_key (key, GDM_KEY_CONSOLE_NOTIFY) ||
is_key (key, GDM_KEY_USER) ||
@@ -1718,7 +1789,7 @@ gdm_update_config (gchar* key)
/* See if custom file is now there */
if (custom_config_file == NULL) {
- custom_cfg = gdm_get_custom_config (&statbuf);
+ custom_cfg = gdm_get_custom_config ();
}
/* Don't bother re-reading configuration if files have not changed */
@@ -1732,8 +1803,10 @@ gdm_update_config (gchar* key)
* has changed since GDM was started.
*/
if (config_file_mtime == statbuf.st_mtime &&
- custom_config_file_mtime == custom_statbuf.st_mtime)
- return TRUE;
+ custom_config_file_mtime == custom_statbuf.st_mtime) {
+ rc = TRUE;
+ goto out;
+ }
/* Shortcut for updating all XDMCP parameters */
if (is_key (key, "xdmcp/PARAMETERS")) {
@@ -1745,19 +1818,21 @@ gdm_update_config (gchar* key)
gdm_update_config (GDM_KEY_MAX_INDIRECT);
gdm_update_config (GDM_KEY_MAX_WAIT_INDIRECT);
gdm_update_config (GDM_KEY_PING_INTERVAL);
- return TRUE;
+ rc = TRUE;
+ goto out;
}
- if (custom_config_file != NULL)
- custom_cfg = ve_config_new (custom_config_file);
+ if (custom_config_file != NULL) {
+ custom_cfg = gdm_common_config_load (custom_config_file, NULL);
+ }
if (is_key (key, "xservers/PARAMETERS")) {
- cfg = ve_config_new (config_file);
+ cfg = gdm_common_config_load (config_file, NULL);
+
gdm_update_xservers (cfg, custom_cfg);
- ve_config_destroy (cfg);
- if (custom_cfg != NULL)
- ve_config_destroy (custom_cfg);
- return TRUE;
+
+ rc = TRUE;
+ goto out;
}
type = gdm_config_hash_lookup (type_hash, key);
@@ -1766,38 +1841,38 @@ gdm_update_config (gchar* key)
/* First check the custom file */
if (custom_cfg != NULL) {
- gchar **splitstr = g_strsplit (key, "/", 2);
-
- if (splitstr[0] != NULL) {
- GList *list = ve_config_get_keys (custom_cfg, splitstr[0]);
-
- while (list != NULL) {
- gchar *custom_key = (char *)list->data;
- gchar *custom_fullkey = g_strdup_printf ("%s/%s", splitstr[0], custom_key);
-
- if (is_key (key, custom_fullkey)) {
- rc = gdm_set_value (custom_cfg, type, key, TRUE);
-
- g_free (custom_fullkey);
- g_strfreev (splitstr);
- ve_config_destroy (custom_cfg);
- return (rc);
- }
-
- g_free (custom_fullkey);
- list = list->next;
- }
- }
- g_strfreev (splitstr);
+ char *config_group;
+ char *config_key;
+ gboolean has_key;
+
+ config_group = config_key = NULL;
+ if (! gdm_common_config_parse_key_string (key, &config_group, &config_key, NULL)) {
+ rc = FALSE;
+ goto out;
+ }
+
+ has_key = g_key_file_has_key (custom_cfg, config_group, config_key, NULL);
+ g_free (config_group);
+ g_free (config_key);
+
+ if (has_key) {
+ rc = gdm_set_value (custom_cfg, type, key, TRUE);
+ goto out;
+ }
}
/* If not in the custom file, check main config file */
- cfg = ve_config_new (config_file);
- rc = gdm_set_value (cfg, type, key, TRUE);
+ cfg = gdm_common_config_load (config_file, NULL);
+
+ rc = gdm_set_value (cfg, type, key, TRUE);
+
+ out:
+ if (cfg != NULL)
+ g_key_file_free (cfg);
- ve_config_destroy (cfg);
if (custom_cfg != NULL)
- ve_config_destroy (custom_cfg);
+ g_key_file_free (custom_cfg);
+
return rc;
}
@@ -1866,8 +1941,8 @@ check_servauthdir (struct stat *statbuf)
}
typedef struct _GdmConfigFiles {
- VeConfig *cfg;
- VeConfig *custom_cfg;
+ GKeyFile *cfg;
+ GKeyFile *custom_cfg;
} GdmConfigFiles;
/**
@@ -1876,24 +1951,33 @@ typedef struct _GdmConfigFiles {
* Load the displays section of the config file
*/
static void
-gdm_load_displays (VeConfig *cfg, GList *list )
+gdm_load_displays (GKeyFile *cfg,
+ char **keys)
{
- GList *li;
GSList *li2;
+ int i;
- for (li = list; li != NULL; li = li->next) {
- const gchar *key = li->data;
+ for (i = 0; keys[i] != NULL; i++) {
+ const gchar *key = keys[i];
+ gdm_debug ("Loading display for key '%s'", key);
if (isdigit (*key)) {
gchar *fullkey;
gchar *dispval;
int keynum = atoi (key);
gboolean skip_entry = FALSE;
-
- fullkey = g_strdup_printf ("%s/%s", GDM_KEY_SECTION_SERVERS, key);
- dispval = ve_config_get_string (cfg, fullkey);
+ GError *error;
+
+ fullkey = g_strdup_printf ("%s/%s", GDM_KEY_SECTION_SERVERS, key);
+ dispval = NULL;
+ error = NULL;
+ gdm_common_config_get_string (cfg, fullkey, &dispval, &error);
+ if (error != NULL) {
+ gdm_error ("Unable to get name for server '%s': %s", fullkey, error->message);
+ }
g_free (fullkey);
+ gdm_debug ("Got name for server: %s", dispval);
/* Do not add if already in the list */
for (li2 = displays; li2 != NULL; li2 = li2->next) {
GdmDisplay *disp = li2->data;
@@ -1955,26 +2039,23 @@ gdm_load_config_option (gpointer key_in, gpointer value_in, gpointer data)
if (type != NULL) {
/* First check the custom file */
if (cfgfiles->custom_cfg != NULL) {
- gchar **splitstr = g_strsplit (key_in, "/", 2);
- if (splitstr[0] != NULL) {
- GList *list = ve_config_get_keys (cfgfiles->custom_cfg, splitstr[0]);
-
- while (list != NULL) {
- gchar *custom_key = (char *)list->data;
- gchar *custom_fullkey = g_strdup_printf ("%s/%s", splitstr[0], custom_key);
-
- if (is_key (key_in, custom_fullkey)) {
- custom_retval = gdm_set_value (cfgfiles->custom_cfg, type, key, FALSE);
- g_free (custom_fullkey);
- g_strfreev (splitstr);
- return;
- }
+ gchar *config_group;
+ gchar *config_key;
+ gboolean has_key;
+
+ config_group = config_key = NULL;
+ if (! gdm_common_config_parse_key_string (key_in, &config_group, &config_key, NULL)) {
+ return;
+ }
- g_free (custom_fullkey);
- list = list->next;
- }
- }
- g_strfreev (splitstr);
+ has_key = g_key_file_has_key (cfgfiles->custom_cfg, config_group, config_key, NULL);
+ g_free (config_group);
+ g_free (config_key);
+
+ if (has_key) {
+ custom_retval = gdm_set_value (cfgfiles->custom_cfg, type, key, FALSE);
+ return;
+ }
}
/* If not in the custom file, check main config file */
@@ -1982,7 +2063,7 @@ gdm_load_config_option (gpointer key_in, gpointer value_in, gpointer data)
return;
}
- gdm_error ("Cannot set config option %s", key);
+ gdm_error ("Cannot set config option %s", key);
}
/**
@@ -1994,7 +2075,8 @@ void
gdm_config_parse (void)
{
GdmConfigFiles cfgfiles;
- VeConfig *cfg, *custom_cfg;
+ GKeyFile *cfg;
+ GKeyFile *custom_cfg;
struct passwd *pwent;
struct group *grent;
struct stat statbuf;
@@ -2012,16 +2094,15 @@ gdm_config_parse (void)
* not exist we cannot continue and need to bail out.
*/
- cfg = gdm_get_default_config (&statbuf);
+ cfg = gdm_get_default_config ();
if (cfg == NULL)
gdm_fail (_("%s: Main config file (defaults.conf) is missing. Aborting!"), "gdm_config_parse");
- config_file_mtime = statbuf.st_mtime;
- custom_cfg = gdm_get_custom_config (&statbuf);
- custom_config_file_mtime = statbuf.st_mtime;
- cfgfiles.cfg = cfg;
- cfgfiles.custom_cfg = custom_cfg;
+ custom_cfg = gdm_get_custom_config ();
+
+ cfgfiles.cfg = cfg;
+ cfgfiles.custom_cfg = custom_cfg;
/* Loop over all configuration options and load them */
g_hash_table_foreach (type_hash, gdm_load_config_option, &cfgfiles);
@@ -2030,20 +2111,37 @@ gdm_config_parse (void)
gdm_update_xservers (cfg, custom_cfg);
/* Only read the list if no_console is FALSE at this stage */
- if ( !no_console) {
- GList *list;
+ if (! no_console) {
+ char **keys;
+ GError *error;
GSList *li2;
+ gsize len;
/* Find static X server definitions */
- if (custom_cfg) {
- list = ve_config_get_keys (custom_cfg, GDM_KEY_SECTION_SERVERS);
- gdm_load_displays (custom_cfg, list);
- ve_config_free_list_of_strings (list);
+ if (custom_cfg != NULL) {
+ error = NULL;
+ keys = g_key_file_get_keys (custom_cfg, GDM_KEY_SECTION_SERVERS, &len, &error);
+ if (error != NULL) {
+ gdm_error ("Unable to load server list: %s", error->message);
+ g_error_free (error);
+ }
+ if (keys != NULL) {
+ gdm_load_displays (custom_cfg, keys);
+ }
+ g_strfreev (keys);
+ }
+
+ error = NULL;
+ keys = g_key_file_get_keys (cfg, GDM_KEY_SECTION_SERVERS, &len, &error);
+ if (error != NULL) {
+ gdm_error ("Unable to load server list: %s", error->message);
+ g_error_free (error);
+ }
+ if (keys != NULL) {
+ gdm_load_displays (cfg, keys);
}
- list = ve_config_get_keys (cfg, GDM_KEY_SECTION_SERVERS);
- gdm_load_displays (cfg, list);
- ve_config_free_list_of_strings (list);
+ g_strfreev (keys);
/* Free list of inactive, not needed anymore */
for (li2 = displays_inactive; li2 != NULL; li2 = li2->next) {
@@ -2280,9 +2378,9 @@ gdm_config_parse (void)
/* Check that user authentication is properly configured */
gdm_verify_check ();
- if (custom_cfg)
- ve_config_destroy (custom_cfg);
- ve_config_destroy (cfg);
+ if (custom_cfg != NULL)
+ g_key_file_free (custom_cfg);
+ g_key_file_free (cfg);
}
/**
@@ -2327,7 +2425,7 @@ gdm_set_high_display_num (gint val)
* Returns TRUE if the key is a valid key, FALSE otherwise.
*/
gboolean
-gdm_is_valid_key (gchar *key)
+gdm_is_valid_key (const gchar *key)
{
GdmConfigType *type = gdm_config_hash_lookup (type_hash, key);
if (type == NULL)
@@ -2433,15 +2531,17 @@ get_facefile_from_gnome2_dir_config (const char *homedir,
/* Sanity check on ~user/.gnome2/gdm */
cfgdir = g_build_filename (homedir, ".gnome2", "gdm", NULL);
if (G_LIKELY (check_user_file (cfgdir, uid))) {
- VeConfig *cfg;
+ GKeyFile *cfg;
char *cfgfile;
cfgfile = g_build_filename (homedir, ".gnome2", "gdm", NULL);
- cfg = ve_config_new (cfgfile);
+ cfg = gdm_common_config_load (cfgfile, NULL);
g_free (cfgfile);
- picfile = ve_config_get_string (cfg, "face/picture=");
- ve_config_destroy (cfg);
+ if (cfg != NULL) {
+ gdm_common_config_get_string (cfg, "face/picture=", &picfile, NULL);
+ g_key_file_free (cfg);
+ }
/* must exist and be absolute (note that this check
* catches empty strings)*/
@@ -2626,10 +2726,13 @@ gdm_get_session_exec (const char *session_name, gboolean check_try_exec)
{
char *file;
char *full = NULL;
- VeConfig *cfg;
+ GKeyFile *cfg;
static char *exec;
static char *cached = NULL;
- char *tryexec;
+ gboolean hidden;
+ char *ret;
+
+ cfg = NULL;
/* clear cache */
if (session_name == NULL) {
@@ -2673,24 +2776,43 @@ gdm_get_session_exec (const char *session_name, gboolean check_try_exec)
}
}
- cfg = ve_config_get (full);
+ cfg = gdm_common_config_load (full, NULL);
g_free (full);
- if (ve_config_get_bool (cfg, "Desktop Entry/Hidden=false"))
- return NULL;
+ if (cfg == NULL) {
+ ret = NULL;
+ goto out;
+ }
+
+ hidden = FALSE;
+ gdm_common_config_get_boolean (cfg, "Desktop Entry/Hidden=false", &hidden, NULL);
+ if (hidden) {
+ ret = NULL;
+ goto out;
+ }
if (check_try_exec) {
- tryexec = ve_config_get_string (cfg, "Desktop Entry/TryExec");
+ char *tryexec;
+ tryexec = NULL;
+ gdm_common_config_get_string (cfg, "Desktop Entry/TryExec", &tryexec, NULL);
if ( ! ve_string_empty (tryexec) &&
! ve_is_prog_in_path (tryexec, gdm_get_value_string (GDM_KEY_PATH)) &&
! ve_is_prog_in_path (tryexec, gdm_saved_getenv ("PATH"))) {
g_free (tryexec);
- return NULL;
+ ret = NULL;
+ goto out;
}
g_free (tryexec);
}
- exec = ve_config_get_string (cfg, "Desktop Entry/Exec");
- return g_strdup (exec);
+ exec = NULL;
+ gdm_common_config_get_string (cfg, "Desktop Entry/Exec", &exec, NULL);
+ ret = g_strdup (exec);
+
+ out:
+
+ g_key_file_free (cfg);
+
+ return ret;
}
/**
@@ -2701,77 +2823,110 @@ gdm_get_session_exec (const char *session_name, gboolean check_try_exec)
* $HOME/.dmrc file via vicious-extensions.
*/
void
-gdm_set_user_session_lang (gboolean savesess, gboolean savelang,
- const char *home_dir, const char *save_session, const char *save_language)
+gdm_set_user_session_lang (gboolean savesess,
+ gboolean savelang,
+ const char *home_dir,
+ const char *save_session,
+ const char *save_language)
{
- VeConfig *dmrc = NULL;
- gchar *cfgstr = g_build_filename (home_dir, ".dmrc", NULL);
+ 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) {
- dmrc = ve_config_new (cfgstr);
- ve_config_set_string (dmrc, "Desktop/Session",
- ve_sure_string (save_session));
+ g_key_file_set_string (dmrc, "Desktop", "Session", ve_sure_string (save_session));
}
if (savelang) {
- if (dmrc == NULL)
- dmrc = ve_config_new (cfgstr);
- if (ve_string_empty (save_language))
+ if (ve_string_empty (save_language)) {
/* we chose the system default language so wipe the
* lang key */
- ve_config_delete_key (dmrc, "Desktop/Language");
- else
- ve_config_set_string (dmrc, "Desktop/Language", save_language);
+ g_key_file_remove_key (dmrc, "Desktop", "Language", NULL);
+ } else {
+ g_key_file_set_string (dmrc, "Desktop", "Language", save_language);
+ }
}
- g_free (cfgstr);
-
if (dmrc != NULL) {
mode_t oldmode;
oldmode = umask (077);
- ve_config_save (dmrc, FALSE);
- ve_config_destroy (dmrc);
- dmrc = NULL;
+ gdm_common_config_save (dmrc, cfgstr, NULL);
umask (oldmode);
}
+
+ g_free (cfgstr);
+ g_key_file_free (dmrc);
}
void
-gdm_get_user_session_lang (char **usrsess, char **usrlang,
- const char *home_dir, gboolean *savesess)
+gdm_get_user_session_lang (char **usrsess,
+ char **usrlang,
+ const char *home_dir,
+ gboolean *savesess)
{
char *p;
- char *cfgfile = g_build_filename (home_dir, ".dmrc", NULL);
- VeConfig *cfg = ve_config_new (cfgfile);
+ 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);
- *usrsess = ve_config_get_string (cfg, "Desktop/Session");
- if (*usrsess == NULL)
- *usrsess = g_strdup ("");
+ 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 (*usrsess, '/');
+ p = strrchr (session, '/');
if (p != NULL) {
- char *tmp = g_strdup (p+1);
- g_free (*usrsess);
- *usrsess = tmp;
+ char *tmp = g_strdup (p + 1);
+ g_free (session);
+ session = tmp;
}
/* ugly workaround for migration */
- if ((strcmp (ve_sure_string (*usrsess), "Default.desktop") == 0 ||
- strcmp (ve_sure_string (*usrsess), "Default") == 0) &&
+ if ((strcmp (ve_sure_string (session), "Default.desktop") == 0 ||
+ strcmp (ve_sure_string (session), "Default") == 0) &&
! ve_is_prog_in_path ("Default.desktop",
gdm_get_value_string (GDM_KEY_SESSION_DESKTOP_DIR))) {
- g_free (*usrsess);
- *usrsess = g_strdup ("default");
- *savesess = TRUE;
+ g_free (session);
+ session = g_strdup ("default");
+ save = TRUE;
}
- *usrlang = ve_config_get_string (cfg, "Desktop/Language");
- if (*usrlang == NULL)
- *usrlang = g_strdup ("");
+ 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);
- ve_config_destroy (cfg);
+ g_key_file_free (cfg);
}
diff --git a/daemon/gdmconfig.h b/daemon/gdmconfig.h
index cf2f9bf6..5142b748 100644
--- a/daemon/gdmconfig.h
+++ b/daemon/gdmconfig.h
@@ -1,4 +1,6 @@
-/* GDM - The GNOME Display Manager
+/* -*- 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>
*
@@ -16,42 +18,44 @@
* 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_CONFIG_H
+#define _GDM_CONFIG_H
+
#include "gdm.h"
-/* To access ve_string_empty(), ve_sure_string(), and
- VE_IGNORE_EINTR macros ve-misc.h must be included */
+G_BEGIN_DECLS
-#include "ve-misc.h"
gchar* gdm_get_display_custom_config_file
- (gchar *display);
+ (const gchar *display);
gchar* gdm_get_custom_config_file (void);
-gchar* gdm_get_value_string (gchar *key);
-gboolean gdm_get_value_bool (gchar *key);
-gint gdm_get_value_int (gchar *key);
+gchar* gdm_get_value_string (const gchar *key);
+gboolean gdm_get_value_bool (const gchar *key);
+gint gdm_get_value_int (const gchar *key);
gchar* gdm_get_value_string_per_display (const gchar *display,
- gchar *key);
-gboolean gdm_get_value_bool_per_display (gchar *display,
- gchar *key);
-gint gdm_get_value_int_per_display (gchar *display,
- gchar *key);
-void gdm_set_value_string (gchar *key,
- gchar *value);
-void gdm_set_value_bool (gchar *key,
+ const gchar *key);
+gboolean gdm_get_value_bool_per_display (const gchar *display,
+ const gchar *key);
+gint gdm_get_value_int_per_display (const gchar *display,
+ const gchar *key);
+void gdm_set_value_string (const gchar *key,
+ const gchar *value);
+void gdm_set_value_bool (const gchar *key,
gboolean value);
-void gdm_set_value_int (gchar *key,
+void gdm_set_value_int (const gchar *key,
gint value);
void gdm_config_key_to_string_per_display
(const gchar *display,
- gchar *key,
+ const gchar *key,
gchar **retval);
-void gdm_config_key_to_string (gchar *file,
- gchar *key,
+void gdm_config_key_to_string (const gchar *file,
+ const gchar *key,
gchar **retval);
-void gdm_config_to_string (gchar *key,
- gchar *display,
+void gdm_config_to_string (const gchar *key,
+ const gchar *display,
gchar **retval);
-gboolean gdm_update_config (gchar *key);
+gboolean gdm_update_config (const gchar *key);
void gdm_config_parse (void);
GdmXserver* gdm_find_xserver (const gchar *id);
gchar* gdm_get_xservers (void);
@@ -61,7 +65,7 @@ uid_t gdm_get_gdmuid (void);
uid_t gdm_get_gdmgid (void);
gint gdm_get_high_display_num (void);
void gdm_set_high_display_num (gint val);
-gboolean gdm_is_valid_key (gchar *key);
+gboolean gdm_is_valid_key (const gchar *key);
gboolean gdm_signal_terminthup_was_notified (void);
gchar* gdm_get_facefile_from_home
@@ -83,3 +87,7 @@ void gdm_set_user_session_lang (gboolean savesess,
char* gdm_get_session_exec (const char *session_name,
gboolean check_try_exec);
+
+G_END_DECLS
+
+#endif /* _GDM_CONFIG_H */
diff --git a/daemon/getvt.c b/daemon/getvt.c
index c8eddfe2..e34c2197 100644
--- a/daemon/getvt.c
+++ b/daemon/getvt.c
@@ -34,6 +34,8 @@
#include "getvt.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
/* Virtual terminals only supported on Linux, FreeBSD, or DragonFly */
#if defined (__linux__) || defined (__FreeBSD__) || defined (__DragonFly__)
diff --git a/daemon/misc.c b/daemon/misc.c
index 2dcca937..ca0056a3 100644
--- a/daemon/misc.c
+++ b/daemon/misc.c
@@ -57,6 +57,8 @@
#include "slave.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
extern char **environ;
extern pid_t extra_process;
diff --git a/daemon/server.c b/daemon/server.c
index 2fa80195..a11d1d43 100644
--- a/daemon/server.c
+++ b/daemon/server.c
@@ -1,4 +1,6 @@
-/* GDM - The GNOME Display Manager
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * GDM - The GNOME Display Manager
* Copyright (C) 1999, 2000 Martin K. Petersen <mkp@mkp.net>
*
* This program is free software; you can redistribute it and/or modify
@@ -50,6 +52,8 @@
#include "getvt.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
/* Local prototypes */
static void gdm_server_spawn (GdmDisplay *d, const char *vtarg);
static void gdm_server_usr1_handler (gint);
@@ -960,42 +964,90 @@ gdm_server_resolve (GdmDisplay *disp)
}
-char **
+static char **
+vector_merge (char * const *v1,
+ int len1,
+ char * const *v2,
+ int len2)
+{
+ int argc, i;
+ char **argv;
+
+ if (v1 == NULL && v2 == NULL)
+ return NULL;
+
+ argc = len1 + len2;
+
+ argv = g_new (char *, argc + 1);
+ for (i = 0; i < len1; i++)
+ argv[i] = g_strdup (v1[i]);
+ for (; i < argc; i++)
+ argv[i] = g_strdup (v2[i - len1]);
+ argv[i] = NULL;
+
+ return argv;
+}
+
+gboolean
gdm_server_resolve_command_line (GdmDisplay *disp,
- gboolean resolve_flags,
- const char *vtarg)
+ gboolean resolve_flags,
+ const char *vtarg,
+ int *argcp,
+ char ***argvp)
{
char *bin;
+ int argc;
char **argv;
int len;
int i;
gboolean gotvtarg = FALSE;
gboolean query_in_arglist = FALSE;
+ argv = NULL;
+
bin = ve_first_word (disp->command);
if (bin == NULL) {
+ const char *str;
+
gdm_error (_("Invalid server command '%s'"), disp->command);
- argv = ve_split (gdm_get_value_string (GDM_KEY_STANDARD_XSERVER));
+ str = gdm_get_value_string (GDM_KEY_STANDARD_XSERVER);
+ g_shell_parse_argv (str, &argc, &argv, NULL);
} else if (bin[0] != '/') {
GdmXserver *svr = gdm_find_xserver (bin);
if (svr == NULL) {
+ const char *str;
+
gdm_error (_("Server name '%s' not found; "
"using standard server"), bin);
- argv = ve_split (gdm_get_value_string (GDM_KEY_STANDARD_XSERVER));
+ str = gdm_get_value_string (GDM_KEY_STANDARD_XSERVER);
+ g_shell_parse_argv (str, &argc, &argv, NULL);
+
} else {
- char **svr_command =
- ve_split (ve_sure_string (svr->command));
- argv = ve_split (disp->command);
+ char **svr_command;
+ const char *str;
+ int svr_argc;
+
+ str = ve_sure_string (svr->command);
+ svr_command = NULL;
+ g_shell_parse_argv (str, &svr_argc, &svr_command, NULL);
+
+ g_shell_parse_argv (disp->command, &argc, &argv, NULL);
+
if (argv[0] == NULL || argv[1] == NULL) {
g_strfreev (argv);
argv = svr_command;
+ argc = svr_argc;
} else {
char **old_argv = argv;
- argv = ve_vector_merge (svr_command,
- &old_argv[1]);
+ argv = vector_merge (svr_command,
+ svr_argc,
+ &old_argv[1],
+ argc);
g_strfreev (svr_command);
g_strfreev (old_argv);
- }
+
+ argc += svr_argc;
+ }
if (resolve_flags) {
/* Setup the handled function */
@@ -1009,7 +1061,7 @@ gdm_server_resolve_command_line (GdmDisplay *disp,
}
}
} else {
- argv = ve_split (disp->command);
+ g_shell_parse_argv (disp->command, &argc, &argv, NULL);
}
for (len = 0; argv != NULL && argv[len] != NULL; len++) {
@@ -1027,6 +1079,7 @@ gdm_server_resolve_command_line (GdmDisplay *disp,
}
argv = g_renew (char *, argv, len + 10);
+ /* shift args down one */
for (i = len - 1; i >= 1; i--) {
argv[i+1] = argv[i];
}
@@ -1065,9 +1118,12 @@ gdm_server_resolve_command_line (GdmDisplay *disp,
argv[len++] = NULL;
+ *argvp = argv;
+ *argcp = len;
+
g_free (bin);
- return argv;
+ return TRUE;
}
/**
@@ -1080,11 +1136,12 @@ gdm_server_resolve_command_line (GdmDisplay *disp,
* since otherwise the server might not yet be looked up yet.
*/
-static void
+static void
gdm_server_spawn (GdmDisplay *d, const char *vtarg)
{
struct sigaction ign_signal;
sigset_t mask;
+ int argc;
gchar **argv = NULL;
char *logfile;
int logfd;
@@ -1110,9 +1167,13 @@ gdm_server_spawn (GdmDisplay *d, const char *vtarg)
}
/* Figure out the server command */
- argv = gdm_server_resolve_command_line (d,
- TRUE /* resolve flags */,
- vtarg);
+ argv = NULL;
+ argc = 0;
+ gdm_server_resolve_command_line (d,
+ TRUE /* resolve flags */,
+ vtarg,
+ &argc,
+ &argv);
command = g_strjoinv (" ", argv);
@@ -1195,7 +1256,6 @@ gdm_server_spawn (GdmDisplay *d, const char *vtarg)
sigprocmask (SIG_SETMASK, &mask, NULL);
if (SERVER_IS_PROXY (d)) {
- int argc = ve_vector_len (argv);
gboolean add_display = TRUE;
g_unsetenv ("DISPLAY");
diff --git a/daemon/server.h b/daemon/server.h
index 301ea53a..cce65801 100644
--- a/daemon/server.h
+++ b/daemon/server.h
@@ -39,9 +39,11 @@ GdmDisplay * gdm_server_alloc (gint id,
void gdm_server_whack_clients (Display *dsp);
void gdm_server_checklog (GdmDisplay *disp);
-char ** gdm_server_resolve_command_line (GdmDisplay *disp,
+gboolean gdm_server_resolve_command_line (GdmDisplay *disp,
gboolean resolve_flags,
- const char *vtarg);
+ const char *vtarg,
+ int *argc,
+ char ***argv);
GdmXserver * gdm_server_resolve (GdmDisplay *disp);
diff --git a/daemon/slave.c b/daemon/slave.c
index 151dd9cd..399429b7 100644
--- a/daemon/slave.c
+++ b/daemon/slave.c
@@ -91,6 +91,8 @@
#include "gdmconfig.h"
#include "display.h"
+#include "gdm-common.h"
+
#ifdef WITH_CONSOLE_KIT
#include "gdmconsolekit.h"
#endif
@@ -1769,6 +1771,8 @@ run_config (GdmDisplay *display, struct passwd *pwent)
if (pid == 0) {
char **argv;
+ const char *s;
+
/* child */
setsid ();
@@ -1814,11 +1818,19 @@ run_config (GdmDisplay *display, struct passwd *pwent)
VE_IGNORE_EINTR (g_chdir ("/"));
/* exec the configurator */
- argv = ve_split (gdm_get_value_string (GDM_KEY_CONFIGURATOR));
+ argv = NULL;
+ s = gdm_get_value_string (GDM_KEY_CONFIGURATOR);
+ if (s != NULL) {
+ g_shell_parse_argv (s, NULL, &argv, NULL);
+ }
+
if G_LIKELY (argv != NULL &&
argv[0] != NULL &&
- g_access (argv[0], X_OK) == 0)
+ g_access (argv[0], X_OK) == 0) {
VE_IGNORE_EINTR (execv (argv[0], argv));
+ }
+
+ g_strfreev (argv);
gdm_error_box (d,
GTK_MESSAGE_ERROR,
@@ -1828,11 +1840,15 @@ run_config (GdmDisplay *display, struct passwd *pwent)
"Attempting to start it from the default "
"location."));
- argv = ve_split
- (LIBEXECDIR
- "/gdmsetup --disable-sound --disable-crash-dialog");
- if (g_access (argv[0], X_OK) == 0)
+ s = LIBEXECDIR "/gdmsetup --disable-sound --disable-crash-dialog";
+ argv = NULL;
+ g_shell_parse_argv (s, NULL, &argv, NULL);
+
+ if (g_access (argv[0], X_OK) == 0) {
VE_IGNORE_EINTR (execv (argv[0], argv));
+ }
+
+ g_strfreev (argv);
gdm_error_box (d,
GTK_MESSAGE_ERROR,
@@ -2442,7 +2458,12 @@ copy_auth_file (uid_t fromuid, uid_t touid, const char *file)
static void
exec_command (const char *command, const char *extra_arg)
{
- char **argv = ve_split (command);
+ char **argv;
+ int argc;
+
+ if (! g_shell_parse_argv (command, &argc, &argv, NULL)) {
+ return;
+ }
if (argv == NULL ||
ve_string_empty (argv[0]))
@@ -2452,20 +2473,16 @@ exec_command (const char *command, const char *extra_arg)
return;
if (extra_arg != NULL) {
- char **new_argv;
- int i;
- for (i = 0; argv[i] != NULL; i++)
- ;
- new_argv = g_new0 (char *, i+2);
- for (i = 0; argv[i] != NULL; i++)
- new_argv[i] = argv[i];
- new_argv[i++] = (char *)extra_arg;
- new_argv[i++] = NULL;
-
- argv = new_argv;
+
+ argv = g_renew (char *, argv, argc + 2);
+
+ argv[argc] = g_strdup (extra_arg);
+ argv[argc + 1] = NULL;
}
VE_IGNORE_EINTR (execv (argv[0], argv));
+
+ g_strfreev (argv);
}
static void
@@ -5468,7 +5485,10 @@ gdm_slave_exec_script (GdmDisplay *d, const gchar *dir, const char *login,
if ( ! ve_string_empty (d->theme_name))
g_setenv ("GDM_GTK_THEME", d->theme_name, TRUE);
g_unsetenv ("MAIL");
- argv = ve_split (script);
+
+ argv = NULL;
+ g_shell_parse_argv (script, NULL, &argv, NULL);
+
VE_IGNORE_EINTR (execv (argv[0], argv));
syslog (LOG_ERR, _("%s: Failed starting: %s"), "gdm_slave_exec_script",
script);
@@ -5608,20 +5628,22 @@ gdm_parse_enriched_login (const gchar *s, GdmDisplay *display)
g_setenv ("GDM_GTK_THEME", d->theme_name, TRUE);
g_unsetenv ("MAIL");
- argv = ve_split (str->str);
+ argv = NULL;
+ g_shell_parse_argv (str->str, NULL, &argv, NULL);
+
VE_IGNORE_EINTR (execv (argv[0], argv));
gdm_error (_("%s: Failed executing: %s"),
"gdm_parse_enriched_login",
str->str);
_exit (EXIT_SUCCESS);
-
+
case -1:
gdm_error (_("%s: Can't fork script process!"),
"gdm_parse_enriched_login");
VE_IGNORE_EINTR (close (pipe1[0]));
VE_IGNORE_EINTR (close (pipe1[1]));
break;
-
+
default:
/* The parent reads username from the pipe a chunk at a time */
VE_IGNORE_EINTR (close (pipe1[1]));
diff --git a/daemon/verify-pam.c b/daemon/verify-pam.c
index 6789a783..d7238b18 100644
--- a/daemon/verify-pam.c
+++ b/daemon/verify-pam.c
@@ -39,6 +39,8 @@
#include "errorgui.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
#ifdef HAVE_LOGINDEVPERM
#include <libdevinfo.h>
#endif /* HAVE_LOGINDEVPERM */
diff --git a/daemon/xdmcp.c b/daemon/xdmcp.c
index 2e25cbe2..f8ab57cb 100644
--- a/daemon/xdmcp.c
+++ b/daemon/xdmcp.c
@@ -103,6 +103,8 @@
#include "cookie.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
/*This is to be changed when the Xdmcp Multicast address is decided */
#define XDMCP_MULTICAST_ADDRESS "ff02::1"
diff --git a/gui/Makefile.am b/gui/Makefile.am
index 4ce1eb77..e1cae1ae 100644
--- a/gui/Makefile.am
+++ b/gui/Makefile.am
@@ -1,3 +1,5 @@
+NULL =
+
SUBDIRS = . greeter modules faces
## Process this file with automake to produce makefile.in
@@ -17,7 +19,7 @@ INCLUDES = \
-I. \
-I.. \
-I$(top_srcdir)/daemon \
- -I$(top_srcdir)/vicious-extensions \
+ -I$(top_srcdir)/common \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
$(GUI_CFLAGS)
@@ -100,7 +102,7 @@ gdmchooser_LDADD = \
$(PANGO_LIBS) \
$(GDK_LIBS) \
$(GDKPIXBUF_LIBS) \
- $(top_builddir)/vicious-extensions/libviciousui.a \
+ $(top_builddir)/common/libgdmcommon.a \
$(X_EXTRA_LIBS) \
$(XINERAMA_LIBS) \
$(X_LIBS) \
@@ -118,7 +120,7 @@ gdmlogin_LDADD = \
$(GDK_LIBS) \
$(PANGO_LIBS) \
$(GDKPIXBUF_LIBS) \
- $(top_builddir)/vicious-extensions/libviciousui-minimal.a \
+ $(top_builddir)/common/libgdmcommon.a \
$(X_EXTRA_LIBS) \
$(XINERAMA_LIBS) \
$(X_LIBS) \
@@ -141,7 +143,7 @@ gdmsetup_LDADD = \
$(GDKPIXBUF_LIBS) \
$(EXTRA_SETUP_LIBS) \
$(LIBGNOMEUI_LIBS) \
- $(top_builddir)/vicious-extensions/libviciousui.a \
+ $(top_builddir)/common/libgdmcommon.a \
$(X_LIBS) \
-lXau \
-lX11
@@ -156,7 +158,8 @@ gdmphotosetup_LDADD = \
$(GDKPIXBUF_LIBS) \
$(INTLLIBS) \
-lX11 \
- $(top_builddir)/vicious-extensions/libviciousui.a
+ $(top_builddir)/common/libgdmcommon.a \
+ $(NULL)
gdmXnestchooser_LDADD = \
libgdmcommon.a \
@@ -165,7 +168,7 @@ gdmXnestchooser_LDADD = \
$(GLIB_LIBS) \
$(GOBJECT_LIBS) \
$(GDK_LIBS) \
- $(top_builddir)/vicious-extensions/libviciousui.a \
+ $(top_builddir)/common/libgdmcommon.a \
$(EXTRA_XNEST_LIBS) \
$(X_LIBS) \
-lXau \
@@ -179,7 +182,7 @@ gdmflexiserver_LDADD = \
$(GLIB_LIBS) \
$(GOBJECT_LIBS) \
$(GDK_LIBS) \
- $(top_builddir)/vicious-extensions/libviciousui.a \
+ $(top_builddir)/common/libgdmcommon.a \
$(EXTRA_FLEXI_LIBS) \
$(X_LIBS) \
-lX11 \
@@ -193,7 +196,7 @@ gdmdynamic_LDADD = \
$(GLIB_LIBS) \
$(GOBJECT_LIBS) \
$(GDK_LIBS) \
- $(top_builddir)/vicious-extensions/libviciousui.a \
+ $(top_builddir)/common/libgdmcommon.a \
$(EXTRA_DYNAMIC_LIBS) \
$(X_LIBS) \
-lX11 \
diff --git a/gui/gdmXnestchooser.c b/gui/gdmXnestchooser.c
index 3a95f173..7a195c7a 100644
--- a/gui/gdmXnestchooser.c
+++ b/gui/gdmXnestchooser.c
@@ -1,4 +1,6 @@
-/* GDM - The GNOME Display Manager
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * GDM - The GNOME Display Manager
* Copyright (c) 2001 Queen of England
*
* GDMXnestChooser - run X nest with a chooser using xdmcp
@@ -40,6 +42,8 @@
#include "gdmcommon.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
static gchar **args_remaining;
static pid_t xnest_pid = 0;
@@ -260,13 +264,9 @@ get_font_path (const char *display)
static char **
make_us_an_exec_vector (const char *xnest)
{
- char **vector;
- int i, ii;
+ char **argv;
int argc;
- char **xnest_vec;
- char **options_vec = NULL;
- gboolean got_font_path = FALSE;
- char *font_path = NULL;
+ GString *command;
if ( ! ve_string_empty (xnest_binary))
xnest = xnest_binary;
@@ -274,62 +274,37 @@ make_us_an_exec_vector (const char *xnest)
if (ve_string_empty (xnest))
xnest = "Xnest";
- xnest_vec = ve_split (xnest);
- if (xnest_options != NULL)
- options_vec = ve_split (xnest_options);
- else
- options_vec = NULL;
-
- argc = ve_vector_len (xnest_vec) +
- 1 +
- ve_vector_len (options_vec) +
- 3 +
- 2;
-
- vector = g_new0 (char *, argc);
-
- ii = 0;
+ command = g_string_new (xnest);
+ g_string_append_printf (command, " %s", display_num);
- /* lots of leaks follow */
-
- vector[ii++] = xnest_vec[0];
- vector[ii++] = display_num;
-
- for (i = 1; xnest_vec[i] != NULL; i++) {
- vector[ii++] = xnest_vec[i];
- if (strcmp (xnest_vec[i], "-fp") == 0)
- got_font_path = TRUE;
- }
-
- if (options_vec != NULL) {
- for (i = 0; options_vec[i] != NULL; i++) {
- vector[ii++] = options_vec[i];
- if (strcmp (options_vec[i], "-fp") == 0)
- got_font_path = TRUE;
- }
+ if (xnest_options != NULL) {
+ g_string_append_printf (command, " %s", xnest_options);
}
if ( ! no_query) {
if (do_broadcast) {
- vector[ii++] = "-broadcast";
+ g_string_append (command, " -broadcast");
} else if (do_direct) {
- vector[ii++] = "-query";
- vector[ii++] = indirect_host;
+ g_string_append_printf (command, " -query %s", indirect_host);
} else {
- vector[ii++] = "-indirect";
- vector[ii++] = indirect_host;
+ g_string_append_printf (command, " -indirect %s", indirect_host);
}
}
- if ( ! got_font_path)
+ if (g_strrstr (command->str, " -fp ") == NULL) {
+ char *font_path;
font_path = get_font_path (NULL);
-
- if (font_path != NULL) {
- vector[ii++] = "-fp";
- vector[ii++] = font_path;
+ g_string_append_printf (command, " -fp %s", font_path);
+ g_free (font_path);
}
- return vector;
+ argv = NULL;
+
+ g_shell_parse_argv (command->str, &argc, &argv, NULL);
+
+ g_string_free (command, TRUE);
+
+ return argv;
}
static const char *
@@ -459,6 +434,32 @@ setup_cookie (int disp)
XauUnlockAuth (filename);
}
+static GtkWidget *
+hig_dialog_new (GtkWindow *parent,
+ GtkDialogFlags flags,
+ GtkMessageType type,
+ GtkButtonsType buttons,
+ const gchar *primary_message,
+ const gchar *secondary_message)
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ type,
+ buttons,
+ "%s", primary_message);
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ "%s", secondary_message);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), "");
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
+
+ return dialog;
+}
+
int
main (int argc, char *argv[])
{
@@ -512,14 +513,14 @@ main (int argc, char *argv[])
if (execvec == NULL) {
GtkWidget *d;
- d = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Xnest doesn't exist."),
- _("Please ask your system "
- "administrator "
- "to install it."));
+ d = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Xnest doesn't exist."),
+ _("Please ask your system "
+ "administrator "
+ "to install it."));
gtk_widget_show_all (d);
gtk_dialog_run (GTK_DIALOG (d));
gtk_widget_destroy (d);
@@ -537,15 +538,14 @@ main (int argc, char *argv[])
! honor_indirect) &&
! do_direct) {
GtkWidget *d;
- d = ve_hig_dialog_new
- (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Indirect XDMCP is not enabled"),
- _("Please ask your "
- "system administrator to enable "
- "this feature."));
+ d = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Indirect XDMCP is not enabled"),
+ _("Please ask your "
+ "system administrator to enable "
+ "this feature."));
gtk_widget_show_all (d);
gtk_dialog_run (GTK_DIALOG (d));
gtk_widget_destroy (d);
@@ -555,15 +555,14 @@ main (int argc, char *argv[])
if ( ! xdmcp_enabled &&
do_direct) {
GtkWidget *d;
- d = ve_hig_dialog_new
- (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("XDMCP is not enabled"),
- _("Please ask your "
- "system administrator to enable "
- "this feature."));
+ d = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("XDMCP is not enabled"),
+ _("Please ask your "
+ "system administrator to enable "
+ "this feature."));
gtk_widget_show_all (d);
gtk_dialog_run (GTK_DIALOG (d));
gtk_widget_destroy (d);
@@ -587,14 +586,13 @@ main (int argc, char *argv[])
(kill (pid, 0) < 0 &&
errno != EPERM)) {
GtkWidget *d;
- d = ve_hig_dialog_new
- (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("GDM is not running"),
- _("Please ask your "
- "system administrator to start it."));
+ d = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("GDM is not running"),
+ _("Please ask your "
+ "system administrator to start it."));
gtk_widget_show_all (d);
gtk_dialog_run (GTK_DIALOG (d));
gtk_widget_destroy (d);
@@ -605,13 +603,13 @@ main (int argc, char *argv[])
display = get_free_display ();
if (display < 0) {
GtkWidget *d;
- d = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Could not find a free "
- "display number"),
- "");
+ d = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Could not find a free "
+ "display number"),
+ "");
gtk_widget_show_all (d);
gtk_dialog_run (GTK_DIALOG (d));
gtk_widget_destroy (d);
diff --git a/gui/gdmchooser.c b/gui/gdmchooser.c
index 79c3bc5f..8c5d8c73 100644
--- a/gui/gdmchooser.c
+++ b/gui/gdmchooser.c
@@ -1,4 +1,6 @@
-/* GDM - The GNOME Display Manager
+/* -*- 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>
*
* This program is free software; you can redistribute it and/or modify
@@ -57,7 +59,7 @@
#include "gdmcommon.h"
#include "gdmconfig.h"
-#include "viciousui.h"
+#include "gdm-common.h"
static gboolean RUNNING_UNDER_GDM = FALSE;
@@ -222,7 +224,7 @@ gdm_chooser_host_alloc (const char *hostname,
host->addrtype = family;
chooser_hosts = g_list_prepend (chooser_hosts, host);
-
+
if ( ! willing)
return host;
@@ -239,7 +241,7 @@ gdm_chooser_host_alloc (const char *hostname,
w = gdk_pixbuf_get_width (img);
h = gdk_pixbuf_get_height (img);
-
+
maxw = gdm_config_get_int (GDM_KEY_MAX_ICON_WIDTH);
maxh = gdm_config_get_int (GDM_KEY_MAX_ICON_HEIGHT);
@@ -426,6 +428,32 @@ gdm_addr_known (char *ia, gint family)
return FALSE;
}
+static GtkWidget *
+hig_dialog_new (GtkWindow *parent,
+ GtkDialogFlags flags,
+ GtkMessageType type,
+ GtkButtonsType buttons,
+ const gchar *primary_message,
+ const gchar *secondary_message)
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ type,
+ buttons,
+ "%s", primary_message);
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ "%s", secondary_message);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), "");
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
+
+ return dialog;
+}
+
static gboolean
gdm_chooser_decode_packet (GIOChannel *source,
GIOCondition condition,
@@ -618,13 +646,12 @@ gdm_chooser_decode_packet (GIOChannel *source,
"Please try again later."),
added_host);
- dialog = ve_hig_dialog_new
- (GTK_WINDOW (chooser) /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot connect to remote server"),
- msg);
+ dialog = hig_dialog_new (GTK_WINDOW (chooser) /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot connect to remote server"),
+ msg);
g_free (msg);
@@ -1282,13 +1309,12 @@ add_check (gpointer data)
added_host,
ADD_TIMEOUT / 1000);
- dialog = ve_hig_dialog_new
- (GTK_WINDOW (chooser) /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Did not receive response from server"),
- msg);
+ dialog = hig_dialog_new (GTK_WINDOW (chooser) /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Did not receive response from server"),
+ msg);
g_free (msg);
@@ -1393,14 +1419,12 @@ gdm_chooser_add_host (void)
"Perhaps you have mistyped it."),
name);
- dialog = ve_hig_dialog_new
- (GTK_WINDOW (chooser) /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot find host"),
- msg);
-
+ dialog = hig_dialog_new (GTK_WINDOW (chooser) /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot find host"),
+ msg);
g_free (msg);
if (RUNNING_UNDER_GDM)
@@ -1621,7 +1645,7 @@ display_chooser_information (void)
gdm_wm_no_login_focus_pop ();
}
-static void
+static void
gdm_chooser_gui_init (void)
{
GtkTreeSelection *selection;
@@ -1630,138 +1654,121 @@ gdm_chooser_gui_init (void)
int width;
int height;
- glade_helper_add_glade_directory (GDM_GLADE_DIR);
- glade_helper_search_gnome_dirs (FALSE);
-
- /* Enable theme */
- if (RUNNING_UNDER_GDM) {
- const char *theme_name;
+ /* Enable theme */
+ if (RUNNING_UNDER_GDM) {
+ const char *theme_name;
- if ( ! ve_string_empty (gdm_config_get_string (GDM_KEY_GTKRC)))
- gtk_rc_parse (gdm_config_get_string (GDM_KEY_GTKRC));
+ if ( ! ve_string_empty (gdm_config_get_string (GDM_KEY_GTKRC)))
+ gtk_rc_parse (gdm_config_get_string (GDM_KEY_GTKRC));
- theme_name = g_getenv ("GDM_GTK_THEME");
- if (ve_string_empty (theme_name))
- theme_name = gdm_config_get_string (GDM_KEY_GTK_THEME);
+ theme_name = g_getenv ("GDM_GTK_THEME");
+ if (ve_string_empty (theme_name))
+ theme_name = gdm_config_get_string (GDM_KEY_GTK_THEME);
- if ( ! ve_string_empty (theme_name)) {
- gdm_set_theme (theme_name);
+ if ( ! ve_string_empty (theme_name)) {
+ gdm_set_theme (theme_name);
+ }
}
- }
- defaulthosticon = gdm_config_get_string (GDM_KEY_DEFAULT_HOST_IMG);
-
- /* Load default host image */
- if (g_access (defaulthosticon, R_OK) != 0) {
- gdm_common_error ("Could not open default host icon: %s", defaulthosticon);
- /* bogus image */
- defhostimg = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- FALSE /* has_alpha */,
- 8 /* bits_per_sample */,
- 48 /* width */,
- 48 /* height */);
- } else {
- defhostimg = gdk_pixbuf_new_from_file (defaulthosticon, NULL);
- }
+ defaulthosticon = gdm_config_get_string (GDM_KEY_DEFAULT_HOST_IMG);
+
+ /* Load default host image */
+ if (g_access (defaulthosticon, R_OK) != 0) {
+ gdm_common_error ("Could not open default host icon: %s", defaulthosticon);
+ /* bogus image */
+ defhostimg = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+ FALSE /* has_alpha */,
+ 8 /* bits_per_sample */,
+ 48 /* width */,
+ 48 /* height */);
+ } else {
+ defhostimg = gdk_pixbuf_new_from_file (defaulthosticon, NULL);
+ }
- /* Main window */
- chooser_app = glade_helper_load ("gdmchooser.glade",
+ /* Main window */
+ chooser_app = glade_xml_new (GDM_GLADE_DIR "gdmchooser.glade",
"gdmchooser_main",
- GTK_TYPE_DIALOG,
- FALSE /* dump_on_destroy */);
- glade_xml_signal_autoconnect (chooser_app);
-
- chooser = glade_helper_get (chooser_app, "gdmchooser_main",
- GTK_TYPE_DIALOG);
- manage = glade_helper_get (chooser_app, "connect_button",
- GTK_TYPE_BUTTON);
- rescan = glade_helper_get (chooser_app, "rescan_button",
- GTK_TYPE_BUTTON);
- cancel = glade_helper_get (chooser_app, "quit_button",
- GTK_TYPE_BUTTON);
- status_label = glade_helper_get (chooser_app, "status_label",
- GTK_TYPE_LABEL);
- add_entry = glade_helper_get (chooser_app, "add_entry",
- GTK_TYPE_ENTRY);
- add_button = glade_helper_get (chooser_app, "add_button",
- GTK_TYPE_BUTTON);
-
- browser = glade_helper_get (chooser_app, "chooser_iconlist",
- GTK_TYPE_TREE_VIEW);
-
- gtk_dialog_set_has_separator (GTK_DIALOG (chooser), FALSE);
-
- gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (browser), TRUE);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (browser));
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
-
- g_signal_connect (selection, "changed",
- G_CALLBACK (host_selected),
- NULL);
- g_signal_connect (browser, "row_activated",
- G_CALLBACK (row_activated),
- NULL);
-
- browser_model = (GtkTreeModel *)gtk_list_store_new (3,
- GDK_TYPE_PIXBUF,
- G_TYPE_STRING,
- G_TYPE_POINTER);
- gtk_tree_view_set_model (GTK_TREE_VIEW (browser), browser_model);
- column = gtk_tree_view_column_new_with_attributes
- ("Icon",
- gtk_cell_renderer_pixbuf_new (),
- "pixbuf", CHOOSER_LIST_ICON_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (browser), column);
-
- column = gtk_tree_view_column_new_with_attributes
- ("Hostname",
- gtk_cell_renderer_text_new (),
- "markup", CHOOSER_LIST_LABEL_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (browser), column);
-
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (browser_model),
- CHOOSER_LIST_LABEL_COLUMN,
- GTK_SORT_ASCENDING);
-
-
- if ( ! gdm_config_get_bool (GDM_KEY_ALLOW_ADD)) {
- GtkWidget *w = glade_helper_get (chooser_app, "add_hbox",
- GTK_TYPE_HBOX);
- gtk_widget_hide (w);
- }
+ NULL);
+ glade_xml_signal_autoconnect (chooser_app);
+ chooser = glade_xml_get_widget (chooser_app, "gdmchooser_main");
+ manage = glade_xml_get_widget (chooser_app, "connect_button");
+ rescan = glade_xml_get_widget (chooser_app, "rescan_button");
+ cancel = glade_xml_get_widget (chooser_app, "quit_button");
+ status_label = glade_xml_get_widget (chooser_app, "status_label");
+ add_entry = glade_xml_get_widget (chooser_app, "add_entry");
+ add_button = glade_xml_get_widget (chooser_app, "add_button");
+ browser = glade_xml_get_widget (chooser_app, "chooser_iconlist");
+
+ gtk_dialog_set_has_separator (GTK_DIALOG (chooser), FALSE);
+
+ gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (browser), TRUE);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (browser));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
+
+ g_signal_connect (selection, "changed",
+ G_CALLBACK (host_selected),
+ NULL);
+ g_signal_connect (browser, "row_activated",
+ G_CALLBACK (row_activated),
+ NULL);
+
+ browser_model = (GtkTreeModel *)gtk_list_store_new (3,
+ GDK_TYPE_PIXBUF,
+ G_TYPE_STRING,
+ G_TYPE_POINTER);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (browser), browser_model);
+ column = gtk_tree_view_column_new_with_attributes ("Icon",
+ gtk_cell_renderer_pixbuf_new (),
+ "pixbuf", CHOOSER_LIST_ICON_COLUMN,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (browser), column);
+
+ column = gtk_tree_view_column_new_with_attributes ("Hostname",
+ gtk_cell_renderer_text_new (),
+ "markup", CHOOSER_LIST_LABEL_COLUMN,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (browser), column);
+
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (browser_model),
+ CHOOSER_LIST_LABEL_COLUMN,
+ GTK_SORT_ASCENDING);
+
+
+ if ( ! gdm_config_get_bool (GDM_KEY_ALLOW_ADD)) {
+ GtkWidget *w = glade_xml_get_widget (chooser_app, "add_hbox");
+ gtk_widget_hide (w);
+ }
- gtk_window_get_size (GTK_WINDOW (chooser),
- &width, &height);
- if (RUNNING_UNDER_GDM) {
- if (width > gdm_wm_screen.width)
- width = gdm_wm_screen.width;
- if (height > gdm_wm_screen.height)
- height = gdm_wm_screen.height;
- } else {
- if (width > gdk_screen_width ())
- width = gdk_screen_width ();
- if (height > gdk_screen_height ())
- height = gdk_screen_height ();
- }
- gtk_widget_set_size_request (GTK_WIDGET (chooser),
- width, height);
- gtk_window_set_default_size (GTK_WINDOW (chooser),
- width, height);
- gtk_window_resize (GTK_WINDOW (chooser),
- width, height);
+ gtk_window_get_size (GTK_WINDOW (chooser),
+ &width, &height);
+ if (RUNNING_UNDER_GDM) {
+ if (width > gdm_wm_screen.width)
+ width = gdm_wm_screen.width;
+ if (height > gdm_wm_screen.height)
+ height = gdm_wm_screen.height;
+ } else {
+ if (width > gdk_screen_width ())
+ width = gdk_screen_width ();
+ if (height > gdk_screen_height ())
+ height = gdk_screen_height ();
+ }
+ gtk_widget_set_size_request (GTK_WIDGET (chooser),
+ width, height);
+ gtk_window_set_default_size (GTK_WINDOW (chooser),
+ width, height);
+ gtk_window_resize (GTK_WINDOW (chooser),
+ width, height);
- /* cursor blinking is evil on remote displays, don't do it forever */
- gdm_common_setup_blinking ();
- gdm_common_setup_blinking_entry (add_entry);
+ /* cursor blinking is evil on remote displays, don't do it forever */
+ gdm_common_setup_blinking ();
+ gdm_common_setup_blinking_entry (add_entry);
- if (RUNNING_UNDER_GDM) {
- gtk_widget_show_now (chooser);
- gdm_wm_center_window (GTK_WINDOW (chooser));
- }
+ if (RUNNING_UNDER_GDM) {
+ gtk_widget_show_now (chooser);
+ gdm_wm_center_window (GTK_WINDOW (chooser));
+ }
}
/*
@@ -2033,14 +2040,14 @@ main (int argc, char *argv[])
"Please restart the GDM daemon or the computer."),
VERSION, gdm_version);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot run chooser"),
- msg);
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot run chooser"),
+ msg);
g_free (msg);
-
+
gtk_widget_show_all (dialog);
gdm_wm_center_window (GTK_WINDOW (dialog));
diff --git a/gui/gdmcomm.c b/gui/gdmcomm.c
index a5d5080e..a19dbedc 100644
--- a/gui/gdmcomm.c
+++ b/gui/gdmcomm.c
@@ -35,13 +35,13 @@
#include <sys/un.h>
#include <errno.h>
-#include "vicious.h"
-
#include "gdm.h"
#include "gdmcommon.h"
#include "gdmcomm.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
static gboolean bulk_acs = FALSE;
static gboolean debug = FALSE;
static gboolean quiet = FALSE;
@@ -583,6 +583,32 @@ gdmcomm_get_auth_cookie (void)
return cookie;
}
+static GtkWidget *
+hig_dialog_new (GtkWindow *parent,
+ GtkDialogFlags flags,
+ GtkMessageType type,
+ GtkButtonsType buttons,
+ const gchar *primary_message,
+ const gchar *secondary_message)
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ type,
+ buttons,
+ "%s", primary_message);
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ "%s", secondary_message);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), "");
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
+
+ return dialog;
+}
+
gboolean
gdmcomm_check (gboolean show_dialog)
{
@@ -611,19 +637,18 @@ gdmcomm_check (gboolean show_dialog)
(kill (pid, 0) < 0 &&
errno != EPERM)) {
if (show_dialog) {
- dialog = ve_hig_dialog_new
- (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- _("GDM (The GNOME Display Manager) "
- "is not running."),
- _("You might in fact be using a different "
- "display manager, such as KDM "
- "(KDE Display Manager) or xdm. "
- "If you still wish to use this feature, "
- "either start GDM yourself or ask your "
- "system administrator to start GDM."));
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ _("GDM (The GNOME Display Manager) "
+ "is not running."),
+ _("You might in fact be using a different "
+ "display manager, such as KDM "
+ "(KDE Display Manager) or xdm. "
+ "If you still wish to use this feature, "
+ "either start GDM yourself or ask your "
+ "system administrator to start GDM."));
gtk_widget_show_all (dialog);
gtk_dialog_run (GTK_DIALOG (dialog));
@@ -637,15 +662,14 @@ gdmcomm_check (gboolean show_dialog)
s.st_uid != 0 ||
g_access (GDM_SUP_SOCKET, R_OK|W_OK) != 0) {
if (show_dialog) {
- dialog = ve_hig_dialog_new
- (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- _("Cannot communicate with GDM "
- "(The GNOME Display Manager)"),
- _("Perhaps you have an old version "
- "of GDM running."));
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ _("Cannot communicate with GDM "
+ "(The GNOME Display Manager)"),
+ _("Perhaps you have an old version "
+ "of GDM running."));
gtk_widget_show_all (dialog);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
diff --git a/gui/gdmcommon.c b/gui/gdmcommon.c
index c2be434a..c91712f9 100644
--- a/gui/gdmcommon.c
+++ b/gui/gdmcommon.c
@@ -42,6 +42,8 @@
#include "gdmcomm.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
gint gdm_timed_delay = 0;
static Atom AT_SPI_IOR;
@@ -553,14 +555,15 @@ pre_fetch_run (gpointer data)
GPid pid = -1;
GError *error = NULL;
char *command = NULL;
- gchar **pre_fetch_prog_argv = NULL;
+ gchar **pre_fetch_prog_argv;
command = pre_fetch_prog_get_path ();
if (! command)
return FALSE;
- pre_fetch_prog_argv = ve_split (command);
+ pre_fetch_prog_argv = NULL;
+ g_shell_parse_argv (command, NULL, &pre_fetch_prog_argv, NULL);
g_spawn_async (".",
pre_fetch_prog_argv,
@@ -570,25 +573,27 @@ pre_fetch_run (gpointer data)
NULL,
&pid,
&error);
+ g_strfreev (pre_fetch_prog_argv);
return FALSE;
}
-static gboolean
+static gboolean
pre_atspi_launch (void){
gboolean a11y = gdm_config_get_bool (GDM_KEY_ADD_GTK_MODULES);
GPid pid = -1;
GError *error = NULL;
char *command = NULL;
- gchar **atspi_prog_argv = NULL;
-
+ gchar **atspi_prog_argv;
+
if (! a11y)
return FALSE;
command = g_strdup (LIBEXECDIR "/at-spi-registryd");
- atspi_prog_argv = ve_split (command);
-
+ atspi_prog_argv = NULL;
+ g_shell_parse_argv (command, NULL, &atspi_prog_argv, NULL);
+
g_spawn_async (".",
atspi_prog_argv,
NULL,
@@ -598,6 +603,8 @@ pre_atspi_launch (void){
&pid,
&error);
+ g_strfreev (atspi_prog_argv);
+
if (kill (pid, 0) < 0) {
fprintf (stderr, "at-spi-registryd not running: %s\n", error->message);
return FALSE;
diff --git a/gui/gdmconfig.c b/gui/gdmconfig.c
index 24e222f6..2d30dc05 100644
--- a/gui/gdmconfig.c
+++ b/gui/gdmconfig.c
@@ -31,7 +31,7 @@
#include "gdmcomm.h"
#include "gdmconfig.h"
-#include "vicious.h"
+#include "gdm-common.h"
static GHashTable *int_hash = NULL;
static GHashTable *bool_hash = NULL;
@@ -75,8 +75,9 @@ gdm_config_set_comm_retries (int tries)
* Accesses hash with key, stripping it so it doesn't contain
* a default value.
*/
-static gpointer
-gdm_config_hash_lookup (GHashTable *hash, gchar *key)
+static gpointer
+gdm_config_hash_lookup (GHashTable *hash,
+ const gchar *key)
{
gchar *p;
gpointer *ret;
@@ -99,7 +100,9 @@ gdm_config_hash_lookup (GHashTable *hash, gchar *key)
* a default value.
*/
static void
-gdm_config_add_hash (GHashTable *hash, gchar *key, gpointer value)
+gdm_config_add_hash (GHashTable *hash,
+ const gchar *key,
+ gpointer value)
{
gchar *p;
gchar *newkey = g_strdup (key);
@@ -120,7 +123,7 @@ gdm_config_add_hash (GHashTable *hash, gchar *key, gpointer value)
* doesn't contain a default value.
*/
static gchar *
-gdm_config_get_result (gchar *key)
+gdm_config_get_result (const gchar *key)
{
gchar *p;
gchar *newkey = g_strdup (key);
@@ -154,7 +157,8 @@ gdm_config_get_result (gchar *key)
* Calls daemon to get details for an xserver config.
*/
static gchar *
-gdm_config_get_xserver_details (gchar *xserver, gchar *key)
+gdm_config_get_xserver_details (const gchar *xserver,
+ const gchar *key)
{
gchar *command = NULL;
gchar *result = NULL;
@@ -312,7 +316,10 @@ gdm_config_get_xservers (gboolean flexible)
* access is faster.
*/
static gchar *
-_gdm_config_get_string (gchar *key, gboolean reload, gboolean *changed, gboolean doing_translated)
+_gdm_config_get_string (const gchar *key,
+ gboolean reload,
+ gboolean *changed,
+ gboolean doing_translated)
{
gchar *hashretval = NULL;
gchar *result = NULL;
@@ -381,7 +388,7 @@ _gdm_config_get_string (gchar *key, gboolean reload, gboolean *changed, gboolean
}
gchar *
-gdm_config_get_string (gchar *key)
+gdm_config_get_string (const gchar *key)
{
if (gdm_never_cache == TRUE)
return _gdm_config_get_string (key, TRUE, NULL, FALSE);
@@ -400,11 +407,14 @@ gdm_config_get_string (gchar *key)
* found.
*/
static gchar *
-_gdm_config_get_translated_string (gchar *key, gboolean reload, gboolean *changed)
+_gdm_config_get_translated_string (const gchar *key,
+ gboolean reload,
+ gboolean *changed)
{
- const GList *li;
+ const char * const *langs;
char *newkey;
char *def;
+ int i;
/* Strip key */
newkey = g_strdup (key);
@@ -412,16 +422,18 @@ _gdm_config_get_translated_string (gchar *key, gboolean reload, gboolean *change
if (def != NULL)
*def = '\0';
- for (li = ve_i18n_get_language_list ("LC_MESSAGES");
- li != NULL;
- li = li->next) {
- gchar *full = g_strdup_printf ("%s[%s]", newkey, (char *)li->data);
+ langs = g_get_language_names ();
+
+ for (i = 0; langs[i] != NULL; i++) {
+ gchar *full;
+ gchar *val;
/*
* Pass TRUE for last argument so it doesn't print errors for
* failing to find the key, since this is expected
*/
- gchar *val = _gdm_config_get_string (full, reload, changed, TRUE);
+ full = g_strdup_printf ("%s[%s]", newkey, langs[i]);
+ val = _gdm_config_get_string (full, reload, changed, TRUE);
g_free (full);
@@ -438,7 +450,7 @@ _gdm_config_get_translated_string (gchar *key, gboolean reload, gboolean *change
}
gchar *
-gdm_config_get_translated_string (gchar *key)
+gdm_config_get_translated_string (const gchar *key)
{
if (gdm_never_cache == TRUE)
return _gdm_config_get_translated_string (key, TRUE, NULL);
@@ -454,7 +466,9 @@ gdm_config_get_translated_string (gchar *key)
* access is faster.
*/
static gint
-_gdm_config_get_int (gchar *key, gboolean reload, gboolean *changed)
+_gdm_config_get_int (const gchar *key,
+ gboolean reload,
+ gboolean *changed)
{
gint *hashretval = NULL;
gchar *result = NULL;
@@ -517,7 +531,7 @@ _gdm_config_get_int (gchar *key, gboolean reload, gboolean *changed)
}
gint
-gdm_config_get_int (gchar *key)
+gdm_config_get_int (const gchar *key)
{
if (gdm_never_cache == TRUE)
return _gdm_config_get_int (key, TRUE, NULL);
@@ -533,7 +547,9 @@ gdm_config_get_int (gchar *key)
* access is faster.
*/
static gboolean
-_gdm_config_get_bool (gchar *key, gboolean reload, gboolean *changed)
+_gdm_config_get_bool (const gchar *key,
+ gboolean reload,
+ gboolean *changed)
{
gboolean *hashretval = NULL;
gchar *result;
@@ -608,7 +624,7 @@ _gdm_config_get_bool (gchar *key, gboolean reload, gboolean *changed)
}
gboolean
-gdm_config_get_bool (gchar *key)
+gdm_config_get_bool (const gchar *key)
{
if (gdm_never_cache == TRUE)
return _gdm_config_get_bool (key, TRUE, NULL);
@@ -625,7 +641,7 @@ gdm_config_get_bool (gchar *key)
* otherwise.
*/
gboolean
-gdm_config_reload_string (gchar *key)
+gdm_config_reload_string (const gchar *key)
{
gboolean changed;
_gdm_config_get_string (key, TRUE, &changed, FALSE);
@@ -633,7 +649,7 @@ gdm_config_reload_string (gchar *key)
}
gboolean
-gdm_config_reload_int (gchar *key)
+gdm_config_reload_int (const gchar *key)
{
gboolean changed;
_gdm_config_get_int (key, TRUE, &changed);
@@ -641,7 +657,7 @@ gdm_config_reload_int (gchar *key)
}
gboolean
-gdm_config_reload_bool (gchar *key)
+gdm_config_reload_bool (const gchar *key)
{
gboolean changed;
_gdm_config_get_bool (key, TRUE, &changed);
@@ -649,28 +665,37 @@ gdm_config_reload_bool (gchar *key)
}
void
-gdm_save_customlist_data (gchar *file, gchar *key, gchar *id)
+gdm_save_customlist_data (const gchar *file,
+ const gchar *key,
+ const gchar *id)
{
- VeConfig *cfg;
- cfg = ve_config_get (file);
- g_free (file);
- ve_config_set_string (cfg, key, ve_sure_string (id));
- ve_config_save (cfg, FALSE);
+ GKeyFile *cfg;
+
+ cfg = gdm_common_config_load (file, NULL);
+ gdm_common_config_set_string (cfg, key, ve_sure_string (id));
+ gdm_common_config_save (cfg, file, NULL);
+
+ g_key_file_free (cfg);
}
gchar *
-gdm_get_theme_greeter (gchar *file, const char *fallback)
+gdm_get_theme_greeter (const gchar *file,
+ const char *fallback)
{
- VeConfig *config = ve_config_new (file);
+ GKeyFile *config;
gchar *s;
- s = ve_config_get_translated_string (config, "GdmGreeterTheme/Greeter");
+ config = gdm_common_config_load (file, NULL);
+ s = NULL;
+ gdm_common_config_get_translated_string (config, "GdmGreeterTheme/Greeter", &s, NULL);
if (s == NULL || s[0] == '\0') {
g_free (s);
s = g_strdup_printf ("%s.xml", fallback);
}
+ g_key_file_free (config);
+
return s;
}
diff --git a/gui/gdmconfig.h b/gui/gdmconfig.h
index 37f8466e..44044931 100644
--- a/gui/gdmconfig.h
+++ b/gui/gdmconfig.h
@@ -1,46 +1,45 @@
/*
* GDM - THe GNOME Display Manager
* Copyright (C) 2001 Queen of England, (c)2002 George Lebl
- *
+ *
* GDMcommunication routines
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
+ *
*/
-#ifndef GDMCONFIG_H
-#define GDMCONFIG_H
+#ifndef _GDMCONFIG_H
+#define _GDMCONFIG_H
-#include "ve-misc.h"
-#include "ve-miscui.h"
+#include "glib.h"
void gdm_config_never_cache (gboolean never_cache);
void gdm_config_set_comm_retries (int tries);
-gchar * gdm_config_get_string (gchar *key);
-gchar * gdm_config_get_translated_string (gchar *key);
-gint gdm_config_get_int (gchar *key);
-gboolean gdm_config_get_bool (gchar *key);
-gboolean gdm_config_reload_string (gchar *key);
-gboolean gdm_config_reload_int (gchar *key);
-gboolean gdm_config_reload_bool (gchar *key);
+gchar * gdm_config_get_string (const gchar *key);
+gchar * gdm_config_get_translated_string (const gchar *key);
+gint gdm_config_get_int (const gchar *key);
+gboolean gdm_config_get_bool (const gchar *key);
+gboolean gdm_config_reload_string (const gchar *key);
+gboolean gdm_config_reload_int (const gchar *key);
+gboolean gdm_config_reload_bool (const gchar *key);
GSList * gdm_config_get_xservers (gboolean flexible);
-void gdm_save_customlist_data (gchar *file,
- gchar *key,
- gchar *id);
-char * gdm_get_theme_greeter (gchar *file,
+void gdm_save_customlist_data (const gchar *file,
+ const gchar *key,
+ const gchar *id);
+char * gdm_get_theme_greeter (const gchar *file,
const char *fallback);
-#endif /* GDMCONFIG_H */
+#endif /* _GDMCONFIG_H */
diff --git a/gui/gdmdynamic.c b/gui/gdmdynamic.c
index 43fb97b8..4bf1ff31 100644
--- a/gui/gdmdynamic.c
+++ b/gui/gdmdynamic.c
@@ -1,4 +1,5 @@
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
* GDMcommunication routines
* (c)2001 Queen of England, (c)2002,2003 George Lebl
*
@@ -40,6 +41,8 @@
#include "gdmcommon.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
static char *myname = NULL; /* name of this program */
static void
diff --git a/gui/gdmflexiserver.c b/gui/gdmflexiserver.c
index ce166c14..3f638b8d 100644
--- a/gui/gdmflexiserver.c
+++ b/gui/gdmflexiserver.c
@@ -41,7 +41,8 @@
#include "gdmcomm.h"
#include "gdmcommon.h"
#include "gdmconfig.h"
-#include "gdmconfig.h"
+
+#include "gdm-common.h"
static GSList *xservers = NULL;
static const char *send_command = NULL;
@@ -93,6 +94,32 @@ get_cur_vt (void)
return cur_vt;
}
+static GtkWidget *
+hig_dialog_new (GtkWindow *parent,
+ GtkDialogFlags flags,
+ GtkMessageType type,
+ GtkButtonsType buttons,
+ const gchar *primary_message,
+ const gchar *secondary_message)
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ type,
+ buttons,
+ "%s", primary_message);
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ "%s", secondary_message);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), "");
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
+
+ return dialog;
+}
+
/* change to an existing vt */
static void
change_vt (int vt)
@@ -107,14 +134,12 @@ change_vt (int vt)
GtkWidget *dialog;
const char *message = gdmcomm_get_error_message (ret, use_xnest);
- dialog = ve_hig_dialog_new
- (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot change display"),
- message);
-
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot change display"),
+ message);
gtk_widget_show_all (dialog);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -123,6 +148,17 @@ change_vt (int vt)
}
static int
+vector_len (char * const *v)
+{
+ int i;
+ if (v == NULL)
+ return 0;
+ for (i = 0; v[i] != NULL; i++)
+ ;
+ return i;
+}
+
+static int
get_vt_num (char **vec, char *vtpart, int depth)
{
int i;
@@ -136,8 +172,7 @@ get_vt_num (char **vec, char *vtpart, int depth)
for (i = 0; vec[i] != NULL; i++) {
char **rvec;
rvec = g_strsplit (vec[i], ",", -1);
- if (rvec == NULL ||
- ve_vector_len (rvec) != 3)
+ if (rvec == NULL || vector_len (rvec) != 3)
continue;
if (strcmp (rvec[0], vtpart) == 0) {
@@ -177,8 +212,7 @@ create_model (char **vec)
char **rvec;
int vt;
rvec = g_strsplit (vec[i], ",", -1);
- if (rvec == NULL ||
- ve_vector_len (rvec) != 3)
+ if (rvec == NULL || vector_len (rvec) != 3)
continue;
vt = get_vt_num (vec, rvec[2], 5);
@@ -380,7 +414,7 @@ run_logged_in_dialogue (char **vec)
if (startnew == TRUE) {
/* Just return if the user doesn't want to see the dialog */
return;
- }
+ }
dialog = gtk_dialog_new_with_buttons (_("Open Displays"),
NULL /* parent */,
@@ -516,8 +550,7 @@ check_for_users (void)
char **rvec;
int vt;
rvec = g_strsplit (vec[i], ",", -1);
- if (rvec == NULL ||
- ve_vector_len (rvec) != 3)
+ if (rvec == NULL || vector_len (rvec) != 3)
continue;
vt = get_vt_num (vec, rvec[2], 5);
@@ -779,15 +812,14 @@ main (int argc, char *argv[])
g_print ("%s\n", ret);
return 0;
} else {
- dialog = ve_hig_dialog_new
- (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot communicate with GDM "
- "(The GNOME Display Manager)"),
- _("Perhaps you have an old version "
- "of GDM running."));
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot communicate with GDM "
+ "(The GNOME Display Manager)"),
+ _("Perhaps you have an old version "
+ "of GDM running."));
gtk_widget_show_all (dialog);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -828,17 +860,15 @@ main (int argc, char *argv[])
/* At this point we are done using the socket, so close it */
gdmcomm_comm_bulk_stop ();
- dialog = ve_hig_dialog_new
- (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("You do not seem to have the "
- "authentication needed for this "
- "operation"),
- _("Perhaps your .Xauthority "
- "file is not set up correctly."));
-
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("You do not seem to have the "
+ "authentication needed for this "
+ "operation"),
+ _("Perhaps your .Xauthority "
+ "file is not set up correctly."));
gtk_widget_show_all (dialog);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -858,15 +888,14 @@ main (int argc, char *argv[])
/* At this point we are done using the socket, so close it */
gdmcomm_comm_bulk_stop ();
- dialog = ve_hig_dialog_new
- (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("You do not seem to be logged in on the "
- "console"),
- _("Starting a new login only "
- "works correctly on the console."));
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("You do not seem to be logged in on the "
+ "console"),
+ _("Starting a new login only "
+ "works correctly on the console."));
gtk_dialog_set_has_separator (GTK_DIALOG (dialog),
FALSE);
gtk_widget_show_all (dialog);
@@ -908,13 +937,12 @@ main (int argc, char *argv[])
message = gdmcomm_get_error_message (ret, use_xnest);
- dialog = ve_hig_dialog_new
- (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot start new display"),
- message);
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot start new display"),
+ message);
gtk_widget_show_all (dialog);
gtk_dialog_run (GTK_DIALOG (dialog));
diff --git a/gui/gdmlanguages.c b/gui/gdmlanguages.c
index 431c3915..b55db2c6 100644
--- a/gui/gdmlanguages.c
+++ b/gui/gdmlanguages.c
@@ -1,4 +1,6 @@
-/* GDM - The GNOME Display Manager
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * GDM - The GNOME Display Manager
* Copyright (C) 1999, 2000 Martin K. Petersen <mkp@mkp.net>
*
* This file Copyright (c) 2001 George Lebl
@@ -28,6 +30,8 @@
#include "gdmlanguages.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
typedef struct _Language Language;
struct _Language {
char *name;
diff --git a/gui/gdmlogin.c b/gui/gdmlogin.c
index bb317f4b..2a3da97b 100644
--- a/gui/gdmlogin.c
+++ b/gui/gdmlogin.c
@@ -51,8 +51,6 @@
#define PW_ENTRY_SIZE GDM_MAX_PASS
#endif
-#include "vicious.h"
-
#include "gdm.h"
#include "gdmuser.h"
#include "gdmcomm.h"
@@ -63,6 +61,8 @@
#include "gdmconfig.h"
#include "misc.h"
+#include "gdm-common.h"
+
/* set the DOING_GDM_DEVELOPMENT env variable if you aren't running
* within the protocol */
static gboolean DOING_GDM_DEVELOPMENT = FALSE;
@@ -314,7 +314,33 @@ back_prog_launch_after_timeout ()
NULL);
}
-/*
+static GtkWidget *
+hig_dialog_new (GtkWindow *parent,
+ GtkDialogFlags flags,
+ GtkMessageType type,
+ GtkButtonsType buttons,
+ const gchar *primary_message,
+ const gchar *secondary_message)
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ type,
+ buttons,
+ "%s", primary_message);
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ "%s", secondary_message);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), "");
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
+
+ return dialog;
+}
+
+/*
* This function starts the background program (if any).
*/
static void
@@ -337,9 +363,10 @@ back_prog_run (void)
/* Focus new windows. We want to give focus to the background program. */
gdm_wm_focus_new_windows (TRUE);
-
- back_prog_argv = ve_split (command);
-
+
+ back_prog_argv = NULL;
+ g_shell_parse_argv (command, NULL, &back_prog_argv, NULL);
+
/* Don't reap child automatically: we want to catch the event. */
if (! g_spawn_async (".",
back_prog_argv,
@@ -358,12 +385,12 @@ back_prog_run (void)
command,
error->message);
- dialog = ve_hig_dialog_new (NULL,
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot start background application"),
- msg);
+ dialog = hig_dialog_new (NULL,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot start background application"),
+ msg);
g_free (msg);
gtk_widget_show_all (dialog);
@@ -1680,12 +1707,12 @@ process_operation (guchar op_code,
gdm_wm_focus_new_windows (TRUE);
tmp = ve_locale_to_utf8 (args);
- dlg = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- tmp,
- "");
+ dlg = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ tmp,
+ "");
g_free (tmp);
gdm_wm_center_window (GTK_WINDOW (dlg));
@@ -1849,15 +1876,15 @@ process_operation (guchar op_code,
/* we should be now fine for focusing new windows */
gdm_wm_focus_new_windows (TRUE);
- dlg = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_OK,
- /* translators: This is a nice and evil eggie text, translate
- * to your favourite currency */
- _("Please insert 25 cents "
- "to log in."),
- "");
+ dlg = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK,
+ /* translators: This is a nice and evil eggie text, translate
+ * to your favourite currency */
+ _("Please insert 25 cents "
+ "to log in."),
+ "");
gdm_wm_center_window (GTK_WINDOW (dlg));
gdm_wm_no_login_focus_push ();
@@ -1877,12 +1904,12 @@ process_operation (guchar op_code,
/* we should be now fine for focusing new windows */
gdm_wm_focus_new_windows (TRUE);
- dlg = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_OK,
- oldtext,
- "");
+ dlg = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK,
+ oldtext,
+ "");
gtk_window_set_modal (GTK_WINDOW (dlg), TRUE);
gdm_wm_center_window (GTK_WINDOW (dlg));
@@ -3433,12 +3460,12 @@ main (int argc, char *argv[])
"Please restart the GDM daemon or the computer."),
VERSION);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot start the greeter"),
- msg);
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot start the greeter"),
+ msg);
g_free (msg);
gtk_widget_show_all (dialog);
@@ -3467,12 +3494,12 @@ main (int argc, char *argv[])
"Please restart the GDM daemon or the computer."),
VERSION);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_NONE,
- _("Cannot start the greeter"),
- msg);
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ _("Cannot start the greeter"),
+ msg);
g_free (msg);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
@@ -3515,12 +3542,12 @@ main (int argc, char *argv[])
"Please restart the GDM daemon or the computer."),
VERSION, gdm_version);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_NONE,
- _("Cannot start the greeter"),
- msg);
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ _("Cannot start the greeter"),
+ msg);
g_free (msg);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
@@ -3730,14 +3757,14 @@ main (int argc, char *argv[])
gdm_wm_focus_new_windows (TRUE);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Session directory is missing"),
- _("Your session directory is missing or empty! "
- "There are two available sessions you can use, but "
- "you should log in and correct the GDM configuration."));
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Session directory is missing"),
+ _("Your session directory is missing or empty! "
+ "There are two available sessions you can use, but "
+ "you should log in and correct the GDM configuration."));
gtk_widget_show_all (dialog);
gdm_wm_center_window (GTK_WINDOW (dialog));
@@ -3754,14 +3781,14 @@ main (int argc, char *argv[])
gdm_wm_focus_new_windows (TRUE);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Configuration is not correct"),
- _("The configuration file contains an invalid command "
- "line for the login dialog, so running the "
- "default command. Please fix your configuration."));
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Configuration is not correct"),
+ _("The configuration file contains an invalid command "
+ "line for the login dialog, so running the "
+ "default command. Please fix your configuration."));
gtk_widget_show_all (dialog);
gdm_wm_center_window (GTK_WINDOW (dialog));
diff --git a/gui/gdmphotosetup.c b/gui/gdmphotosetup.c
index 881a793a..4f1e0262 100644
--- a/gui/gdmphotosetup.c
+++ b/gui/gdmphotosetup.c
@@ -38,7 +38,6 @@
#include "gdmcomm.h"
#include "gdmcommon.h"
#include "gdmconfig.h"
-#include "ve-miscui.h"
static GladeXML *xml;
static char *photofile;
@@ -163,6 +162,32 @@ update_preview_cb (GtkFileChooser *chooser)
gtk_file_chooser_set_preview_widget_active (chooser, TRUE);
}
+static GtkWidget *
+hig_dialog_new (GtkWindow *parent,
+ GtkDialogFlags flags,
+ GtkMessageType type,
+ GtkButtonsType buttons,
+ const gchar *primary_message,
+ const gchar *secondary_message)
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ type,
+ buttons,
+ "%s", primary_message);
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ "%s", secondary_message);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), "");
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
+
+ return dialog;
+}
+
static void
set_face_from_filename (const char *filename)
{
@@ -184,16 +209,16 @@ set_face_from_filename (const char *filename)
GtkWidget *d;
char *tmp = g_filename_to_utf8 (photofile, -1, NULL, NULL, NULL);
char *msg;
-
+
msg = g_strdup_printf (_("File %s cannot be opened for "
"writing."), tmp);
- d = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot open file"),
- msg);
+ d = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot open file"),
+ msg);
gtk_dialog_run (GTK_DIALOG (d));
gtk_widget_destroy (d);
diff --git a/gui/gdmsession.c b/gui/gdmsession.c
index 40253976..537fc5d5 100644
--- a/gui/gdmsession.c
+++ b/gui/gdmsession.c
@@ -1,4 +1,6 @@
-/* GDM - The GNOME Display Manager
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * GDM - The GNOME Display Manager
* Copyright (C) 1999, 2000 Martin K. Petersen <mkp@mkp.net>
*
* This file Copyright (c) 2003 George Lebl
@@ -26,13 +28,13 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include "vicious.h"
-
#include "gdm.h"
#include "gdmsession.h"
#include "gdmcommon.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
GHashTable *sessnames = NULL;
gchar *default_session = NULL;
const gchar *current_session = NULL;
@@ -178,12 +180,13 @@ _gdm_session_list_init (GHashTable **sessnames, GList **sessions,
dent = NULL;
while (dent != NULL) {
- VeConfig *cfg;
+ GKeyFile *cfg;
char *exec;
char *comment;
char *s;
char *tryexec;
char *ext;
+ gboolean hidden;
/* ignore everything but the .desktop files */
ext = strstr (dent->d_name, ".desktop");
@@ -200,20 +203,23 @@ _gdm_session_list_init (GHashTable **sessnames, GList **sessions,
}
s = g_strconcat (dir, "/", dent->d_name, NULL);
- cfg = ve_config_new (s);
+ cfg = gdm_common_config_load (s, NULL);
g_free (s);
- if (ve_config_get_bool (cfg, "Desktop Entry/Hidden=false")) {
+ hidden = FALSE;
+ gdm_common_config_get_boolean (cfg, "Desktop Entry/Hidden=false", &hidden, NULL);
+ if (hidden) {
session = g_new0 (GdmSession, 1);
session->name = g_strdup (dent->d_name);
session->clearname = NULL;
g_hash_table_insert (*sessnames, g_strdup (dent->d_name), session);
- ve_config_destroy (cfg);
+ g_key_file_free (cfg);
dent = readdir (sessdir);
continue;
}
- tryexec = ve_config_get_string (cfg, "Desktop Entry/TryExec");
+ tryexec = NULL;
+ gdm_common_config_get_string (cfg, "Desktop Entry/TryExec", &tryexec, NULL);
if ( ! ve_string_empty (tryexec)) {
char **tryexecvec = g_strsplit (tryexec, " ", -1);
char *full = NULL;
@@ -229,7 +235,7 @@ _gdm_session_list_init (GHashTable **sessnames, GList **sessions,
g_hash_table_insert (*sessnames, g_strdup (dent->d_name),
session);
g_free (tryexec);
- ve_config_destroy (cfg);
+ g_key_file_free (cfg);
dent = readdir (sessdir);
continue;
}
@@ -238,11 +244,13 @@ _gdm_session_list_init (GHashTable **sessnames, GList **sessions,
}
g_free (tryexec);
- exec = ve_config_get_string (cfg, "Desktop Entry/Exec");
- name = ve_config_get_translated_string (cfg, "Desktop Entry/Name");
- comment = ve_config_get_translated_string (cfg, "Desktop Entry/Comment");
-
- ve_config_destroy (cfg);
+ exec = NULL;
+ name = NULL;
+ comment = NULL;
+ gdm_common_config_get_string (cfg, "Desktop Entry/Exec", &exec, NULL);
+ gdm_common_config_get_translated_string (cfg, "Desktop Entry/Name", &name, NULL);
+ gdm_common_config_get_translated_string (cfg, "Desktop Entry/Comment", &comment, NULL);
+ g_key_file_free (cfg);
if G_UNLIKELY (ve_string_empty (exec) || ve_string_empty (name)) {
session = g_new0 (GdmSession, 1);
diff --git a/gui/gdmsetup.c b/gui/gdmsetup.c
index 5789844e..ac2a62fb 100644
--- a/gui/gdmsetup.c
+++ b/gui/gdmsetup.c
@@ -1,4 +1,6 @@
-/* GDMSetup
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * GDMSetup
* Copyright (C) 2002, George Lebl
*
* This program is free software; you can redistribute it and/or modify
@@ -39,9 +41,6 @@
#include <glade/glade.h>
#include <glib/gi18n.h>
-#include "vicious.h"
-#include "viciousui.h"
-
#include "gdm.h"
#include "gdmcommon.h"
#include "misc.h"
@@ -50,6 +49,8 @@
#include "gdmsession.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
static char *GdmSoundProgram = NULL;
static gchar *GdmExclude = NULL;
static gchar *GdmInclude = NULL;
@@ -197,7 +198,9 @@ simple_spawn_sync (char **argv)
static void
setup_cursor (GdkCursorType type)
{
- GdkCursor *cursor = gdk_cursor_new (type);
+ GdkCursor *cursor;
+
+ cursor = gdk_cursor_new (type);
gdk_window_set_cursor (gdk_get_default_root_window (), cursor);
gdk_cursor_unref (cursor);
}
@@ -205,9 +208,11 @@ setup_cursor (GdkCursorType type)
static void
setup_window_cursor (GdkCursorType type)
{
- GdkCursor *cursor = gdk_cursor_new (type);
- GtkWidget *setup_dialog = glade_helper_get
- (xml, "setup_dialog", GTK_TYPE_WINDOW);
+ GdkCursor *cursor;
+ GtkWidget *setup_dialog;
+
+ cursor = gdk_cursor_new (type);
+ setup_dialog = glade_xml_get_widget (xml, "setup_dialog");
if (setup_dialog->window)
gdk_window_set_cursor (setup_dialog->window, cursor);
gdk_cursor_unref (cursor);
@@ -216,12 +221,39 @@ setup_window_cursor (GdkCursorType type)
static void
unsetup_window_cursor (void)
{
- GtkWidget *setup_dialog = glade_helper_get
- (xml, "setup_dialog", GTK_TYPE_WINDOW);
+ GtkWidget *setup_dialog;
+
+ setup_dialog = glade_xml_get_widget (xml, "setup_dialog");
if (setup_dialog->window)
gdk_window_set_cursor (setup_dialog->window, NULL);
}
+static GtkWidget *
+hig_dialog_new (GtkWindow *parent,
+ GtkDialogFlags flags,
+ GtkMessageType type,
+ GtkButtonsType buttons,
+ const gchar *primary_message,
+ const gchar *secondary_message)
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ type,
+ buttons,
+ "%s", primary_message);
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ "%s", secondary_message);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), "");
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
+
+ return dialog;
+}
+
static void
update_greeters (void)
{
@@ -271,20 +303,20 @@ update_greeters (void)
check_update_error:
if ( ! shown_error && have_error) {
- GtkWidget *setup_dialog = glade_helper_get
- (xml, "setup_dialog", GTK_TYPE_WINDOW);
- GtkWidget *dlg =
- ve_hig_dialog_new (GTK_WINDOW (setup_dialog),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("An error occurred while "
- "trying to contact the "
- "login screens. Not all "
- "updates may have taken "
- "effect."),
- "");
+ GtkWidget *setup_dialog;
+ GtkWidget *dlg;
+ setup_dialog = glade_xml_get_widget (xml, "setup_dialog");
+ dlg = hig_dialog_new (GTK_WINDOW (setup_dialog),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("An error occurred while "
+ "trying to contact the "
+ "login screens. Not all "
+ "updates may have taken "
+ "effect."),
+ "");
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg);
@@ -350,60 +382,81 @@ update_key (const char *key)
}
}
-static void
+static void
gdm_setup_config_set_bool (const char *key, gboolean val)
{
- VeConfig *cfg = ve_config_get (config_file);
- VeConfig *custom_cfg = ve_config_get (custom_config_file);
- gboolean defaultval = ve_config_get_bool (cfg, key);
+ GKeyFile *cfg;
+ GKeyFile *custom_cfg;
+ gboolean defaultval;
+
+ cfg = gdm_common_config_load (config_file, NULL);
+ custom_cfg = gdm_common_config_load (custom_config_file, NULL);
+ gdm_common_config_get_boolean (cfg, key, &defaultval, NULL);
if (val == defaultval) {
- ve_config_delete_key (custom_cfg, key);
+ gdm_common_config_remove_key (custom_cfg, key, NULL);
} else {
- ve_config_set_bool (custom_cfg, key, val);
+ gdm_common_config_set_boolean (custom_cfg, key, val);
}
- ve_config_save (custom_cfg, FALSE /* force */);
+ gdm_common_config_save (custom_cfg, custom_config_file, NULL);
+
+ g_key_file_free (cfg);
+ g_key_file_free (custom_cfg);
update_key (key);
}
-static void
+static void
gdm_setup_config_set_int (const char *key, int val)
{
- VeConfig *cfg = ve_config_get (config_file);
- VeConfig *custom_cfg = ve_config_get (custom_config_file);
- int defaultval = ve_config_get_int (cfg, key);
+ GKeyFile *cfg;
+ GKeyFile *custom_cfg;
+ int defaultval;
+
+ cfg = gdm_common_config_load (config_file, NULL);
+ custom_cfg = gdm_common_config_load (custom_config_file, NULL);
+ gdm_common_config_get_int (cfg, key, &defaultval, NULL);
if (val == defaultval) {
- ve_config_delete_key (custom_cfg, key);
+ gdm_common_config_remove_key (custom_cfg, key, NULL);
} else {
- ve_config_set_int (custom_cfg, key, val);
+ gdm_common_config_set_int (custom_cfg, key, val);
}
- ve_config_save (custom_cfg, FALSE /* force */);
+ gdm_common_config_save (custom_cfg, custom_config_file, NULL);
+
+ g_key_file_free (cfg);
+ g_key_file_free (custom_cfg);
update_key (key);
}
-static void
+static void
gdm_setup_config_set_string (const char *key, gchar *val)
{
- VeConfig *cfg = ve_config_get (config_file);
- VeConfig *custom_cfg = ve_config_get (custom_config_file);
- gchar *defaultval = ve_config_get_string (cfg, key);
+ GKeyFile *cfg;
+ GKeyFile *custom_cfg;
+ char *defaultval;
+
+ cfg = gdm_common_config_load (config_file, NULL);
+ custom_cfg = gdm_common_config_load (custom_config_file, NULL);
+ gdm_common_config_get_string (cfg, key, &defaultval, NULL);
if (defaultval != NULL &&
strcmp (ve_sure_string (val), ve_sure_string (defaultval)) == 0) {
- ve_config_delete_key (custom_cfg, key);
+ gdm_common_config_remove_key (custom_cfg, key, NULL);
} else {
- ve_config_set_string (custom_cfg, key, val);
+ gdm_common_config_set_string (custom_cfg, key, val);
}
if (defaultval)
g_free (defaultval);
- ve_config_save (custom_cfg, FALSE /* force */);
+ gdm_common_config_save (custom_cfg, custom_config_file, NULL);
+
+ g_key_file_free (cfg);
+ g_key_file_free (custom_cfg);
update_key (key);
}
@@ -459,14 +512,12 @@ toggle_timeout (GtkWidget *toggle)
gchar *filename;
GtkWidget *file_chooser;
- file_chooser = glade_helper_get (xml, "global_face_dir_filechooser",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
+ file_chooser = glade_xml_get_widget (xml, "global_face_dir_filechooser");
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser));
-
- if (strcmp (ve_sure_string (gdm_config_get_string ((char*)key)),
- ve_sure_string (filename)) != 0)
+ if (strcmp (ve_sure_string (gdm_config_get_string ((char*)key)),
+ ve_sure_string (filename)) != 0)
gdm_setup_config_set_string (key, ve_sure_string (filename));
-
+
g_free (filename);
}
else
@@ -480,8 +531,8 @@ toggle_timeout (GtkWidget *toggle)
gchar *filename;
GtkWidget *file_chooser;
- file_chooser = glade_helper_get (xml, "default_face_filechooser",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
+ file_chooser = glade_xml_get_widget (xml, "default_face_filechooser");
+
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser));
if (strcmp (ve_sure_string (gdm_config_get_string ((char*)key)),
@@ -501,8 +552,8 @@ toggle_timeout (GtkWidget *toggle)
gchar *filename;
GtkWidget *file_chooser;
- file_chooser = glade_helper_get (xml, "gtkrc_chooserbutton",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
+ file_chooser = glade_xml_get_widget (xml, "gtkrc_chooserbutton");
+
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser));
if (strcmp (ve_sure_string (gdm_config_get_string ((char*)key)),
@@ -525,8 +576,7 @@ toggle_timeout (GtkWidget *toggle)
gchar *new_val = NULL;
GtkWidget *default_session_combobox;
- default_session_combobox = glade_helper_get (xml, "default_session_combobox",
- GTK_TYPE_COMBO_BOX);
+ default_session_combobox = glade_xml_get_widget (xml, "default_session_combobox");
selected = gtk_combo_box_get_active (GTK_COMBO_BOX (default_session_combobox));
@@ -575,10 +625,8 @@ command_toggle_timeout (GtkWidget *toggle)
gint selected, i;
val = GTK_TOGGLE_BUTTON (toggle)->active;
- apply_cmd_changes = glade_helper_get (xml_commands, "command_apply_button", GTK_TYPE_BUTTON);
- command_combobox = glade_helper_get (xml_commands,
- "cmd_type_combobox",
- GTK_TYPE_COMBO_BOX);
+ apply_cmd_changes = glade_xml_get_widget (xml_commands, "command_apply_button");
+ command_combobox = glade_xml_get_widget (xml_commands, "cmd_type_combobox");
selected = gtk_combo_box_get_active (GTK_COMBO_BOX (command_combobox));
@@ -613,8 +661,7 @@ logo_toggle_timeout (GtkWidget *toggle)
GtkWidget *chooserbutton;
gchar *filename;
- chooserbutton = glade_helper_get (xml, "local_logo_image_chooserbutton",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
+ chooserbutton = glade_xml_get_widget (xml, "local_logo_image_chooserbutton");
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooserbutton));
@@ -638,8 +685,7 @@ logo_toggle_toggled (GtkWidget *toggle, gpointer data)
GtkWidget *checkbutton;
- checkbutton = glade_helper_get (xml, "remote_logo_image_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
+ checkbutton = glade_xml_get_widget (xml, "remote_logo_image_checkbutton");
g_signal_handlers_disconnect_by_func (checkbutton,
(gpointer) logo_toggle_toggled,
@@ -654,8 +700,7 @@ logo_toggle_toggled (GtkWidget *toggle, gpointer data)
else {
GtkWidget *checkbutton;
- checkbutton = glade_helper_get (xml, "local_logo_image_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
+ checkbutton = glade_xml_get_widget (xml, "local_logo_image_checkbutton");
g_signal_handlers_disconnect_by_func (checkbutton,
(gpointer) logo_toggle_toggled,
@@ -722,22 +767,22 @@ intspin_timeout (GtkWidget *spin)
GtkTreeIter iter;
GtkWidget *setup_dialog;
- setup_dialog = glade_helper_get(xml, "setup_dialog", GTK_TYPE_WINDOW);
+ setup_dialog = glade_xml_get_widget(xml, "setup_dialog");
//Inform user about the change and its implications
- dlg = ve_hig_dialog_new (GTK_WINDOW (setup_dialog),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- _("Users include list modification"),
- _("Some of the users in the Include list "
- "(Users tab) now have uid lower than "
- "MinimalUID and will be removed."));
+ dlg = hig_dialog_new (GTK_WINDOW (setup_dialog),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ _("Users include list modification"),
+ _("Some of the users in the Include list "
+ "(Users tab) now have uid lower than "
+ "MinimalUID and will be removed."));
gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg);
- include_treeview = glade_helper_get (xml, "fb_include_treeview",
- GTK_TYPE_TREE_VIEW);
+ include_treeview = glade_xml_get_widget (xml, "fb_include_treeview");
+
include_model = gtk_tree_view_get_model (GTK_TREE_VIEW (include_treeview));
valid = gtk_tree_model_get_iter_first (include_model, &iter);
@@ -812,81 +857,86 @@ static GSList *displays_inactive = NULL;
static GHashTable *dispval_hash = NULL;
static void
-gdm_load_displays (VeConfig *cfg, GList *list )
-{
- GList *li;
- GSList *li2;
-
- for (li = list; li != NULL; li = li->next) {
- const gchar *key = li->data;
-
- if (isdigit (*key)) {
- gchar *fullkey;
- gchar *dispval;
- int keynum = atoi (key);
- gboolean skip_entry = FALSE;
-
- fullkey = g_strdup_printf ("%s/%s", GDM_KEY_SECTION_SERVERS, key);
- dispval = ve_config_get_string (cfg, fullkey);
- g_free (fullkey);
-
- /* Do not add if already in the list */
- for (li2 = displays; li2 != NULL; li2 = li2->next) {
- gchar *disp = li2->data;
- if (atoi (disp) == keynum) {
- skip_entry = TRUE;
- break;
- }
- }
-
- /* Do not add if this display was marked as inactive already */
- for (li2 = displays_inactive; li2 != NULL; li2 = li2->next) {
- gchar *disp = li2->data;
- if (atoi (disp) == keynum) {
- skip_entry = TRUE;
- break;
- }
- }
-
- if (skip_entry == TRUE) {
- g_free (dispval);
- continue;
- }
+gdm_load_displays (GKeyFile *cfg,
+ char **keys)
+{
+ GSList *li2;
+ int i;
+
+ for (i = 0; keys[i] != NULL; i++) {
+ const gchar *key = keys[i];
- if (g_ascii_strcasecmp (ve_sure_string (dispval), "inactive") == 0) {
- displays_inactive = g_slist_append (displays_inactive, g_strdup (key));
- } else {
- if (dispval_hash == NULL)
- dispval_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ if (isdigit (*key)) {
+ gchar *fullkey;
+ gchar *dispval;
+ int keynum = atoi (key);
+ gboolean skip_entry = FALSE;
- displays = g_slist_insert_sorted (displays, g_strdup (key), (GCompareFunc) display_sort_func);
- g_hash_table_insert (dispval_hash, g_strdup (key), g_strdup (dispval));
- }
+ fullkey = g_strdup_printf ("%s/%s", GDM_KEY_SECTION_SERVERS, key);
+ gdm_common_config_get_string (cfg, fullkey, &dispval, NULL);
+ g_free (fullkey);
- g_free (dispval);
- }
- }
+ /* Do not add if already in the list */
+ for (li2 = displays; li2 != NULL; li2 = li2->next) {
+ gchar *disp = li2->data;
+ if (atoi (disp) == keynum) {
+ skip_entry = TRUE;
+ break;
+ }
+ }
+
+ /* Do not add if this display was marked as inactive already */
+ for (li2 = displays_inactive; li2 != NULL; li2 = li2->next) {
+ gchar *disp = li2->data;
+ if (atoi (disp) == keynum) {
+ skip_entry = TRUE;
+ break;
+ }
+ }
+
+ if (skip_entry == TRUE) {
+ g_free (dispval);
+ continue;
+ }
+
+ if (g_ascii_strcasecmp (ve_sure_string (dispval), "inactive") == 0) {
+ displays_inactive = g_slist_append (displays_inactive, g_strdup (key));
+ } else {
+ if (dispval_hash == NULL)
+ dispval_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+ displays = g_slist_insert_sorted (displays, g_strdup (key), (GCompareFunc) display_sort_func);
+ g_hash_table_insert (dispval_hash, g_strdup (key), g_strdup (dispval));
+ }
+
+ g_free (dispval);
+ }
+ }
}
-static void
+static void
xservers_get_displays (GtkListStore *store)
{
/* Find server definitions */
- VeConfig *custom_cfg = ve_config_get (custom_config_file);
- VeConfig *cfg = ve_config_get (config_file);
- GList *list;
+ GKeyFile *custom_cfg;
+ GKeyFile *cfg;
+ char **keys;
GSList *li;
gchar *server, *options;
+ custom_cfg = gdm_common_config_load (custom_config_file, NULL);
+ cfg = gdm_common_config_load (config_file, NULL);
+
/* Fill list with all the active displays */
- if (custom_cfg) {
- list = ve_config_get_keys (custom_cfg, GDM_KEY_SECTION_SERVERS);
- gdm_load_displays (custom_cfg, list);
- ve_config_free_list_of_strings (list);
+ if (custom_cfg != NULL) {
+ keys = g_key_file_get_keys (custom_cfg, GDM_KEY_SECTION_SERVERS, NULL, NULL);
+ gdm_load_displays (custom_cfg, keys);
+ g_strfreev (keys);
}
- list = ve_config_get_keys (cfg, GDM_KEY_SECTION_SERVERS);
- gdm_load_displays (cfg, list);
- ve_config_free_list_of_strings (list);
+
+ keys = g_key_file_get_keys (cfg, GDM_KEY_SECTION_SERVERS, NULL, NULL);
+ gdm_load_displays (cfg, keys);
+ g_strfreev (keys);
for (li = displays; li != NULL; li = li->next) {
GtkTreeIter iter;
@@ -933,10 +983,8 @@ xserver_update_delete_sensitivity ()
gboolean valid;
gint i;
- modify_combobox = glade_helper_get (xml_xservers, "xserver_mod_combobox",
- GTK_TYPE_COMBO_BOX);
- delete_button = glade_helper_get (xml_xservers, "xserver_deletebutton",
- GTK_TYPE_BUTTON);
+ modify_combobox = glade_xml_get_widget (xml_xservers, "xserver_mod_combobox");
+ delete_button = glade_xml_get_widget (xml_xservers, "xserver_deletebutton");
/* Get list of servers that are set to start */
store = gtk_list_store_new (XSERVER_NUM_COLUMNS,
@@ -993,20 +1041,13 @@ void init_servers_combobox (int index)
GtkListStore *store;
GdmXserver *xserver;
- mod_combobox = glade_helper_get (xml_xservers, "xserver_mod_combobox",
- GTK_TYPE_COMBO_BOX);
- name_entry = glade_helper_get (xml_xservers, "xserver_name_entry",
- GTK_TYPE_ENTRY);
- command_entry = glade_helper_get (xml_xservers, "xserver_command_entry",
- GTK_TYPE_ENTRY);
- style_combobox = glade_helper_get (xml_xservers, "xserver_style_combobox",
- GTK_TYPE_COMBO_BOX);
- handled_checkbutton = glade_helper_get (xml_xservers, "xserver_handled_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
- flexible_checkbutton = glade_helper_get (xml_xservers, "xserver_flexible_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
- priority_spinbutton = glade_helper_get(xml_xservers, "xserv_priority_spinbutton",
- GTK_TYPE_SPIN_BUTTON);
+ mod_combobox = glade_xml_get_widget (xml_xservers, "xserver_mod_combobox");
+ name_entry = glade_xml_get_widget (xml_xservers, "xserver_name_entry");
+ command_entry = glade_xml_get_widget (xml_xservers, "xserver_command_entry");
+ style_combobox = glade_xml_get_widget (xml_xservers, "xserver_style_combobox");
+ handled_checkbutton = glade_xml_get_widget (xml_xservers, "xserver_handled_checkbutton");
+ flexible_checkbutton = glade_xml_get_widget (xml_xservers, "xserver_flexible_checkbutton");
+ priority_spinbutton = glade_xml_get_widget(xml_xservers, "xserv_priority_spinbutton");
/* Get list of servers that are set to start */
store = gtk_list_store_new (XSERVER_NUM_COLUMNS,
@@ -1051,28 +1092,18 @@ update_remote_sensitivity (gboolean value)
GtkWidget *remote_theme_mode_hbox;
GtkWidget *remote_theme_select_hbox;
GtkWidget *sg_scale_background_remote_hbox;
-
- remote_background_color_hbox = glade_helper_get (xml, "remote_background_color_hbox",
- GTK_TYPE_HBOX);
- remote_background_image_hhox = glade_helper_get (xml, "remote_background_image_hhox",
- GTK_TYPE_HBOX);
- remote_background_image_checkbutton = glade_helper_get (xml, "remote_background_image_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
- remote_background_image_chooserbutton = glade_helper_get (xml, "remote_background_image_chooserbutton",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
- remote_logo_image_checkbutton = glade_helper_get (xml, "remote_logo_image_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
- remote_plain_logo_hbox = glade_helper_get (xml, "remote_plain_logo_hbox",
- GTK_TYPE_HBOX);
- remote_theme_background_hbox = glade_helper_get (xml, "remote_theme_background_hbox",
- GTK_TYPE_TABLE);
- remote_theme_mode_hbox = glade_helper_get (xml, "remote_theme_mode_hbox",
- GTK_TYPE_HBOX);
- remote_theme_select_hbox = glade_helper_get (xml, "remote_theme_select_hbox",
- GTK_TYPE_HBOX);
- sg_scale_background_remote_hbox = glade_helper_get (xml, "sg_scale_background_remote_hbox",
- GTK_TYPE_HBOX);
-
+
+ remote_background_color_hbox = glade_xml_get_widget (xml, "remote_background_color_hbox");
+ remote_background_image_hhox = glade_xml_get_widget (xml, "remote_background_image_hhox");
+ remote_background_image_checkbutton = glade_xml_get_widget (xml, "remote_background_image_checkbutton");
+ remote_background_image_chooserbutton = glade_xml_get_widget (xml, "remote_background_image_chooserbutton");
+ remote_logo_image_checkbutton = glade_xml_get_widget (xml, "remote_logo_image_checkbutton");
+ remote_plain_logo_hbox = glade_xml_get_widget (xml, "remote_plain_logo_hbox");
+ remote_theme_background_hbox = glade_xml_get_widget (xml, "remote_theme_background_hbox");
+ remote_theme_mode_hbox = glade_xml_get_widget (xml, "remote_theme_mode_hbox");
+ remote_theme_select_hbox = glade_xml_get_widget (xml, "remote_theme_select_hbox");
+ sg_scale_background_remote_hbox = glade_xml_get_widget (xml, "sg_scale_background_remote_hbox");
+
gtk_widget_set_sensitive (remote_background_color_hbox, value);
gtk_widget_set_sensitive (remote_background_image_hhox, value);
gtk_widget_set_sensitive (remote_background_image_checkbutton, value);
@@ -1099,24 +1130,16 @@ refresh_remote_tab (void)
gchar *remote_style;
gint local_style;
- local_greeter = glade_helper_get (xml, "local_greeter",
- GTK_TYPE_COMBO_BOX);
- remote_greeter = glade_helper_get (xml, "remote_greeter",
- GTK_TYPE_COMBO_BOX);
- remote_plain_vbox = glade_helper_get (xml, "remote_plain_properties_vbox",
- GTK_TYPE_VBOX);
- remote_themed_vbox = glade_helper_get (xml, "remote_themed_properties_vbox",
- GTK_TYPE_VBOX);
- configure_xdmcp_vbox = glade_helper_get (xml, "remote_configure_xdmcp_vbox",
- GTK_TYPE_VBOX);
- welcome_message_vbox = glade_helper_get (xml, "remote_welcome_message_vbox",
- GTK_TYPE_VBOX);
- allowremoteroot = glade_helper_get (xml, "allowremoteroot",
- GTK_TYPE_BUTTON);
- allowremoteauto = glade_helper_get (xml, "allowremoteauto",
- GTK_TYPE_CHECK_BUTTON);
-
- /* Remove previously added items from the combobox */
+ local_greeter = glade_xml_get_widget (xml, "local_greeter");
+ remote_greeter = glade_xml_get_widget (xml, "remote_greeter");
+ remote_plain_vbox = glade_xml_get_widget (xml, "remote_plain_properties_vbox");
+ remote_themed_vbox = glade_xml_get_widget (xml, "remote_themed_properties_vbox");
+ configure_xdmcp_vbox = glade_xml_get_widget (xml, "remote_configure_xdmcp_vbox");
+ welcome_message_vbox = glade_xml_get_widget (xml, "remote_welcome_message_vbox");
+ allowremoteroot = glade_xml_get_widget (xml, "allowremoteroot");
+ allowremoteauto = glade_xml_get_widget (xml, "allowremoteauto");
+
+ /* Remove previously added items from the combobox */
gtk_combo_box_remove_text (GTK_COMBO_BOX (remote_greeter), REMOTE_PLAIN_WITH_FACE);
gtk_combo_box_remove_text (GTK_COMBO_BOX (remote_greeter), REMOTE_PLAIN);
@@ -1199,37 +1222,41 @@ refresh_remote_tab (void)
static void
update_xserver (gchar *section, GdmXserver *svr)
{
- VeConfig *custom_cfg = ve_config_get (custom_config_file);
- gchar *real_section = g_strdup_printf ("%s%s",
- GDM_KEY_SERVER_PREFIX, section);
+ GKeyFile *custom_cfg;
+ gchar *real_section;
gchar *key;
+ custom_cfg = gdm_common_config_load (custom_config_file, NULL);
+ real_section = g_strdup_printf ("%s%s", GDM_KEY_SERVER_PREFIX, section);
+
key = g_strconcat (real_section, "/" GDM_KEY_SERVER_NAME, NULL);
- ve_config_set_string (custom_cfg, key, svr->name);
+ gdm_common_config_set_string (custom_cfg, key, svr->name);
g_free (key);
key = g_strconcat (real_section, "/" GDM_KEY_SERVER_COMMAND, NULL);
- ve_config_set_string (custom_cfg, key, svr->command);
+ gdm_common_config_set_string (custom_cfg, key, svr->command);
g_free (key);
key = g_strconcat (real_section, "/", GDM_KEY_SERVER_CHOOSER, NULL);
- ve_config_set_bool (custom_cfg, key, svr->chooser);
+ gdm_common_config_set_boolean (custom_cfg, key, svr->chooser);
g_free (key);
key = g_strconcat (real_section, "/" GDM_KEY_SERVER_HANDLED, NULL);
- ve_config_set_bool (custom_cfg, key, svr->handled);
+ gdm_common_config_set_boolean (custom_cfg, key, svr->handled);
g_free (key);
key = g_strconcat (real_section, "/" GDM_KEY_SERVER_FLEXIBLE, NULL);
- ve_config_set_bool (custom_cfg, key, svr->flexible);
+ gdm_common_config_set_boolean (custom_cfg, key, svr->flexible);
g_free (key);
key = g_strconcat (real_section, "/" GDM_KEY_SERVER_PRIORITY, NULL);
- ve_config_set_int (custom_cfg, key, svr->priority);
+ gdm_common_config_set_int (custom_cfg, key, svr->priority);
g_free (key);
g_free (real_section);
- ve_config_save (custom_cfg, FALSE);
+ gdm_common_config_save (custom_cfg, custom_config_file, NULL);
+
+ g_key_file_free (custom_cfg);
update_key ("xservers/PARAMETERS");
}
@@ -1355,14 +1382,14 @@ combobox_timeout (GtkWidget *combo_box)
str = g_strdup (_("Autologin or timed login to the root account is forbidden."));
else
str = g_strdup_printf (_("The \"%s\" user UID is lower than allowed MinimalUID."), new_val);
- setup_dialog = glade_helper_get(xml, "setup_dialog", GTK_TYPE_WINDOW);
+ setup_dialog = glade_xml_get_widget(xml, "setup_dialog");
- dialog = ve_hig_dialog_new (GTK_WINDOW (setup_dialog),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("User not allowed"),
- str);
+ dialog = hig_dialog_new (GTK_WINDOW (setup_dialog),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("User not allowed"),
+ str);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
g_free (str);
@@ -1411,10 +1438,8 @@ combobox_timeout (GtkWidget *combo_box)
gchar *section;
gboolean val_old, val_new;
- mod_combobox = glade_helper_get (xml_xservers, "xserver_mod_combobox",
- GTK_TYPE_COMBO_BOX);
- style_combobox = glade_helper_get (xml_xservers, "xserver_style_combobox",
- GTK_TYPE_COMBO_BOX);
+ mod_combobox = glade_xml_get_widget (xml_xservers, "xserver_mod_combobox");
+ style_combobox = glade_xml_get_widget (xml_xservers, "xserver_style_combobox");
/* Get xserver section to update */
section = gtk_combo_box_get_active_text (GTK_COMBO_BOX (mod_combobox));
@@ -1466,12 +1491,9 @@ combobox_timeout (GtkWidget *combo_box)
gboolean bool_val = FALSE;
gboolean enabled_command = FALSE;
- hrs_cmd_entry = glade_helper_get (xml_commands, "hrs_cmd_path_entry",
- GTK_TYPE_ENTRY);
- cust_cmd_entry = glade_helper_get (xml_commands, "custom_cmd_path_entry",
- GTK_TYPE_ENTRY);
- status_label = glade_helper_get (xml_commands, "command_status_label",
- GTK_TYPE_LABEL);
+ hrs_cmd_entry = glade_xml_get_widget (xml_commands, "hrs_cmd_path_entry");
+ cust_cmd_entry = glade_xml_get_widget (xml_commands, "custom_cmd_path_entry");
+ status_label = glade_xml_get_widget (xml_commands, "command_status_label");
if (selected == HALT_CMD) {
val = gdm_config_get_string (GDM_KEY_HALT);
@@ -1501,46 +1523,40 @@ combobox_timeout (GtkWidget *combo_box)
g_free (val);
key_string = g_strdup_printf(_("%s%d="), GDM_KEY_CUSTOM_CMD_LABEL_TEMPLATE, i);
- cust_cmd_label_entry = glade_helper_get (xml_commands, "custom_cmd_label_entry",
- GTK_TYPE_ENTRY);
+ cust_cmd_label_entry = glade_xml_get_widget (xml_commands, "custom_cmd_label_entry");
val = gdm_config_get_string (key_string);
gtk_entry_set_text (GTK_ENTRY (cust_cmd_label_entry), ve_sure_string (val));
g_free (key_string);
g_free (val);
key_string = g_strdup_printf(_("%s%d="), GDM_KEY_CUSTOM_CMD_LR_LABEL_TEMPLATE, i);
- cust_cmd_lrlabel_entry = glade_helper_get (xml_commands, "custom_cmd_lrlabel_entry",
- GTK_TYPE_ENTRY);
+ cust_cmd_lrlabel_entry = glade_xml_get_widget (xml_commands, "custom_cmd_lrlabel_entry");
val = gdm_config_get_string (key_string);
gtk_entry_set_text (GTK_ENTRY (cust_cmd_lrlabel_entry), ve_sure_string (val));
g_free (key_string);
g_free (val);
key_string = g_strdup_printf(_("%s%d="), GDM_KEY_CUSTOM_CMD_TEXT_TEMPLATE, i);
- cust_cmd_text_entry = glade_helper_get (xml_commands, "custom_cmd_text_entry",
- GTK_TYPE_ENTRY);
+ cust_cmd_text_entry = glade_xml_get_widget (xml_commands, "custom_cmd_text_entry");
val = gdm_config_get_string (key_string);
gtk_entry_set_text (GTK_ENTRY (cust_cmd_text_entry), ve_sure_string (val));
g_free (key_string);
g_free (val);
key_string = g_strdup_printf(_("%s%d="), GDM_KEY_CUSTOM_CMD_TOOLTIP_TEMPLATE, i);
- cust_cmd_tooltip_entry = glade_helper_get (xml_commands, "custom_cmd_tooltip_entry",
- GTK_TYPE_ENTRY);
+ cust_cmd_tooltip_entry = glade_xml_get_widget (xml_commands, "custom_cmd_tooltip_entry");
val = gdm_config_get_string (key_string);
gtk_entry_set_text (GTK_ENTRY (cust_cmd_tooltip_entry), ve_sure_string (val));
g_free (key_string);
key_string = g_strdup_printf(_("%s%d="), GDM_KEY_CUSTOM_CMD_NO_RESTART_TEMPLATE, i);
- cust_cmd_norestart_checkbox = glade_helper_get (xml_commands, "custom_cmd_norestart_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
+ cust_cmd_norestart_checkbox = glade_xml_get_widget (xml_commands, "custom_cmd_norestart_checkbutton");
bool_val = gdm_config_get_bool (key_string);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cust_cmd_norestart_checkbox), bool_val);
g_free (key_string);
key_string = g_strdup_printf(_("%s%d="), GDM_KEY_CUSTOM_CMD_IS_PERSISTENT_TEMPLATE, i);
- cust_cmd_persistent_checkbox = glade_helper_get (xml_commands, "custom_cmd_persistent_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
+ cust_cmd_persistent_checkbox = glade_xml_get_widget (xml_commands, "custom_cmd_persistent_checkbutton");
bool_val = gdm_config_get_bool (key_string);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cust_cmd_persistent_checkbox), bool_val);
g_free (key_string);
@@ -1602,8 +1618,7 @@ list_selection_toggled (GtkWidget *toggle, gpointer data)
val = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle));
- include_treeview = glade_helper_get (xml, "fb_include_treeview",
- GTK_TYPE_TREE_VIEW);
+ include_treeview = glade_xml_get_widget (xml, "fb_include_treeview");
include_model = gtk_tree_view_get_model (GTK_TREE_VIEW (include_treeview));
selection = gtk_tree_view_get_selection (
@@ -1635,10 +1650,8 @@ combobox_changed (GtkWidget *combobox)
GtkWidget *local_themed_vbox;
gint selected;
- local_plain_vbox = glade_helper_get (xml, "local_plain_properties_vbox",
- GTK_TYPE_VBOX);
- local_themed_vbox = glade_helper_get (xml, "local_themed_properties_vbox",
- GTK_TYPE_VBOX);
+ local_plain_vbox = glade_xml_get_widget (xml, "local_plain_properties_vbox");
+ local_themed_vbox = glade_xml_get_widget (xml, "local_themed_properties_vbox");
selected = gtk_combo_box_get_active (GTK_COMBO_BOX (combobox));
@@ -1662,26 +1675,20 @@ combobox_changed (GtkWidget *combobox)
GtkWidget *configure_xdmcp_vbox;
GtkWidget *welcome_message_vbox;
gint selected;
-
- remote_plain_vbox = glade_helper_get (xml, "remote_plain_properties_vbox",
- GTK_TYPE_VBOX);
- remote_themed_vbox = glade_helper_get (xml, "remote_themed_properties_vbox",
- GTK_TYPE_VBOX);
- configure_xdmcp_vbox = glade_helper_get (xml, "remote_configure_xdmcp_vbox",
- GTK_TYPE_VBOX);
- welcome_message_vbox = glade_helper_get (xml, "remote_welcome_message_vbox",
- GTK_TYPE_VBOX);
-
+
+ remote_plain_vbox = glade_xml_get_widget (xml, "remote_plain_properties_vbox");
+ remote_themed_vbox = glade_xml_get_widget (xml, "remote_themed_properties_vbox");
+ configure_xdmcp_vbox = glade_xml_get_widget (xml, "remote_configure_xdmcp_vbox");
+ welcome_message_vbox = glade_xml_get_widget (xml, "remote_welcome_message_vbox");
+
selected = gtk_combo_box_get_active (GTK_COMBO_BOX (combobox));
if (selected == REMOTE_DISABLED) {
GtkWidget *allowremoteauto;
GtkWidget *allowremoteroot;
-
- allowremoteauto = glade_helper_get (xml, "allowremoteauto",
- GTK_TYPE_CHECK_BUTTON);
- allowremoteroot = glade_helper_get (xml, "allowremoteroot",
- GTK_TYPE_CHECK_BUTTON);
+
+ allowremoteauto = glade_xml_get_widget (xml, "allowremoteauto");
+ allowremoteroot = glade_xml_get_widget (xml, "allowremoteroot");
gtk_widget_set_sensitive (allowremoteauto, FALSE);
gtk_widget_set_sensitive (allowremoteroot, FALSE);
@@ -1696,12 +1703,9 @@ combobox_changed (GtkWidget *combobox)
GtkWidget *allowremoteauto;
GtkWidget *allowremoteroot;
- timedlogin = glade_helper_get (xml, "timedlogin",
- GTK_TYPE_CHECK_BUTTON);
- allowremoteauto = glade_helper_get (xml, "allowremoteauto",
- GTK_TYPE_CHECK_BUTTON);
- allowremoteroot = glade_helper_get (xml, "allowremoteroot",
- GTK_TYPE_CHECK_BUTTON);
+ timedlogin = glade_xml_get_widget (xml, "timedlogin");
+ allowremoteauto = glade_xml_get_widget (xml, "allowremoteauto");
+ allowremoteroot = glade_xml_get_widget (xml, "allowremoteroot");
gtk_widget_set_sensitive (allowremoteauto, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (timedlogin)));
gtk_widget_set_sensitive (allowremoteroot, TRUE);
@@ -1762,22 +1766,17 @@ combobox_changed (GtkWidget *combobox)
GtkTreeIter iter;
gint selected;
- theme_list = glade_helper_get (xml, "gg_theme_list",
- GTK_TYPE_TREE_VIEW);
- theme_list_remote = glade_helper_get (xml, "gg_theme_list_remote",
- GTK_TYPE_TREE_VIEW);
- delete_button = glade_helper_get (xml, "gg_delete_theme",
- GTK_TYPE_BUTTON);
- delete_button_remote = glade_helper_get (xml, "gg_delete_theme_remote",
- GTK_TYPE_BUTTON);
+ theme_list = glade_xml_get_widget (xml, "gg_theme_list");
+ theme_list_remote = glade_xml_get_widget (xml, "gg_theme_list_remote");
+ delete_button = glade_xml_get_widget (xml, "gg_delete_theme");
+ delete_button_remote = glade_xml_get_widget (xml, "gg_delete_theme_remote");
selected = gtk_combo_box_get_active (GTK_COMBO_BOX (combobox));
if (gtk_notebook_get_current_page (GTK_NOTEBOOK (setup_notebook)) == LOCAL_TAB) {
GtkWidget *mode_combobox;
- mode_combobox = glade_helper_get (xml, "gg_mode_combobox_remote",
- GTK_TYPE_COMBO_BOX);
+ mode_combobox = glade_xml_get_widget (xml, "gg_mode_combobox_remote");
gtk_combo_box_set_active (GTK_COMBO_BOX (mode_combobox), selected);
if (mode_combobox != combobox) {
@@ -1788,17 +1787,16 @@ combobox_changed (GtkWidget *combobox)
to be displayed only once */
if (selected == RANDOM_THEME && ve_string_empty (selected_themes)) {
- GtkWidget *setup_dialog = glade_helper_get(xml,
- "setup_dialog", GTK_TYPE_WINDOW);
+ GtkWidget *setup_dialog = glade_xml_get_widget(xml, "setup_dialog");
- GtkWidget *warn_dlg = ve_hig_dialog_new (GTK_WINDOW (setup_dialog) /* parent */,
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT /* flags */,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- _("No themes selected!"),
- _("You need one or more themes selected for the "
- "\"Random from selected\" option to be valid. "
- "Failure to do so will force \"Selected only\" mode."));
+ GtkWidget *warn_dlg = hig_dialog_new (GTK_WINDOW (setup_dialog) /* parent */,
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT /* flags */,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ _("No themes selected!"),
+ _("You need one or more themes selected for the "
+ "\"Random from selected\" option to be valid. "
+ "Failure to do so will force \"Selected only\" mode."));
gtk_dialog_run (GTK_DIALOG (warn_dlg));
gtk_widget_destroy (warn_dlg);
@@ -1811,8 +1809,7 @@ combobox_changed (GtkWidget *combobox)
else {
GtkWidget *mode_combobox;
- mode_combobox = glade_helper_get (xml, "gg_mode_combobox",
- GTK_TYPE_COMBO_BOX);
+ mode_combobox = glade_xml_get_widget (xml, "gg_mode_combobox");
gtk_combo_box_set_active (GTK_COMBO_BOX (mode_combobox), selected);
if (mode_combobox != combobox) {
@@ -1822,18 +1819,17 @@ combobox_changed (GtkWidget *combobox)
called multiple times and we want this warning
to be displayed only once */
if (selected == RANDOM_THEME && ve_string_empty (selected_themes)) {
- GtkWidget *setup_dialog = glade_helper_get(xml,
- "setup_dialog", GTK_TYPE_WINDOW);
+ GtkWidget *setup_dialog = glade_xml_get_widget(xml, "setup_dialog");
- GtkWidget *warn_dlg = ve_hig_dialog_new (GTK_WINDOW (setup_dialog) /* parent */,
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT /* flags */,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- _("No themes selected!"),
- _("You need one or more themes "
- "selected for the \"Random from selected\" "
- "option to be valid. Failure to do so will "
- "force \"Selected only\" mode."));
+ GtkWidget *warn_dlg = hig_dialog_new (GTK_WINDOW (setup_dialog) /* parent */,
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT /* flags */,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ _("No themes selected!"),
+ _("You need one or more themes "
+ "selected for the \"Random from selected\" "
+ "option to be valid. Failure to do so will "
+ "force \"Selected only\" mode."));
gtk_dialog_run (GTK_DIALOG (warn_dlg));
gtk_widget_destroy (warn_dlg);
@@ -1949,16 +1945,16 @@ combobox_changed (GtkWidget *combobox)
GtkWidget *apply_command;
gint response;
- setup_dialog = glade_helper_get (xml, "setup_dialog", GTK_TYPE_WINDOW);
+ setup_dialog = glade_xml_get_widget (xml, "setup_dialog");
- prompt = ve_hig_dialog_new (GTK_WINDOW (setup_dialog),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_NONE,
- _("Apply changes to the modified command?"),
- _("If you don't apply, the changes "
- "will be discarded."));
+ prompt = hig_dialog_new (GTK_WINDOW (setup_dialog),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ _("Apply changes to the modified command?"),
+ _("If you don't apply, the changes "
+ "will be discarded."));
gtk_dialog_add_button (GTK_DIALOG (prompt), "gtk-cancel", GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (prompt), "gtk-apply", GTK_RESPONSE_APPLY);
@@ -1966,8 +1962,7 @@ combobox_changed (GtkWidget *combobox)
response = gtk_dialog_run (GTK_DIALOG (prompt));
gtk_widget_destroy (prompt);
- apply_command = glade_helper_get (xml_commands, "command_apply_button",
- GTK_TYPE_BUTTON);
+ apply_command = glade_xml_get_widget (xml_commands, "command_apply_button");
if (response == GTK_RESPONSE_APPLY)
g_signal_emit_by_name (G_OBJECT (apply_command), "clicked");
@@ -1979,10 +1974,8 @@ combobox_changed (GtkWidget *combobox)
last_selected_command = selected;
- hrs_cmd_vbox = glade_helper_get (xml_commands, "hrs_command_vbox",
- GTK_TYPE_VBOX);
- custom_cmd_vbox = glade_helper_get (xml_commands, "custom_command_vbox",
- GTK_TYPE_VBOX);
+ hrs_cmd_vbox = glade_xml_get_widget (xml_commands, "hrs_command_vbox");
+ custom_cmd_vbox = glade_xml_get_widget (xml_commands, "custom_command_vbox");
if (selected > SUSPEND_CMD) {
/* We are dealing with custom commands */
gtk_widget_show (custom_cmd_vbox);
@@ -2065,7 +2058,7 @@ setup_notify_toggle (const char *name,
GtkWidget *toggle;
gboolean val;
- toggle = glade_helper_get (xml, name, GTK_TYPE_TOGGLE_BUTTON);
+ toggle = glade_xml_get_widget (xml, name);
val = gdm_config_get_bool ((gchar *)key);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), val);
@@ -2079,10 +2072,8 @@ setup_notify_toggle (const char *name,
GtkWidget *config_available;
GtkWidget *chooser_button;
- config_available = glade_helper_get (xml, "config_available",
- GTK_TYPE_CHECK_BUTTON);
- chooser_button = glade_helper_get (xml, "chooser_button",
- GTK_TYPE_CHECK_BUTTON);
+ config_available = glade_xml_get_widget (xml, "config_available");
+ chooser_button = glade_xml_get_widget (xml, "chooser_button");
gtk_widget_set_sensitive (config_available, val);
gtk_widget_set_sensitive (chooser_button, val);
@@ -2099,11 +2090,9 @@ setup_notify_toggle (const char *name,
GtkWidget *autologin_label;
GtkWidget *autologin_combo;
- autologin_label = glade_helper_get (xml, "autologin_label",
- GTK_TYPE_LABEL);
- autologin_combo = glade_helper_get (xml, "autologin_combo",
- GTK_TYPE_COMBO_BOX);
-
+ autologin_label = glade_xml_get_widget (xml, "autologin_label");
+ autologin_combo = glade_xml_get_widget (xml, "autologin_combo");
+
gtk_widget_set_sensitive (autologin_label, val);
gtk_widget_set_sensitive (autologin_combo, val);
@@ -2125,18 +2114,12 @@ setup_notify_toggle (const char *name,
GtkWidget *timedlogin_seconds_units;
GtkWidget *timedlogin_allow_remote;
- timedlogin_label = glade_helper_get (xml, "timed_login_label",
- GTK_TYPE_LABEL);
- timedlogin_combo = glade_helper_get (xml, "timedlogin_combo",
- GTK_TYPE_COMBO_BOX);
- timedlogin_seconds_label = glade_helper_get (xml, "timedlogin_seconds_label",
- GTK_TYPE_LABEL);
- timedlogin_seconds_spin_button = glade_helper_get (xml,"timedlogin_seconds",
- GTK_TYPE_SPIN_BUTTON);
- timedlogin_seconds_units = glade_helper_get (xml,"timedlogin_seconds_units",
- GTK_TYPE_LABEL);
- timedlogin_allow_remote = glade_helper_get (xml, "allowremoteauto",
- GTK_TYPE_CHECK_BUTTON);
+ timedlogin_label = glade_xml_get_widget (xml, "timed_login_label");
+ timedlogin_combo = glade_xml_get_widget (xml, "timedlogin_combo");
+ timedlogin_seconds_label = glade_xml_get_widget (xml, "timedlogin_seconds_label");
+ timedlogin_seconds_spin_button = glade_xml_get_widget (xml,"timedlogin_seconds");
+ timedlogin_seconds_units = glade_xml_get_widget (xml,"timedlogin_seconds_units");
+ timedlogin_allow_remote = glade_xml_get_widget (xml, "allowremoteauto");
gtk_widget_set_sensitive (timedlogin_label, val);
gtk_widget_set_sensitive (timedlogin_combo, val);
@@ -2170,9 +2153,8 @@ setup_notify_toggle (const char *name,
/* This one is a lil bit back to front
true is false and false is true */
GtkWidget *use_circles_in_passwd;
- use_circles_in_passwd = glade_helper_get (xml, "use_circles_passwd_checkbox",
- GTK_TYPE_CHECK_BUTTON);
-
+ use_circles_in_passwd = glade_xml_get_widget (xml, "use_circles_passwd_checkbox");
+
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), !val);
gtk_widget_set_sensitive (use_circles_in_passwd, !val);
@@ -2187,15 +2169,13 @@ setup_notify_toggle (const char *name,
GtkWidget *posx;
GtkWidget *posy;
- posx = glade_helper_get (xml, "local_posx_spinbutton",
- GTK_TYPE_SPIN_BUTTON);
-
- posy = glade_helper_get (xml, "local_posy_spinbutton",
- GTK_TYPE_SPIN_BUTTON);
+ posx = glade_xml_get_widget (xml, "local_posx_spinbutton");
+
+ posy = glade_xml_get_widget (xml, "local_posy_spinbutton");
gtk_widget_set_sensitive (posx, val);
gtk_widget_set_sensitive (posy, val);
-
+
g_signal_connect (G_OBJECT (toggle), "toggled",
G_CALLBACK (toggle_toggled), toggle);
g_signal_connect (G_OBJECT (toggle), "toggled",
@@ -2208,11 +2188,8 @@ setup_notify_toggle (const char *name,
GtkWidget *posx;
GtkWidget *posy;
- posx = glade_helper_get (xml, "remote_posx_spinbutton",
- GTK_TYPE_SPIN_BUTTON);
-
- posy = glade_helper_get (xml, "remote_posy_spinbutton",
- GTK_TYPE_SPIN_BUTTON);
+ posx = glade_xml_get_widget (xml, "remote_posx_spinbutton");
+ posy = glade_xml_get_widget (xml, "remote_posy_spinbutton");
gtk_widget_set_sensitive (posx, val);
gtk_widget_set_sensitive (posy, val);
@@ -2227,9 +2204,8 @@ setup_notify_toggle (const char *name,
else if (strcmp ("local_title_bar_checkbutton", ve_sure_string (name)) == 0) {
GtkWidget *lockpos;
- lockpos = glade_helper_get (xml, "local_lock_pos_checkbox",
- GTK_TYPE_CHECK_BUTTON);
-
+ lockpos = glade_xml_get_widget (xml, "local_lock_pos_checkbox");
+
gtk_widget_set_sensitive (lockpos, val);
g_signal_connect (G_OBJECT (toggle), "toggled",
@@ -2240,9 +2216,8 @@ setup_notify_toggle (const char *name,
else if (strcmp ("remote_title_bar_checkbutton", ve_sure_string (name)) == 0) {
GtkWidget *lockpos;
- lockpos = glade_helper_get (xml, "remote_lock_pos_checkbox",
- GTK_TYPE_CHECK_BUTTON);
-
+ lockpos = glade_xml_get_widget (xml, "remote_lock_pos_checkbox");
+
gtk_widget_set_sensitive (lockpos, val);
g_signal_connect (G_OBJECT (toggle), "toggled",
@@ -2253,9 +2228,8 @@ setup_notify_toggle (const char *name,
else if (strcmp ("disallow_tcp", ve_sure_string (name)) == 0) {
GtkWidget *nfs_cookies;
- nfs_cookies = glade_helper_get (xml, "never_cookies_NFS_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
-
+ nfs_cookies = glade_xml_get_widget (xml, "never_cookies_NFS_checkbutton");
+
gtk_widget_set_sensitive (nfs_cookies, !val);
g_signal_connect (G_OBJECT (toggle), "toggled",
@@ -2280,8 +2254,8 @@ commands_entry_timeout (GtkWidget *entry)
const char *key = g_object_get_data (G_OBJECT (entry), "key");
const gchar *val = gtk_entry_get_text (GTK_ENTRY (entry));
- apply_cmd_changes = glade_helper_get (xml_commands, "command_apply_button", GTK_TYPE_BUTTON);
- command_combobox = glade_helper_get (xml_commands, "cmd_type_combobox", GTK_TYPE_COMBO_BOX);
+ apply_cmd_changes = glade_xml_get_widget (xml_commands, "command_apply_button");
+ command_combobox = glade_xml_get_widget (xml_commands, "cmd_type_combobox");
selected = gtk_combo_box_get_active (GTK_COMBO_BOX (command_combobox));
@@ -2349,7 +2323,7 @@ setup_commands_text_entry (const char *name,
{
GtkWidget *entry;
- entry = glade_helper_get (xml_commands, name, GTK_TYPE_ENTRY);
+ entry = glade_xml_get_widget (xml_commands, name);
g_object_set_data_full (G_OBJECT (entry),
"key", g_strdup (key),
@@ -2365,7 +2339,7 @@ setup_commands_notify_toggle (const char *name,
{
GtkWidget *toggle;
- toggle = glade_helper_get (xml_commands, name, GTK_TYPE_TOGGLE_BUTTON);
+ toggle = glade_xml_get_widget (xml_commands, name);
g_object_set_data_full (G_OBJECT (toggle),
"key", g_strdup (key),
@@ -2383,7 +2357,7 @@ setup_xdmcp_notify_toggle (const char *name,
GtkWidget *toggle;
gboolean val;
- toggle = glade_helper_get (xml_xdmcp, name, GTK_TYPE_TOGGLE_BUTTON);
+ toggle = glade_xml_get_widget (xml_xdmcp, name);
val = gdm_config_get_bool ((gchar *)key);
@@ -2417,13 +2391,12 @@ root_not_allowed (GtkWidget *combo_box)
if ( ! ve_string_empty (text) &&
strcmp (text, get_root_user ()) == 0) {
- GtkWidget *dlg =
- ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Autologin or timed login to the root account is not allowed."),
- "");
+ GtkWidget *dlg = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Autologin or timed login to the root account is not allowed."),
+ "");
if (RUNNING_UNDER_GDM)
setup_cursor (GDK_LEFT_PTR);
gtk_dialog_run (GTK_DIALOG (dlg));
@@ -2444,8 +2417,7 @@ static void
setup_user_combobox_list (const char *name, const char *key)
{
GtkListStore *combobox_store = NULL;
- GtkWidget *combobox_entry = glade_helper_get (xml, name,
- GTK_TYPE_COMBO_BOX_ENTRY);
+ GtkWidget *combobox_entry = glade_xml_get_widget (xml, name);
GtkTreeIter iter;
GList *users = NULL;
GList *users_string = NULL;
@@ -2499,7 +2471,7 @@ setup_user_combobox_list (const char *name, const char *key)
static void
setup_user_combobox (const char *name, const char *key)
{
- GtkWidget *combobox_entry = glade_helper_get (xml, name, GTK_TYPE_COMBO_BOX_ENTRY);
+ GtkWidget *combobox_entry = glade_xml_get_widget (xml, name);
setup_user_combobox_list (name, key);
g_object_set_data_full (G_OBJECT (combobox_entry), "key",
g_strdup (key), (GDestroyNotify) g_free);
@@ -2513,8 +2485,7 @@ static void
setup_intspin (const char *name,
const char *key)
{
- GtkWidget *spin = glade_helper_get (xml, name,
- GTK_TYPE_SPIN_BUTTON);
+ GtkWidget *spin = glade_xml_get_widget (xml, name);
int val = gdm_config_get_int ((gchar *)key);
g_object_set_data_full (G_OBJECT (spin),
@@ -2535,10 +2506,7 @@ setup_xdmcp_intspin (const char *name,
GtkWidget *spin;
int val = gdm_config_get_int ((gchar *)key);
- spin = glade_helper_get (xml_xdmcp,
- name,
- GTK_TYPE_SPIN_BUTTON);
-
+ spin = glade_xml_get_widget (xml_xdmcp, name);
g_object_set_data_full (G_OBJECT (spin),
"key", g_strdup (key),
@@ -2633,8 +2601,7 @@ face_add (FaceData *fd)
GtkTreeIter iter;
gboolean valid;
- user_entry = glade_helper_get (xml_add_users, "fb_addentry",
- GTK_TYPE_ENTRY);
+ user_entry = glade_xml_get_widget (xml_add_users, "fb_addentry");
text = gtk_entry_get_text (GTK_ENTRY (user_entry));
if (gdm_is_user_valid (text)) {
@@ -2649,16 +2616,14 @@ face_add (FaceData *fd)
str = g_strdup_printf (_("The \"%s\" user already exists in the include list."), text);
- setup_dialog = glade_helper_get (xml_add_users, "add_user_dialog",
- GTK_TYPE_WINDOW);
-
- dialog = ve_hig_dialog_new (GTK_WINDOW (setup_dialog),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot add user"),
- str);
+ setup_dialog = glade_xml_get_widget (xml_add_users, "add_user_dialog");
+ dialog = hig_dialog_new (GTK_WINDOW (setup_dialog),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot add user"),
+ str);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
g_free (str);
@@ -2679,16 +2644,14 @@ face_add (FaceData *fd)
str = g_strdup_printf (_("The \"%s\" user already exists in the exclude list."), text);
- setup_dialog = glade_helper_get (xml_add_users, "add_user_dialog",
- GTK_TYPE_WINDOW);
-
- dialog = ve_hig_dialog_new (GTK_WINDOW (setup_dialog),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot add user"),
- str);
+ setup_dialog = glade_xml_get_widget (xml_add_users, "add_user_dialog");
+ dialog = hig_dialog_new (GTK_WINDOW (setup_dialog),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot add user"),
+ str);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
g_free (str);
@@ -2708,16 +2671,14 @@ face_add (FaceData *fd)
str = g_strdup_printf (_("The \"%s\" user UID is lower than allowed MinimalUID."), text);
- setup_dialog = glade_helper_get (xml_add_users, "add_user_dialog",
- GTK_TYPE_WINDOW);
-
- dialog = ve_hig_dialog_new (GTK_WINDOW (setup_dialog),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot add user"),
- str);
+ setup_dialog = glade_xml_get_widget (xml_add_users, "add_user_dialog");
+ dialog = hig_dialog_new (GTK_WINDOW (setup_dialog),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot add user"),
+ str);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
g_free (str);
@@ -2740,16 +2701,14 @@ face_add (FaceData *fd)
str = g_strdup_printf (_("The \"%s\" user does not exist."), text);
- setup_dialog = glade_helper_get (xml_add_users, "add_user_dialog",
- GTK_TYPE_WINDOW);
-
- dialog = ve_hig_dialog_new (GTK_WINDOW (setup_dialog),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot add user"),
- str);
+ setup_dialog = glade_xml_get_widget (xml_add_users, "add_user_dialog");
+ dialog = hig_dialog_new (GTK_WINDOW (setup_dialog),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot add user"),
+ str);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
g_free (str);
@@ -2816,16 +2775,14 @@ browser_move (GtkWidget *button, gpointer data)
str = g_strdup_printf (_("The \"%s\" user UID is lower than allowed MinimalUID."), text);
- setup_dialog = glade_helper_get (xml_add_users, "add_user_dialog",
- GTK_TYPE_WINDOW);
-
- dialog = ve_hig_dialog_new (GTK_WINDOW (setup_dialog),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot add user"),
- str);
+ setup_dialog = glade_xml_get_widget (xml_add_users, "add_user_dialog");
+ dialog = hig_dialog_new (GTK_WINDOW (setup_dialog),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot add user"),
+ str);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
g_free (str);
@@ -2887,14 +2844,10 @@ command_apply (GtkWidget *button, gpointer data)
selected = gtk_combo_box_get_active (GTK_COMBO_BOX (command_combobox));
if (last_selected_command < CUSTOM_CMD)
- cmd_path_entry = glade_helper_get (xml_commands,
- "hrs_cmd_path_entry",
- GTK_TYPE_ENTRY);
+ cmd_path_entry = glade_xml_get_widget (xml_commands, "hrs_cmd_path_entry");
else
- cmd_path_entry = glade_helper_get (xml_commands,
- "custom_cmd_path_entry",
- GTK_TYPE_ENTRY);
-
+ cmd_path_entry = glade_xml_get_widget (xml_commands, "custom_cmd_path_entry");
+
command = gtk_entry_get_text (GTK_ENTRY (cmd_path_entry));
command_exists = ve_string_empty (command) || gdm_working_command_exists (command);
@@ -2904,16 +2857,16 @@ command_apply (GtkWidget *button, gpointer data)
(GHRFunc) unsaved_data_from_hash_table_func, NULL);
else {
- GtkWidget *parent = glade_helper_get (xml_commands, "commands_dialog", GTK_TYPE_WINDOW);
-
- GtkWidget *dialog = ve_hig_dialog_new (GTK_WINDOW (parent),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Invalid command path"),
- _("The path you provided for this "
- "command is not valid. The changes "
- "will not be saved."));
+ GtkWidget *parent = glade_xml_get_widget (xml_commands, "commands_dialog");
+
+ GtkWidget *dialog = hig_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Invalid command path"),
+ _("The path you provided for this "
+ "command is not valid. The changes "
+ "will not be saved."));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
@@ -2972,17 +2925,17 @@ browser_apply (GtkWidget *button, gpointer data)
GtkWidget *setup_dialog;
GtkWidget *dlg;
- setup_dialog = glade_helper_get(xml, "setup_dialog", GTK_TYPE_WINDOW);
+ setup_dialog = glade_xml_get_widget(xml, "setup_dialog");
//Inform user about the change
- dlg = ve_hig_dialog_new (GTK_WINDOW (setup_dialog),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- _("Users include list modification"),
- _("Some of the users had uid lower than "
- "MinimalUID (Security tab) and "
- "could not be added."));
+ dlg = hig_dialog_new (GTK_WINDOW (setup_dialog),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ _("Users include list modification"),
+ _("Some of the users had uid lower than "
+ "MinimalUID (Security tab) and "
+ "could not be added."));
gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg);
@@ -3099,15 +3052,14 @@ users_add_button_clicked (GtkWidget *button, gpointer data)
GtkWidget *parent;
if (dialog == NULL) {
- parent = glade_helper_get (xml, "setup_dialog", GTK_TYPE_WINDOW);
- dialog = glade_helper_get (xml_add_users, "add_user_dialog", GTK_TYPE_DIALOG);
+ parent = glade_xml_get_widget (xml, "setup_dialog");
+ dialog = glade_xml_get_widget (xml_add_users, "add_user_dialog");
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
}
- user_entry = glade_helper_get (xml_add_users, "fb_addentry",
- GTK_TYPE_ENTRY);
+ user_entry = glade_xml_get_widget (xml_add_users, "fb_addentry");
gtk_widget_grab_focus (user_entry);
@@ -3127,26 +3079,16 @@ setup_face (void)
GtkTreeSelection *selection;
- fc.include_add = glade_helper_get (xml, "fb_includeadd",
- GTK_TYPE_WIDGET);
- fc.include_del = glade_helper_get (xml, "fb_includedelete",
- GTK_TYPE_WIDGET);
- fc.exclude_add = glade_helper_get (xml, "fb_excludeadd",
- GTK_TYPE_WIDGET);
- fc.exclude_del = glade_helper_get (xml, "fb_excludedelete",
- GTK_TYPE_WIDGET);
- fc.to_include_button = glade_helper_get (xml, "fb_toinclude",
- GTK_TYPE_WIDGET);
- fc.to_exclude_button = glade_helper_get (xml, "fb_toexclude",
- GTK_TYPE_WIDGET);
- fc.apply = glade_helper_get (xml, "fb_faceapply",
- GTK_TYPE_WIDGET);
- fc.include_treeview = glade_helper_get (xml, "fb_include_treeview",
- GTK_TYPE_TREE_VIEW);
- fc.exclude_treeview = glade_helper_get (xml, "fb_exclude_treeview",
- GTK_TYPE_TREE_VIEW);
- fc.allusers = glade_helper_get (xml, "fb_allusers",
- GTK_TYPE_TOGGLE_BUTTON);
+ fc.include_add = glade_xml_get_widget (xml, "fb_includeadd");
+ fc.include_del = glade_xml_get_widget (xml, "fb_includedelete");
+ fc.exclude_add = glade_xml_get_widget (xml, "fb_excludeadd");
+ fc.exclude_del = glade_xml_get_widget (xml, "fb_excludedelete");
+ fc.to_include_button = glade_xml_get_widget (xml, "fb_toinclude");
+ fc.to_exclude_button = glade_xml_get_widget (xml, "fb_toexclude");
+ fc.apply = glade_xml_get_widget (xml, "fb_faceapply");
+ fc.include_treeview = glade_xml_get_widget (xml, "fb_include_treeview");
+ fc.exclude_treeview = glade_xml_get_widget (xml, "fb_exclude_treeview");
+ fc.allusers = glade_xml_get_widget (xml, "fb_allusers");
fc.include_store = setup_include_exclude (fc.include_treeview,
GDM_KEY_INCLUDE);
@@ -3173,10 +3115,7 @@ setup_face (void)
face_apply.include = &fd_include;
face_apply.exclude = &fd_exclude;
- xml_add_users = glade_helper_load ("gdmsetup.glade",
- "add_user_dialog",
- GTK_TYPE_DIALOG,
- TRUE);
+ xml_add_users = glade_xml_new (GDM_GLADE_DIR "/gdmsetup.glade", "add_user_dialog", NULL);
g_signal_connect (G_OBJECT (fc.include_add), "clicked",
G_CALLBACK (users_add_button_clicked), &fd_include);
@@ -3240,8 +3179,7 @@ greeter_toggle_timeout (GtkWidget *toggle)
GtkWidget *checkbutton;
- checkbutton = glade_helper_get (xml, "sg_scale_background_remote",
- GTK_TYPE_CHECK_BUTTON);
+ checkbutton = glade_xml_get_widget (xml, "sg_scale_background_remote");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton),
GTK_TOGGLE_BUTTON (toggle)->active);
@@ -3249,8 +3187,7 @@ greeter_toggle_timeout (GtkWidget *toggle)
else {
GtkWidget *checkbutton;
- checkbutton = glade_helper_get (xml, "sg_scale_background",
- GTK_TYPE_CHECK_BUTTON);
+ checkbutton = glade_xml_get_widget (xml, "sg_scale_background");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton),
GTK_TOGGLE_BUTTON (toggle)->active);
@@ -3300,19 +3237,11 @@ local_background_type_toggle_timeout (GtkWidget *toggle)
gboolean image_value;
gboolean color_value;
- image_radiobutton = glade_helper_get (xml,
- "local_background_image_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
- color_radiobutton = glade_helper_get (xml,
- "local_background_color_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
- image_remote_radiobutton = glade_helper_get (xml,
- "remote_background_image_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
- color_remote_radiobutton = glade_helper_get (xml,
- "remote_background_color_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
-
+ image_radiobutton = glade_xml_get_widget (xml, "local_background_image_checkbutton");
+ color_radiobutton = glade_xml_get_widget (xml, "local_background_color_checkbutton");
+ image_remote_radiobutton = glade_xml_get_widget (xml, "remote_background_image_checkbutton");
+ color_remote_radiobutton = glade_xml_get_widget (xml, "remote_background_color_checkbutton");
+
if (gtk_notebook_get_current_page (GTK_NOTEBOOK (setup_notebook)) == LOCAL_TAB) {
image_value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (image_radiobutton));
color_value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (color_radiobutton));
@@ -3357,8 +3286,7 @@ static void
setup_greeter_toggle (const char *name,
const char *key)
{
- GtkWidget *toggle = glade_helper_get (xml, name,
- GTK_TYPE_TOGGLE_BUTTON);
+ GtkWidget *toggle = glade_xml_get_widget (xml, name);
gboolean val = gdm_config_get_bool ((gchar *)key);
g_object_set_data_full (G_OBJECT (toggle), "key", g_strdup (key),
@@ -3367,10 +3295,8 @@ setup_greeter_toggle (const char *name,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), val);
if (strcmp ("sg_defaultwelcome", ve_sure_string (name)) == 0) {
- GtkWidget *welcome = glade_helper_get (xml,
- "welcome", GTK_TYPE_ENTRY);
- GtkWidget *custom = glade_helper_get (xml, "sg_customwelcome",
- GTK_TYPE_RADIO_BUTTON);
+ GtkWidget *welcome = glade_xml_get_widget (xml, "welcome");
+ GtkWidget *custom = glade_xml_get_widget (xml, "sg_customwelcome");
gtk_widget_set_sensitive (welcome, !val);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (custom), !val);
@@ -3379,10 +3305,8 @@ setup_greeter_toggle (const char *name,
G_CALLBACK (sensitive_entry_toggled), welcome);
} else if (strcmp ("sg_defaultwelcomeremote", ve_sure_string (name)) == 0) {
- GtkWidget *welcomeremote = glade_helper_get (xml,
- "welcomeremote", GTK_TYPE_ENTRY);
- GtkWidget *customremote = glade_helper_get (xml, "sg_customwelcomeremote",
- GTK_TYPE_RADIO_BUTTON);
+ GtkWidget *welcomeremote = glade_xml_get_widget (xml, "welcomeremote");
+ GtkWidget *customremote = glade_xml_get_widget (xml, "sg_customwelcomeremote");
gtk_widget_set_sensitive (welcomeremote, !val);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (customremote), !val);
@@ -3392,17 +3316,12 @@ setup_greeter_toggle (const char *name,
} else if (strcmp ("fb_allusers", ve_sure_string (name)) == 0) {
- GtkWidget *fb_includetree = glade_helper_get (xml, "fb_include_treeview",
- GTK_TYPE_TREE_VIEW);
- GtkWidget *fb_buttonbox = glade_helper_get (xml, "UsersButtonBox",
- GTK_TYPE_VBOX);
- GtkWidget *fb_includeadd = glade_helper_get (xml, "fb_includeadd",
- GTK_TYPE_BUTTON);
- GtkWidget *fb_includeremove = glade_helper_get (xml, "fb_includedelete",
- GTK_TYPE_BUTTON);
- GtkWidget *fb_includelabel = glade_helper_get (xml, "fb_includelabel",
- GTK_TYPE_LABEL);
-
+ GtkWidget *fb_includetree = glade_xml_get_widget (xml, "fb_include_treeview");
+ GtkWidget *fb_buttonbox = glade_xml_get_widget (xml, "UsersButtonBox");
+ GtkWidget *fb_includeadd = glade_xml_get_widget (xml, "fb_includeadd");
+ GtkWidget *fb_includeremove = glade_xml_get_widget (xml, "fb_includedelete");
+ GtkWidget *fb_includelabel = glade_xml_get_widget (xml, "fb_includelabel");
+
gtk_widget_set_sensitive (fb_buttonbox, !val);
gtk_widget_set_sensitive (fb_includetree, !val);
gtk_widget_set_sensitive (fb_includelabel, !val);
@@ -3423,13 +3342,9 @@ setup_greeter_toggle (const char *name,
GtkWidget *file_chooser;
GtkWidget *play_button;
- file_chooser = glade_helper_get (xml,
- "acc_sound_ready_button",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
- play_button = glade_helper_get (xml,
- "acc_soundtest_ready_button",
- GTK_TYPE_BUTTON);
-
+ file_chooser = glade_xml_get_widget (xml, "acc_sound_ready_button");
+ play_button = glade_xml_get_widget (xml, "acc_soundtest_ready_button");
+
gtk_widget_set_sensitive (file_chooser, val);
gtk_widget_set_sensitive (play_button, val);
@@ -3441,11 +3356,9 @@ setup_greeter_toggle (const char *name,
GtkWidget *file_chooser;
GtkWidget *play_button;
- file_chooser = glade_helper_get (xml, "acc_sound_success_button",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
- play_button = glade_helper_get (xml, "acc_soundtest_success_button",
- GTK_TYPE_BUTTON);
-
+ file_chooser = glade_xml_get_widget (xml, "acc_sound_success_button");
+ play_button = glade_xml_get_widget (xml, "acc_soundtest_success_button");
+
gtk_widget_set_sensitive (file_chooser, val);
gtk_widget_set_sensitive (play_button, val);
@@ -3457,11 +3370,9 @@ setup_greeter_toggle (const char *name,
GtkWidget *file_chooser;
GtkWidget *play_button;
- file_chooser = glade_helper_get (xml, "acc_sound_failure_button",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
- play_button = glade_helper_get (xml, "acc_soundtest_failure_button",
- GTK_TYPE_BUTTON);
-
+ file_chooser = glade_xml_get_widget (xml, "acc_sound_failure_button");
+ play_button = glade_xml_get_widget (xml, "acc_soundtest_failure_button");
+
gtk_widget_set_sensitive (file_chooser, val);
gtk_widget_set_sensitive (play_button, val);
@@ -3474,15 +3385,12 @@ setup_greeter_toggle (const char *name,
GtkWidget *file_chooser_remote;
GtkWidget *checkbutton;
- checkbutton = glade_helper_get (xml, "remote_logo_image_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
-
- file_chooser = glade_helper_get (xml, "local_logo_image_chooserbutton",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
+ checkbutton = glade_xml_get_widget (xml, "remote_logo_image_checkbutton");
+
+ file_chooser = glade_xml_get_widget (xml, "local_logo_image_chooserbutton");
+
+ file_chooser_remote = glade_xml_get_widget (xml, "remote_logo_image_chooserbutton");
- file_chooser_remote = glade_helper_get (xml, "remote_logo_image_chooserbutton",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
-
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), val);
gtk_widget_set_sensitive (file_chooser, val);
@@ -3508,12 +3416,9 @@ greeter_color_timeout (GtkWidget *picker)
GtkWidget *colorbutton;
if (strcmp (GDM_KEY_GRAPHICAL_THEMED_COLOR, ve_sure_string (key)) == 0) {
- colorbutton = glade_helper_get (xml, "remote_background_theme_colorbutton",
- GTK_TYPE_COLOR_BUTTON);
- }
- else {
- colorbutton = glade_helper_get (xml, "remote_background_colorbutton",
- GTK_TYPE_COLOR_BUTTON);
+ colorbutton = glade_xml_get_widget (xml, "remote_background_theme_colorbutton");
+ } else {
+ colorbutton = glade_xml_get_widget (xml, "remote_background_colorbutton");
}
gtk_color_button_set_color (GTK_COLOR_BUTTON (colorbutton), &color_val);
}
@@ -3521,12 +3426,9 @@ greeter_color_timeout (GtkWidget *picker)
GtkWidget *colorbutton;
if (strcmp (GDM_KEY_GRAPHICAL_THEMED_COLOR, ve_sure_string (key)) == 0) {
- colorbutton = glade_helper_get (xml, "local_background_theme_colorbutton",
- GTK_TYPE_COLOR_BUTTON);
- }
- else {
- colorbutton = glade_helper_get (xml, "local_background_colorbutton",
- GTK_TYPE_COLOR_BUTTON);
+ colorbutton = glade_xml_get_widget (xml, "local_background_theme_colorbutton");
+ } else {
+ colorbutton = glade_xml_get_widget (xml, "local_background_colorbutton");
}
gtk_color_button_set_color (GTK_COLOR_BUTTON (colorbutton), &color_val);
}
@@ -3559,8 +3461,7 @@ static void
setup_greeter_color (const char *name,
const char *key)
{
- GtkWidget *picker = glade_helper_get (xml, name,
- GTK_TYPE_COLOR_BUTTON);
+ GtkWidget *picker = glade_xml_get_widget (xml, name);
char *val = gdm_config_get_string ((gchar *)key);
g_object_set_data_full (G_OBJECT (picker),
@@ -3569,7 +3470,7 @@ setup_greeter_color (const char *name,
if (val != NULL) {
GdkColor color;
-
+
if (gdk_color_parse (val, &color)) {
gtk_color_button_set_color (GTK_COLOR_BUTTON (picker), &color);
}
@@ -3597,16 +3498,42 @@ typedef struct _ImageData {
static gboolean
greeter_entry_untranslate_timeout (GtkWidget *entry)
{
- VeConfig *custom_cfg = ve_config_get (custom_config_file);
- const char *key = g_object_get_data (G_OBJECT (entry), "key");
+ GKeyFile *custom_cfg;
+ const char *key;
const char *text;
+ char *config_group;
+ char *config_key;
+ int i;
+ char *prefix;
+ char **keys;
+
+ custom_cfg = gdm_common_config_load (custom_config_file, NULL);
+ key = g_object_get_data (G_OBJECT (entry), "key");
text = gtk_entry_get_text (GTK_ENTRY (entry));
- ve_config_delete_translations (custom_cfg, key);
+ config_group = config_key = NULL;
+ if (! gdm_common_config_parse_key_string (key, &config_group, &config_key, NULL)) {
+ goto out;
+ }
+
+ prefix = g_strdup_printf ("%s[", config_key);
+ keys = g_key_file_get_keys (custom_cfg, config_group, NULL, NULL);
+ for (i = 0; keys[i] != NULL; i++) {
+ if (g_str_has_prefix (keys[i], prefix)) {
+ g_key_file_remove_key (custom_cfg, config_group, keys[i], NULL);
+ }
+ }
+ g_strfreev (keys);
+
gdm_setup_config_set_string (key, (char *)ve_sure_string (text));
update_greeters ();
+ gdm_common_config_save (custom_cfg, custom_config_file, NULL);
+
+ out:
+ g_key_file_free (custom_cfg);
+
return FALSE;
}
@@ -3632,7 +3559,7 @@ command_response (GtkWidget *button, gpointer data)
GtkWidget *command_entry = NULL;
gint selected;
- setup_dialog = glade_helper_get (xml_commands, "commands_dialog", GTK_TYPE_WINDOW);
+ setup_dialog = glade_xml_get_widget (xml_commands, "commands_dialog");
/* first get the file */
chooser = gtk_file_chooser_dialog_new (_("Select Command"),
@@ -3656,13 +3583,13 @@ command_response (GtkWidget *button, gpointer data)
GtkWidget *dialog;
- dialog = ve_hig_dialog_new (GTK_WINDOW (setup_dialog),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("No file selected"),
- "");
+ dialog = hig_dialog_new (GTK_WINDOW (setup_dialog),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("No file selected"),
+ "");
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
return;
@@ -3674,10 +3601,8 @@ command_response (GtkWidget *button, gpointer data)
append the chosen filepath onto the existing
string */
- command_combobox = glade_helper_get (xml_commands,
- "cmd_type_combobox",
- GTK_TYPE_COMBO_BOX);
-
+ command_combobox = glade_xml_get_widget (xml_commands, "cmd_type_combobox");
+
selected = gtk_combo_box_get_active (GTK_COMBO_BOX (command_combobox));
if (selected == HALT_CMD)
@@ -3699,12 +3624,10 @@ command_response (GtkWidget *button, gpointer data)
value = strings_list_add (value, filename, ";");
- if (strcmp (ve_sure_string (key), "add_hrs_cmd_button") == 0)
- command_entry = glade_helper_get (xml_commands, "hrs_cmd_path_entry", GTK_TYPE_ENTRY);
-
- else if (strcmp (ve_sure_string (key), "add_custom_cmd_button") == 0)
- command_entry = glade_helper_get (xml_commands, "custom_cmd_path_entry", GTK_TYPE_ENTRY);
-
+ if (strcmp (ve_sure_string (key), "add_hrs_cmd_button") == 0)
+ command_entry = glade_xml_get_widget (xml_commands, "hrs_cmd_path_entry");
+ else if (strcmp (ve_sure_string (key), "add_custom_cmd_button") == 0)
+ command_entry = glade_xml_get_widget (xml_commands, "custom_cmd_path_entry");
gtk_entry_set_text (GTK_ENTRY (command_entry), ve_sure_string (value));
@@ -3750,7 +3673,7 @@ static void
setup_general_command_buttons (const char *name,
const char *key)
{
- GtkWidget *button = glade_helper_get (xml_commands, name, GTK_TYPE_BUTTON);
+ GtkWidget *button = glade_xml_get_widget (xml_commands, name);
g_object_set_data_full (G_OBJECT (button),
"key", g_strdup (key),
@@ -3764,7 +3687,7 @@ static void
setup_greeter_untranslate_entry (const char *name,
const char *key)
{
- GtkWidget *entry = glade_helper_get (xml, name, GTK_TYPE_ENTRY);
+ GtkWidget *entry = glade_xml_get_widget (xml, name);
char *val;
val = gdm_config_get_translated_string ((gchar *)key);
@@ -3792,13 +3715,10 @@ xdmcp_button_clicked (void)
GtkWidget *parent;
- xml_xdmcp = glade_helper_load ("gdmsetup.glade",
- "xdmcp_dialog",
- GTK_TYPE_DIALOG,
- TRUE);
-
- parent = glade_helper_get (xml, "setup_dialog", GTK_TYPE_WINDOW);
- dialog = glade_helper_get (xml_xdmcp, "xdmcp_dialog", GTK_TYPE_DIALOG);
+ xml_xdmcp = glade_xml_new (GDM_GLADE_DIR "/gdmsetup.glade", "xdmcp_dialog", NULL);
+
+ parent = glade_xml_get_widget (xml, "setup_dialog");
+ dialog = glade_xml_get_widget (xml_xdmcp, "xdmcp_dialog");
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
@@ -3829,13 +3749,13 @@ apply_command_changes (GObject *object, gint response, gpointer command_data)
GtkWidget *prompt;
gint response;
- prompt = ve_hig_dialog_new (GTK_WINDOW (dialog),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_NONE,
- _("Apply the changes to commands before closing?"),
- _("If you don't apply, the changes made "
- "will be disregarded."));
+ prompt = hig_dialog_new (GTK_WINDOW (dialog),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ _("Apply the changes to commands before closing?"),
+ _("If you don't apply, the changes made "
+ "will be disregarded."));
gtk_dialog_add_button (GTK_DIALOG (prompt), _("Close _without Applying"), GTK_RESPONSE_CLOSE);
gtk_dialog_add_button (GTK_DIALOG (prompt), "gtk-apply", GTK_RESPONSE_APPLY);
@@ -3846,8 +3766,7 @@ apply_command_changes (GObject *object, gint response, gpointer command_data)
if (response == GTK_RESPONSE_APPLY) {
GtkWidget *apply_button;
- apply_button = glade_helper_get (xml_commands, "command_apply_button",
- GTK_TYPE_WIDGET);
+ apply_button = glade_xml_get_widget (xml_commands, "command_apply_button");
g_signal_emit_by_name (G_OBJECT (apply_button), "clicked");
}
else {
@@ -3858,6 +3777,28 @@ apply_command_changes (GObject *object, gint response, gpointer command_data)
}
}
+/* Make label surrounded by tag (if tag = "tag" add <tag>text</tag>) */
+static void
+glade_helper_tagify_label (GladeXML *xml,
+ const char *name,
+ const char *tag)
+{
+ const char *lbl;
+ char *s;
+ GtkWidget *label;
+
+ label = glade_xml_get_widget (xml, name);
+ if (GTK_IS_BUTTON (label)) {
+ label = GTK_BIN(label)->child;
+ }
+
+ lbl = gtk_label_get_label (GTK_LABEL (label));
+ s = g_strdup_printf ("<%s>%s</%s>", tag, lbl, tag);
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ gtk_label_set_label (GTK_LABEL (label), s);
+ g_free (s);
+}
+
static void
command_button_clicked (void)
{
@@ -3866,20 +3807,15 @@ command_button_clicked (void)
gint selected = -1;
gint response;
- if (dialog == NULL) {
+ if (dialog == NULL) {
GtkWidget *parent;
- GtkWidget *apply_command_changes_button;
+ GtkWidget *apply_command_changes_button;
gint i;
- xml_commands = glade_helper_load ("gdmsetup.glade",
- "commands_dialog",
- GTK_TYPE_DIALOG,
- TRUE);
-
- command_chooser = glade_helper_get (xml_commands,
- "cmd_type_combobox",
- GTK_TYPE_COMBO_BOX);
+ xml_commands = glade_xml_new (GDM_GLADE_DIR "/gdmsetup.glade", "commands_dialog", NULL);
+
+ command_chooser = glade_xml_get_widget (xml_commands, "cmd_type_combobox");
glade_helper_tagify_label (xml_commands, "custom_cmd_note_label", "i");
glade_helper_tagify_label (xml_commands, "custom_cmd_note_label", "small");
@@ -3901,8 +3837,8 @@ command_button_clicked (void)
glade_helper_tagify_label (xml_commands, "norestart_label", "i");
glade_helper_tagify_label (xml_commands, "norestart_label", "small");
- parent = glade_helper_get (xml, "setup_dialog", GTK_TYPE_WINDOW);
- dialog = glade_helper_get (xml_commands, "commands_dialog", GTK_TYPE_DIALOG);
+ parent = glade_xml_get_widget (xml, "setup_dialog");
+ dialog = glade_xml_get_widget (xml_commands, "commands_dialog");
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
@@ -3947,9 +3883,7 @@ command_button_clicked (void)
setup_general_command_buttons("custom_command_add", "add_custom_cmd_button");
/* set up apply command changes button */
- apply_command_changes_button = glade_helper_get (xml_commands,
- "command_apply_button",
- GTK_TYPE_BUTTON);
+ apply_command_changes_button = glade_xml_get_widget (xml_commands, "command_apply_button");
g_object_set_data_full (G_OBJECT (apply_command_changes_button), "key",
g_strdup ("apply_command_changes"), (GDestroyNotify) g_free);
g_signal_connect (G_OBJECT (apply_command_changes_button), "clicked",
@@ -3962,9 +3896,7 @@ command_button_clicked (void)
G_CALLBACK (apply_command_changes), dialog);
}
else {
- command_chooser = glade_helper_get (xml_commands,
- "cmd_type_combobox",
- GTK_TYPE_COMBO_BOX);
+ command_chooser = glade_xml_get_widget (xml_commands, "cmd_type_combobox");
selected = gtk_combo_box_get_active (GTK_COMBO_BOX (command_chooser));
@@ -3999,7 +3931,7 @@ static void
setup_greeter_combobox (const char *name,
const char *key)
{
- GtkWidget *combobox = glade_helper_get (xml, name, GTK_TYPE_COMBO_BOX);
+ GtkWidget *combobox = glade_xml_get_widget (xml, name);
char *greetval = g_strdup (gdm_config_get_string ((gchar *)key));
if (greetval != NULL &&
@@ -4020,10 +3952,8 @@ setup_greeter_combobox (const char *name,
val = gdm_config_get_bool (GDM_KEY_BROWSER);
- local_plain_vbox = glade_helper_get (xml, "local_plain_properties_vbox",
- GTK_TYPE_VBOX);
- local_themed_vbox = glade_helper_get (xml, "local_themed_properties_vbox",
- GTK_TYPE_VBOX);
+ local_plain_vbox = glade_xml_get_widget (xml, "local_plain_properties_vbox");
+ local_themed_vbox = glade_xml_get_widget (xml, "local_themed_properties_vbox");
if (val == FALSE) {
gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), LOCAL_PLAIN);
}
@@ -4035,15 +3965,12 @@ setup_greeter_combobox (const char *name,
gtk_widget_hide (local_themed_vbox);
}
else if (strstr (greetval, "/gdmgreeter") != NULL) {
-
GtkWidget *local_plain_vbox;
GtkWidget *local_themed_vbox;
-
- local_plain_vbox = glade_helper_get (xml, "local_plain_properties_vbox",
- GTK_TYPE_VBOX);
- local_themed_vbox = glade_helper_get (xml, "local_themed_properties_vbox",
- GTK_TYPE_VBOX);
-
+
+ local_plain_vbox = glade_xml_get_widget (xml, "local_plain_properties_vbox");
+ local_themed_vbox = glade_xml_get_widget (xml, "local_themed_properties_vbox");
+
gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), LOCAL_THEMED);
gtk_widget_hide (local_plain_vbox);
gtk_widget_show (local_themed_vbox);
@@ -4067,8 +3994,7 @@ setup_xdmcp_support (void)
{
GtkWidget *xdmcp_button;
- xdmcp_button = glade_helper_get (xml, "xdmcp_configbutton",
- GTK_TYPE_BUTTON);
+ xdmcp_button = glade_xml_get_widget (xml, "xdmcp_configbutton");
#ifndef HAVE_LIBXDMCP
/* HAVE_LIBXDMCP */
gtk_widget_set_sensitive (xdmcp_button, FALSE);
@@ -4336,9 +4262,7 @@ setup_users_tab (void)
setup_face ();
/* Setup default face */
- default_face_filechooser = glade_helper_get (xml,
- "default_face_filechooser",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
+ default_face_filechooser = glade_xml_get_widget (xml, "default_face_filechooser");
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("Images"));
@@ -4347,10 +4271,7 @@ setup_users_tab (void)
filename = gdm_config_get_string (GDM_KEY_DEFAULT_FACE);
- default_face_checkbox = glade_helper_get (xml,
- "default_face_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
-
+ default_face_checkbox = glade_xml_get_widget (xml, "default_face_checkbutton");
if (!ve_string_empty (filename) && access (filename, R_OK|X_OK)) {
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (default_face_filechooser),
@@ -4383,16 +4304,12 @@ setup_users_tab (void)
/* Setup global face dir */
g_free (filename);
- global_face_dir_filechooser = glade_helper_get (xml,
- "global_face_dir_filechooser",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
+ global_face_dir_filechooser = glade_xml_get_widget (xml, "global_face_dir_filechooser");
filename = gdm_config_get_string (GDM_KEY_GLOBAL_FACE_DIR);
- global_face_dir_checkbox = glade_helper_get (xml,
- "global_face_dir_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
-
+ global_face_dir_checkbox = glade_xml_get_widget (xml, "global_face_dir_checkbutton");
+
if (!ve_string_empty (filename) && access (filename, R_OK|X_OK) == 0) {
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (global_face_dir_filechooser),
filename);
@@ -4440,40 +4357,19 @@ setup_accessibility_tab (void)
gchar *modules_list;
gchar *value;
- enable_accessible_login =
- glade_helper_get (xml,
- "acc_modules",
- GTK_TYPE_CHECK_BUTTON);
-
- access_sound_ready_file_chooser =
- glade_helper_get (xml,
- "acc_sound_ready_button",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
-
- access_sound_ready_play_button =
- glade_helper_get (xml,
- "acc_soundtest_ready_button",
- GTK_TYPE_BUTTON);
-
- access_sound_success_file_chooser =
- glade_helper_get (xml,
- "acc_sound_success_button",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
-
- access_sound_success_play_button =
- glade_helper_get (xml,
- "acc_soundtest_success_button",
- GTK_TYPE_BUTTON);
-
- access_sound_failure_file_chooser =
- glade_helper_get (xml,
- "acc_sound_failure_button",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
-
- access_sound_failure_play_button =
- glade_helper_get (xml,
- "acc_soundtest_failure_button",
- GTK_TYPE_BUTTON);
+ enable_accessible_login = glade_xml_get_widget (xml, "acc_modules");
+
+ access_sound_ready_file_chooser = glade_xml_get_widget (xml, "acc_sound_ready_button");
+
+ access_sound_ready_play_button = glade_xml_get_widget (xml, "acc_soundtest_ready_button");
+
+ access_sound_success_file_chooser = glade_xml_get_widget (xml, "acc_sound_success_button");
+
+ access_sound_success_play_button = glade_xml_get_widget (xml, "acc_soundtest_success_button");
+
+ access_sound_failure_file_chooser = glade_xml_get_widget (xml, "acc_sound_failure_button");
+
+ access_sound_failure_play_button = glade_xml_get_widget (xml, "acc_soundtest_failure_button");
setup_greeter_toggle ("acc_theme",
GDM_KEY_ALLOW_GTK_THEME_CHANGE);
@@ -4628,10 +4524,8 @@ gg_selection_changed (GtkTreeSelection *selection, gpointer data)
gchar *str;
gint selected = -1;
- delete_button = glade_helper_get (xml, "gg_delete_theme",
- GTK_TYPE_BUTTON);
- delete_button_remote = glade_helper_get (xml, "gg_delete_theme_remote",
- GTK_TYPE_BUTTON);
+ delete_button = glade_xml_get_widget (xml, "gg_delete_theme");
+ delete_button_remote = glade_xml_get_widget (xml, "gg_delete_theme_remote");
if ( !gtk_tree_selection_get_selected (selection, &model, &iter)) {
gtk_widget_set_sensitive (delete_button, FALSE);
@@ -4648,13 +4542,11 @@ gg_selection_changed (GtkTreeSelection *selection, gpointer data)
GtkTreeModel *model;
GtkTreePath *path;
- theme_list = glade_helper_get (xml, "gg_theme_list_remote",
- GTK_TYPE_TREE_VIEW);
+ theme_list = glade_xml_get_widget (xml, "gg_theme_list_remote");
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (theme_list));
model = gtk_tree_view_get_model (GTK_TREE_VIEW (theme_list));
- local_combobox = glade_helper_get (xml, "gg_mode_combobox",
- GTK_TYPE_COMBO_BOX);
+ local_combobox = glade_xml_get_widget (xml, "gg_mode_combobox");
selected = gtk_combo_box_get_active (GTK_COMBO_BOX (local_combobox));
if (model != NULL) {
@@ -4676,8 +4568,7 @@ gg_selection_changed (GtkTreeSelection *selection, gpointer data)
GtkTreeModel *model;
GtkTreePath *path;
- theme_list = glade_helper_get (xml, "gg_theme_list",
- GTK_TYPE_TREE_VIEW);
+ theme_list = glade_xml_get_widget (xml, "gg_theme_list");
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (theme_list));
model = gtk_tree_view_get_model (GTK_TREE_VIEW (theme_list));
@@ -4728,12 +4619,10 @@ gg_selection_changed (GtkTreeSelection *selection, gpointer data)
else {
str = g_strconcat (_("None"), NULL);
}
-
- label = glade_helper_get (xml, "gg_author_text_view",
- GTK_TYPE_TEXT_VIEW);
- label_remote = glade_helper_get (xml, "gg_author_text_view_remote",
- GTK_TYPE_TEXT_VIEW);
-
+
+ label = glade_xml_get_widget (xml, "gg_author_text_view");
+ label_remote = glade_xml_get_widget (xml, "gg_author_text_view_remote");
+
textview_set_buffer (GTK_TEXT_VIEW (label), "");
textview_set_buffer (GTK_TEXT_VIEW (label_remote), "");
@@ -4760,10 +4649,8 @@ gg_selection_changed (GtkTreeSelection *selection, gpointer data)
THEME_COLUMN_COPYRIGHT,
&value);
- label = glade_helper_get (xml, "gg_copyright_text_view",
- GTK_TYPE_TEXT_VIEW);
- label_remote = glade_helper_get (xml, "gg_copyright_text_view_remote",
- GTK_TYPE_TEXT_VIEW);
+ label = glade_xml_get_widget (xml, "gg_copyright_text_view");
+ label_remote = glade_xml_get_widget (xml, "gg_copyright_text_view_remote");
textview_set_buffer (GTK_TEXT_VIEW (label), "");
textview_set_buffer (GTK_TEXT_VIEW (label_remote), "");
@@ -4812,7 +4699,8 @@ read_themes (GtkListStore *store, const char *theme_dir, DIR *dir,
GtkTreeIter iter;
gboolean sel_theme;
gboolean sel_themes;
- VeConfig *theme_file;
+ GKeyFile *theme_file;
+
if (dent->d_name[0] == '.')
continue;
n = g_strconcat (theme_dir, "/", dent->d_name,
@@ -4827,8 +4715,6 @@ read_themes (GtkListStore *store, const char *theme_dir, DIR *dir,
continue;
}
- theme_file = ve_config_new (n);
-
file = gdm_get_theme_greeter (n, dent->d_name);
full = g_strconcat (theme_dir, "/", dent->d_name,
"/", file, NULL);
@@ -4857,23 +4743,21 @@ read_themes (GtkListStore *store, const char *theme_dir, DIR *dir,
else
sel_themes = FALSE;
- name = ve_config_get_translated_string
- (theme_file, "GdmGreeterTheme/Name");
+ theme_file = gdm_common_config_load (n, NULL);
+ name = NULL;
+ gdm_common_config_get_translated_string (theme_file, "GdmGreeterTheme/Name", &name, NULL);
if (ve_string_empty (name)) {
g_free (name);
name = g_strdup (dent->d_name);
}
- desc = ve_config_get_translated_string
- (theme_file, "GdmGreeterTheme/Description");
- author = ve_config_get_translated_string
- (theme_file, "GdmGreeterTheme/Author");
- copyright = ve_config_get_translated_string
- (theme_file, "GdmGreeterTheme/Copyright");
- ss = ve_config_get_translated_string
- (theme_file, "GdmGreeterTheme/Screenshot");
+ desc = author = copyright = ss = NULL;
+ gdm_common_config_get_translated_string (theme_file, "GdmGreeterTheme/Description", &desc, NULL);
+ gdm_common_config_get_translated_string (theme_file, "GdmGreeterTheme/Author", &author, NULL);
+ gdm_common_config_get_translated_string (theme_file, "GdmGreeterTheme/Copyright", &copyright, NULL);
+ gdm_common_config_get_translated_string (theme_file, "GdmGreeterTheme/Screenshot", &ss, NULL);
- ve_config_destroy (theme_file);
+ g_key_file_free (theme_file);
if (ss != NULL)
full = g_strconcat (theme_dir, "/", dent->d_name,
@@ -4999,12 +4883,9 @@ selected_toggled (GtkCellRendererToggle *cell,
GtkTreeIter iter;
GtkTreePath *path;
GtkTreePath *sel_path = gtk_tree_path_new_from_string (path_str);
- GtkWidget *theme_list = glade_helper_get (xml, "gg_theme_list",
- GTK_TYPE_TREE_VIEW);
- GtkWidget *del_button = glade_helper_get (xml, "gg_delete_theme",
- GTK_TYPE_BUTTON);
- GtkWidget *del_button_remote = glade_helper_get (xml, "gg_delete_theme_remote",
- GTK_TYPE_BUTTON);
+ GtkWidget *theme_list = glade_xml_get_widget (xml, "gg_theme_list");
+ GtkWidget *del_button = glade_xml_get_widget (xml, "gg_delete_theme");
+ GtkWidget *del_button_remote = glade_xml_get_widget (xml, "gg_delete_theme_remote");
gboolean is_radio;
gtk_tree_model_get_iter (model, &selected_iter, sel_path);
@@ -5085,19 +4966,17 @@ selected_toggled (GtkCellRendererToggle *cell,
/* There are no themes selected atm in the Random form selected mode.
We need to inform users that is the case */
if (ve_string_empty (selected_themes)) {
- GtkWidget *setup_dialog = glade_helper_get(xml,
- "setup_dialog", GTK_TYPE_WINDOW);
-
- GtkWidget *dlg =
- ve_hig_dialog_new (GTK_WINDOW (setup_dialog),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- _("No themes selected!"),
- _("You need one or more themes selected for "
- "the \"Random from selected\" option to be "
- "valid. Failure to do so will force "
- "\"Selected only\" mode."));
+ GtkWidget *setup_dialog = glade_xml_get_widget(xml, "setup_dialog");
+
+ GtkWidget *dlg = hig_dialog_new (GTK_WINDOW (setup_dialog),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ _("No themes selected!"),
+ _("You need one or more themes selected for "
+ "the \"Random from selected\" option to be "
+ "valid. Failure to do so will force "
+ "\"Selected only\" mode."));
gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg);
}
@@ -5419,7 +5298,7 @@ install_theme_file (gchar *filename, GtkListStore *store, GtkWindow *parent)
gchar *untar_cmd;
gboolean success = FALSE;
- theme_list = glade_helper_get (xml, "gg_theme_list", GTK_TYPE_TREE_VIEW);
+ theme_list = glade_xml_get_widget (xml, "gg_theme_list");
cwd = g_get_current_dir ();
theme_dir = get_theme_dir ();
@@ -5445,13 +5324,13 @@ install_theme_file (gchar *filename, GtkListStore *store, GtkWindow *parent)
msg = g_strdup_printf (_("%s"), error);
- dialog = ve_hig_dialog_new (GTK_WINDOW (parent),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Not a theme archive"),
- msg);
+ dialog = hig_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Not a theme archive"),
+ msg);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
g_free (theme_dir);
@@ -5476,13 +5355,13 @@ install_theme_file (gchar *filename, GtkListStore *store, GtkWindow *parent)
"installed. Install again anyway?"),
fname);
- dialog = ve_hig_dialog_new (GTK_WINDOW (parent),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
- s,
- "");
+ dialog = hig_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_NONE,
+ s,
+ "");
g_free (fname);
g_free (s);
@@ -5559,14 +5438,14 @@ install_theme_file (gchar *filename, GtkListStore *store, GtkWindow *parent)
GtkWidget *dialog;
- dialog = ve_hig_dialog_new (GTK_WINDOW (parent),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Some error occurred when "
- "installing the theme"),
- "");
+ dialog = hig_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Some error occurred when "
+ "installing the theme"),
+ "");
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
@@ -5615,13 +5494,13 @@ theme_install_response (GtkWidget *chooser, gint response, gpointer data)
GtkWidget *dialog;
- dialog = ve_hig_dialog_new (GTK_WINDOW (chooser),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("No file selected"),
- "");
+ dialog = hig_dialog_new (GTK_WINDOW (chooser),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("No file selected"),
+ "");
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
return;
@@ -5639,7 +5518,7 @@ install_new_theme (GtkWidget *button, gpointer data)
static GtkWidget *chooser = NULL;
GtkWidget *setup_dialog;
- setup_dialog = glade_helper_get (xml, "setup_dialog", GTK_TYPE_WINDOW);
+ setup_dialog = glade_xml_get_widget (xml, "setup_dialog");
chooser = gtk_file_chooser_dialog_new (_("Select Theme Archive"),
GTK_WINDOW (setup_dialog),
@@ -5683,18 +5562,13 @@ delete_theme (GtkWidget *button, gpointer data)
gboolean selected_warning = FALSE;
gint selected = -1;
- setup_dialog = glade_helper_get (xml, "setup_dialog", GTK_TYPE_WINDOW);
- theme_list = glade_helper_get (xml, "gg_theme_list",
- GTK_TYPE_TREE_VIEW);
- theme_list_remote = glade_helper_get (xml, "gg_theme_list_remote",
- GTK_TYPE_TREE_VIEW);
- del_button = glade_helper_get (xml, "gg_delete_theme",
- GTK_TYPE_BUTTON);
- del_button_remote = glade_helper_get (xml, "gg_delete_theme_remote",
- GTK_TYPE_BUTTON);
- local_combobox = glade_helper_get (xml, "gg_mode_combobox",
- GTK_TYPE_COMBO_BOX);
-
+ setup_dialog = glade_xml_get_widget (xml, "setup_dialog");
+ theme_list = glade_xml_get_widget (xml, "gg_theme_list");
+ theme_list_remote = glade_xml_get_widget (xml, "gg_theme_list_remote");
+ del_button = glade_xml_get_widget (xml, "gg_delete_theme");
+ del_button_remote = glade_xml_get_widget (xml, "gg_delete_theme_remote");
+ local_combobox = glade_xml_get_widget (xml, "gg_mode_combobox");
+
if (gtk_notebook_get_current_page (GTK_NOTEBOOK (setup_notebook)) == LOCAL_TAB) {
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (theme_list));
}
@@ -5744,15 +5618,15 @@ delete_theme (GtkWidget *button, gpointer data)
mode is currently in use in the "Selected only" mode
so lets warn the user about it */
if (selected_warning == TRUE) {
- dlg = ve_hig_dialog_new (GTK_WINDOW (setup_dialog) /* parent */,
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT /* flags */,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- _("Theme active in \"Selected only\" mode"),
- _("This theme cannot be deleted at this point. "
- "If you wish to delete this theme switch to "
- "\"Selected only\" mode, and deselect it by "
- "choosing a different theme."));
+ dlg = hig_dialog_new (GTK_WINDOW (setup_dialog) /* parent */,
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT /* flags */,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ _("Theme active in \"Selected only\" mode"),
+ _("This theme cannot be deleted at this point. "
+ "If you wish to delete this theme switch to "
+ "\"Selected only\" mode, and deselect it by "
+ "choosing a different theme."));
gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg);
}
@@ -5780,13 +5654,12 @@ delete_theme (GtkWidget *button, gpointer data)
s = g_strdup_printf (_("Remove the \"%s\" theme?"),
name);
- dlg = ve_hig_dialog_new
- (GTK_WINDOW (setup_dialog),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_NONE,
- s,
+ dlg = hig_dialog_new (GTK_WINDOW (setup_dialog),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ s,
_("If you choose to remove the theme, it will be permanently lost."));
g_free (s);
@@ -5857,8 +5730,7 @@ xserver_entry_timeout (GtkWidget *entry)
gchar *string_old = NULL;
gchar *section;
- mod_combobox = glade_helper_get (xml_xservers, "xserver_mod_combobox",
- GTK_TYPE_COMBO_BOX);
+ mod_combobox = glade_xml_get_widget (xml_xservers, "xserver_mod_combobox");
/* Get xserver section to update */
section = gtk_combo_box_get_active_text (GTK_COMBO_BOX (mod_combobox));
@@ -5906,10 +5778,9 @@ xserver_priority_timeout (GtkWidget *entry)
const char *key = g_object_get_data (G_OBJECT (entry), "key");
gint value = 0;
gchar *section;
-
- mod_combobox = glade_helper_get (xml_xservers, "xserver_mod_combobox",
- GTK_TYPE_COMBO_BOX);
-
+
+ mod_combobox = glade_xml_get_widget (xml_xservers, "xserver_mod_combobox");
+
/* Get xserver section to update */
section = gtk_combo_box_get_active_text (GTK_COMBO_BOX (mod_combobox));
@@ -5945,8 +5816,7 @@ xserver_toggle_timeout (GtkWidget *toggle)
gboolean val = FALSE;
gchar *section;
- mod_combobox = glade_helper_get (xml_xservers, "xserver_mod_combobox",
- GTK_TYPE_COMBO_BOX);
+ mod_combobox = glade_xml_get_widget (xml_xservers, "xserver_mod_combobox");
/* Get xserver section to update */
section = gtk_combo_box_get_active_text (GTK_COMBO_BOX (mod_combobox));
@@ -6031,10 +5901,8 @@ static void
xserver_init_server_list ()
{
/* Get Widgets from glade */
- GtkWidget *treeview = glade_helper_get (xml_xservers, "xserver_tree_view",
- GTK_TYPE_TREE_VIEW);
- GtkWidget *remove_button = glade_helper_get (xml_xservers, "xserver_remove_button",
- GTK_TYPE_BUTTON);
+ GtkWidget *treeview = glade_xml_get_widget (xml_xservers, "xserver_tree_view");
+ GtkWidget *remove_button = glade_xml_get_widget (xml_xservers, "xserver_remove_button");
/* create list store */
GtkListStore *store = gtk_list_store_new (XSERVER_NUM_COLUMNS,
@@ -6058,8 +5926,7 @@ xserver_init_servers ()
/* Init widget states */
xserver_init_server_list();
- remove_button = glade_helper_get (xml_xservers, "xserver_remove_button",
- GTK_TYPE_BUTTON);
+ remove_button = glade_xml_get_widget (xml_xservers, "xserver_remove_button");
gtk_widget_set_sensitive (remove_button, FALSE);
}
@@ -6068,8 +5935,7 @@ xserver_row_selected(GtkTreeSelection *selection, gpointer data)
{
GtkWidget *remove_button;
- remove_button = glade_helper_get (xml_xservers, "xserver_remove_button",
- GTK_TYPE_BUTTON);
+ remove_button = glade_xml_get_widget (xml_xservers, "xserver_remove_button");
gtk_widget_set_sensitive (remove_button, TRUE);
}
@@ -6087,20 +5953,20 @@ xserver_remove_display (gpointer data)
gint vt;
char vt_value[3];
- treeview = glade_helper_get (xml_xservers, "xserver_tree_view",
- GTK_TYPE_TREE_VIEW);
+ treeview = glade_xml_get_widget (xml_xservers, "xserver_tree_view");
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- VeConfig *cfg = ve_config_get (config_file);
- VeConfig *custom_cfg = ve_config_get (custom_config_file);
+ if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
+ GKeyFile *cfg;
+ GKeyFile *custom_cfg;
gchar *defaultval;
gchar *key;
- combo = glade_helper_get (xml_add_xservers, "xserver_server_combobox",
- GTK_TYPE_COMBO_BOX);
+ cfg = gdm_common_config_load (config_file, NULL);
+ custom_cfg = gdm_common_config_load (custom_config_file, NULL);
+
+ combo = glade_xml_get_widget (xml_add_xservers, "xserver_server_combobox");
/* Update config */
gtk_tree_model_get (model, &iter, XSERVER_COLUMN_VT, &vt, -1);
@@ -6108,50 +5974,52 @@ xserver_remove_display (gpointer data)
g_snprintf (vt_value, sizeof (vt_value), "%d", vt);
key = g_strconcat (GDM_KEY_SECTION_SERVERS, "/", vt_value, "=", NULL);
- defaultval = ve_config_get_string (cfg, key);
+ defaultval = NULL;
+ gdm_common_config_get_string (cfg, key, &defaultval, NULL);
/*
* If the value is in the default config file, set it to inactive in
* the custom config file, else delete it
*/
if (! ve_string_empty (defaultval)) {
- ve_config_set_string (custom_cfg, key, "inactive");
+ gdm_common_config_set_string (custom_cfg, key, "inactive");
} else {
- ve_config_delete_key (custom_cfg, key);
+ gdm_common_config_remove_key (custom_cfg, key, NULL);
}
g_free (defaultval);
- ve_config_save (custom_cfg, FALSE /* force */);
+ gdm_common_config_save (custom_cfg, custom_config_file, NULL);
+ g_key_file_free (custom_cfg);
+ g_key_file_free (cfg);
/* Update gdmsetup */
xserver_init_server_list ();
xserver_update_delete_sensitivity ();
}
}
-
+
/* Add a display to the list of displays to start */
static void
xserver_add_display (gpointer data)
{
- VeConfig *cfg = ve_config_get (config_file);
- VeConfig *custom_cfg = ve_config_get (custom_config_file);
+ GKeyFile *cfg;
+ GKeyFile *custom_cfg;
GtkWidget *spinner, *combo, *entry, *button;
gchar *string;
gchar *defaultval;
char spinner_value[3], *key;
+ cfg = gdm_common_config_load (config_file, NULL);
+ custom_cfg = gdm_common_config_load (custom_config_file, NULL);
+
/* Get Widgets from glade */
- spinner = glade_helper_get (xml_add_xservers, "xserver_spin_button",
- GTK_TYPE_SPIN_BUTTON);
- entry = glade_helper_get (xml_add_xservers, "xserver_options_entry",
- GTK_TYPE_ENTRY);
- combo = glade_helper_get (xml_add_xservers, "xserver_server_combobox",
- GTK_TYPE_COMBO_BOX);
- button = glade_helper_get (xml_xservers, "xserver_add_button",
- GTK_TYPE_BUTTON);
+ spinner = glade_xml_get_widget (xml_add_xservers, "xserver_spin_button");
+ entry = glade_xml_get_widget (xml_add_xservers, "xserver_options_entry");
+ combo = glade_xml_get_widget (xml_add_xservers, "xserver_server_combobox");
+ button = glade_xml_get_widget (xml_xservers, "xserver_add_button");
/* String to add to config */
- g_snprintf (spinner_value, sizeof (spinner_value), "%d",
+ g_snprintf (spinner_value, sizeof (spinner_value), "%d",
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinner)));
key = g_strconcat (GDM_KEY_SECTION_SERVERS, "/", spinner_value, "=", NULL);
@@ -6163,15 +6031,20 @@ xserver_add_display (gpointer data)
string = g_strdup (gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo)));
}
- defaultval = ve_config_get_string (cfg, key);
+ defaultval = NULL;
+ gdm_common_config_get_string (cfg, key, &defaultval, NULL);
/* Add to config */
- if (strcmp (ve_sure_string (defaultval), ve_sure_string (string)) == 0)
- ve_config_delete_key (custom_cfg, key);
- else
- ve_config_set_string (custom_cfg, key, ve_sure_string(string));
+ if (strcmp (ve_sure_string (defaultval), ve_sure_string (string)) == 0) {
+ gdm_common_config_remove_key (custom_cfg, key, NULL);
+ } else {
+ gdm_common_config_set_string (custom_cfg, key, ve_sure_string(string));
+ }
+
+ gdm_common_config_save (custom_cfg, custom_config_file, NULL);
+ g_key_file_free (custom_cfg);
+ g_key_file_free (cfg);
- ve_config_save (custom_cfg, FALSE /* force */);
/* Reinitialize gdmsetup */
xserver_init_servers ();
xserver_update_delete_sensitivity ();
@@ -6198,20 +6071,17 @@ xserver_add_button_clicked (void)
gboolean res;
if (dialog == NULL) {
- parent = glade_helper_get (xml_xservers, "xserver_dialog", GTK_TYPE_WINDOW);
- dialog = glade_helper_get (xml_add_xservers, "add_xserver_dialog", GTK_TYPE_DIALOG);
+ parent = glade_xml_get_widget (xml_xservers, "xserver_dialog");
+ dialog = glade_xml_get_widget (xml_add_xservers, "add_xserver_dialog");
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
}
- vt_spinbutton = glade_helper_get (xml_add_xservers, "xserver_spin_button",
- GTK_TYPE_SPIN_BUTTON);
- server_combobox = glade_helper_get (xml_add_xservers, "xserver_server_combobox",
- GTK_TYPE_COMBO_BOX);
- options_entry = glade_helper_get (xml_add_xservers, "xserver_options_entry",
- GTK_TYPE_ENTRY);
-
+ vt_spinbutton = glade_xml_get_widget (xml_add_xservers, "xserver_spin_button");
+ server_combobox = glade_xml_get_widget (xml_add_xservers, "xserver_server_combobox");
+ options_entry = glade_xml_get_widget (xml_add_xservers, "xserver_options_entry");
+
activate_signal_id = g_signal_connect (G_OBJECT (vt_spinbutton), "activate",
G_CALLBACK (vt_spinbutton_activate),
(gpointer) dialog);
@@ -6220,8 +6090,7 @@ xserver_add_button_clicked (void)
gtk_widget_grab_focus (vt_spinbutton);
- treeview = glade_helper_get (xml_xservers, "xserver_tree_view",
- GTK_TYPE_TREE_VIEW);
+ treeview = glade_xml_get_widget (xml_xservers, "xserver_tree_view");
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
/* set default values */
@@ -6297,35 +6166,24 @@ xserver_create (gpointer data)
GtkWidget *priority_spinbutton;
/* Get Widgets from glade */
- frame = glade_helper_get (xml, "xserver_modify_frame",
- GTK_TYPE_FRAME);
- name_entry = glade_helper_get (xml, "xserver_name_entry",
- GTK_TYPE_ENTRY);
- command_entry = glade_helper_get (xml, "xserver_command_entry",
- GTK_TYPE_ENTRY);
- priority_spinbutton = glade_helper_get(xml, "xserv_priority_spinbutton",
- GTK_TYPE_SPIN_BUTTON);
- handled_check = glade_helper_get (xml, "xserver_handled_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
- flexible_check = glade_helper_get (xml, "xserver_flexible_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
- greeter_radio = glade_helper_get (xml, "xserver_greeter_radiobutton",
- GTK_TYPE_RADIO_BUTTON);
- chooser_radio = glade_helper_get (xml, "xserver_chooser_radiobutton",
- GTK_TYPE_RADIO_BUTTON);
- modify_combobox = glade_helper_get (xml, "xserver_mod_combobox",
- GTK_TYPE_COMBO_BOX);
- create_button = glade_helper_get (xml, "xserver_create_button",
- GTK_TYPE_BUTTON);
- delete_button = glade_helper_get (xml, "xserver_delete_button",
- GTK_TYPE_BUTTON);
+ frame = glade_xml_get_widget (xml, "xserver_modify_frame");
+ name_entry = glade_xml_get_widget (xml, "xserver_name_entry");
+ command_entry = glade_xml_get_widget (xml, "xserver_command_entry");
+ priority_spinbutton = glade_xml_get_widget(xml, "xserv_priority_spinbutton");
+ handled_check = glade_xml_get_widget (xml, "xserver_handled_checkbutton");
+ flexible_check = glade_xml_get_widget (xml, "xserver_flexible_checkbutton");
+ greeter_radio = glade_xml_get_widget (xml, "xserver_greeter_radiobutton");
+ chooser_radio = glade_xml_get_widget (xml, "xserver_chooser_radiobutton");
+ modify_combobox = glade_xml_get_widget (xml, "xserver_mod_combobox");
+ create_button = glade_xml_get_widget (xml, "xserver_create_button");
+ delete_button = glade_xml_get_widget (xml, "xserver_delete_button");
gtk_combo_box_append_text (GTK_COMBO_BOX (modify_combobox),
"New Server");
/* TODO: Create a new section for this server */
/* TODO: Write this value to the config and update xservers list */
- /* cfg = ve_config_get (custom_config_file); */
+ /* cfg = gdm_common_config_load (custom_config_file, NULL); */
success = FALSE;
/* success = ve_config_add_section (cfg, SECTION_NAME); */
@@ -6363,10 +6221,8 @@ xserver_init_definitions ()
GtkWidget *style_combobox;
GtkWidget *modify_combobox;
- style_combobox = glade_helper_get (xml_xservers, "xserver_style_combobox",
- GTK_TYPE_COMBO_BOX);
- modify_combobox = glade_helper_get (xml_xservers, "xserver_mod_combobox",
- GTK_TYPE_COMBO_BOX);
+ style_combobox = glade_xml_get_widget (xml_xservers, "xserver_style_combobox");
+ modify_combobox = glade_xml_get_widget (xml_xservers, "xserver_mod_combobox");
xserver_populate_combobox (GTK_COMBO_BOX (modify_combobox));
@@ -6397,14 +6253,16 @@ static void
xserver_delete (gpointer data)
{
gchar temp_string;
-
/* Get xserver section to delete */
- GtkWidget *combobox = glade_helper_get (xml_xservers, "xserver_mod_combobox",
- GTK_TYPE_COMBO_BOX);
- gchar *section = gtk_combo_box_get_active_text ( GTK_COMBO_BOX (combobox));
-
+ GtkWidget *combobox;
+ gchar *section;
/* Delete xserver section */
- VeConfig *custom_cfg = ve_config_get (custom_config_file);
+ VeConfig *custom_cfg;
+
+ combobox = glade_xml_get_widget (xml_xservers, "xserver_mod_combobox");
+ section = gtk_combo_box_get_active_text ( GTK_COMBO_BOX (combobox));
+ custom_cfg = ve_config_get (custom_config_file);
+
temp_string = g_strconcat (GDM_KEY_SERVER_PREFIX, section, NULL);
ve_config_delete_section (custom_cfg, temp_string);
g_free (temp_string);
@@ -6440,28 +6298,17 @@ setup_xserver_support (GladeXML *xml_xservers)
/* setup_xrandr_support (); */
/* Get Widgets from glade */
- treeview = glade_helper_get (xml_xservers, "xserver_tree_view",
- GTK_TYPE_TREE_VIEW);
- name_entry = glade_helper_get (xml_xservers, "xserver_name_entry",
- GTK_TYPE_ENTRY);
- command_entry = glade_helper_get (xml_xservers, "xserver_command_entry",
- GTK_TYPE_ENTRY);
- priority_spinbutton = glade_helper_get(xml_xservers, "xserv_priority_spinbutton",
- GTK_TYPE_SPIN_BUTTON);
- handled_check = glade_helper_get (xml_xservers, "xserver_handled_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
- flexible_check = glade_helper_get (xml_xservers, "xserver_flexible_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
- style_combobox = glade_helper_get (xml_xservers, "xserver_style_combobox",
- GTK_TYPE_COMBO_BOX);
- servers_combobox = glade_helper_get (xml_xservers, "xserver_mod_combobox",
- GTK_TYPE_COMBO_BOX);
- create_button = glade_helper_get (xml_xservers, "xserver_createbutton",
- GTK_TYPE_BUTTON);
- delete_button = glade_helper_get (xml_xservers, "xserver_deletebutton",
- GTK_TYPE_BUTTON);
- remove_button = glade_helper_get (xml_xservers, "xserver_remove_button",
- GTK_TYPE_BUTTON);
+ treeview = glade_xml_get_widget (xml_xservers, "xserver_tree_view");
+ name_entry = glade_xml_get_widget (xml_xservers, "xserver_name_entry");
+ command_entry = glade_xml_get_widget (xml_xservers, "xserver_command_entry");
+ priority_spinbutton = glade_xml_get_widget(xml_xservers, "xserv_priority_spinbutton");
+ handled_check = glade_xml_get_widget (xml_xservers, "xserver_handled_checkbutton");
+ flexible_check = glade_xml_get_widget (xml_xservers, "xserver_flexible_checkbutton");
+ style_combobox = glade_xml_get_widget (xml_xservers, "xserver_style_combobox");
+ servers_combobox = glade_xml_get_widget (xml_xservers, "xserver_mod_combobox");
+ create_button = glade_xml_get_widget (xml_xservers, "xserver_createbutton");
+ delete_button = glade_xml_get_widget (xml_xservers, "xserver_deletebutton");
+ remove_button = glade_xml_get_widget (xml_xservers, "xserver_remove_button");
glade_helper_tagify_label (xml_xservers, "xserver_informationlabel", "i");
glade_helper_tagify_label (xml_xservers, "xserver_informationlabel", "small");
@@ -6563,19 +6410,13 @@ xserver_button_clicked (void)
GtkWidget *parent;
GtkWidget *button;
- xml_xservers = glade_helper_load ("gdmsetup.glade",
- "xserver_dialog",
- GTK_TYPE_DIALOG,
- TRUE);
+ xml_xservers = glade_xml_new (GDM_GLADE_DIR "/gdmsetup.glade", "xserver_dialog", NULL);
- xml_add_xservers = glade_helper_load ("gdmsetup.glade",
- "add_xserver_dialog",
- GTK_TYPE_DIALOG,
- TRUE);
+ xml_add_xservers = glade_xml_new (GDM_GLADE_DIR "/gdmsetup.glade", "add_xserver_dialog", NULL);
- parent = glade_helper_get (xml, "setup_dialog", GTK_TYPE_WINDOW);
- dialog = glade_helper_get (xml_xservers, "xserver_dialog", GTK_TYPE_DIALOG);
- button = glade_helper_get (xml_xservers, "xserver_add_button", GTK_TYPE_BUTTON);
+ parent = glade_xml_get_widget (xml, "setup_dialog");
+ dialog = glade_xml_get_widget (xml_xservers, "xserver_dialog");
+ button = glade_xml_get_widget (xml_xservers, "xserver_add_button");
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
@@ -6605,7 +6446,7 @@ setup_radio_group (const gchar *name,
GtkWidget *radio;
gint val;
- radio = glade_helper_get (xml, name, GTK_TYPE_RADIO_BUTTON);
+ radio = glade_xml_get_widget (xml, name);
val = gdm_config_get_int ((gchar *)key);
if (val == position)
@@ -6646,14 +6487,12 @@ setup_security_tab (void)
setup_intspin ("retry_delay", GDM_KEY_RETRY_DELAY);
/* Bold the Enable automatic login label */
- checkbox = glade_helper_get (xml, "autologin",
- GTK_TYPE_CHECK_BUTTON);
- label = gtk_bin_get_child (GTK_BIN (checkbox));
+ checkbox = glade_xml_get_widget (xml, "autologin");
+ label = gtk_bin_get_child (GTK_BIN (checkbox));
g_object_set (G_OBJECT (label), "use_markup", TRUE, NULL);
/* Bold the Enable timed login label */
- checkbox = glade_helper_get (xml, "timedlogin",
- GTK_TYPE_CHECK_BUTTON);
+ checkbox = glade_xml_get_widget (xml, "timedlogin");
label = gtk_bin_get_child (GTK_BIN (checkbox));
g_object_set (G_OBJECT (label), "use_markup", TRUE, NULL);
@@ -6683,8 +6522,7 @@ setup_security_tab (void)
setup_intspin ("minimal_uid_spinbutton", GDM_KEY_MINIMAL_UID);
/* Setup Configure XDMCP button */
- XDMCPbutton = glade_helper_get (xml, "config_xserverbutton",
- GTK_TYPE_BUTTON);
+ XDMCPbutton = glade_xml_get_widget (xml, "config_xserverbutton");
setup_xdmcp_support ();
g_signal_connect (G_OBJECT (XDMCPbutton), "clicked",
G_CALLBACK (xserver_button_clicked), NULL);
@@ -6746,8 +6584,8 @@ theme_list_drag_data_received (GtkWidget *widget,
GtkListStore *store;
GList *list;
- parent = glade_helper_get (xml, "setup_dialog", GTK_TYPE_WINDOW);
- theme_list = glade_helper_get (xml, "gg_theme_list", GTK_TYPE_TREE_VIEW);
+ parent = glade_xml_get_widget (xml, "setup_dialog");
+ theme_list = glade_xml_get_widget (xml, "gg_theme_list");
store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (theme_list)));
gtk_drag_finish (context, TRUE, FALSE, time);
@@ -6764,12 +6602,12 @@ theme_list_drag_data_received (GtkWidget *widget,
mesg = g_strdup_printf (_("Install the theme from '%s'?"), base);
detail = g_strdup_printf (_("Select install to add the theme from the file '%s'."), (gchar *)list->data);
- prompt = ve_hig_dialog_new (GTK_WINDOW (parent),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
- mesg,
- detail);
+ prompt = hig_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_NONE,
+ mesg,
+ detail);
gtk_dialog_add_button (GTK_DIALOG (prompt), "gtk-cancel", GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (prompt), _("_Install"), GTK_RESPONSE_OK);
@@ -6832,24 +6670,18 @@ setup_local_themed_settings (void)
GtkSizeGroup *size_group;
char *theme_dir;
- GtkWidget *theme_list = glade_helper_get (xml, "gg_theme_list",
- GTK_TYPE_TREE_VIEW);
- GtkWidget *button = glade_helper_get (xml, "gg_install_new_theme",
- GTK_TYPE_BUTTON);
- GtkWidget *del_button = glade_helper_get (xml, "gg_delete_theme",
- GTK_TYPE_BUTTON);
- GtkWidget *mode_combobox = glade_helper_get (xml, "gg_mode_combobox",
- GTK_TYPE_COMBO_BOX);
-
- style_label = glade_helper_get (xml, "local_stylelabel", GTK_TYPE_LABEL);
- theme_label = glade_helper_get (xml, "local_theme_label", GTK_TYPE_LABEL);
+ GtkWidget *theme_list = glade_xml_get_widget (xml, "gg_theme_list");
+ GtkWidget *button = glade_xml_get_widget (xml, "gg_install_new_theme");
+ GtkWidget *del_button = glade_xml_get_widget (xml, "gg_delete_theme");
+ GtkWidget *mode_combobox = glade_xml_get_widget (xml, "gg_mode_combobox");
+
+ style_label = glade_xml_get_widget (xml, "local_stylelabel");
+ theme_label = glade_xml_get_widget (xml, "local_theme_label");
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
gtk_size_group_add_widget (size_group, style_label);
gtk_size_group_add_widget (size_group, theme_label);
- color_colorbutton = glade_helper_get (xml,
- "local_background_theme_colorbutton",
- GTK_TYPE_COLOR_BUTTON);
+ color_colorbutton = glade_xml_get_widget (xml, "local_background_theme_colorbutton");
g_object_set_data (G_OBJECT (color_colorbutton), "key",
GDM_KEY_GRAPHICAL_THEMED_COLOR);
@@ -6999,8 +6831,7 @@ dialog_response (GtkWidget *dlg, int response, gpointer data)
timeout_remove_all ();
gtk_main_quit ();
} else if (response == GTK_RESPONSE_HELP) {
- GtkWidget *setup_dialog = glade_helper_get
- (xml, "setup_dialog", GTK_TYPE_WINDOW);
+ GtkWidget *setup_dialog = glade_xml_get_widget (xml, "setup_dialog");
static GtkWidget *dlg = NULL;
if (dlg != NULL) {
@@ -7111,14 +6942,9 @@ logo_filechooser_response (GtkWidget *file_chooser, gpointer data)
}
if (gtk_notebook_get_current_page (GTK_NOTEBOOK (setup_notebook)) == LOCAL_TAB) {
- image_toggle = glade_helper_get (xml,
- "remote_logo_image_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
-
+ image_toggle = glade_xml_get_widget (xml, "remote_logo_image_checkbutton");
} else {
- image_toggle = glade_helper_get (xml,
- "remote_logo_image_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
+ image_toggle = glade_xml_get_widget (xml, "remote_logo_image_checkbutton");
}
if (filename != NULL &&
@@ -7219,26 +7045,12 @@ hookup_plain_background (void)
GtkWidget *image_preview;
gchar *background_filename;
- color_radiobutton = glade_helper_get (xml,
- "local_background_color_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
-
- color_colorbutton = glade_helper_get (xml,
- "local_background_colorbutton",
- GTK_TYPE_COLOR_BUTTON);
+ color_radiobutton = glade_xml_get_widget (xml, "local_background_color_checkbutton");
+ color_colorbutton = glade_xml_get_widget (xml, "local_background_colorbutton");
+ image_radiobutton = glade_xml_get_widget (xml, "local_background_image_checkbutton");
+ image_filechooser = glade_xml_get_widget (xml, "local_background_image_chooserbutton");
+ image_scale_to_fit = glade_xml_get_widget (xml, "sg_scale_background");
- image_radiobutton = glade_helper_get (xml,
- "local_background_image_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
-
- image_filechooser = glade_helper_get (xml,
- "local_background_image_chooserbutton",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
-
- image_scale_to_fit = glade_helper_get (xml,
- "sg_scale_background",
- GTK_TYPE_CHECK_BUTTON);
-
setup_greeter_color ("local_background_colorbutton",
GDM_KEY_BACKGROUND_COLOR);
@@ -7382,13 +7194,8 @@ hookup_plain_logo (void)
GtkWidget *image_preview;
gchar *logo_filename;
- logo_checkbutton = glade_helper_get (xml,
- "local_logo_image_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
- logo_button = glade_helper_get (xml,
- "local_logo_image_chooserbutton",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
-
+ logo_checkbutton = glade_xml_get_widget (xml, "local_logo_image_checkbutton");
+ logo_button = glade_xml_get_widget (xml, "local_logo_image_chooserbutton");
gtk_file_chooser_set_use_preview_label (GTK_FILE_CHOOSER (logo_button),
FALSE);
@@ -7511,7 +7318,7 @@ setup_default_session (void)
_gdm_session_list_init (&sessnames, &org_sessions, NULL, NULL);
- default_session_combobox = glade_helper_get (xml, "default_session_combobox", GTK_TYPE_COMBO_BOX);
+ default_session_combobox = glade_xml_get_widget (xml, "default_session_combobox");
org_val = gdm_config_get_string (GDM_KEY_DEFAULT_SESSION);
@@ -7561,10 +7368,8 @@ setup_default_session (void)
g_signal_connect (default_session_combobox, "changed",
G_CALLBACK (combobox_changed), NULL);
- default_session_checkbox = glade_helper_get (xml,
- "default_session_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
-
+ default_session_checkbox = glade_xml_get_widget (xml, "default_session_checkbutton");
+
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (default_session_checkbox), !ve_string_empty (org_val));
g_object_set_data_full (G_OBJECT (default_session_checkbox),
@@ -7607,16 +7412,12 @@ setup_general_tab (void)
setup_default_session ();
/* Setup GtkRC file path */
- gtkrc_filechooser = glade_helper_get (xml,
- "gtkrc_chooserbutton",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
+ gtkrc_filechooser = glade_xml_get_widget (xml, "gtkrc_chooserbutton");
gtkrc_filename = gdm_config_get_string (GDM_KEY_GTKRC);
- gtkrc_checkbox = glade_helper_get (xml,
- "gtkrc_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
-
+ gtkrc_checkbox = glade_xml_get_widget (xml, "gtkrc_checkbutton");
+
if (!ve_string_empty (gtkrc_filename) && access (gtkrc_filename, R_OK) == 0) {
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (gtkrc_filechooser),
gtkrc_filename);
@@ -7651,10 +7452,8 @@ setup_general_tab (void)
g_free (gtkrc_filename);
/* Setup user 24Hr Clock */
- clock_type_chooser = glade_helper_get (xml,
- "use_24hr_clock_combobox",
- GTK_TYPE_COMBO_BOX);
-
+ clock_type_chooser = glade_xml_get_widget (xml, "use_24hr_clock_combobox");
+
user_24hr_clock = gdm_config_get_string (GDM_KEY_USE_24_CLOCK);
if (!ve_string_empty (user_24hr_clock)) {
if (strcasecmp (ve_sure_string (user_24hr_clock), _("auto")) == 0) {
@@ -7673,8 +7472,7 @@ setup_general_tab (void)
g_signal_connect (G_OBJECT (clock_type_chooser), "changed",
G_CALLBACK (combobox_changed), NULL);
- commands_button = glade_helper_get (xml, "configure_commands_button",
- GTK_TYPE_BUTTON);
+ commands_button = glade_xml_get_widget (xml, "configure_commands_button");
g_signal_connect (G_OBJECT (commands_button), "clicked",
G_CALLBACK (command_button_clicked), NULL);
@@ -7700,27 +7498,13 @@ hookup_remote_plain_background (void)
GtkWidget *image_preview;
gchar *background_filename;
- color_radiobutton = glade_helper_get (xml,
- "remote_background_color_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
-
- color_colorbutton = glade_helper_get (xml,
- "remote_background_colorbutton",
- GTK_TYPE_COLOR_BUTTON);
+ color_radiobutton = glade_xml_get_widget (xml, "remote_background_color_checkbutton");
+ color_colorbutton = glade_xml_get_widget (xml, "remote_background_colorbutton");
+ image_radiobutton = glade_xml_get_widget (xml, "remote_background_image_checkbutton");
+ image_filechooser = glade_xml_get_widget (xml, "remote_background_image_chooserbutton");
+ image_scale_to_fit = glade_xml_get_widget (xml, "sg_scale_background_remote");
- image_radiobutton = glade_helper_get (xml,
- "remote_background_image_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
-
- image_filechooser = glade_helper_get (xml,
- "remote_background_image_chooserbutton",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
-
- image_scale_to_fit = glade_helper_get (xml,
- "sg_scale_background_remote",
- GTK_TYPE_CHECK_BUTTON);
-
- setup_greeter_color ("remote_background_colorbutton",
+ setup_greeter_color ("remote_background_colorbutton",
GDM_KEY_BACKGROUND_COLOR);
setup_greeter_toggle ("sg_scale_background_remote",
@@ -7865,13 +7649,8 @@ hookup_remote_plain_logo (void)
GtkWidget *image_preview;
gchar *logo_filename;
- logo_checkbutton = glade_helper_get (xml,
- "remote_logo_image_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
- logo_button = glade_helper_get (xml,
- "remote_logo_image_chooserbutton",
- GTK_TYPE_FILE_CHOOSER_BUTTON);
-
+ logo_checkbutton = glade_xml_get_widget (xml, "remote_logo_image_checkbutton");
+ logo_button = glade_xml_get_widget (xml, "remote_logo_image_chooserbutton");
gtk_file_chooser_set_use_preview_label (GTK_FILE_CHOOSER (logo_button),
FALSE);
@@ -7938,11 +7717,9 @@ setup_remote_plain_settings (void)
GtkSizeGroup *size_group;
GtkWidget *image_checkbutton;
GtkWidget *color_checkbutton;
-
- image_checkbutton = glade_helper_get (xml, "remote_background_image_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
- color_checkbutton = glade_helper_get (xml, "remote_background_color_checkbutton",
- GTK_TYPE_CHECK_BUTTON);
+
+ image_checkbutton = glade_xml_get_widget (xml, "remote_background_image_checkbutton");
+ color_checkbutton = glade_xml_get_widget (xml, "remote_background_color_checkbutton");
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
gtk_size_group_add_widget (size_group, image_checkbutton);
@@ -7978,27 +7755,20 @@ setup_remote_themed_settings (void)
GtkWidget *style_label;
GtkWidget *theme_label;
GtkSizeGroup *size_group;
-
- GtkWidget *theme_list = glade_helper_get (xml, "gg_theme_list_remote",
- GTK_TYPE_TREE_VIEW);
- GtkWidget *theme_list_local = glade_helper_get (xml, "gg_theme_list",
- GTK_TYPE_TREE_VIEW);
- GtkWidget *button = glade_helper_get (xml, "gg_install_new_theme_remote",
- GTK_TYPE_BUTTON);
- GtkWidget *del_button = glade_helper_get (xml, "gg_delete_theme_remote",
- GTK_TYPE_BUTTON);
- GtkWidget *mode_combobox = glade_helper_get (xml, "gg_mode_combobox_remote",
- GTK_TYPE_COMBO_BOX);
-
- style_label = glade_helper_get (xml, "remote_stylelabel", GTK_TYPE_LABEL);
- theme_label = glade_helper_get (xml, "remote_theme_label", GTK_TYPE_LABEL);
+
+ GtkWidget *theme_list = glade_xml_get_widget (xml, "gg_theme_list_remote");
+ GtkWidget *theme_list_local = glade_xml_get_widget (xml, "gg_theme_list");
+ GtkWidget *button = glade_xml_get_widget (xml, "gg_install_new_theme_remote");
+ GtkWidget *del_button = glade_xml_get_widget (xml, "gg_delete_theme_remote");
+ GtkWidget *mode_combobox = glade_xml_get_widget (xml, "gg_mode_combobox_remote");
+
+ style_label = glade_xml_get_widget (xml, "remote_stylelabel");
+ theme_label = glade_xml_get_widget (xml, "remote_theme_label");
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
gtk_size_group_add_widget (size_group, style_label);
gtk_size_group_add_widget (size_group, theme_label);
- color_colorbutton = glade_helper_get (xml,
- "remote_background_theme_colorbutton",
- GTK_TYPE_COLOR_BUTTON);
+ color_colorbutton = glade_xml_get_widget (xml, "remote_background_theme_colorbutton");
g_object_set_data (G_OBJECT (color_colorbutton), "key",
GDM_KEY_GRAPHICAL_THEMED_COLOR);
@@ -8103,9 +7873,8 @@ static void
setup_remote_tab (void)
{
GtkWidget *xdmcp_button;
-
- xdmcp_button = glade_helper_get (xml, "xdmcp_configbutton",
- GTK_TYPE_BUTTON);
+
+ xdmcp_button = glade_xml_get_widget (xml, "xdmcp_configbutton");
#ifndef HAVE_LIBXDMCP
gtk_widget_set_sensitive (xdmcp_button, FALSE);
@@ -8124,20 +7893,16 @@ setup_gui (void)
{
GtkWidget *dialog;
- xml = glade_helper_load ("gdmsetup.glade",
- "setup_dialog",
- GTK_TYPE_DIALOG,
- TRUE /* dump_on_destroy */);
+ xml = glade_xml_new (GDM_GLADE_DIR "/gdmsetup.glade", "setup_dialog", NULL);
- dialog = glade_helper_get (xml, "setup_dialog", GTK_TYPE_DIALOG);
+ dialog = glade_xml_get_widget (xml, "setup_dialog");
g_signal_connect (G_OBJECT (dialog), "delete_event",
G_CALLBACK (delete_event), NULL);
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (dialog_response), NULL);
- setup_notebook = glade_helper_get (xml, "setup_notebook",
- GTK_TYPE_NOTEBOOK);
+ setup_notebook = glade_xml_get_widget (xml, "setup_notebook");
/* Markup glade labels */
glade_helper_tagify_label (xml, "themes_label", "b");
@@ -8220,8 +7985,7 @@ static void
update_sensitivity (void)
{
gboolean sensitive = get_sensitivity ();
- GtkWidget *setup_dialog = glade_helper_get (xml, "setup_dialog",
- GTK_TYPE_WINDOW);
+ GtkWidget *setup_dialog = glade_xml_get_widget (xml, "setup_dialog");
gtk_widget_set_sensitive (setup_dialog, sensitive);
if (sensitive)
unsetup_window_cursor ();
@@ -8303,13 +8067,13 @@ apply_user_changes (GObject *object, gint arg1, gpointer user_data)
GtkWidget *prompt;
- prompt = ve_hig_dialog_new (GTK_WINDOW (dialog),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- _("Random theme mode change"),
- _("Since no themes were selected in random theme mode"
- " switching back to single theme mode."));
+ prompt = hig_dialog_new (GTK_WINDOW (dialog),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ _("Random theme mode change"),
+ _("Since no themes were selected in random theme mode"
+ " switching back to single theme mode."));
gtk_dialog_run (GTK_DIALOG (prompt));
gtk_widget_destroy (prompt);
@@ -8321,13 +8085,13 @@ apply_user_changes (GObject *object, gint arg1, gpointer user_data)
GtkWidget *prompt;
gint response;
- prompt = ve_hig_dialog_new (GTK_WINDOW (dialog),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_NONE,
- _("Apply the changes to users before closing?"),
- _("If you don't apply, the changes made on "
- "the Users tab will be disregarded."));
+ prompt = hig_dialog_new (GTK_WINDOW (dialog),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ _("Apply the changes to users before closing?"),
+ _("If you don't apply, the changes made on "
+ "the Users tab will be disregarded."));
gtk_dialog_add_button (GTK_DIALOG (prompt), _("Close _without Applying"), GTK_RESPONSE_CLOSE);
gtk_dialog_add_button (GTK_DIALOG (prompt), "gtk-cancel", GTK_RESPONSE_CANCEL);
@@ -8339,8 +8103,7 @@ apply_user_changes (GObject *object, gint arg1, gpointer user_data)
if (response == GTK_RESPONSE_APPLY) {
GtkWidget *apply_button;
- apply_button = glade_helper_get (xml, "fb_faceapply",
- GTK_TYPE_WIDGET);
+ apply_button = glade_xml_get_widget (xml, "fb_faceapply");
g_signal_emit_by_name (G_OBJECT (apply_button), "clicked");
}
@@ -8392,12 +8155,12 @@ main (int argc, char *argv[])
/* Done using socket */
gdmcomm_comm_bulk_stop ();
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Could not access configuration file (defaults.conf)"),
- _("Make sure that the file exists before launching login manager config utility."));
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Could not access configuration file (defaults.conf)"),
+ _("Make sure that the file exists before launching login manager config utility."));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -8409,12 +8172,12 @@ main (int argc, char *argv[])
/* Done using socket */
gdmcomm_comm_bulk_stop ();
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Could not access configuration file (custom.conf)"),
- _("Make sure that the file exists before launching login manager config utility."));
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Could not access configuration file (custom.conf)"),
+ _("Make sure that the file exists before launching login manager config utility."));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -8446,8 +8209,6 @@ main (int argc, char *argv[])
g_type_class_ref (GTK_TYPE_WIDGET);
}
- glade_helper_add_glade_directory (GDM_GLADE_DIR);
-
/* Make sure the user is root. If not, they shouldn't be messing with
* GDM's configuration.
*/
@@ -8459,13 +8220,12 @@ main (int argc, char *argv[])
/* Done using socket */
gdmcomm_comm_bulk_stop ();
- fatal_error =
- ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("You must be the root user to configure GDM."),
- "");
+ fatal_error = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("You must be the root user to configure GDM."),
+ "");
if (RUNNING_UNDER_GDM)
setup_cursor (GDK_LEFT_PTR);
gtk_dialog_run (GTK_DIALOG (fatal_error));
diff --git a/gui/gdmuser.c b/gui/gdmuser.c
index f85db2c4..b80aae1b 100644
--- a/gui/gdmuser.c
+++ b/gui/gdmuser.c
@@ -34,6 +34,8 @@
#include "gdmuser.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
static time_t time_started;
static GdmUser *
diff --git a/gui/gdmwm.c b/gui/gdmwm.c
index d8530d34..d6c47506 100644
--- a/gui/gdmwm.c
+++ b/gui/gdmwm.c
@@ -36,6 +36,8 @@
#include "gdmcommon.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
typedef struct _GdmWindow GdmWindow;
struct _GdmWindow {
int x, y;
@@ -1576,6 +1578,32 @@ gdm_wm_show_info_msg_dialog (const gchar *msg_file,
g_free (InfoMsg);
}
+static GtkWidget *
+hig_dialog_new (GtkWindow *parent,
+ GtkDialogFlags flags,
+ GtkMessageType type,
+ GtkButtonsType buttons,
+ const gchar *primary_message,
+ const gchar *secondary_message)
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ type,
+ buttons,
+ "%s", primary_message);
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ "%s", secondary_message);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), "");
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
+
+ return dialog;
+}
+
void
gdm_wm_message_dialog (const gchar *primary_message,
const gchar *secondary_message)
@@ -1585,12 +1613,12 @@ gdm_wm_message_dialog (const gchar *primary_message,
/* we should be now fine for focusing new windows */
gdm_wm_focus_new_windows (TRUE);
- req = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_OK,
- primary_message,
- secondary_message);
+ req = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK,
+ primary_message,
+ secondary_message);
gdm_wm_center_window (GTK_WINDOW (req));
@@ -1614,12 +1642,12 @@ gdm_wm_query_dialog (const gchar *primary_message,
/* we should be now fine for focusing new windows */
gdm_wm_focus_new_windows (TRUE);
- req = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
- primary_message,
- secondary_message);
+ req = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_NONE,
+ primary_message,
+ secondary_message);
if (negbutton != NULL) {
button = gtk_button_new_from_stock (negbutton);
@@ -1673,12 +1701,12 @@ gdm_wm_warn_dialog (const gchar *primary_message,
/* we should be now fine for focusing new windows */
gdm_wm_focus_new_windows (TRUE);
- req = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_NONE,
- primary_message,
- secondary_message);
+ req = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ primary_message,
+ secondary_message);
if (negbutton != NULL) {
button = gtk_button_new_from_stock (negbutton);
diff --git a/gui/greeter/Makefile.am b/gui/greeter/Makefile.am
index 7d0f355b..b5e31f39 100644
--- a/gui/greeter/Makefile.am
+++ b/gui/greeter/Makefile.am
@@ -5,7 +5,7 @@ INCLUDES = \
-I. \
-I$(top_srcdir)/gui \
-I$(top_srcdir)/daemon \
- -I$(top_srcdir)/vicious-extensions \
+ -I$(top_srcdir)/common \
-DAUTHDIR=\""$(authdir)"\" \
-DDATADIR=\""$(datadir)"\" \
-DDMCONFDIR=\""$(dmconfdir)"\" \
@@ -73,13 +73,13 @@ gdmgreeter_SOURCES = \
greeter_session.c \
greeter_session.h \
greeter_system.c \
- greeter_system.h
+ greeter_system.h
gdmgreeter_LDADD = \
-L$(top_builddir)/gui \
-lgdmwm \
-lgdmcommon \
- $(top_builddir)/vicious-extensions/libviciousui-minimal.a \
+ $(top_builddir)/common/libgdmcommon.a \
$(GLIB_LIBS) \
$(GOBJECT_LIBS) \
$(PANGO_LIBS) \
diff --git a/gui/greeter/greeter.c b/gui/greeter/greeter.c
index 2ff4de5a..ded59ff6 100644
--- a/gui/greeter/greeter.c
+++ b/gui/greeter/greeter.c
@@ -24,6 +24,7 @@
#include <unistd.h>
#include <signal.h>
#include <syslog.h>
+#include <errno.h>
#if HAVE_PAM
#include <security/pam_appl.h>
@@ -37,7 +38,7 @@
#include <gdk/gdkkeysyms.h>
#include <libgnomecanvas/libgnomecanvas.h>
-#include "vicious.h"
+#include "gdm-common.h"
#include "gdm.h"
#include "gdmwm.h"
@@ -164,6 +165,32 @@ greeter_ctrl_handler (GIOChannel *source,
return TRUE;
}
+static GtkWidget *
+hig_dialog_new (GtkWindow *parent,
+ GtkDialogFlags flags,
+ GtkMessageType type,
+ GtkButtonsType buttons,
+ const gchar *primary_message,
+ const gchar *secondary_message)
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ type,
+ buttons,
+ "%s", primary_message);
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ "%s", secondary_message);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), "");
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
+
+ return dialog;
+}
+
static void
process_operation (guchar op_code,
const gchar *args)
@@ -174,7 +201,6 @@ process_operation (guchar op_code,
GreeterItemInfo *conversation_info;
static GnomeCanvasItem *disabled_cover = NULL;
gchar *language;
- gchar *selected_user = NULL;
gint lookup_status = SESSION_LOOKUP_SUCCESS;
gchar *firstmsg = NULL;
gchar *secondmsg = NULL;
@@ -254,12 +280,12 @@ process_operation (guchar op_code,
gdm_wm_focus_new_windows (TRUE);
tmp = ve_locale_to_utf8 (args);
- dlg = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- tmp,
- "");
+ dlg = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ tmp,
+ "");
g_free (tmp);
gdm_wm_center_window (GTK_WINDOW (dlg));
@@ -405,15 +431,15 @@ process_operation (guchar op_code,
/* we should be now fine for focusing new windows */
gdm_wm_focus_new_windows (TRUE);
- dlg = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_OK,
- /* translators: This is a nice and evil eggie text, translate
- * to your favourite currency */
- _("Please insert 25 cents "
- "to log in."),
- "");
+ dlg = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK,
+ /* translators: This is a nice and evil eggie text, translate
+ * to your favourite currency */
+ _("Please insert 25 cents "
+ "to log in."),
+ "");
gdm_wm_center_window (GTK_WINDOW (dlg));
gdm_wm_no_login_focus_push ();
@@ -642,12 +668,12 @@ verify_gdm_version (void)
"Please restart the GDM daemon or the computer."),
VERSION);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Cannot start the greeter"),
- msg);
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Cannot start the greeter"),
+ msg);
g_free (msg);
gtk_widget_show_all (dialog);
@@ -677,12 +703,12 @@ verify_gdm_version (void)
"Please restart the GDM daemon or the computer."),
VERSION);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_NONE,
- _("Cannot start the greeter"),
- msg);
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ _("Cannot start the greeter"),
+ msg);
g_free (msg);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
@@ -726,12 +752,12 @@ verify_gdm_version (void)
"Please restart the GDM daemon or the computer."),
VERSION, gdm_version);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_NONE,
- _("Cannot start the greeter"),
- msg);
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ _("Cannot start the greeter"),
+ msg);
g_free (msg);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
@@ -1341,12 +1367,12 @@ main (int argc, char *argv[])
s = g_strdup_printf (_("There was an error loading the "
"theme %s"), tmp);
g_free (tmp);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- s,
- (error && error->message) ? error->message : "");
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ s,
+ (error && error->message) ? error->message : "");
g_free (s);
gtk_widget_show_all (dialog);
@@ -1388,14 +1414,14 @@ main (int argc, char *argv[])
gdm_wm_init (0);
gdm_wm_focus_new_windows (TRUE);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("The greeter theme is corrupt"),
- _("The theme does not contain "
- "definition for the username/password "
- "entry element."));
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("The greeter theme is corrupt"),
+ _("The theme does not contain "
+ "definition for the username/password "
+ "entry element."));
gtk_widget_show_all (dialog);
gdm_wm_center_window (GTK_WINDOW (dialog));
@@ -1422,16 +1448,16 @@ main (int argc, char *argv[])
gdm_wm_init (0);
gdm_wm_focus_new_windows (TRUE);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("There was an error loading the "
- "theme, and the default theme "
- "could not be loaded. "
- "Attempting to start the "
- "standard greeter"),
- "");
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("There was an error loading the "
+ "theme, and the default theme "
+ "could not be loaded. "
+ "Attempting to start the "
+ "standard greeter"),
+ "");
gtk_widget_show_all (dialog);
gdm_wm_center_window (GTK_WINDOW (dialog));
@@ -1444,15 +1470,15 @@ main (int argc, char *argv[])
execl (LIBEXECDIR "/gdmlogin", LIBEXECDIR "/gdmlogin", NULL);
execlp ("gdmlogin", "gdmlogin", NULL);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("The GTK+ greeter could not be started. "
- "This display will abort and you may "
- "have to login another way and fix the "
- "installation of GDM"),
- "");
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("The GTK+ greeter could not be started. "
+ "This display will abort and you may "
+ "have to login another way and fix the "
+ "installation of GDM"),
+ "");
gtk_widget_show_all (dialog);
gdm_wm_center_window (GTK_WINDOW (dialog));
@@ -1510,14 +1536,14 @@ main (int argc, char *argv[])
gdm_wm_focus_new_windows (TRUE);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Session directory is missing"),
- _("Your session directory is missing or empty! "
- "There are two available sessions you can use, but "
- "you should log in and correct the gdm configuration."));
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Session directory is missing"),
+ _("Your session directory is missing or empty! "
+ "There are two available sessions you can use, but "
+ "you should log in and correct the gdm configuration."));
gtk_widget_show_all (dialog);
gdm_wm_center_window (GTK_WINDOW (dialog));
@@ -1535,14 +1561,14 @@ main (int argc, char *argv[])
gdm_wm_focus_new_windows (TRUE);
- dialog = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Configuration is not correct"),
- _("The configuration file contains an invalid command "
- "line for the login dialog, so running the "
- "default command. Please fix your configuration."));
+ dialog = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("Configuration is not correct"),
+ _("The configuration file contains an invalid command "
+ "line for the login dialog, so running the "
+ "default command. Please fix your configuration."));
gtk_widget_show_all (dialog);
gdm_wm_center_window (GTK_WINDOW (dialog));
diff --git a/gui/greeter/greeter_canvas_item.c b/gui/greeter/greeter_canvas_item.c
index 68a7fac8..2ce1bda1 100644
--- a/gui/greeter/greeter_canvas_item.c
+++ b/gui/greeter/greeter_canvas_item.c
@@ -27,6 +27,9 @@
#include "gdm.h"
#include "gdmcommon.h"
#include "gdmconfig.h"
+
+#include "gdm-common.h"
+
#include "greeter.h"
#include "greeter_item.h"
#include "greeter_events.h"
diff --git a/gui/greeter/greeter_item.c b/gui/greeter/greeter_item.c
index 61794c38..0021b674 100644
--- a/gui/greeter/greeter_item.c
+++ b/gui/greeter/greeter_item.c
@@ -30,6 +30,8 @@
#include "gdmcommon.h"
#include "misc.h"
+#include "gdm-common.h"
+
#include "greeter_item.h"
#include "greeter_configuration.h"
diff --git a/gui/greeter/greeter_item_customlist.c b/gui/greeter/greeter_item_customlist.c
index 5b4f53d5..ab46e05a 100644
--- a/gui/greeter/greeter_item_customlist.c
+++ b/gui/greeter/greeter_item_customlist.c
@@ -25,6 +25,8 @@
#include "gdmconfig.h"
#include "gdmsession.h"
+#include "gdm-common.h"
+
#include "greeter_item.h"
#include "greeter_configuration.h"
#include "greeter_item_customlist.h"
diff --git a/gui/greeter/greeter_item_pam.c b/gui/greeter/greeter_item_pam.c
index 4c177c5e..f0e7d80d 100644
--- a/gui/greeter/greeter_item_pam.c
+++ b/gui/greeter/greeter_item_pam.c
@@ -23,7 +23,7 @@
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
-#include "viciousui.h"
+#include "gdm-common.h"
#include "greeter.h"
#include "greeter_item.h"
@@ -361,6 +361,32 @@ greeter_item_pam_error (const char *message)
}
}
+static GtkWidget *
+hig_dialog_new (GtkWindow *parent,
+ GtkDialogFlags flags,
+ GtkMessageType type,
+ GtkButtonsType buttons,
+ const gchar *primary_message,
+ const gchar *secondary_message)
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ type,
+ buttons,
+ "%s", primary_message);
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ "%s", secondary_message);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), "");
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
+
+ return dialog;
+}
+
void
greeter_item_pam_leftover_messages (void)
{
@@ -385,12 +411,12 @@ greeter_item_pam_leftover_messages (void)
/* we should be now fine for focusing new windows */
gdm_wm_focus_new_windows (TRUE);
- dlg = ve_hig_dialog_new (NULL /* parent */,
- GTK_DIALOG_MODAL /* flags */,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_OK,
- oldtext,
- "");
+ dlg = hig_dialog_new (NULL /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK,
+ oldtext,
+ "");
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
gtk_window_set_modal (GTK_WINDOW (dlg), TRUE);
gdm_wm_center_window (GTK_WINDOW (dlg));
diff --git a/gui/greeter/greeter_item_timed.c b/gui/greeter/greeter_item_timed.c
index c24b24f6..077189bc 100644
--- a/gui/greeter/greeter_item_timed.c
+++ b/gui/greeter/greeter_item_timed.c
@@ -24,6 +24,8 @@
#include "gdm.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
#include "greeter_parser.h"
#include "greeter_configuration.h"
#include "greeter_item_timed.h"
diff --git a/gui/greeter/greeter_item_ulist.c b/gui/greeter/greeter_item_ulist.c
index c38740c6..baf1b8d6 100644
--- a/gui/greeter/greeter_item_ulist.c
+++ b/gui/greeter/greeter_item_ulist.c
@@ -39,6 +39,8 @@
#include "gdmconfig.h"
#include "gdmuser.h"
+#include "gdm-common.h"
+
#include "greeter.h"
#include "greeter_item_ulist.h"
#include "greeter_parser.h"
@@ -104,6 +106,17 @@ greeter_item_ulist_unset_selected_user (void)
selected_user = NULL;
}
+static int
+vector_len (char * const *v)
+{
+ int i;
+ if (v == NULL)
+ return 0;
+ for (i = 0; v[i] != NULL; i++)
+ ;
+ return i;
+}
+
static void
check_for_displays (void)
{
@@ -137,7 +150,7 @@ check_for_displays (void)
char **rvec;
rvec = g_strsplit (vec[i], ",", -1);
- if (rvec == NULL || ve_vector_len (rvec) != 3)
+ if (rvec == NULL || vector_len (rvec) != 3)
continue;
g_hash_table_insert (displays_hash,
@@ -214,7 +227,7 @@ greeter_populate_user_list (GtkTreeModel *tm)
}
}
-void
+void
greeter_item_ulist_select_user (gchar *login)
{
printf ("%c%c%c%s\n", STX, BEL,
diff --git a/gui/greeter/greeter_parser.c b/gui/greeter/greeter_parser.c
index 0431f2df..c9065c9a 100644
--- a/gui/greeter/greeter_parser.c
+++ b/gui/greeter/greeter_parser.c
@@ -24,13 +24,17 @@
#include <stdlib.h>
#include <librsvg/rsvg.h>
#include <math.h>
-#include <gdk/gdkx.h>
#include <locale.h>
+
#include <glib/gi18n.h>
+#include <gdk/gdkx.h>
#include "gdmwm.h"
#include "gdmcommon.h"
#include "gdmconfig.h"
+
+#include "gdm-common.h"
+
#include "greeter_configuration.h"
#include "greeter_parser.h"
#include "greeter_events.h"
@@ -1238,15 +1242,17 @@ parse_state_text (xmlNodePtr node,
static gint
is_current_locale (const char *lang)
{
- const GList *l = ve_i18n_get_language_list ("LC_MESSAGES");
+ const char * const *langs;
int score = 0;
-
- while (l != NULL)
+ int i;
+
+ langs = g_get_language_names ();
+
+ for (i = 0; langs[i] != NULL; i++)
{
- if (strcmp (l->data, lang) == 0)
+ if (strcmp (langs[i], lang) == 0)
return score;
- l = l->next;
score++;
}
return 1000;
diff --git a/gui/greeter/greeter_session.c b/gui/greeter/greeter_session.c
index 2bc812a3..28a0b294 100644
--- a/gui/greeter/greeter_session.c
+++ b/gui/greeter/greeter_session.c
@@ -33,6 +33,8 @@
#include "gdmconfig.h"
#include "gdmsession.h"
+#include "gdm-common.h"
+
#include "greeter.h"
#include "greeter_session.h"
#include "greeter_item_pam.h"
diff --git a/gui/greeter/greeter_system.c b/gui/greeter/greeter_system.c
index 7c6bcb4f..29c834b4 100644
--- a/gui/greeter/greeter_system.c
+++ b/gui/greeter/greeter_system.c
@@ -24,17 +24,20 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#include "gdm.h"
+#include "gdmcommon.h"
+#include "gdmconfig.h"
+#include "gdmwm.h"
+#include "misc.h"
+
+#include "gdm-common.h"
+
#include "greeter.h"
#include "greeter_configuration.h"
#include "greeter_system.h"
#include "greeter_item.h"
#include "greeter_item_ulist.h"
#include "greeter_parser.h"
-#include "gdm.h"
-#include "gdmcommon.h"
-#include "gdmconfig.h"
-#include "gdmwm.h"
-#include "misc.h"
GtkWidget *dialog;
extern gboolean GdmHaltFound;
diff --git a/gui/greeter/themes/Makefile.am b/gui/greeter/themes/Makefile.am
index a27cf1ee..85df4a1b 100644
--- a/gui/greeter/themes/Makefile.am
+++ b/gui/greeter/themes/Makefile.am
@@ -1,2 +1 @@
SUBDIRS = circles happygnome happygnome-list
-
diff --git a/gui/misc.c b/gui/misc.c
index 9ec09b23..028a8d3f 100644
--- a/gui/misc.c
+++ b/gui/misc.c
@@ -26,6 +26,8 @@
#include "misc.h"
#include "gdmconfig.h"
+#include "gdm-common.h"
+
#define INDEX_FILE1 "index.theme"
#define INDEX_FILE2 "index.theme.disabled"