changeset 877:21e324dcd78c

refresh thumbnails on file change
author nadvornik
date Thu, 03 Jul 2008 20:16:15 +0000
parents 2d8705f33da5
children 1b14c0e177ad
files src/main.c src/thumb.c src/thumb.h
diffstat 3 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.c	Thu Jul 03 19:38:19 2008 +0000
+++ b/src/main.c	Thu Jul 03 20:16:15 2008 +0000
@@ -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 @@
 
 	/* 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);
--- a/src/thumb.c	Thu Jul 03 19:38:19 2008 +0000
+++ b/src/thumb.c	Thu Jul 03 20:16:15 2008 +0000
@@ -530,6 +530,18 @@
 }
 #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)
--- a/src/thumb.h	Thu Jul 03 19:38:19 2008 +0000
+++ b/src/thumb.h	Thu Jul 03 20:16:15 2008 +0000
@@ -28,5 +28,6 @@
 
 GdkPixbuf *thumb_loader_get_pixbuf(ThumbLoader *tl);
 
+void thumb_notify_cb(FileData *fd, NotifyType type, gpointer data);
 
 #endif