[PATCH] - makes main toolbar optional -Bug 309810



Attached is patch to make the main toolbar optional in the nautilus browser as the pathbar/places sidebar makes it redundant.

This is a fix for bug:
http://bugzilla.gnome.org/show_bug.cgi?id=309810


--
Mr Jamie McCracken
http://www.advogato.org/person/jamiemcc/
Index: src/nautilus-navigation-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-navigation-window.c,v
retrieving revision 1.433
diff -u -r1.433 nautilus-navigation-window.c
--- src/nautilus-navigation-window.c	8 Jul 2005 11:25:51 -0000	1.433
+++ src/nautilus-navigation-window.c	8 Jul 2005 18:29:57 -0000
@@ -1031,6 +1031,29 @@
 	return TRUE;
 }
 
+
+void 
+nautilus_navigation_window_hide_toolbar (NautilusNavigationWindow *window)
+{
+	gtk_widget_hide (window->details->toolbar);
+	nautilus_navigation_window_update_show_hide_menu_items (window);
+	if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR) &&
+	    eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR)) {
+		eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR, FALSE);
+	}
+}
+
+void 
+nautilus_navigation_window_show_toolbar (NautilusNavigationWindow *window)
+{
+	gtk_widget_show (window->details->toolbar);
+	nautilus_navigation_window_update_show_hide_menu_items (window);
+	if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR) &&
+	    !eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR)) {
+		eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR, TRUE);
+	}
+}
+
 void 
 nautilus_navigation_window_hide_sidebar (NautilusNavigationWindow *window)
 {
@@ -1117,6 +1140,13 @@
 	/* Initially show or hide views based on preferences; once the window is displayed
 	 * these can be controlled on a per-window basis from View menu items. 
 	 */
+
+	if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR)) {
+		nautilus_navigation_window_show_toolbar (window);
+	} else {
+		nautilus_navigation_window_hide_toolbar (window);
+	}
+
 	if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR)) {
 		nautilus_navigation_window_show_location_bar (window, FALSE);
 	} else {
Index: src/nautilus-navigation-window-menus.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-navigation-window-menus.c,v
retrieving revision 1.279
diff -u -r1.279 nautilus-navigation-window-menus.c
--- src/nautilus-navigation-window-menus.c	8 Jul 2005 11:25:50 -0000	1.279
+++ src/nautilus-navigation-window-menus.c	8 Jul 2005 18:29:58 -0000
@@ -144,6 +144,23 @@
 }
 
 static void
+action_show_hide_toolbar_callback (GtkAction *action, 
+				   gpointer user_data)
+{
+	NautilusNavigationWindow *window;
+
+	window = NAUTILUS_NAVIGATION_WINDOW (user_data);
+
+	if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
+		nautilus_navigation_window_show_toolbar (window);
+	} else {
+		nautilus_navigation_window_hide_toolbar (window);
+	}
+}
+
+
+
+static void
 action_show_hide_sidebar_callback (GtkAction *action, 
 				   gpointer user_data)
 {
@@ -196,6 +213,11 @@
 	g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
 
 	action = gtk_action_group_get_action (window->details->navigation_action_group,
+					      NAUTILUS_ACTION_SHOW_HIDE_TOOLBAR);
+	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+				      nautilus_navigation_window_toolbar_showing (window));
+
+	action = gtk_action_group_get_action (window->details->navigation_action_group,
 					      NAUTILUS_ACTION_SHOW_HIDE_SIDEBAR);
 	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
 				      nautilus_navigation_window_sidebar_showing (window));
