# HG changeset patch # User zas_ # Date 1207952076 0 # Node ID b16b9b8979e54353045257304915fdf4d4e86396 # Parent 46169c246c513a6a2df0187e33fd056466e147a0 Add a new struct ConfOptions to handle options. Changes were made among the code to use only one global var named "options" of type ConfOptions *. Initialization takes place in new init_options(). diff -r 46169c246c51 -r b16b9b8979e5 src/bar_info.c --- a/src/bar_info.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/bar_info.c Fri Apr 11 22:14:36 2008 +0000 @@ -312,7 +312,7 @@ { if (!fd) return FALSE; - if (enable_metadata_dirs && /* FIXME - use dedicated option */ + if (options->enable_metadata_dirs && /* FIXME - use dedicated option */ comment_xmp_write(fd, keywords, comment)) { comment_delete_legacy(fd); diff -r 46169c246c51 -r b16b9b8979e5 src/cache-loader.c --- a/src/cache-loader.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/cache-loader.c Fri Apr 11 22:14:36 2008 +0000 @@ -157,7 +157,7 @@ else { /* done, save then call done function */ - if (enable_thumb_caching && + if (options->enable_thumb_caching && cl->done_mask != CACHE_LOADER_NONE) { gchar *base; diff -r 46169c246c51 -r b16b9b8979e5 src/cache.c --- a/src/cache.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/cache.c Fri Apr 11 22:14:36 2008 +0000 @@ -660,8 +660,8 @@ cache_ext = NULL; } - if (((type != CACHE_TYPE_METADATA && enable_thumb_dirs) || - (type == CACHE_TYPE_METADATA && enable_metadata_dirs)) && + if (((type != CACHE_TYPE_METADATA && options->enable_thumb_dirs) || + (type == CACHE_TYPE_METADATA && options->enable_metadata_dirs)) && access_file(base, W_OK)) { path = g_strconcat(base, "/", cache_local, name, cache_ext, NULL); @@ -699,11 +699,11 @@ if (type == CACHE_TYPE_METADATA) { - prefer_local = enable_metadata_dirs; + prefer_local = options->enable_metadata_dirs; } else { - prefer_local = enable_thumb_dirs; + prefer_local = options->enable_thumb_dirs; } if (prefer_local) diff -r 46169c246c51 -r b16b9b8979e5 src/cache_maint.c --- a/src/cache_maint.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/cache_maint.c Fri Apr 11 22:14:36 2008 +0000 @@ -547,7 +547,8 @@ } g_free(base); - if (enable_thumb_caching && thumbnail_spec_standard) thumb_std_maint_moved(src, dest); + if (options->enable_thumb_caching && options->thumbnail_spec_standard) + thumb_std_maint_moved(src, dest); } static void cache_file_remove(const gchar *path) @@ -574,7 +575,8 @@ cache_file_remove(buf); g_free(buf); - if (enable_thumb_caching && thumbnail_spec_standard) thumb_std_maint_removed(fd->path); + if (options->enable_thumb_caching && options->thumbnail_spec_standard) + thumb_std_maint_removed(fd->path); } void cache_maint_copied(FileData *fd) @@ -738,7 +740,7 @@ path = cd->list->data; cd->list = g_list_remove(cd->list, path); - cd->tl = (ThumbLoaderStd *)thumb_loader_new(thumb_max_width, thumb_max_height); + cd->tl = (ThumbLoaderStd *)thumb_loader_new(options->thumb_max_width, options->thumb_max_height); thumb_loader_set_callbacks((ThumbLoader *)cd->tl, cache_manager_render_thumb_done_cb, cache_manager_render_thumb_done_cb, @@ -849,7 +851,7 @@ pref_checkbox_new_int(cd->group, _("Include subfolders"), FALSE, &cd->recurse); button = pref_checkbox_new_int(cd->group, _("Store thumbnails local to source images"), FALSE, &cd->local); - gtk_widget_set_sensitive(button, thumbnail_spec_standard); + gtk_widget_set_sensitive(button, options->thumbnail_spec_standard); pref_line(cd->gd->vbox, PREF_PAD_SPACE); hbox = pref_box_new(cd->gd->vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); diff -r 46169c246c51 -r b16b9b8979e5 src/collect-io.c --- a/src/collect-io.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/collect-io.c Fri Apr 11 22:14:36 2008 +0000 @@ -240,7 +240,7 @@ /* setup loader and call it */ cd->thumb_info = ci; thumb_loader_free(cd->thumb_loader); - cd->thumb_loader = thumb_loader_new(thumb_max_width, thumb_max_height); + cd->thumb_loader = thumb_loader_new(options->thumb_max_width, options->thumb_max_height); thumb_loader_set_callbacks(cd->thumb_loader, collection_load_thumb_done_cb, collection_load_thumb_error_cb, diff -r 46169c246c51 -r b16b9b8979e5 src/collect-table.c --- a/src/collect-table.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/collect-table.c Fri Apr 11 22:14:36 2008 +0000 @@ -205,11 +205,11 @@ { gint width; - if (!ct->show_text) return thumb_max_width; - - width = thumb_max_width + thumb_max_width / 2; + if (!ct->show_text) return options->thumb_max_width; + + width = options->thumb_max_width + options->thumb_max_width / 2; if (width < THUMB_MIN_ICON_WIDTH) width = THUMB_MIN_ICON_WIDTH; - if (width > THUMB_MAX_ICON_WIDTH) width = thumb_max_width; + if (width > THUMB_MAX_ICON_WIDTH) width = options->thumb_max_width; return width; } @@ -366,7 +366,7 @@ ct->prev_selection = end; - if (!collection_rectangular_selection) + if (!options->collection_rectangular_selection) { GList *work; CollectInfo *info; @@ -988,8 +988,8 @@ adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(ct->listview)); page_size = (gint)adj->page_increment; - row_height = thumb_max_height + THUMB_BORDER_PADDING * 2; - if (ct->show_text) row_height += thumb_max_height / 3; + row_height = options->thumb_max_height + THUMB_BORDER_PADDING * 2; + if (ct->show_text) row_height += options->thumb_max_height / 3; ret = page_size / row_height; if (ret < 1) ret = 1; @@ -1100,7 +1100,7 @@ { if (event->state & GDK_SHIFT_MASK) { - if (!collection_rectangular_selection) + if (!options->collection_rectangular_selection) { collection_table_select_region_util(ct, old_info, new_info, FALSE); } @@ -1392,7 +1392,7 @@ else { GtkAdjustment *adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(ct->listview)); - widget_auto_scroll_start(ct->listview, adj, -1, thumb_max_height / 2, + widget_auto_scroll_start(ct->listview, adj, -1, options->thumb_max_height / 2, collection_table_auto_scroll_notify_cb, ct); } } @@ -1594,7 +1594,7 @@ if (cell && GQV_IS_CELL_RENDERER_ICON(cell)) { g_object_set(G_OBJECT(cell), "fixed_width", thumb_width, - "fixed_height", thumb_max_height, + "fixed_height", options->thumb_max_height, "show_text", ct->show_text, NULL); } } diff -r 46169c246c51 -r b16b9b8979e5 src/collect.c --- a/src/collect.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/collect.c Fri Apr 11 22:14:36 2008 +0000 @@ -1198,7 +1198,7 @@ GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE); - if (save_window_positions && path && collection_load_only_geometry(cw->cd, path)) + if (options->save_window_positions && path && collection_load_only_geometry(cw->cd, path)) { /* FIXME: x, y is not implemented */ gtk_window_set_default_size(GTK_WINDOW(cw->window), cw->cd->window_w, cw->cd->window_h); diff -r 46169c246c51 -r b16b9b8979e5 src/dupe.c --- a/src/dupe.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/dupe.c Fri Apr 11 22:14:36 2008 +0000 @@ -1168,7 +1168,7 @@ if (mask & DUPE_MATCH_SIM_HIGH) m = 0.95; else if (mask & DUPE_MATCH_SIM_MED) m = 0.90; - else if (mask & DUPE_MATCH_SIM_CUSTOM) m = (gdouble)dupe_custom_threshold / 100.0; + else if (mask & DUPE_MATCH_SIM_CUSTOM) m = (gdouble)options->dupe_custom_threshold / 100.0; else m = 0.85; if (fast) @@ -1327,7 +1327,7 @@ dw->thumb_item = di; thumb_loader_free(dw->thumb_loader); - dw->thumb_loader = thumb_loader_new(thumb_max_width, thumb_max_height); + dw->thumb_loader = thumb_loader_new(options->thumb_max_width, options->thumb_max_height); thumb_loader_set_callbacks(dw->thumb_loader, dupe_thumb_done_cb, @@ -1393,7 +1393,7 @@ di->width = gdk_pixbuf_get_width(pixbuf); di->height = gdk_pixbuf_get_height(pixbuf); } - if (enable_thumb_caching) + if (options->enable_thumb_caching) { dupe_item_write_cache(di); } @@ -1451,14 +1451,14 @@ dupe_window_update_progress(dw, _("Reading checksums..."), dw->setup_count == 0 ? 0.0 : (gdouble)(dw->setup_n - 1) / dw->setup_count, FALSE); - if (enable_thumb_caching) + if (options->enable_thumb_caching) { dupe_item_read_cache(di); if (di->md5sum) return TRUE; } di->md5sum = md5_text_from_file_utf8(di->fd->path, ""); - if (enable_thumb_caching) + if (options->enable_thumb_caching) { dupe_item_write_cache(di); } @@ -1484,14 +1484,14 @@ dupe_window_update_progress(dw, _("Reading dimensions..."), dw->setup_count == 0 ? 0.0 : (gdouble)(dw->setup_n - 1) / dw->setup_count, FALSE); - if (enable_thumb_caching) + if (options->enable_thumb_caching) { dupe_item_read_cache(di); if (di->width != 0 || di->height != 0) return TRUE; } image_load_dimensions(di->fd, &di->width, &di->height); - if (enable_thumb_caching) + if (options->enable_thumb_caching) { dupe_item_write_cache(di); } @@ -1518,7 +1518,7 @@ dupe_window_update_progress(dw, _("Reading similarity data..."), dw->setup_count == 0 ? 0.0 : (gdouble)dw->setup_n / dw->setup_count, FALSE); - if (enable_thumb_caching) + if (options->enable_thumb_caching) { dupe_item_read_cache(di); if (cache_sim_data_filled(di->simd)) @@ -2751,14 +2751,14 @@ column = gtk_tree_view_get_column(GTK_TREE_VIEW(listview), DUPE_COLUMN_THUMB - 1); if (!column) return; - gtk_tree_view_column_set_fixed_width(column, (thumb) ? thumb_max_width : 4); + gtk_tree_view_column_set_fixed_width(column, (thumb) ? options->thumb_max_width : 4); list = gtk_tree_view_column_get_cell_renderers(column); if (!list) return; cell = list->data; g_list_free(list); - g_object_set(G_OBJECT(cell), "height", (thumb) ? thumb_max_height : -1, NULL); + g_object_set(G_OBJECT(cell), "height", (thumb) ? options->thumb_max_height : -1, NULL); gtk_tree_view_columns_autosize(GTK_TREE_VIEW(listview)); } diff -r 46169c246c51 -r b16b9b8979e5 src/editors.c --- a/src/editors.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/editors.c Fri Apr 11 22:14:36 2008 +0000 @@ -100,10 +100,10 @@ for (i = 0; i < GQ_EDITOR_SLOTS; i++) { - g_free(editor_name[i]); - editor_name[i] = g_strdup(_(editor_slot_defaults[i * 2])); - g_free(editor_command[i]); - editor_command[i] = g_strdup(editor_slot_defaults[i * 2 + 1]); + g_free(options->editor_name[i]); + options->editor_name[i] = g_strdup(_(editor_slot_defaults[i * 2])); + g_free(options->editor_command[i]); + options->editor_command[i] = g_strdup(editor_slot_defaults[i * 2 + 1]); } } @@ -785,11 +785,11 @@ gint error; if (n < 0 || n >= GQ_EDITOR_SLOTS || !list || - !editor_command[n] || - strlen(editor_command[n]) == 0) return FALSE; + !options->editor_command[n] || + strlen(options->editor_command[n]) == 0) return FALSE; - command = g_locale_from_utf8(editor_command[n], -1, NULL, NULL, NULL); - error = editor_command_start(command, editor_name[n], list, cb, data); + command = g_locale_from_utf8(options->editor_command[n], -1, NULL, NULL, NULL); + error = editor_command_start(command, options->editor_name[n], list, cb, data); g_free(command); return error; } @@ -821,10 +821,10 @@ gint editor_window_flag_set(gint n) { if (n < 0 || n >= GQ_EDITOR_SLOTS || - !editor_command[n] || - strlen(editor_command[n]) == 0) return TRUE; + !options->editor_command[n] || + strlen(options->editor_command[n]) == 0) return TRUE; - return (editor_command_parse(editor_command[n], NULL, NULL) & EDITOR_KEEP_FS); + return (editor_command_parse(options->editor_command[n], NULL, NULL) & EDITOR_KEEP_FS); } diff -r 46169c246c51 -r b16b9b8979e5 src/filelist.c --- a/src/filelist.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/filelist.c Fri Apr 11 22:14:36 2008 +0000 @@ -318,7 +318,7 @@ GList *work; gint ln; - if (!extension_list || file_filter_disable) return TRUE; + if (!extension_list || options->file_filter_disable) return TRUE; ln = strlen(name); work = extension_list; @@ -423,7 +423,7 @@ { GList *work; - if (!is_dir_list && file_filter_disable && show_dot_files) return list; + if (!is_dir_list && options->file_filter_disable && options->show_dot_files) return list; work = list; while (work) @@ -433,7 +433,7 @@ base = filename_from_path(name); - if ((!show_dot_files && ishidden(base)) || + if ((!options->show_dot_files && ishidden(base)) || (!is_dir_list && !filter_name_exists(base)) || (is_dir_list && base[0] == '.' && (strcmp(base, GQ_CACHE_LOCAL_THUMB) == 0 || strcmp(base, GQ_CACHE_LOCAL_METADATA) == 0)) ) @@ -1220,7 +1220,7 @@ while ((dir = readdir(dp)) != NULL) { gchar *name = dir->d_name; - if (show_dot_files || !ishidden(name)) + if (options->show_dot_files || !ishidden(name)) { gchar *filepath = g_strconcat(pathl, "/", name, NULL); if ((follow_symlinks ? @@ -1349,7 +1349,7 @@ { GList *work; - if (!is_dir_list && file_filter_disable && show_dot_files) return list; + if (!is_dir_list && options->file_filter_disable && options->show_dot_files) return list; work = list; while (work) @@ -1357,7 +1357,7 @@ FileData *fd = (FileData *)(work->data); const gchar *name = fd->name; - if ((!show_dot_files && ishidden(name)) || + if ((!options->show_dot_files && ishidden(name)) || (!is_dir_list && !filter_name_exists(name)) || (is_dir_list && name[0] == '.' && (strcmp(name, GQ_CACHE_LOCAL_THUMB) == 0 || strcmp(name, GQ_CACHE_LOCAL_METADATA) == 0)) ) diff -r 46169c246c51 -r b16b9b8979e5 src/fullscreen.c --- a/src/fullscreen.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/fullscreen.c Fri Apr 11 22:14:36 2008 +0000 @@ -194,7 +194,7 @@ static gboolean fullscreen_saver_block_cb(gpointer data) { - if (fullscreen_disable_saver) + if (options->fullscreen_disable_saver) { fullscreen_saver_deactivate(); } @@ -234,8 +234,8 @@ fs->stop_func = stop_func; fs->stop_data = stop_data; - if (debug) printf("full screen requests screen %d\n", fullscreen_screen); - fullscreen_prefs_get_geometry(fullscreen_screen, window, &x, &y, &w, &h, + if (debug) printf("full screen requests screen %d\n", options->fullscreen_screen); + fullscreen_prefs_get_geometry(options->fullscreen_screen, window, &x, &y, &w, &h, &screen, &same); fs->window = window_new(GTK_WINDOW_TOPLEVEL, "fullscreen", NULL, NULL, _("Full screen")); @@ -243,14 +243,14 @@ /* this requests no decorations, if you still have them complain to the window manager author(s) */ gtk_window_set_decorated(GTK_WINDOW(fs->window), FALSE); - if (fullscreen_screen < 0) + if (options->fullscreen_screen < 0) { /* If we want control of the window size and position this is not what we want. * Geeqie needs control of which monitor(s) to use for full screen. */ gtk_window_fullscreen(GTK_WINDOW(fs->window)); } - else if (fullscreen_above) + else if (options->fullscreen_above) { /* request to be above other windows */ gtk_window_set_keep_above(GTK_WINDOW(fs->window), TRUE); @@ -289,15 +289,15 @@ gtk_container_add(GTK_CONTAINER(fs->window), fs->imd->widget); - if (user_specified_window_background) + if (options->user_specified_window_background) { - image_background_set_color(fs->imd, &window_background_color); + image_background_set_color(fs->imd, &options->window_background_color); } - image_set_delay_flip(fs->imd, fullscreen_clean_flip); + image_set_delay_flip(fs->imd, options->fullscreen_clean_flip); image_auto_refresh(fs->imd, fs->normal_imd->auto_refresh_interval); - if (fullscreen_clean_flip) + if (options->fullscreen_clean_flip) { image_set_update_func(fs->imd, fullscreen_image_update_cb, fs); image_set_complete_func(fs->imd, fullscreen_image_complete_cb, fs); diff -r 46169c246c51 -r b16b9b8979e5 src/globals.c --- a/src/globals.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/globals.c Fri Apr 11 22:14:36 2008 +0000 @@ -12,103 +12,109 @@ #include "main.h" +GList *filename_filter = NULL; -GList *filename_filter = NULL; +ConfOptions *init_options(ConfOptions *options) +{ + if (!options) options = g_new0(ConfOptions, 1); + + options->main_window_w = 500; + options->main_window_h = 400; + options->main_window_x = 0; + options->main_window_y = 0; + options->main_window_maximized = FALSE; + + options->float_window_w = 260; + options->float_window_h = 450; + options->float_window_x = 0; + options->float_window_y = 0; + options->float_window_divider = -1; + + options->window_hdivider_pos = -1; + options->window_vdivider_pos = 200; + + options->save_window_positions = FALSE; + options->tools_float = FALSE; + options->tools_hidden = FALSE; + options->toolbar_hidden = FALSE; + options->progressive_key_scrolling = FALSE; + + options->startup_path_enable = FALSE; + options->startup_path = NULL; + options->confirm_delete = TRUE; + options->enable_delete_key = TRUE; + options->safe_delete_enable = FALSE; + options->safe_delete_path = NULL; + options->safe_delete_size = 128; + options->restore_tool = FALSE; + options->zoom_mode = ZOOM_RESET_ORIGINAL; + options->two_pass_zoom = TRUE; + options->scroll_reset_method = SCROLL_RESET_TOPLEFT; + options->fit_window = FALSE; + options->limit_window_size = FALSE; + options->zoom_to_fit_expands = TRUE; + options->max_window_size = 100; + options->limit_autofit_size = FALSE; + options->max_autofit_size = 100; + options->thumb_max_width = DEFAULT_THUMB_WIDTH; + options->thumb_max_height = DEFAULT_THUMB_HEIGHT; + options->enable_thumb_caching = TRUE; + options->enable_thumb_dirs = FALSE; + options->use_xvpics_thumbnails = TRUE; + options->thumbnail_fast = TRUE; + options->thumbnail_spec_standard = TRUE; + options->enable_metadata_dirs = FALSE; + options->show_dot_files = FALSE; + options->file_filter_disable = FALSE; + + + options->thumbnails_enabled = FALSE; + options->file_sort_method = SORT_NAME; + options->file_sort_ascending = TRUE; + + options->slideshow_delay = 150; + options->slideshow_random = FALSE; + options->slideshow_repeat = FALSE; + + options->mousewheel_scrolls = FALSE; + options->enable_in_place_rename = TRUE; + + options->recent_list_max = 10; + + options->collection_rectangular_selection = FALSE; + + options->tile_cache_max = 10; + options->thumbnail_quality = (gint)GDK_INTERP_TILES; + options->zoom_quality = (gint)GDK_INTERP_BILINEAR; + options->dither_quality = (gint)GDK_RGB_DITHER_NORMAL; + + options->zoom_increment = 5; + + options->enable_read_ahead = TRUE; + + options->place_dialogs_under_mouse = FALSE; + + options->user_specified_window_background = FALSE; + memset(&options->window_background_color, 0, sizeof(options->window_background_color)); + + options->fullscreen_screen = -1; + options->fullscreen_clean_flip = FALSE; + options->fullscreen_disable_saver = TRUE; + options->fullscreen_above = FALSE; + options->show_fullscreen_info = TRUE; + options->fullscreen_info = NULL; + + options->dupe_custom_threshold = 99; + + return options; +} /* -- options -- */ -gint main_window_w = 500; -gint main_window_h = 400; -gint main_window_x = 0; -gint main_window_y = 0; -gint main_window_maximized = FALSE; - -gint float_window_w = 260; -gint float_window_h = 450; -gint float_window_x = 0; -gint float_window_y = 0; -gint float_window_divider = -1; - -gint window_hdivider_pos = -1; -gint window_vdivider_pos = 200; - -gint save_window_positions = FALSE; -gint tools_float = FALSE; -gint tools_hidden = FALSE; -gint toolbar_hidden = FALSE; -gint progressive_key_scrolling = FALSE; - -gint startup_path_enable = FALSE; -gchar *startup_path = NULL; -gint confirm_delete = TRUE; -gint enable_delete_key = TRUE; -gint safe_delete_enable = FALSE; -gchar *safe_delete_path = NULL; -gint safe_delete_size = 128; -gint restore_tool = FALSE; -gint zoom_mode = ZOOM_RESET_ORIGINAL; -gint two_pass_zoom = TRUE; -gint scroll_reset_method = SCROLL_RESET_TOPLEFT; -gint fit_window = FALSE; -gint limit_window_size = FALSE; -gint zoom_to_fit_expands = TRUE; -gint max_window_size = 100; -gint limit_autofit_size = FALSE; -gint max_autofit_size = 100; -gint thumb_max_width = DEFAULT_THUMB_WIDTH; -gint thumb_max_height = DEFAULT_THUMB_HEIGHT; -gint enable_thumb_caching = TRUE; -gint enable_thumb_dirs = FALSE; -gint use_xvpics_thumbnails = TRUE; -gint thumbnail_fast = TRUE; -gint thumbnail_spec_standard = TRUE; -gint enable_metadata_dirs = FALSE; -gint show_dot_files = FALSE; -gint file_filter_disable = FALSE; -gchar *editor_name[GQ_EDITOR_SLOTS]; -gchar *editor_command[GQ_EDITOR_SLOTS]; - -gint thumbnails_enabled = FALSE; -SortType file_sort_method = SORT_NAME; -gint file_sort_ascending = TRUE; - -gint slideshow_delay = 150; -gint slideshow_random = FALSE; -gint slideshow_repeat = FALSE; - -gint mousewheel_scrolls = FALSE; -gint enable_in_place_rename = TRUE; - -gint recent_list_max = 10; - -gint collection_rectangular_selection = FALSE; - -gint tile_cache_max = 10; -gint thumbnail_quality = (gint)GDK_INTERP_TILES; -gint zoom_quality = (gint)GDK_INTERP_BILINEAR; -gint dither_quality = (gint)GDK_RGB_DITHER_NORMAL; - -gint zoom_increment = 5; - -gint enable_read_ahead = TRUE; - -gint place_dialogs_under_mouse = FALSE; - -gint user_specified_window_background = FALSE; -GdkColor window_background_color = {0, 0, 0, 0}; - -gint fullscreen_screen = -1; -gint fullscreen_clean_flip = FALSE; -gint fullscreen_disable_saver = TRUE; -gint fullscreen_above = FALSE; -gint show_fullscreen_info = TRUE; -gchar *fullscreen_info = NULL; - -gint dupe_custom_threshold = 99; - #ifdef DEBUG gint debug = FALSE; #endif + /* layout */ gchar *layout_order = NULL; gint layout_style = 0; diff -r 46169c246c51 -r b16b9b8979e5 src/image-overlay.c --- a/src/image-overlay.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/image-overlay.c Fri Apr 11 22:14:36 2008 +0000 @@ -329,7 +329,7 @@ } else { - text = image_osd_mkinfo(fullscreen_info, imd, vars); + text = image_osd_mkinfo(options->fullscreen_info, imd, vars); } g_free(size); diff -r 46169c246c51 -r b16b9b8979e5 src/image.c --- a/src/image.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/image.c Fri Apr 11 22:14:36 2008 +0000 @@ -938,7 +938,7 @@ pixbuf = image_get_pixbuf(imd); - if (enable_read_ahead && imd->image_fd && pixbuf) + if (options->enable_read_ahead && imd->image_fd && pixbuf) { if (imd->il) { @@ -1090,7 +1090,7 @@ imd->title_right = g_strdup(title_right); imd->title_show_zoom = show_zoom; - if (!fit_window) window = NULL; + if (!options->fit_window) window = NULL; pixbuf_renderer_set_parent((PixbufRenderer *)imd->pr, (GtkWindow *)window); @@ -1663,7 +1663,7 @@ pixbuf_renderer_get_scaled_size((PixbufRenderer *)imd->pr, &width, &height); } - pb = gdk_pixbuf_scale_simple(pixbuf, width, height, (GdkInterpType)zoom_quality); + pb = gdk_pixbuf_scale_simple(pixbuf, width, height, (GdkInterpType)options->zoom_quality); gdk_pixbuf_render_pixmap_and_mask (pb, &pixmap, NULL, 128); gdk_window_set_back_pixmap(rootwindow, pixmap, FALSE); @@ -1715,17 +1715,17 @@ static void image_options_set(ImageWindow *imd) { - g_object_set(G_OBJECT(imd->pr), "zoom_quality", zoom_quality, - "zoom_2pass", two_pass_zoom, - "zoom_expand", zoom_to_fit_expands, - "dither_quality", dither_quality, - "scroll_reset", scroll_reset_method, - "cache_display", tile_cache_max, - "window_fit", (imd->top_window_sync && fit_window), - "window_limit", limit_window_size, - "window_limit_value", max_window_size, - "autofit_limit", limit_autofit_size, - "autofit_limit_value", max_autofit_size, + g_object_set(G_OBJECT(imd->pr), "zoom_quality", options->zoom_quality, + "zoom_2pass", options->two_pass_zoom, + "zoom_expand", options->zoom_to_fit_expands, + "dither_quality", options->dither_quality, + "scroll_reset", options->scroll_reset_method, + "cache_display", options->tile_cache_max, + "window_fit", (imd->top_window_sync && options->fit_window), + "window_limit", options->limit_window_size, + "window_limit_value", options->max_window_size, + "autofit_limit", options->limit_autofit_size, + "autofit_limit_value", options->max_autofit_size, NULL); diff -r 46169c246c51 -r b16b9b8979e5 src/img-view.c --- a/src/img-view.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/img-view.c Fri Apr 11 22:14:36 2008 +0000 @@ -112,7 +112,7 @@ if (next) { info = collection_next_by_info(cd, info); - if (enable_read_ahead) + if (options->enable_read_ahead) { read_ahead_info = collection_next_by_info(cd, info); if (!read_ahead_info) read_ahead_info = collection_prev_by_info(cd, info); @@ -121,7 +121,7 @@ else { info = collection_prev_by_info(cd, info); - if (enable_read_ahead) + if (options->enable_read_ahead) { read_ahead_info = collection_prev_by_info(cd, info); if (!read_ahead_info) read_ahead_info = collection_next_by_info(cd, info); @@ -130,7 +130,7 @@ if (info) { - image_change_from_collection(imd, cd, info, image_zoom_get_default(imd, zoom_mode)); + image_change_from_collection(imd, cd, info, image_zoom_get_default(imd, options->zoom_mode)); if (read_ahead_info) image_prebuffer_set(imd, read_ahead_info->fd); } @@ -151,17 +151,17 @@ if (last) { info = collection_get_last(cd); - if (enable_read_ahead) read_ahead_info = collection_prev_by_info(cd, info); + if (options->enable_read_ahead) read_ahead_info = collection_prev_by_info(cd, info); } else { info = collection_get_first(cd); - if (enable_read_ahead) read_ahead_info = collection_next_by_info(cd, info); + if (options->enable_read_ahead) read_ahead_info = collection_next_by_info(cd, info); } if (info) { - image_change_from_collection(imd, cd, info, image_zoom_get_default(imd, zoom_mode)); + image_change_from_collection(imd, cd, info, image_zoom_get_default(imd, options->zoom_mode)); if (read_ahead_info) image_prebuffer_set(imd, read_ahead_info->fd); } } @@ -221,9 +221,9 @@ vw->list_pointer = work; fd = work->data; - image_change_fd(imd, fd, image_zoom_get_default(imd, zoom_mode)); + image_change_fd(imd, fd, image_zoom_get_default(imd, options->zoom_mode)); - if (enable_read_ahead && work_ahead) + if (options->enable_read_ahead && work_ahead) { FileData *next_fd = work_ahead->data; image_prebuffer_set(imd, next_fd); @@ -252,9 +252,9 @@ vw->list_pointer = work; fd = work->data; - image_change_fd(imd, fd, image_zoom_get_default(imd, zoom_mode)); + image_change_fd(imd, fd, image_zoom_get_default(imd, options->zoom_mode)); - if (enable_read_ahead && work_ahead) + if (options->enable_read_ahead && work_ahead) { FileData *next_fd = work_ahead->data; image_prebuffer_set(imd, next_fd); @@ -557,7 +557,7 @@ image_alter(imd, ALTER_ROTATE_90_CC); break; case GDK_Delete: case GDK_KP_Delete: - if (enable_delete_key) + if (options->enable_delete_key) { file_util_delete(image_get_fd(imd), NULL, imd->widget); } @@ -635,7 +635,7 @@ break; } } - else if ( (state & GDK_SHIFT_MASK) != (mousewheel_scrolls)) + else if ( (state & GDK_SHIFT_MASK) != (options->mousewheel_scrolls)) { switch (direction) { @@ -855,7 +855,7 @@ vw->imd = image_new(FALSE); - image_background_set_color(vw->imd, user_specified_window_background ? &window_background_color : NULL); + image_background_set_color(vw->imd, options->user_specified_window_background ? &options->window_background_color : NULL); image_attach_window(vw->imd, vw->window, NULL, GQ_APPNAME, TRUE); @@ -877,8 +877,8 @@ G_CALLBACK(view_window_key_press_cb), vw); if (cd && info) { - image_change_from_collection(vw->imd, cd, info, image_zoom_get_default(NULL, zoom_mode)); - if (enable_read_ahead) + image_change_from_collection(vw->imd, cd, info, image_zoom_get_default(NULL, options->zoom_mode)); + if (options->enable_read_ahead) { CollectInfo * r_info = collection_next_by_info(cd, info); if (!r_info) r_info = collection_prev_by_info(cd, info); @@ -889,9 +889,9 @@ { view_window_set_list(vw, list); vw->list_pointer = vw->list; - image_change_fd(vw->imd, (FileData *)vw->list->data, image_zoom_get_default(NULL, zoom_mode)); + image_change_fd(vw->imd, (FileData *)vw->list->data, image_zoom_get_default(NULL, options->zoom_mode)); - if (enable_read_ahead) + if (options->enable_read_ahead) { GList *work = vw->list->next; if (work) image_prebuffer_set(vw->imd, (FileData *)work->data); @@ -899,7 +899,7 @@ } else { - image_change_fd(vw->imd, fd, image_zoom_get_default(NULL, zoom_mode)); + image_change_fd(vw->imd, fd, image_zoom_get_default(NULL, options->zoom_mode)); } if (image_zoom_get(vw->imd) == 0.0) @@ -910,10 +910,10 @@ { pixbuf_renderer_get_scaled_size(PIXBUF_RENDERER(vw->imd->pr), &w, &h); } - if (limit_window_size) + if (options->limit_window_size) { - gint mw = gdk_screen_width() * max_window_size / 100; - gint mh = gdk_screen_height() * max_window_size / 100; + gint mw = gdk_screen_width() * options->max_window_size / 100; + gint mh = gdk_screen_height() * options->max_window_size / 100; if (w > mw) w = mw; if (h > mh) h = mh; @@ -1011,7 +1011,7 @@ ViewWindow *vw = work->data; work = work->next; - image_background_set_color(vw->imd, user_specified_window_background ? &window_background_color : NULL); + image_background_set_color(vw->imd, options->user_specified_window_background ? &options->window_background_color : NULL); } } @@ -1351,10 +1351,10 @@ vw->list_pointer = vw->list; fd = vw->list->data; - image_change_fd(vw->imd, fd, image_zoom_get_default(vw->imd, zoom_mode)); + image_change_fd(vw->imd, fd, image_zoom_get_default(vw->imd, options->zoom_mode)); work = vw->list->next; - if (enable_read_ahead && work) + if (options->enable_read_ahead && work) { fd = work->data; image_prebuffer_set(vw->imd, fd); @@ -1362,7 +1362,7 @@ } else { - image_change_fd(vw->imd, NULL, image_zoom_get_default(vw->imd, zoom_mode)); + image_change_fd(vw->imd, NULL, image_zoom_get_default(vw->imd, options->zoom_mode)); } } @@ -1481,7 +1481,7 @@ if (source && info_list) { - image_change_from_collection(imd, source, info_list->data, image_zoom_get_default(imd, zoom_mode)); + image_change_from_collection(imd, source, info_list->data, image_zoom_get_default(imd, options->zoom_mode)); } else { @@ -1492,7 +1492,7 @@ vw->list_pointer = vw->list; } - image_change_fd(imd, fd, image_zoom_get_default(imd, zoom_mode)); + image_change_fd(imd, fd, image_zoom_get_default(imd, options->zoom_mode)); } } } @@ -1598,7 +1598,7 @@ } if (image_get_fd(imd) == image_fd) { - image_change_fd(imd, NULL, image_zoom_get_default(imd, zoom_mode)); + image_change_fd(imd, NULL, image_zoom_get_default(imd, options->zoom_mode)); } } @@ -1644,7 +1644,7 @@ fd = NULL; } - image_change_fd(imd, fd, image_zoom_get_default(imd, zoom_mode)); + image_change_fd(imd, fd, image_zoom_get_default(imd, options->zoom_mode)); } } diff -r 46169c246c51 -r b16b9b8979e5 src/layout.c --- a/src/layout.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/layout.c Fri Apr 11 22:14:36 2008 +0000 @@ -1258,8 +1258,8 @@ static void layout_tools_geometry_sync(LayoutWindow *lw) { - layout_geometry_get_tools(lw, &float_window_x, &float_window_x, - &float_window_w, &float_window_h, &lw->div_float); + layout_geometry_get_tools(lw, &options->float_window_x, &options->float_window_x, + &options->float_window_w, &options->float_window_h, &lw->div_float); } static void layout_tools_hide(LayoutWindow *lw, gint hide) @@ -1322,7 +1322,7 @@ G_CALLBACK(layout_tools_delete_cb), lw); layout_keyboard_init(lw, lw->tools); - if (save_window_positions) + if (options->save_window_positions) { hints = GDK_HINT_USER_POS; } @@ -1378,10 +1378,10 @@ if (new_window) { - if (save_window_positions) + if (options->save_window_positions) { - gtk_window_set_default_size(GTK_WINDOW(lw->tools), float_window_w, float_window_h); - gtk_window_move(GTK_WINDOW(lw->tools), float_window_x, float_window_y); + gtk_window_set_default_size(GTK_WINDOW(lw->tools), options->float_window_w, options->float_window_h); + gtk_window_move(GTK_WINDOW(lw->tools), options->float_window_x, options->float_window_y); } else { @@ -1398,7 +1398,7 @@ } } - if (!save_window_positions) + if (!options->save_window_positions) { if (vertical) { @@ -1719,7 +1719,7 @@ work = work->next; if (!lw->image) continue; - image_background_set_color(lw->image, user_specified_window_background ? &window_background_color : NULL); + image_background_set_color(lw->image, options->user_specified_window_background ? &options->window_background_color : NULL); } } @@ -1879,14 +1879,14 @@ lw = g_new0(LayoutWindow, 1); - lw->thumbs_enabled = thumbnails_enabled; + lw->thumbs_enabled = options->thumbnails_enabled; lw->sort_method = SORT_NAME; lw->sort_ascend = TRUE; lw->tools_float = popped; lw->tools_hidden = hidden; - lw->toolbar_hidden = toolbar_hidden; + lw->toolbar_hidden = options->toolbar_hidden; lw->utility_box = NULL; lw->bar_sort = NULL; @@ -1907,11 +1907,11 @@ /* divider positions */ - if (save_window_positions) + if (options->save_window_positions) { - lw->div_h = window_hdivider_pos; - lw->div_v = window_vdivider_pos; - lw->div_float = float_window_divider; + lw->div_h = options->window_hdivider_pos; + lw->div_v = options->window_vdivider_pos; + lw->div_float = options->float_window_divider; } else { @@ -1926,7 +1926,7 @@ gtk_window_set_resizable(GTK_WINDOW(lw->window), TRUE); gtk_container_set_border_width(GTK_CONTAINER(lw->window), 0); - if (save_window_positions) + if (options->save_window_positions) { hint_mask = GDK_HINT_USER_POS; } @@ -1942,13 +1942,13 @@ gtk_window_set_geometry_hints(GTK_WINDOW(lw->window), NULL, &hint, GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hint_mask); - if (save_window_positions) + if (options->save_window_positions) { - gtk_window_set_default_size(GTK_WINDOW(lw->window), main_window_w, main_window_h); + gtk_window_set_default_size(GTK_WINDOW(lw->window), options->main_window_w, options->main_window_h); if (!layout_window_list) { - gtk_window_move(GTK_WINDOW(lw->window), main_window_x, main_window_y); - if (main_window_maximized) gtk_window_maximize(GTK_WINDOW(lw->window)); + gtk_window_move(GTK_WINDOW(lw->window), options->main_window_x, options->main_window_y); + if (options->main_window_maximized) gtk_window_maximize(GTK_WINDOW(lw->window)); } } else diff -r 46169c246c51 -r b16b9b8979e5 src/layout_image.c --- a/src/layout_image.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/layout_image.c Fri Apr 11 22:14:36 2008 +0000 @@ -1111,7 +1111,7 @@ image_get_scroll_center(lw->image, &sx, &sy); - image_change_fd(lw->image, fd, image_zoom_get_default(lw->image, zoom_mode)); + image_change_fd(lw->image, fd, image_zoom_get_default(lw->image, options->zoom_mode)); image_set_scroll_center(lw->image, sx, sy); @@ -1135,7 +1135,7 @@ } */ layout_image_set_fd(lw, fd); - if (enable_read_ahead) image_prebuffer_set(lw->image, read_ahead_fd); + if (options->enable_read_ahead) image_prebuffer_set(lw->image, read_ahead_fd); } void layout_image_set_index(LayoutWindow *lw, gint index) @@ -1203,8 +1203,8 @@ { if (!layout_valid(&lw)) return; - image_change_from_collection(lw->image, cd, info, image_zoom_get_default(lw->image, zoom_mode)); - if (enable_read_ahead) + image_change_from_collection(lw->image, cd, info, image_zoom_get_default(lw->image, options->zoom_mode)); + if (options->enable_read_ahead) { CollectInfo *r_info; if (forward) @@ -1556,7 +1556,7 @@ break; } } - else if ( (state & GDK_SHIFT_MASK) != (mousewheel_scrolls)) + else if ( (state & GDK_SHIFT_MASK) != (options->mousewheel_scrolls)) { switch (direction) { @@ -1698,7 +1698,7 @@ gtk_widget_ref(lw->split_images[i]->widget); - image_background_set_color(lw->split_images[i], user_specified_window_background ? &window_background_color : NULL); + image_background_set_color(lw->split_images[i], options->user_specified_window_background ? &options->window_background_color : NULL); image_auto_refresh(lw->split_images[i], 0); diff -r 46169c246c51 -r b16b9b8979e5 src/layout_util.c --- a/src/layout_util.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/layout_util.c Fri Apr 11 22:14:36 2008 +0000 @@ -190,7 +190,7 @@ layout_image_next(lw); break; case GDK_Delete: case GDK_KP_Delete: - if (enable_delete_key) + if (options->enable_delete_key) { file_util_delete(NULL, layout_selection_list(lw), widget); } @@ -255,7 +255,7 @@ layout_image_full_screen_stop(lw); nw = layout_new(NULL, FALSE, FALSE); - layout_sort_set(nw, file_sort_method, file_sort_ascending); + layout_sort_set(nw, options->file_sort_method, options->file_sort_ascending); layout_set_path(nw, layout_get_path(lw)); } @@ -916,13 +916,13 @@ action = gtk_action_group_get_action(lw->action_group, key); g_object_set_data(G_OBJECT(action), "edit_index", GINT_TO_POINTER(i)); - if (editor_command[i] && strlen(editor_command[i]) > 0) + if (options->editor_command[i] && strlen(options->editor_command[i]) > 0) { gchar *text; - if (editor_name[i] && strlen(editor_name[i]) > 0) + if (options->editor_name[i] && strlen(options->editor_name[i]) > 0) { - text = g_strdup_printf(_("in %s..."), editor_name[i]); + text = g_strdup_printf(_("in %s..."), options->editor_name[i]); } else { @@ -1031,7 +1031,7 @@ { if (!path) return; - history_list_add_to_key("recent", path, recent_list_max); + history_list_add_to_key("recent", path, options->recent_list_max); layout_recent_update_all(); } diff -r 46169c246c51 -r b16b9b8979e5 src/main.c --- a/src/main.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/main.c Fri Apr 11 22:14:36 2008 +0000 @@ -113,7 +113,7 @@ gdouble get_zoom_increment(void) { - return ((zoom_increment != 0) ? (gdouble)zoom_increment / 10.0 : 1.0); + return ((options->zoom_increment != 0) ? (gdouble)options->zoom_increment / 10.0 : 1.0); } /* @@ -296,7 +296,7 @@ return; } - if (progressive_key_scrolling) + if (options->progressive_key_scrolling) { guint32 time_diff; @@ -403,7 +403,7 @@ return; } - slideshow_delay = (gint)(n * 10.0 + 0.01); + options->slideshow_delay = (gint)(n * 10.0 + 0.01); } static void gr_tools_show(const gchar *text, gpointer data) @@ -962,15 +962,15 @@ else if (strcmp(cmd_line, "+t") == 0 || strcmp(cmd_line, "--with-tools") == 0) { - tools_float = FALSE; - tools_hidden = FALSE; + options->tools_float = FALSE; + options->tools_hidden = FALSE; remote_list = g_list_append(remote_list, "+t"); } else if (strcmp(cmd_line, "-t") == 0 || strcmp(cmd_line, "--without-tools") == 0) { - tools_hidden = TRUE; + options->tools_hidden = TRUE; remote_list = g_list_append(remote_list, "-t"); } @@ -1155,8 +1155,8 @@ for (i = 0; i < GQ_EDITOR_SLOTS; i++) { - editor_name[i] = NULL; - editor_command[i] = NULL; + options->editor_name[i] = NULL; + options->editor_command[i] = NULL; } editor_reset_defaults(); @@ -1169,8 +1169,8 @@ bookmark_add_default(_("Collections"), path); g_free(path); - g_free(safe_delete_path); - safe_delete_path = concat_dir_and_file(homedir(), GQ_RC_DIR_TRASH); + g_free(options->safe_delete_path); + options->safe_delete_path = concat_dir_and_file(homedir(), GQ_RC_DIR_TRASH); for (i = 0; i < COLOR_PROFILE_INPUTS; i++) { @@ -1178,7 +1178,7 @@ color_profile_input_name[i] = NULL; } - fullscreen_info = g_strdup("%collection%(%number%/%total%) %name%\n" + options->fullscreen_info = g_strdup("%collection%(%number%/%total%) %name%\n" "%res%|%date%|%size%\n" "%fAperture%|%fShutterSpeed%|%fISOSpeedRating%|%fFocalLength%|%fExposureBias%\n" "%fCamera%|%fFlash%"); @@ -1198,26 +1198,26 @@ if (layout_valid(&lw)) { - main_window_maximized = window_maximized(lw->window); - if (!main_window_maximized) + options->main_window_maximized = window_maximized(lw->window); + if (!options->main_window_maximized) { - layout_geometry_get(NULL, &main_window_x, &main_window_y, - &main_window_w, &main_window_h); + layout_geometry_get(NULL, &options->main_window_x, &options->main_window_y, + &options->main_window_w, &options->main_window_h); } - show_fullscreen_info = image_osd_get(lw->image, NULL, NULL); + options->show_fullscreen_info = image_osd_get(lw->image, NULL, NULL); } - layout_geometry_get_dividers(NULL, &window_hdivider_pos, &window_vdivider_pos); + layout_geometry_get_dividers(NULL, &options->window_hdivider_pos, &options->window_vdivider_pos); layout_views_get(NULL, &layout_view_tree, &layout_view_icons); - thumbnails_enabled = layout_thumb_get(NULL); - layout_sort_get(NULL, &file_sort_method, &file_sort_ascending); + options->thumbnails_enabled = layout_thumb_get(NULL); + layout_sort_get(NULL, &options->file_sort_method, &options->file_sort_ascending); - layout_geometry_get_tools(NULL, &float_window_x, &float_window_y, - &float_window_w, &float_window_h, &float_window_divider); - layout_tools_float_get(NULL, &tools_float, &tools_hidden); - toolbar_hidden = layout_toolbar_hidden(NULL); + layout_geometry_get_tools(NULL, &options->float_window_x, &options->float_window_y, + &options->float_window_w, &options->float_window_h, &options->float_window_divider); + layout_tools_float_get(NULL, &options->tools_float, &options->tools_hidden); + options->toolbar_hidden = layout_toolbar_hidden(NULL); color_profile_enabled = layout_image_color_profile_get_use(NULL); layout_image_color_profile_get(NULL, @@ -1322,7 +1322,7 @@ #if 1 printf("%s %s, This is an alpha release.\n", GQ_APPNAME, VERSION); #endif - + options = init_options(NULL); layout_order = g_strdup("123"); setup_default_options(); load_options(); @@ -1383,17 +1383,17 @@ { path = g_strdup(cmd_path); } - else if (startup_path_enable && startup_path && isdir(startup_path)) + else if (options->startup_path_enable && options->startup_path && isdir(options->startup_path)) { - path = g_strdup(startup_path); + path = g_strdup(options->startup_path); } else { path = get_current_dir(); } - lw = layout_new_with_geometry(NULL, tools_float, tools_hidden, geometry); - layout_sort_set(lw, file_sort_method, file_sort_ascending); + lw = layout_new_with_geometry(NULL, options->tools_float, options->tools_hidden, geometry); + layout_sort_set(lw, options->file_sort_method, options->file_sort_ascending); if (collection_list && !startup_command_line_collection) { @@ -1478,7 +1478,7 @@ collection_get_first(first_collection)); } } - image_osd_set(lw->image, FALSE, show_fullscreen_info); + image_osd_set(lw->image, FALSE, options->show_fullscreen_info); g_free(geometry); g_free(cmd_path); diff -r 46169c246c51 -r b16b9b8979e5 src/main.h --- a/src/main.h Fri Apr 11 20:35:37 2008 +0000 +++ b/src/main.h Fri Apr 11 22:14:36 2008 +0000 @@ -108,6 +108,9 @@ * globals *---------------------------------------------------------------------------- */ +ConfOptions *init_options(ConfOptions *options); /* TODO: move to globals.h */ + +ConfOptions *options; /* * Since globals are used everywhere, @@ -117,98 +120,12 @@ extern GList *filename_filter; /* -- options -- */ -extern gint main_window_w; -extern gint main_window_h; -extern gint main_window_x; -extern gint main_window_y; -extern gint main_window_maximized; -extern gint float_window_w; -extern gint float_window_h; -extern gint float_window_x; -extern gint float_window_y; -extern gint float_window_divider; - -extern gint window_hdivider_pos; -extern gint window_vdivider_pos; - -extern gint save_window_positions; -extern gint tools_float; -extern gint tools_hidden; -extern gint toolbar_hidden; -extern gint progressive_key_scrolling; - -extern gint startup_path_enable; -extern gchar *startup_path; -extern gint confirm_delete; -extern gint enable_delete_key; -extern gint safe_delete_enable; -extern gchar *safe_delete_path; -extern gint safe_delete_size; -extern gint restore_tool; -extern gint zoom_mode; -extern gint two_pass_zoom; -extern gint scroll_reset_method; -extern gint fit_window; -extern gint limit_window_size; -extern gint zoom_to_fit_expands; -extern gint max_window_size; -extern gint limit_autofit_size; -extern gint max_autofit_size; -extern gint thumb_max_width; -extern gint thumb_max_height; -extern gint enable_thumb_caching; -extern gint enable_thumb_dirs; -extern gint thumbnail_fast; -extern gint use_xvpics_thumbnails; -extern gint thumbnail_spec_standard; -extern gint enable_metadata_dirs; -extern gint show_dot_files; -extern gint file_filter_disable; -extern gchar *editor_name[]; -extern gchar *editor_command[]; - -extern gint thumbnails_enabled; -extern SortType file_sort_method; -extern gint file_sort_ascending; - -extern gint slideshow_delay; /* in tenths of a second */ -extern gint slideshow_random; -extern gint slideshow_repeat; - -extern gint mousewheel_scrolls; -extern gint enable_in_place_rename; - -extern gint user_specified_window_background; -extern GdkColor window_background_color; - -extern gint fullscreen_screen; -extern gint fullscreen_clean_flip; -extern gint fullscreen_disable_saver; -extern gint fullscreen_above; -extern gint show_fullscreen_info; -extern gchar *fullscreen_info; - -extern gint dupe_custom_threshold; #ifdef DEBUG extern gint debug; #endif -extern gint recent_list_max; - -extern gint collection_rectangular_selection; - -extern gint tile_cache_max; /* in megabytes */ -extern gint thumbnail_quality; -extern gint zoom_quality; -extern gint dither_quality; - -extern gint zoom_increment; /* 10 is 1.0, 5 is 0.05, 20 is 2.0, etc. */ - -extern gint enable_read_ahead; - -extern gint place_dialogs_under_mouse; /* layout */ extern gchar *layout_order; diff -r 46169c246c51 -r b16b9b8979e5 src/menu.c --- a/src/menu.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/menu.c Fri Apr 11 22:14:36 2008 +0000 @@ -67,11 +67,11 @@ gint i; for (i = 0; i < GQ_EDITOR_SLOTS; i++) { - if (editor_command[i] && strlen(editor_command[i]) > 0) + if (options->editor_command[i] && strlen(options->editor_command[i]) > 0) { gchar *text; - if (editor_name[i] && strlen(editor_name[i]) > 0) - text = g_strdup_printf(_("in %s..."), editor_name[i]); + if (options->editor_name[i] && strlen(options->editor_name[i]) > 0) + text = g_strdup_printf(_("in %s..."), options->editor_name[i]); else text = g_strdup(_("in (unknown)...")); if (accel_grp) diff -r 46169c246c51 -r b16b9b8979e5 src/pan-view.c --- a/src/pan-view.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/pan-view.c Fri Apr 11 22:14:36 2008 +0000 @@ -131,7 +131,7 @@ tmp = pi->pixbuf; pi->pixbuf = gdk_pixbuf_scale_simple(tmp, pi->width, pi->height, - (GdkInterpType)zoom_quality); + (GdkInterpType)options->zoom_quality); g_object_unref(tmp); } @@ -2566,8 +2566,8 @@ return TRUE; } - if (enable_thumb_caching && - thumbnail_spec_standard) return FALSE; + if (options->enable_thumb_caching && + options->thumbnail_spec_standard) return FALSE; if (!pref_list_int_get(PAN_PREF_GROUP, PAN_PREF_HIDE_WARNING, &hide_dlg)) hide_dlg = FALSE; if (hide_dlg) return FALSE; @@ -2589,9 +2589,9 @@ group = pref_box_new(group, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); ct_button = pref_checkbox_new_int(group, _("Cache thumbnails"), - enable_thumb_caching, &enable_thumb_caching); + options->enable_thumb_caching, &options->enable_thumb_caching); button = pref_checkbox_new_int(group, _("Use shared thumbnail cache"), - thumbnail_spec_standard, &thumbnail_spec_standard); + options->thumbnail_spec_standard, &options->thumbnail_spec_standard); pref_checkbox_link_sensitivity(ct_button, button); pref_line(box, 0); diff -r 46169c246c51 -r b16b9b8979e5 src/preferences.c --- a/src/preferences.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/preferences.c Fri Apr 11 22:14:36 2008 +0000 @@ -70,65 +70,9 @@ }; /* config memory values */ -static gint startup_path_enable_c; -static gint confirm_delete_c; -static gint enable_delete_key_c; -static gint safe_delete_enable_c; -static gint safe_delete_size_c; -static gint restore_tool_c; -static gint save_window_positions_c; -static gint zoom_mode_c; -static gint two_pass_zoom_c; -static gint fit_window_c; -static gint limit_window_size_c; -static gint zoom_to_fit_expands_c; -static gint max_window_size_c; -static gint limit_autofit_size_c; -static gint max_autofit_size_c; -static gint progressive_key_scrolling_c; -static gint thumb_max_width_c; -static gint thumb_max_height_c; -static gint enable_thumb_caching_c; -static gint enable_thumb_dirs_c; -static gint thumbnail_fast_c; -#if 0 -static gint use_xvpics_thumbnails_c; -#endif -static gint thumbnail_spec_standard_c; -static gint enable_metadata_dirs_c; -static gint show_dot_files_c; -static gint file_filter_disable_c; -static gint file_sort_case_sensitive_c; -static gint slideshow_delay_c; -static gint slideshow_random_c; -static gint slideshow_repeat_c; +static ConfOptions *options_c = NULL; -static gint mousewheel_scrolls_c; - -static gint enable_in_place_rename_c; - -static gint collection_rectangular_selection_c; - -static gint tile_cache_max_c; - -static gint thumbnail_quality_c; -static gint zoom_quality_c; - -static gint zoom_increment_c; - -static gint enable_read_ahead_c; - -static gint user_specified_window_background_c; -static GdkColor window_background_color_c; - -static gint fullscreen_screen_c; -static gint fullscreen_clean_flip_c; -static gint fullscreen_disable_saver_c; -static gint fullscreen_above_c; -static gint show_fullscreen_info_c; -static gchar *fullscreen_info_c = NULL; - -static gint dupe_custom_threshold_c; +static int file_sort_case_sensitive_c; #ifdef DEBUG static gint debug_c; @@ -173,29 +117,29 @@ static void zoom_mode_original_cb(GtkWidget *widget, gpointer data) { if (GTK_TOGGLE_BUTTON (widget)->active) - zoom_mode_c = ZOOM_RESET_ORIGINAL; + options_c->zoom_mode = ZOOM_RESET_ORIGINAL; } static void zoom_mode_fit_cb(GtkWidget *widget, gpointer data) { if (GTK_TOGGLE_BUTTON (widget)->active) - zoom_mode_c = ZOOM_RESET_FIT_WINDOW; + options_c->zoom_mode = ZOOM_RESET_FIT_WINDOW; } static void zoom_mode_none_cb(GtkWidget *widget, gpointer data) { if (GTK_TOGGLE_BUTTON (widget)->active) - zoom_mode_c = ZOOM_RESET_NONE; + options_c->zoom_mode = ZOOM_RESET_NONE; } static void zoom_increment_cb(GtkWidget *spin, gpointer data) { - zoom_increment_c = (gint)(gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin)) * 10.0 + 0.01); + options_c->zoom_increment = (gint)(gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin)) * 10.0 + 0.01); } static void slideshow_delay_cb(GtkWidget *spin, gpointer data) { - slideshow_delay_c = (gint)(gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin)) * + options_c->slideshow_delay = (gint)(gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin)) * (double)SLIDESHOW_SUBSECOND_PRECISION + 0.01); } @@ -217,108 +161,108 @@ { if (i < GQ_EDITOR_GENERIC_SLOTS) { - g_free(editor_name[i]); - editor_name[i] = NULL; + g_free(options->editor_name[i]); + options->editor_name[i] = NULL; buf = gtk_entry_get_text(GTK_ENTRY(editor_name_entry[i])); - if (buf && strlen(buf) > 0) editor_name[i] = g_strdup(buf); + if (buf && strlen(buf) > 0) options->editor_name[i] = g_strdup(buf); } - g_free(editor_command[i]); - editor_command[i] = NULL; + g_free(options->editor_command[i]); + options->editor_command[i] = NULL; buf = gtk_entry_get_text(GTK_ENTRY(editor_command_entry[i])); - if (buf && strlen(buf) > 0) editor_command[i] = g_strdup(buf); + if (buf && strlen(buf) > 0) options->editor_command[i] = g_strdup(buf); } layout_edit_update_all(); - g_free(startup_path); - startup_path = NULL; + g_free(options->startup_path); + options->startup_path = NULL; buf = gtk_entry_get_text(GTK_ENTRY(startup_path_entry)); - if (buf && strlen(buf) > 0) startup_path = remove_trailing_slash(buf); + if (buf && strlen(buf) > 0) options->startup_path = remove_trailing_slash(buf); - g_free(safe_delete_path); - safe_delete_path = NULL; + g_free(options->safe_delete_path); + options->safe_delete_path = NULL; buf = gtk_entry_get_text(GTK_ENTRY(safe_delete_path_entry)); - if (buf && strlen(buf) > 0) safe_delete_path = remove_trailing_slash(buf); + if (buf && strlen(buf) > 0) options->safe_delete_path = remove_trailing_slash(buf); - if (show_dot_files != show_dot_files_c) refresh = TRUE; + if (options->show_dot_files != options_c->show_dot_files) refresh = TRUE; if (file_sort_case_sensitive != file_sort_case_sensitive_c) refresh = TRUE; - if (file_filter_disable != file_filter_disable_c) refresh = TRUE; + if (options->file_filter_disable != options_c->file_filter_disable) refresh = TRUE; - startup_path_enable = startup_path_enable_c; - confirm_delete = confirm_delete_c; - enable_delete_key = enable_delete_key_c; - safe_delete_enable = safe_delete_enable_c; - safe_delete_size = safe_delete_size_c; - restore_tool = restore_tool_c; - save_window_positions = save_window_positions_c; - zoom_mode = zoom_mode_c; - two_pass_zoom = two_pass_zoom_c; - fit_window = fit_window_c; - limit_window_size = limit_window_size_c; - zoom_to_fit_expands = zoom_to_fit_expands_c; - max_window_size = max_window_size_c; - limit_autofit_size = limit_autofit_size_c; - max_autofit_size = max_autofit_size_c; - progressive_key_scrolling = progressive_key_scrolling_c; - thumb_max_width = thumb_max_width_c; - thumb_max_height = thumb_max_height_c; - enable_thumb_caching = enable_thumb_caching_c; - enable_thumb_dirs = enable_thumb_dirs_c; - thumbnail_fast = thumbnail_fast_c; + options->startup_path_enable = options_c->startup_path_enable; + options->confirm_delete = options_c->confirm_delete; + options->enable_delete_key = options_c->enable_delete_key; + options->safe_delete_enable = options_c->safe_delete_enable; + options->safe_delete_size = options_c->safe_delete_size; + options->restore_tool = options_c->restore_tool; + options->save_window_positions = options_c->save_window_positions; + options->zoom_mode = options_c->zoom_mode; + options->two_pass_zoom = options_c->two_pass_zoom; + options->fit_window = options_c->fit_window; + options->limit_window_size = options_c->limit_window_size; + options->zoom_to_fit_expands = options_c->zoom_to_fit_expands; + options->max_window_size = options_c->max_window_size; + options->limit_autofit_size = options_c->limit_autofit_size; + options->max_autofit_size = options_c->max_autofit_size; + options->progressive_key_scrolling = options_c->progressive_key_scrolling; + options->thumb_max_width = options_c->thumb_max_width; + options->thumb_max_height = options_c->thumb_max_height; + options->enable_thumb_caching = options_c->enable_thumb_caching; + options->enable_thumb_dirs = options_c->enable_thumb_dirs; + options->thumbnail_fast = options_c->thumbnail_fast; #if 0 - use_xvpics_thumbnails = use_xvpics_thumbnails_c; + options->use_xvpics_thumbnails = options_c->use_xvpics_thumbnails; #endif - thumbnail_spec_standard = thumbnail_spec_standard_c; - enable_metadata_dirs = enable_metadata_dirs_c; - show_dot_files = show_dot_files_c; + options->thumbnail_spec_standard = options_c->thumbnail_spec_standard; + options->enable_metadata_dirs = options_c->enable_metadata_dirs; + options->show_dot_files = options_c->show_dot_files; file_sort_case_sensitive = file_sort_case_sensitive_c; - file_filter_disable = file_filter_disable_c; + options->file_filter_disable = options_c->file_filter_disable; sidecar_ext_parse(gtk_entry_get_text(GTK_ENTRY(sidecar_ext_entry)), FALSE); - slideshow_random = slideshow_random_c; - slideshow_repeat = slideshow_repeat_c; - slideshow_delay = slideshow_delay_c; + options->slideshow_random = options_c->slideshow_random; + options->slideshow_repeat = options_c->slideshow_repeat; + options->slideshow_delay = options_c->slideshow_delay; - mousewheel_scrolls = mousewheel_scrolls_c; + options->mousewheel_scrolls = options_c->mousewheel_scrolls; - enable_in_place_rename = enable_in_place_rename_c; + options->enable_in_place_rename = options_c->enable_in_place_rename; - collection_rectangular_selection = collection_rectangular_selection_c; + options->collection_rectangular_selection = options_c->collection_rectangular_selection; - tile_cache_max = tile_cache_max_c; + options->tile_cache_max = options_c->tile_cache_max; - thumbnail_quality = thumbnail_quality_c; - zoom_quality = zoom_quality_c; + options->thumbnail_quality = options_c->thumbnail_quality; + options->zoom_quality = options_c->zoom_quality; - zoom_increment = zoom_increment_c; + options->zoom_increment = options_c->zoom_increment; - enable_read_ahead = enable_read_ahead_c; + options->enable_read_ahead = options_c->enable_read_ahead; - if (user_specified_window_background != user_specified_window_background_c - || !gdk_color_equal(&window_background_color, &window_background_color_c)) + if (options->user_specified_window_background != options_c->user_specified_window_background + || !gdk_color_equal(&options->window_background_color, &options_c->window_background_color)) { - user_specified_window_background = user_specified_window_background_c; - window_background_color = window_background_color_c; + options->user_specified_window_background = options_c->user_specified_window_background; + options->window_background_color = options_c->window_background_color; layout_colors_update(); view_window_colors_update(); } - fullscreen_screen = fullscreen_screen_c; - fullscreen_clean_flip = fullscreen_clean_flip_c; - fullscreen_disable_saver = fullscreen_disable_saver_c; - fullscreen_above = fullscreen_above_c; - show_fullscreen_info = show_fullscreen_info_c; - if (fullscreen_info_c) + options->fullscreen_screen = options_c->fullscreen_screen; + options->fullscreen_clean_flip = options_c->fullscreen_clean_flip; + options->fullscreen_disable_saver = options_c->fullscreen_disable_saver; + options->fullscreen_above = options_c->fullscreen_above; + options->show_fullscreen_info = options_c->show_fullscreen_info; + if (options_c->fullscreen_info) { - g_free(fullscreen_info); - fullscreen_info = g_strdup(fullscreen_info_c); + g_free(options->fullscreen_info); + options->fullscreen_info = g_strdup(options_c->fullscreen_info); } update_on_time_change = update_on_time_change_c; exif_rotate_enable = exif_rotate_enable_c; - dupe_custom_threshold = dupe_custom_threshold_c; + options->dupe_custom_threshold = options_c->dupe_custom_threshold; tree_descend_subdirs = tree_descend_subdirs_c; #ifdef DEBUG @@ -537,13 +481,13 @@ if (n >= 0 && n < sizeof(thumb_size_list) / sizeof(ThumbSize)) { - thumb_max_width_c = thumb_size_list[n].w; - thumb_max_height_c = thumb_size_list[n].h; + options_c->thumb_max_width = thumb_size_list[n].w; + options_c->thumb_max_height = thumb_size_list[n].h; } else if (n > 0) { - thumb_max_width_c = thumb_max_width; - thumb_max_height_c = thumb_max_height; + options_c->thumb_max_width = options->thumb_max_width; + options_c->thumb_max_height = options->thumb_max_height; } } @@ -553,8 +497,8 @@ gint current; gint i; - thumb_max_width_c = thumb_max_width; - thumb_max_height_c = thumb_max_height; + options_c->thumb_max_width = options->thumb_max_width; + options_c->thumb_max_height = options->thumb_max_height; pref_table_label(table, column, row, text, 0.0); @@ -573,14 +517,14 @@ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), buf); g_free(buf); - if (w == thumb_max_width && h == thumb_max_height) current = i; + if (w == options->thumb_max_width && h == options->thumb_max_height) current = i; } if (current == -1) { gchar *buf; - buf = g_strdup_printf("%s %d x %d", _("Custom"), thumb_max_width, thumb_max_height); + buf = g_strdup_printf("%s %d x %d", _("Custom"), options->thumb_max_width, options->thumb_max_height); gtk_combo_box_append_text(GTK_COMBO_BOX(combo), buf); g_free(buf); @@ -772,9 +716,9 @@ { if (i < GQ_EDITOR_GENERIC_SLOTS) gtk_entry_set_text(GTK_ENTRY(editor_name_entry[i]), - (editor_name[i]) ? editor_name[i] : ""); + (options->editor_name[i]) ? options->editor_name[i] : ""); gtk_entry_set_text(GTK_ENTRY(editor_command_entry[i]), - (editor_command[i]) ? editor_command[i] : ""); + (options->editor_command[i]) ? options->editor_command[i] : ""); } } @@ -819,7 +763,7 @@ entry = gtk_entry_new(); GTK_WIDGET_UNSET_FLAGS(entry, GTK_CAN_FOCUS); gtk_editable_set_editable(GTK_EDITABLE(entry), FALSE); - if (safe_delete_path) gtk_entry_set_text(GTK_ENTRY(entry), safe_delete_path); + if (options->safe_delete_path) gtk_entry_set_text(GTK_ENTRY(entry), options->safe_delete_path); gtk_box_pack_start(GTK_BOX(gd->vbox), entry, FALSE, FALSE, 0); gtk_widget_show(entry); gtk_widget_show(gd->dialog); @@ -838,8 +782,8 @@ gtk_text_buffer_get_start_iter(pTextBuffer, &iStart); gtk_text_buffer_get_end_iter(pTextBuffer, &iEnd); - if (fullscreen_info_c) g_free(fullscreen_info_c); - fullscreen_info_c = gtk_text_buffer_get_text(pTextBuffer, &iStart, &iEnd, TRUE); + if (options_c->fullscreen_info) g_free(options_c->fullscreen_info); + options_c->fullscreen_info = gtk_text_buffer_get_text(pTextBuffer, &iStart, &iEnd, TRUE); } /* general options tab */ @@ -865,12 +809,12 @@ group = pref_group_new(vbox, FALSE, _("Startup"), GTK_ORIENTATION_VERTICAL); button = pref_checkbox_new_int(group, _("Change to folder:"), - startup_path_enable, &startup_path_enable_c); + options->startup_path_enable, &options_c->startup_path_enable); hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); pref_checkbox_link_sensitivity(button, hbox); - tabcomp = tab_completion_new(&startup_path_entry, startup_path, NULL, NULL); + tabcomp = tab_completion_new(&startup_path_entry, options->startup_path, NULL, NULL); tab_completion_add_select_button(startup_path_entry, NULL, TRUE); gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0); gtk_widget_show(tabcomp); @@ -882,42 +826,42 @@ table = pref_table_new(group, 2, 2, FALSE, FALSE); add_thumb_size_menu(table, 0, 0, _("Size:")); - add_quality_menu(table, 0, 1, _("Quality:"), thumbnail_quality, &thumbnail_quality_c); + add_quality_menu(table, 0, 1, _("Quality:"), options->thumbnail_quality, &options_c->thumbnail_quality); ct_button = pref_checkbox_new_int(group, _("Cache thumbnails"), - enable_thumb_caching, &enable_thumb_caching_c); + options->enable_thumb_caching, &options_c->enable_thumb_caching); subgroup = pref_box_new(group, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); pref_checkbox_link_sensitivity(ct_button, subgroup); button = pref_checkbox_new_int(subgroup, _("Use shared thumbnail cache"), - thumbnail_spec_standard, &thumbnail_spec_standard_c); + options->thumbnail_spec_standard, &options_c->thumbnail_spec_standard); subgroup = pref_box_new(subgroup, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); pref_checkbox_link_sensitivity_swap(button, subgroup); pref_checkbox_new_int(subgroup, _("Cache thumbnails into .thumbnails"), - enable_thumb_dirs, &enable_thumb_dirs_c); + options->enable_thumb_dirs, &options_c->enable_thumb_dirs); #if 0 pref_checkbox_new_int(subgroup, _("Use xvpics thumbnails when found (read only)"), - use_xvpics_thumbnails, &use_xvpics_thumbnails_c); + options->use_xvpics_thumbnails, &options_c->use_xvpics_thumbnails); #endif pref_checkbox_new_int(group, _("Faster jpeg thumbnailing (may reduce quality)"), - thumbnail_fast, &thumbnail_fast_c); + options->thumbnail_fast, &options_c->thumbnail_fast); group = pref_group_new(vbox, FALSE, _("Slide show"), GTK_ORIENTATION_VERTICAL); - slideshow_delay_c = slideshow_delay; + options_c->slideshow_delay = options->slideshow_delay; spin = pref_spin_new(group, _("Delay between image change:"), _("seconds"), SLIDESHOW_MIN_SECONDS, SLIDESHOW_MAX_SECONDS, 1.0, 1, - slideshow_delay ? (double)slideshow_delay / SLIDESHOW_SUBSECOND_PRECISION : 10.0, + options->slideshow_delay ? (double)options->slideshow_delay / SLIDESHOW_SUBSECOND_PRECISION : 10.0, G_CALLBACK(slideshow_delay_cb), NULL); gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(spin), GTK_UPDATE_ALWAYS); - pref_checkbox_new_int(group, _("Random"), slideshow_random, &slideshow_random_c); - pref_checkbox_new_int(group, _("Repeat"), slideshow_repeat, &slideshow_repeat_c); + pref_checkbox_new_int(group, _("Random"), options->slideshow_random, &options_c->slideshow_random); + pref_checkbox_new_int(group, _("Repeat"), options->slideshow_repeat, &options_c->slideshow_repeat); } /* image tab */ @@ -941,58 +885,58 @@ group = pref_group_new(vbox, FALSE, _("Zoom"), GTK_ORIENTATION_VERTICAL); #if 0 - add_dither_menu(dither_quality, &dither_quality_c, _("Dithering method:"), group); + add_dither_menu(dither_quality, &options_c->dither_quality, _("Dithering method:"), group); #endif table = pref_table_new(group, 2, 1, FALSE, FALSE); - add_quality_menu(table, 0, 0, _("Quality:"), zoom_quality, &zoom_quality_c); + add_quality_menu(table, 0, 0, _("Quality:"), options->zoom_quality, &options_c->zoom_quality); pref_checkbox_new_int(group, _("Two pass zooming"), - two_pass_zoom, &two_pass_zoom_c); + options->two_pass_zoom, &options_c->two_pass_zoom); pref_checkbox_new_int(group, _("Allow enlargement of image for zoom to fit"), - zoom_to_fit_expands, &zoom_to_fit_expands_c); + options->zoom_to_fit_expands, &options_c->zoom_to_fit_expands); hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); ct_button = pref_checkbox_new_int(hbox, _("Limit image size when autofitting (%):"), - limit_autofit_size, &limit_autofit_size_c); + options->limit_autofit_size, &options_c->limit_autofit_size); spin = pref_spin_new_int(hbox, NULL, NULL, 10, 150, 1, - max_autofit_size, &max_autofit_size_c); + options->max_autofit_size, &options_c->max_autofit_size); pref_checkbox_link_sensitivity(ct_button, spin); - zoom_increment_c = zoom_increment; + options_c->zoom_increment = options->zoom_increment; spin = pref_spin_new(group, _("Zoom increment:"), NULL, - 0.1, 4.0, 0.1, 1, (double)zoom_increment / 10.0, + 0.1, 4.0, 0.1, 1, (double)options->zoom_increment / 10.0, G_CALLBACK(zoom_increment_cb), NULL); gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(spin), GTK_UPDATE_ALWAYS); group = pref_group_new(vbox, FALSE, _("When new image is selected:"), GTK_ORIENTATION_VERTICAL); - zoom_mode_c = zoom_mode; + options_c->zoom_mode = options->zoom_mode; button = pref_radiobutton_new(group, NULL, _("Zoom to original size"), - (zoom_mode == ZOOM_RESET_ORIGINAL), + (options->zoom_mode == ZOOM_RESET_ORIGINAL), G_CALLBACK(zoom_mode_original_cb), NULL); button = pref_radiobutton_new(group, button, _("Fit image to window"), - (zoom_mode == ZOOM_RESET_FIT_WINDOW), + (options->zoom_mode == ZOOM_RESET_FIT_WINDOW), G_CALLBACK(zoom_mode_fit_cb), NULL); button = pref_radiobutton_new(group, button, _("Leave Zoom at previous setting"), - (zoom_mode == ZOOM_RESET_NONE), + (options->zoom_mode == ZOOM_RESET_NONE), G_CALLBACK(zoom_mode_none_cb), NULL); group = pref_group_new(vbox, FALSE, _("Appearance"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("User specified background color"), - user_specified_window_background, &user_specified_window_background_c); + options->user_specified_window_background, &options_c->user_specified_window_background); - pref_colorbutton_new(group, _("Background color"), &window_background_color, - G_CALLBACK(pref_background_color_set_cb), &window_background_color_c); + pref_colorbutton_new(group, _("Background color"), &options->window_background_color, + G_CALLBACK(pref_background_color_set_cb), &options_c->window_background_color); group = pref_group_new(vbox, FALSE, _("Convenience"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Refresh on file change"), update_on_time_change, &update_on_time_change_c); pref_checkbox_new_int(group, _("Preload next image"), - enable_read_ahead, &enable_read_ahead_c); + options->enable_read_ahead, &options_c->enable_read_ahead); pref_checkbox_new_int(group, _("Auto rotate image using Exif information"), exif_rotate_enable, &exif_rotate_enable_c); } @@ -1016,21 +960,21 @@ group = pref_group_new(vbox, FALSE, _("State"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Remember window positions"), - save_window_positions, &save_window_positions_c); + options->save_window_positions, &options_c->save_window_positions); pref_checkbox_new_int(group, _("Remember tool state (float/hidden)"), - restore_tool, &restore_tool_c); + options->restore_tool, &options_c->restore_tool); group = pref_group_new(vbox, FALSE, _("Size"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Fit window to image when tools are hidden/floating"), - fit_window, &fit_window_c); + options->fit_window, &options_c->fit_window); hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); ct_button = pref_checkbox_new_int(hbox, _("Limit size when auto-sizing window (%):"), - limit_window_size, &limit_window_size_c); + options->limit_window_size, &options_c->limit_window_size); spin = pref_spin_new_int(hbox, NULL, NULL, 10, 150, 1, - max_window_size, &max_window_size_c); + options->max_window_size, &options_c->max_window_size); pref_checkbox_link_sensitivity(ct_button, spin); group = pref_group_new(vbox, FALSE, _("Layout"), GTK_ORIENTATION_VERTICAL); @@ -1066,12 +1010,12 @@ group = pref_box_new(vbox, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); pref_checkbox_new_int(group, _("Show entries that begin with a dot"), - show_dot_files, &show_dot_files_c); + options->show_dot_files, &options_c->show_dot_files); pref_checkbox_new_int(group, _("Case sensitive sort"), file_sort_case_sensitive, &file_sort_case_sensitive_c); ct_button = pref_checkbox_new_int(group, _("Disable File Filtering"), - file_filter_disable, &file_filter_disable_c); + options->file_filter_disable, &options_c->file_filter_disable); group = pref_group_new(vbox, FALSE, _("Grouping sidecar extensions"), GTK_ORIENTATION_VERTICAL); @@ -1086,7 +1030,7 @@ frame = pref_group_parent(group); g_signal_connect(G_OBJECT(ct_button), "toggled", G_CALLBACK(filter_disable_cb), frame); - gtk_widget_set_sensitive(frame, !file_filter_disable); + gtk_widget_set_sensitive(frame, !options->file_filter_disable); scrolled = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN); @@ -1198,12 +1142,12 @@ entry = gtk_entry_new(); gtk_entry_set_max_length(GTK_ENTRY(entry), EDITOR_NAME_MAX_LENGTH); gtk_widget_set_size_request(entry, 80, -1); - if (editor_name[i]) - gtk_entry_set_text(GTK_ENTRY(entry), editor_name[i]); + if (options->editor_name[i]) + gtk_entry_set_text(GTK_ENTRY(entry), options->editor_name[i]); } else { - entry = gtk_label_new(editor_name[i]); + entry = gtk_label_new(options->editor_name[i]); gtk_misc_set_alignment(GTK_MISC(entry), 0.0, 0.5); } @@ -1216,8 +1160,8 @@ gtk_entry_set_max_length(GTK_ENTRY(entry), EDITOR_COMMAND_MAX_LENGTH); gtk_widget_set_size_request(entry, 160, -1); tab_completion_add_to_entry(entry, NULL, NULL); - if (editor_command[i]) - gtk_entry_set_text(GTK_ENTRY(entry), editor_command[i]); + if (options->editor_command[i]) + gtk_entry_set_text(GTK_ENTRY(entry), options->editor_command[i]); gtk_table_attach(GTK_TABLE (table), entry, 2, 3, i+1, i+2, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_widget_show(entry); @@ -1323,18 +1267,18 @@ group = pref_group_new(vbox, FALSE, _("Full screen"), GTK_ORIENTATION_VERTICAL); - fullscreen_screen_c = fullscreen_screen; - fullscreen_above_c = fullscreen_above; - hbox = fullscreen_prefs_selection_new(_("Location:"), &fullscreen_screen_c, &fullscreen_above_c); + options_c->fullscreen_screen = options->fullscreen_screen; + options_c->fullscreen_above = options->fullscreen_above; + hbox = fullscreen_prefs_selection_new(_("Location:"), &options_c->fullscreen_screen, &options_c->fullscreen_above); gtk_box_pack_start(GTK_BOX(group), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); pref_checkbox_new_int(group, _("Smooth image flip"), - fullscreen_clean_flip, &fullscreen_clean_flip_c); + options->fullscreen_clean_flip, &options_c->fullscreen_clean_flip); pref_checkbox_new_int(group, _("Disable screen saver"), - fullscreen_disable_saver, &fullscreen_disable_saver_c); + options->fullscreen_disable_saver, &options_c->fullscreen_disable_saver); pref_checkbox_new_int(group, _("Always show fullscreen info"), - show_fullscreen_info, &show_fullscreen_info_c); + options->show_fullscreen_info, &options_c->show_fullscreen_info); pref_label_new(group, _("Fullscreen info string")); scrolled = gtk_scrolled_window_new(NULL, NULL); @@ -1365,19 +1309,19 @@ gtk_widget_show(fullscreen_info_view); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(fullscreen_info_view)); - gtk_text_buffer_set_text(buffer, fullscreen_info, -1); + gtk_text_buffer_set_text(buffer, options->fullscreen_info, -1); g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK(fullscreen_info_view_changed_cb), fullscreen_info_view); group = pref_group_new(vbox, FALSE, _("Delete"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Confirm file delete"), - confirm_delete, &confirm_delete_c); + options->confirm_delete, &options_c->confirm_delete); pref_checkbox_new_int(group, _("Enable Delete key"), - enable_delete_key, &enable_delete_key_c); + options->enable_delete_key, &options_c->enable_delete_key); ct_button = pref_checkbox_new_int(group, _("Safe delete"), - safe_delete_enable, &safe_delete_enable_c); + options->safe_delete_enable, &options_c->safe_delete_enable); hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); pref_checkbox_link_sensitivity(ct_button, hbox); @@ -1385,7 +1329,7 @@ pref_spacer(hbox, PREF_PAD_INDENT - PREF_PAD_SPACE); pref_label_new(hbox, _("Folder:")); - tabcomp = tab_completion_new(&safe_delete_path_entry, safe_delete_path, NULL, NULL); + tabcomp = tab_completion_new(&safe_delete_path_entry, options->safe_delete_path, NULL, NULL); tab_completion_add_select_button(safe_delete_path_entry, NULL, TRUE); gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0); gtk_widget_show(tabcomp); @@ -1395,7 +1339,7 @@ pref_spacer(hbox, PREF_PAD_INDENT - PREF_PAD_GAP); spin = pref_spin_new_int(hbox, _("Maximum size:"), _("MB"), - 0, 2048, 1, safe_delete_size, &safe_delete_size_c); + 0, 2048, 1, options->safe_delete_size, &options_c->safe_delete_size); #if GTK_CHECK_VERSION(2,12,0) gtk_widget_set_tooltip_markup(spin, _("Set to 0 for unlimited size")); #endif @@ -1412,31 +1356,31 @@ group = pref_group_new(vbox, FALSE, _("Behavior"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Rectangular selection in icon view"), - collection_rectangular_selection, &collection_rectangular_selection_c); + options->collection_rectangular_selection, &options_c->collection_rectangular_selection); pref_checkbox_new_int(group, _("Descend folders in tree view"), tree_descend_subdirs, &tree_descend_subdirs_c); pref_checkbox_new_int(group, _("In place renaming"), - enable_in_place_rename, &enable_in_place_rename_c); + options->enable_in_place_rename, &options_c->enable_in_place_rename); group = pref_group_new(vbox, FALSE, _("Navigation"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Progressive keyboard scrolling"), - progressive_key_scrolling, &progressive_key_scrolling_c); + options->progressive_key_scrolling, &options_c->progressive_key_scrolling); pref_checkbox_new_int(group, _("Mouse wheel scrolls image"), - mousewheel_scrolls, &mousewheel_scrolls_c); + options->mousewheel_scrolls, &options_c->mousewheel_scrolls); group = pref_group_new(vbox, FALSE, _("Miscellaneous"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Store keywords and comments local to source images"), - enable_metadata_dirs, &enable_metadata_dirs_c); + options->enable_metadata_dirs, &options_c->enable_metadata_dirs); pref_spin_new_int(group, _("Custom similarity threshold:"), NULL, - 0, 100, 1, dupe_custom_threshold, &dupe_custom_threshold_c); + 0, 100, 1, options->dupe_custom_threshold, &options_c->dupe_custom_threshold); pref_spin_new_int(group, _("Offscreen cache size (Mb per image):"), NULL, - 0, 128, 1, tile_cache_max, &tile_cache_max_c); + 0, 128, 1, options->tile_cache_max, &options_c->tile_cache_max); group = pref_group_new(vbox, FALSE, _("Color profiles"), GTK_ORIENTATION_VERTICAL); #ifndef HAVE_LCMS @@ -1509,6 +1453,8 @@ GtkWidget *button; GtkWidget *ct_button; + if (!options_c) options_c = init_options(NULL); + configwindow = window_new(GTK_WINDOW_TOPLEVEL, "preferences", PIXBUF_INLINE_ICON_CONFIG, NULL, _("Preferences")); gtk_window_set_type_hint(GTK_WINDOW(configwindow), GDK_WINDOW_TYPE_HINT_DIALOG); g_signal_connect(G_OBJECT (configwindow), "delete_event", diff -r 46169c246c51 -r b16b9b8979e5 src/rcfile.c --- a/src/rcfile.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/rcfile.c Fri Apr 11 22:14:36 2008 +0000 @@ -290,97 +290,97 @@ write_bool_option(ssi, "exif_auto_rotate", exif_rotate_enable); secure_fputc(ssi, '\n'); - write_bool_option(ssi, "enable_startup_path", startup_path_enable); - write_char_option(ssi, "startup_path", startup_path); + write_bool_option(ssi, "enable_startup_path", options->startup_path_enable); + write_char_option(ssi, "startup_path", options->startup_path); secure_fputc(ssi, '\n'); secure_fprintf(ssi, "zoom_mode: "); - if (zoom_mode == ZOOM_RESET_ORIGINAL) secure_fprintf(ssi, "original\n"); - if (zoom_mode == ZOOM_RESET_FIT_WINDOW) secure_fprintf(ssi, "fit\n"); - if (zoom_mode == ZOOM_RESET_NONE) secure_fprintf(ssi, "dont_change\n"); - write_bool_option(ssi, "two_pass_scaling", two_pass_zoom); - write_bool_option(ssi, "zoom_to_fit_allow_expand", zoom_to_fit_expands); + if (options->zoom_mode == ZOOM_RESET_ORIGINAL) secure_fprintf(ssi, "original\n"); + if (options->zoom_mode == ZOOM_RESET_FIT_WINDOW) secure_fprintf(ssi, "fit\n"); + if (options->zoom_mode == ZOOM_RESET_NONE) secure_fprintf(ssi, "dont_change\n"); + write_bool_option(ssi, "two_pass_scaling", options->two_pass_zoom); + write_bool_option(ssi, "zoom_to_fit_allow_expand", options->zoom_to_fit_expands); secure_fputc(ssi, '\n'); - write_bool_option(ssi, "fit_window_to_image", fit_window); - write_bool_option(ssi, "limit_window_size", limit_window_size); - write_int_option(ssi, "max_window_size", max_window_size); - write_bool_option(ssi, "limit_autofit_size", limit_autofit_size); - write_int_option(ssi, "max_autofit_size", max_autofit_size); + write_bool_option(ssi, "fit_window_to_image", options->fit_window); + write_bool_option(ssi, "limit_window_size", options->limit_window_size); + write_int_option(ssi, "max_window_size", options->max_window_size); + write_bool_option(ssi, "limit_autofit_size", options->limit_autofit_size); + write_int_option(ssi, "max_autofit_size", options->max_autofit_size); secure_fputc(ssi, '\n'); - write_bool_option(ssi, "progressive_keyboard_scrolling", progressive_key_scrolling); - write_int_option(ssi, "scroll_reset_method", scroll_reset_method); + write_bool_option(ssi, "progressive_keyboard_scrolling", options->progressive_key_scrolling); + write_int_option(ssi, "scroll_reset_method", options->scroll_reset_method); secure_fputc(ssi, '\n'); - write_bool_option(ssi, "enable_thumbnails", thumbnails_enabled); - write_int_option(ssi, "thumbnail_width", thumb_max_width); - write_int_option(ssi, "thumbnail_height", thumb_max_height); - write_bool_option(ssi, "cache_thumbnails", enable_thumb_caching); - write_bool_option(ssi, "cache_thumbnails_into_dirs", enable_thumb_dirs); - write_bool_option(ssi, "thumbnail_fast", thumbnail_fast); - write_bool_option(ssi, "use_xvpics_thumbnails", use_xvpics_thumbnails); - write_bool_option(ssi, "thumbnail_spec_standard", thumbnail_spec_standard); + write_bool_option(ssi, "enable_thumbnails", options->thumbnails_enabled); + write_int_option(ssi, "thumbnail_width", options->thumb_max_width); + write_int_option(ssi, "thumbnail_height", options->thumb_max_height); + write_bool_option(ssi, "cache_thumbnails", options->enable_thumb_caching); + write_bool_option(ssi, "cache_thumbnails_into_dirs", options->enable_thumb_dirs); + write_bool_option(ssi, "thumbnail_fast", options->thumbnail_fast); + write_bool_option(ssi, "use_xvpics_thumbnails", options->use_xvpics_thumbnails); + write_bool_option(ssi, "thumbnail_spec_standard", options->thumbnail_spec_standard); secure_fputc(ssi, '\n'); - write_bool_option(ssi, "local_metadata", enable_metadata_dirs); + write_bool_option(ssi, "local_metadata", options->enable_metadata_dirs); secure_fputc(ssi, '\n'); - write_int_option(ssi, "sort_method", (gint)file_sort_method); - write_bool_option(ssi, "sort_ascending", file_sort_ascending); + write_int_option(ssi, "sort_method", (gint)options->file_sort_method); + write_bool_option(ssi, "sort_ascending", options->file_sort_ascending); write_bool_option(ssi, "sort_case_sensitive", file_sort_case_sensitive); secure_fputc(ssi, '\n'); - write_bool_option(ssi, "confirm_delete", confirm_delete); - write_bool_option(ssi, "enable_delete_key", enable_delete_key); - write_bool_option(ssi, "safe_delete", safe_delete_enable); - write_char_option(ssi, "safe_delete_path", safe_delete_path); - write_int_option(ssi, "safe_delete_size", safe_delete_size); + write_bool_option(ssi, "confirm_delete", options->confirm_delete); + write_bool_option(ssi, "enable_delete_key", options->enable_delete_key); + write_bool_option(ssi, "safe_delete", options->safe_delete_enable); + write_char_option(ssi, "safe_delete_path", options->safe_delete_path); + write_int_option(ssi, "safe_delete_size", options->safe_delete_size); secure_fputc(ssi, '\n'); - write_bool_option(ssi, "tools_float", tools_float); - write_bool_option(ssi, "tools_hidden", tools_hidden); - write_bool_option(ssi, "restore_tool_state", restore_tool); - write_bool_option(ssi, "toolbar_hidden", toolbar_hidden); + write_bool_option(ssi, "tools_float", options->tools_float); + write_bool_option(ssi, "tools_hidden", options->tools_hidden); + write_bool_option(ssi, "restore_tool_state", options->restore_tool); + write_bool_option(ssi, "toolbar_hidden", options->toolbar_hidden); secure_fputc(ssi, '\n'); - write_bool_option(ssi, "mouse_wheel_scrolls", mousewheel_scrolls); - write_bool_option(ssi, "in_place_rename", enable_in_place_rename); - write_int_option(ssi, "open_recent_max", recent_list_max); - write_int_option(ssi, "image_cache_size_max", tile_cache_max); - write_int_option(ssi, "thumbnail_quality", thumbnail_quality); - write_int_option(ssi, "zoom_quality", zoom_quality); - write_int_option(ssi, "dither_quality", dither_quality); - write_int_option(ssi, "zoom_increment", zoom_increment); - write_bool_option(ssi, "enable_read_ahead", enable_read_ahead); - write_bool_option(ssi, "display_dialogs_under_mouse", place_dialogs_under_mouse); + write_bool_option(ssi, "mouse_wheel_scrolls", options->mousewheel_scrolls); + write_bool_option(ssi, "in_place_rename", options->enable_in_place_rename); + write_int_option(ssi, "open_recent_max", options->recent_list_max); + write_int_option(ssi, "image_cache_size_max", options->tile_cache_max); + write_int_option(ssi, "thumbnail_quality", options->thumbnail_quality); + write_int_option(ssi, "zoom_quality", options->zoom_quality); + write_int_option(ssi, "dither_quality", options->dither_quality); + write_int_option(ssi, "zoom_increment", options->zoom_increment); + write_bool_option(ssi, "enable_read_ahead", options->enable_read_ahead); + write_bool_option(ssi, "display_dialogs_under_mouse", options->place_dialogs_under_mouse); secure_fputc(ssi, '\n'); - write_bool_option(ssi, "user_specified_window_background", user_specified_window_background); - write_color_option(ssi, "window_background_color", &window_background_color); + write_bool_option(ssi, "user_specified_window_background", options->user_specified_window_background); + write_color_option(ssi, "window_background_color", &options->window_background_color); secure_fputc(ssi, '\n'); - write_int_option(ssi, "fullscreen_screen", fullscreen_screen); - write_bool_option(ssi, "fullscreen_clean_flip", fullscreen_clean_flip); - write_bool_option(ssi, "fullscreen_disable_saver", fullscreen_disable_saver); - write_bool_option(ssi, "fullscreen_above", fullscreen_above); - write_bool_option(ssi, "show_fullscreen_info", show_fullscreen_info); - write_char_option(ssi, "fullscreen_info", fullscreen_info); + write_int_option(ssi, "fullscreen_screen", options->fullscreen_screen); + write_bool_option(ssi, "fullscreen_clean_flip", options->fullscreen_clean_flip); + write_bool_option(ssi, "fullscreen_disable_saver", options->fullscreen_disable_saver); + write_bool_option(ssi, "fullscreen_above", options->fullscreen_above); + write_bool_option(ssi, "show_fullscreen_info", options->show_fullscreen_info); + write_char_option(ssi, "fullscreen_info", options->fullscreen_info); secure_fputc(ssi, '\n'); - write_int_option(ssi, "custom_similarity_threshold", dupe_custom_threshold); + write_int_option(ssi, "custom_similarity_threshold", options->dupe_custom_threshold); secure_fprintf(ssi, "\n##### Slideshow Options #####\n\n"); - write_int_unit_option(ssi, "slideshow_delay", slideshow_delay, SLIDESHOW_SUBSECOND_PRECISION); + write_int_unit_option(ssi, "slideshow_delay", options->slideshow_delay, SLIDESHOW_SUBSECOND_PRECISION); - write_bool_option(ssi, "slideshow_random", slideshow_random); - write_bool_option(ssi, "slideshow_repeat", slideshow_repeat); + write_bool_option(ssi, "slideshow_random", options->slideshow_random); + write_bool_option(ssi, "slideshow_repeat", options->slideshow_repeat); secure_fprintf(ssi, "\n##### Filtering Options #####\n\n"); - write_bool_option(ssi, "show_dotfiles", show_dot_files); - write_bool_option(ssi, "disable_filtering", file_filter_disable); + write_bool_option(ssi, "show_dotfiles", options->show_dot_files); + write_bool_option(ssi, "disable_filtering", options->file_filter_disable); filter_write_list(ssi); @@ -418,8 +418,8 @@ for (i = 0; i < GQ_EDITOR_SLOTS; i++) { - gchar *qname = escquote_value(editor_name[i]); - gchar *qcommand = escquote_value(editor_command[i]); + gchar *qname = escquote_value(options->editor_name[i]); + gchar *qcommand = escquote_value(options->editor_command[i]); secure_fprintf(ssi, "external_%d: %s %s\n", i+1, qname, qcommand); g_free(qname); g_free(qcommand); @@ -427,24 +427,24 @@ secure_fprintf(ssi, "\n##### Collection Options #####\n\n"); - write_bool_option(ssi, "rectangular_selections", collection_rectangular_selection); + write_bool_option(ssi, "rectangular_selections", options->collection_rectangular_selection); secure_fprintf(ssi, "\n##### Window Positions #####\n\n"); - write_bool_option(ssi, "restore_window_positions", save_window_positions); + write_bool_option(ssi, "restore_window_positions", options->save_window_positions); secure_fputc(ssi, '\n'); - write_int_option(ssi, "main_window_x", main_window_x); - write_int_option(ssi, "main_window_y", main_window_y); - write_int_option(ssi, "main_window_width", main_window_w); - write_int_option(ssi, "main_window_height", main_window_h); - write_bool_option(ssi, "main_window_maximized", main_window_maximized); - write_int_option(ssi, "float_window_x", float_window_x); - write_int_option(ssi, "float_window_y", float_window_y); - write_int_option(ssi, "float_window_width", float_window_w); - write_int_option(ssi, "float_window_height", float_window_h); - write_int_option(ssi, "float_window_divider", float_window_divider); - write_int_option(ssi, "divider_position_h", window_hdivider_pos); - write_int_option(ssi, "divider_position_v", window_vdivider_pos); + write_int_option(ssi, "main_window_x", options->main_window_x); + write_int_option(ssi, "main_window_y", options->main_window_y); + write_int_option(ssi, "main_window_width", options->main_window_w); + write_int_option(ssi, "main_window_height", options->main_window_h); + write_bool_option(ssi, "main_window_maximized", options->main_window_maximized); + write_int_option(ssi, "float_window_x", options->float_window_x); + write_int_option(ssi, "float_window_y", options->float_window_y); + write_int_option(ssi, "float_window_width", options->float_window_w); + write_int_option(ssi, "float_window_height", options->float_window_h); + write_int_option(ssi, "float_window_divider", options->float_window_divider); + write_int_option(ssi, "divider_position_h", options->window_hdivider_pos); + write_int_option(ssi, "divider_position_v", options->window_vdivider_pos); secure_fprintf(ssi, "\n##### Exif #####\n# 0: never\n# 1: if set\n# 2: always\n\n"); for (i = 0; ExifUIList[i].key; i++) @@ -547,150 +547,150 @@ exif_rotate_enable = read_bool_option(f, option, "exif_auto_rotate", value, exif_rotate_enable); - startup_path_enable = read_bool_option(f, option, - "enable_startup_path", value, startup_path_enable); - startup_path = read_char_option(f, option, - "startup_path", value_all, startup_path); + options->startup_path_enable = read_bool_option(f, option, + "enable_startup_path", value, options->startup_path_enable); + options->startup_path = read_char_option(f, option, + "startup_path", value_all, options->startup_path); - if (strcasecmp(option,"zoom_mode") == 0) + if (strcasecmp(option, "zoom_mode") == 0) { - if (strcasecmp(value, "original") == 0) zoom_mode = ZOOM_RESET_ORIGINAL; - if (strcasecmp(value, "fit") == 0) zoom_mode = ZOOM_RESET_FIT_WINDOW; - if (strcasecmp(value, "dont_change") == 0) zoom_mode = ZOOM_RESET_NONE; + if (strcasecmp(value, "original") == 0) options->zoom_mode = ZOOM_RESET_ORIGINAL; + if (strcasecmp(value, "fit") == 0) options->zoom_mode = ZOOM_RESET_FIT_WINDOW; + if (strcasecmp(value, "dont_change") == 0) options->zoom_mode = ZOOM_RESET_NONE; } - two_pass_zoom = read_bool_option(f, option, - "two_pass_scaling", value, two_pass_zoom); - zoom_to_fit_expands = read_bool_option(f, option, - "zoom_to_fit_allow_expand", value, zoom_to_fit_expands); + options->two_pass_zoom = read_bool_option(f, option, + "two_pass_scaling", value, options->two_pass_zoom); + options->zoom_to_fit_expands = read_bool_option(f, option, + "zoom_to_fit_allow_expand", value, options->zoom_to_fit_expands); - fit_window = read_bool_option(f, option, - "fit_window_to_image", value, fit_window); - limit_window_size = read_bool_option(f, option, - "limit_window_size", value, limit_window_size); - max_window_size = read_int_option(f, option, - "max_window_size", value, max_window_size); - limit_autofit_size = read_bool_option(f, option, - "limit_autofit_size", value, limit_autofit_size); - max_autofit_size = read_int_option(f, option, - "max_autofit_size", value, max_autofit_size); - progressive_key_scrolling = read_bool_option(f, option, - "progressive_keyboard_scrolling", value, progressive_key_scrolling); - scroll_reset_method = read_int_option(f, option, - "scroll_reset_method", value, scroll_reset_method); + options->fit_window = read_bool_option(f, option, + "fit_window_to_image", value, options->fit_window); + options->limit_window_size = read_bool_option(f, option, + "limit_window_size", value, options->limit_window_size); + options->max_window_size = read_int_option(f, option, + "max_window_size", value, options->max_window_size); + options->limit_autofit_size = read_bool_option(f, option, + "limit_autofit_size", value, options->limit_autofit_size); + options->max_autofit_size = read_int_option(f, option, + "max_autofit_size", value, options->max_autofit_size); + options->progressive_key_scrolling = read_bool_option(f, option, + "progressive_keyboard_scrolling", value, options->progressive_key_scrolling); + options->scroll_reset_method = read_int_option(f, option, + "scroll_reset_method", value, options->scroll_reset_method); - thumbnails_enabled = read_bool_option(f, option, - "enable_thumbnails", value, thumbnails_enabled); - thumb_max_width = read_int_option(f, option, - "thumbnail_width", value, thumb_max_width); - if (thumb_max_width < 16) thumb_max_width = 16; - thumb_max_height = read_int_option(f, option, - "thumbnail_height", value, thumb_max_height); - if (thumb_max_height < 16) thumb_max_height = 16; - enable_thumb_caching = read_bool_option(f, option, - "cache_thumbnails", value, enable_thumb_caching); - enable_thumb_dirs = read_bool_option(f, option, - "cache_thumbnails_into_dirs", value, enable_thumb_dirs); - thumbnail_fast = read_bool_option(f, option, - "thumbnail_fast", value, thumbnail_fast); - use_xvpics_thumbnails = read_bool_option(f, option, - "use_xvpics_thumbnails", value, use_xvpics_thumbnails); - thumbnail_spec_standard = read_bool_option(f, option, - "thumbnail_spec_standard", value, thumbnail_spec_standard); + options->thumbnails_enabled = read_bool_option(f, option, + "enable_thumbnails", value, options->thumbnails_enabled); + options->thumb_max_width = read_int_option(f, option, + "thumbnail_width", value, options->thumb_max_width); + if (options->thumb_max_width < 16) options->thumb_max_width = 16; + options->thumb_max_height = read_int_option(f, option, + "thumbnail_height", value, options->thumb_max_height); + if (options->thumb_max_height < 16) options->thumb_max_height = 16; + options->enable_thumb_caching = read_bool_option(f, option, + "cache_thumbnails", value, options->enable_thumb_caching); + options->enable_thumb_dirs = read_bool_option(f, option, + "cache_thumbnails_into_dirs", value, options->enable_thumb_dirs); + options->thumbnail_fast = read_bool_option(f, option, + "thumbnail_fast", value, options->thumbnail_fast); + options->use_xvpics_thumbnails = read_bool_option(f, option, + "use_xvpics_thumbnails", value, options->use_xvpics_thumbnails); + options->thumbnail_spec_standard = read_bool_option(f, option, + "thumbnail_spec_standard", value, options->thumbnail_spec_standard); - enable_metadata_dirs = read_bool_option(f, option, - "local_metadata", value, enable_metadata_dirs); + options->enable_metadata_dirs = read_bool_option(f, option, + "local_metadata", value, options->enable_metadata_dirs); - file_sort_method = (SortType)read_int_option(f, option, - "sort_method", value, (gint)file_sort_method); - file_sort_ascending = read_bool_option(f, option, - "sort_ascending", value, file_sort_ascending); + options->file_sort_method = (SortType)read_int_option(f, option, + "sort_method", value, (gint)options->file_sort_method); + options->file_sort_ascending = read_bool_option(f, option, + "sort_ascending", value, options->file_sort_ascending); file_sort_case_sensitive = read_bool_option(f, option, "sort_case_sensitive", value, file_sort_case_sensitive); - confirm_delete = read_bool_option(f, option, - "confirm_delete", value, confirm_delete); - enable_delete_key = read_bool_option(f, option, - "enable_delete_key", value, enable_delete_key); - safe_delete_enable = read_bool_option(f, option, - "safe_delete", value, safe_delete_enable); - safe_delete_path = read_char_option(f, option, - "safe_delete_path", value, safe_delete_path); - safe_delete_size = read_int_option(f, option, - "safe_delete_size", value, safe_delete_size); + options->confirm_delete = read_bool_option(f, option, + "confirm_delete", value, options->confirm_delete); + options->enable_delete_key = read_bool_option(f, option, + "enable_delete_key", value, options->enable_delete_key); + options->safe_delete_enable = read_bool_option(f, option, + "safe_delete", value, options->safe_delete_enable); + options->safe_delete_path = read_char_option(f, option, + "safe_delete_path", value, options->safe_delete_path); + options->safe_delete_size = read_int_option(f, option, + "safe_delete_size", value,options->safe_delete_size); - tools_float = read_bool_option(f, option, - "tools_float", value, tools_float); - tools_hidden = read_bool_option(f, option, - "tools_hidden", value, tools_hidden); - restore_tool = read_bool_option(f, option, - "restore_tool_state", value, restore_tool); + options->tools_float = read_bool_option(f, option, + "tools_float", value, options->tools_float); + options->tools_hidden = read_bool_option(f, option, + "tools_hidden", value, options->tools_hidden); + options->restore_tool = read_bool_option(f, option, + "restore_tool_state", value, options->restore_tool); - toolbar_hidden = read_bool_option(f, option, - "toolbar_hidden", value, toolbar_hidden); + options->toolbar_hidden = read_bool_option(f, option, + "toolbar_hidden", value, options->toolbar_hidden); - mousewheel_scrolls = read_bool_option(f, option, - "mouse_wheel_scrolls", value, mousewheel_scrolls); - enable_in_place_rename = read_bool_option(f, option, - "in_place_rename", value, enable_in_place_rename); + options->mousewheel_scrolls = read_bool_option(f, option, + "mouse_wheel_scrolls", value, options->mousewheel_scrolls); + options->enable_in_place_rename = read_bool_option(f, option, + "in_place_rename", value, options->enable_in_place_rename); - recent_list_max = read_int_option(f, option, - "open_recent_max", value, recent_list_max); + options->recent_list_max = read_int_option(f, option, + "open_recent_max", value, options->recent_list_max); - tile_cache_max = read_int_option(f, option, - "image_cache_size_max", value, tile_cache_max); + options->tile_cache_max = read_int_option(f, option, + "image_cache_size_max", value, options->tile_cache_max); - thumbnail_quality = CLAMP(read_int_option(f, option, - "thumbnail_quality", value, thumbnail_quality), GDK_INTERP_NEAREST, GDK_INTERP_HYPER); - zoom_quality = CLAMP(read_int_option(f, option, - "zoom_quality", value, zoom_quality), GDK_INTERP_NEAREST, GDK_INTERP_HYPER); - dither_quality = CLAMP(read_int_option(f, option, - "dither_quality", value, dither_quality), GDK_RGB_DITHER_NONE, GDK_RGB_DITHER_MAX); + options->thumbnail_quality = CLAMP(read_int_option(f, option, + "thumbnail_quality", value, options->thumbnail_quality), GDK_INTERP_NEAREST, GDK_INTERP_HYPER); + options->zoom_quality = CLAMP(read_int_option(f, option, + "zoom_quality", value, options->zoom_quality), GDK_INTERP_NEAREST, GDK_INTERP_HYPER); + options->dither_quality = CLAMP(read_int_option(f, option, + "dither_quality", value, options->dither_quality), GDK_RGB_DITHER_NONE, GDK_RGB_DITHER_MAX); - zoom_increment = read_int_option(f, option, - "zoom_increment", value, zoom_increment); + options->zoom_increment = read_int_option(f, option, + "zoom_increment", value, options->zoom_increment); - enable_read_ahead = read_bool_option(f, option, - "enable_read_ahead", value, enable_read_ahead); + options->enable_read_ahead = read_bool_option(f, option, + "enable_read_ahead", value, options->enable_read_ahead); - place_dialogs_under_mouse = read_bool_option(f, option, - "display_dialogs_under_mouse", value, place_dialogs_under_mouse); + options->place_dialogs_under_mouse = read_bool_option(f, option, + "display_dialogs_under_mouse", value, options->place_dialogs_under_mouse); - user_specified_window_background = read_bool_option(f, option, - "user_specified_window_background", value, user_specified_window_background); + options->user_specified_window_background = read_bool_option(f, option, + "user_specified_window_background", value, options->user_specified_window_background); read_color_option(f, option, - "window_background_color", value, &window_background_color); + "window_background_color", value, &options->window_background_color); - fullscreen_screen = read_int_option(f, option, - "fullscreen_screen", value, fullscreen_screen); - fullscreen_clean_flip = read_bool_option(f, option, - "fullscreen_clean_flip", value, fullscreen_clean_flip); - fullscreen_disable_saver = read_bool_option(f, option, - "fullscreen_disable_saver", value, fullscreen_disable_saver); - fullscreen_above = read_bool_option(f, option, - "fullscreen_above", value, fullscreen_above); - show_fullscreen_info = read_bool_option(f, option, - "show_fullscreen_info", value, show_fullscreen_info); - fullscreen_info = read_char_option(f, option, - "fullscreen_info", value_all, fullscreen_info); + options->fullscreen_screen = read_int_option(f, option, + "fullscreen_screen", value, options->fullscreen_screen); + options->fullscreen_clean_flip = read_bool_option(f, option, + "fullscreen_clean_flip", value, options->fullscreen_clean_flip); + options->fullscreen_disable_saver = read_bool_option(f, option, + "fullscreen_disable_saver", value, options->fullscreen_disable_saver); + options->fullscreen_above = read_bool_option(f, option, + "fullscreen_above", value, options->fullscreen_above); + options->show_fullscreen_info = read_bool_option(f, option, + "show_fullscreen_info", value, options->show_fullscreen_info); + options->fullscreen_info = read_char_option(f, option, + "fullscreen_info", value_all, options->fullscreen_info); - dupe_custom_threshold = read_int_option(f, option, - "custom_similarity_threshold", value, dupe_custom_threshold); + options->dupe_custom_threshold = read_int_option(f, option, + "custom_similarity_threshold", value, options->dupe_custom_threshold); /* slideshow options */ - slideshow_delay = read_int_unit_option(f, option, - "slideshow_delay", value, slideshow_delay, SLIDESHOW_SUBSECOND_PRECISION); - slideshow_random = read_bool_option(f, option, - "slideshow_random", value, slideshow_random); - slideshow_repeat = read_bool_option(f, option, - "slideshow_repeat", value, slideshow_repeat); + options->slideshow_delay = read_int_unit_option(f, option, + "slideshow_delay", value, options->slideshow_delay, SLIDESHOW_SUBSECOND_PRECISION); + options->slideshow_random = read_bool_option(f, option, + "slideshow_random", value, options->slideshow_random); + options->slideshow_repeat = read_bool_option(f, option, + "slideshow_repeat", value, options->slideshow_repeat); /* filtering options */ - show_dot_files = read_bool_option(f, option, - "show_dotfiles", value, show_dot_files); - file_filter_disable = read_bool_option(f, option, - "disable_filtering", value, file_filter_disable); + options->show_dot_files = read_bool_option(f, option, + "show_dotfiles", value, options->show_dot_files); + options->file_filter_disable = read_bool_option(f, option, + "disable_filtering", value, options->file_filter_disable); if (strcasecmp(option, "filter_ext") == 0) { @@ -744,48 +744,48 @@ { const gchar *ptr; i--; - g_free(editor_name[i]); - g_free(editor_command[i]); + g_free(options->editor_name[i]); + g_free(options->editor_command[i]); - editor_name[i] = quoted_value(value_all, &ptr); - editor_command[i] = quoted_value(ptr, NULL); + options->editor_name[i] = quoted_value(value_all, &ptr); + options->editor_command[i] = quoted_value(ptr, NULL); } } /* colection options */ - collection_rectangular_selection = read_bool_option(f, option, - "rectangular_selections", value, collection_rectangular_selection); + options->collection_rectangular_selection = read_bool_option(f, option, + "rectangular_selections", value, options->collection_rectangular_selection); /* window positions */ - save_window_positions = read_bool_option(f, option, - "restore_window_positions", value, save_window_positions); + options->save_window_positions = read_bool_option(f, option, + "restore_window_positions", value, options->save_window_positions); - main_window_x = read_int_option(f, option, - "main_window_x", value, main_window_x); - main_window_y = read_int_option(f, option, - "main_window_y", value, main_window_y); - main_window_w = read_int_option(f, option, - "main_window_width", value, main_window_w); - main_window_h = read_int_option(f, option, - "main_window_height", value, main_window_h); - main_window_maximized = read_bool_option(f, option, - "main_window_maximized", value, main_window_maximized); - float_window_x = read_int_option(f, option, - "float_window_x", value, float_window_x); - float_window_y = read_int_option(f, option, - "float_window_y", value, float_window_y); - float_window_w = read_int_option(f, option, - "float_window_width", value, float_window_w); - float_window_h = read_int_option(f, option, - "float_window_height", value, float_window_h); - float_window_divider = read_int_option(f, option, - "float_window_divider", value, float_window_divider); - window_hdivider_pos = read_int_option(f, option, - "divider_position_h", value, window_hdivider_pos); - window_vdivider_pos = read_int_option(f, option, - "divider_position_v", value, window_vdivider_pos); + options->main_window_x = read_int_option(f, option, + "main_window_x", value, options->main_window_x); + options->main_window_y = read_int_option(f, option, + "main_window_y", value, options->main_window_y); + options->main_window_w = read_int_option(f, option, + "main_window_width", value, options->main_window_w); + options->main_window_h = read_int_option(f, option, + "main_window_height", value, options->main_window_h); + options->main_window_maximized = read_bool_option(f, option, + "main_window_maximized", value, options->main_window_maximized); + options->float_window_x = read_int_option(f, option, + "float_window_x", value, options->float_window_x); + options->float_window_y = read_int_option(f, option, + "float_window_y", value, options->float_window_y); + options->float_window_w = read_int_option(f, option, + "float_window_width", value, options->float_window_w); + options->float_window_h = read_int_option(f, option, + "float_window_height", value, options->float_window_h); + options->float_window_divider = read_int_option(f, option, + "float_window_divider", value, options->float_window_divider); + options->window_hdivider_pos = read_int_option(f, option, + "divider_position_h", value,options-> window_hdivider_pos); + options->window_vdivider_pos = read_int_option(f, option, + "divider_position_v", value, options->window_vdivider_pos); if (0 == strncasecmp(option, "exif_", 5)) { diff -r 46169c246c51 -r b16b9b8979e5 src/search.c --- a/src/search.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/search.c Fri Apr 11 22:14:36 2008 +0000 @@ -779,7 +779,7 @@ sd->thumb_fd = mfd->fd; thumb_loader_free(sd->thumb_loader); - sd->thumb_loader = thumb_loader_new(thumb_max_width, thumb_max_height); + sd->thumb_loader = thumb_loader_new(options->thumb_max_width, options->thumb_max_height); thumb_loader_set_callbacks(sd->thumb_loader, search_result_thumb_done_cb, @@ -802,14 +802,14 @@ column = gtk_tree_view_get_column(GTK_TREE_VIEW(sd->result_view), SEARCH_COLUMN_THUMB - 1); if (!column) return; - gtk_tree_view_column_set_fixed_width(column, (sd->thumb_enable) ? thumb_max_width : 4); + gtk_tree_view_column_set_fixed_width(column, (sd->thumb_enable) ? options->thumb_max_width : 4); list = gtk_tree_view_column_get_cell_renderers(column); if (!list) return; cell = list->data; g_list_free(list); - g_object_set(G_OBJECT(cell), "height", (sd->thumb_enable) ? thumb_max_height : -1, NULL); + g_object_set(G_OBJECT(cell), "height", (sd->thumb_enable) ? options->thumb_max_height : -1, NULL); gtk_tree_view_columns_autosize(GTK_TREE_VIEW(sd->result_view)); } @@ -1500,7 +1500,7 @@ image_sim_free(sim); } - if (enable_thumb_caching && + if (options->enable_thumb_caching && sd->img_loader && sd->img_loader->fd) { gchar *base; diff -r 46169c246c51 -r b16b9b8979e5 src/slideshow.c --- a/src/slideshow.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/slideshow.c Fri Apr 11 22:14:36 2008 +0000 @@ -94,7 +94,7 @@ if (ss->list) g_list_free(ss->list); - if (slideshow_random) + if (options->slideshow_random) { ss->list = generate_random_list(ss); } @@ -183,7 +183,7 @@ if (ss->filelist) { ss->slide_fd = file_data_ref((FileData *)g_list_nth_data(ss->filelist, row)); - image_change_fd(ss->imd, ss->slide_fd, image_zoom_get_default(ss->imd, zoom_mode)); + image_change_fd(ss->imd, ss->slide_fd, image_zoom_get_default(ss->imd, options->zoom_mode)); } else if (ss->cd) { @@ -192,7 +192,7 @@ info = g_list_nth_data(ss->cd->list, row); ss->slide_fd = file_data_ref(info->fd); - image_change_from_collection(ss->imd, ss->cd, info, image_zoom_get_default(ss->imd, zoom_mode)); + image_change_from_collection(ss->imd, ss->cd, info, image_zoom_get_default(ss->imd, options->zoom_mode)); } else { @@ -200,7 +200,7 @@ if (ss->from_selection) { - image_change_fd(ss->imd, ss->slide_fd, image_zoom_get_default(ss->imd, zoom_mode)); + image_change_fd(ss->imd, ss->slide_fd, image_zoom_get_default(ss->imd, options->zoom_mode)); layout_status_update_info(ss->layout, NULL); } else @@ -209,7 +209,7 @@ } } - if (!ss->list && slideshow_repeat) + if (!ss->list && options->slideshow_repeat) { slideshow_list_init(ss, -1); } @@ -221,7 +221,7 @@ /* read ahead */ - if (enable_read_ahead) + if (options->enable_read_ahead) { gint r; if (forward) @@ -274,10 +274,10 @@ { if (reset) { - if (slideshow_delay < 1) slideshow_delay = 1; + if (options->slideshow_delay < 1) options->slideshow_delay = 1; if (ss->timeout_id != -1) g_source_remove(ss->timeout_id); - ss->timeout_id = g_timeout_add(slideshow_delay * 1000 / SLIDESHOW_SUBSECOND_PRECISION, + ss->timeout_id = g_timeout_add(options->slideshow_delay * 1000 / SLIDESHOW_SUBSECOND_PRECISION, slideshow_loop_cb, ss); } else if (ss->timeout_id != -1) @@ -350,7 +350,7 @@ { collection_ref(ss->cd); ss->slide_count = g_list_length(ss->cd->list); - if (!slideshow_random && start_info) + if (!options->slideshow_random && start_info) { start_index = g_list_index(ss->cd->list, start_info); } @@ -364,7 +364,7 @@ if (ss->slide_count < 2) { ss->slide_count = layout_list_count(ss->layout, NULL); - if (!slideshow_random && start_point >= 0 && start_point < ss->slide_count) + if (!options->slideshow_random && start_point >= 0 && start_point < ss->slide_count) { start_index = start_point; } diff -r 46169c246c51 -r b16b9b8979e5 src/thumb.c --- a/src/thumb.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/thumb.c Fri Apr 11 22:14:36 2008 +0000 @@ -196,7 +196,7 @@ if (w < 1) w = 1; } - tl->pixbuf = gdk_pixbuf_scale_simple(pixbuf, w, h, (GdkInterpType)thumbnail_quality); + tl->pixbuf = gdk_pixbuf_scale_simple(pixbuf, w, h, (GdkInterpType)options->thumbnail_quality); save = TRUE; } else @@ -255,7 +255,7 @@ image_loader_free(tl->il); tl->il = image_loader_new(file_data_new_simple(path)); - if (thumbnail_fast) + if (options->thumbnail_fast) { /* this will speed up jpegs by up to 3x in some cases */ image_loader_set_requested_size(tl->il, tl->max_w, tl->max_h); @@ -350,7 +350,7 @@ } } - if (!cache_path && use_xvpics_thumbnails) + if (!cache_path && options->use_xvpics_thumbnails) { tl->pixbuf = get_xv_thumbnail(tl->path, tl->max_w, tl->max_h); if (tl->pixbuf) @@ -461,7 +461,7 @@ { ThumbLoader *tl; - if (thumbnail_spec_standard) + if (options->thumbnail_spec_standard) { return (ThumbLoader *)thumb_loader_std_new(width, height); } @@ -469,7 +469,7 @@ tl = g_new0(ThumbLoader, 1); tl->standard_loader = FALSE; tl->path = NULL; - tl->cache_enable = enable_thumb_caching; + tl->cache_enable = options->enable_thumb_caching; tl->cache_hit = FALSE; tl->percent_done = 0.0; tl->max_w = width; diff -r 46169c246c51 -r b16b9b8979e5 src/thumb_standard.c --- a/src/thumb_standard.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/thumb_standard.c Fri Apr 11 22:14:36 2008 +0000 @@ -80,7 +80,7 @@ tl->il = NULL; tl->source_path = NULL; - tl->cache_enable = enable_thumb_caching; + tl->cache_enable = options->enable_thumb_caching; tl->cache_local = FALSE; tl->cache_retry = FALSE; @@ -436,7 +436,7 @@ &thumb_w, &thumb_h)) { pixbuf_thumb = gdk_pixbuf_scale_simple(pixbuf, thumb_w, thumb_h, - (GdkInterpType)thumbnail_quality); + (GdkInterpType)options->thumbnail_quality); } else { @@ -484,7 +484,7 @@ &thumb_w, &thumb_h)) { result = gdk_pixbuf_scale_simple(pixbuf, thumb_w, thumb_h, - (GdkInterpType)thumbnail_quality); + (GdkInterpType)options->thumbnail_quality); } else { @@ -603,7 +603,7 @@ { tl->il = image_loader_new_from_path(path); - if (thumbnail_fast) + if (options->thumbnail_fast) { /* this will speed up jpegs by up to 3x in some cases */ if (tl->requested_width <= THUMB_SIZE_NORMAL && diff -r 46169c246c51 -r b16b9b8979e5 src/typedefs.h --- a/src/typedefs.h Fri Apr 11 20:35:37 2008 +0000 +++ b/src/typedefs.h Fri Apr 11 22:14:36 2008 +0000 @@ -141,6 +141,7 @@ typedef struct _SecureSaveInfo SecureSaveInfo; +typedef struct _ConfOptions ConfOptions; struct _ImageLoader { @@ -728,6 +729,97 @@ gint unlink_on_error; /**< whether to remove temporary file on save failure, TRUE by default */ }; +struct _ConfOptions +{ + gint main_window_w; + gint main_window_h; + gint main_window_x; + gint main_window_y; + gint main_window_maximized; + + gint float_window_w; + gint float_window_h; + gint float_window_x; + gint float_window_y; + gint float_window_divider; + + gint window_hdivider_pos; + gint window_vdivider_pos; + + gint save_window_positions; + gint tools_float; + gint tools_hidden; + gint toolbar_hidden; + gint progressive_key_scrolling; + + gint startup_path_enable; + gchar *startup_path; + gint confirm_delete; + gint enable_delete_key; + gint safe_delete_enable; + gchar *safe_delete_path; + gint safe_delete_size; + gint restore_tool; + gint zoom_mode; + gint two_pass_zoom; + gint scroll_reset_method; + gint fit_window; + gint limit_window_size; + gint zoom_to_fit_expands; + gint max_window_size; + gint limit_autofit_size; + gint max_autofit_size; + gint thumb_max_width; + gint thumb_max_height; + gint enable_thumb_caching; + gint enable_thumb_dirs; + gint thumbnail_fast; + gint use_xvpics_thumbnails; + gint thumbnail_spec_standard; + gint enable_metadata_dirs; + gint show_dot_files; + gint file_filter_disable; + gchar *editor_name[GQ_EDITOR_SLOTS]; + gchar *editor_command[GQ_EDITOR_SLOTS]; + + gint thumbnails_enabled; + SortType file_sort_method; + gint file_sort_ascending; + + gint slideshow_delay; /* in tenths of a second */ + gint slideshow_random; + gint slideshow_repeat; + + gint mousewheel_scrolls; + gint enable_in_place_rename; + + gint user_specified_window_background; + GdkColor window_background_color; + + gint fullscreen_screen; + gint fullscreen_clean_flip; + gint fullscreen_disable_saver; + gint fullscreen_above; + gint show_fullscreen_info; + gchar *fullscreen_info; + + gint dupe_custom_threshold; + + gint recent_list_max; + + gint collection_rectangular_selection; + + gint tile_cache_max; /* in megabytes */ + gint thumbnail_quality; + gint zoom_quality; + gint dither_quality; + + gint zoom_increment; /* 10 is 1.0, 5 is 0.05, 20 is 2.0, etc. */ + + gint enable_read_ahead; + + gint place_dialogs_under_mouse; +}; #endif diff -r 46169c246c51 -r b16b9b8979e5 src/utilops.c --- a/src/utilops.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/utilops.c Fri Apr 11 22:14:36 2008 +0000 @@ -258,7 +258,7 @@ GenericDialog *gd; gd = generic_dialog_new(title, wmclass, wmsubclass, parent, auto_close, cancel_cb, data); - if (place_dialogs_under_mouse) + if (options->place_dialogs_under_mouse) { gtk_window_set_position(GTK_WINDOW(gd->dialog), GTK_WIN_POS_MOUSE); } @@ -274,7 +274,7 @@ FileDialog *fdlg; fdlg = file_dialog_new(title, wmclass, wmsubclass, parent, cancel_cb, data); - if (place_dialogs_under_mouse) + if (options->place_dialogs_under_mouse) { gtk_window_set_position(GTK_WINDOW(GENERIC_DIALOG(fdlg)->dialog), GTK_WIN_POS_MOUSE); } @@ -299,7 +299,7 @@ gd = file_util_gen_dlg(heading, GQ_WMCLASS, "warning", parent, TRUE, NULL, NULL); generic_dialog_add_message(gd, icon_stock_id, heading, message); generic_dialog_add_button(gd, GTK_STOCK_OK, NULL, file_util_warning_dialog_ok_cb, TRUE); - if (place_dialogs_under_mouse) + if (options->place_dialogs_under_mouse) { gtk_window_set_position(GTK_WINDOW(gd->dialog), GTK_WIN_POS_MOUSE); } @@ -360,7 +360,7 @@ { gint ok; g_assert(fd->change); - if (editor_command[CMD_COPY]) + if (options->editor_command[CMD_COPY]) { ok = !start_editor_from_file_full(CMD_COPY, fd, copy_file_ext_cb, NULL); if (ok) return ok; /* that's all for now, let's continue in callback */ @@ -408,7 +408,7 @@ { gint ok; g_assert(fd->change); - if (editor_command[CMD_MOVE]) + if (options->editor_command[CMD_MOVE]) { ok = !start_editor_from_file_full(CMD_MOVE, fd, move_file_ext_cb, NULL); if (ok) return ok; /* that's all for now, let's continue in callback */ @@ -455,7 +455,7 @@ { gint ok; g_assert(fd->change); - if (editor_command[CMD_RENAME]) + if (options->editor_command[CMD_RENAME]) { ok = !start_editor_from_file_full(CMD_RENAME, fd, rename_file_ext_cb, NULL); if (ok) return ok; /* that's all for now, let's continue in callback */ @@ -1304,7 +1304,7 @@ gint sorted = FALSE; gint warned = FALSE; - if (!filelist_read(safe_delete_path, &list, NULL)) return 0; + if (!filelist_read(options->safe_delete_path, &list, NULL)) return 0; work = list; while (work) @@ -1321,8 +1321,8 @@ total += fd->size; } - while (safe_delete_size > 0 && list && - (free_space < 0 || total + free_space > (gint64)safe_delete_size * 1048576) ) + while (options->safe_delete_size > 0 && list && + (free_space < 0 || total + free_space > (gint64)options->safe_delete_size * 1048576) ) { FileData *fd; @@ -1362,12 +1362,12 @@ gint n; n = file_util_safe_number(filesize(path)); - return g_strdup_printf("%s/%06d_%s", safe_delete_path, n, filename_from_path(path)); + return g_strdup_printf("%s/%06d_%s", options->safe_delete_path, n, filename_from_path(path)); } static void file_util_safe_del_toggle_cb(GtkWidget *button, gpointer data) { - safe_delete_enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); + options->safe_delete_enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); } static void file_util_safe_del_close_cb(GtkWidget *dialog, gpointer data) @@ -1386,15 +1386,15 @@ if (!isfile(fd->path)) return FALSE; - if (!safe_delete_enable) + if (!options->safe_delete_enable) { return unlink_file(fd->path); } - if (!isdir(safe_delete_path)) + if (!isdir(options->safe_delete_path)) { - if (debug) printf("creating trash: %s\n", safe_delete_path); - if (!safe_delete_path || !mkdir_utf8(safe_delete_path, 0755)) + if (debug) printf("creating trash: %s\n", options->safe_delete_path); + if (!options->safe_delete_path || !mkdir_utf8(options->safe_delete_path, 0755)) { result = _("Could not create folder"); success = FALSE; @@ -1428,7 +1428,7 @@ GtkWidget *button; gchar *buf; - buf = g_strdup_printf(_("Unable to access or create the trash folder.\n\"%s\""), safe_delete_path); + buf = g_strdup_printf(_("Unable to access or create the trash folder.\n\"%s\""), options->safe_delete_path); gd = file_util_warning_dialog(result, buf, GTK_STOCK_DIALOG_WARNING, NULL); g_free(buf); @@ -1450,21 +1450,21 @@ GtkWidget *label; gchar *buf; - if (editor_command[CMD_DELETE]) + if (options->editor_command[CMD_DELETE]) { buf = g_strdup(_("Deletion by external command")); } else { - if (safe_delete_enable) + if (options->safe_delete_enable) { gchar *buf2; - if (safe_delete_size > 0) - buf2 = g_strdup_printf(_(" (max. %d MB)"), safe_delete_size); + if (options->safe_delete_size > 0) + buf2 = g_strdup_printf(_(" (max. %d MB)"), options->safe_delete_size); else buf2 = g_strdup(""); - buf = g_strdup_printf(_("Safe delete: %s%s\nTrash: %s"), _("on"), buf2, safe_delete_path); + buf = g_strdup_printf(_("Safe delete: %s%s\nTrash: %s"), _("on"), buf2, options->safe_delete_path); g_free(buf2); } else @@ -1579,7 +1579,7 @@ } - if (editor_command[CMD_DELETE]) + if (options->editor_command[CMD_DELETE]) { gint flags; work = source_list; @@ -1746,7 +1746,7 @@ static void file_util_delete_multiple(GList *source_list, GtkWidget *parent) { - if (!confirm_delete) + if (!options->confirm_delete) { file_util_delete_multiple_ok_cb(NULL, source_list); } @@ -1811,7 +1811,7 @@ } - if (editor_command[CMD_DELETE]) + if (options->editor_command[CMD_DELETE]) { gint flags; if ((flags = start_editor_from_file_full(CMD_DELETE, fd, file_util_delete_ext_cb, NULL))) @@ -1846,7 +1846,7 @@ static void file_util_delete_single(FileData *fd, GtkWidget *parent) { - if (!confirm_delete) + if (!options->confirm_delete) { file_util_delete_ok_cb(NULL, file_data_ref(fd)); } diff -r 46169c246c51 -r b16b9b8979e5 src/view_dir_tree.c --- a/src/view_dir_tree.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/view_dir_tree.c Fri Apr 11 22:14:36 2008 +0000 @@ -1062,7 +1062,7 @@ /* when hidden files are not enabled, and the user enters a hidden path, * allow the tree to display that path by specifically inserting the hidden entries */ - if (!show_dot_files && + if (!options->show_dot_files && target_path && strncmp(nd->fd->path, target_path, strlen(nd->fd->path)) == 0) { diff -r 46169c246c51 -r b16b9b8979e5 src/view_file_icon.c --- a/src/view_file_icon.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/view_file_icon.c Fri Apr 11 22:14:36 2008 +0000 @@ -380,7 +380,7 @@ cur_fd = layout_image_get_fd(vfi->layout); if (sel_fd == cur_fd) return; /* no change */ - if (enable_read_ahead) + if (options->enable_read_ahead) { gint row; @@ -411,11 +411,11 @@ { gint width; - if (!vfi->show_text) return thumb_max_width; - - width = thumb_max_width + thumb_max_width / 2; + if (!vfi->show_text) return options->thumb_max_width; + + width = options->thumb_max_width + options->thumb_max_width / 2; if (width < THUMB_MIN_ICON_WIDTH) width = THUMB_MIN_ICON_WIDTH; - if (width > THUMB_MAX_ICON_WIDTH) width = thumb_max_width; + if (width > THUMB_MAX_ICON_WIDTH) width = options->thumb_max_width; return width; } @@ -860,7 +860,7 @@ vfi->prev_selection = end; - if (!collection_rectangular_selection) + if (!options->collection_rectangular_selection) { GList *work; IconData *id; @@ -1256,8 +1256,8 @@ adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(vfi->listview)); page_size = (gint)adj->page_increment; - row_height = thumb_max_height + THUMB_BORDER_PADDING * 2; - if (vfi->show_text) row_height += thumb_max_height / 3; + row_height = options->thumb_max_height + THUMB_BORDER_PADDING * 2; + if (vfi->show_text) row_height += options->thumb_max_height / 3; ret = page_size / row_height; if (ret < 1) ret = 1; @@ -1382,7 +1382,7 @@ { if (event->state & GDK_SHIFT_MASK) { - if (!collection_rectangular_selection) + if (!options->collection_rectangular_selection) { vficon_select_region_util(vfi, old_id, new_id, FALSE); } @@ -1664,7 +1664,7 @@ if (cell && GQV_IS_CELL_RENDERER_ICON(cell)) { g_object_set(G_OBJECT(cell), "fixed_width", thumb_width, - "fixed_height", thumb_max_height, + "fixed_height", options->thumb_max_height, "show_text", vfi->show_text, NULL); } } @@ -1990,7 +1990,7 @@ thumb_loader_free(vfi->thumbs_loader); - vfi->thumbs_loader = thumb_loader_new(thumb_max_width, thumb_max_height); + vfi->thumbs_loader = thumb_loader_new(options->thumb_max_width, options->thumb_max_height); thumb_loader_set_callbacks(vfi->thumbs_loader, vficon_thumb_done_cb, vficon_thumb_error_cb, diff -r 46169c246c51 -r b16b9b8979e5 src/view_file_list.c --- a/src/view_file_list.c Fri Apr 11 20:35:37 2008 +0000 +++ b/src/view_file_list.c Fri Apr 11 22:14:36 2008 +0000 @@ -356,7 +356,7 @@ GList *list; list = vflist_pop_menu_file_list(vfl); - if (enable_in_place_rename && + if (options->enable_in_place_rename && list && !list->next && vfl->click_fd) { GtkTreeModel *store; @@ -848,7 +848,7 @@ row = g_list_index(vfl->list, sel_fd); // FIXME sidecar data - if (sel_fd && enable_read_ahead && row >= 0) + if (sel_fd && options->enable_read_ahead && row >= 0) { if (row > g_list_index(vfl->list, cur_fd) && row + 1 < vflist_count(vfl, NULL)) @@ -1225,7 +1225,7 @@ thumb_loader_free(vfl->thumbs_loader); - vfl->thumbs_loader = thumb_loader_new(thumb_max_width, thumb_max_height); + vfl->thumbs_loader = thumb_loader_new(options->thumb_max_width, options->thumb_max_height); thumb_loader_set_callbacks(vfl->thumbs_loader, vflist_thumb_done_cb, vflist_thumb_error_cb, @@ -1633,14 +1633,14 @@ column = gtk_tree_view_get_column(GTK_TREE_VIEW(listview), FILE_COLUMN_THUMB - 1); if (!column) return; - gtk_tree_view_column_set_fixed_width(column, ((thumb) ? thumb_max_width : 4) + 10); + gtk_tree_view_column_set_fixed_width(column, ((thumb) ? options->thumb_max_width : 4) + 10); list = gtk_tree_view_column_get_cell_renderers(column); if (!list) return; cell = list->data; g_list_free(list); - g_object_set(G_OBJECT(cell), "height", (thumb) ? thumb_max_height : -1, NULL); + g_object_set(G_OBJECT(cell), "height", (thumb) ? options->thumb_max_height : -1, NULL); gtk_tree_view_columns_autosize(GTK_TREE_VIEW(listview)); }