When creating a GtkPopoverMenu from a menu model, Gtk4 will always try to parse mnemonics from the menu label (see here)
My problem is that one of my menus contains a list of filenames, so files with underscores in their names will be incorrectly displayed (__init__.py becomes _init_.py, aaa_bbb becomes aaabbb, …)
Is there a way to avoid this, or to escape the mnemonics underscore when creating my GMenuItem?
Note: back in Gtk3 we had 2 different APIs gtk_menu_item_new_with_label() and gtk_menu_item_new_with_mnemonic(), I couldn’t find any equivalent in Gtk4.
No, there’s no such thing as a way to set the label without mnemonic.
I assume you’re building a menu using Gio.Menu and assigning the label; you could replace the menu items with a custom placeholder and then using custom widgets.
Well, now with a custom widget (GtkLabel) the text display works (no mnemonic troubles), but I’ve lost all the theming and click/activation events on the menu item, looks like I’ve to implement them myself on my label…