diff --git a/thunar/thunar-folder.c b/thunar/thunar-folder.c index a90988e4b..1b2e33732 100644 --- a/thunar/thunar-folder.c +++ b/thunar/thunar-folder.c @@ -31,6 +31,8 @@ #define DEBUG_FILE_CHANGES FALSE +#include + /* property identifiers */ @@ -119,6 +121,9 @@ struct _ThunarFolder ThunarFileMonitor *file_monitor; GFileMonitor *monitor; + + int dir_lock_fd; + }; @@ -250,6 +255,7 @@ thunar_folder_init (ThunarFolder *folder) folder->monitor = NULL; folder->reload_info = FALSE; + folder->dir_lock_fd=-1; } @@ -317,6 +323,13 @@ thunar_folder_finalize (GObject *object) /* release references to the current files */ thunar_g_file_list_free (folder->files); + + if (folder->dir_lock_fd>=0) { + close (folder->dir_lock_fd); + folder->dir_lock_fd=-1; + } + + (*G_OBJECT_CLASS (thunar_folder_parent_class)->finalize) (object); } @@ -890,6 +903,14 @@ thunar_folder_get_for_file (ThunarFile *file) /* schedule the loading of the folder */ thunar_folder_reload (folder, FALSE); + + GFile* gfile = thunar_file_get_file(file); + if (gfile) { + char *path=g_file_get_path (gfile); + if (path) { + folder->dir_lock_fd=open(path,O_RDONLY+O_DIRECTORY); + } + } } return folder;