GNOME Bugzilla – Bug 733977
No way of creating a widget for a menu model
Last modified: 2018-05-02 16:10:50 UTC
In gnome-documents, we have an entry dropdown menu for search options, using a GtkPopover. To get a consistent look, and to keep the code simple, it makes a lot of sense to use GActions and a GMenu to model those options. The problem is that currently GTK has no public API to create a widget for a GMenuModel; I was able to work this around by creating a GtkPopover and stealing its child, but it's not a very future-proof solution. Instead, it would be best to have a public API to create an (opaque) widget foe a GMenuModel, basically exposing what happens inside gtk_popover_bind_model().
I think this calls for exporting the modelbutton widgetry that is used in the popover-from-model code, so you can construct this yourself instead of abusing both menu models and their popover conversion code.
and that, in turn, calls for a new approach to GtkButton... which is where we've been for a couple of years now.
Matthias, do GtkPopoverMenu and GtkModelButton fill this gap?
not really, I'm afraid. popovermenu and modelbutton sidestep the issue by not using models altogether and just letting you construct action-backed popovers 'the normal way'
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/498.