GNOME Bugzilla – Bug 738364
expose actionable -> action mapping
Last modified: 2014-12-23 00:58:45 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);
Created attachment 288307 [details] [review] Expose more action group functionality Tools like GtkInspector and gnome-builder need to get at the action groups.
Created attachment 288308 [details] [review] inspector: Use newly-exported api for action groups
Created attachment 288331 [details] [review] Expose more action group functionality Tools like GtkInspector and gnome-builder need to get at the action groups.
Created attachment 288332 [details] [review] inspector: Use newly-exported api for action groups
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.
The first two look fine -- less invasive than expected, in fact. The last one is a bit problematic: what is the intended usecase here?
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
To get the command popup in gnome-builder, enable vim mode and hit :
we've added some public api for this now