if (top->m_mainWidget)
         {
-            // 3) MAGIC HACK: if you ever used GtkExpander in a GTK+ program you know
-            //    that this magic call is required to make it possible to shrink the
-            //    top level window in the expanded->collapsed transition.
-            //    This may be sometimes undesired but *is* necessary and if you look
-            //    carefully, all GTK+ programs using GtkExpander perform this trick
-            //    (e.g. the standard "open file" dialog of GTK+>=2.4 is not resizeable
-            //     when the expander is collapsed!)
+            // 3) MAGIC HACK: if you ever used GtkExpander in a GTK+ program
+            //    you know that this magic call is required to make it possible
+            //    to shrink the top level window in the expanded->collapsed
+            //    transition.  This may be sometimes undesired but *is*
+            //    necessary and if you look carefully, all GTK+ programs using
+            //    GtkExpander perform this trick (e.g. the standard "open file"
+            //    dialog of GTK+>=2.4 is not resizeable when the expander is
+            //    collapsed!)
             gtk_window_set_resizable (GTK_WINDOW (top->m_widget), p->IsExpanded());
 
             // 4) set size hints
-            top->SetSizeHints(sz.x, sz.y);
+            top->SetMinClientSize(sz);
 
             // 5) set size
             top->SetClientSize(sz);
 }
 }
 
-static void
-gtk_collapsiblepane_insert_callback(wxWindowGTK* parent, wxWindowGTK* child)
+void wxCollapsiblePane::AddChildGTK(wxWindowGTK* child)
 {
-    // this callback should be used only once to insert the "pane" into the
+    // should be used only once to insert the "pane" into the
     // GtkExpander widget. wxGenericCollapsiblePane::DoAddChild() will check if
     // it has been called only once (and in any case we would get a warning
     // from the following call as GtkExpander is a GtkBin and can contain only
     // a single child!).
-    gtk_container_add (GTK_CONTAINER (parent->m_widget), child->m_widget);
+    gtk_container_add(GTK_CONTAINER(m_widget), child->m_widget);
 }
 
 //-----------------------------------------------------------------------------
 
     m_widget =
         gtk_expander_new_with_mnemonic(wxGTK_CONV(GTKConvertMnemonics(label)));
+    g_object_ref(m_widget);
 
     // see the gtk_collapsiblepane_expanded_callback comments to understand why
     // we connect to the "notify::expanded" signal instead of the more common
     g_signal_connect(m_widget, "notify::expanded",
                      G_CALLBACK(gtk_collapsiblepane_expanded_callback), this);
 
-    // before creating m_pPane, we need to makesure our own insert callback
-    // will be used
-    m_insertCallback = gtk_collapsiblepane_insert_callback;
-
     // this the real "pane"
     m_pPane = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
                            wxTAB_TRAVERSAL|wxNO_BORDER);