[nautilus] all: assume all windows are navigation windows



commit 0e73140437c97c23b480f137ce8c88113900a336
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Feb 17 13:10:51 2011 -0500

    all: assume all windows are navigation windows

 src/nautilus-application.c         |   13 ++------
 src/nautilus-bookmarks-window.c    |    7 ----
 src/nautilus-window-manage-views.c |   55 ++++++++++++++++-------------------
 src/nautilus-window-pane.c         |    4 +--
 src/nautilus-window.c              |   24 +++++++--------
 5 files changed, 40 insertions(+), 63 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 785afe8..8de6f70 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -717,20 +717,14 @@ nautilus_application_close_all_navigation_windows (NautilusApplication *self)
 		NautilusWindow *window;
 		
 		window = NAUTILUS_WINDOW (l->data);
-
-		if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
-			gtk_widget_hide (GTK_WIDGET (window));
-		}
+		gtk_widget_hide (GTK_WIDGET (window));
 	}
 
 	for (l = list_copy; l != NULL; l = l->next) {
 		NautilusWindow *window;
 		
 		window = NAUTILUS_WINDOW (l->data);
-		
-		if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
-			nautilus_window_close (window);
-		}
+		nautilus_window_close (window);
 	}
 	g_list_free (list_copy);
 }
@@ -791,8 +785,7 @@ another_navigation_window_already_showing (NautilusApplication *application,
 	
 	list = gtk_application_get_windows (GTK_APPLICATION (application));
 	for (item = list; item != NULL; item = item->next) {
-		if (item->data != the_window &&
-		    NAUTILUS_IS_NAVIGATION_WINDOW (item->data)) {
+		if (item->data != the_window) {
 			return TRUE;
 		}
 	}
diff --git a/src/nautilus-bookmarks-window.c b/src/nautilus-bookmarks-window.c
index 15e46bb..94c69c4 100644
--- a/src/nautilus-bookmarks-window.c
+++ b/src/nautilus-bookmarks-window.c
@@ -63,7 +63,6 @@ static int                   button_pressed_signal_id;
 static int                   key_pressed_signal_id;
 static int                   jump_button_signal_id;
 static NautilusApplication  *application;
-static gboolean              parent_is_browser_window;
 
 /* forward declarations */
 static guint    get_selected_row                            (void);
@@ -266,12 +265,6 @@ create_bookmarks_window (NautilusBookmarkList *list, GObject *undo_manager_sourc
 
 	application = nautilus_application_dup_singleton ();
 
-	if (NAUTILUS_IS_NAVIGATION_WINDOW (undo_manager_source)) {
-		parent_is_browser_window = TRUE;
-	} else {
-		parent_is_browser_window = FALSE;
-	}
-
 	set_up_close_accelerator (window);
 	nautilus_undo_share_undo_manager (G_OBJECT (window), undo_manager_source);
 
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 90f2276..92bdd84 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -324,6 +324,9 @@ viewed_file_changed_callback (NautilusFile *file,
                  * file was never seen in the first place.
                  */
                 if (slot->viewed_file_seen) {
+			/* auto-show existing parent. */
+			GFile *go_to_file, *parent, *location;
+
                         /* Detecting a file is gone may happen in the
                          * middle of a pending location change, we
                          * need to cancel it before closing the window
@@ -339,37 +342,30 @@ viewed_file_changed_callback (NautilusFile *file,
                          */
 			end_location_change (slot);
 
-			if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
-				/* auto-show existing parent. */
-				GFile *go_to_file, *parent, *location;
-
-				go_to_file = NULL;
-				location =  nautilus_file_get_location (file);
-				parent = g_file_get_parent (location);
-				g_object_unref (location);
-				if (parent) {
-					go_to_file = nautilus_find_existing_uri_in_hierarchy (parent);
-					g_object_unref (parent);
-				}
+			go_to_file = NULL;
+			location =  nautilus_file_get_location (file);
+			parent = g_file_get_parent (location);
+			g_object_unref (location);
+			if (parent) {
+				go_to_file = nautilus_find_existing_uri_in_hierarchy (parent);
+				g_object_unref (parent);
+			}
 				
-				if (go_to_file != NULL) {
-					/* 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 == 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_PANE (slot->pane)->path_bar));
-					}
-
-					nautilus_window_slot_go_to (slot, go_to_file, FALSE);
-					g_object_unref (go_to_file);
-				} else {
-					nautilus_window_slot_go_home (slot, FALSE);
+			if (go_to_file != NULL) {
+				/* 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 == 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_PANE (slot->pane)->path_bar));
 				}
+				
+				nautilus_window_slot_go_to (slot, go_to_file, FALSE);
+				g_object_unref (go_to_file);
 			} else {
-				nautilus_window_close (window);
+				nautilus_window_slot_go_home (slot, FALSE);
 			}
                 }
 	} else {
@@ -512,8 +508,7 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
 
         g_assert (target_window != NULL);
 
-	if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) != 0 &&
-	    NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
+	if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) != 0) {
 		g_assert (target_window == window);
 
 		slot_flags = 0;
diff --git a/src/nautilus-window-pane.c b/src/nautilus-window-pane.c
index 7e4456c..689f7a5 100644
--- a/src/nautilus-window-pane.c
+++ b/src/nautilus-window-pane.c
@@ -177,9 +177,7 @@ nautilus_window_pane_slot_close (NautilusWindowPane *pane,
 				nautilus_window_close_pane (pane);
 				nautilus_window_set_active_pane (window, next_pane);
 
-				if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
-					nautilus_navigation_window_update_show_hide_menu_items (NAUTILUS_NAVIGATION_WINDOW (window));
-				}
+				nautilus_navigation_window_update_show_hide_menu_items (NAUTILUS_NAVIGATION_WINDOW (window));
 			} else {
 				nautilus_window_close (window);
 			}
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 9d4910c..c9450ef 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1443,24 +1443,22 @@ nautilus_forget_history (void)
 	     window_node != NULL;
 	     window_node = window_node->next) {
 
-		if (NAUTILUS_IS_NAVIGATION_WINDOW (window_node->data)) {
-			NautilusNavigationWindow *window;
+		NautilusNavigationWindow *window;
 			
-			window = NAUTILUS_NAVIGATION_WINDOW (window_node->data);
+		window = NAUTILUS_NAVIGATION_WINDOW (window_node->data);
 
-			for (walk = NAUTILUS_WINDOW (window_node->data)->details->panes; walk; walk = walk->next) {
-				NautilusWindowPane *pane = walk->data;
-				for (l = pane->slots; l != NULL; l = l->next) {
-					navigation_slot = l->data;
+		for (walk = NAUTILUS_WINDOW (window_node->data)->details->panes; walk; walk = walk->next) {
+			NautilusWindowPane *pane = walk->data;
+			for (l = pane->slots; l != NULL; l = l->next) {
+				navigation_slot = l->data;
 
-					nautilus_navigation_window_slot_clear_back_list (navigation_slot);
-					nautilus_navigation_window_slot_clear_forward_list (navigation_slot);
-				}
+				nautilus_navigation_window_slot_clear_back_list (navigation_slot);
+				nautilus_navigation_window_slot_clear_forward_list (navigation_slot);
 			}
-
-			nautilus_navigation_window_allow_back (window, FALSE);
-			nautilus_navigation_window_allow_forward (window, FALSE);
 		}
+
+		nautilus_navigation_window_allow_back (window, FALSE);
+		nautilus_navigation_window_allow_forward (window, FALSE);
 	}
 
 	g_object_unref (app);



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