Merging UI strings into Gtk::Builder?

Carlo Wood <[email protected]> Mon, 27 Jul 2020 15:50:16 +0200
Newsgroups gmane.comp.gnome.gtkmm
Message-ID <[email protected]>
Hi,

the documentation at

https://developer.gnome.org/gtkmm/stable/classGtk_1_1Builder.html#ae3520ee31a98ac30b728f93522de8df5

says: "Parses a string containing a GtkBuilder UI definition and merges
it with the current contents of the builder."

But when I try this:

  Glib::ustring ui_info =
    "<interface>"
    "  <menu id='menu-linuxchess'>"
    "    <submenu>"
...
    "    </submenu>"
    "  </menu>"
    "</interface>";

  Glib::ustring ui_info2 =
    "<interface>"
    "  <menu id='menu-linuxchess'>"
    "    <submenu>"
...
    "    </submenu>"
    "  </menu>" 
    "</interface>";

  m_refBuilder = Gtk::Builder::create();
  m_refBuilder->add_from_string(ui_info);
  m_refBuilder->add_from_string(ui_info2);

Then the last line *replaces* the content of m_refBuilder.
Nothing is merged, I just get a menu with the definition
from ui_info2.

How can I do this?