Add read_dummy_option() to handle old/deprecated options.
authorLaurent Monin <zas@norz.org>
Tue, 14 Aug 2012 22:48:35 +0000 (00:48 +0200)
committerLaurent Monin <zas@norz.org>
Thu, 16 Aug 2012 21:27:08 +0000 (23:27 +0200)
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.

src/rcfile.c
src/rcfile.h

index 6999380..df6ef65 100644 (file)
@@ -74,6 +74,15 @@ void write_char_option(GString *str, gint indent, const gchar *label, const gcha
        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 @@ static gboolean load_global_params(const gchar **attribute_names, const gchar **
                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);
                }
 
index 83c70a0..cf2da3c 100644 (file)
@@ -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 @@ gboolean read_bool_option(const gchar *option, const gchar *label, const gchar *
 #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;