@@ -414,6 +436,11 @@
 };
 
 static const GtkToggleActionEntry navigation_toggle_entries[] = {
+  { "Show Hide Toolbar", NULL,                 /* name, stock id */
+    N_("_Main Toolbar"), NULL,                    /* label, accelerator */     
+    N_("Change the visibility of this window's main toolbar"),                       /* tooltip */
+    G_CALLBACK (action_show_hide_toolbar_callback),
+    TRUE}, /* is_active */
   { "Show Hide Sidebar", NULL,                 /* name, stock id */
     N_("_Side Pane"), "F9",                    /* label, accelerator */     
     N_("Change the visibility of this window's sidebar"),                       /* tooltip */
Index: src/nautilus-navigation-window-ui.xml
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-navigation-window-ui.xml,v
retrieving revision 1.11
diff -u -r1.11 nautilus-navigation-window-ui.xml
--- src/nautilus-navigation-window-ui.xml	22 Nov 2004 15:24:37 -0000	1.11
+++ src/nautilus-navigation-window-ui.xml	8 Jul 2005 18:29:58 -0000
@@ -11,6 +11,7 @@
 	</menu>
 	<menu action="View">
 		<placeholder name="Show Hide Placeholder">
+			<menuitem name="Show Hide Toolbar" action="Show Hide Toolbar"/>
 			<menuitem name="Show Hide Sidebar" action="Show Hide Sidebar"/>
 			<menuitem name="Show Hide Location Bar" action="Show Hide Location Bar"/>
 			<menuitem name="Show Hide Statusbar" action="Show Hide Statusbar"/>
Index: src/nautilus-actions.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-actions.h,v
retrieving revision 1.3
diff -u -r1.3 nautilus-actions.h
--- src/nautilus-actions.h	28 Jan 2005 08:49:42 -0000	1.3
+++ src/nautilus-actions.h	8 Jul 2005 18:29:58 -0000
@@ -33,6 +33,7 @@
 #define NAUTILUS_ACTION_UP_ACCEL "UpAccel"
 #define NAUTILUS_ACTION_UP_ACCEL "UpAccel"
 #define NAUTILUS_ACTION_FORWARD "Forward"
+#define NAUTILUS_ACTION_SHOW_HIDE_TOOLBAR "Show Hide Toolbar"
 #define NAUTILUS_ACTION_SHOW_HIDE_SIDEBAR "Show Hide Sidebar"
 #define NAUTILUS_ACTION_SHOW_HIDE_STATUSBAR "Show Hide Statusbar"
 #define NAUTILUS_ACTION_SHOW_HIDE_LOCATION_BAR "Show Hide Location Bar"
Index: libnautilus-private/nautilus-global-preferences.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-global-preferences.h,v
retrieving revision 1.129
diff -u -r1.129 nautilus-global-preferences.h
--- libnautilus-private/nautilus-global-preferences.h	8 Jul 2005 11:25:47 -0000	1.129
+++ libnautilus-private/nautilus-global-preferences.h	8 Jul 2005 18:29:58 -0000
@@ -85,6 +85,7 @@
 #define NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY		"preferences/always_use_location_entry"
 #define NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR		"preferences/start_with_status_bar"
 #define NAUTILUS_PREFERENCES_START_WITH_SIDEBAR		 	"preferences/start_with_sidebar"
+#define NAUTILUS_PREFERENCES_START_WITH_TOOLBAR			"preferences/start_with_toolbar"
 #define NAUTILUS_PREFERENCES_SIDE_PANE_VIEW                     "preferences/side_pane_view"
 #define NAUTILUS_PREFERENCES_NAVIGATION_WINDOW_SAVED_GEOMETRY 	"preferences/navigation_window_saved_geometry"
 
Index: libnautilus-private/nautilus-global-preferences.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-global-preferences.c,v
retrieving revision 1.222
diff -u -r1.222 nautilus-global-preferences.c
--- libnautilus-private/nautilus-global-preferences.c	8 Jul 2005 11:25:47 -0000	1.222
+++ libnautilus-private/nautilus-global-preferences.c	8 Jul 2005 18:29:59 -0000
@@ -390,6 +390,10 @@
 	  PREFERENCE_BOOLEAN,
 	  GINT_TO_POINTER (FALSE)
 	},
+	{ NAUTILUS_PREFERENCES_START_WITH_TOOLBAR,
+	  PREFERENCE_BOOLEAN,
+	  GINT_TO_POINTER (TRUE)
+	},
 	{ NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR,
 	  PREFERENCE_BOOLEAN,
 	  GINT_TO_POINTER (TRUE)


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