changeset 164:f8bd5d49eed8

update FileData on file change
author nadvornik
date Thu, 20 Dec 2007 22:43:52 +0000
parents e3f12d4abc04
children d7067ec71042
files src/filelist.c
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/filelist.c	Thu Dec 20 16:18:28 2007 +0000
+++ b/src/filelist.c	Thu Dec 20 22:43:52 2007 +0000
@@ -668,6 +668,18 @@
 		fd->extension = fd->name + strlen(fd->name);
 }
 
+static void file_data_check_update(FileData *fd, struct stat *st)
+{
+	if (fd->size != st->st_size ||
+	    fd->date != st->st_mtime)
+		{
+		fd->size = st->st_size;
+		fd->date = st->st_mtime;
+		if (fd->pixbuf) g_object_unref(fd->pixbuf);
+		fd->pixbuf = NULL;
+		}
+}
+
 static void file_data_check_sidecars(FileData *fd);
 static GHashTable *file_data_pool = NULL;
 
@@ -683,6 +695,7 @@
 	fd = g_hash_table_lookup(file_data_pool, path_utf8);
 	if (fd)
 		{
+		file_data_check_update(fd, st);
 		printf("file_data_pool hit: '%s'\n", fd->path);
 		return file_data_ref(fd);
 		}