changeset 355:0b82646e977f

Let toggle the visibility of hidden files from directories list or tree contextual menu.
author zas_
date Sun, 13 Apr 2008 18:56:24 +0000
parents 5c82855feba7
children 673d1eb5af73
files src/view_dir_list.c src/view_dir_tree.c
diffstat 2 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/view_dir_list.c	Sun Apr 13 12:24:42 2008 +0000
+++ b/src/view_dir_list.c	Sun Apr 13 18:56:24 2008 +0000
@@ -371,6 +371,14 @@
 	if (vdl->layout) layout_refresh(vdl->layout);
 }
 
+static void vdlist_toggle_show_dot_files_cb(GtkWidget *widget, gpointer data)
+{
+	ViewDirList *vdl = data;
+
+	options->file_filter.show_dot_files = !options->file_filter.show_dot_files;
+	if (vdl->layout) layout_refresh(vdl->layout);
+}
+
 static GtkWidget *vdlist_pop_menu(ViewDirList *vdl, FileData *fd)
 {
 	GtkWidget *menu;
@@ -418,6 +426,9 @@
 	menu_item_add_divider(menu);
 	menu_item_add_check(menu, _("View as _tree"), FALSE,
 			    G_CALLBACK(vdlist_pop_menu_tree_cb), vdl);
+	menu_item_add_check(menu, _("Show _hidden files"), options->file_filter.show_dot_files,
+			    G_CALLBACK(vdlist_toggle_show_dot_files_cb), vdl);
+
 	menu_item_add_stock(menu, _("Re_fresh"), GTK_STOCK_REFRESH,
 			    G_CALLBACK(vdlist_pop_menu_refresh_cb), vdl);
 
--- a/src/view_dir_tree.c	Sun Apr 13 12:24:42 2008 +0000
+++ b/src/view_dir_tree.c	Sun Apr 13 18:56:24 2008 +0000
@@ -462,6 +462,14 @@
 	if (vdt->layout) layout_refresh(vdt->layout);
 }
 
+static void vdtree_toggle_show_dot_files_cb(GtkWidget *widget, gpointer data)
+{
+	ViewDirTree *vdt = data;
+
+	options->file_filter.show_dot_files = !options->file_filter.show_dot_files;
+	if (vdt->layout) layout_refresh(vdt->layout);
+}
+
 static GtkWidget *vdtree_pop_menu(ViewDirTree *vdt, FileData *fd)
 {
 	GtkWidget *menu;
@@ -513,6 +521,9 @@
 	menu_item_add_divider(menu);
 	menu_item_add_check(menu, _("View as _tree"), TRUE,
 			    G_CALLBACK(vdtree_pop_menu_tree_cb), vdt);
+	menu_item_add_check(menu, _("Show _hidden files"), options->file_filter.show_dot_files,
+			    G_CALLBACK(vdtree_toggle_show_dot_files_cb), vdt);
+
 	menu_item_add_stock(menu, _("Re_fresh"), GTK_STOCK_REFRESH,
 			    G_CALLBACK(vdtree_pop_menu_refresh_cb), vdt);