Mercurial > geeqie.yaz
annotate src/rcfile.c @ 40:dcc04a6a58bf
Sat Apr 16 12:29:42 2005 John Ellis <johne@verizon.net>
* pan-view.c: Add option to ignore symbolic links to folders when
creating file list (no gui control yet), and do not allow listing
the root folder as this introduces too many issues (for instance
how do we ignore special filesystems such as /proc using only stat
attributes?). Add fix to not show empty folders in the flower view.
* thumb_standard.c (thumb_loader_std_finish): Fix logic that caused
thumbnails to be saved for images with a size between normal and large
when using large thumbnails.
* ui_fileops.[ch]: Add utilities lstat_utf8 and islink.
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
##### an offical release when making enhancements and translation updates. #####
author | gqview |
---|---|
date | Sat, 16 Apr 2005 16:26:49 +0000 |
parents | 25335c62cd9b |
children | 6281cc38e5ca |
rev | line source |
---|---|
1 | 1 /* |
9 | 2 * GQview |
3 * (C) 2004 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 */ | |
26 | |
9 | 27 gchar *quoted_value(const gchar *text) |
1 | 28 { |
9 | 29 const gchar *ptr; |
1 | 30 gint c = 0; |
31 gint l = strlen(text); | |
32 | |
33 if (l == 0) return NULL; | |
34 | |
35 while (c < l && text[c] !='"') c++; | |
36 if (text[c] == '"') | |
37 { | |
9 | 38 gint e; |
1 | 39 c++; |
40 ptr = text + c; | |
9 | 41 e = c; |
42 while (e < l && text[e] !='"') e++; | |
43 if (text[e] == '"') | |
1 | 44 { |
9 | 45 if (e - c > 0) |
1 | 46 { |
9 | 47 return g_strndup(ptr, e - c); |
1 | 48 } |
49 } | |
50 } | |
51 else | |
52 /* for compatibility with older formats (<0.3.7) | |
53 * read a line without quotes too */ | |
54 { | |
55 c = 0; | |
56 while (c < l && text[c] !=' ' && text[c] !=8 && text[c] != '\n') c++; | |
57 if (c != 0) | |
58 { | |
9 | 59 return g_strndup(text, c); |
1 | 60 } |
61 } | |
62 | |
63 return NULL; | |
64 } | |
65 | |
66 static void write_char_option(FILE *f, gchar *label, gchar *text) | |
67 { | |
68 if (text) | |
69 fprintf(f,"%s: \"%s\"\n", label, text); | |
70 else | |
71 fprintf(f,"%s: \n", label); | |
72 } | |
73 | |
74 static gchar *read_char_option(FILE *f, gchar *option, gchar *label, gchar *value, gchar *text) | |
75 { | |
9 | 76 if (strcasecmp(option, label) == 0) |
1 | 77 { |
78 g_free(text); | |
79 text = quoted_value(value); | |
80 } | |
81 return text; | |
82 } | |
83 | |
84 static void write_int_option(FILE *f, gchar *label, gint n) | |
85 { | |
86 fprintf(f,"%s: %d\n\n", label, n); | |
87 } | |
88 | |
89 static gint read_int_option(FILE *f, gchar *option, gchar *label, gchar *value, gint n) | |
90 { | |
9 | 91 if (strcasecmp(option, label) == 0) |
92 { | |
93 n = strtol(value, NULL, 10); | |
94 } | |
95 return n; | |
96 } | |
97 | |
98 static void write_int_unit_option(FILE *f, gchar *label, gint n, gint subunits) | |
99 { | |
100 gint l, r; | |
101 | |
102 if (subunits > 0) | |
103 { | |
104 l = n / subunits; | |
105 r = n % subunits; | |
106 } | |
107 else | |
1 | 108 { |
9 | 109 l = n; |
110 r = 0; | |
111 } | |
112 | |
113 fprintf(f,"%s: %d.%d\n\n", label, l, r); | |
114 } | |
115 | |
116 static gint read_int_unit_option(FILE *f, gchar *option, gchar *label, gchar *value, gint n, gint subunits) | |
117 { | |
118 if (strcasecmp(option, label) == 0) | |
119 { | |
120 gint l, r; | |
121 gchar *ptr; | |
122 | |
123 ptr = value; | |
124 while (*ptr != '\0' && *ptr != '.') ptr++; | |
125 if (*ptr == '.') | |
126 { | |
127 *ptr = '\0'; | |
128 l = strtol(value, NULL, 10); | |
129 *ptr = '.'; | |
130 ptr++; | |
131 r = strtol(ptr, NULL, 10); | |
132 } | |
133 else | |
134 { | |
135 l = strtol(value, NULL, 10); | |
136 r = 0; | |
137 } | |
138 | |
139 n = l * subunits + r; | |
1 | 140 } |
141 return n; | |
142 } | |
143 | |
144 static void write_bool_option(FILE *f, gchar *label, gint n) | |
145 { | |
146 fprintf(f,"%s: ", label); | |
147 if (n) fprintf(f,"true\n"); else fprintf(f,"false\n"); | |
148 fprintf(f,"\n"); | |
149 } | |
150 | |
151 static gint read_bool_option(FILE *f, gchar *option, gchar *label, gchar *value, gint n) | |
152 { | |
9 | 153 if (strcasecmp(option, label) == 0) |
1 | 154 { |
9 | 155 if (strcasecmp(value, "true") == 0) |
1 | 156 n = TRUE; |
157 else | |
158 n = FALSE; | |
159 } | |
160 return n; | |
161 } | |
162 | |
163 /* | |
164 *----------------------------------------------------------------------------- | |
165 * save configuration (public) | |
166 *----------------------------------------------------------------------------- | |
167 */ | |
168 | |
9 | 169 void save_options(void) |
1 | 170 { |
171 FILE *f; | |
172 gchar *rc_path; | |
9 | 173 gchar *rc_pathl; |
1 | 174 gint i; |
175 | |
9 | 176 rc_path = g_strconcat(homedir(), "/", GQVIEW_RC_DIR, "/", RC_FILE_NAME, NULL); |
1 | 177 |
9 | 178 rc_pathl = path_from_utf8(rc_path); |
179 f = fopen(rc_pathl, "w"); | |
180 g_free(rc_pathl); | |
1 | 181 if (!f) |
182 { | |
9 | 183 gchar *buf; |
184 | |
185 buf = g_strdup_printf(_("error saving config file: %s\n"), rc_path); | |
186 print_term(buf); | |
187 g_free(buf); | |
188 | |
1 | 189 g_free(rc_path); |
190 return; | |
191 } | |
192 | |
193 fprintf(f,"######################################################################\n"); | |
194 fprintf(f,"# GQview config file version %7s #\n", VERSION); | |
195 fprintf(f,"######################################################################\n"); | |
196 fprintf(f,"\n"); | |
197 fprintf(f,"##### General Options #####\n\n"); | |
198 | |
9 | 199 write_int_option(f, "layout_style", layout_style); |
200 write_char_option(f, "layout_order", layout_order); | |
201 fprintf(f,"\n"); | |
202 write_bool_option(f, "layout_view_as_icons", layout_view_icons); | |
203 write_bool_option(f, "layout_view_as_tree", layout_view_tree); | |
204 write_bool_option(f, "show_icon_names", show_icon_names); | |
205 fprintf(f,"\n"); | |
206 | |
207 write_bool_option(f, "tree_descend_folders", tree_descend_subdirs); | |
208 write_bool_option(f, "lazy_image_sync", lazy_image_sync); | |
209 write_bool_option(f, "update_on_time_change", update_on_time_change); | |
210 write_bool_option(f, "exif_auto_rotate", exif_rotate_enable); | |
211 fprintf(f,"\n"); | |
212 | |
1 | 213 write_bool_option(f, "enable_startup_path", startup_path_enable); |
214 write_char_option(f, "startup_path", startup_path); | |
215 fprintf(f,"\n"); | |
216 | |
217 fprintf(f,"zoom_mode: "); | |
218 if (zoom_mode == ZOOM_RESET_ORIGINAL) fprintf(f,"original\n"); | |
219 if (zoom_mode == ZOOM_RESET_FIT_WINDOW) fprintf(f,"fit\n"); | |
220 if (zoom_mode == ZOOM_RESET_NONE) fprintf(f,"dont_change\n"); | |
9 | 221 |
222 write_bool_option(f, "two_pass_scaling", two_pass_zoom); | |
223 | |
224 write_bool_option(f, "zoom_to_fit_allow_expand", zoom_to_fit_expands); | |
1 | 225 fprintf(f,"\n"); |
226 | |
227 write_bool_option(f, "fit_window_to_image", fit_window); | |
228 write_bool_option(f, "limit_window_size", limit_window_size); | |
229 write_int_option(f, "max_window_size", max_window_size); | |
230 fprintf(f,"\n"); | |
231 | |
232 write_bool_option(f, "progressive_keyboard_scrolling", progressive_key_scrolling); | |
9 | 233 write_int_option(f, "scroll_reset_method", scroll_reset_method); |
1 | 234 fprintf(f,"\n"); |
235 | |
3 | 236 write_bool_option(f, "enable_thumbnails", thumbnails_enabled); |
1 | 237 write_int_option(f, "thumbnail_width", thumb_max_width); |
238 write_int_option(f, "thumbnail_height", thumb_max_height); | |
239 write_bool_option(f, "cache_thumbnails", enable_thumb_caching); | |
9 | 240 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
|
241 write_bool_option(f, "thumbnail_fast", thumbnail_fast); |
1 | 242 write_bool_option(f, "use_xvpics_thumbnails", use_xvpics_thumbnails); |
9 | 243 write_bool_option(f, "thumbnail_spec_standard", thumbnail_spec_standard); |
244 fprintf(f,"\n"); | |
245 | |
246 write_bool_option(f, "local_metadata", enable_metadata_dirs); | |
247 fprintf(f,"\n"); | |
248 | |
249 write_int_option(f, "sort_method", (gint)file_sort_method); | |
250 write_bool_option(f, "sort_ascending", file_sort_ascending); | |
251 write_bool_option(f, "sort_case_sensitive", file_sort_case_sensitive); | |
1 | 252 fprintf(f,"\n"); |
253 | |
254 write_bool_option(f, "confirm_delete", confirm_delete); | |
9 | 255 write_bool_option(f, "enable_delete_key", enable_delete_key); |
256 write_bool_option(f, "safe_delete", safe_delete_enable); | |
257 write_char_option(f, "safe_delete_path", safe_delete_path); | |
258 write_int_option(f, "safe_delete_size", safe_delete_size); | |
1 | 259 fprintf(f,"\n"); |
260 write_bool_option(f, "tools_float", tools_float); | |
261 write_bool_option(f, "tools_hidden", tools_hidden); | |
262 write_bool_option(f, "restore_tool_state", restore_tool); | |
263 | |
9 | 264 write_bool_option(f, "toolbar_hidden", toolbar_hidden); |
265 | |
4 | 266 write_bool_option(f, "mouse_wheel_scrolls", mousewheel_scrolls); |
9 | 267 write_bool_option(f, "in_place_rename", enable_in_place_rename); |
268 | |
269 write_int_option(f, "open_recent_max", recent_list_max); | |
270 | |
271 write_int_option(f, "image_cache_size_max", tile_cache_max); | |
272 | |
273 write_int_option(f, "thumbnail_quality", thumbnail_quality); | |
274 write_int_option(f, "zoom_quality", zoom_quality); | |
275 write_int_option(f, "dither_quality", dither_quality); | |
276 | |
277 write_int_option(f, "zoom_increment", zoom_increment); | |
278 | |
279 write_bool_option(f, "enable_read_ahead", enable_read_ahead); | |
280 | |
281 write_bool_option(f, "display_dialogs_under_mouse", place_dialogs_under_mouse); | |
282 | |
283 write_bool_option(f, "black_window_background", black_window_background); | |
284 | |
285 write_int_option(f, "fullscreen_screen", fullscreen_screen); | |
286 write_bool_option(f, "fullscreen_clean_flip", fullscreen_clean_flip); | |
287 write_bool_option(f, "fullscreen_disable_saver", fullscreen_disable_saver); | |
288 write_bool_option(f, "fullscreen_above", fullscreen_above); | |
289 | |
290 write_int_option(f, "custom_similarity_threshold", dupe_custom_threshold); | |
4 | 291 |
1 | 292 fprintf(f,"\n##### Slideshow Options #####\n\n"); |
293 | |
9 | 294 write_int_unit_option(f, "slideshow_delay", slideshow_delay, SLIDESHOW_SUBSECOND_PRECISION); |
1 | 295 |
296 write_bool_option(f, "slideshow_random", slideshow_random); | |
297 write_bool_option(f, "slideshow_repeat", slideshow_repeat); | |
298 | |
299 fprintf(f,"\n##### Filtering Options #####\n\n"); | |
300 | |
301 write_bool_option(f, "show_dotfiles", show_dot_files); | |
302 write_bool_option(f, "disable_filtering", file_filter_disable); | |
9 | 303 filter_write_list(f); |
1 | 304 |
305 fprintf(f,"\n##### External Programs #####\n"); | |
306 fprintf(f,"# Maximum of 8 programs (external_1 through external 8)\n"); | |
307 fprintf(f,"# format: external_n: \"menu name\" \"command line\"\n\n"); | |
308 | |
9 | 309 for (i = 0; i < GQVIEW_EDITOR_SLOTS; i++) |
1 | 310 { |
311 fprintf(f,"external_%d: \"", i+1); | |
9 | 312 if (editor_name[i]) fprintf(f, "%s", editor_name[i]); |
1 | 313 fprintf(f, "\" \""); |
9 | 314 if (editor_command[i]) fprintf(f, "%s", editor_command[i]); |
1 | 315 fprintf(f, "\"\n"); |
316 } | |
317 | |
9 | 318 fprintf(f,"\n##### Collection Options #####\n\n"); |
319 | |
320 write_bool_option(f, "rectangular_selections", collection_rectangular_selection); | |
321 | |
1 | 322 fprintf(f,"\n##### Window Positions #####\n\n"); |
323 | |
324 write_bool_option(f, "restore_window_positions", save_window_positions); | |
325 fprintf(f,"\n"); | |
326 write_int_option(f, "main_window_x", main_window_x); | |
327 write_int_option(f, "main_window_y", main_window_y); | |
328 write_int_option(f, "main_window_width", main_window_w); | |
329 write_int_option(f, "main_window_height", main_window_h); | |
9 | 330 write_bool_option(f, "main_window_maximized", main_window_maximized); |
1 | 331 write_int_option(f, "float_window_x", float_window_x); |
332 write_int_option(f, "float_window_y", float_window_y); | |
333 write_int_option(f, "float_window_width", float_window_w); | |
334 write_int_option(f, "float_window_height", float_window_h); | |
9 | 335 write_int_option(f, "float_window_divider", float_window_divider); |
336 write_int_option(f, "divider_position_h", window_hdivider_pos); | |
337 write_int_option(f, "divider_position_v", window_vdivider_pos); | |
1 | 338 |
339 fprintf(f,"######################################################################\n"); | |
340 fprintf(f,"# end of GQview config file #\n"); | |
341 fprintf(f,"######################################################################\n"); | |
342 | |
343 fclose(f); | |
344 | |
345 g_free(rc_path); | |
346 } | |
347 | |
348 /* | |
349 *----------------------------------------------------------------------------- | |
350 * load configuration (public) | |
351 *----------------------------------------------------------------------------- | |
352 */ | |
353 | |
9 | 354 void load_options(void) |
1 | 355 { |
356 FILE *f; | |
357 gchar *rc_path; | |
9 | 358 gchar *rc_pathl; |
1 | 359 gchar s_buf[1024]; |
360 gchar *s_buf_ptr; | |
361 gchar option[1024]; | |
362 gchar value[1024]; | |
363 gchar value_all[1024]; | |
364 gint c,l,i; | |
9 | 365 |
366 rc_path = g_strconcat(homedir(), "/", GQVIEW_RC_DIR, "/", RC_FILE_NAME, NULL); | |
1 | 367 |
9 | 368 rc_pathl = path_from_utf8(rc_path); |
369 f = fopen(rc_pathl,"r"); | |
370 g_free(rc_pathl); | |
1 | 371 if (!f) |
372 { | |
373 g_free(rc_path); | |
374 return; | |
375 } | |
376 | |
377 while (fgets(s_buf,1024,f)) | |
378 { | |
379 if (s_buf[0]=='#') continue; | |
380 if (s_buf[0]=='\n') continue; | |
381 c = 0; | |
382 l = strlen(s_buf); | |
383 while (s_buf[c] != ':' && c < l) c++; | |
384 if (c >= l) continue; | |
385 s_buf[c] = '\0'; | |
386 c++; | |
9 | 387 while ((s_buf[c] == ' ' || s_buf[c] == 8) && c < l) c++; |
1 | 388 s_buf_ptr = s_buf + c; |
9 | 389 strncpy(value_all, s_buf_ptr, sizeof(value_all)); |
1 | 390 while (s_buf[c] != 8 && s_buf[c] != ' ' && s_buf[c] != '\n' && c < l) c++; |
391 s_buf[c] = '\0'; | |
9 | 392 strncpy(option, s_buf, sizeof(option)); |
393 strncpy(value, s_buf_ptr, sizeof(value)); | |
1 | 394 |
395 /* general options */ | |
396 | |
9 | 397 layout_style = read_int_option(f, option, |
398 "layout_style", value, layout_style); | |
399 layout_order = read_char_option(f, option, | |
400 "layout_order", value, layout_order); | |
401 layout_view_icons = read_bool_option(f, option, | |
402 "layout_view_as_icons", value, layout_view_icons); | |
403 layout_view_tree = read_bool_option(f, option, | |
404 "layout_view_as_tree", value, layout_view_tree); | |
405 show_icon_names = read_bool_option(f, option, | |
406 "show_icon_names", value, show_icon_names); | |
407 | |
408 tree_descend_subdirs = read_bool_option(f, option, | |
409 "tree_descend_folders", value, tree_descend_subdirs); | |
410 lazy_image_sync = read_bool_option(f, option, | |
411 "lazy_image_sync", value, lazy_image_sync); | |
412 update_on_time_change = read_bool_option(f, option, | |
413 "update_on_time_change", value, update_on_time_change); | |
414 exif_rotate_enable = read_bool_option(f, option, | |
415 "exif_auto_rotate", value, exif_rotate_enable); | |
416 | |
1 | 417 startup_path_enable = read_bool_option(f, option, |
418 "enable_startup_path", value, startup_path_enable); | |
419 startup_path = read_char_option(f, option, | |
420 "startup_path", value_all, startup_path); | |
421 | |
9 | 422 if (strcasecmp(option,"zoom_mode") == 0) |
1 | 423 { |
9 | 424 if (strcasecmp(value, "original") == 0) zoom_mode = ZOOM_RESET_ORIGINAL; |
425 if (strcasecmp(value, "fit") == 0) zoom_mode = ZOOM_RESET_FIT_WINDOW; | |
426 if (strcasecmp(value, "dont_change") == 0) zoom_mode = ZOOM_RESET_NONE; | |
1 | 427 } |
9 | 428 two_pass_zoom = read_bool_option(f, option, |
429 "two_pass_scaling", value, two_pass_zoom); | |
430 zoom_to_fit_expands = read_bool_option(f, option, | |
431 "zoom_to_fit_allow_expand", value, zoom_to_fit_expands); | |
1 | 432 |
433 fit_window = read_bool_option(f, option, | |
434 "fit_window_to_image", value, fit_window); | |
435 limit_window_size = read_bool_option(f, option, | |
436 "limit_window_size", value, limit_window_size); | |
437 max_window_size = read_int_option(f, option, | |
438 "max_window_size", value, max_window_size); | |
439 progressive_key_scrolling = read_bool_option(f, option, | |
440 "progressive_keyboard_scrolling", value, progressive_key_scrolling); | |
9 | 441 scroll_reset_method = read_int_option(f, option, |
442 "scroll_reset_method", value, scroll_reset_method); | |
1 | 443 |
3 | 444 thumbnails_enabled = read_bool_option(f, option, |
445 "enable_thumbnails", value, thumbnails_enabled); | |
1 | 446 thumb_max_width = read_int_option(f, option, |
447 "thumbnail_width", value, thumb_max_width); | |
448 thumb_max_height = read_int_option(f, option, | |
449 "thumbnail_height", value, thumb_max_height); | |
450 enable_thumb_caching = read_bool_option(f, option, | |
451 "cache_thumbnails", value, enable_thumb_caching); | |
9 | 452 enable_thumb_dirs = read_bool_option(f, option, |
453 "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
|
454 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
|
455 "thumbnail_fast", value, thumbnail_fast); |
1 | 456 use_xvpics_thumbnails = read_bool_option(f, option, |
457 "use_xvpics_thumbnails", value, use_xvpics_thumbnails); | |
9 | 458 thumbnail_spec_standard = read_bool_option(f, option, |
459 "thumbnail_spec_standard", value, thumbnail_spec_standard); | |
460 | |
461 enable_metadata_dirs = read_bool_option(f, option, | |
462 "local_metadata", value, enable_metadata_dirs); | |
463 | |
464 file_sort_method = (SortType)read_int_option(f, option, | |
465 "sort_method", value, (gint)file_sort_method); | |
466 file_sort_ascending = read_bool_option(f, option, | |
467 "sort_ascending", value, file_sort_ascending); | |
468 file_sort_case_sensitive = read_bool_option(f, option, | |
469 "sort_case_sensitive", value, file_sort_case_sensitive); | |
1 | 470 |
471 confirm_delete = read_bool_option(f, option, | |
472 "confirm_delete", value, confirm_delete); | |
9 | 473 enable_delete_key = read_bool_option(f, option, |
474 "enable_delete_key", value, enable_delete_key); | |
475 safe_delete_enable = read_bool_option(f, option, | |
476 "safe_delete", value, safe_delete_enable); | |
477 safe_delete_path = read_char_option(f, option, | |
478 "safe_delete_path", value, safe_delete_path); | |
479 safe_delete_size = read_int_option(f, option, | |
480 "safe_delete_size", value, safe_delete_size); | |
1 | 481 |
482 tools_float = read_bool_option(f, option, | |
483 "tools_float", value, tools_float); | |
484 tools_hidden = read_bool_option(f, option, | |
485 "tools_hidden", value, tools_hidden); | |
486 restore_tool = read_bool_option(f, option, | |
487 "restore_tool_state", value, restore_tool); | |
488 | |
9 | 489 toolbar_hidden = read_bool_option(f, option, |
490 "toolbar_hidden", value, toolbar_hidden); | |
491 | |
4 | 492 mousewheel_scrolls = read_bool_option(f, option, |
493 "mouse_wheel_scrolls", value, mousewheel_scrolls); | |
9 | 494 enable_in_place_rename = read_bool_option(f, option, |
495 "in_place_rename", value, enable_in_place_rename); | |
4 | 496 |
9 | 497 recent_list_max = read_int_option(f, option, |
498 "open_recent_max", value, recent_list_max); | |
499 | |
500 tile_cache_max = read_int_option(f, option, | |
501 "image_cache_size_max", value, tile_cache_max); | |
502 | |
503 thumbnail_quality = CLAMP(read_int_option(f, option, | |
504 "thumbnail_quality", value, thumbnail_quality), GDK_INTERP_NEAREST, GDK_INTERP_HYPER); | |
505 zoom_quality = CLAMP(read_int_option(f, option, | |
506 "zoom_quality", value, zoom_quality), GDK_INTERP_NEAREST, GDK_INTERP_HYPER); | |
507 dither_quality = CLAMP(read_int_option(f, option, | |
508 "dither_quality", value, dither_quality), GDK_RGB_DITHER_NONE, GDK_RGB_DITHER_MAX); | |
509 | |
510 zoom_increment = read_int_option(f, option, | |
511 "zoom_increment", value, zoom_increment); | |
512 | |
513 enable_read_ahead = read_bool_option(f, option, | |
514 "enable_read_ahead", value, enable_read_ahead); | |
4 | 515 |
9 | 516 place_dialogs_under_mouse = read_bool_option(f, option, |
517 "display_dialogs_under_mouse", value, place_dialogs_under_mouse); | |
518 | |
519 black_window_background = read_bool_option(f, option, | |
520 "black_window_background", value, black_window_background); | |
1 | 521 |
9 | 522 fullscreen_screen = read_int_option(f, option, |
523 "fullscreen_screen", value, fullscreen_screen); | |
524 fullscreen_clean_flip = read_bool_option(f, option, | |
525 "fullscreen_clean_flip", value, fullscreen_clean_flip); | |
526 fullscreen_disable_saver = read_bool_option(f, option, | |
527 "fullscreen_disable_saver", value, fullscreen_disable_saver); | |
528 fullscreen_above = read_bool_option(f, option, | |
529 "fullscreen_above", value, fullscreen_above); | |
530 | |
531 dupe_custom_threshold = read_int_option(f, option, | |
532 "custom_similarity_threshold", value, dupe_custom_threshold); | |
533 | |
534 /* slideshow options */ | |
535 | |
536 slideshow_delay = read_int_unit_option(f, option, | |
537 "slideshow_delay", value, slideshow_delay, SLIDESHOW_SUBSECOND_PRECISION); | |
1 | 538 slideshow_random = read_bool_option(f, option, |
539 "slideshow_random", value, slideshow_random); | |
540 slideshow_repeat = read_bool_option(f, option, | |
541 "slideshow_repeat", value, slideshow_repeat); | |
542 | |
543 /* filtering options */ | |
544 | |
545 show_dot_files = read_bool_option(f, option, | |
546 "show_dotfiles", value, show_dot_files); | |
547 file_filter_disable = read_bool_option(f, option, | |
548 "disable_filtering", value, file_filter_disable); | |
549 | |
9 | 550 if (strcasecmp(option, "filter_ext") == 0) |
551 { | |
552 filter_parse(value_all); | |
553 } | |
1 | 554 |
555 /* External Programs */ | |
556 | |
9 | 557 if (strncasecmp(option, "external_", 9) == 0) |
1 | 558 { |
559 i = strtol(option + 9, NULL, 0); | |
9 | 560 if (i > 0 && i <= GQVIEW_EDITOR_SLOTS) |
1 | 561 { |
562 gchar *ptr1, *ptr2; | |
563 i--; | |
564 c = 0; | |
565 l = strlen(value_all); | |
566 ptr1 = value_all; | |
567 | |
568 g_free(editor_name[i]); | |
569 editor_name[i] = NULL; | |
570 g_free(editor_command[i]); | |
571 editor_command[i] = NULL; | |
572 | |
573 while (c<l && value_all[c] !='"') c++; | |
574 if (ptr1[c] == '"') | |
575 { | |
576 c++; | |
577 ptr2 = ptr1 + c; | |
578 while (c<l && value_all[c] !='"') c++; | |
579 if (ptr1[c] == '"') | |
580 { | |
581 ptr1[c] = '\0'; | |
582 if (ptr1 + c - 1 != ptr2) | |
583 editor_name[i] = g_strdup(ptr2); | |
584 c++; | |
585 while (c<l && value_all[c] !='"') c++; | |
586 if (ptr1[c] == '"') | |
587 { | |
588 c++; | |
589 ptr2 = ptr1 + c; | |
9 | 590 while (value_all[c] != '\0') c++; |
591 while (c > 0 && value_all[c] != '"') c--; | |
592 if (ptr1[c] == '"' && ptr1 + c > ptr2) | |
1 | 593 { |
594 ptr1[c] = '\0'; | |
595 editor_command[i] = g_strdup(ptr2); | |
596 } | |
597 } | |
598 } | |
599 } | |
600 } | |
601 } | |
602 | |
9 | 603 /* colection options */ |
604 | |
605 collection_rectangular_selection = read_bool_option(f, option, | |
606 "rectangular_selections", value, collection_rectangular_selection); | |
607 | |
1 | 608 /* window positions */ |
609 | |
610 save_window_positions = read_bool_option(f, option, | |
611 "restore_window_positions", value, save_window_positions); | |
612 | |
613 main_window_x = read_int_option(f, option, | |
614 "main_window_x", value, main_window_x); | |
615 main_window_y = read_int_option(f, option, | |
616 "main_window_y", value, main_window_y); | |
617 main_window_w = read_int_option(f, option, | |
618 "main_window_width", value, main_window_w); | |
619 main_window_h = read_int_option(f, option, | |
620 "main_window_height", value, main_window_h); | |
9 | 621 main_window_maximized = read_bool_option(f, option, |
622 "main_window_maximized", value, main_window_maximized); | |
1 | 623 float_window_x = read_int_option(f, option, |
624 "float_window_x", value, float_window_x); | |
625 float_window_y = read_int_option(f, option, | |
626 "float_window_y", value, float_window_y); | |
627 float_window_w = read_int_option(f, option, | |
628 "float_window_width", value, float_window_w); | |
629 float_window_h = read_int_option(f, option, | |
630 "float_window_height", value, float_window_h); | |
9 | 631 float_window_divider = read_int_option(f, option, |
632 "float_window_divider", value, float_window_divider); | |
633 window_hdivider_pos = read_int_option(f, option, | |
634 "divider_position_h", value, window_hdivider_pos); | |
635 window_vdivider_pos = read_int_option(f, option, | |
636 "divider_position_v", value, window_vdivider_pos); | |
637 | |
1 | 638 } |
639 | |
640 fclose(f); | |
641 g_free(rc_path); | |
642 } | |
643 |