Commit 0e731404 authored by Cosimo Cecchi's avatar Cosimo Cecchi

all: assume all windows are navigation windows

parent b6b63e35
...@@ -717,20 +717,14 @@ nautilus_application_close_all_navigation_windows (NautilusApplication *self) ...@@ -717,20 +717,14 @@ nautilus_application_close_all_navigation_windows (NautilusApplication *self)
NautilusWindow *window; NautilusWindow *window;
window = NAUTILUS_WINDOW (l->data); window = NAUTILUS_WINDOW (l->data);
gtk_widget_hide (GTK_WIDGET (window));
if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
gtk_widget_hide (GTK_WIDGET (window));
}
} }
for (l = list_copy; l != NULL; l = l->next) { for (l = list_copy; l != NULL; l = l->next) {
NautilusWindow *window; NautilusWindow *window;
window = NAUTILUS_WINDOW (l->data); window = NAUTILUS_WINDOW (l->data);
nautilus_window_close (window);
if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
nautilus_window_close (window);
}
} }
g_list_free (list_copy); g_list_free (list_copy);
} }
...@@ -791,8 +785,7 @@ another_navigation_window_already_showing (NautilusApplication *application, ...@@ -791,8 +785,7 @@ another_navigation_window_already_showing (NautilusApplication *application,
list = gtk_application_get_windows (GTK_APPLICATION (application)); list = gtk_application_get_windows (GTK_APPLICATION (application));
for (item = list; item != NULL; item = item->next) { for (item = list; item != NULL; item = item->next) {
if (item->data != the_window && if (item->data != the_window) {
NAUTILUS_IS_NAVIGATION_WINDOW (item->data)) {
return TRUE; return TRUE;
} }
} }
......
...@@ -63,7 +63,6 @@ static int button_pressed_signal_id; ...@@ -63,7 +63,6 @@ static int button_pressed_signal_id;
static int key_pressed_signal_id; static int key_pressed_signal_id;
static int jump_button_signal_id; static int jump_button_signal_id;
static NautilusApplication *application; static NautilusApplication *application;
static gboolean parent_is_browser_window;
/* forward declarations */ /* forward declarations */
static guint get_selected_row (void); static guint get_selected_row (void);
...@@ -266,12 +265,6 @@ create_bookmarks_window (NautilusBookmarkList *list, GObject *undo_manager_sourc ...@@ -266,12 +265,6 @@ create_bookmarks_window (NautilusBookmarkList *list, GObject *undo_manager_sourc
application = nautilus_application_dup_singleton (); 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); set_up_close_accelerator (window);
nautilus_undo_share_undo_manager (G_OBJECT (window), undo_manager_source); nautilus_undo_share_undo_manager (G_OBJECT (window), undo_manager_source);
......
...@@ -324,6 +324,9 @@ viewed_file_changed_callback (NautilusFile *file, ...@@ -324,6 +324,9 @@ viewed_file_changed_callback (NautilusFile *file,
* file was never seen in the first place. * file was never seen in the first place.
*/ */
if (slot->viewed_file_seen) { if (slot->viewed_file_seen) {
/* auto-show existing parent. */
GFile *go_to_file, *parent, *location;
/* Detecting a file is gone may happen in the /* Detecting a file is gone may happen in the
* middle of a pending location change, we * middle of a pending location change, we
* need to cancel it before closing the window * need to cancel it before closing the window
...@@ -339,37 +342,30 @@ viewed_file_changed_callback (NautilusFile *file, ...@@ -339,37 +342,30 @@ viewed_file_changed_callback (NautilusFile *file,
*/ */
end_location_change (slot); end_location_change (slot);
if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) { go_to_file = NULL;
/* auto-show existing parent. */ location = nautilus_file_get_location (file);
GFile *go_to_file, *parent, *location; parent = g_file_get_parent (location);
g_object_unref (location);
go_to_file = NULL; if (parent) {
location = nautilus_file_get_location (file); go_to_file = nautilus_find_existing_uri_in_hierarchy (parent);
parent = g_file_get_parent (location); g_object_unref (parent);
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) { if (go_to_file != NULL) {
/* the path bar URI will be set to go_to_uri immediately /* the path bar URI will be set to go_to_uri immediately
* in begin_location_change, but we don't want the * in begin_location_change, but we don't want the
* inexistant children to show up anymore */ * inexistant children to show up anymore */
if (slot == slot->pane->active_slot) { if (slot == slot->pane->active_slot) {
/* multiview-TODO also update NautilusWindowSlot /* multiview-TODO also update NautilusWindowSlot
* [which as of writing doesn't save/store any path bar state] * [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_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);
} }
nautilus_window_slot_go_to (slot, go_to_file, FALSE);
g_object_unref (go_to_file);
} else { } else {
nautilus_window_close (window); nautilus_window_slot_go_home (slot, FALSE);
} }
} }
} else { } else {
...@@ -512,8 +508,7 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot, ...@@ -512,8 +508,7 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
g_assert (target_window != NULL); g_assert (target_window != NULL);
if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) != 0 && if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) != 0) {
NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
g_assert (target_window == window); g_assert (target_window == window);
slot_flags = 0; slot_flags = 0;
......
...@@ -177,9 +177,7 @@ nautilus_window_pane_slot_close (NautilusWindowPane *pane, ...@@ -177,9 +177,7 @@ nautilus_window_pane_slot_close (NautilusWindowPane *pane,
nautilus_window_close_pane (pane); nautilus_window_close_pane (pane);
nautilus_window_set_active_pane (window, next_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 { } else {
nautilus_window_close (window); nautilus_window_close (window);
} }
......
...@@ -1443,24 +1443,22 @@ nautilus_forget_history (void) ...@@ -1443,24 +1443,22 @@ nautilus_forget_history (void)
window_node != NULL; window_node != NULL;
window_node = window_node->next) { 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) { for (walk = NAUTILUS_WINDOW (window_node->data)->details->panes; walk; walk = walk->next) {
NautilusWindowPane *pane = walk->data; NautilusWindowPane *pane = walk->data;
for (l = pane->slots; l != NULL; l = l->next) { for (l = pane->slots; l != NULL; l = l->next) {
navigation_slot = l->data; navigation_slot = l->data;
nautilus_navigation_window_slot_clear_back_list (navigation_slot); nautilus_navigation_window_slot_clear_back_list (navigation_slot);
nautilus_navigation_window_slot_clear_forward_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); g_object_unref (app);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment