annotate src/rcfile.c @ 146:e8285b0c0c7d

prevent duplicate sidecar files; code cleanup
author nadvornik
date Wed, 21 Nov 2007 21:21:17 +0000
parents 8be2cc687304
children 9a56e3d13e67
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
1 /*
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
2 * GQview
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
3 * (C) 2006 John Ellis
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
4 *
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
5 * Author: John Ellis
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
6 *
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
8 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
10 */
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
11
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
12
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
13 #include "gqview.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
14 #include "rcfile.h"
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
15
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
16 #include "filelist.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
17 #include "slideshow.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
18 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
19
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
20
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
21 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
22 *-----------------------------------------------------------------------------
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
23 * line write/parse routines (private)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
24 *-----------------------------------------------------------------------------
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
25 */
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
26
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
27 gchar *quoted_value(const gchar *text)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
28 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
29 const gchar *ptr;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
30 gint c = 0;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
31 gint l = strlen(text);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
32
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
33 if (l == 0) return NULL;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
34
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
35 while (c < l && text[c] !='"') c++;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
36 if (text[c] == '"')
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
37 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
38 gint e;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
39 c++;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
40 ptr = text + c;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
41 e = c;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
42 while (e < l && text[e] !='"') e++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
43 if (text[e] == '"')
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
44 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
45 if (e - c > 0)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
46 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
47 return g_strndup(ptr, e - c);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
48 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
49 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
50 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
51 else
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
52 /* for compatibility with older formats (<0.3.7)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
53 * read a line without quotes too */
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
54 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
55 c = 0;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
56 while (c < l && text[c] !=' ' && text[c] !=8 && text[c] != '\n') c++;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
57 if (c != 0)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
58 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
59 return g_strndup(text, c);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
60 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
61 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
62
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
63 return NULL;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
64 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
65
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
66 static void write_char_option(FILE *f, gchar *label, gchar *text)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
67 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
68 if (text)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
69 fprintf(f,"%s: \"%s\"\n", label, text);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
70 else
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
71 fprintf(f,"%s: \n", label);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
72 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
73
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
74 static gchar *read_char_option(FILE *f, gchar *option, gchar *label, gchar *value, gchar *text)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
75 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
76 if (strcasecmp(option, label) == 0)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
77 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
78 g_free(text);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
79 text = quoted_value(value);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
80 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
81 return text;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
82 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
83
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
84 static void write_int_option(FILE *f, gchar *label, gint n)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
85 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
86 fprintf(f,"%s: %d\n\n", label, n);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
87 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
88
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
89 static gint read_int_option(FILE *f, gchar *option, gchar *label, gchar *value, gint n)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
90 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
91 if (strcasecmp(option, label) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
92 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
93 n = strtol(value, NULL, 10);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
94 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
95 return n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
96 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
97
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
98 static void write_int_unit_option(FILE *f, gchar *label, gint n, gint subunits)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
99 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
100 gint l, r;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
101
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
102 if (subunits > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
103 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
104 l = n / subunits;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
105 r = n % subunits;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
106 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
107 else
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
108 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
109 l = n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
110 r = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
111 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
112
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
113 fprintf(f,"%s: %d.%d\n\n", label, l, r);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
114 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
115
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
116 static gint read_int_unit_option(FILE *f, gchar *option, gchar *label, gchar *value, gint n, gint subunits)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
117 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
118 if (strcasecmp(option, label) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
119 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
120 gint l, r;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
121 gchar *ptr;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
122
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
123 ptr = value;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
124 while (*ptr != '\0' && *ptr != '.') ptr++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
125 if (*ptr == '.')
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
126 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
127 *ptr = '\0';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
128 l = strtol(value, NULL, 10);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
129 *ptr = '.';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
130 ptr++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
131 r = strtol(ptr, NULL, 10);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
132 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
133 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
134 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
135 l = strtol(value, NULL, 10);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
136 r = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
137 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
138
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
139 n = l * subunits + r;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
140 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
141 return n;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
142 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
143
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
144 static void write_bool_option(FILE *f, gchar *label, gint n)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
145 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
146 fprintf(f,"%s: ", label);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
147 if (n) fprintf(f,"true\n"); else fprintf(f,"false\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
148 fprintf(f,"\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
149 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
150
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
151 static gint read_bool_option(FILE *f, gchar *option, gchar *label, gchar *value, gint n)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
152 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
153 if (strcasecmp(option, label) == 0)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
154 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
155 if (strcasecmp(value, "true") == 0)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
156 n = TRUE;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
157 else
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
158 n = FALSE;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
159 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
160 return n;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
161 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
162
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
163 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
164 *-----------------------------------------------------------------------------
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
165 * save configuration (public)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
166 *-----------------------------------------------------------------------------
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
167 */
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
168
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
169 void save_options(void)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
170 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
171 FILE *f;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
172 gchar *rc_path;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
173 gchar *rc_pathl;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
174 gint i;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
175
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
176 rc_path = g_strconcat(homedir(), "/", GQVIEW_RC_DIR, "/", RC_FILE_NAME, NULL);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
177
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
178 rc_pathl = path_from_utf8(rc_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
179 f = fopen(rc_pathl, "w");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
180 g_free(rc_pathl);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
181 if (!f)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
182 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
183 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
184
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
185 buf = g_strdup_printf(_("error saving config file: %s\n"), rc_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
186 print_term(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
187 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
188
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
189 g_free(rc_path);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
190 return;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
191 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
192
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
193 fprintf(f,"######################################################################\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
194 fprintf(f,"# GQview config file version %7s #\n", VERSION);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
195 fprintf(f,"######################################################################\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
196 fprintf(f,"\n");
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 14
diff changeset
197 fprintf(f,"# Note: This file is autogenerated. Options can be changed here,\n");
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 14
diff changeset
198 fprintf(f,"# but user comments and formatting will be lost.\n");
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 14
diff changeset
199 fprintf(f,"\n");
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
200 fprintf(f,"##### General Options #####\n\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
201
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
202 write_int_option(f, "layout_style", layout_style);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
203 write_char_option(f, "layout_order", layout_order);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
204 fprintf(f,"\n");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
205 write_bool_option(f, "layout_view_as_icons", layout_view_icons);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
206 write_bool_option(f, "layout_view_as_tree", layout_view_tree);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
207 write_bool_option(f, "show_icon_names", show_icon_names);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
208 fprintf(f,"\n");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
209
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
210 write_bool_option(f, "tree_descend_folders", tree_descend_subdirs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
211 write_bool_option(f, "lazy_image_sync", lazy_image_sync);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
212 write_bool_option(f, "update_on_time_change", update_on_time_change);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
213 write_bool_option(f, "exif_auto_rotate", exif_rotate_enable);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
214 fprintf(f,"\n");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
215
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
216 write_bool_option(f, "enable_startup_path", startup_path_enable);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
217 write_char_option(f, "startup_path", startup_path);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
218 fprintf(f,"\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
219
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
220 fprintf(f,"zoom_mode: ");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
221 if (zoom_mode == ZOOM_RESET_ORIGINAL) fprintf(f,"original\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
222 if (zoom_mode == ZOOM_RESET_FIT_WINDOW) fprintf(f,"fit\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
223 if (zoom_mode == ZOOM_RESET_NONE) fprintf(f,"dont_change\n");
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
224
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
225 write_bool_option(f, "two_pass_scaling", two_pass_zoom);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
226
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
227 write_bool_option(f, "zoom_to_fit_allow_expand", zoom_to_fit_expands);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
228 fprintf(f,"\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
229
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
230 write_bool_option(f, "fit_window_to_image", fit_window);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
231 write_bool_option(f, "limit_window_size", limit_window_size);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
232 write_int_option(f, "max_window_size", max_window_size);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
233 fprintf(f,"\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
234
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
235 write_bool_option(f, "progressive_keyboard_scrolling", progressive_key_scrolling);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
236 write_int_option(f, "scroll_reset_method", scroll_reset_method);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
237 fprintf(f,"\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
238
3
gqview
parents: 1
diff changeset
239 write_bool_option(f, "enable_thumbnails", thumbnails_enabled);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
240 write_int_option(f, "thumbnail_width", thumb_max_width);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
241 write_int_option(f, "thumbnail_height", thumb_max_height);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
242 write_bool_option(f, "cache_thumbnails", enable_thumb_caching);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
243 write_bool_option(f, "cache_thumbnails_into_dirs", enable_thumb_dirs);
14
25335c62cd9b ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
244 write_bool_option(f, "thumbnail_fast", thumbnail_fast);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
245 write_bool_option(f, "use_xvpics_thumbnails", use_xvpics_thumbnails);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
246 write_bool_option(f, "thumbnail_spec_standard", thumbnail_spec_standard);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
247 fprintf(f,"\n");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
248
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
249 write_bool_option(f, "local_metadata", enable_metadata_dirs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
250 fprintf(f,"\n");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
251
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
252 write_int_option(f, "sort_method", (gint)file_sort_method);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
253 write_bool_option(f, "sort_ascending", file_sort_ascending);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
254 write_bool_option(f, "sort_case_sensitive", file_sort_case_sensitive);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
255 fprintf(f,"\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
256
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
257 write_bool_option(f, "confirm_delete", confirm_delete);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
258 write_bool_option(f, "enable_delete_key", enable_delete_key);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
259 write_bool_option(f, "safe_delete", safe_delete_enable);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
260 write_char_option(f, "safe_delete_path", safe_delete_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
261 write_int_option(f, "safe_delete_size", safe_delete_size);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
262 fprintf(f,"\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
263 write_bool_option(f, "tools_float", tools_float);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
264 write_bool_option(f, "tools_hidden", tools_hidden);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
265 write_bool_option(f, "restore_tool_state", restore_tool);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
266
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
267 write_bool_option(f, "toolbar_hidden", toolbar_hidden);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
268
4
e149abcda4eb Syncing to 0.8.1
gqview
parents: 3
diff changeset
269 write_bool_option(f, "mouse_wheel_scrolls", mousewheel_scrolls);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
270 write_bool_option(f, "in_place_rename", enable_in_place_rename);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
271
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
272 write_int_option(f, "open_recent_max", recent_list_max);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
273
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
274 write_int_option(f, "image_cache_size_max", tile_cache_max);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
275
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
276 write_int_option(f, "thumbnail_quality", thumbnail_quality);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
277 write_int_option(f, "zoom_quality", zoom_quality);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
278 write_int_option(f, "dither_quality", dither_quality);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
279
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
280 write_int_option(f, "zoom_increment", zoom_increment);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
281
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
282 write_bool_option(f, "enable_read_ahead", enable_read_ahead);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
283
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
284 write_bool_option(f, "display_dialogs_under_mouse", place_dialogs_under_mouse);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
285
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
286 write_bool_option(f, "black_window_background", black_window_background);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
287
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
288 write_int_option(f, "fullscreen_screen", fullscreen_screen);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
289 write_bool_option(f, "fullscreen_clean_flip", fullscreen_clean_flip);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
290 write_bool_option(f, "fullscreen_disable_saver", fullscreen_disable_saver);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
291 write_bool_option(f, "fullscreen_above", fullscreen_above);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
292
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
293 write_int_option(f, "custom_similarity_threshold", dupe_custom_threshold);
4
e149abcda4eb Syncing to 0.8.1
gqview
parents: 3
diff changeset
294
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
295 fprintf(f,"\n##### Slideshow Options #####\n\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
296
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
297 write_int_unit_option(f, "slideshow_delay", slideshow_delay, SLIDESHOW_SUBSECOND_PRECISION);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
298
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
299 write_bool_option(f, "slideshow_random", slideshow_random);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
300 write_bool_option(f, "slideshow_repeat", slideshow_repeat);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
301
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
302 fprintf(f,"\n##### Filtering Options #####\n\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
303
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
304 write_bool_option(f, "show_dotfiles", show_dot_files);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
305 write_bool_option(f, "disable_filtering", file_filter_disable);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
306 filter_write_list(f);
145
8be2cc687304 fixed grouping sidecar files and made it configurable via config file
nadvornik
parents: 113
diff changeset
307
8be2cc687304 fixed grouping sidecar files and made it configurable via config file
nadvornik
parents: 113
diff changeset
308 sidecar_ext_write(f);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
309
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
310 fprintf(f,"\n##### Color Profiles #####\n\n");
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
311
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
312 #ifndef HAVE_LCMS
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
313 fprintf(f,"# NOTICE: GQview was not built with support for color profiles,\n"
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
314 "# color profile options will have no effect.\n\n");
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
315 #endif
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
316
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
317 write_bool_option(f, "color_profile_enabled", color_profile_enabled);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
318 write_bool_option(f, "color_profile_use_image", color_profile_use_image);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
319 write_int_option(f, "color_profile_input_type", color_profile_input_type);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
320 for (i = 0; i < COLOR_PROFILE_INPUTS; i++)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
321 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
322 gchar *buf;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
323
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
324 buf = g_strdup_printf("color_profile_input_file_%d", i + 1);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
325 write_char_option(f, buf, color_profile_input_file[i]);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
326 g_free(buf);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
327
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
328 buf = g_strdup_printf("color_profile_input_name_%d", i + 1);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
329 write_char_option(f, buf, color_profile_input_name[i]);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
330 g_free(buf);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
331 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
332 fprintf(f,"\n");
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
333 write_int_option(f, "color_profile_screen_type", color_profile_screen_type);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
334 write_char_option(f, "color_profile_screen_file_1", color_profile_screen_file);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
335
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
336 fprintf(f,"\n##### External Programs #####\n");
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 14
diff changeset
337 fprintf(f,"# Maximum of 10 programs (external_1 through external_10)\n");
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
338 fprintf(f,"# format: external_n: \"menu name\" \"command line\"\n\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
339
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
340 for (i = 0; i < GQVIEW_EDITOR_SLOTS; i++)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
341 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
342 fprintf(f,"external_%d: \"", i+1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
343 if (editor_name[i]) fprintf(f, "%s", editor_name[i]);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
344 fprintf(f, "\" \"");
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
345 if (editor_command[i]) fprintf(f, "%s", editor_command[i]);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
346 fprintf(f, "\"\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
347 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
348
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
349 fprintf(f,"\n##### Collection Options #####\n\n");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
350
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
351 write_bool_option(f, "rectangular_selections", collection_rectangular_selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
352
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
353 fprintf(f,"\n##### Window Positions #####\n\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
354
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
355 write_bool_option(f, "restore_window_positions", save_window_positions);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
356 fprintf(f,"\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
357 write_int_option(f, "main_window_x", main_window_x);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
358 write_int_option(f, "main_window_y", main_window_y);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
359 write_int_option(f, "main_window_width", main_window_w);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
360 write_int_option(f, "main_window_height", main_window_h);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
361 write_bool_option(f, "main_window_maximized", main_window_maximized);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
362 write_int_option(f, "float_window_x", float_window_x);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
363 write_int_option(f, "float_window_y", float_window_y);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
364 write_int_option(f, "float_window_width", float_window_w);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
365 write_int_option(f, "float_window_height", float_window_h);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
366 write_int_option(f, "float_window_divider", float_window_divider);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
367 write_int_option(f, "divider_position_h", window_hdivider_pos);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
368 write_int_option(f, "divider_position_v", window_vdivider_pos);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
369
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
370 fprintf(f,"######################################################################\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
371 fprintf(f,"# end of GQview config file #\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
372 fprintf(f,"######################################################################\n");
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
373
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
374 fclose(f);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
375
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
376 g_free(rc_path);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
377 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
378
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
379 /*
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
380 *-----------------------------------------------------------------------------
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
381 * load configuration (public)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
382 *-----------------------------------------------------------------------------
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
383 */
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
384
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
385 void load_options(void)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
386 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
387 FILE *f;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
388 gchar *rc_path;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
389 gchar *rc_pathl;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
390 gchar s_buf[1024];
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
391 gchar *s_buf_ptr;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
392 gchar option[1024];
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
393 gchar value[1024];
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
394 gchar value_all[1024];
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
395 gint c,l,i;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
396
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
397 rc_path = g_strconcat(homedir(), "/", GQVIEW_RC_DIR, "/", RC_FILE_NAME, NULL);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
398
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
399 rc_pathl = path_from_utf8(rc_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
400 f = fopen(rc_pathl,"r");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
401 g_free(rc_pathl);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
402 if (!f)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
403 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
404 g_free(rc_path);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
405 return;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
406 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
407
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
408 while (fgets(s_buf,1024,f))
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
409 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
410 if (s_buf[0]=='#') continue;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
411 if (s_buf[0]=='\n') continue;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
412 c = 0;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
413 l = strlen(s_buf);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
414 while (s_buf[c] != ':' && c < l) c++;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
415 if (c >= l) continue;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
416 s_buf[c] = '\0';
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
417 c++;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
418 while ((s_buf[c] == ' ' || s_buf[c] == 8) && c < l) c++;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
419 s_buf_ptr = s_buf + c;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
420 strncpy(value_all, s_buf_ptr, sizeof(value_all));
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
421 while (s_buf[c] != 8 && s_buf[c] != ' ' && s_buf[c] != '\n' && c < l) c++;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
422 s_buf[c] = '\0';
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
423 strncpy(option, s_buf, sizeof(option));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
424 strncpy(value, s_buf_ptr, sizeof(value));
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
425
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
426 /* general options */
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
427
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
428 layout_style = read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
429 "layout_style", value, layout_style);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
430 layout_order = read_char_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
431 "layout_order", value, layout_order);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
432 layout_view_icons = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
433 "layout_view_as_icons", value, layout_view_icons);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
434 layout_view_tree = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
435 "layout_view_as_tree", value, layout_view_tree);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
436 show_icon_names = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
437 "show_icon_names", value, show_icon_names);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
438
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
439 tree_descend_subdirs = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
440 "tree_descend_folders", value, tree_descend_subdirs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
441 lazy_image_sync = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
442 "lazy_image_sync", value, lazy_image_sync);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
443 update_on_time_change = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
444 "update_on_time_change", value, update_on_time_change);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
445 exif_rotate_enable = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
446 "exif_auto_rotate", value, exif_rotate_enable);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
447
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
448 startup_path_enable = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
449 "enable_startup_path", value, startup_path_enable);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
450 startup_path = read_char_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
451 "startup_path", value_all, startup_path);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
452
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
453 if (strcasecmp(option,"zoom_mode") == 0)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
454 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
455 if (strcasecmp(value, "original") == 0) zoom_mode = ZOOM_RESET_ORIGINAL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
456 if (strcasecmp(value, "fit") == 0) zoom_mode = ZOOM_RESET_FIT_WINDOW;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
457 if (strcasecmp(value, "dont_change") == 0) zoom_mode = ZOOM_RESET_NONE;
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
458 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
459 two_pass_zoom = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
460 "two_pass_scaling", value, two_pass_zoom);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
461 zoom_to_fit_expands = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
462 "zoom_to_fit_allow_expand", value, zoom_to_fit_expands);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
463
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
464 fit_window = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
465 "fit_window_to_image", value, fit_window);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
466 limit_window_size = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
467 "limit_window_size", value, limit_window_size);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
468 max_window_size = read_int_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
469 "max_window_size", value, max_window_size);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
470 progressive_key_scrolling = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
471 "progressive_keyboard_scrolling", value, progressive_key_scrolling);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
472 scroll_reset_method = read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
473 "scroll_reset_method", value, scroll_reset_method);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
474
3
gqview
parents: 1
diff changeset
475 thumbnails_enabled = read_bool_option(f, option,
gqview
parents: 1
diff changeset
476 "enable_thumbnails", value, thumbnails_enabled);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
477 thumb_max_width = read_int_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
478 "thumbnail_width", value, thumb_max_width);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
479 thumb_max_height = read_int_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
480 "thumbnail_height", value, thumb_max_height);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
481 enable_thumb_caching = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
482 "cache_thumbnails", value, enable_thumb_caching);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
483 enable_thumb_dirs = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
484 "cache_thumbnails_into_dirs", value, enable_thumb_dirs);
14
25335c62cd9b ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
485 thumbnail_fast = read_bool_option(f, option,
25335c62cd9b ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
486 "thumbnail_fast", value, thumbnail_fast);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
487 use_xvpics_thumbnails = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
488 "use_xvpics_thumbnails", value, use_xvpics_thumbnails);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
489 thumbnail_spec_standard = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
490 "thumbnail_spec_standard", value, thumbnail_spec_standard);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
491
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
492 enable_metadata_dirs = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
493 "local_metadata", value, enable_metadata_dirs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
494
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
495 file_sort_method = (SortType)read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
496 "sort_method", value, (gint)file_sort_method);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
497 file_sort_ascending = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
498 "sort_ascending", value, file_sort_ascending);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
499 file_sort_case_sensitive = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
500 "sort_case_sensitive", value, file_sort_case_sensitive);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
501
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
502 confirm_delete = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
503 "confirm_delete", value, confirm_delete);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
504 enable_delete_key = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
505 "enable_delete_key", value, enable_delete_key);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
506 safe_delete_enable = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
507 "safe_delete", value, safe_delete_enable);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
508 safe_delete_path = read_char_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
509 "safe_delete_path", value, safe_delete_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
510 safe_delete_size = read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
511 "safe_delete_size", value, safe_delete_size);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
512
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
513 tools_float = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
514 "tools_float", value, tools_float);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
515 tools_hidden = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
516 "tools_hidden", value, tools_hidden);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
517 restore_tool = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
518 "restore_tool_state", value, restore_tool);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
519
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
520 toolbar_hidden = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
521 "toolbar_hidden", value, toolbar_hidden);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
522
4
e149abcda4eb Syncing to 0.8.1
gqview
parents: 3
diff changeset
523 mousewheel_scrolls = read_bool_option(f, option,
e149abcda4eb Syncing to 0.8.1
gqview
parents: 3
diff changeset
524 "mouse_wheel_scrolls", value, mousewheel_scrolls);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
525 enable_in_place_rename = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
526 "in_place_rename", value, enable_in_place_rename);
4
e149abcda4eb Syncing to 0.8.1
gqview
parents: 3
diff changeset
527
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
528 recent_list_max = read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
529 "open_recent_max", value, recent_list_max);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
530
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
531 tile_cache_max = read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
532 "image_cache_size_max", value, tile_cache_max);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
533
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
534 thumbnail_quality = CLAMP(read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
535 "thumbnail_quality", value, thumbnail_quality), GDK_INTERP_NEAREST, GDK_INTERP_HYPER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
536 zoom_quality = CLAMP(read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
537 "zoom_quality", value, zoom_quality), GDK_INTERP_NEAREST, GDK_INTERP_HYPER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
538 dither_quality = CLAMP(read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
539 "dither_quality", value, dither_quality), GDK_RGB_DITHER_NONE, GDK_RGB_DITHER_MAX);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
540
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
541 zoom_increment = read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
542 "zoom_increment", value, zoom_increment);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
543
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
544 enable_read_ahead = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
545 "enable_read_ahead", value, enable_read_ahead);
4
e149abcda4eb Syncing to 0.8.1
gqview
parents: 3
diff changeset
546
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
547 place_dialogs_under_mouse = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
548 "display_dialogs_under_mouse", value, place_dialogs_under_mouse);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
549
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
550 black_window_background = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
551 "black_window_background", value, black_window_background);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
552
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
553 fullscreen_screen = read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
554 "fullscreen_screen", value, fullscreen_screen);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
555 fullscreen_clean_flip = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
556 "fullscreen_clean_flip", value, fullscreen_clean_flip);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
557 fullscreen_disable_saver = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
558 "fullscreen_disable_saver", value, fullscreen_disable_saver);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
559 fullscreen_above = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
560 "fullscreen_above", value, fullscreen_above);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
561
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
562 dupe_custom_threshold = read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
563 "custom_similarity_threshold", value, dupe_custom_threshold);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
564
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
565 /* slideshow options */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
566
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
567 slideshow_delay = read_int_unit_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
568 "slideshow_delay", value, slideshow_delay, SLIDESHOW_SUBSECOND_PRECISION);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
569 slideshow_random = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
570 "slideshow_random", value, slideshow_random);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
571 slideshow_repeat = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
572 "slideshow_repeat", value, slideshow_repeat);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
573
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
574 /* filtering options */
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
575
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
576 show_dot_files = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
577 "show_dotfiles", value, show_dot_files);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
578 file_filter_disable = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
579 "disable_filtering", value, file_filter_disable);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
580
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
581 if (strcasecmp(option, "filter_ext") == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
582 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
583 filter_parse(value_all);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
584 }
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
585
145
8be2cc687304 fixed grouping sidecar files and made it configurable via config file
nadvornik
parents: 113
diff changeset
586 if (strcasecmp(option, "sidecar_ext") == 0)
8be2cc687304 fixed grouping sidecar files and made it configurable via config file
nadvornik
parents: 113
diff changeset
587 {
8be2cc687304 fixed grouping sidecar files and made it configurable via config file
nadvornik
parents: 113
diff changeset
588 sidecar_ext_parse(value_all);
8be2cc687304 fixed grouping sidecar files and made it configurable via config file
nadvornik
parents: 113
diff changeset
589 }
8be2cc687304 fixed grouping sidecar files and made it configurable via config file
nadvornik
parents: 113
diff changeset
590
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
591 /* Color Profiles */
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
592
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
593 color_profile_enabled = read_bool_option(f, option,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
594 "color_profile_enabled", value, color_profile_enabled);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
595 color_profile_use_image = read_bool_option(f, option,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
596 "color_profile_use_image", value, color_profile_use_image);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
597 color_profile_input_type = read_int_option(f, option,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
598 "color_profile_input_type", value, color_profile_input_type);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
599
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
600 if (strncasecmp(option, "color_profile_input_file_", 25) == 0)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
601 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
602 i = strtol(option + 25, NULL, 0) - 1;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
603 if (i >= 0 && i < COLOR_PROFILE_INPUTS)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
604 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
605 color_profile_input_file[i] = read_char_option(f, option,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
606 option, value, color_profile_input_file[i]);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
607 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
608 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
609 if (strncasecmp(option, "color_profile_input_name_", 25) == 0)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
610 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
611 i = strtol(option + 25, NULL, 0) - 1;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
612 if (i >= 0 && i < COLOR_PROFILE_INPUTS)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
613 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
614 color_profile_input_name[i] = read_char_option(f, option,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
615 option, value, color_profile_input_name[i]);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
616 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
617 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
618
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
619 color_profile_screen_type = read_int_option(f, option,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
620 "color_profile_screen_type", value, color_profile_screen_type);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
621 color_profile_screen_file = read_char_option(f, option,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
622 "color_profile_screen_file_1", value, color_profile_screen_file);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
623
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
624 /* External Programs */
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
625
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
626 if (strncasecmp(option, "external_", 9) == 0)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
627 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
628 i = strtol(option + 9, NULL, 0);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
629 if (i > 0 && i <= GQVIEW_EDITOR_SLOTS)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
630 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
631 gchar *ptr1, *ptr2;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
632 i--;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
633 c = 0;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
634 l = strlen(value_all);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
635 ptr1 = value_all;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
636
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
637 g_free(editor_name[i]);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
638 editor_name[i] = NULL;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
639 g_free(editor_command[i]);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
640 editor_command[i] = NULL;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
641
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
642 while (c<l && value_all[c] !='"') c++;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
643 if (ptr1[c] == '"')
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
644 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
645 c++;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
646 ptr2 = ptr1 + c;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
647 while (c<l && value_all[c] !='"') c++;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
648 if (ptr1[c] == '"')
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
649 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
650 ptr1[c] = '\0';
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
651 if (ptr1 + c - 1 != ptr2)
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
652 editor_name[i] = g_strdup(ptr2);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
653 c++;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
654 while (c<l && value_all[c] !='"') c++;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
655 if (ptr1[c] == '"')
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
656 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
657 c++;
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
658 ptr2 = ptr1 + c;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
659 while (value_all[c] != '\0') c++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
660 while (c > 0 && value_all[c] != '"') c--;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
661 if (ptr1[c] == '"' && ptr1 + c > ptr2)
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
662 {
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
663 ptr1[c] = '\0';
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
664 editor_command[i] = g_strdup(ptr2);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
665 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
666 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
667 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
668 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
669 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
670 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
671
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
672 /* colection options */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
673
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
674 collection_rectangular_selection = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
675 "rectangular_selections", value, collection_rectangular_selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
676
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
677 /* window positions */
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
678
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
679 save_window_positions = read_bool_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
680 "restore_window_positions", value, save_window_positions);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
681
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
682 main_window_x = read_int_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
683 "main_window_x", value, main_window_x);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
684 main_window_y = read_int_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
685 "main_window_y", value, main_window_y);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
686 main_window_w = read_int_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
687 "main_window_width", value, main_window_w);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
688 main_window_h = read_int_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
689 "main_window_height", value, main_window_h);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
690 main_window_maximized = read_bool_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
691 "main_window_maximized", value, main_window_maximized);
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
692 float_window_x = read_int_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
693 "float_window_x", value, float_window_x);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
694 float_window_y = read_int_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
695 "float_window_y", value, float_window_y);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
696 float_window_w = read_int_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
697 "float_window_width", value, float_window_w);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
698 float_window_h = read_int_option(f, option,
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
699 "float_window_height", value, float_window_h);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
700 float_window_divider = read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
701 "float_window_divider", value, float_window_divider);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
702 window_hdivider_pos = read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
703 "divider_position_h", value, window_hdivider_pos);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
704 window_vdivider_pos = read_int_option(f, option,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
705 "divider_position_v", value, window_vdivider_pos);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents: 4
diff changeset
706
1
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
707 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
708
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
709 fclose(f);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
710 g_free(rc_path);
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
711 }
b3e0e515fabf Initial revision
gqview
parents:
diff changeset
712