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