changeset 945:fd84847c8231

speed-up of directory notification on deleting large number of files
author nadvornik
date Sun, 27 Jul 2008 13:46:24 +0000
parents e73552743bda
children 1d6e01950e85
files src/filedata.c src/typedefs.h src/view_dir.c
diffstat 3 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/filedata.c	Sun Jul 27 09:51:28 2008 +0000
+++ b/src/filedata.c	Sun Jul 27 13:46:24 2008 +0000
@@ -235,6 +235,7 @@
 		{
 		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 @@
 
 	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;
--- a/src/typedefs.h	Sun Jul 27 09:51:28 2008 +0000
+++ b/src/typedefs.h	Sun Jul 27 13:46:24 2008 +0000
@@ -457,6 +457,7 @@
 	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 */
--- a/src/view_dir.c	Sun Jul 27 09:51:28 2008 +0000
+++ b/src/view_dir.c	Sun Jul 27 13:46:24 2008 +0000
@@ -1041,7 +1041,7 @@
 	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);