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