[nautilus] Move location bar entries to pane



commit f14e7d47456867899016889756f32120dda847fb
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Dec 9 21:23:56 2009 +0100

    Move location bar entries to pane
    
    Location bar entries are pane-specific, not window
    specific. Therefore, it is neccessary to move significant parts of the
    logic around, mainly from NautilusWindow to NautilusWindowPane, and
    NautilusNavigationWindow to NautilisNavigationWindowPane.
    
    In particular, the following functions have been moved into the pane:
    
    bookmark_list_get_uri_index
    restore_focus_widget
    search_bar_activate_callback
    search_bar_cancel_callback
    navigation_bar_cancel_callback
    navigation_bar_location_changed_callback
    location_button_should_be_active
    location_button_toggled_cb
    path_bar_location_changed_callback
    path_bar_button_pressed_callback
    path_bar_button_released_callback
    path_bar_button_drag_begin_callback
    path_bar_path_set_callback
    nautilus_navigation_window_show_location_bar_temporarily
    nautilus_navigation_window_show_navigation_bar_temporarily
    nautilus_navigation_window_path_bar_showing
    nautilus_navigation_window_set_bar_mode
    nautilus_navigation_window_search_bar_showing
    nautilus_navigation_window_hide_location_bar
    nautilus_navigation_window_show_location_bar
    nautilus_navigation_window_location_bar_showing
    nautilus_window_zoom_{in,out,to_level,to_default}
    
    The location bar setup parts of nautilus_navigation_window_init() have
    been moved to nautilus_navigation_window_pane_setup_location_bar.
    
    The following fuctions have been made public:
    
    hide_temporary_bars
    load_view_as_menu
    unset_focus_widget
    update_up_button
    
    Much logic of the following functions has been moved to the pane, but
    the functions themselves have been left in the window as triggers:
    
    nautilus_navigation_window_hide_temporary_bars
    nautilus_window_sync_location_widgets

 src/nautilus-application.c             |    2 +-
 src/nautilus-location-bar.c            |   11 +-
 src/nautilus-location-bar.h            |    5 +-
 src/nautilus-navigation-window-menus.c |   25 +-
 src/nautilus-navigation-window-pane.c  |  595 +++++++++++++++++++++++++++
 src/nautilus-navigation-window-pane.h  |   45 ++-
 src/nautilus-navigation-window-slot.c  |    3 +-
 src/nautilus-navigation-window.c       |  699 +++++---------------------------
 src/nautilus-navigation-window.h       |   27 +-
 src/nautilus-window-manage-views.c     |   76 +---
 src/nautilus-window-manage-views.h     |    1 +
 src/nautilus-window-pane.c             |  102 +++++
 src/nautilus-window-pane.h             |   10 +
 src/nautilus-window-private.h          |   16 +-
 src/nautilus-window.c                  |  129 ++++---
 15 files changed, 980 insertions(+), 766 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index d638624..ab7c823 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -2008,7 +2008,7 @@ nautilus_application_load_session (NautilusApplication *application)
 								nautilus_window_slot_open_location (slot, location, FALSE);
 								
 								if (xmlHasProp (slot_node, "active")) {
-									nautilus_window_set_active_slot (slot->pane, slot);
+									nautilus_window_set_active_slot (slot->pane->window, slot);
 								}
 								
 								i++;
diff --git a/src/nautilus-location-bar.c b/src/nautilus-location-bar.c
index c6b44ed..178ba03 100644
--- a/src/nautilus-location-bar.c
+++ b/src/nautilus-location-bar.c
@@ -36,6 +36,7 @@
 #include "nautilus-location-entry.h"
 #include "nautilus-window-private.h"
 #include "nautilus-window.h"
+#include "nautilus-navigation-window-pane.h"
 #include <eel/eel-accessibility.h>
 #include <eel/eel-glib-extensions.h>
 #include <eel/eel-gtk-macros.h>
@@ -465,7 +466,7 @@ nautilus_location_bar_init (NautilusLocationBar *bar)
 }
 
 GtkWidget *
-nautilus_location_bar_new (NautilusNavigationWindow *window)
+nautilus_location_bar_new (NautilusNavigationWindowPane *pane)
 {
 	GtkWidget *bar;
 	NautilusLocationBar *location_bar;
@@ -476,7 +477,7 @@ nautilus_location_bar_new (NautilusNavigationWindow *window)
 	/* Clipboard */
 	nautilus_clipboard_set_up_editable
 		(GTK_EDITABLE (location_bar->details->entry),
-		 nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window)),
+		 nautilus_window_get_ui_manager (NAUTILUS_WINDOW (NAUTILUS_WINDOW_PANE(pane)->window)),
 		 TRUE);
 
 	return bar;
@@ -586,3 +587,9 @@ nautilus_location_bar_update_label (NautilusLocationBar *bar)
 	g_object_unref (location);
 	g_object_unref (last_location);
 }
+
+NautilusEntry *
+nautilus_location_bar_get_entry (NautilusLocationBar *location_bar)
+{
+	return location_bar->details->entry;
+}
diff --git a/src/nautilus-location-bar.h b/src/nautilus-location-bar.h
index bfcd82c..eea9eb1 100644
--- a/src/nautilus-location-bar.h
+++ b/src/nautilus-location-bar.h
@@ -32,6 +32,8 @@
 
 #include "nautilus-navigation-bar.h"
 #include "nautilus-navigation-window.h"
+#include "nautilus-navigation-window-pane.h"
+#include "nautilus-entry.h"
 #include <gtk/gtk.h>
 
 #define NAUTILUS_TYPE_LOCATION_BAR nautilus_location_bar_get_type()
@@ -58,6 +60,7 @@ typedef struct {
 } NautilusLocationBarClass;
 
 GType      nautilus_location_bar_get_type     	(void);
-GtkWidget* nautilus_location_bar_new          	(NautilusNavigationWindow *window);
+GtkWidget* nautilus_location_bar_new          	(NautilusNavigationWindowPane *pane);
+NautilusEntry * nautilus_location_bar_get_entry (NautilusLocationBar *location_bar);
 
 #endif /* NAUTILUS_LOCATION_BAR_H */
diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
index 305c16e..e2a00be 100644
--- a/src/nautilus-navigation-window-menus.c
+++ b/src/nautilus-navigation-window-menus.c
@@ -42,6 +42,7 @@
 #include "nautilus-window-manage-views.h"
 #include "nautilus-window-private.h"
 #include "nautilus-window-bookmarks.h"
+#include "nautilus-navigation-window-pane.h"
 #include <eel/eel-glib-extensions.h>
 #include <eel/eel-gnome-extensions.h>
 #include <eel/eel-stock-dialogs.h>
@@ -181,14 +182,20 @@ static void
 action_show_hide_location_bar_callback (GtkAction *action, 
 					gpointer user_data)
 {
-	NautilusNavigationWindow *window;
+	NautilusWindow *window;
+	GList *walk;
+	gboolean is_active;
 
-	window = NAUTILUS_NAVIGATION_WINDOW (user_data);
+	window = NAUTILUS_WINDOW (user_data);
 
-	if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
-		nautilus_navigation_window_show_location_bar (window, TRUE);
-	} else {
-		nautilus_navigation_window_hide_location_bar (window, TRUE);
+	is_active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+	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);
+		}
 	}
 }
 
@@ -227,7 +234,7 @@ nautilus_navigation_window_update_show_hide_menu_items (NautilusNavigationWindow
 	action = gtk_action_group_get_action (window->details->navigation_action_group,
 					      NAUTILUS_ACTION_SHOW_HIDE_LOCATION_BAR);
 	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
-				      nautilus_navigation_window_location_bar_showing (window));
+					  nautilus_navigation_window_pane_location_bar_showing (NAUTILUS_NAVIGATION_WINDOW_PANE (NAUTILUS_WINDOW (window)->details->active_pane)));
 
 	action = gtk_action_group_get_action (window->details->navigation_action_group,
 					      NAUTILUS_ACTION_SHOW_HIDE_STATUSBAR);
