GNOME Bugzilla – Bug 741386
allow applications to retrieve GActionGroups available to a widget
Last modified: 2014-12-12 06:37:18 UTC
It would be handy to be able to get access to the GActionGroups that a widget will use when resolving an action-name. In particular, we need this in builder for the command line API. (It is a CLI similar to Firefox <Shift>F2 that let's you interact with the IDE's internal actions).
Created attachment 292518 [details] [review] widget: add helpers to resolve GActionGroups available to GtkWidget These functions, while added for use by the GTK inspector, are generally useful to applications that need to resolve what action groups are available to a particular GtkWidget.
Matthias, we discused this at the Boston summit. This just makes the API added for the inspector public (and changes the list function to return a GStrv as would be expected by convention).
similar to bug 738364 ?
Yup, sure looks like!
Review of attachment 292518 [details] [review]: Looks fine by me. Any reason for not just returning 'const gchar **'? Also: my understanding is that it's no longer cool to put instructions about which free function to use into docstrings.
Review of attachment 292518 [details] [review]: You forgot the gtk3-sections.txt additions too...
Created attachment 292576 [details] [review] widget: add helpers to resolve GActionGroups available to GtkWidget These functions, while added for use by the GTK inspector, are generally useful to applications that need to resolve what action groups are available to a particular GtkWidget.
Created attachment 292578 [details] [review] widget: add helpers to resolve GActionGroups available to GtkWidget These functions, while added for use by the GTK inspector, are generally useful to applications that need to resolve what action groups are available to a particular GtkWidget.
Review of attachment 292578 [details] [review]: Sorry -- still a couple of small issues remain. ::: gtk/gtkwidget.c @@ +17045,3 @@ + * #GActionGroup's available to @widget. + * + * Returns: (transfer container): a %NULL-terminated array of strings. Not true. Either mark this (nullable) or return g_new0(const gchar *, 0 + 1); below instead. The second one is slightly nice for consistency -- no need to check for NULL return before just iterating the result (even if it has zero items). @@ +17068,3 @@ + * ancestry. + * + * Returns: (transfer none): A #GActionGroup or %NULL. This is also (nullable). Should probably doc that this is what happens if no such prefix exists.
Review of attachment 292578 [details] [review]: Also worth noting that it's possible that you'd see a return value of an empty array even if there are no groups, depending on if the muxer happened to be created here or not. It might be best just to always return a non-NULL array to prevent the implementation leaking out in a semi-random way (unless you want to force the other case to NULL...).
Created attachment 292580 [details] [review] widget: add helpers to resolve GActionGroups available to GtkWidget These functions, while added for use by the GTK inspector, are generally useful to applications that need to resolve what action groups are available to a particular GtkWidget.
Both suggestions make sense. I went the route of returning a newly allocated array to simplify the consumer code.
Review of attachment 292580 [details] [review]: lgtm.