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 738364 - expose actionable -> action mapping
expose actionable -> action mapping
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkApplication
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-10-11 18:20 UTC by Matthias Clasen
Modified: 2014-12-23 00:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Expose more action group functionality (3.95 KB, patch)
2014-10-12 12:13 UTC, Matthias Clasen
none Details | Review
inspector: Use newly-exported api for action groups (1.13 KB, patch)
2014-10-12 12:13 UTC, Matthias Clasen
none Details | Review
Expose more action group functionality (4.03 KB, patch)
2014-10-12 16:11 UTC, Matthias Clasen
none Details | Review
inspector: Use newly-exported api for action groups (1.69 KB, patch)
2014-10-12 16:11 UTC, Matthias Clasen
none Details | Review
Add public api to look up actions (2.80 KB, patch)
2014-10-12 16:37 UTC, Matthias Clasen
none Details | Review

Description Matthias Clasen 2014-10-11 18:20:10 UTC
Both GtkInspector and gnome-builder need some functionality that is curently not exposed:

1) list all the actions that are defined by an object (GtkApplication, GtkApplicationWindow or just a widget), and the associated prefixes.

2) go from a GtkActionable to the GAction and the object where that action is defined (that could be the GtkApplication, a GtkApplicationWindow or just a widget (with gtk_widget_insert_action_group)

For 1), GtkApplication and GtkApplicationWindow are not a problem because they just implement GtkActionGroup/Map, and just use a fixed prefix. For the widget case, we need some api like

gchar ** gtk_widget_list_action_prefixes (GtkWidget *widget)
GActionGroup *gtk_widget_get_action_group_for_prefix (GtkWidget *widget, const gchar *prefix)

or 

gint gtk_widget_list_action_groups (GtkWidget *widget, GActionGroup **groups_out, gchar **prefixes_out)

For 2), this could be an api like

GAction *gtk_widget_find_action (GtkWidget *widget, const gchar *prefixed_action_name, GObject **owner_out);
Comment 1 Matthias Clasen 2014-10-12 12:13:03 UTC
Created attachment 288307 [details] [review]
Expose more action group functionality

Tools like GtkInspector and gnome-builder need to get at the
action groups.
Comment 2 Matthias Clasen 2014-10-12 12:13:14 UTC
Created attachment 288308 [details] [review]
inspector: Use newly-exported api for action groups
Comment 3 Matthias Clasen 2014-10-12 16:11:05 UTC
Created attachment 288331 [details] [review]
Expose more action group functionality

Tools like GtkInspector and gnome-builder need to get at the
action groups.
Comment 4 Matthias Clasen 2014-10-12 16:11:16 UTC
Created attachment 288332 [details] [review]
inspector: Use newly-exported api for action groups
Comment 5 Matthias Clasen 2014-10-12 16:37:36 UTC
Created attachment 288333 [details] [review]
Add public api to look up actions

This function looks up a prefixed action name, starting at
a widget. Optionally, the 'owner' of the action is returned
too.
Comment 6 Allison Karlitskaya (desrt) 2014-10-15 08:15:06 UTC
The first two look fine -- less invasive than expected, in fact.

The last one is a bit problematic: what is the intended usecase here?
Comment 7 Matthias Clasen 2014-10-15 14:37:57 UTC
the use cases for the find_action api are 

1) GtkInspector shows a 'Go to Action' button in the property editor for GtkActionable::action-name

2) gnome-builder has a 'command popup' where Christian wants to offer autocompletion for actions, in the context of the last focused tab
Comment 8 Matthias Clasen 2014-10-15 14:38:25 UTC
To get the command popup in gnome-builder, enable vim mode and hit :
Comment 9 Matthias Clasen 2014-12-23 00:58:45 UTC
we've added some public api for this now