@@ -685,8 +692,6 @@ action_new_tab_callback (GtkAction *action,
 	current_slot = window->details->active_pane->active_slot;
 	location = nautilus_window_slot_get_location (current_slot);
 
-	window = NAUTILUS_WINDOW (current_slot->pane->window);
-
 	if (location != NULL) {
 		flags = 0;
 
@@ -703,7 +708,7 @@ action_new_tab_callback (GtkAction *action,
 		g_free (scheme);
 
 		new_slot = nautilus_window_open_slot (current_slot->pane, flags);
-		nautilus_window_set_active_slot (new_slot->pane, new_slot);
+		nautilus_window_set_active_slot (window, new_slot);
 		nautilus_window_slot_go_to (new_slot, location, FALSE);
 		g_object_unref (location);
 	}
diff --git a/src/nautilus-navigation-window-pane.c b/src/nautilus-navigation-window-pane.c
index c3d0136..9e55d1d 100644
--- a/src/nautilus-navigation-window-pane.c
+++ b/src/nautilus-navigation-window-pane.c
@@ -23,6 +23,18 @@
 */
 
 #include "nautilus-navigation-window-pane.h"
+#include "nautilus-window-private.h"
+#include "nautilus-navigation-bar.h"
+#include "nautilus-pathbar.h"
+#include "nautilus-location-bar.h"
+
+#include <libnautilus-private/nautilus-global-preferences.h>
+#include <libnautilus-private/nautilus-window-slot-info.h>
+#include <libnautilus-private/nautilus-view-factory.h>
+#include <libnautilus-private/nautilus-entry.h>
+
+#include <eel/eel-preferences.h>
+
 
 static void nautilus_navigation_window_pane_init       (NautilusNavigationWindowPane *pane);
 static void nautilus_navigation_window_pane_class_init (NautilusNavigationWindowPaneClass *class);
@@ -34,6 +46,589 @@ G_DEFINE_TYPE (NautilusNavigationWindowPane,
 #define parent_class nautilus_navigation_window_pane_parent_class
 
 
+void
+nautilus_navigation_window_pane_set_active (NautilusNavigationWindowPane *pane, gboolean is_active)
+{
+	if (NAUTILUS_WINDOW_PANE (pane)->is_active == is_active) {
+		return;
+	}
+	nautilus_window_pane_set_active (NAUTILUS_WINDOW_PANE (pane), is_active);
+
+	/* location button */
+	gtk_widget_set_sensitive (gtk_bin_get_child (GTK_BIN (pane->location_button)), is_active);
+	
+	/* hhb: TODO: deal with path bar */
+
+	/* hhb: TODO: deal with navigation bar (manual entry) */
+}
+
+static gboolean
+navigation_bar_focus_in_callback (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
+{
+	NautilusWindowPane *pane;
+	pane = NAUTILUS_WINDOW_PANE (user_data);
+	nautilus_window_set_active_pane (pane->window, pane);
+	return FALSE;
+}
+
+static int
+bookmark_list_get_uri_index (GList *list, GFile *location)
+{
+	NautilusBookmark *bookmark;
+	GList *l;
+	GFile *tmp;
+	int i;
+
+	g_return_val_if_fail (location != NULL, -1);
+
+	for (i = 0, l = list; l != NULL; i++, l = l->next) {
+		bookmark = NAUTILUS_BOOKMARK (l->data);
+
+		tmp = nautilus_bookmark_get_location (bookmark);
+		if (g_file_equal (location, tmp)) {
+			g_object_unref (tmp);
+			return i;
+		}
+		g_object_unref (tmp);
+	}
+
+	return -1;
+}
+
+static void
+search_bar_activate_callback (NautilusSearchBar *bar,
+			      NautilusNavigationWindowPane *pane)
+{
+	char *uri, *current_uri;
+	NautilusDirectory *directory;
+	NautilusSearchDirectory *search_directory;
+	NautilusQuery *query;
+	GFile *location;
+
+	uri = nautilus_search_directory_generate_new_uri ();
+	location = g_file_new_for_uri (uri);
+	g_free (uri);
+	
+	directory = nautilus_directory_get (location);
+	
+	g_assert (NAUTILUS_IS_SEARCH_DIRECTORY (directory));
+
+	search_directory = NAUTILUS_SEARCH_DIRECTORY (directory);
+
+	query = nautilus_search_bar_get_query (NAUTILUS_SEARCH_BAR (pane->search_bar));
+	if (query != NULL) {
+		NautilusWindowSlot *slot = NAUTILUS_WINDOW_PANE (pane)->active_slot;
+		if (!nautilus_search_directory_is_indexed (search_directory)) {
+			current_uri = nautilus_window_slot_get_location_uri (slot);
+			nautilus_query_set_location (query, current_uri);
+			g_free (current_uri);
+		}
+		nautilus_search_directory_set_query (search_directory, query);
+		g_object_unref (query);
+	}
+	
+	nautilus_window_slot_go_to (NAUTILUS_WINDOW_PANE (pane)->active_slot, location, FALSE);
+	
+	nautilus_directory_unref (directory);
+	g_object_unref (location);
+}
+
+static void
+search_bar_cancel_callback (GtkWidget *widget,
+			    NautilusNavigationWindowPane *pane)
+{
+	if (nautilus_navigation_window_pane_hide_temporary_bars (pane)) {
+		nautilus_navigation_window_restore_focus_widget (NAUTILUS_NAVIGATION_WINDOW (NAUTILUS_WINDOW_PANE (pane)->window));
+	}
+}
+
+static void
+navigation_bar_cancel_callback (GtkWidget *widget,
+				NautilusNavigationWindowPane *pane)
+{
+	if (nautilus_navigation_window_pane_hide_temporary_bars (pane)) {
+		nautilus_navigation_window_restore_focus_widget (NAUTILUS_NAVIGATION_WINDOW (NAUTILUS_WINDOW_PANE (pane)->window));
+	}
+}
+
+static void
+navigation_bar_location_changed_callback (GtkWidget *widget,
+					  const char *uri,
+					  NautilusNavigationWindowPane *pane)
+{
+	GFile *location;
+	
+	if (nautilus_navigation_window_pane_hide_temporary_bars (pane)) {
+		nautilus_navigation_window_restore_focus_widget (NAUTILUS_NAVIGATION_WINDOW (NAUTILUS_WINDOW_PANE (pane)->window));
+	}
+
+	location = g_file_new_for_uri (uri);
+	nautilus_window_slot_go_to (NAUTILUS_WINDOW_PANE (pane)->active_slot, location, FALSE);
+	g_object_unref (location);
+}
+
+static gboolean
+location_button_should_be_active (NautilusNavigationWindowPane *pane)
+{
+	return eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY);
+}
+
+static void
+location_button_toggled_cb (GtkToggleButton *toggle,
+			    NautilusNavigationWindowPane *pane)
+{
+	gboolean is_active;
+
+	is_active = gtk_toggle_button_get_active (toggle);
+	eel_preferences_set_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY, is_active);
+
+	if (is_active) {
+		nautilus_navigation_bar_activate (NAUTILUS_NAVIGATION_BAR (pane->navigation_bar));
+	}
+	
+	nautilus_window_set_active_pane (NAUTILUS_WINDOW_PANE (pane)->window, NAUTILUS_WINDOW_PANE (pane));
+}
+
+static GtkWidget *
+location_button_create (NautilusNavigationWindowPane *pane)
+{
+	GtkWidget *image;
+	GtkWidget *button;
+
+	image = gtk_image_new_from_stock (GTK_STOCK_EDIT, GTK_ICON_SIZE_BUTTON);
+	gtk_widget_show (image);
+
+	button = g_object_new (GTK_TYPE_TOGGLE_BUTTON,
+			       "image", image,
+			       "focus-on-click", FALSE,
+			       "active", location_button_should_be_active (pane),
+			       NULL);
+
+	gtk_widget_set_tooltip_text (button,
+				     _("Toggle between button and text-based location bar"));
+
+	g_signal_connect (button, "toggled",
+			  G_CALLBACK (location_button_toggled_cb), pane);
+	return button;
+}
+
+static void
+path_bar_location_changed_callback (GtkWidget *widget,
+				    GFile *location,
+				    NautilusNavigationWindowPane *pane)
+{
+	NautilusNavigationWindowSlot *slot;
+	NautilusWindowPane *win_pane;
+	int i;
+
+	g_assert (NAUTILUS_IS_NAVIGATION_WINDOW_PANE (pane));
+
+	win_pane = NAUTILUS_WINDOW_PANE(pane);
+	
+	slot = NAUTILUS_NAVIGATION_WINDOW_SLOT (win_pane->active_slot);
+
+	/* check whether we already visited the target location */
+	i = bookmark_list_get_uri_index (slot->back_list, location);
+	if (i >= 0) {
+		nautilus_navigation_window_back_or_forward (NAUTILUS_NAVIGATION_WINDOW (win_pane->window), TRUE, i, FALSE);
+	} else {
+		nautilus_window_slot_go_to (win_pane->active_slot, location, FALSE);
+	}
+}
+
+static gboolean
+path_bar_button_pressed_callback (GtkWidget *widget,
+				  GdkEventButton *event,
+				  NautilusNavigationWindowPane *pane)
+{
+	NautilusWindowSlot *slot;
+	NautilusView *view;
+	GFile *location;
+	char *uri;
+
+	g_object_set_data (G_OBJECT (widget), "handle-button-release",
+			   GINT_TO_POINTER (TRUE));
+
+	if (event->button == 3) {
+		slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW_PANE (pane)->window);
+		view = slot->content_view;
+		if (view != NULL) {
+			location = nautilus_path_bar_get_path_for_button (
+				NAUTILUS_PATH_BAR (pane->path_bar), widget);
+			if (location != NULL) {
+				uri = g_file_get_uri (location);
+				nautilus_view_pop_up_location_context_menu (
+					view, event, uri);
+				g_object_unref (G_OBJECT (location));
+				g_free (uri);
+				return TRUE;
+			}
+		}
+	}
+
+	return FALSE;
+}
+
+static gboolean
+path_bar_button_released_callback (GtkWidget *widget,
+				   GdkEventButton *event,
+				   NautilusNavigationWindowPane *pane)
+{
+	NautilusWindowSlot *slot;
+	NautilusWindowOpenFlags flags;
+	GFile *location;
+	int mask;
+	gboolean handle_button_release;
+
+	mask = event->state & gtk_accelerator_get_default_mod_mask ();
+	flags = 0;
+
+	handle_button_release = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (widget),
+						  "handle-button-release"));
+
+	if (event->type == GDK_BUTTON_RELEASE && handle_button_release) {
+		location = nautilus_path_bar_get_path_for_button (NAUTILUS_PATH_BAR (pane->path_bar), widget);
+
+		if (event->button == 2 && mask == 0) {
+			if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ENABLE_TABS)) {
+				flags = NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
+			} else {
+				flags = NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW;
+			}
+		} else if (event->button == 1 && mask == GDK_CONTROL_MASK) {
+			flags = NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW;
+		}
+
+		if (flags != 0) {
+			slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW_PANE (pane)->window);
+			nautilus_window_slot_info_open_location (slot, location,
+								 NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
+								 flags, NULL);
+			g_object_unref (location);
+			return TRUE;
+		}
+
+		g_object_unref (location);
+	}
+
+	return FALSE;
+}
+
+static void
+path_bar_button_drag_begin_callback (GtkWidget *widget,
+				     GdkEventButton *event,
+				     gpointer user_data)
+{
+	g_object_set_data (G_OBJECT (widget), "handle-button-release",
+			   GINT_TO_POINTER (FALSE));
+}
+
+static void
+path_bar_path_set_callback (GtkWidget *widget,
+			    GFile *location,
+			    NautilusNavigationWindowPane *pane)
+{
+	GList *children, *l;
+	GtkWidget *child;
+
+	children = gtk_container_get_children (GTK_CONTAINER (widget));
+
+	for (l = children; l != NULL; l = l->next) {
+		child = GTK_WIDGET (l->data);
+
+		if (!GTK_IS_TOGGLE_BUTTON (child)) {
+			continue;
+		}
+
+		if (!g_signal_handler_find (child,
+					    G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+					    0, 0, NULL, 
+					    path_bar_button_pressed_callback,
+					    pane)) {
+			g_signal_connect (child, "button-press-event",
+					  G_CALLBACK (path_bar_button_pressed_callback),
+					  pane);
+			g_signal_connect (child, "button-release-event",
+					  G_CALLBACK (path_bar_button_released_callback),
+					  pane);
+			g_signal_connect (child, "drag-begin",
+					  G_CALLBACK (path_bar_button_drag_begin_callback),
+					  pane);
+		}
+	}
+
+	g_list_free (children);
+}
+
+void
+nautilus_navigation_window_pane_sync_location_widgets (NautilusNavigationWindowPane *pane)
+{
+	NautilusWindowSlot *slot;
+
+	slot = NAUTILUS_WINDOW_PANE (pane)->active_slot;
+
+	/* Change the location bar and path bar to match the current location. */
+	if (slot->location != NULL) {
+		char *uri;
+		
+		/* this may be NULL if we just created the slot */
+		uri = nautilus_window_slot_get_location_uri (slot);
+		nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (pane->navigation_bar),uri);
+		g_free (uri);
+		nautilus_path_bar_set_path (NAUTILUS_PATH_BAR (pane->path_bar),slot->location);
+	}	
+}
+
+gboolean
+nautilus_navigation_window_pane_hide_temporary_bars (NautilusNavigationWindowPane *pane)
+{
+	NautilusWindowSlot *slot;
+	NautilusDirectory *directory;
+	gboolean success;
+
+	g_assert (NAUTILUS_IS_NAVIGATION_WINDOW_PANE (pane));
+
+	slot = NAUTILUS_WINDOW_PANE(pane)->active_slot;
+	success = FALSE;
+	
+	if (pane->temporary_location_bar) {
+		if (nautilus_navigation_window_pane_location_bar_showing (pane)) {
+			nautilus_navigation_window_pane_hide_location_bar (pane, FALSE);
+		}
+		pane->temporary_location_bar = FALSE;
+		success = TRUE;
+	}
+	if (pane->temporary_navigation_bar) {
+		directory = nautilus_directory_get (slot->location);
+
+		if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
+			nautilus_navigation_window_pane_set_bar_mode (pane, NAUTILUS_BAR_SEARCH);
+		} else {
+			if (!eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY)) {
+				nautilus_navigation_window_pane_set_bar_mode (pane, NAUTILUS_BAR_PATH);
+			}
+		}
+		pane->temporary_navigation_bar = FALSE;
+		success = TRUE;
+
+		nautilus_directory_unref (directory);
+	}
+	if (pane->temporary_search_bar) {
+		if (!eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY)) {
+			nautilus_navigation_window_pane_set_bar_mode (pane, NAUTILUS_BAR_PATH);
+		} else {
+			nautilus_navigation_window_pane_set_bar_mode (pane, NAUTILUS_BAR_NAVIGATION);
+		}
+		pane->temporary_search_bar = FALSE;
+		success = TRUE;
+	}
+
+	return success;		
+}
+
+void
+nautilus_navigation_window_pane_always_use_location_entry (NautilusNavigationWindowPane *pane, gboolean use_entry)
+{
+	if (use_entry) {
+		nautilus_navigation_window_pane_set_bar_mode (pane, NAUTILUS_BAR_NAVIGATION);
+	} else {
+		nautilus_navigation_window_pane_set_bar_mode (pane, NAUTILUS_BAR_PATH);
+	}
+	
+	g_signal_handlers_block_by_func (pane->location_button,
+					 G_CALLBACK (location_button_toggled_cb),
+					 pane);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pane->location_button), use_entry);
+	g_signal_handlers_unblock_by_func (pane->location_button,
+					   G_CALLBACK (location_button_toggled_cb),
+					   pane);
+}
+
+void
+nautilus_navigation_window_pane_setup_location_bar (NautilusNavigationWindowPane *pane)
+{
+	GtkWidget *location_bar;
+	GtkWidget *hbox;
+	GtkToolItem *item;
+	NautilusEntry *entry;
+
+	location_bar = gtk_toolbar_new ();
+	pane->location_bar = location_bar;
+	
+	hbox = gtk_hbox_new (FALSE, 12);
+	gtk_widget_show (hbox);
+
+	item = gtk_tool_item_new ();
+	gtk_container_set_border_width (GTK_CONTAINER (item), 4);
+	gtk_widget_show (GTK_WIDGET (item));
+	gtk_tool_item_set_expand (item, TRUE);
+	gtk_container_add (GTK_CONTAINER (item),  hbox);
+	gtk_toolbar_insert (GTK_TOOLBAR (location_bar),
+			    item, -1);
+
+	pane->navigation_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
+	gtk_size_group_set_ignore_hidden (pane->navigation_group, FALSE);
+
+	pane->location_button = location_button_create (pane);
+	gtk_size_group_add_widget (pane->navigation_group, pane->location_button);
+	gtk_box_pack_start (GTK_BOX (hbox), pane->location_button, FALSE, FALSE, 0);
+	gtk_widget_show (pane->location_button);
+
+	pane->path_bar = g_object_new (NAUTILUS_TYPE_PATH_BAR, NULL);
+	gtk_size_group_add_widget (pane->navigation_group, pane->path_bar);
+	gtk_widget_show (pane->path_bar);
+	
+	g_signal_connect_object (pane->path_bar, "path_clicked",
+				 G_CALLBACK (path_bar_location_changed_callback), pane, 0);
+	g_signal_connect_object (pane->path_bar, "path_set",
+				 G_CALLBACK (path_bar_path_set_callback), pane, 0);
+	
+	gtk_box_pack_start (GTK_BOX (hbox),
+			    pane->path_bar,
+			    TRUE, TRUE, 0);
+
+	pane->navigation_bar = nautilus_location_bar_new (pane);
+	gtk_size_group_add_widget (pane->navigation_group, pane->navigation_bar);
+	g_signal_connect_object (pane->navigation_bar, "location_changed",
+				 G_CALLBACK (navigation_bar_location_changed_callback), pane, 0);
+	g_signal_connect_object (pane->navigation_bar, "cancel",
+				 G_CALLBACK (navigation_bar_cancel_callback), pane, 0);
+	entry = nautilus_location_bar_get_entry (NAUTILUS_LOCATION_BAR (pane->navigation_bar));
+	g_signal_connect (entry, "focus-in-event",
+			G_CALLBACK (navigation_bar_focus_in_callback), pane);
+
+	gtk_box_pack_start (GTK_BOX (hbox),
+			    pane->navigation_bar,
+			    TRUE, TRUE, 0);
+
+	pane->search_bar = nautilus_search_bar_new ();
+	gtk_size_group_add_widget (pane->navigation_group, pane->search_bar);
+	g_signal_connect_object (pane->search_bar, "activate",
+				 G_CALLBACK (search_bar_activate_callback), pane, 0);
+	g_signal_connect_object (pane->search_bar, "cancel",
+				 G_CALLBACK (search_bar_cancel_callback), pane, 0);
+	gtk_box_pack_start (GTK_BOX (hbox),
+			    pane->search_bar,
+			    TRUE, TRUE, 0);
+}
+
+void
+nautilus_navigation_window_pane_show_location_bar_temporarily (NautilusNavigationWindowPane *pane)
+{
+	if (!nautilus_navigation_window_pane_location_bar_showing (pane)) {
+		nautilus_navigation_window_pane_show_location_bar (pane, FALSE);
+		pane->temporary_location_bar = TRUE;
+	}
+}
+
+void
+nautilus_navigation_window_pane_show_navigation_bar_temporarily (NautilusNavigationWindowPane *pane)
+{
+	if (nautilus_navigation_window_pane_path_bar_showing (pane)
+	    || nautilus_navigation_window_pane_search_bar_showing (pane)) {
+		nautilus_navigation_window_pane_set_bar_mode (pane, NAUTILUS_BAR_NAVIGATION);
+		pane->temporary_navigation_bar = TRUE;
+	}
+	nautilus_navigation_bar_activate 
+		(NAUTILUS_NAVIGATION_BAR (pane->navigation_bar));
+}
+
+gboolean
+nautilus_navigation_window_pane_path_bar_showing (NautilusNavigationWindowPane *pane)
+{
+	if (pane->path_bar != NULL) {
+		return GTK_WIDGET_VISIBLE (pane->path_bar);
+	}
+	/* If we're not visible yet we haven't changed visibility, so its TRUE */
+	return TRUE;
+}
+
+void
+nautilus_navigation_window_pane_set_bar_mode (NautilusNavigationWindowPane *pane,
+					      NautilusBarMode mode)
+{
+    gboolean use_entry;
+    
+	switch (mode) {
+
+	case NAUTILUS_BAR_PATH:
+		gtk_widget_show (pane->path_bar);
+		gtk_widget_hide (pane->navigation_bar);
+		gtk_widget_hide (pane->search_bar);
+		break;
+
+	case NAUTILUS_BAR_NAVIGATION:
+		gtk_widget_show (pane->navigation_bar);
+		gtk_widget_hide (pane->path_bar);
+		gtk_widget_hide (pane->search_bar);
+		break;
+
+	case NAUTILUS_BAR_SEARCH:
+		gtk_widget_show (pane->search_bar);
+		gtk_widget_hide (pane->path_bar);
+		gtk_widget_hide (pane->navigation_bar);
+		break;
+	}
+    
+	if (mode == NAUTILUS_BAR_NAVIGATION || mode == NAUTILUS_BAR_PATH) {
+		use_entry = (mode == NAUTILUS_BAR_NAVIGATION);
+
+		g_signal_handlers_block_by_func (pane->location_button,
+						 G_CALLBACK (location_button_toggled_cb),
+						 pane);
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pane->location_button),
+					      use_entry);
+		g_signal_handlers_unblock_by_func (pane->location_button,
+						   G_CALLBACK (location_button_toggled_cb),
+						   pane);
+	}    
+}
+
+gboolean
+nautilus_navigation_window_pane_search_bar_showing (NautilusNavigationWindowPane *pane)
+{
+	if (pane->search_bar != NULL) {
+		return GTK_WIDGET_VISIBLE (pane->search_bar);
+	}
+	/* If we're not visible yet we haven't changed visibility, so its TRUE */
+	return TRUE;
+}
+
+void
+nautilus_navigation_window_pane_hide_location_bar (NautilusNavigationWindowPane *pane, gboolean save_preference)
+{
+	pane->temporary_location_bar = FALSE;
+	gtk_widget_hide(pane->location_bar);
+	nautilus_navigation_window_update_show_hide_menu_items(
+			NAUTILUS_NAVIGATION_WINDOW (NAUTILUS_WINDOW_PANE (pane)->window));
+	if (save_preference && eel_preferences_key_is_writable(NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR)) {
+		eel_preferences_set_boolean(NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR, FALSE);
+	}
+}
+
+void
+nautilus_navigation_window_pane_show_location_bar (NautilusNavigationWindowPane *pane, gboolean save_preference)
+{
+	gtk_widget_show(pane->location_bar);
+	nautilus_navigation_window_update_show_hide_menu_items(NAUTILUS_NAVIGATION_WINDOW (NAUTILUS_WINDOW_PANE (pane)->window));
+	if (save_preference && eel_preferences_key_is_writable(NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR)) {
+		eel_preferences_set_boolean(NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR, TRUE);
+	}
+}
+
+gboolean
+nautilus_navigation_window_pane_location_bar_showing (NautilusNavigationWindowPane *pane)
+{
+	if (!NAUTILUS_IS_NAVIGATION_WINDOW_PANE (pane)) {
+		return FALSE;
+	}
+	if (pane->location_bar != NULL) {
+		return GTK_WIDGET_VISIBLE (pane->location_bar);
+	}
+	/* If we're not visible yet we haven't changed visibility, so its TRUE */
+	return TRUE;
+}
+
 static void
 nautilus_navigation_window_pane_init (NautilusNavigationWindowPane *pane)
 {
diff --git a/src/nautilus-navigation-window-pane.h b/src/nautilus-navigation-window-pane.h
index cea3b3e..c22fcb7 100644
--- a/src/nautilus-navigation-window-pane.h
+++ b/src/nautilus-navigation-window-pane.h
@@ -25,12 +25,12 @@
 #ifndef NAUTILUS_NAVIGATION_WINDOW_PANE_H
 #define NAUTILUS_NAVIGATION_WINDOW_PANE_H
 
-#include "nautilus-window.h"
 #include "nautilus-window-pane.h"
+#include "nautilus-navigation-window-slot.h"
 
-#define NAUTILUS_TYPE_NAVIGATION_WINDOW_PANE	 (nautilus_navigation_window_pane_get_type())
+#define NAUTILUS_TYPE_NAVIGATION_WINDOW_PANE     (nautilus_navigation_window_pane_get_type())
 #define NAUTILUS_NAVIGATION_WINDOW_PANE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NAUTILUS_TYPE_NAVIGATION_WINDOW_PANE, NautilusNavigationWindowPaneClass))
-#define NAUTILUS_NAVIGATION_WINDOW_PANE(obj)	 (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_NAVIGATION_WINDOW_PANE, NautilusNavigationWindowPane))
+#define NAUTILUS_NAVIGATION_WINDOW_PANE(obj)     (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_NAVIGATION_WINDOW_PANE, NautilusNavigationWindowPane))
 #define NAUTILUS_IS_NAVIGATION_WINDOW_PANE(obj)  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_NAVIGATION_WINDOW_PANE))
 #define NAUTILUS_IS_NAVIGATION_WINDOW_PANE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), NAUTILUS_TYPE_NAVIGATION_WINDOW_PANE))
 #define NAUTILUS_NAVIGATION_WINDOW_PANE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NAUTILUS_TYPE_NAVIGATION_WINDOW_PANE, NautilusNavigationWindowPaneClass))
@@ -39,14 +39,47 @@ typedef struct _NautilusNavigationWindowPaneClass NautilusNavigationWindowPaneCl
 typedef struct _NautilusNavigationWindowPane      NautilusNavigationWindowPane;
 
 struct _NautilusNavigationWindowPaneClass {
-	NautilusWindowPaneClass parent_class;
+    NautilusWindowPaneClass parent_class;
 };
 
 struct _NautilusNavigationWindowPane {
-	NautilusWindowPane parent;
+    NautilusWindowPane parent;
+
+    /* location bar */
+    GtkWidget *location_bar;
+    GtkWidget *location_button;
+    GtkSizeGroup *navigation_group;
+    GtkWidget *navigation_bar;
+    GtkWidget *path_bar;
+    GtkWidget *search_bar;
+
+    /* Location bar */
+    gboolean temporary_navigation_bar;
+    gboolean temporary_location_bar;
+    gboolean temporary_search_bar;    
 };
 
-GType nautilus_navigation_window_pane_get_type (void);
+GType    nautilus_navigation_window_pane_get_type (void);
+
+NautilusNavigationWindowPane* nautilus_navigation_window_pane_new (NautilusWindow *window);
+
+/* location bar */
+void     nautilus_navigation_window_pane_setup_location_bar (NautilusNavigationWindowPane *pane);
+
+void     nautilus_navigation_window_pane_hide_location_bar (NautilusNavigationWindowPane *pane, gboolean save_preference);
+void     nautilus_navigation_window_pane_show_location_bar (NautilusNavigationWindowPane *pane, gboolean save_preference);
+gboolean nautilus_navigation_window_pane_location_bar_showing (NautilusNavigationWindowPane *pane);
+void     nautilus_navigation_window_pane_hide_path_bar (NautilusNavigationWindowPane *pane);
+void     nautilus_navigation_window_pane_show_path_bar (NautilusNavigationWindowPane *pane);
+gboolean nautilus_navigation_window_pane_path_bar_showing (NautilusNavigationWindowPane *pane);
+gboolean nautilus_navigation_window_pane_search_bar_showing (NautilusNavigationWindowPane *pane);
+void     nautilus_navigation_window_pane_set_bar_mode  (NautilusNavigationWindowPane *pane, NautilusBarMode mode);
+void     nautilus_navigation_window_pane_show_location_bar_temporarily (NautilusNavigationWindowPane *pane);
+void     nautilus_navigation_window_pane_show_navigation_bar_temporarily (NautilusNavigationWindowPane *pane);
+void     nautilus_navigation_window_pane_always_use_location_entry (NautilusNavigationWindowPane *pane, gboolean use_entry);
+gboolean nautilus_navigation_window_pane_hide_temporary_bars (NautilusNavigationWindowPane *pane);
+void     nautilus_navigation_window_pane_sync_location_widgets (NautilusNavigationWindowPane *pane);
+void     nautilus_navigation_window_pane_set_active (NautilusNavigationWindowPane *pane, gboolean is_active);
 
 NautilusNavigationWindowPane* nautilus_navigation_window_pane_new (NautilusWindow *window);
 
diff --git a/src/nautilus-navigation-window-slot.c b/src/nautilus-navigation-window-slot.c
index d80418e..bdfeae3 100644
--- a/src/nautilus-navigation-window-slot.c
+++ b/src/nautilus-navigation-window-slot.c
@@ -26,6 +26,7 @@
 #include "nautilus-navigation-window-slot.h"
 #include "nautilus-window-private.h"
 #include "nautilus-search-bar.h"
+#include "nautilus-navigation-window-pane.h"
 #include <libnautilus-private/nautilus-window-slot-info.h>
 #include <libnautilus-private/nautilus-file.h>
 #include <eel/eel-gtk-macros.h>
@@ -139,7 +140,7 @@ nautilus_navigation_window_slot_update_query_editor (NautilusWindowSlot *slot)
 			query_editor = nautilus_query_editor_new_with_bar (FALSE,
 									   nautilus_search_directory_is_indexed (search_directory),
 									   slot->pane->window->details->active_pane->active_slot == slot,
-									   NAUTILUS_SEARCH_BAR (navigation_window->search_bar),
+									   NAUTILUS_SEARCH_BAR (NAUTILUS_NAVIGATION_WINDOW_PANE (slot->pane)->search_bar),
 									   slot);
 		}
 	}
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index 339a749..ca9d4a0 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -36,7 +36,6 @@
 #include "nautilus-bookmarks-window.h"
 #include "nautilus-main.h"
 #include "nautilus-location-bar.h"
