title: How do you add Gtk::Notebook tabs at runtime from Glade definitions?
body: <p>I am creating a new GTK app (using gtkmm) and the main interface is tabbed, a bit like a web browser.</p>
  
  <p>I want to create a new tab for each document the user opens, with the content of each tab being defined by Glade.  I'm new to gtkmm, so I am not sure how to do this.</p>
  
  <p>If I design my tab in Glade as a self-contained window, when I call <code>Gtk::Builder::get_widget()</code> it returns a pointer to the <code>Gtk::Window</code>, but I can't pass this to <code>Gtk::Notebook::append_page()</code> because that function requires a reference and I only have a pointer.  I don't want to dereference the pointer, because I believe each call to <code>get_widget()</code> returns the same pointer - so if I want to add five pages the same, I need to somehow clone the UI structure before adding it to the <code>Gtk::Notebook</code> - otherwise changing a UI element on one tab will cause it to change on the other four tabs too as they are all pointing to the same UI widgets.</p>
  
  <p>What is the best way to take a window designed in Glade and dynamically add it multiple times to a <code>Gtk::Notebook</code>?</p>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Putting each tab's definitions into a separate <code>*.glade</code> file does allow me to load multiple instances so that part is all good.</p>
  
  <p>However I still can't add the loaded structure to the <code>Gtk::Notebook</code>:</p>
  
  <ul>
  <li>If I tell <code>Gtk::Builder::get_widget()</code> to retrieve the root <code>Gtk::Window</code> from the <code>.glade</code> file and add that as the new tab, it won't compile because I have to pass a <code>Gtk::Widget</code> to <code>append_page()</code> and it won't accept a <code>Gtk::Window</code> parameter instead.</li>
  <li><p>If I tell it to pick the top-most widget instead, then I get a bunch of runtime errors:</p>
  
  <pre><code>Can't set a parent on widget which has a parent
  gtkcontainer.c:858: container class `gtkmm__GtkWindow' has no child property named `tab-expand'
  gtkcontainer.c:858: container class `gtkmm__GtkWindow' has no child property named `tab-fill'
  gtkcontainer.c:858: container class `gtkmm__GtkWindow' has no child property named `tab-label'
  gtkcontainer.c:858: container class `gtkmm__GtkWindow' has no child property named `menu-label'
  gtkcontainer.c:858: container class `gtkmm__GtkWindow' has no child property named `position'
  Gtk:ERROR:gtkcontainer.c:3541:gtk_container_propagate_draw: assertion failed: (gtk_widget_get_parent (child) == GTK_WIDGET (container))
  Aborted (core dumped)
  </code></pre></li>
  <li><p>If I take the top-most widget and instead call <code>reparent()</code> and pass the <code>Gtk::Notebook</code> as the new parent then the new tab does show up with all the widgets correctly arranged, but then I can't control the tab's title.</p></li>
  </ul>
  
  <p>There must be a 'correct' way to do this, I just can't figure out what it is!</p>