[nautilus/wip/oholy/pathbar-crash-fix: 2/2] pathbar: Fix button list order regressions




commit 67a3fe05ad2e0994101b0a668af1c6c321f0ca47
Author: António Fernandes <antoniof gnome org>
Date:   Sat Mar 19 12:55:04 2022 +0000

    pathbar: Fix button list order regressions
    
    The pathbar code makes the assumption that the first GList link in the
    list of path buttons corresponds to the current location and that each
    subsequent link is corresponds to the parent location of the previous
    one.
    
    This assumption relied on reversing of the list of buttons, which I've
    broken in commit eab10931491aba1c2d92ec716d8c9de91660c85d
    
    Fix the misbehaviours by restoring the list reversion.

 src/nautilus-pathbar.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 04420474b..8266ec8ed 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -1248,14 +1248,17 @@ nautilus_path_bar_update_path (NautilusPathBar *self,
     }
 
     nautilus_path_bar_clear_buttons (self);
-    self->button_list = new_buttons;
 
-    for (l = self->button_list; l; l = l->next)
+    for (l = new_buttons; l; l = l->next)
     {
         GtkWidget *container;
         container = BUTTON_DATA (l->data)->container;
         gtk_box_append (GTK_BOX (self->buttons_box), container);
     }
+
+    /* Buttons are listed in reverse order such that the current location is
+     * always the first link. */
+    self->button_list = g_list_reverse (new_buttons);
 }
 
 void


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