Skip to content

Commit

Permalink
lock directories shown in a folder window so we don't get into troubl…
Browse files Browse the repository at this point in the history
…e with the automounter
  • Loading branch information
donald authored and david committed Jun 18, 2018
1 parent 4b23103 commit 15fded1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions thunar/thunar-folder.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

#define DEBUG_FILE_CHANGES FALSE

#include <fcntl.h>



/* property identifiers */
Expand Down Expand Up @@ -119,6 +121,9 @@ struct _ThunarFolder
ThunarFileMonitor *file_monitor;

GFileMonitor *monitor;

int dir_lock_fd;

};


Expand Down Expand Up @@ -250,6 +255,7 @@ thunar_folder_init (ThunarFolder *folder)

folder->monitor = NULL;
folder->reload_info = FALSE;
folder->dir_lock_fd=-1;
}


Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 15fded1

Please sign in to comment.