- rc_pathl = path_from_utf8(utf8_path);
- f = fopen(rc_pathl,"r");
- g_free(rc_pathl);
- if (!f) return FALSE;
-
- while (fgets(s_buf, sizeof(s_buf), f))
- {
- gchar *value_end;
- gchar *p = s_buf;
-
- /* skip empty lines and comments */
- while (g_ascii_isspace(*p)) p++;
- if (!*p || *p == '\n' || *p == '#') continue;
-
- /* parse option name */
- option = p;
- while (g_ascii_isalnum(*p) || *p == '_' || *p == '.') p++;
- if (!*p) continue;
- *p = '\0';
- p++;
-
- /* search for value start, name and value are normally separated by ': '
- * but we allow relaxed syntax here, so '=', ':=' or just a tab will work too */
- while (*p == ':' || g_ascii_isspace(*p) || *p == '=') p++;
- value = p;
-
- while (*p && !g_ascii_isspace(*p) && *p != '\n') p++;
- value_end = p; /* value part up to the first whitespace or end of line */
- while (*p != '\0') p++;
- memcpy(value_all, value, 1 + p - value);
-
- *value_end = '\0';
-
-#define READ_BOOL(_name_) if (read_bool_option(f, option, #_name_, value, &options->_name_)) continue;
-#define READ_INT(_name_) if (read_int_option(f, option, #_name_, value, &options->_name_)) continue;
-#define READ_UINT(_name_) if (read_uint_option(f, option, #_name_, value, &options->_name_)) continue;
-#define READ_INT_CLAMP(_name_, _min_, _max_) if (read_int_option_clamp(f, option, #_name_, value, &options->_name_, _min_, _max_)) continue;
-#define READ_UINT_CLAMP(_name_, _min_, _max_) if (read_uint_option_clamp(f, option, #_name_, value, &options->_name_, _min_, _max_)) continue;
-#define READ_INT_UNIT(_name_, _unit_) if (read_int_unit_option(f, option, #_name_, value, &options->_name_, _unit_)) continue;
-#define READ_CHAR(_name_) if (read_char_option(f, option, #_name_, value_all, &options->_name_)) continue;
-#define READ_COLOR(_name_) if (read_color_option(f, option, #_name_, value, &options->_name_)) continue;
-
-#define COMPAT_READ_BOOL(_oldname_, _name_) if (read_bool_option(f, option, #_oldname_, value, &options->_name_)) continue;
-#define COMPAT_READ_INT(_oldname_, _name_) if (read_int_option(f, option, #_oldname_, value, &options->_name_)) continue;
-#define COMPAT_READ_UINT(_oldname_, _name_) if (read_uint_option(f, option, #_oldname_, value, &options->_name_)) continue;
-#define COMPAT_READ_INT_CLAMP(_oldname_, _name_, _min_, _max_) if (read_int_option_clamp(f, option, #_oldname_, value, &options->_name_, _min_, _max_)) continue;
-#define COMPAT_READ_INT_UNIT(_oldname_, _name_, _unit_) if (read_int_unit_option(f, option, #_oldname_, value, &options->_name_, _unit_)) continue;
-#define COMPAT_READ_CHAR(_oldname_, _name_) if (read_char_option(f, option, #_oldname_, value_all, &options->_name_)) continue;
-#define COMPAT_READ_COLOR(_oldname_, _name_) if (read_color_option(f, option, #_oldname_, value, &options->_name_)) continue;
-
- /* general options */
- READ_BOOL(show_icon_names);
- READ_BOOL(show_copy_path);
-
- READ_BOOL(tree_descend_subdirs);
- READ_BOOL(lazy_image_sync);
- READ_BOOL(update_on_time_change);
-
- READ_UINT_CLAMP(duplicates_similarity_threshold, 0, 100);
-
- READ_BOOL(progressive_key_scrolling);
-
- READ_BOOL(mousewheel_scrolls);
-
- READ_INT(open_recent_list_maxsize);
- READ_INT(dnd_icon_size);
- READ_BOOL(place_dialogs_under_mouse);
-
- /* startup options */
-
- COMPAT_READ_BOOL(startup_path_enable, startup.restore_path); /* 2008/05/11 */
- READ_BOOL(startup.restore_path);
-
- READ_BOOL(startup.use_last_path);
-
- COMPAT_READ_CHAR(startup_path, startup.path); /* 2008/05/11 */
- READ_CHAR(startup.path);
-
- /* layout options */
-
- READ_INT(layout.style);
- READ_CHAR(layout.order);
-
- COMPAT_READ_UINT(layout.view_as_icons, layout.file_view_type); /* 2008/05/03 */
-
- READ_UINT(layout.dir_view_type);
- READ_UINT(layout.file_view_type);
- READ_BOOL(layout.show_marks);
- READ_BOOL(layout.show_thumbnails);
- READ_BOOL(layout.show_directory_date);
- READ_CHAR(layout.home_path);
-
- /* window positions */
-
- READ_BOOL(layout.save_window_positions);
-
- READ_INT(layout.main_window.x);
- READ_INT(layout.main_window.y);
- READ_INT(layout.main_window.w);
- READ_INT(layout.main_window.h);
- READ_BOOL(layout.main_window.maximized);
- READ_INT(layout.main_window.hdivider_pos);
- READ_INT(layout.main_window.vdivider_pos);
-
- READ_INT(layout.float_window.x);
- READ_INT(layout.float_window.y);
- READ_INT(layout.float_window.w);
- READ_INT(layout.float_window.h);
- READ_INT(layout.float_window.vdivider_pos);
-
- READ_INT(layout.properties_window.w);
- READ_INT(layout.properties_window.h);
-
- READ_BOOL(layout.tools_float);
- READ_BOOL(layout.tools_hidden);
- READ_BOOL(layout.tools_restore_state);
- READ_BOOL(layout.toolbar_hidden);
-
- /* panels */
- READ_BOOL(panels.exif.enabled);
- READ_INT_CLAMP(panels.exif.width, PANEL_MIN_WIDTH, PANEL_MAX_WIDTH);
- READ_BOOL(panels.info.enabled);
- READ_INT_CLAMP(panels.info.width, PANEL_MIN_WIDTH, PANEL_MAX_WIDTH);
- READ_BOOL(panels.sort.enabled);
- READ_INT(panels.sort.action_state);
- READ_INT(panels.sort.mode_state);
- READ_INT(panels.sort.selection_state);
- READ_CHAR(panels.sort.action_filter);
-
- /* properties dialog options */
- READ_CHAR(properties.tabs_order);
-
- /* image options */
- if (g_ascii_strcasecmp(option, "image.zoom_mode") == 0)
- {
- if (g_ascii_strcasecmp(value, "original") == 0)
- options->image.zoom_mode = ZOOM_RESET_ORIGINAL;
- else if (g_ascii_strcasecmp(value, "fit") == 0)
- options->image.zoom_mode = ZOOM_RESET_FIT_WINDOW;
- else if (g_ascii_strcasecmp(value, "dont_change") == 0)
- options->image.zoom_mode = ZOOM_RESET_NONE;
- continue;
- }
- READ_BOOL(image.zoom_2pass);
- READ_BOOL(image.zoom_to_fit_allow_expand);
- READ_BOOL(image.fit_window_to_image);
- READ_BOOL(image.limit_window_size);
- READ_INT(image.max_window_size);
- READ_BOOL(image.limit_autofit_size);
- READ_INT(image.max_autofit_size);
- READ_UINT_CLAMP(image.scroll_reset_method, 0, PR_SCROLL_RESET_COUNT - 1);
- READ_INT(image.tile_cache_max);
- READ_INT(image.image_cache_max);
- READ_UINT_CLAMP(image.zoom_quality, GDK_INTERP_NEAREST, GDK_INTERP_HYPER);
- READ_UINT_CLAMP(image.dither_quality, GDK_RGB_DITHER_NONE, GDK_RGB_DITHER_MAX);
- READ_INT(image.zoom_increment);
- READ_BOOL(image.enable_read_ahead);
- READ_BOOL(image.exif_rotate_enable);
- READ_BOOL(image.use_custom_border_color);
- READ_COLOR(image.border_color);
- READ_INT_CLAMP(image.read_buffer_size, IMAGE_LOADER_READ_BUFFER_SIZE_MIN, IMAGE_LOADER_READ_BUFFER_SIZE_MAX);
- READ_INT_CLAMP(image.idle_read_loop_count, IMAGE_LOADER_IDLE_READ_LOOP_COUNT_MIN, IMAGE_LOADER_IDLE_READ_LOOP_COUNT_MAX);
-
-
- /* thumbnails options */
- READ_INT_CLAMP(thumbnails.max_width, 16, 512);
- READ_INT_CLAMP(thumbnails.max_height, 16, 512);
-
- READ_BOOL(thumbnails.enable_caching);
- READ_BOOL(thumbnails.cache_into_dirs);
- READ_BOOL(thumbnails.fast);
- READ_BOOL(thumbnails.use_xvpics);
- READ_BOOL(thumbnails.spec_standard);
- READ_UINT_CLAMP(thumbnails.quality, GDK_INTERP_NEAREST, GDK_INTERP_HYPER);
- READ_BOOL(thumbnails.use_exif);
-
- /* file sorting options */
- READ_UINT(file_sort.method);
- READ_BOOL(file_sort.ascending);
- READ_BOOL(file_sort.case_sensitive);
-
- /* file operations options */
- READ_BOOL(file_ops.enable_in_place_rename);
- READ_BOOL(file_ops.confirm_delete);
- READ_BOOL(file_ops.enable_delete_key);
- READ_BOOL(file_ops.safe_delete_enable);
- READ_CHAR(file_ops.safe_delete_path);
- READ_INT(file_ops.safe_delete_folder_maxsize);
-
- /* fullscreen options */
- READ_INT(fullscreen.screen);
- READ_BOOL(fullscreen.clean_flip);
- READ_BOOL(fullscreen.disable_saver);
- READ_BOOL(fullscreen.above);
-
- /* histogram */
- READ_UINT(histogram.last_channel_mode);
- READ_UINT(histogram.last_log_mode);
-
- /* image overlay */
- COMPAT_READ_UINT(image_overlay.common.enabled, image_overlay.common.state); /* 2008-05-12 */
- READ_UINT(image_overlay.common.state);
- COMPAT_READ_BOOL(fullscreen.show_info, image_overlay.common.show_at_startup); /* 2008-04-21 */
- READ_BOOL(image_overlay.common.show_at_startup);
- COMPAT_READ_CHAR(fullscreen.info, image_overlay.common.template_string); /* 2008-04-21 */
- READ_CHAR(image_overlay.common.template_string);
-
- READ_INT(image_overlay.common.x);
- READ_INT(image_overlay.common.y);
-
-
- /* slideshow options */
- READ_INT_UNIT(slideshow.delay, SLIDESHOW_SUBSECOND_PRECISION);
- READ_BOOL(slideshow.random);
- READ_BOOL(slideshow.repeat);
-
- /* collection options */
-
- READ_BOOL(collections.rectangular_selection);
-
- /* filtering options */
-
- READ_BOOL(file_filter.show_hidden_files);
- READ_BOOL(file_filter.show_dot_directory);
- READ_BOOL(file_filter.disable);
-
- if (g_ascii_strcasecmp(option, "file_filter.ext") == 0)
- {
- filter_parse(value_all);
- continue;
- }