changeset 2072:6b9508574641

Add read_dummy_option() to handle old/deprecated options. It is better to keep a trace of old options, for now, just display a message about the option to be ignored, and the reason.
author Laurent Monin <zas@norz.org>
date Wed, 15 Aug 2012 00:48:35 +0200
parents 72669739f0ce
children d6e8bbeea325
files src/rcfile.c src/rcfile.h
diffstat 2 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/rcfile.c	Mon May 14 23:01:01 2012 +0200
+++ b/src/rcfile.c	Wed Aug 15 00:48:35 2012 +0200
@@ -74,6 +74,15 @@
 	g_free(escval1);
 }
 
+/* dummy read for old/obsolete/futur/deprecated/unused options */
+gboolean read_dummy_option(const gchar *option, const gchar *label, const gchar *message)
+{
+	if (g_ascii_strcasecmp(option, label) != 0) return FALSE;
+	log_printf(_("Option %s ignored: %s\n"), option, message);
+	return TRUE;
+}
+
+
 gboolean read_char_option(const gchar *option, const gchar *label, const gchar *value, gchar **text)
 {
 	if (g_ascii_strcasecmp(option, label) != 0) return FALSE;
@@ -720,6 +729,10 @@
 		if (READ_UINT(*options, stereo.fixed_x2)) continue;
 		if (READ_UINT(*options, stereo.fixed_y2)) continue;
 
+		/* dummy options */
+		if (READ_DUMMY(*options, image.dither_quality, "deprecated since 2012-08-13")) continue;
+
+		/* unknown options */
 		log_printf("unknown attribute %s = %s\n", option, value);
 		}
 
--- a/src/rcfile.h	Mon May 14 23:01:01 2012 +0200
+++ b/src/rcfile.h	Wed Aug 15 00:48:35 2012 +0200
@@ -17,6 +17,7 @@
 
 void write_indent(GString *str, gint indent);
 void write_char_option(GString *str, gint indent, const gchar *label, const gchar *text);
+gboolean read_dummy_option(const gchar *option, const gchar *label, const gchar *message);
 gboolean read_char_option(const gchar *option, const gchar *label, const gchar *value, gchar **text);
 void write_color_option(GString *str, gint indent, gchar *label, GdkColor *color);
 gboolean read_color_option(const gchar *option, const gchar *label, const gchar *value, GdkColor *color);
@@ -60,8 +61,7 @@
 #define READ_CHAR_FULL(_name_, _target_) read_char_option(option, _name_, value, &(_target_))
 #define READ_COLOR_FULL(_name_, _target_) read_color_option(option, _name_, value, &(_target_))
 
-
-
+#define READ_DUMMY(_target_, _name_, _msg_) read_dummy_option(option, #_name_, _msg_)
 
 typedef struct _GQParserFuncData GQParserFuncData;
 typedef struct _GQParserData GQParserData;