Mercurial > geeqie
annotate src/rcfile.c @ 217:5bdab7ed4bcd
use quoted_value everywhere
simplify parsing of multiple quoted values on one line
author | nadvornik |
---|---|
date | Mon, 31 Mar 2008 21:09:36 +0000 |
parents | 3fa93ab9b119 |
children | f4a0555794a9 |
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" | |
19 | |
1 | 20 |
21 /* | |
22 *----------------------------------------------------------------------------- | |
23 * line write/parse routines (private) | |
24 *----------------------------------------------------------------------------- | |
25 */ | |
217 | 26 |
27 /* | |
28 returns text without quotes or NULL for empty or broken string | |
29 any text up to first '"' is skipped | |
30 tail is set to point at the char after the second '"' | |
31 or at the ending \0 | |
32 | |
33 */ | |
1 | 34 |
217 | 35 gchar *quoted_value(const gchar *text, const gchar **tail) |
1 | 36 { |
9 | 37 const gchar *ptr; |
1 | 38 gint c = 0; |
39 gint l = strlen(text); | |
210
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
40 gchar *retval = NULL; |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
41 |
217 | 42 if (tail) *tail = text; |
43 | |
210
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
44 if (l == 0) return retval; |
1 | 45 |
46 while (c < l && text[c] !='"') c++; | |
47 if (text[c] == '"') | |
48 { | |
9 | 49 gint e; |
1 | 50 c++; |
51 ptr = text + c; | |
9 | 52 e = c; |
210
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
53 while (e < l) |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
54 { |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
55 if (text[e-1] != '\\' && text[e] == '"') break; |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
56 e++; |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
57 } |
9 | 58 if (text[e] == '"') |
1 | 59 { |
9 | 60 if (e - c > 0) |
1 | 61 { |
210
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
62 gchar *substring = g_strndup(ptr, e - c); |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
63 |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
64 if (substring) |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
65 { |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
66 retval = g_strcompress(substring); |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
67 g_free(substring); |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
68 } |
1 | 69 } |
70 } | |
217 | 71 if (tail) *tail = text + e + 1; |
1 | 72 } |
73 else | |
74 /* for compatibility with older formats (<0.3.7) | |
75 * read a line without quotes too */ | |
76 { | |
77 c = 0; | |
78 while (c < l && text[c] !=' ' && text[c] !=8 && text[c] != '\n') c++; | |
79 if (c != 0) | |
80 { | |
210
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
81 retval = g_strndup(text, c); |
1 | 82 } |
217 | 83 if (tail) *tail = text + c; |
1 | 84 } |
85 | |
210
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
86 return retval; |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
87 } |
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 gchar *escquote_value(const gchar *text) |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
90 { |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
91 gchar *e; |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
92 gchar *retval; |
3fa93ab9b119
Improve escaping and quoting of strings saved in rc files.
zas_
parents:
209
diff
changeset
|
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); | |
360 | |
361 write_int_option(f, "custom_similarity_threshold", dupe_custom_threshold); | |
4 | 362 |
1 | 363 fprintf(f,"\n##### Slideshow Options #####\n\n"); |
364 | |
9 | 365 write_int_unit_option(f, "slideshow_delay", slideshow_delay, SLIDESHOW_SUBSECOND_PRECISION); |
1 | 366 |
367 write_bool_option(f, "slideshow_random", slideshow_random); | |
368 write_bool_option(f, "slideshow_repeat", slideshow_repeat); | |
369 | |
370 fprintf(f,"\n##### Filtering Options #####\n\n"); | |
371 | |
372 write_bool_option(f, "show_dotfiles", show_dot_files); | |
373 write_bool_option(f, "disable_filtering", file_filter_disable); | |
9 | 374 filter_write_list(f); |
145
8be2cc687304
fixed grouping sidecar files and made it configurable via config file
nadvornik
parents:
113
diff
changeset
|
375 |
8be2cc687304
fixed grouping sidecar files and made it configurable via config file
nadvornik
parents:
113
diff
changeset
|
376 sidecar_ext_write(f); |
1 | 377 |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
378 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
|
379 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
380 #ifndef HAVE_LCMS |
196 | 381 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
|
382 "# 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
|
383 #endif |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
384 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
385 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
|
386 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
|
387 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
|
388 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
|
389 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
390 gchar *buf; |
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 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
|
393 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
|
394 g_free(buf); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
395 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
396 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
|
397 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
|
398 g_free(buf); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
399 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
400 fprintf(f,"\n"); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
401 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
|
402 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
|
403 |
1 | 404 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
|
405 fprintf(f,"# Maximum of 10 programs (external_1 through external_10)\n"); |
1 | 406 fprintf(f,"# format: external_n: \"menu name\" \"command line\"\n\n"); |
407 | |
9 | 408 for (i = 0; i < GQVIEW_EDITOR_SLOTS; i++) |
1 | 409 { |
217 | 410 char *qname = escquote_value(editor_name[i]); |
411 char *qcommand = escquote_value(editor_command[i]); | |
412 fprintf(f,"external_%d: %s %s\n", i+1, qname, qcommand); | |
413 g_free(qname); | |
414 g_free(qcommand); | |
1 | 415 } |
416 | |
9 | 417 fprintf(f,"\n##### Collection Options #####\n\n"); |
418 | |
419 write_bool_option(f, "rectangular_selections", collection_rectangular_selection); | |
420 | |
1 | 421 fprintf(f,"\n##### Window Positions #####\n\n"); |
422 | |
423 write_bool_option(f, "restore_window_positions", save_window_positions); | |
424 fprintf(f,"\n"); | |
425 write_int_option(f, "main_window_x", main_window_x); | |
426 write_int_option(f, "main_window_y", main_window_y); | |
427 write_int_option(f, "main_window_width", main_window_w); | |
428 write_int_option(f, "main_window_height", main_window_h); | |
9 | 429 write_bool_option(f, "main_window_maximized", main_window_maximized); |
1 | 430 write_int_option(f, "float_window_x", float_window_x); |
431 write_int_option(f, "float_window_y", float_window_y); | |
432 write_int_option(f, "float_window_width", float_window_w); | |
433 write_int_option(f, "float_window_height", float_window_h); | |
9 | 434 write_int_option(f, "float_window_divider", float_window_divider); |
435 write_int_option(f, "divider_position_h", window_hdivider_pos); | |
436 write_int_option(f, "divider_position_v", window_vdivider_pos); | |
1 | 437 |
438 fprintf(f,"######################################################################\n"); | |
196 | 439 fprintf(f,"# end of Geeqie config file #\n"); |
1 | 440 fprintf(f,"######################################################################\n"); |
441 | |
442 fclose(f); | |
443 | |
444 g_free(rc_path); | |
445 } | |
446 | |
447 /* | |
448 *----------------------------------------------------------------------------- | |
449 * load configuration (public) | |
450 *----------------------------------------------------------------------------- | |
451 */ | |
452 | |
9 | 453 void load_options(void) |
1 | 454 { |
455 FILE *f; | |
456 gchar *rc_path; | |
9 | 457 gchar *rc_pathl; |
1 | 458 gchar s_buf[1024]; |
459 gchar *s_buf_ptr; | |
460 gchar option[1024]; | |
461 gchar value[1024]; | |
462 gchar value_all[1024]; | |
463 gint c,l,i; | |
9 | 464 |
465 rc_path = g_strconcat(homedir(), "/", GQVIEW_RC_DIR, "/", RC_FILE_NAME, NULL); | |
1 | 466 |
9 | 467 rc_pathl = path_from_utf8(rc_path); |
468 f = fopen(rc_pathl,"r"); | |
469 g_free(rc_pathl); | |
1 | 470 if (!f) |
471 { | |
472 g_free(rc_path); | |
473 return; | |
474 } | |
475 | |
476 while (fgets(s_buf,1024,f)) | |
477 { | |
478 if (s_buf[0]=='#') continue; | |
479 if (s_buf[0]=='\n') continue; | |
480 c = 0; | |
481 l = strlen(s_buf); | |
482 while (s_buf[c] != ':' && c < l) c++; | |
483 if (c >= l) continue; | |
484 s_buf[c] = '\0'; | |
485 c++; | |
9 | 486 while ((s_buf[c] == ' ' || s_buf[c] == 8) && c < l) c++; |
1 | 487 s_buf_ptr = s_buf + c; |
9 | 488 strncpy(value_all, s_buf_ptr, sizeof(value_all)); |
1 | 489 while (s_buf[c] != 8 && s_buf[c] != ' ' && s_buf[c] != '\n' && c < l) c++; |
490 s_buf[c] = '\0'; | |
9 | 491 strncpy(option, s_buf, sizeof(option)); |
492 strncpy(value, s_buf_ptr, sizeof(value)); | |
1 | 493 |
494 /* general options */ | |
495 | |
9 | 496 layout_style = read_int_option(f, option, |
497 "layout_style", value, layout_style); | |
498 layout_order = read_char_option(f, option, | |
499 "layout_order", value, layout_order); | |
500 layout_view_icons = read_bool_option(f, option, | |
501 "layout_view_as_icons", value, layout_view_icons); | |
502 layout_view_tree = read_bool_option(f, option, | |
503 "layout_view_as_tree", value, layout_view_tree); | |
504 show_icon_names = read_bool_option(f, option, | |
505 "show_icon_names", value, show_icon_names); | |
506 | |
507 tree_descend_subdirs = read_bool_option(f, option, | |
508 "tree_descend_folders", value, tree_descend_subdirs); | |
509 lazy_image_sync = read_bool_option(f, option, | |
510 "lazy_image_sync", value, lazy_image_sync); | |
511 update_on_time_change = read_bool_option(f, option, | |
512 "update_on_time_change", value, update_on_time_change); | |
513 exif_rotate_enable = read_bool_option(f, option, | |
514 "exif_auto_rotate", value, exif_rotate_enable); | |
515 | |
1 | 516 startup_path_enable = read_bool_option(f, option, |
517 "enable_startup_path", value, startup_path_enable); | |
518 startup_path = read_char_option(f, option, | |
519 "startup_path", value_all, startup_path); | |
520 | |
9 | 521 if (strcasecmp(option,"zoom_mode") == 0) |
1 | 522 { |
9 | 523 if (strcasecmp(value, "original") == 0) zoom_mode = ZOOM_RESET_ORIGINAL; |
524 if (strcasecmp(value, "fit") == 0) zoom_mode = ZOOM_RESET_FIT_WINDOW; | |
525 if (strcasecmp(value, "dont_change") == 0) zoom_mode = ZOOM_RESET_NONE; | |
1 | 526 } |
9 | 527 two_pass_zoom = read_bool_option(f, option, |
528 "two_pass_scaling", value, two_pass_zoom); | |
529 zoom_to_fit_expands = read_bool_option(f, option, | |
530 "zoom_to_fit_allow_expand", value, zoom_to_fit_expands); | |
1 | 531 |
532 fit_window = read_bool_option(f, option, | |
533 "fit_window_to_image", value, fit_window); | |
534 limit_window_size = read_bool_option(f, option, | |
535 "limit_window_size", value, limit_window_size); | |
536 max_window_size = read_int_option(f, option, | |
537 "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
|
538 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
|
539 "limit_autofit_size", value, limit_autofit_size); |
ad78ad18523a
configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents:
208
diff
changeset
|
540 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
|
541 "max_autofit_size", value, max_autofit_size); |
1 | 542 progressive_key_scrolling = read_bool_option(f, option, |
543 "progressive_keyboard_scrolling", value, progressive_key_scrolling); | |
9 | 544 scroll_reset_method = read_int_option(f, option, |
545 "scroll_reset_method", value, scroll_reset_method); | |
1 | 546 |
3 | 547 thumbnails_enabled = read_bool_option(f, option, |
548 "enable_thumbnails", value, thumbnails_enabled); | |
1 | 549 thumb_max_width = read_int_option(f, option, |
550 "thumbnail_width", value, thumb_max_width); | |
551 thumb_max_height = read_int_option(f, option, | |
552 "thumbnail_height", value, thumb_max_height); | |
553 enable_thumb_caching = read_bool_option(f, option, | |
554 "cache_thumbnails", value, enable_thumb_caching); | |
9 | 555 enable_thumb_dirs = read_bool_option(f, option, |
556 "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
|
557 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
|
558 "thumbnail_fast", value, thumbnail_fast); |
1 | 559 use_xvpics_thumbnails = read_bool_option(f, option, |
560 "use_xvpics_thumbnails", value, use_xvpics_thumbnails); | |
9 | 561 thumbnail_spec_standard = read_bool_option(f, option, |
562 "thumbnail_spec_standard", value, thumbnail_spec_standard); | |
563 | |
564 enable_metadata_dirs = read_bool_option(f, option, | |
565 "local_metadata", value, enable_metadata_dirs); | |
566 | |
567 file_sort_method = (SortType)read_int_option(f, option, | |
568 "sort_method", value, (gint)file_sort_method); | |
569 file_sort_ascending = read_bool_option(f, option, | |
570 "sort_ascending", value, file_sort_ascending); | |
571 file_sort_case_sensitive = read_bool_option(f, option, | |
572 "sort_case_sensitive", value, file_sort_case_sensitive); | |
1 | 573 |
574 confirm_delete = read_bool_option(f, option, | |
575 "confirm_delete", value, confirm_delete); | |
9 | 576 enable_delete_key = read_bool_option(f, option, |
577 "enable_delete_key", value, enable_delete_key); | |
578 safe_delete_enable = read_bool_option(f, option, | |
579 "safe_delete", value, safe_delete_enable); | |
580 safe_delete_path = read_char_option(f, option, | |
581 "safe_delete_path", value, safe_delete_path); | |
582 safe_delete_size = read_int_option(f, option, | |
583 "safe_delete_size", value, safe_delete_size); | |
1 | 584 |
585 tools_float = read_bool_option(f, option, | |
586 "tools_float", value, tools_float); | |
587 tools_hidden = read_bool_option(f, option, | |
588 "tools_hidden", value, tools_hidden); | |
589 restore_tool = read_bool_option(f, option, | |
590 "restore_tool_state", value, restore_tool); | |
591 | |
9 | 592 toolbar_hidden = read_bool_option(f, option, |
593 "toolbar_hidden", value, toolbar_hidden); | |
594 | |
4 | 595 mousewheel_scrolls = read_bool_option(f, option, |
596 "mouse_wheel_scrolls", value, mousewheel_scrolls); | |
9 | 597 enable_in_place_rename = read_bool_option(f, option, |
598 "in_place_rename", value, enable_in_place_rename); | |
4 | 599 |
9 | 600 recent_list_max = read_int_option(f, option, |
601 "open_recent_max", value, recent_list_max); | |
602 | |
603 tile_cache_max = read_int_option(f, option, | |
604 "image_cache_size_max", value, tile_cache_max); | |
605 | |
606 thumbnail_quality = CLAMP(read_int_option(f, option, | |
607 "thumbnail_quality", value, thumbnail_quality), GDK_INTERP_NEAREST, GDK_INTERP_HYPER); | |
608 zoom_quality = CLAMP(read_int_option(f, option, | |
609 "zoom_quality", value, zoom_quality), GDK_INTERP_NEAREST, GDK_INTERP_HYPER); | |
610 dither_quality = CLAMP(read_int_option(f, option, | |
611 "dither_quality", value, dither_quality), GDK_RGB_DITHER_NONE, GDK_RGB_DITHER_MAX); | |
612 | |
613 zoom_increment = read_int_option(f, option, | |
614 "zoom_increment", value, zoom_increment); | |
615 | |
616 enable_read_ahead = read_bool_option(f, option, | |
617 "enable_read_ahead", value, enable_read_ahead); | |
4 | 618 |
9 | 619 place_dialogs_under_mouse = read_bool_option(f, option, |
620 "display_dialogs_under_mouse", value, place_dialogs_under_mouse); | |
621 | |
208
fa0e05f985c3
set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents:
196
diff
changeset
|
622 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
|
623 "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
|
624 read_color_option(f, option, |
fa0e05f985c3
set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents:
196
diff
changeset
|
625 "window_background_color", value, &window_background_color); |
1 | 626 |
9 | 627 fullscreen_screen = read_int_option(f, option, |
628 "fullscreen_screen", value, fullscreen_screen); | |
629 fullscreen_clean_flip = read_bool_option(f, option, | |
630 "fullscreen_clean_flip", value, fullscreen_clean_flip); | |
631 fullscreen_disable_saver = read_bool_option(f, option, | |
632 "fullscreen_disable_saver", value, fullscreen_disable_saver); | |
633 fullscreen_above = read_bool_option(f, option, | |
634 "fullscreen_above", value, fullscreen_above); | |
635 | |
636 dupe_custom_threshold = read_int_option(f, option, | |
637 "custom_similarity_threshold", value, dupe_custom_threshold); | |
638 | |
639 /* slideshow options */ | |
640 | |
641 slideshow_delay = read_int_unit_option(f, option, | |
642 "slideshow_delay", value, slideshow_delay, SLIDESHOW_SUBSECOND_PRECISION); | |
1 | 643 slideshow_random = read_bool_option(f, option, |
644 "slideshow_random", value, slideshow_random); | |
645 slideshow_repeat = read_bool_option(f, option, | |
646 "slideshow_repeat", value, slideshow_repeat); | |
647 | |
648 /* filtering options */ | |
649 | |
650 show_dot_files = read_bool_option(f, option, | |
651 "show_dotfiles", value, show_dot_files); | |
652 file_filter_disable = read_bool_option(f, option, | |
653 "disable_filtering", value, file_filter_disable); | |
654 | |
9 | 655 if (strcasecmp(option, "filter_ext") == 0) |
656 { | |
657 filter_parse(value_all); | |
658 } | |
1 | 659 |
145
8be2cc687304
fixed grouping sidecar files and made it configurable via config file
nadvornik
parents:
113
diff
changeset
|
660 if (strcasecmp(option, "sidecar_ext") == 0) |
8be2cc687304
fixed grouping sidecar files and made it configurable via config file
nadvornik
parents:
113
diff
changeset
|
661 { |
170
9a56e3d13e67
basic sidecar files configuration via preferences dialog
nadvornik
parents:
145
diff
changeset
|
662 sidecar_ext_parse(value_all, TRUE); |
145
8be2cc687304
fixed grouping sidecar files and made it configurable via config file
nadvornik
parents:
113
diff
changeset
|
663 } |
8be2cc687304
fixed grouping sidecar files and made it configurable via config file
nadvornik
parents:
113
diff
changeset
|
664 |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
665 /* Color Profiles */ |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
666 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
667 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
|
668 "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
|
669 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
|
670 "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
|
671 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
|
672 "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
|
673 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
674 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
|
675 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
676 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
|
677 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
|
678 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
679 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
|
680 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
|
681 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
682 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
683 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
|
684 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
685 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
|
686 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
|
687 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
688 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
|
689 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
|
690 } |
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 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
693 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
|
694 "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
|
695 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
|
696 "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
|
697 |
1 | 698 /* External Programs */ |
699 | |
9 | 700 if (strncasecmp(option, "external_", 9) == 0) |
1 | 701 { |
702 i = strtol(option + 9, NULL, 0); | |
9 | 703 if (i > 0 && i <= GQVIEW_EDITOR_SLOTS) |
1 | 704 { |
217 | 705 const gchar *ptr; |
1 | 706 i--; |
707 g_free(editor_name[i]); | |
708 g_free(editor_command[i]); | |
217 | 709 |
710 editor_name[i] = quoted_value(value_all, &ptr); | |
711 editor_command[i] = quoted_value(ptr, NULL); | |
1 | 712 } |
713 } | |
714 | |
9 | 715 /* colection options */ |
716 | |
717 collection_rectangular_selection = read_bool_option(f, option, | |
718 "rectangular_selections", value, collection_rectangular_selection); | |
719 | |
1 | 720 /* window positions */ |
721 | |
722 save_window_positions = read_bool_option(f, option, | |
723 "restore_window_positions", value, save_window_positions); | |
724 | |
725 main_window_x = read_int_option(f, option, | |
726 "main_window_x", value, main_window_x); | |
727 main_window_y = read_int_option(f, option, | |
728 "main_window_y", value, main_window_y); | |
729 main_window_w = read_int_option(f, option, | |
730 "main_window_width", value, main_window_w); | |
731 main_window_h = read_int_option(f, option, | |
732 "main_window_height", value, main_window_h); | |
9 | 733 main_window_maximized = read_bool_option(f, option, |
734 "main_window_maximized", value, main_window_maximized); | |
1 | 735 float_window_x = read_int_option(f, option, |
736 "float_window_x", value, float_window_x); | |
737 float_window_y = read_int_option(f, option, | |
738 "float_window_y", value, float_window_y); | |
739 float_window_w = read_int_option(f, option, | |
740 "float_window_width", value, float_window_w); | |
741 float_window_h = read_int_option(f, option, | |
742 "float_window_height", value, float_window_h); | |
9 | 743 float_window_divider = read_int_option(f, option, |
744 "float_window_divider", value, float_window_divider); | |
745 window_hdivider_pos = read_int_option(f, option, | |
746 "divider_position_h", value, window_hdivider_pos); | |
747 window_vdivider_pos = read_int_option(f, option, | |
748 "divider_position_v", value, window_vdivider_pos); | |
749 | |
1 | 750 } |
751 | |
752 fclose(f); | |
753 g_free(rc_path); | |
754 } | |
755 |