[nautilus] window: Don't change default tab closing behaviour



commit 475684ac9e556b144da594bf25581560d4fa5a7f
Author: ignapk <automat script gmail com>
Date:   Fri Aug 21 01:04:08 2020 +0200

    window: Don't change default tab closing behaviour
    
    Currently when closing the currently focused slot, the next slot to gain
    focus is the earliest created. This is because the default behaviour,
    which is to open the next tab at the same position or the new last tab
    if the previous tab was closed, used in other gnome apps like epiphany
    and terminal is overriden by manually setting active slot to earliest
    inactive one.
    
    To provide consistent behaviour, remove code that overwrites the default
    gtk notebook tab closing behaviour.
    
    Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/1567

 src/nautilus-window.c | 33 +--------------------------------
 1 file changed, 1 insertion(+), 32 deletions(-)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index b241034c2..aefa7f12c 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1427,29 +1427,10 @@ nautilus_window_show_sidebar (NautilusWindow *window)
     setup_side_pane_width (window);
 }
 
-static inline NautilusWindowSlot *
-get_first_inactive_slot (NautilusWindow *window)
-{
-    GList *l;
-    NautilusWindowSlot *slot;
-
-    for (l = window->slots; l != NULL; l = l->next)
-    {
-        slot = NAUTILUS_WINDOW_SLOT (l->data);
-        if (slot != window->active_slot)
-        {
-            return slot;
-        }
-    }
-
-    return NULL;
-}
-
 void
 nautilus_window_slot_close (NautilusWindow     *window,
                             NautilusWindowSlot *slot)
 {
-    NautilusWindowSlot *next_slot;
     NautilusNavigationState *data;
 
     DEBUG ("Requesting to remove slot %p from window %p", slot, window);
@@ -1458,12 +1439,6 @@ nautilus_window_slot_close (NautilusWindow     *window,
         return;
     }
 
-    if (window->active_slot == slot)
-    {
-        next_slot = get_first_inactive_slot (window);
-        nautilus_window_set_active_slot (window, next_slot);
-    }
-
     data = nautilus_window_slot_get_navigation_state (slot);
     if (data != NULL)
     {
@@ -2011,7 +1986,7 @@ notebook_page_removed_cb (GtkNotebook *notebook,
                           gpointer     user_data)
 {
     NautilusWindow *window = user_data;
-    NautilusWindowSlot *slot = NAUTILUS_WINDOW_SLOT (page), *next_slot;
+    NautilusWindowSlot *slot = NAUTILUS_WINDOW_SLOT (page);
     gboolean dnd_slot;
 
     dnd_slot = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (slot), "dnd-window-slot"));
@@ -2020,12 +1995,6 @@ notebook_page_removed_cb (GtkNotebook *notebook,
         return;
     }
 
-    if (window->active_slot == slot)
-    {
-        next_slot = get_first_inactive_slot (window);
-        nautilus_window_set_active_slot (window, next_slot);
-    }
-
     close_slot (window, slot, FALSE);
 }
 


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