refresh thumbnails on file change
authorVladimir Nadvornik <nadvornik@suse.cz>
Thu, 3 Jul 2008 20:16:15 +0000 (20:16 +0000)
committerVladimir Nadvornik <nadvornik@suse.cz>
Thu, 3 Jul 2008 20:16:15 +0000 (20:16 +0000)
src/main.c
src/thumb.c
src/thumb.h

index fd9ed90..7b2acdb 100644 (file)
@@ -28,6 +28,7 @@
 #include "ui_fileops.h"
 #include "ui_utildlg.h"
 #include "cache_maint.h"
+#include "thumb.h"
 
 #include <gdk/gdkkeysyms.h> /* for keyboard values */
 
@@ -689,6 +690,7 @@ int main(int argc, char *argv[])
 
        /* register global notify functions */
        file_data_register_notify_func(cache_notify_cb, NULL, NOTIFY_PRIORITY_HIGH);
+       file_data_register_notify_func(thumb_notify_cb, NULL, NOTIFY_PRIORITY_HIGH);
        file_data_register_notify_func(collect_manager_notify_cb, NULL, NOTIFY_PRIORITY_LOW);
 
        parse_command_line_for_debug_option(argc, argv);
index eb69b91..86493a4 100644 (file)
@@ -530,6 +530,18 @@ gint thumb_from_xpm_d(const char **data, gint max_w, gint max_h, GdkPixmap **pix
 }
 #endif
 
+
+/* release thumb_pixbuf on file change - this forces reload. */
+void thumb_notify_cb(FileData *fd, NotifyType type, gpointer data)
+{
+       if (type != NOTIFY_TYPE_INTERNAL && fd->thumb_pixbuf)
+               {
+               g_object_unref(fd->thumb_pixbuf);
+               fd->thumb_pixbuf = NULL;
+               }
+}
+
+
 /*
  *-----------------------------------------------------------------------------
  * xvpics thumbnail support, read-only (private)
index 614efad..cc807ca 100644 (file)
@@ -28,5 +28,6 @@ void thumb_loader_free(ThumbLoader *tl);
 
 GdkPixbuf *thumb_loader_get_pixbuf(ThumbLoader *tl);
 
+void thumb_notify_cb(FileData *fd, NotifyType type, gpointer data);
 
 #endif