After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 741386 - allow applications to retrieve GActionGroups available to a widget
allow applications to retrieve GActionGroups available to a widget
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.15.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-12-11 10:49 UTC by Christian Hergert
Modified: 2014-12-12 06:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
widget: add helpers to resolve GActionGroups available to GtkWidget (5.71 KB, patch)
2014-12-11 10:51 UTC, Christian Hergert
needs-work Details | Review
widget: add helpers to resolve GActionGroups available to GtkWidget (7.79 KB, patch)
2014-12-11 22:56 UTC, Christian Hergert
none Details | Review
widget: add helpers to resolve GActionGroups available to GtkWidget (7.74 KB, patch)
2014-12-11 22:59 UTC, Christian Hergert
needs-work Details | Review
widget: add helpers to resolve GActionGroups available to GtkWidget (7.43 KB, patch)
2014-12-11 23:26 UTC, Christian Hergert
committed Details | Review

Description Christian Hergert 2014-12-11 10:49:30 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).
Comment 1 Christian Hergert 2014-12-11 10:51:14 UTC
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.
Comment 2 Christian Hergert 2014-12-11 10:54:09 UTC
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).
Comment 3 Matthias Clasen 2014-12-11 11:41:51 UTC
similar to bug 738364 ?
Comment 4 Christian Hergert 2014-12-11 12:30:15 UTC
Yup, sure looks like!
Comment 5 Allison Karlitskaya (desrt) 2014-12-11 22:39:20 UTC
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.
Comment 6 Allison Karlitskaya (desrt) 2014-12-11 22:40:47 UTC
Review of attachment 292518 [details] [review]:

You forgot the gtk3-sections.txt additions too...
Comment 7 Christian Hergert 2014-12-11 22:56:31 UTC
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.
Comment 8 Christian Hergert 2014-12-11 22:59:31 UTC
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.
Comment 9 Allison Karlitskaya (desrt) 2014-12-11 23:19:51 UTC
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.
Comment 10 Allison Karlitskaya (desrt) 2014-12-11 23:22:15 UTC
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...).
Comment 11 Christian Hergert 2014-12-11 23:26:08 UTC
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.
Comment 12 Christian Hergert 2014-12-11 23:27:55 UTC
Both suggestions make sense. I went the route of returning a newly allocated array to simplify the consumer code.
Comment 13 Allison Karlitskaya (desrt) 2014-12-11 23:28:50 UTC
Review of attachment 292580 [details] [review]:

lgtm.