On Tue, 8 Dec 2020 08:41:58 +0100
Kjell Ahlstedt <kjellahlstedt gmail com> wrote:
> I don't know if it works with a file that glade has written.
That sounds like you don't support glade. I am confused, because
I thought that glade was the defacto standard that Gnome wants
users to generate user interfaces.
Glade does not support GMenu/GMenuModel, see the first item in their TODO:
Your original code was defining a GMenu/Gio::Menu, which Kjell fixed up.
Your new glade generated GtkMenu xml could work, but you'd need to rewrite the driving c++ code to expect those items to be GtkMenuItems. Additionally you probably need to Gtk::RadioMenuItem::set_group as it seems undefined in glade's xml.
I recommend reading:
A bug?
As gtkmm is just a binding, in a case like this you'd need to show something working in straight C but failing in C++.
I think you should accept Kjell's solution. If you really want a GtkMenu created via GtkBuilder then another simple solution would be to use Kjell's xml but add a GtkMenu with its model set to Kjell's GMenu.