I have the following XML code that I use to generate a GtkMenuBar by means of GtkBuilder:
<?xml version="1.0"?>
<interface>
<menu id="menubar">
<submenu id="submenu">
<attribute name="label">test</attribute>
<section>
<item>
<attribute name="label">random item</attribute>
</item>
</section>
</submenu>
</menu>
</interface>
Both the menu as well as the submenu allow for an id attribute with which I can use in a call to gtk_builder_get_object, when I ever need to refer to them in my program, and this works just fine.
However, for the item, such an id attribute is impossible, i.e. changing <item> to <item id="myitem"> will result in the error
Gtk-ERROR **: failed to add UI: attribute 'id' invalid for element 'item'
However, I need to change this menu item's label at runtime and had hoped to do this in the way I described above. How can I accomplish this instead?
This is a simple menu bar, with one menu item (_File), one submenu which has 3 Menu items (2x ImageMenuItem and a SeparatorMenuItem). The following was done with Glade 3.19 (Fedora 23) and after parsing your file, glade complains it is targeted for Gtk+ 2.12 even when there is no version reference on the file. As you can see the syntax differs.
Can you inform a bit more on your setup and dependencies? Anyway, it is recommended to upgrade to Gtk+ 3.