remove deleted files from metadata queue
authorVladimir Nadvornik <nadvornik@suse.cz>
Sat, 22 Aug 2009 21:58:49 +0000 (21:58 +0000)
committerVladimir Nadvornik <nadvornik@suse.cz>
Sat, 22 Aug 2009 21:58:49 +0000 (21:58 +0000)
src/main.c
src/metadata.c
src/metadata.h

index 3e407a1..6685f86 100644 (file)
@@ -759,6 +759,8 @@ gint main(gint argc, gchar *argv[])
        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();
         
index cca2110..de671ee 100644 (file)
@@ -126,6 +126,18 @@ gboolean metadata_write_queue_remove_list(GList *list)
        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 @@ gboolean metadata_write_queue_confirm(gboolean force_dialog, FileUtilDoneFunc do
                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));
index 3a481fe..639da6d 100644 (file)
@@ -22,6 +22,7 @@ gboolean metadata_write_queue_remove(FileData *fd);
 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);