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