[Nautilus-list] hack that puts a menu item to toggle hidden files viewage



in my quest to someday become a hacker, i made a little hack that adds a item in the view menu to toggle if hidden files are soon. its nothing fancy, but im sure someone on the list might want to try it. i think this patch should work, its the first patch i have ever made and was taken against HEAD.
Index: src/nautilus-shell-ui.xml
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-shell-ui.xml,v
retrieving revision 1.62
diff -d -u -r1.62 nautilus-shell-ui.xml
--- src/nautilus-shell-ui.xml	2001/04/25 03:47:07	1.62
+++ src/nautilus-shell-ui.xml	2001/04/26 04:37:20
@@ -156,6 +156,10 @@
 				  _label="Hide St_atus Bar"
 				  _tip="Change the visibility of this window's status bar"
 				  verb="Show Hide Status Bar"/>
+		    <menuitem name="Toggle Hidden Files"
+		          _label="Toggle _Hidden Files"
+		          _tip="Toggle the visibility of hidden files"
+		          verb="Toggle Hidden Files"/>
 		</placeholder>
 		<placeholder name="View Preferences Placeholder" delimit = "top"/>
 		<placeholder name="View Items Placeholder" delimit="top"/>
Index: src/nautilus-window-menus.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-menus.c,v
retrieving revision 1.193
diff -d -u -r1.193 nautilus-window-menus.c
--- src/nautilus-window-menus.c	2001/04/20 02:01:41	1.193
+++ src/nautilus-window-menus.c	2001/04/26 04:37:21
@@ -454,6 +454,19 @@
 		nautilus_window_show_status_bar (window);
 	}
 }
+static gboolean show_hidden_files = TRUE;
+static void
+view_menu_toggle_hidden_files_callback (BonoboUIComponent *component, 
+			                 gpointer user_data, 
+			                 const char *verb) 
+{
+	show_hidden_files = nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
+	if (show_hidden_files == TRUE) {
+		nautilus_preferences_set_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,FALSE);
+	} else {
+		nautilus_preferences_set_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,TRUE);
+	}		
+}
 
 void
 nautilus_window_update_show_hide_menu_items (NautilusWindow *window) 
@@ -1260,6 +1273,7 @@
 		BONOBO_UI_VERB ("Show Hide Toolbar", view_menu_show_hide_toolbar_callback),
 		BONOBO_UI_VERB ("Show Hide Location Bar", view_menu_show_hide_location_bar_callback),
 		BONOBO_UI_VERB ("Show Hide Status Bar", view_menu_show_hide_status_bar_callback),
+		BONOBO_UI_VERB ("Toggle Hidden Files", view_menu_toggle_hidden_files_callback),
 		BONOBO_UI_VERB ("Zoom In", view_menu_zoom_in_callback),
 		BONOBO_UI_VERB ("Zoom Out", view_menu_zoom_out_callback),
 		BONOBO_UI_VERB ("Zoom Normal", view_menu_zoom_normal_callback),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]