-#include "nautilus-pathbar.h"
 #include "nautilus-query-editor.h"
 #include "nautilus-search-bar.h"
 #include "nautilus-navigation-window-slot.h"
@@ -100,17 +99,6 @@ static int mouse_back_button = 8;
 static void add_sidebar_panels                       (NautilusNavigationWindow *window);
 static void side_panel_image_changed_callback        (NautilusSidebar          *side_panel,
 						      gpointer                  callback_data);
-static void navigation_bar_location_changed_callback (GtkWidget                *widget,
-						      const char               *uri,
-						      NautilusNavigationWindow *window);
-static void navigation_bar_cancel_callback           (GtkWidget                *widget,
-						      NautilusNavigationWindow *window);
-static void path_bar_location_changed_callback       (GtkWidget                *widget,
-						      GFile                    *path,
-						      NautilusNavigationWindow *window);
-static void path_bar_path_set_callback               (GtkWidget                *widget,
-						      GFile                    *location,
-						      NautilusNavigationWindow *window);
 static void always_use_location_entry_changed        (gpointer                  callback_data);
 static void always_use_browser_changed               (gpointer                  callback_data);
 static void enable_tabs_changed			     (gpointer                  callback_data);
@@ -118,14 +106,6 @@ static void mouse_back_button_changed		     (gpointer                  callback_
 static void mouse_forward_button_changed	     (gpointer                  callback_data);
 static void use_extra_mouse_buttons_changed          (gpointer                  callback_data);
 
-static void nautilus_navigation_window_set_bar_mode  (NautilusNavigationWindow *window, 
-						      NautilusBarMode           mode);
-static void search_bar_activate_callback             (NautilusSearchBar        *bar,
-						      NautilusWindow           *window);
-static void search_bar_cancel_callback               (GtkWidget                *widget,
-						      NautilusNavigationWindow *window);
-
-static void nautilus_navigation_window_show_location_bar_temporarily (NautilusNavigationWindow *window);
 
 G_DEFINE_TYPE (NautilusNavigationWindow, nautilus_navigation_window, NAUTILUS_TYPE_WINDOW)
 #define parent_class nautilus_navigation_window_parent_class
@@ -140,49 +120,17 @@ static const struct {
 #endif
 };
 
-
-
-static void
-location_button_toggled_cb (GtkToggleButton *toggle,
-			    NautilusNavigationWindow *window)
+gboolean
+nautilus_navigation_window_hide_temporary_bars (NautilusNavigationWindow *window)
 {
-	gboolean is_active;
-
-	is_active = gtk_toggle_button_get_active (toggle);
-	eel_preferences_set_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY, is_active);
-
-	if (is_active) {
-		nautilus_navigation_bar_activate (NAUTILUS_NAVIGATION_BAR (window->navigation_bar));
+	gboolean any = TRUE;
+	GList *walk;
+	for (walk = NAUTILUS_WINDOW(window)->details->panes; walk; walk = walk->next) {
+		if(!nautilus_navigation_window_pane_hide_temporary_bars (walk->data)) {
+			any = FALSE;
+		}
 	}
-}
-
-static gboolean
-location_button_should_be_active (NautilusNavigationWindow *window)
-{
-	return eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY);
-}
-
-static GtkWidget *
-location_button_create (NautilusNavigationWindow *window)
-{
-	GtkWidget *image;
-	GtkWidget *button;
-
-	image = gtk_image_new_from_stock (GTK_STOCK_EDIT, GTK_ICON_SIZE_BUTTON);
-	gtk_widget_show (image);
-
-	button = g_object_new (GTK_TYPE_TOGGLE_BUTTON,
-			       "image", image,
-			       "focus-on-click", FALSE,
-			       "active", location_button_should_be_active (window),
-			       NULL);
-
-	gtk_widget_set_tooltip_text (button,
-				     _("Toggle between button and text-based location bar"));
-
-	g_signal_connect (button, "toggled",
-			  G_CALLBACK (location_button_toggled_cb), window);
-	return button;
+	return any;
 }
 
 static gboolean
