Re: Failure to add radio buttons to popup menu.



On Tue, Dec 8, 2020 at 7:24 AM Carlo Wood <carlo alinoe com> wrote:
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:
https://gitlab.gnome.org/GNOME/glade/-/blob/master/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:
https://developer.gnome.org/GMenu/
https://wiki.gnome.org/HowDoI/GAction
https://blogs.gnome.org/christopherdavis/2020/11/19/glade-not-recommended/
https://www.gnome.org/news/2020/11/gtk-at-the-heart-of-gnome/ (new UI design tool on the way)

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.
 


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