From 1a6c98c79b73f5f9440f5f78d001caddf6f1d68c Mon Sep 17 00:00:00 2001 From: Thomas Thurman Date: Tue, 7 Aug 2007 01:30:28 +0000 Subject: [PATCH] If KEY_AUTO_RAISE_DELAY is undefined or non-integer, it is not treated as 2007-08-06 Thomas Thurman If KEY_AUTO_RAISE_DELAY is undefined or non-integer, it is not treated as zero. * src/prefs.c (meta_prefs_init): check type of key, and behave sensibly if it's unexpected. * src/prefs.c (find_and_update_list_binding): remove old comment. svn path=/trunk/; revision=3287 --- ChangeLog | 9 +++++++++ src/prefs.c | 20 +++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index e17cdeb29..1a6d9140a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-08-06 Thomas Thurman + + If KEY_AUTO_RAISE_DELAY is undefined or non-integer, it is not treated + as zero. + + * src/prefs.c (meta_prefs_init): check type of key, and behave sensibly + if it's unexpected. + * src/prefs.c (find_and_update_list_binding): remove old comment. + 2007-08-03 Frederic Crozat * src/delete.c: Fix mangled window title in "Force Quit" diff --git a/src/prefs.c b/src/prefs.c index efc6ec4fa..46d05b925 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -364,6 +364,7 @@ meta_prefs_init (void) GError *err = NULL; char *str_val; int int_val; + GConfValue *gconf_val; gboolean bool_val, bool_val_2; gboolean update_visual; gboolean update_audible; @@ -422,16 +423,18 @@ meta_prefs_init (void) if (get_bool (KEY_AUTO_RAISE, &bool_val)) update_auto_raise (bool_val); - /* FIXME: Since auto_raise_delay of 0 is valid and gconf_client_get_int - * silently returns that value when KEY_AUTO_RAISE_DELAY doesn't exist, - * we should be using gconf_client_get() instead if we cared about - * careful error checking of the key-doesn't-exist case. Since this - * setting is crap, though, I'm adding a FIXME instead of fixing it. ;-) - */ - int_val = gconf_client_get_int (default_client, KEY_AUTO_RAISE_DELAY, + gconf_val = gconf_client_get (default_client, KEY_AUTO_RAISE_DELAY, &err); cleanup_error (&err); - update_auto_raise_delay (int_val); + if (gconf_val) + { + if (gconf_val->type == GCONF_VALUE_INT) + update_auto_raise_delay (gconf_value_get_int (gconf_val)); + else + meta_warning(_("Type of %s was not integer"), KEY_AUTO_RAISE_DELAY); + + gconf_value_free (gconf_val); + } str_val = gconf_client_get_string (default_client, KEY_THEME, @@ -2549,7 +2552,6 @@ find_and_update_list_binding (MetaKeyPref *bindings, name_without_suffix[strlen(name_without_suffix) - strlen(KEY_LIST_BINDINGS_SUFFIX)] = 0; - /* FIXME factor out dupld code */ if (*name_without_suffix == '/') key = relative_key (name_without_suffix); else