@@ -204,7 +152,7 @@ notebook_switch_page_cb (GtkNotebook *notebook,
 	slot = nautilus_window_get_slot_for_content_box (nautilus_window, widget);
 	g_assert (slot != NULL);
 
-	nautilus_window_set_active_slot (slot->pane, slot);
+	nautilus_window_set_active_slot (slot->pane->window, slot);
 
 	return FALSE;
 }
@@ -344,9 +292,6 @@ nautilus_navigation_window_init (NautilusNavigationWindow *window)
 {
 	GtkUIManager *ui_manager;
 	GtkWidget *toolbar;
-	GtkWidget *location_bar;
-	GtkToolItem *item;
-	GtkWidget *hbox;
 	NautilusWindow *win;
 	NautilusNavigationWindowPane *pane;
 
@@ -388,7 +333,20 @@ nautilus_navigation_window_init (NautilusNavigationWindow *window)
 	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (window->notebook), FALSE);
 	gtk_notebook_set_show_border (GTK_NOTEBOOK (window->notebook), FALSE);
 	gtk_widget_show (window->notebook);
-	
+
+    nautilus_navigation_window_pane_setup_location_bar(pane);
+    gtk_widget_show (pane->location_bar);
+	gtk_table_attach (GTK_TABLE (NAUTILUS_WINDOW (window)->details->table),
+			  pane->location_bar,
+			  /* X direction */                    /* Y direction */
+			  0, 1,                                2, 3,
+			  GTK_EXPAND | GTK_FILL | GTK_SHRINK,  0,
+			  0,                                   0);
+
+	/* this has to be done after the location bar has been set up,
+	 * but before menu stuff is being called */
+    nautilus_window_set_active_pane (win, NAUTILUS_WINDOW_PANE (pane));
+
 	nautilus_navigation_window_initialize_actions (window);
 	nautilus_navigation_window_initialize_menus (window);
 	
@@ -411,74 +369,6 @@ nautilus_navigation_window_init (NautilusNavigationWindow *window)
 	nautilus_navigation_window_allow_back (window, FALSE);
 	nautilus_navigation_window_allow_forward (window, FALSE);
 
-	/* set up location bar */
-	location_bar = gtk_toolbar_new ();
-	window->details->location_bar = location_bar;
-
-	hbox = gtk_hbox_new (FALSE, 12);
-	gtk_widget_show (hbox);
-
-	item = gtk_tool_item_new ();
-	gtk_container_set_border_width (GTK_CONTAINER (item), 4);
-	gtk_widget_show (GTK_WIDGET (item));
-	gtk_tool_item_set_expand (item, TRUE);
-	gtk_container_add (GTK_CONTAINER (item),  hbox);
-	gtk_toolbar_insert (GTK_TOOLBAR (location_bar),
-			    item, -1);
-
-	window->navigation_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
-	gtk_size_group_set_ignore_hidden (window->navigation_group, FALSE);
-
-	window->details->location_button = location_button_create (window);
-	gtk_size_group_add_widget (window->navigation_group, window->details->location_button);
-	gtk_box_pack_start (GTK_BOX (hbox), window->details->location_button, FALSE, FALSE, 0);
-	gtk_widget_show (window->details->location_button);
-
-	window->path_bar = g_object_new (NAUTILUS_TYPE_PATH_BAR, NULL);
-	gtk_size_group_add_widget (window->navigation_group, window->path_bar);
- 	gtk_widget_show (window->path_bar);
-	
-	g_signal_connect_object (window->path_bar, "path_clicked",
-				 G_CALLBACK (path_bar_location_changed_callback), window, 0);
-	g_signal_connect_object (window->path_bar, "path_set",
-				 G_CALLBACK (path_bar_path_set_callback), window, 0);
-	
-	gtk_box_pack_start (GTK_BOX (hbox),
-			    window->path_bar,
-			    TRUE, TRUE, 0);
-
-	window->navigation_bar = nautilus_location_bar_new (window);
-	gtk_size_group_add_widget (window->navigation_group, window->navigation_bar);
-	g_signal_connect_object (window->navigation_bar, "location_changed",
-				 G_CALLBACK (navigation_bar_location_changed_callback), window, 0);
-	g_signal_connect_object (window->navigation_bar, "cancel",
-				 G_CALLBACK (navigation_bar_cancel_callback), window, 0);
-
-	gtk_box_pack_start (GTK_BOX (hbox),
-			    window->navigation_bar,
-			    TRUE, TRUE, 0);
-
-	window->search_bar = nautilus_search_bar_new ();
-	gtk_size_group_add_widget (window->navigation_group, window->search_bar);
-	g_signal_connect_object (window->search_bar, "activate",
-				 G_CALLBACK (search_bar_activate_callback), window, 0);
-	g_signal_connect_object (window->search_bar, "cancel",
-				 G_CALLBACK (search_bar_cancel_callback), window, 0);
-	gtk_box_pack_start (GTK_BOX (hbox),
-			    window->search_bar,
-			    TRUE, TRUE, 0);
-
-	gtk_widget_show (location_bar);
-
-	gtk_table_attach (GTK_TABLE (NAUTILUS_WINDOW (window)->details->table),
-			  location_bar,
-			  /* X direction */                    /* Y direction */
-			  0, 1,                                2, 3,
-			  GTK_EXPAND | GTK_FILL | GTK_SHRINK,  0,
-			  0,                                   0);
-
-	nautilus_window_set_active_pane (win, NAUTILUS_WINDOW_PANE (pane));
-
 	eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY,
 						  always_use_location_entry_changed,
 						  window, G_OBJECT (window));
@@ -496,16 +386,15 @@ static void
 always_use_location_entry_changed (gpointer callback_data)
 {
 	NautilusNavigationWindow *window;
+    GList *walk;
 	gboolean use_entry;
 
 	window = NAUTILUS_NAVIGATION_WINDOW (callback_data);
 
 	use_entry = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY);
 
-	if (use_entry) {
-		nautilus_navigation_window_set_bar_mode (window, NAUTILUS_BAR_NAVIGATION);
-	} else {
-		nautilus_navigation_window_set_bar_mode (window, NAUTILUS_BAR_PATH);
+	for (walk = NAUTILUS_WINDOW(window)->details->panes; walk; walk = walk->next) {
+		nautilus_navigation_window_pane_always_use_location_entry (walk->data, use_entry);
 	}
 }
 
