- gtk_container_add((GtkContainer*)align, tool->GetControl()->m_widget);
- gtk_toolbar_insert_widget(
- m_toolbar,
- align,
- (const char *) NULL,
- (const char *) NULL,
- posGtk
- );
- // release reference obtained by wxInsertChildInToolBar
- g_object_unref(tool->GetControl()->m_widget);
+ gtk_container_add(GTK_CONTAINER(align),
+ tool->GetControl()->m_widget);
+ gtk_toolbar_insert_widget(m_toolbar, align, NULL, NULL, posGtk);
+
+ // remember the container we're in so that we could remove
+ // ourselves from it when we're detached from the toolbar
+ tool->m_item = align;