static void gtk_notebook_redraw_tabs (GtkNotebook *notebook);
static void gtk_notebook_redraw_arrows (GtkNotebook *notebook);
static void gtk_notebook_real_remove (GtkNotebook *notebook,
- GList *list);
+ GList *list,
+ gboolean destroying);
static void gtk_notebook_update_labels (GtkNotebook *notebook);
static gint gtk_notebook_timer (GtkNotebook *notebook);
static gint gtk_notebook_page_compare (gconstpointer a,
static void
gtk_notebook_destroy (GtkObject *object)
{
+ GList *children;
GtkNotebook *notebook = GTK_NOTEBOOK (object);
if (notebook->menu)
gtk_notebook_popup_disable (notebook);
+ children = notebook->children;
+ while (children)
+ {
+ GList *child = children;
+ children = child->next;
+
+ gtk_notebook_real_remove (notebook, child, TRUE);
+ }
+
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
page = children->data;
if (page->child == widget)
{
- gtk_notebook_real_remove (notebook, children);
+ gtk_notebook_real_remove (notebook, children, FALSE);
break;
}
page_num++;
static void
gtk_notebook_real_remove (GtkNotebook *notebook,
- GList *list)
+ GList *list,
+ gboolean destroying)
{
GtkNotebookPage *page;
GList * next_list;
if (notebook->cur_page == list->data)
{
notebook->cur_page = NULL;
- if (next_list)
+ if (next_list && !destroying)
gtk_notebook_switch_page (notebook, GTK_NOTEBOOK_PAGE (next_list), -1);
}
if (list == notebook->first_tab)
notebook->first_tab = next_list;
- if (list == notebook->focus_tab)
+ if (list == notebook->focus_tab && !destroying)
gtk_notebook_switch_focus_tab (notebook, next_list);
page = list->data;
{
list = g_list_nth (notebook->children, page_num);
if (list)
- gtk_notebook_real_remove (notebook, list);
+ gtk_notebook_real_remove (notebook, list, FALSE);
}
else
{
list = g_list_last (notebook->children);
if (list)
- gtk_notebook_real_remove (notebook, list);
+ gtk_notebook_real_remove (notebook, list, FALSE);
}
}