@@ -572,54 +461,8 @@ use_extra_mouse_buttons_changed (gpointer callback_data)
 	mouse_extra_buttons = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_MOUSE_USE_EXTRA_BUTTONS);
 }
 
-static int
-bookmark_list_get_uri_index (GList *list,
-			     GFile *location)
-{
-	NautilusBookmark *bookmark;
-	GList *l;
-	GFile *tmp;
-	int i;
-
-	g_return_val_if_fail (location != NULL, -1);
-
-	for (i = 0, l = list; l != NULL; i++, l = l->next) {
-		bookmark = NAUTILUS_BOOKMARK (l->data);
-
-		tmp = nautilus_bookmark_get_location (bookmark);
-		if (g_file_equal (location, tmp)) {
-			g_object_unref (tmp);
-			return i;
-		}
-		g_object_unref (tmp);
-	}
-
-	return -1;
-}
-
-static void
-path_bar_location_changed_callback (GtkWidget *widget,
-				    GFile *location,
-				    NautilusNavigationWindow *window)
-{
-	NautilusNavigationWindowSlot *slot;
-	int i;
-
-	g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
-
-	slot = NAUTILUS_NAVIGATION_WINDOW_SLOT (NAUTILUS_WINDOW (window)->details->active_pane->active_slot);
-
-	/* check whether we already visited the target location */
-	i = bookmark_list_get_uri_index (slot->back_list, location);
-	if (i >= 0) {
-		nautilus_navigation_window_back_or_forward (window, TRUE, i, FALSE);
-	} else {
-		nautilus_window_go_to (NAUTILUS_WINDOW (window), location);
-	}
-}
-
-static void
-unset_focus_widget (NautilusNavigationWindow *window)
+void
+nautilus_navigation_window_unset_focus_widget (NautilusNavigationWindow *window)
 {
 	if (window->details->last_focus_widget != NULL) {
 		g_object_remove_weak_pointer (G_OBJECT (window->details->last_focus_widget),
@@ -632,18 +475,33 @@ static inline gboolean
 is_in_temporary_navigation_bar (GtkWidget *widget,
 				NautilusNavigationWindow *window)
 {
-	return gtk_widget_get_ancestor (widget, NAUTILUS_TYPE_NAVIGATION_BAR) != NULL &&
-	       window->details->temporary_navigation_bar;
+	GList *walk;
+	gboolean is_in_any = FALSE;
+
+	for (walk = NAUTILUS_WINDOW(window)->details->panes; walk; walk = walk->next) {
+		NautilusNavigationWindowPane *pane = walk->data;
+		if(gtk_widget_get_ancestor (widget, NAUTILUS_TYPE_NAVIGATION_BAR) != NULL &&
+			       pane->temporary_navigation_bar)
+			is_in_any = TRUE;
+	}
+	return is_in_any;
 }
 
 static inline gboolean
 is_in_temporary_search_bar (GtkWidget *widget,
 			    NautilusNavigationWindow *window)
 {
-	return gtk_widget_get_ancestor (widget, NAUTILUS_TYPE_SEARCH_BAR) != NULL &&
-	       window->details->temporary_search_bar;
-}
+	GList *walk;
+	gboolean is_in_any = FALSE;
 
+	for (walk = NAUTILUS_WINDOW(window)->details->panes; walk; walk = walk->next) {
+		NautilusNavigationWindowPane *pane = walk->data;
+		if(gtk_widget_get_ancestor (widget, NAUTILUS_TYPE_SEARCH_BAR) != NULL &&
+				       pane->temporary_search_bar)
+			is_in_any = TRUE;
+	}
+	return is_in_any;
+}
 
 static void
 remember_focus_widget (NautilusNavigationWindow *window)
@@ -657,7 +515,7 @@ remember_focus_widget (NautilusNavigationWindow *window)
 	if (focus_widget != NULL &&
 	    !is_in_temporary_navigation_bar (focus_widget, navigation_window) &&
 	    !is_in_temporary_search_bar (focus_widget, navigation_window)) {
-		unset_focus_widget (navigation_window);
+		nautilus_navigation_window_unset_focus_widget (navigation_window);
 
 		navigation_window->details->last_focus_widget = focus_widget;
 		g_object_add_weak_pointer (G_OBJECT (focus_widget),
@@ -665,8 +523,8 @@ remember_focus_widget (NautilusNavigationWindow *window)
 	}
 }
 
-static void
-restore_focus_widget (NautilusNavigationWindow *window)
+void
+nautilus_navigation_window_restore_focus_widget (NautilusNavigationWindow *window)
 {
 	if (window->details->last_focus_widget != NULL) {
 		if (NAUTILUS_IS_VIEW (window->details->last_focus_widget)) {
@@ -675,85 +533,11 @@ restore_focus_widget (NautilusNavigationWindow *window)
 			gtk_widget_grab_focus (window->details->last_focus_widget);
 		}
 
-		unset_focus_widget (window);
-	}
-}
-
-static gboolean
-hide_temporary_bars (NautilusNavigationWindow *window)
-{
-	NautilusWindowSlot *slot;
-	NautilusDirectory *directory;
-	gboolean success;
-
-	g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
-
-	slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (window));
-
-	success = FALSE;
-
-	if (window->details->temporary_location_bar) {
-		if (nautilus_navigation_window_location_bar_showing (window)) {
-			nautilus_navigation_window_hide_location_bar (window, FALSE);
-		}
-		window->details->temporary_location_bar = FALSE;
-		success = TRUE;
-	}
-	if (window->details->temporary_navigation_bar) {
-		directory = nautilus_directory_get (slot->location);
-
-		if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
-			nautilus_navigation_window_set_bar_mode (window, NAUTILUS_BAR_SEARCH);
-		} else {
-			if (!eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY)) {
-				nautilus_navigation_window_set_bar_mode (window, NAUTILUS_BAR_PATH);
-			}
-		}
-		window->details->temporary_navigation_bar = FALSE;
-		success = TRUE;
-
-		nautilus_directory_unref (directory);
-	}
-	if (window->details->temporary_search_bar) {
-		if (!eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY)) {
-			nautilus_navigation_window_set_bar_mode (window, NAUTILUS_BAR_PATH);
-		} else {
-			nautilus_navigation_window_set_bar_mode (window, NAUTILUS_BAR_NAVIGATION);
-		}
-		nautilus_navigation_window_set_search_button (window, FALSE);
-		window->details->temporary_search_bar = FALSE;
-		success = TRUE;
-	}
-
-	return success;
-}
-
-static void
-navigation_bar_cancel_callback (GtkWidget *widget,
-				NautilusNavigationWindow *window)
-{
-	if (hide_temporary_bars (window)) {
-		restore_focus_widget (window);
+		nautilus_navigation_window_unset_focus_widget (window);
 	}
 }
 
 static void
-navigation_bar_location_changed_callback (GtkWidget *widget,
-					  const char *uri,
-					  NautilusNavigationWindow *window)
-{
-	GFile *location;
-	
-	if (hide_temporary_bars (window)) {
-		restore_focus_widget (window);
-	}
-
-	location = g_file_new_for_uri (uri);
-	nautilus_window_go_to (NAUTILUS_WINDOW (window), location);
-	g_object_unref (location);
-}
-
-static void
 side_pane_close_requested_callback (GtkWidget *widget,
 				    gpointer user_data)
 {
@@ -981,16 +765,13 @@ nautilus_navigation_window_destroy (GtkObject *object)
 	
 	window = NAUTILUS_NAVIGATION_WINDOW (object);
 
-	unset_focus_widget (window);
+	nautilus_navigation_window_unset_focus_widget (window);
 
 	window->sidebar = NULL;
 	g_list_foreach (window->sidebar_panels, (GFunc)g_object_unref, NULL);
 	g_list_free (window->sidebar_panels);
 	window->sidebar_panels = NULL;
 
-	window->navigation_bar = NULL;
-	window->path_bar = NULL;
-
 	window->details->content_paned = NULL;
 
 	GTK_OBJECT_CLASS (parent_class)->destroy (object);
@@ -1163,234 +944,49 @@ real_sync_allow_stop (NautilusWindow *window,
 	nautilus_notebook_sync_loading (notebook, slot);
 }
 
-static gboolean
-path_bar_button_pressed_callback (GtkWidget *widget,
-				  GdkEventButton *event,
-				  NautilusNavigationWindow *window)
-{
-	NautilusWindowSlot *slot;
-	NautilusView *view;
-	GFile *location;
-	char *uri;
-
-	g_object_set_data (G_OBJECT (widget), "handle-button-release",
-			   GINT_TO_POINTER (TRUE));
-
-	if (event->button == 3) {
-		slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (window));
-		view = slot->content_view;
-		if (view != NULL) {
-			location = nautilus_path_bar_get_path_for_button (
-				NAUTILUS_PATH_BAR (window->path_bar), widget);
-			if (location != NULL) {
-				uri = g_file_get_uri (location);
-				nautilus_view_pop_up_location_context_menu (
-					view, event, uri);
-				g_object_unref (G_OBJECT (location));
-				g_free (uri);
-				return TRUE;
-			}
-		}
-	}
-
-	return FALSE;
-}
-
-static gboolean
-path_bar_button_released_callback (GtkWidget *widget,
-				   GdkEventButton *event,
-				   NautilusNavigationWindow *window)
-{
-	NautilusWindowSlot *slot;
-	NautilusWindowOpenFlags flags;
-	GFile *location;
-	int mask;
-	gboolean handle_button_release;
-
-	mask = event->state & gtk_accelerator_get_default_mod_mask ();
-	flags = 0;
-
-	handle_button_release = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (widget),
-						  "handle-button-release"));
-
-	if (event->type == GDK_BUTTON_RELEASE && handle_button_release) {
-		location = nautilus_path_bar_get_path_for_button (NAUTILUS_PATH_BAR (window->path_bar), widget);
-
-		if (event->button == 2 && mask == 0) {
-			if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ENABLE_TABS)) {
-				flags = NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
-			} else {
-				flags = NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW;
-			}
-		} else if (event->button == 1 && mask == GDK_CONTROL_MASK) {
-			flags = NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW;
-		}
-
-		if (flags != 0) {
-			slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (window));
-			nautilus_window_slot_info_open_location (slot, location,
-								 NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
-								 flags, NULL);
-			g_object_unref (location);
-			return TRUE;
-		}
-
-		g_object_unref (location);
-	}
-
-	return FALSE;
-}
-
-static void
-path_bar_button_drag_begin_callback (GtkWidget *widget,
-				     GdkEventButton *event,
-				     gpointer user_data)
-{
-	g_object_set_data (G_OBJECT (widget), "handle-button-release",
-			   GINT_TO_POINTER (FALSE));
-}
-
-
-static void
-path_bar_path_set_callback (GtkWidget *widget,
-			    GFile *location,
-			    NautilusNavigationWindow *window)
-{
-	GList *children, *l;
-	GtkWidget *child;
-
-	children = gtk_container_get_children (GTK_CONTAINER (widget));
-
-	for (l = children; l != NULL; l = l->next) {
-		child = GTK_WIDGET (l->data);
-
-		if (!GTK_IS_TOGGLE_BUTTON (child)) {
-			continue;
-		}
-
-		if (!g_signal_handler_find (child,
-					    G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
-					    0, 0, NULL, 
-					    path_bar_button_pressed_callback,
-					    window)) {
-			g_signal_connect (child, "button-press-event",
-					  G_CALLBACK (path_bar_button_pressed_callback),
-					  window);
-			g_signal_connect (child, "button-release-event",
-					  G_CALLBACK (path_bar_button_released_callback),
-					  window);
-			g_signal_connect (child, "drag-begin",
-					  G_CALLBACK (path_bar_button_drag_begin_callback),
-					  window);
-		}
-	}
-
-	g_list_free (children);
-}
-
-static void
-nautilus_navigation_window_show_location_bar_temporarily (NautilusNavigationWindow *window)
-{
-	if (!nautilus_navigation_window_location_bar_showing (window)) {
-		nautilus_navigation_window_show_location_bar (window, FALSE);
-		window->details->temporary_location_bar = TRUE;
-	}
-}
-
-static void
-nautilus_navigation_window_show_navigation_bar_temporarily (NautilusNavigationWindow *window)
-{
-	if (nautilus_navigation_window_path_bar_showing (window)
-	    || nautilus_navigation_window_search_bar_showing (window)) {
-		nautilus_navigation_window_set_bar_mode (window, NAUTILUS_BAR_NAVIGATION);
-		window->details->temporary_navigation_bar = TRUE;
-	}
-	nautilus_navigation_bar_activate 
-		(NAUTILUS_NAVIGATION_BAR (window->navigation_bar));
-}
-
 static void
 real_prompt_for_location (NautilusWindow *window, const char *initial)
 {
+    NautilusNavigationWindowPane *pane;
+    
 	remember_focus_widget (NAUTILUS_NAVIGATION_WINDOW (window));
 
-	nautilus_navigation_window_show_location_bar_temporarily (NAUTILUS_NAVIGATION_WINDOW (window));
-	nautilus_navigation_window_show_navigation_bar_temporarily (NAUTILUS_NAVIGATION_WINDOW (window));
+    pane = NAUTILUS_NAVIGATION_WINDOW_PANE (window->details->active_pane);
+    
+	nautilus_navigation_window_pane_show_location_bar_temporarily (pane);
+	nautilus_navigation_window_pane_show_navigation_bar_temporarily (pane);
 	
 	if (initial) {
-		nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->navigation_bar),
+		nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (pane->navigation_bar),
 						      initial);
 	}
 }
 
