Commit a3ac3b61 authored by Matthias Clasen's avatar Matthias Clasen

Merge branch...

Merge branch '1397-gtknotebook-built-in-popup-menu-listing-tabs-doesn-t-use-tab-label-text-for-the-last-tab-4' into 'master'

Notebook: Ensure menu label updates with tab_label

Closes #1397

See merge request GNOME/gtk!386
parents 532a48aa 4e884b60
Pipeline #36171 failed with stages
in 6 minutes and 39 seconds
......@@ -497,6 +497,8 @@ static void gtk_notebook_menu_switch_page (GtkWidget *widget,
/*** GtkNotebook Menu Functions ***/
static void gtk_notebook_menu_item_create (GtkNotebook *notebook,
GList *list);
static void gtk_notebook_menu_item_recreate (GtkNotebook *notebook,
GList *list);
static void gtk_notebook_menu_label_unparent (GtkWidget *widget,
gpointer data);
static void gtk_notebook_menu_detacher (GtkWidget *widget,
......@@ -5481,6 +5483,7 @@ gtk_notebook_menu_switch_page (GtkWidget *widget,
/* Private GtkNotebook Menu Functions:
*
* gtk_notebook_menu_item_create
* gtk_notebook_menu_item_recreate
* gtk_notebook_menu_label_unparent
* gtk_notebook_menu_detacher
*/
......@@ -5514,6 +5517,19 @@ gtk_notebook_menu_item_create (GtkNotebook *notebook,
gtk_widget_show (menu_item);
}
static void
gtk_notebook_menu_item_recreate (GtkNotebook *notebook,
GList *list)
{
GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page = list->data;
GtkWidget *menu_item = gtk_widget_get_parent (page->menu_label);
gtk_container_remove (GTK_CONTAINER (menu_item), page->menu_label);
gtk_container_remove (GTK_CONTAINER (priv->menu), menu_item);
gtk_notebook_menu_item_create (notebook, list);
}
static void
gtk_notebook_menu_label_unparent (GtkWidget *widget,
gpointer data)
......@@ -6476,7 +6492,6 @@ gtk_notebook_set_tab_label (GtkNotebook *notebook,
if (page->tab_label == tab_label)
return;
gtk_notebook_remove_tab_label (notebook, page);
if (tab_label)
......@@ -6516,6 +6531,9 @@ gtk_notebook_set_tab_label (GtkNotebook *notebook,
gtk_widget_queue_resize (GTK_WIDGET (notebook));
}
if (priv->menu)
gtk_notebook_menu_item_recreate (notebook, list);
child_notify (notebook, child, "tab-label");
}
......@@ -6720,14 +6738,7 @@ gtk_notebook_child_reordered (GtkNotebook *notebook,
list = g_list_find (priv->children, page);
if (priv->menu)
{
GtkWidget *menu_item;
menu_item = gtk_widget_get_parent (page->menu_label);
gtk_container_remove (GTK_CONTAINER (menu_item), page->menu_label);
gtk_container_remove (GTK_CONTAINER (priv->menu), menu_item);
gtk_notebook_menu_item_create (notebook, list);
}
gtk_notebook_menu_item_recreate (notebook, list);
if (list->prev)
sibling = gtk_widget_get_css_node (GTK_NOTEBOOK_PAGE (list->prev)->tab_widget);
......
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