annotate src/rcfile.h @ 1618:f47b8dc207f5

Minor code cleanup and redundancy reduction.
author zas_
date Mon, 01 Jun 2009 16:37:30 +0000
parents 9c16a93a0fdf
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1 /*
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 9
diff changeset
2 * Geeqie
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
3 * (C) 2004 John Ellis
1284
8b89e3ff286b Add year 2009 to copyright info everywhere.
zas_
parents: 1055
diff changeset
4 * Copyright (C) 2008 - 2009 The Geeqie Team
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
13
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 #ifndef RCFILE_H
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15 #define RCFILE_H
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
17
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
18 void write_indent(GString *str, gint indent);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
19 void write_char_option(GString *str, gint indent, const gchar *label, const gchar *text);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
20 gboolean read_char_option(const gchar *option, const gchar *label, const gchar *value, gchar **text);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
21 void write_color_option(GString *str, gint indent, gchar *label, GdkColor *color);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
22 gboolean read_color_option(const gchar *option, const gchar *label, const gchar *value, GdkColor *color);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
23 void write_int_option(GString *str, gint indent, const gchar *label, gint n);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
24 gboolean read_int_option(const gchar *option, const gchar *label, const gchar *value, gint *n);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
25 void write_uint_option(GString *str, gint indent, const gchar *label, guint n);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
26 gboolean read_uint_option(const gchar *option, const gchar *label, const gchar *value, guint *n);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
27 gboolean read_uint_option_clamp(const gchar *option, const gchar *label, const gchar *value, guint *n, guint min, guint max);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
28 gboolean read_int_option_clamp(const gchar *option, const gchar *label, const gchar *value, gint *n, gint min, gint max);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
29 void write_int_unit_option(GString *str, gint indent, gchar *label, gint n, gint subunits);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
30 gboolean read_int_unit_option(const gchar *option, const gchar *label, const gchar *value, gint *n, gint subunits);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
31 void write_bool_option(GString *str, gint indent, gchar *label, gint n);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
32 gboolean read_bool_option(const gchar *option, const gchar *label, const gchar *value, gint *n);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
33
1316
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
34 #define WRITE_BOOL(_source_, _name_) write_bool_option(outstr, indent, #_name_, (_source_)._name_)
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
35 #define WRITE_INT(_source_, _name_) write_int_option(outstr, indent, #_name_, (_source_)._name_)
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
36 #define WRITE_UINT(_source_, _name_) write_uint_option(outstr, indent, #_name_, (_source_)._name_)
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
37 #define WRITE_INT_UNIT(_source_, _name_, _unit_) write_int_unit_option(outstr, indent, #_name_, (_source_)._name_, _unit_)
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
38 #define WRITE_CHAR(_source_, _name_) write_char_option(outstr, indent, #_name_, (_source_)._name_)
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
39 #define WRITE_COLOR(_source_, _name_) write_color_option(outstr, indent, #_name_, &(_source_)._name_)
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
40
1461
e015b6573d36 improved config file formatting
nadvornik
parents: 1316
diff changeset
41 #define WRITE_NL() write_indent(outstr, indent)
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
42 #define WRITE_SEPARATOR() g_string_append(outstr, "\n")
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
43 #define WRITE_SUBTITLE(_title_) g_string_append_printf(outstr, "\n\n<!-- "_title_" -->\n\n")
1461
e015b6573d36 improved config file formatting
nadvornik
parents: 1316
diff changeset
44 #define WRITE_STRING(_str_) g_string_append_printf(outstr, _str_)
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
45
1316
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
46 #define READ_BOOL(_target_, _name_) read_bool_option(option, #_name_, value, &(_target_)._name_)
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
47 #define READ_INT(_target_, _name_) read_int_option(option, #_name_, value, &(_target_)._name_)
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
48 #define READ_UINT(_target_, _name_) read_uint_option(option, #_name_, value, &(_target_)._name_)
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
49 #define READ_INT_CLAMP(_target_, _name_, _min_, _max_) read_int_option_clamp(option, #_name_, value, &(_target_)._name_, _min_, _max_)
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
50 #define READ_UINT_CLAMP(_target_, _name_, _min_, _max_) read_uint_option_clamp(option, #_name_, value, &(_target_)._name_, _min_, _max_)
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
51 #define READ_INT_UNIT(_target_, _name_, _unit_) read_int_unit_option(option, #_name_, value, &(_target_)._name_, _unit_)
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
52 #define READ_CHAR(_target_, _name_) read_char_option(option, #_name_, value, &(_target_)._name_)
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
53 #define READ_COLOR(_target_, _name_) read_color_option(option, #_name_, value, &(_target_)._name_)
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
54
1316
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
55 #define READ_BOOL_FULL(_name_, _target_) read_bool_option(option, _name_, value, &(_target_))
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
56 #define READ_INT_FULL(_name_, _target_) read_int_option(option, _name_, value, &(_target_))
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
57 #define READ_UINT_FULL(_name_, _target_) read_uint_option(option, _name_, value, &(_target_))
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
58 #define READ_INT_CLAMP_FULL(_name_, _target_, _min_, _max_) read_int_option_clamp(option, _name_, value, &(_target_), _min_, _max_)
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
59 #define READ_INT_UNIT_FULL(_name_, _target_, _unit_) read_int_unit_option(option, _name_, value, &(_target_), _unit_)
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
60 #define READ_CHAR_FULL(_name_, _target_) read_char_option(option, _name_, value, &(_target_))
732083928afb Enclose macro parameters names with _ to differentiate them from variable names.
zas_
parents: 1315
diff changeset
61 #define READ_COLOR_FULL(_name_, _target_) read_color_option(option, _name_, value, &(_target_))
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
62
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
63
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
64
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
65
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
66 typedef struct _GQParserFuncData GQParserFuncData;
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
67 typedef struct _GQParserData GQParserData;
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
68 typedef void (* GQParserStartFunc)(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
69 typedef void (* GQParserEndFunc)(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, gpointer data, GError **error);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
70
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
71 void options_parse_func_push(GQParserData *parser_data, GQParserStartFunc start_func, GQParserEndFunc end_func, gpointer data);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
72 void options_parse_func_pop(GQParserData *parser_data);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
73 void options_parse_func_set_data(GQParserData *parser_data, gpointer data);
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
74
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
75
1484
9c16a93a0fdf improved sidebar configuration
nadvornik
parents: 1461
diff changeset
76 gboolean save_config_to_file(const gchar *utf8_path, ConfOptions *options);
9c16a93a0fdf improved sidebar configuration
nadvornik
parents: 1461
diff changeset
77
9c16a93a0fdf improved sidebar configuration
nadvornik
parents: 1461
diff changeset
78 gboolean load_config_from_buf(const gchar *buf, gsize size, gboolean startup);
9c16a93a0fdf improved sidebar configuration
nadvornik
parents: 1461
diff changeset
79 gboolean load_config_from_file(const gchar *utf8_path, gboolean startup);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1284
diff changeset
81
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 #endif
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 1023
diff changeset
83 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */