Revision: 1602
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1602&view=rev
Author:   zas_
Date:     2009-04-02 23:11:07 +0000 (Thu, 02 Apr 2009)

Log Message:
-----------
Force thumbnails refreshing when thumbnails dimensions are modified through 
Preferences.

Modified Paths:
--------------
    trunk/src/layout.c
    trunk/src/main.c
    trunk/src/main.h
    trunk/src/preferences.c
    trunk/src/view_file.c
    trunk/src/view_file.h
    trunk/src/view_file_icon.c
    trunk/src/view_file_icon.h
    trunk/src/view_file_list.c
    trunk/src/view_file_list.h

Modified: trunk/src/layout.c
===================================================================
--- trunk/src/layout.c  2009-04-02 16:10:12 UTC (rev 1601)
+++ trunk/src/layout.c  2009-04-02 23:11:07 UTC (rev 1602)
@@ -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);
+       
+       layout_list_sync_thumb(lw);
 
-       switch (lw->options.file_view_type)
-       {
-       case FILEVIEW_ICON:
-               break;
-       case FILEVIEW_LIST:
-               vf_thumb_set(lw->vf, lw->options.show_thumbnails);
-               break;
-       }
-
        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)

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c    2009-04-02 16:10:12 UTC (rev 1601)
+++ trunk/src/main.c    2009-04-02 23:11:07 UTC (rev 1602)
@@ -46,10 +46,9 @@
 #include <pwd.h>
 #endif
 
-
+gboolean thumb_format_changed = FALSE;
 static RemoteConnection *remote_connection = NULL;
 
-
 /*
  *-----------------------------------------------------------------------------
  * keyboard functions

Modified: trunk/src/main.h
===================================================================
--- trunk/src/main.h    2009-04-02 16:10:12 UTC (rev 1601)
+++ trunk/src/main.h    2009-04-02 23:11:07 UTC (rev 1602)
@@ -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);
 

Modified: trunk/src/preferences.c
===================================================================
--- trunk/src/preferences.c     2009-04-02 16:10:12 UTC (rev 1601)
+++ trunk/src/preferences.c     2009-04-02 23:11:07 UTC (rev 1602)
@@ -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;

Modified: trunk/src/view_file.c
===================================================================
--- trunk/src/view_file.c       2009-04-02 16:10:12 UTC (rev 1601)
+++ trunk/src/view_file.c       2009-04-02 23:11:07 UTC (rev 1602)
@@ -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;

Modified: trunk/src/view_file.h
===================================================================
--- trunk/src/view_file.h       2009-04-02 16:10:12 UTC (rev 1601)
+++ trunk/src/view_file.h       2009-04-02 23:11:07 UTC (rev 1602)
@@ -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: */

Modified: trunk/src/view_file_icon.c
===================================================================
--- trunk/src/view_file_icon.c  2009-04-02 16:10:12 UTC (rev 1601)
+++ trunk/src/view_file_icon.c  2009-04-02 23:11:07 UTC (rev 1602)
@@ -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,13 +2029,31 @@
        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));
 }
 

Modified: trunk/src/view_file_icon.h
===================================================================
--- trunk/src/view_file_icon.h  2009-04-02 16:10:12 UTC (rev 1601)
+++ trunk/src/view_file_icon.h  2009-04-02 23:11:07 UTC (rev 1602)
@@ -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: */

Modified: trunk/src/view_file_list.c
===================================================================
--- trunk/src/view_file_list.c  2009-04-02 16:10:12 UTC (rev 1601)
+++ trunk/src/view_file_list.c  2009-04-02 23:11:07 UTC (rev 1602)
@@ -1126,16 +1126,19 @@
                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));
 }
 

Modified: trunk/src/view_file_list.h
===================================================================
--- trunk/src/view_file_list.h  2009-04-02 16:10:12 UTC (rev 1601)
+++ trunk/src/view_file_list.h  2009-04-02 23:11:07 UTC (rev 1602)
@@ -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: */


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to