speed-up of directory notification on deleting large number of files
authorVladimir Nadvornik <nadvornik@suse.cz>
Sun, 27 Jul 2008 13:46:24 +0000 (13:46 +0000)
committerVladimir Nadvornik <nadvornik@suse.cz>
Sun, 27 Jul 2008 13:46:24 +0000 (13:46 +0000)
src/filedata.c
src/typedefs.h
src/view_dir.c

index bfdc90a..58ec1a9 100644 (file)
@@ -235,6 +235,7 @@ static gboolean file_data_check_changed_files_recursive(FileData *fd, struct sta
                {
                fd->size = st->st_size;
                fd->date = st->st_mtime;
+               fd->mode = st->st_mode;
                if (fd->thumb_pixbuf) g_object_unref(fd->thumb_pixbuf);
                fd->thumb_pixbuf = NULL;
                file_data_increment_version(fd);
@@ -351,6 +352,7 @@ static FileData *file_data_new(const gchar *path_utf8, struct stat *st, gboolean
 
        fd->size = st->st_size;
        fd->date = st->st_mtime;
+       fd->mode = st->st_mode;
        fd->thumb_pixbuf = NULL;
        fd->sidecar_files = NULL;
        fd->ref = 1;
index 7581f33..c12aae1 100644 (file)
@@ -457,6 +457,7 @@ struct _FileData {
        gchar *collate_key_name_nocase;
        gint64 size;
        time_t date;
+       mode_t mode; /* this is needed at least for notification in view_dir because it is preserved after the file/directory is deleted */
        guint marks;
        GList *sidecar_files;
        FileData *parent; /* parent file if this is a sidecar file, NULL otherwise */
index ad582cb..55262e8 100644 (file)
@@ -1041,7 +1041,7 @@ static void vd_notify_cb(FileData *fd, NotifyType type, gpointer data)
        gboolean refresh;
        gchar *base;
 
-       if (!isdir(fd->path) && isname(fd->path)) return;
+       if (!S_ISDIR(fd->mode)) return; /* this gives correct results even on recently deleted files/directories */
 
        base = remove_level_from_path(fd->path);