keep files with non-zero marks in memory
authorVladimir Nadvornik <nadvornik@suse.cz>
Sat, 16 Aug 2008 20:57:40 +0000 (20:57 +0000)
committerVladimir Nadvornik <nadvornik@suse.cz>
Sat, 16 Aug 2008 20:57:40 +0000 (20:57 +0000)
src/filedata.c

index 0e8b5f3..718857f 100644 (file)
@@ -1061,9 +1061,20 @@ gboolean file_data_get_mark(FileData *fd, gint n)
 
 void file_data_set_mark(FileData *fd, gint n, gboolean value)
 {
+       guint old = fd->marks;
        if (!value == !(fd->marks & (1 << n))) return;
 
        fd->marks = fd->marks ^ (1 << n);
+       
+       if (old && !fd->marks) /* keep files with non-zero marks in memory */
+               {
+               file_data_unref(fd);
+               }
+       else if (!old && fd->marks)
+               {
+               file_data_ref(fd);
+               }
+       
        file_data_increment_version(fd);
        file_data_send_notification(fd, NOTIFY_TYPE_INTERNAL);
 }