Prevent the destruction of the menu label on page removal

In certain cases the menu label of a notebook page will be reused after the
page was removed from the notebook, for instance when a page is dragged from
one notebook to another. For such cases make sure that the menu label isn't
destroyed as part of destroying the menu item it was in.
This commit is contained in:
Sjoerd Simons 2010-03-22 14:11:05 -04:00 committed by Tristan Van Berkom
parent b1ca3163a6
commit 177973bdfc

View File

@ -4656,17 +4656,20 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
if (destroying) if (destroying)
gtk_widget_destroy (tab_label); gtk_widget_destroy (tab_label);
g_object_unref (tab_label); g_object_unref (tab_label);
} }
if (notebook->menu) if (notebook->menu)
{ {
gtk_container_remove (GTK_CONTAINER (notebook->menu), GtkWidget *parent = page->menu_label->parent;
page->menu_label->parent);
gtk_notebook_menu_label_unparent (parent, NULL);
gtk_container_remove (GTK_CONTAINER (notebook->menu), parent);
gtk_widget_queue_resize (notebook->menu); gtk_widget_queue_resize (notebook->menu);
} }
if (!page->default_menu) if (!page->default_menu)
g_object_unref (page->menu_label); g_object_unref (page->menu_label);
g_list_free (list); g_list_free (list);
if (page->last_focus_child) if (page->last_focus_child)