changeset 373:61a3c8b05b24

Add a new option in Preferences > Filtering to allow the user to choose to display '.' directory in folder lists or not. This option is saved to rc file as file_filter.show_dot_directory. A minor fix was made to disable display of .. in folder selection dialogs when current path is /.
author zas_
date Tue, 15 Apr 2008 20:36:11 +0000
parents 8ce8d565c038
children a264519f1c21
files src/globals.c src/preferences.c src/rcfile.c src/typedefs.h src/ui_pathsel.c src/view_dir_list.c
diffstat 6 files changed, 24 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/globals.c	Tue Apr 15 20:00:27 2008 +0000
+++ b/src/globals.c	Tue Apr 15 20:36:11 2008 +0000
@@ -67,7 +67,9 @@
 	options->thumbnails.fast = TRUE;
 	options->thumbnails.spec_standard = TRUE;
 	options->enable_metadata_dirs = FALSE;
+
 	options->file_filter.show_hidden_files = FALSE;
+	options->file_filter.show_dot_directory = FALSE;
 	options->file_filter.disable = FALSE;
 	
 	
--- a/src/preferences.c	Tue Apr 15 20:00:27 2008 +0000
+++ b/src/preferences.c	Tue Apr 15 20:36:11 2008 +0000
@@ -179,6 +179,7 @@
 	if (buf && strlen(buf) > 0) options->file_ops.safe_delete_path = remove_trailing_slash(buf);
 
 	if (options->file_filter.show_hidden_files != c_options->file_filter.show_hidden_files) refresh = TRUE;
+	if (options->file_filter.show_dot_directory != c_options->file_filter.show_dot_directory) refresh = TRUE;
 	if (options->file_sort.case_sensitive != c_options->file_sort.case_sensitive) refresh = TRUE;
 	if (options->file_filter.disable != c_options->file_filter.disable) refresh = TRUE;
 
@@ -209,6 +210,8 @@
 	options->thumbnails.spec_standard = c_options->thumbnails.spec_standard;
 	options->enable_metadata_dirs = c_options->enable_metadata_dirs;
 	options->file_filter.show_hidden_files = c_options->file_filter.show_hidden_files;
+	options->file_filter.show_dot_directory = c_options->file_filter.show_dot_directory;
+
 	options->file_sort.case_sensitive = c_options->file_sort.case_sensitive;
 	options->file_filter.disable = c_options->file_filter.disable;
 
@@ -1031,6 +1034,8 @@
 
 	pref_checkbox_new_int(group, _("Show hidden files or folders"),
 			      options->file_filter.show_hidden_files, &c_options->file_filter.show_hidden_files);
+	pref_checkbox_new_int(group, _("Show dot directory"),
+			      options->file_filter.show_dot_directory, &c_options->file_filter.show_dot_directory);
 	pref_checkbox_new_int(group, _("Case sensitive sort"),
 			      options->file_sort.case_sensitive, &c_options->file_sort.case_sensitive);
 
--- a/src/rcfile.c	Tue Apr 15 20:00:27 2008 +0000
+++ b/src/rcfile.c	Tue Apr 15 20:36:11 2008 +0000
@@ -433,6 +433,7 @@
 	WRITE_SUBTITLE("Filtering Options");
 
 	WRITE_BOOL(file_filter.show_hidden_files);
+	WRITE_BOOL(file_filter.show_dot_directory);
 	WRITE_BOOL(file_filter.disable);
 	WRITE_SEPARATOR();
 
@@ -706,6 +707,7 @@
 		/* filtering options */
 
 		READ_BOOL(file_filter.show_hidden_files);
+		READ_BOOL(file_filter.show_dot_directory);
 		READ_BOOL(file_filter.disable);
 
 		if (strcasecmp(option, "file_filter.ext") == 0)
--- a/src/typedefs.h	Tue Apr 15 20:00:27 2008 +0000
+++ b/src/typedefs.h	Tue Apr 15 20:36:11 2008 +0000
@@ -802,6 +802,7 @@
 	/* file filtering */
 	struct {
 		gint show_hidden_files;
+		gint show_dot_directory;
 		gint disable;
 	} file_filter;
 
--- a/src/ui_pathsel.c	Tue Apr 15 20:00:27 2008 +0000
+++ b/src/ui_pathsel.c	Tue Apr 15 20:36:11 2008 +0000
@@ -178,6 +178,12 @@
 		}
 	while ((dir = readdir(dp)) != NULL)
 		{
+		if (!options->file_filter.show_dot_directory
+		    && dir->d_name[0] == '.' && dir->d_name[1] == '\0')
+		    	continue;
+		if (dir->d_name[0] == '.' && dir->d_name[1] == '.' && dir->d_name[2] == '\0'
+		    && pathl[0] == '/' && pathl[1] == '\0')
+		    	continue; /* no .. for root directory */
 		if (dd->show_hidden || !is_hidden(dir->d_name))
 			{
 			gchar *name = dir->d_name;
--- a/src/view_dir_list.c	Tue Apr 15 20:00:27 2008 +0000
+++ b/src/view_dir_list.c	Tue Apr 15 20:36:11 2008 +0000
@@ -861,10 +861,14 @@
 		vdl->list = g_list_prepend(vdl->list, fd);
 		g_free(filepath);
 		}
-	filepath = g_strconcat(vdl->path, "/", ".", NULL); 
-	fd = file_data_new_simple(filepath);
-	vdl->list = g_list_prepend(vdl->list, fd);
-	g_free(filepath);
+	
+	if (options->file_filter.show_dot_directory)
+		{
+		filepath = g_strconcat(vdl->path, "/", ".", NULL); 
+		fd = file_data_new_simple(filepath);
+		vdl->list = g_list_prepend(vdl->list, fd);
+		g_free(filepath);
+	}
 
 	vdlist_populate(vdl);