summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2020-11-30 09:38:45 -0600
committerMichael Catanzaro <mcatanzaro@gnome.org>2020-11-30 09:38:45 -0600
commite242eceb9577527d063db1ce29d8d1836b418215 (patch)
treeb647f08150ed4805c7fc61d196bfb96770468dc8
parent0c2f7feacd4cc50ac3f9504252e1a2aa552ccd00 (diff)
downloadepiphany-mcatanzaro/#1341.tar.gz
notebook: add newly-pinned tabs at end, not at startmcatanzaro/#1341
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
-rw-r--r--src/ephy-notebook.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 3526e4205..21828657b 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 ();