Mercurial > geeqie
changeset 1506:d352a44545a6
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
author | zas_ |
---|---|
date | Thu, 02 Apr 2009 23:11:07 +0000 |
parents | 2a99cf2184b0 |
children | 6c2e31dad7ef |
files | src/layout.c src/main.c src/main.h src/preferences.c src/view_file.c src/view_file.h src/view_file_icon.c src/view_file_icon.h src/view_file_list.c src/view_file_list.h |
diffstat | 10 files changed, 82 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/src/layout.c Thu Apr 02 16:10:12 2009 +0000 +++ b/src/layout.c Thu Apr 02 23:11:07 2009 +0000 @@ -904,6 +904,11 @@ layout_status_update_progress(lw, val, text); } +static void layout_list_sync_thumb(LayoutWindow *lw) +{ + if (lw->vf) vf_thumb_set(lw->vf, lw->options.show_thumbnails); +} + static GtkWidget *layout_list_new(LayoutWindow *lw) { lw->vf = vf_new(lw->options.file_view_type, NULL); @@ -913,24 +918,12 @@ vf_set_thumb_status_func(lw->vf, layout_list_thumb_cb, lw); vf_marks_set(lw->vf, lw->options.show_marks); - - switch (lw->options.file_view_type) - { - case FILEVIEW_ICON: - break; - case FILEVIEW_LIST: - vf_thumb_set(lw->vf, lw->options.show_thumbnails); - break; - } + + layout_list_sync_thumb(lw); return lw->vf->widget; } -static void layout_list_sync_thumb(LayoutWindow *lw) -{ - if (lw->vf) vf_thumb_set(lw->vf, lw->options.show_thumbnails); -} - static void layout_list_sync_marks(LayoutWindow *lw) { if (lw->vf) vf_marks_set(lw->vf, lw->options.show_marks); @@ -1186,7 +1179,11 @@ { if (lw->vd) vd_refresh(lw->vd); - if (lw->vf) vf_refresh(lw->vf); + if (lw->vf) + { + vf_refresh(lw->vf); + vf_thumb_update(lw->vf); + } } void layout_refresh(LayoutWindow *lw)
--- a/src/main.c Thu Apr 02 16:10:12 2009 +0000 +++ b/src/main.c Thu Apr 02 23:11:07 2009 +0000 @@ -46,10 +46,9 @@ #include <pwd.h> #endif - +gboolean thumb_format_changed = FALSE; static RemoteConnection *remote_connection = NULL; - /* *----------------------------------------------------------------------------- * keyboard functions
--- a/src/main.h Thu Apr 02 16:10:12 2009 +0000 +++ b/src/main.h Thu Apr 02 23:11:07 2009 +0000 @@ -132,6 +132,8 @@ * This also doubles as the main.c header. */ +extern gboolean thumb_format_changed; + void keyboard_scroll_calc(gint *x, gint *y, GdkEventKey *event); gint key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data);
--- a/src/preferences.c Thu Apr 02 16:10:12 2009 +0000 +++ b/src/preferences.c Thu Apr 02 23:11:07 2009 +0000 @@ -251,8 +251,16 @@ options->image.limit_autofit_size = c_options->image.limit_autofit_size; options->image.max_autofit_size = c_options->image.max_autofit_size; options->progressive_key_scrolling = c_options->progressive_key_scrolling; - options->thumbnails.max_width = c_options->thumbnails.max_width; - options->thumbnails.max_height = c_options->thumbnails.max_height; + if (options->thumbnails.max_width != c_options->thumbnails.max_width + || options->thumbnails.max_height != c_options->thumbnails.max_height + || options->thumbnails.quality != c_options->thumbnails.quality) + { + thumb_format_changed = TRUE; + refresh = TRUE; + options->thumbnails.max_width = c_options->thumbnails.max_width; + options->thumbnails.max_height = c_options->thumbnails.max_height; + options->thumbnails.quality = c_options->thumbnails.quality; + } options->thumbnails.enable_caching = c_options->thumbnails.enable_caching; options->thumbnails.cache_into_dirs = c_options->thumbnails.cache_into_dirs; options->thumbnails.fast = c_options->thumbnails.fast; @@ -287,7 +295,6 @@ options->image.read_buffer_size = c_options->image.read_buffer_size; options->image.idle_read_loop_count = c_options->image.idle_read_loop_count; - options->thumbnails.quality = c_options->thumbnails.quality; options->image.zoom_quality = c_options->image.zoom_quality; options->image.zoom_increment = c_options->image.zoom_increment;
--- a/src/view_file.c Thu Apr 02 16:10:12 2009 +0000 +++ b/src/view_file.c Thu Apr 02 23:11:07 2009 +0000 @@ -615,6 +615,15 @@ return menu; } +void vf_thumb_update(ViewFile *vf) +{ + switch (vf->type) + { + case FILEVIEW_LIST: vflist_thumb_update(vf); break; + case FILEVIEW_ICON: vficon_thumb_update(vf); break; + } +} + gboolean vf_refresh(ViewFile *vf) { gboolean ret = FALSE;
--- a/src/view_file.h Thu Apr 02 16:10:12 2009 +0000 +++ b/src/view_file.h Thu Apr 02 23:11:07 2009 +0000 @@ -60,5 +60,7 @@ void vf_refresh_idle_cancel(ViewFile *vf); void vf_notify_cb(FileData *fd, NotifyType type, gpointer data); +void vf_thumb_update(ViewFile *vf); + #endif /* VIEW_FILE_H */ /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/view_file_icon.c Thu Apr 02 16:10:12 2009 +0000 +++ b/src/view_file_icon.c Thu Apr 02 23:11:07 2009 +0000 @@ -154,7 +154,6 @@ static void vficon_selection_remove(ViewFile *vf, IconData *id, SelectionType mask, GtkTreeIter *iter); static void vficon_move_focus(ViewFile *vf, gint row, gint col, gboolean relative); static void vficon_set_focus(ViewFile *vf, IconData *id); -static void vficon_thumb_update(ViewFile *vf); static void vficon_populate_at_new_size(ViewFile *vf, gint w, gint h, gboolean force); @@ -2030,12 +2029,30 @@ return FALSE; } -static void vficon_thumb_update(ViewFile *vf) +void vficon_thumb_update(ViewFile *vf) { vficon_thumb_stop(vf); vficon_thumb_status(vf, 0.0, _("Loading thumbs...")); vf->thumbs_running = TRUE; + + if (thumb_format_changed) + { + GList *work = vf->list; + while (work) + { + IconData *id = work->data; + FileData *fd = id->fd; + if (fd->thumb_pixbuf) + { + g_object_unref(fd->thumb_pixbuf); + fd->thumb_pixbuf = NULL; + } + work = work->next; + } + + thumb_format_changed = FALSE; + } while (vficon_thumb_next(vf)); }
--- a/src/view_file_icon.h Thu Apr 02 16:10:12 2009 +0000 +++ b/src/view_file_icon.h Thu Apr 02 23:11:07 2009 +0000 @@ -54,5 +54,7 @@ void vficon_mark_to_selection(ViewFile *vf, gint mark, MarkToSelectionMode mode); void vficon_selection_to_mark(ViewFile *vf, gint mark, SelectionToMarkMode mode); +void vficon_thumb_update(ViewFile *vf); + #endif /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/view_file_list.c Thu Apr 02 16:10:12 2009 +0000 +++ b/src/view_file_list.c Thu Apr 02 23:11:07 2009 +0000 @@ -1126,15 +1126,18 @@ GtkTreeModel *store; GtkTreeIter iter; gboolean valid = TRUE; - + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview)); gtk_tree_model_get_iter(store, &iter, tpath); gtk_tree_path_free(tpath); while (!fd && valid && tree_view_row_get_visibility(GTK_TREE_VIEW(vf->listview), &iter, FALSE) == 0) { - gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1); - if (fd->thumb_pixbuf) fd = NULL; + FileData *nfd; + + gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &nfd, -1); + + if (!nfd->thumb_pixbuf) fd = nfd; valid = gtk_tree_model_iter_next(store, &iter); } @@ -1195,7 +1198,7 @@ return FALSE; } -static void vflist_thumb_update(ViewFile *vf) +void vflist_thumb_update(ViewFile *vf) { vflist_thumb_stop(vf); if (!VFLIST(vf)->thumbs_enabled) return; @@ -1203,6 +1206,23 @@ vflist_thumb_status(vf, 0.0, _("Loading thumbs...")); vf->thumbs_running = TRUE; + if (thumb_format_changed) + { + GList *work = vf->list; + while (work) + { + FileData *fd = work->data; + if (fd->thumb_pixbuf) + { + g_object_unref(fd->thumb_pixbuf); + fd->thumb_pixbuf = NULL; + } + work = work->next; + } + + thumb_format_changed = FALSE; + } + while (vflist_thumb_next(vf)); }
--- a/src/view_file_list.h Thu Apr 02 16:10:12 2009 +0000 +++ b/src/view_file_list.h Thu Apr 02 23:11:07 2009 +0000 @@ -58,6 +58,7 @@ void vflist_selection_to_mark(ViewFile *vf, gint mark, SelectionToMarkMode mode); void vflist_color_set(ViewFile *vf, FileData *fd, gboolean color_set); +void vflist_thumb_update(ViewFile *vf); #endif /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */