[epiphany/gnome-3-38] notebook: add newly-pinned tabs at end, not at start



commit 9cd05cd5c6cbb8cd4e7f7fa31e9a1b6da9628959
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Mon Nov 30 15:38:45 2020 +0000

    notebook: add newly-pinned tabs at end, not at start
    
    This is slightly nicer, since tabs that you pinned first appear in the
    leftmost position. As a side effect, this also prevents pinned tabs from
    reordering themselves when loading the session.
    
    Fixes #1341
    
    
    (cherry picked from commit 42c2385b62d9b75292574b05009d4f6925f613c4)

 src/ephy-notebook.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index fb0e6aeaa..c68974149 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -1137,14 +1137,18 @@ ephy_notebook_tab_set_pinned (EphyNotebook *notebook,
                               gboolean      is_pinned)
 {
   GtkWidget *tab_label;
+  int last_pinned_tab;
   gboolean expanded;
 
   gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (notebook), embed, !is_pinned);
   tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (notebook), embed);
+
+  /* We have to compute the last pinned tab *before* we pin/unpin this tab. */
+  last_pinned_tab = get_last_pinned_tab_pos (notebook);
   ephy_tab_label_set_pinned (tab_label, is_pinned);
 
   if (is_pinned) {
-    gtk_notebook_reorder_child (GTK_NOTEBOOK (notebook), embed, 0);
+    gtk_notebook_reorder_child (GTK_NOTEBOOK (notebook), embed, last_pinned_tab != -1 ? last_pinned_tab + 1 
: 0);
     expanded = FALSE;
   } else {
     expanded = expand_tabs_bar ();


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