Mercurial > geeqie.yaz
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 |
rev | line source |
---|---|
9 | 1 /* |
196 | 2 * Geeqie |
9 | 3 * (C) 2004 John Ellis |
1284 | 4 * Copyright (C) 2008 - 2009 The Geeqie Team |
9 | 5 * |
6 * Author: John Ellis | |
7 * | |
8 * This software is released under the GNU General Public License (GNU GPL). | |
9 * Please read the included file COPYING for more information. | |
10 * This software comes with no warranty of any kind, use at your own risk! | |
11 */ | |
12 | |
13 | |
14 #ifndef RCFILE_H | |
15 #define RCFILE_H | |
16 | |
1309 | 17 |
18 void write_indent(GString *str, gint indent); | |
19 void write_char_option(GString *str, gint indent, const gchar *label, const gchar *text); | |
20 gboolean read_char_option(const gchar *option, const gchar *label, const gchar *value, gchar **text); | |
21 void write_color_option(GString *str, gint indent, gchar *label, GdkColor *color); | |
22 gboolean read_color_option(const gchar *option, const gchar *label, const gchar *value, GdkColor *color); | |
23 void write_int_option(GString *str, gint indent, const gchar *label, gint n); | |
24 gboolean read_int_option(const gchar *option, const gchar *label, const gchar *value, gint *n); | |
25 void write_uint_option(GString *str, gint indent, const gchar *label, guint n); | |
26 gboolean read_uint_option(const gchar *option, const gchar *label, const gchar *value, guint *n); | |
27 gboolean read_uint_option_clamp(const gchar *option, const gchar *label, const gchar *value, guint *n, guint min, guint max); | |
28 gboolean read_int_option_clamp(const gchar *option, const gchar *label, const gchar *value, gint *n, gint min, gint max); | |
29 void write_int_unit_option(GString *str, gint indent, gchar *label, gint n, gint subunits); | |
30 gboolean read_int_unit_option(const gchar *option, const gchar *label, const gchar *value, gint *n, gint subunits); | |
31 void write_bool_option(GString *str, gint indent, gchar *label, gint n); | |
32 gboolean read_bool_option(const gchar *option, const gchar *label, const gchar *value, gint *n); | |
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 | 40 |
1461 | 41 #define WRITE_NL() write_indent(outstr, indent) |
1309 | 42 #define WRITE_SEPARATOR() g_string_append(outstr, "\n") |
43 #define WRITE_SUBTITLE(_title_) g_string_append_printf(outstr, "\n\n<!-- "_title_" -->\n\n") | |
1461 | 44 #define WRITE_STRING(_str_) g_string_append_printf(outstr, _str_) |
1309 | 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 | 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 | 62 |
63 | |
64 | |
65 | |
66 typedef struct _GQParserFuncData GQParserFuncData; | |
67 typedef struct _GQParserData GQParserData; | |
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); | |
69 typedef void (* GQParserEndFunc)(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, gpointer data, GError **error); | |
70 | |
71 void options_parse_func_push(GQParserData *parser_data, GQParserStartFunc start_func, GQParserEndFunc end_func, gpointer data); | |
72 void options_parse_func_pop(GQParserData *parser_data); | |
73 void options_parse_func_set_data(GQParserData *parser_data, gpointer data); | |
74 | |
75 | |
1484 | 76 gboolean save_config_to_file(const gchar *utf8_path, ConfOptions *options); |
77 | |
78 gboolean load_config_from_buf(const gchar *buf, gsize size, gboolean startup); | |
79 gboolean load_config_from_file(const gchar *utf8_path, gboolean startup); | |
9 | 80 |
1309 | 81 |
9 | 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: */ |