[nautilus] Fix View -> Location Bar in dual pane mode.



commit 8bafe8109f2151ee1febfc4a00255b92053c2ef8
Author: Holger Berndt <berndth gmx de>
Date:   Thu Jun 25 02:02:09 2009 +0200

    Fix View -> Location Bar in dual pane mode.
    
    Although each pane has a separate location bar, the show/hide location
    bar setting is window-global instead of applying to individual panes:
    Either both panes have a location bar, or neither one
    does. Inconsistencies with remembered show/hide location bar gconf
    setting were also fixed.

 src/nautilus-navigation-window-menus.c |   24 ++++++++++++++++++------
 src/nautilus-navigation-window.c       |   13 +++++++++++++
 2 files changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
index 07f6ada..2926fdd 100644
--- a/src/nautilus-navigation-window-menus.c
+++ b/src/nautilus-navigation-window-menus.c
@@ -204,6 +204,18 @@ action_show_hide_sidebar_callback (GtkAction *action,
 }
 
 static void
+pane_show_hide_location_bar (NautilusNavigationWindowPane *pane, gboolean is_active)
+{
+	if (nautilus_navigation_window_pane_location_bar_showing (pane) != is_active) {
+		if (is_active) {
+			nautilus_navigation_window_pane_show_location_bar (pane, TRUE);
+		} else {
+			nautilus_navigation_window_pane_hide_location_bar (pane, TRUE);
+		}
+	}
+}
+
+static void
 action_show_hide_location_bar_callback (GtkAction *action, 
 					gpointer user_data)
 {
@@ -214,13 +226,13 @@ action_show_hide_location_bar_callback (GtkAction *action,
 	window = NAUTILUS_WINDOW (user_data);
 
 	is_active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+
+	/* Do the active pane first, because this will trigger an update of the menu items,
+	 * which in turn relies on the active pane. */
+	pane_show_hide_location_bar (NAUTILUS_NAVIGATION_WINDOW_PANE (window->details->active_pane), is_active);
+
 	for (walk = window->details->panes; walk; walk = walk->next) {
-		NautilusNavigationWindowPane *pane = walk->data;
-		if (is_active) {
-			nautilus_navigation_window_pane_show_location_bar (pane, TRUE);
-		} else {
-			nautilus_navigation_window_pane_hide_location_bar (pane, TRUE);
-		}
+		pane_show_hide_location_bar (NAUTILUS_NAVIGATION_WINDOW_PANE (walk->data), is_active);
 	}
 }
 
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index 3e7c0cd..e9f147f 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -1254,6 +1254,19 @@ split_view_added_to_container_callback (GtkContainer *container,
 					GtkWidget *widget,
 					gpointer user_data)
 {
+	NautilusNavigationWindowPane *pane;
+	GtkAction *action;
+
+	/* now that view is ready, show the location bar if the active pane has one, too */
+	pane = NAUTILUS_NAVIGATION_WINDOW_PANE (user_data);
+	action = gtk_action_group_get_action (NAUTILUS_NAVIGATION_WINDOW (NAUTILUS_WINDOW_PANE (pane)->window)->details->navigation_action_group,
+					      NAUTILUS_ACTION_SHOW_HIDE_LOCATION_BAR);
+	if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
+		nautilus_navigation_window_pane_show_location_bar (pane, TRUE);
+	} else {
+		nautilus_navigation_window_pane_hide_location_bar (pane, TRUE);
+	}
+
 	/* list view doesn't focus automatically */
 	if (FM_IS_LIST_VIEW (widget)) {
 		GtkWidget *focus_widget;



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