changeset 1720:808d4308ca00

remove deleted files from metadata queue
author nadvornik
date Sat, 22 Aug 2009 21:58:49 +0000
parents 192d4752fd06
children 46284779a897
files src/main.c src/metadata.c src/metadata.h
diffstat 3 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.c	Sat Aug 22 20:20:19 2009 +0000
+++ b/src/main.c	Sat Aug 22 21:58:49 2009 +0000
@@ -759,6 +759,8 @@
 	file_data_register_notify_func(thumb_notify_cb, NULL, NOTIFY_PRIORITY_HIGH);
 	file_data_register_notify_func(histogram_notify_cb, NULL, NOTIFY_PRIORITY_HIGH);
 	file_data_register_notify_func(collect_manager_notify_cb, NULL, NOTIFY_PRIORITY_LOW);
+	file_data_register_notify_func(metadata_notify_cb, NULL, NOTIFY_PRIORITY_LOW);
+	
 
 	gtkrc_load();
 	 
--- a/src/metadata.c	Sat Aug 22 20:20:19 2009 +0000
+++ b/src/metadata.c	Sat Aug 22 21:58:49 2009 +0000
@@ -126,6 +126,18 @@
 	return ret;
 }
 
+void metadata_notify_cb(FileData *fd, NotifyType type, gpointer data)
+{
+	if ((type & (NOTIFY_REREAD | NOTIFY_CHANGE)) && g_list_find(metadata_write_queue, fd)) 
+		{
+		DEBUG_1("Notify metadata: %s %04x", fd->path, type);
+		if (!isname(fd->path))
+			{
+			/* ignore deleted files */
+			metadata_write_queue_remove(fd);
+			}
+		}
+}
 
 gboolean metadata_write_queue_confirm(gboolean force_dialog, FileUtilDoneFunc done_func, gpointer done_data)
 {
@@ -138,6 +150,13 @@
 		FileData *fd = work->data;
 		work = work->next;
 		
+		if (!isname(fd->path))
+			{
+			/* ignore deleted files */
+			metadata_write_queue_remove(fd);
+			continue;
+			}
+		
 		if (fd->change) continue; /* another operation in progress, skip this file for now */
 		
 		to_approve = g_list_prepend(to_approve, file_data_ref(fd));
--- a/src/metadata.h	Sat Aug 22 20:20:19 2009 +0000
+++ b/src/metadata.h	Sat Aug 22 21:58:49 2009 +0000
@@ -22,6 +22,7 @@
 gboolean metadata_write_queue_remove_list(GList *list);
 gboolean metadata_write_perform(FileData *fd);
 gboolean metadata_write_queue_confirm(gboolean force_dialog, FileUtilDoneFunc done_func, gpointer done_data);
+void metadata_notify_cb(FileData *fd, NotifyType type, gpointer data);
 
 gint metadata_queue_length(void);