Short-circuit on destroy. (gtk_notebook_destroy): Destroy tab_label
2007-11-26 Matthias Clasen <mclasen@redhat.com> * gtk/gtknotebook.c (gtk_notebook_update_labels): Short-circuit on destroy. (gtk_notebook_destroy): Destroy tab_label widgets. (#388321, Morten Welinder) svn path=/branches/gtk-2-12/; revision=19060
This commit is contained in:
committed by
Matthias Clasen
parent
61ae384fcc
commit
310b25767c
@@ -1,3 +1,12 @@
|
||||
2007-11-26 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
Merged from trunk:
|
||||
|
||||
* gtk/gtknotebook.c (gtk_notebook_update_labels): Short-circuit on
|
||||
destroy.
|
||||
(gtk_notebook_destroy): Destroy tab_label widgets. (#388321,
|
||||
Morten Welinder)
|
||||
|
||||
2007-11-26 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
Merged from trunk:
|
||||
|
||||
@@ -212,6 +212,8 @@ static void gtk_notebook_move_focus_out (GtkNotebook *notebook,
|
||||
static gboolean gtk_notebook_reorder_tab (GtkNotebook *notebook,
|
||||
GtkDirectionType direction_type,
|
||||
gboolean move_to_last);
|
||||
static void gtk_notebook_remove_tab_label (GtkNotebook *notebook,
|
||||
GtkNotebookPage *page);
|
||||
|
||||
/*** GtkObject Methods ***/
|
||||
static void gtk_notebook_destroy (GtkObject *object);
|
||||
@@ -1453,7 +1455,8 @@ gtk_notebook_destroy (GtkObject *object)
|
||||
{
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK (object);
|
||||
GtkNotebookPrivate *priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
|
||||
|
||||
GList *l;
|
||||
|
||||
if (notebook->menu)
|
||||
gtk_notebook_popup_disable (notebook);
|
||||
|
||||
@@ -1469,6 +1472,23 @@ gtk_notebook_destroy (GtkObject *object)
|
||||
priv->switch_tab_timer = 0;
|
||||
}
|
||||
|
||||
for (l = notebook->children; l; l = l->next)
|
||||
{
|
||||
GtkNotebookPage *page = l->data;
|
||||
GtkWidget *w = page->tab_label;
|
||||
if (w) {
|
||||
g_object_ref (w);
|
||||
gtk_notebook_remove_tab_label (notebook, page);
|
||||
gtk_widget_destroy (w);
|
||||
g_object_unref (w);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Prevent gtk_notebook_update_labels from doing work. (And from crashing
|
||||
* since we have NULL tab_labels all over.
|
||||
*/
|
||||
notebook->show_tabs = FALSE;
|
||||
|
||||
GTK_OBJECT_CLASS (gtk_notebook_parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
@@ -4380,6 +4400,9 @@ gtk_notebook_update_labels (GtkNotebook *notebook)
|
||||
gchar string[32];
|
||||
gint page_num = 1;
|
||||
|
||||
if (!notebook->show_tabs && !notebook->menu)
|
||||
return;
|
||||
|
||||
for (list = gtk_notebook_search_page (notebook, NULL, STEP_NEXT, FALSE);
|
||||
list;
|
||||
list = gtk_notebook_search_page (notebook, list, STEP_NEXT, FALSE))
|
||||
|
||||
Reference in New Issue
Block a user