Re: Merging UI strings into Gtk::Builder?



Both definitions specify the same string for the menu id, so the second definition updates/overwrites the first one. Try using 'menu-linuxchess-2' in the second one...

On 7/27/20 6:50 AM, Carlo Wood wrote:
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?


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list
--
What was that about a rising tide lifting all boats? What if you don't have a boat?
   — Eugene Robinson


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]