-static void
-search_bar_activate_callback (NautilusSearchBar *bar,
-			      NautilusWindow *window)
-{
-	char *uri, *current_uri;
-	NautilusDirectory *directory;
-	NautilusSearchDirectory *search_directory;
-	NautilusQuery *query;
-	GFile *location;
-
-	uri = nautilus_search_directory_generate_new_uri ();
-	location = g_file_new_for_uri (uri);
-	g_free (uri);
-	
-	directory = nautilus_directory_get (location);
-	
-	g_assert (NAUTILUS_IS_SEARCH_DIRECTORY (directory));
-
-	search_directory = NAUTILUS_SEARCH_DIRECTORY (directory);
-
-	query = nautilus_search_bar_get_query (NAUTILUS_SEARCH_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->search_bar));
-	if (query != NULL) {
-		NautilusWindowSlot *slot = window->details->active_pane->active_slot;
-		if (!nautilus_search_directory_is_indexed (search_directory)) {
-			current_uri = nautilus_window_slot_get_location_uri (slot);
-			nautilus_query_set_location (query, current_uri);
-			g_free (current_uri);
-		}
-		nautilus_search_directory_set_query (search_directory, query);
-		g_object_unref (query);
-	}
-	
-	nautilus_window_go_to (window, location);
-	
-	nautilus_directory_unref (directory);
-	g_object_unref (location);
-}
-
-static void
-search_bar_cancel_callback (GtkWidget *widget,
-			    NautilusNavigationWindow *window)
-{
-	if (hide_temporary_bars (window)) {
-		restore_focus_widget (window);
-	}
-}
-
 void 
 nautilus_navigation_window_show_search (NautilusNavigationWindow *window)
 {
-	if (!nautilus_navigation_window_search_bar_showing (window)) {
+	NautilusNavigationWindowPane *pane;
+
+	pane = NAUTILUS_NAVIGATION_WINDOW_PANE (NAUTILUS_WINDOW (window)->details->active_pane);
+	if (!nautilus_navigation_window_pane_search_bar_showing (pane)) {
 		remember_focus_widget (window);
 
-		nautilus_navigation_window_show_location_bar_temporarily (window);
-		nautilus_navigation_window_set_bar_mode (window, NAUTILUS_BAR_SEARCH);
-		window->details->temporary_search_bar = TRUE;
-		nautilus_search_bar_clear (NAUTILUS_SEARCH_BAR (window->search_bar));
+		nautilus_navigation_window_pane_show_location_bar_temporarily (pane);
+		nautilus_navigation_window_pane_set_bar_mode (pane, NAUTILUS_BAR_SEARCH);
+		pane->temporary_search_bar = TRUE;
+		nautilus_search_bar_clear (NAUTILUS_SEARCH_BAR (pane->search_bar));
 	}
 
-	nautilus_search_bar_grab_focus (NAUTILUS_SEARCH_BAR (window->search_bar));
+	nautilus_search_bar_grab_focus (NAUTILUS_SEARCH_BAR (pane->search_bar));
 }
 
 void
 nautilus_navigation_window_hide_search (NautilusNavigationWindow *window)
 {
-	if (nautilus_navigation_window_search_bar_showing (window)) {
-		if (hide_temporary_bars (window)) {
-			restore_focus_widget (window);
+	NautilusNavigationWindowPane *pane = NAUTILUS_NAVIGATION_WINDOW_PANE (NAUTILUS_WINDOW (window)->details->active_pane);
+	if (nautilus_navigation_window_pane_search_bar_showing (pane)) {
+		if (nautilus_navigation_window_pane_hide_temporary_bars (pane)) {
+			nautilus_navigation_window_restore_focus_widget (window);
 		}
 	}
 }
@@ -1410,12 +1006,13 @@ static void
 real_sync_search_widgets (NautilusWindow *window)
 {
 	NautilusNavigationWindow *navigation_window;
+    NautilusNavigationWindowPane *pane;
 	NautilusWindowSlot *slot;
 	NautilusDirectory *directory;
 	NautilusSearchDirectory *search_directory;
 
 	navigation_window = NAUTILUS_NAVIGATION_WINDOW (window);
-
+    pane = NAUTILUS_NAVIGATION_WINDOW_PANE (window->details->active_pane);
 	slot = window->details->active_pane->active_slot;
 
 	search_directory = NULL;
@@ -1427,12 +1024,12 @@ real_sync_search_widgets (NautilusWindow *window)
 
 	if (search_directory != NULL &&
 	    !nautilus_search_directory_is_saved_search (search_directory)) {
-		nautilus_navigation_window_show_location_bar_temporarily (navigation_window);
-		nautilus_navigation_window_set_bar_mode (navigation_window, NAUTILUS_BAR_SEARCH);
-		navigation_window->details->temporary_search_bar = FALSE;
+		nautilus_navigation_window_pane_show_location_bar_temporarily (pane);
+		nautilus_navigation_window_pane_set_bar_mode (pane, NAUTILUS_BAR_SEARCH);
+		pane->temporary_search_bar = FALSE;
 	} else {
-		navigation_window->details->temporary_search_bar = TRUE;
-		hide_temporary_bars (navigation_window);
+		pane->temporary_search_bar = TRUE;
+		nautilus_navigation_window_hide_temporary_bars (navigation_window);
 	}
 	nautilus_directory_unref (directory);
 }
@@ -1499,114 +1096,6 @@ add_sidebar_panels (NautilusNavigationWindow *window)
 		 NAUTILUS_SIDEBAR (current));
 }
 
-void 
-nautilus_navigation_window_hide_location_bar (NautilusNavigationWindow *window, gboolean save_preference)
-{
-	window->details->temporary_location_bar = FALSE;
-	gtk_widget_hide (window->details->location_bar);
-	nautilus_navigation_window_update_show_hide_menu_items (window);
-	if (save_preference &&
-	    eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR)) {
-		eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR, FALSE);
-	}
-}
-
-void 
-nautilus_navigation_window_show_location_bar (NautilusNavigationWindow *window, gboolean save_preference)
-{
-	gtk_widget_show (window->details->location_bar);
-	nautilus_navigation_window_update_show_hide_menu_items (window);
-	if (save_preference &&
-	    eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR)) {
-		eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR, TRUE);
-	}
-}
-
-gboolean
-nautilus_navigation_window_location_bar_showing (NautilusNavigationWindow *window)
-{
-	if (window->details->location_bar != NULL) {
-		return GTK_WIDGET_VISIBLE (window->details->location_bar);
-	}
-	/* If we're not visible yet we haven't changed visibility, so its TRUE */
-	return TRUE;
-}
-
-gboolean
-nautilus_navigation_window_search_bar_showing (NautilusNavigationWindow *window)
-{
-	if (window->search_bar != NULL) {
-		return GTK_WIDGET_VISIBLE (window->search_bar);
-	}
-	/* If we're not visible yet we haven't changed visibility, so its TRUE */
-	return TRUE;
-}
-
-static void
-nautilus_navigation_window_set_bar_mode (NautilusNavigationWindow *window,
-					 NautilusBarMode mode)
-{
-	gboolean use_entry;
-	GtkWidget *focus_widget;
-
-	switch (mode) {
-
-	case NAUTILUS_BAR_PATH:
-		gtk_widget_show (window->path_bar);
-		gtk_widget_show (window->details->location_button);
-		gtk_widget_hide (window->navigation_bar);
-		gtk_widget_hide (window->search_bar);
-		break;
-
-	case NAUTILUS_BAR_NAVIGATION:
-		gtk_widget_show (window->navigation_bar);
-		gtk_widget_show (window->details->location_button);
-		gtk_widget_hide (window->path_bar);
-		gtk_widget_hide (window->search_bar);
-		break;
-
-	case NAUTILUS_BAR_SEARCH:
-		gtk_widget_show (window->search_bar);
-		gtk_widget_hide (window->path_bar);
-		gtk_widget_hide (window->navigation_bar);
-		gtk_widget_hide (window->details->location_button);
-		break;
-	}
-
-	if (mode == NAUTILUS_BAR_NAVIGATION || mode == NAUTILUS_BAR_PATH) {
-		use_entry = (mode == NAUTILUS_BAR_NAVIGATION);
-
-		g_signal_handlers_block_by_func (window->details->location_button,
-						 G_CALLBACK (location_button_toggled_cb),
-						 window);
-		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (window->details->location_button),
-					      use_entry);
-		g_signal_handlers_unblock_by_func (window->details->location_button,
-						   G_CALLBACK (location_button_toggled_cb),
-						   window);
-	}
-
-	focus_widget = gtk_window_get_focus (GTK_WINDOW (window));
-	if (focus_widget != NULL && !is_in_temporary_navigation_bar (focus_widget, window) &&
-				    !is_in_temporary_search_bar (focus_widget, window)) {
-		if (mode == NAUTILUS_BAR_NAVIGATION || mode == NAUTILUS_BAR_PATH) {
-			nautilus_navigation_window_set_search_button (window, FALSE);
-		} else {
-			nautilus_navigation_window_set_search_button (window, TRUE);
-		}
-	}
-}
-
-gboolean
-nautilus_navigation_window_path_bar_showing (NautilusNavigationWindow *window)
-{
-	if (window->path_bar != NULL) {
-		return GTK_WIDGET_VISIBLE (window->path_bar);
-	}
-	/* If we're not visible yet we haven't changed visibility, so its TRUE */
-	return TRUE;
-}
-
 gboolean
 nautilus_navigation_window_toolbar_showing (NautilusNavigationWindow *window)
 {
@@ -1757,6 +1246,9 @@ static void
 nautilus_navigation_window_show (GtkWidget *widget)
 {	
 	NautilusNavigationWindow *window;
+	gboolean show_location_bar;
+	gboolean always_use_location_entry;
+	GList *walk;
 
 	window = NAUTILUS_NAVIGATION_WINDOW (widget);
 
@@ -1770,16 +1262,21 @@ nautilus_navigation_window_show (GtkWidget *widget)
 		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 {
-		nautilus_navigation_window_hide_location_bar (window, FALSE);
-	}
+	show_location_bar = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR);
+	always_use_location_entry = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY);
+	for (walk = NAUTILUS_WINDOW(window)->details->panes; walk; walk = walk->next) {
+		NautilusNavigationWindowPane *pane = walk->data;
+		if (show_location_bar) {
+			nautilus_navigation_window_pane_show_location_bar (pane, FALSE);
+		} else {
+			nautilus_navigation_window_pane_hide_location_bar (pane, FALSE);
+		}
 
-	if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY)) {
-		nautilus_navigation_window_set_bar_mode (window, NAUTILUS_BAR_NAVIGATION);
-	} else {
-		nautilus_navigation_window_set_bar_mode (window, NAUTILUS_BAR_PATH);
+		if (always_use_location_entry) {
+			nautilus_navigation_window_pane_set_bar_mode (pane, NAUTILUS_BAR_NAVIGATION);
+		} else {
+			nautilus_navigation_window_pane_set_bar_mode (pane, NAUTILUS_BAR_PATH);
+		}
 	}
 	
 	if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_SIDEBAR)) {
diff --git a/src/nautilus-navigation-window.h b/src/nautilus-navigation-window.h
index 791c66b..25476f4 100644
--- a/src/nautilus-navigation-window.h
+++ b/src/nautilus-navigation-window.h
@@ -63,13 +63,7 @@ struct _NautilusNavigationWindow {
         
         /** UI stuff **/
         NautilusSidePane *sidebar;
-
-        GtkSizeGroup *navigation_group;
-        GtkWidget *navigation_bar;
-	GtkWidget *path_bar;
-        GtkWidget *search_bar;
-
-	GtkWidget *notebook;
+        GtkWidget *notebook;
 
         /* Current views stuff */
         GList *sidebar_panels;
@@ -89,18 +83,6 @@ void     nautilus_navigation_window_clear_back_list      (NautilusNavigationWind
 void     nautilus_navigation_window_clear_forward_list   (NautilusNavigationWindow *window);
 void     nautilus_forget_history                         (void);
 gint     nautilus_navigation_window_get_base_page_index  (NautilusNavigationWindow *window);
-void     nautilus_navigation_window_hide_location_bar    (NautilusNavigationWindow *window,
-                                                          gboolean                  save_preference);
-void     nautilus_navigation_window_show_location_bar    (NautilusNavigationWindow *window,
-                                                          gboolean                  save_preference);
-
-void     nautilus_navigation_window_hide_path_bar        (NautilusNavigationWindow *window);
-void     nautilus_navigation_window_show_path_bar        (NautilusNavigationWindow *window);
-gboolean nautilus_navigation_window_path_bar_showing 	 (NautilusNavigationWindow *window);
-
-gboolean nautilus_navigation_window_search_bar_showing 	 (NautilusNavigationWindow *window);
-
-gboolean nautilus_navigation_window_location_bar_showing (NautilusNavigationWindow *window);
 void     nautilus_navigation_window_hide_toolbar         (NautilusNavigationWindow *window);
 void     nautilus_navigation_window_show_toolbar         (NautilusNavigationWindow *window);
 gboolean nautilus_navigation_window_toolbar_showing      (NautilusNavigationWindow *window);
@@ -119,8 +101,11 @@ void     nautilus_navigation_window_back_or_forward      (NautilusNavigationWind
                                                           guint                     distance,
 							  gboolean                  new_tab);
 void     nautilus_navigation_window_show_search          (NautilusNavigationWindow *window);
+void     nautilus_navigation_window_unset_focus_widget   (NautilusNavigationWindow *window);
+gboolean nautilus_navigation_window_hide_temporary_bars  (NautilusNavigationWindow *window);
 void     nautilus_navigation_window_hide_search          (NautilusNavigationWindow *window);
-void     nautilus_navigation_window_set_search_button	  (NautilusNavigationWindow *window,
-							   gboolean		    state);
+void     nautilus_navigation_window_set_search_button	 (NautilusNavigationWindow *window,
+                                                          gboolean		    state);
+void     nautilus_navigation_window_restore_focus_widget (NautilusNavigationWindow *window);
 
 #endif
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index df6d7e6..03efe07 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -40,6 +40,7 @@
 #include "nautilus-trash-bar.h"
 #include "nautilus-x-content-bar.h"
 #include "nautilus-zoom-control.h"
+#include "nautilus-navigation-window-pane.h"
 #include <eel/eel-accessibility.h>
 #include <eel/eel-debug.h>
 #include <eel/eel-gdk-extensions.h>
@@ -294,25 +295,25 @@ handle_go_elsewhere (NautilusWindowSlot *slot, GFile *location)
 #endif
 }
 
-static void
-update_up_button (NautilusWindow *window)
+void
+nautilus_window_update_up_button (NautilusWindow *window)
 {
-	NautilusWindowSlot *slot;
-        gboolean allowed;
-	GFile *parent;
-
-	slot = window->details->active_pane->active_slot;
-
-        allowed = FALSE;
-        if (slot->location != NULL) {
-		parent = g_file_get_parent (slot->location);
-		allowed = parent != NULL;
-		if (parent != NULL) {
-			g_object_unref (parent);
+    NautilusWindowSlot *slot;
+    gboolean allowed;
+    GFile *parent;
+
+    slot = window->details->active_pane->active_slot;
+
+    allowed = FALSE;
+    if (slot->location != NULL) {
+        parent = g_file_get_parent (slot->location);
+        allowed = parent != NULL;
+        if (parent != NULL) {
+            g_object_unref (parent);
 		}
-        }
+    }
 
-        nautilus_window_allow_up (window, allowed);
+    nautilus_window_allow_up (window, allowed);
 }
 
 static void
@@ -377,11 +378,11 @@ viewed_file_changed_callback (NautilusFile *file,
 					/* the path bar URI will be set to go_to_uri immediately
 					 * in begin_location_change, but we don't want the
 					 * inexistant children to show up anymore */
-					if (slot == window->details->active_pane->active_slot) {
+					if (slot == slot->pane->active_slot) {
 						/* multiview-TODO also update NautilusWindowSlot
 						 * [which as of writing doesn't save/store any path bar state]
 						 */
-						nautilus_path_bar_clear_buttons (NAUTILUS_PATH_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->path_bar));
+						nautilus_path_bar_clear_buttons (NAUTILUS_PATH_BAR (NAUTILUS_NAVIGATION_WINDOW_PANE (slot->pane)->path_bar));
 					}
 
 					nautilus_window_slot_go_to (slot, go_to_file, FALSE);
@@ -1547,40 +1548,9 @@ found_mount_cb (GObject *source_object,
 void
 nautilus_window_sync_location_widgets (NautilusWindow *window)
 {
-	NautilusWindowSlot *slot;
-	char *uri;
-
-	slot = window->details->active_pane->active_slot;
-
-	if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
-		NautilusNavigationWindowSlot *navigation_slot;
-
-		navigation_slot = NAUTILUS_NAVIGATION_WINDOW_SLOT (slot);
-
-		/* Check if the back and forward buttons need enabling or disabling. */
-		update_up_button (window);
-		nautilus_navigation_window_allow_back (NAUTILUS_NAVIGATION_WINDOW (window),
-						       navigation_slot->back_list != NULL);
-		nautilus_navigation_window_allow_forward (NAUTILUS_NAVIGATION_WINDOW (window),
-							  navigation_slot->forward_list != NULL);
-
-		/* Change the location bar and path bar to match the current location. */
-		if (slot->location != NULL) {
-			/* this may be NULL if we just created the
- 			 * slot */
-			uri = nautilus_window_slot_get_location_uri (slot);
-			nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->navigation_bar),
-							      uri);
-			g_free (uri);
-			nautilus_path_bar_set_path (NAUTILUS_PATH_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->path_bar),
-						    slot->location);
-		}
-	}
-
-	if (NAUTILUS_IS_SPATIAL_WINDOW (window)) {
-		/* Change the location button to match the current location. */
-		nautilus_spatial_window_set_location_button (NAUTILUS_SPATIAL_WINDOW (window),
-							     slot->location);
+	GList *walk;
+	for (walk = window->details->panes; walk; walk = walk->next) {
+		nautilus_window_pane_sync_location_widgets (walk->data);
 	}
 }
 
@@ -1629,7 +1599,7 @@ update_for_new_location (NautilusWindowSlot *slot)
 
 	if (slot == window->details->active_pane->active_slot) {
 		/* Check if we can go up. */
-		update_up_button (window);
+		nautilus_window_update_up_button (window);
 	}
 
 	if (slot == window->details->active_pane->active_slot) {
diff --git a/src/nautilus-window-manage-views.h b/src/nautilus-window-manage-views.h
index d2a9290..dd85eda 100644
--- a/src/nautilus-window-manage-views.h
+++ b/src/nautilus-window-manage-views.h
@@ -44,5 +44,6 @@ void nautilus_window_report_view_failed       (NautilusWindow     *window,
 void nautilus_window_report_load_complete     (NautilusWindow     *window,
                                                NautilusView       *view);
 void nautilus_window_report_location_change   (NautilusWindow     *window);
+void nautilus_window_update_up_button         (NautilusWindow     *window);
 
 #endif /* NAUTILUS_WINDOW_MANAGE_VIEWS_H */
diff --git a/src/nautilus-window-pane.c b/src/nautilus-window-pane.c
index 4551ed7..43ef05b 100644
--- a/src/nautilus-window-pane.c
+++ b/src/nautilus-window-pane.c
@@ -23,6 +23,9 @@
 */
 
 #include "nautilus-window-pane.h"
+#include "nautilus-window-private.h"
+#include "nautilus-navigation-window-pane.h"
+#include "nautilus-window-manage-views.h"
 
 static void nautilus_window_pane_init       (NautilusWindowPane *pane);
 static void nautilus_window_pane_class_init (NautilusWindowPaneClass *class);
@@ -33,6 +36,94 @@ G_DEFINE_TYPE (NautilusWindowPane,
 	       G_TYPE_OBJECT)
 #define parent_class nautilus_window_pane_parent_class
 
+void
+nautilus_window_pane_zoom_in (NautilusWindowPane *pane)
+{
+	NautilusWindowSlot *slot;
+
+	g_assert (pane != NULL);
+
+	nautilus_window_set_active_pane (pane->window, pane);
+
+	slot = pane->active_slot;
+	if (slot->content_view != NULL) {
+		nautilus_view_bump_zoom_level (slot->content_view, 1);
+	}
+}
+
+void
+nautilus_window_pane_zoom_to_level (NautilusWindowPane *pane,
+			       NautilusZoomLevel level)
+{
+	NautilusWindowSlot *slot;
+
+	g_assert (pane != NULL);
+
+	nautilus_window_set_active_pane (pane->window, pane);
+
+	slot = pane->active_slot;
+	if (slot->content_view != NULL) {
+		nautilus_view_zoom_to_level (slot->content_view, level);
+	}
+}
+
+void
+nautilus_window_pane_zoom_out (NautilusWindowPane *pane)
+{
+	NautilusWindowSlot *slot;
+
+	g_assert (pane != NULL);
+
+	nautilus_window_set_active_pane (pane->window, pane);
+
+	slot = pane->active_slot;
+	if (slot->content_view != NULL) {
+		nautilus_view_bump_zoom_level (slot->content_view, -1);
+	}
+}
+
+void
+nautilus_window_pane_zoom_to_default (NautilusWindowPane *pane)
+{
+	NautilusWindowSlot *slot;
+
+	g_assert (pane != NULL);
+
+	nautilus_window_set_active_pane (pane->window, pane);
+
+	slot = pane->active_slot;
+	if (slot->content_view != NULL) {
+		nautilus_view_restore_default_zoom_level (slot->content_view);
+	}
+}
+
+void
+nautilus_window_pane_sync_location_widgets (NautilusWindowPane *pane)
+{
+	if (NAUTILUS_IS_NAVIGATION_WINDOW_PANE (pane)) {
+		NautilusNavigationWindowSlot *navigation_slot;
+		
+		nautilus_navigation_window_pane_sync_location_widgets (NAUTILUS_NAVIGATION_WINDOW_PANE (pane));
+		nautilus_window_update_up_button (pane->window);
+		
+		/* Check if the back and forward buttons need enabling or disabling. */
+		navigation_slot = NAUTILUS_NAVIGATION_WINDOW_SLOT (pane->window->details->active_pane->active_slot);
+		nautilus_navigation_window_allow_back (NAUTILUS_NAVIGATION_WINDOW (pane->window),
+						       navigation_slot->back_list != NULL);
+		nautilus_navigation_window_allow_forward (NAUTILUS_NAVIGATION_WINDOW (pane->window),
+							  navigation_slot->forward_list != NULL);
+
+	}
+
+	if (NAUTILUS_IS_SPATIAL_WINDOW (pane->window)) {
+		NautilusWindowSlot *slot;
+
+		slot = pane->window->details->active_pane->active_slot;
+		/* Change the location button to match the current location. */
+		nautilus_spatial_window_set_location_button (NAUTILUS_SPATIAL_WINDOW (pane->window),
+							     slot->location);
+	}
+}
 
 static void
 nautilus_window_pane_init (NautilusWindowPane *pane)
@@ -40,6 +131,17 @@ nautilus_window_pane_init (NautilusWindowPane *pane)
 	pane->slots = NULL;
 	pane->active_slots = NULL;
 	pane->active_slot = NULL;
+    pane->is_active = FALSE;
+}
+
+void
+nautilus_window_pane_set_active (NautilusWindowPane *pane, gboolean is_active)
+{
+	if (is_active == pane->is_active) {
+		return;
+	}
+
+	pane->is_active = is_active;
 }
 
 static void
diff --git a/src/nautilus-window-pane.h b/src/nautilus-window-pane.h
index 5c205ec..a5424ff 100644
--- a/src/nautilus-window-pane.h
+++ b/src/nautilus-window-pane.h
@@ -61,10 +61,20 @@ struct _NautilusWindowPane {
 	GList *slots;
 	GList *active_slots;
 	NautilusWindowSlot *active_slot;
+
+	/* whether or not this pane is active */
+	gboolean is_active;    
 };
 
 GType nautilus_window_pane_get_type (void);
 NautilusWindowPane *nautilus_window_pane_new (NautilusWindow *window);
 
 
+void nautilus_window_pane_zoom_in (NautilusWindowPane *pane);
+void nautilus_window_pane_zoom_to_level (NautilusWindowPane *pane, NautilusZoomLevel level);
+void nautilus_window_pane_zoom_out (NautilusWindowPane *pane);
+void nautilus_window_pane_zoom_to_default (NautilusWindowPane *pane);
+void nautilus_window_pane_sync_location_widgets (NautilusWindowPane *pane);
+void nautilus_window_pane_set_active (NautilusWindowPane *pane, gboolean is_active);
+
 #endif /* NAUTILUS_WINDOW_PANE_H */
diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
index 46531d0..3afc9ff 100644
--- a/src/nautilus-window-private.h
+++ b/src/nautilus-window-private.h
@@ -86,16 +86,6 @@ struct _NautilusNavigationWindowDetails {
         GtkWidget *content_box;
         GtkActionGroup *navigation_action_group; /* owned by ui_manager */
         
-        /* Location bar */
-        gboolean temporary_navigation_bar;
-        gboolean temporary_location_bar;
-        gboolean temporary_search_bar;
-
-        GtkWidget *location_button;
-	/* focus widget before the location bar
-	 * has been shown temporarily */
-	GtkWidget *last_focus_widget;
-
         /* Side Pane */
         int side_pane_width;
         NautilusSidebar *current_side_panel;
@@ -110,7 +100,6 @@ struct _NautilusNavigationWindowDetails {
 
         /* Toolbar */
         GtkWidget *toolbar;
-        GtkWidget *location_bar;
 
         guint extensions_toolbar_merge_id;
         GtkActionGroup *extensions_toolbar_action_group;
@@ -118,6 +107,9 @@ struct _NautilusNavigationWindowDetails {
 	/* Throbber */
         gboolean    throbber_active;
         GtkWidget  *throbber;
+
+        /* focus widget before the location bar has been shown temporarily */
+        GtkWidget *last_focus_widget;
 };
 
 #define NAUTILUS_MENU_PATH_BACK_ITEM			"/menu/Go/Back"
@@ -197,7 +189,7 @@ NautilusWindowSlot *nautilus_window_get_slot_for_content_box             (Nautil
 
 GList *              nautilus_window_get_slots                           (NautilusWindow    *window);
 NautilusWindowSlot * nautilus_window_get_active_slot                     (NautilusWindow    *window);
-void                 nautilus_window_set_active_slot                     (NautilusWindowPane *pane,
+void                 nautilus_window_set_active_slot                     (NautilusWindow    *window,
 									  NautilusWindowSlot *slot);
 void                 nautilus_window_set_active_pane                     (NautilusWindow *window,
                                                                           NautilusWindowPane *new_pane);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 124141f..8a5e2ee 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -41,6 +41,7 @@
 #include "nautilus-navigation-window-slot.h"
 #include "nautilus-zoom-control.h"
 #include "nautilus-search-bar.h"
+#include "nautilus-navigation-window-pane.h"
 #include <eel/eel-debug.h>
 #include <eel/eel-marshal.h>
 #include <eel/eel-gtk-macros.h>
@@ -421,54 +422,34 @@ nautilus_window_sync_search_widgets (NautilusWindow *window)
 void
 nautilus_window_zoom_in (NautilusWindow *window)
 {
-	NautilusWindowSlot *slot;
-
 	g_assert (window != NULL);
 
-	slot = window->details->active_pane->active_slot;
-	if (slot->content_view != NULL) {
-		nautilus_view_bump_zoom_level (slot->content_view, 1);
-	}
+	nautilus_window_pane_zoom_in (window->details->active_pane);
 }
 
 void
 nautilus_window_zoom_to_level (NautilusWindow *window,
 			       NautilusZoomLevel level)
 {
-	NautilusWindowSlot *slot;
-
 	g_assert (window != NULL);
 
-	slot = window->details->active_pane->active_slot;
-	if (slot->content_view != NULL) {
-		nautilus_view_zoom_to_level (slot->content_view, level);
-	}
+	nautilus_window_pane_zoom_to_level (window->details->active_pane, level);
 }
 
 void
 nautilus_window_zoom_out (NautilusWindow *window)
 {
-	NautilusWindowSlot *slot;
-
 	g_assert (window != NULL);
 
-	slot = window->details->active_pane->active_slot;
-	if (slot->content_view != NULL) {
-		nautilus_view_bump_zoom_level (slot->content_view, -1);
-	}
+	nautilus_window_pane_zoom_out (window->details->active_pane);
 }
 
 void
 nautilus_window_zoom_to_default (NautilusWindow *window)
 {
-	NautilusWindowSlot *slot;
-
 	g_assert (window != NULL);
 
-	slot = window->details->active_pane->active_slot;
-	if (slot->content_view != NULL) {
-		nautilus_view_restore_default_zoom_level (slot->content_view);
-	}
+	nautilus_window_pane_zoom_to_default (window->details->active_pane);
 }
 
 /* Code should never force the window taller than this size.
@@ -651,7 +632,7 @@ nautilus_window_constructor (GType type,
 	window = NAUTILUS_WINDOW (object);
 
 	slot = nautilus_window_open_slot (window->details->active_pane, 0);
-	nautilus_window_set_active_slot (window->details->active_pane, slot);
+	nautilus_window_set_active_slot (window, slot);
 
 	return object;
 }
@@ -784,77 +765,109 @@ nautilus_window_get_active_pane (NautilusWindow *window)
 	return window->details->active_pane;
 }
 
+static void
+real_set_active_pane (NautilusWindow *window, NautilusWindowPane *new_pane)
+{
+	/* make old pane inactive, and new one active.
+	 * Currently active pane may be NULL (after init). */
+	if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
+		if (new_pane->window->details->active_pane) {
+			nautilus_navigation_window_pane_set_active
+				(NAUTILUS_NAVIGATION_WINDOW_PANE (new_pane->window->details->active_pane), FALSE);
+		}
+		nautilus_navigation_window_pane_set_active (NAUTILUS_NAVIGATION_WINDOW_PANE (new_pane), TRUE);
+	}
+	else {
+		if (new_pane->window->details->active_pane) {
+			nautilus_window_pane_set_active (new_pane->window->details->active_pane, FALSE);
+		}
+		nautilus_window_pane_set_active (new_pane, TRUE);
+	}
+
+	window->details->active_pane = new_pane;
+}
+
+/* Make the given pane the active pane of its associated window. This
+ * always implies making the containing active slot the active slot of
+ * the window. */
 void
 nautilus_window_set_active_pane (NautilusWindow *window,
 				 NautilusWindowPane *new_pane)
 {
-	/* hhb: TODO: temporary implementaion */
-	window->details->active_pane = new_pane;
+	g_assert (NAUTILUS_IS_WINDOW_PANE (new_pane));
+	if (new_pane->active_slot) {
+		nautilus_window_set_active_slot (window, new_pane->active_slot);
+	}
+	else if (new_pane != window->details->active_pane) {
+		real_set_active_pane (window, new_pane);
+	}
 }
 
+/* Make both, the given slot the active slot and its corresponding
+ * pane the active pane of the associated window.
+ * new_slot may be NULL. */
 void
-nautilus_window_set_active_slot (NautilusWindowPane *pane,
-				 NautilusWindowSlot *new_slot)
+nautilus_window_set_active_slot (NautilusWindow *window, NautilusWindowSlot *new_slot)
 {
-	NautilusWindow *window;
 	NautilusWindowSlot *old_slot;
-	NautilusWindowPane *new_pane;
-	GList *walk;
-
-	g_assert (NAUTILUS_IS_WINDOW_PANE (pane));
 
-	window = pane->window;
 	g_assert (NAUTILUS_IS_WINDOW (window));
 
-	/* find the pane that contains the new slot */
-	for (walk = window->details->panes; walk; walk = walk->next) {
-		new_pane = walk->data;
-		if (g_list_find (new_pane->slots, new_slot)) {
-			nautilus_window_set_active_pane (window, new_pane);
-			break;
-		}
-	}
-
-	if (new_slot != NULL) {
+	if (new_slot) {
 		g_assert (NAUTILUS_IS_WINDOW_SLOT (new_slot));
+		g_assert (NAUTILUS_IS_WINDOW_PANE (new_slot->pane));
 		g_assert (window == new_slot->pane->window);
-		g_assert (g_list_find (window->details->active_pane->slots, new_slot) != NULL);
+		g_assert (g_list_find (new_slot->pane->slots, new_slot) != NULL);
 	}
 
-	old_slot = window->details->active_pane->active_slot;
+	if (NAUTILUS_IS_WINDOW_PANE (window->details->active_pane)) {
+		old_slot = window->details->active_pane->active_slot;
+	}
+	else {
+		old_slot = NULL;
+	}
 
 	if (old_slot == new_slot) {
 		return;
 	}
 
+	/* make old slot inactive if it exists (may be NULL after init, for example) */
 	if (old_slot != NULL) {
 		/* inform window */
 		if (old_slot->content_view != NULL) {
 			nautilus_window_slot_disconnect_content_view (old_slot, old_slot->content_view);
 		}
-
+		
 		/* inform slot & view */
 		g_signal_emit_by_name (old_slot, "inactive");
 	}
 
-	window->details->active_pane->active_slot = new_slot;
+	/* deal with panes */
+	if (new_slot && (new_slot->pane != new_slot->pane->window->details->active_pane)) {
+		real_set_active_pane (window, new_slot->pane);
+	}
 
 
-	if (new_slot != NULL) {
-		window->details->active_pane->active_slots = g_list_remove (window->details->active_pane->active_slots, new_slot);
-		window->details->active_pane->active_slots = g_list_prepend (window->details->active_pane->active_slots, new_slot);
+	window->details->active_pane->active_slot = new_slot;
 
+	/* make new slot active, if it exists */
+	if (new_slot) {
+		window->details->active_pane->active_slots =
+			g_list_remove (window->details->active_pane->active_slots, new_slot);
+		window->details->active_pane->active_slots =
+			g_list_prepend (window->details->active_pane->active_slots, new_slot);
+		
 		/* inform sidebar panels */
-		nautilus_window_report_location_change (window);
+                nautilus_window_report_location_change (window);
 		/* TODO decide whether "selection-changed" should be emitted */
 
 		if (new_slot->content_view != NULL) {
-			/* inform window */
-			nautilus_window_slot_connect_content_view (new_slot, new_slot->content_view);
-		}
+                        /* inform window */
+                        nautilus_window_slot_connect_content_view (new_slot, new_slot->content_view);
+                }
 
 		/* inform slot & view */
-		g_signal_emit_by_name (new_slot, "active");
+                g_signal_emit_by_name (new_slot, "active");
 	}
 }
 
@@ -897,7 +910,7 @@ nautilus_window_slot_close (NautilusWindowSlot *slot)
 					next_slot = get_first_inactive_slot (pane);
 				}
 
-				nautilus_window_set_active_slot (pane, next_slot);
+				nautilus_window_set_active_slot (pane->window, next_slot);
 			}
 		}
 



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