GNOME Bugzilla – Bug 748652
vim command-bar: various fixes and enhancements
Last modified: 2015-04-29 20:55:54 UTC
see the description in attachements
Created attachment 302576 [details] [review] command-bar: more columns in the command list Use of a higher number of max columns in command list (shown with tab in command bar)
Created attachment 302577 [details] [review] vim: fix jump to line in command bar :line_number to jump to a line number now work
Created attachment 302578 [details] [review] command bar: better discovering of commands Actualy, we use two providers for discover the commands but the GAction provider gives us too much commands with duplicates, so we need to filter it better.
Created attachment 302579 [details] [review] vim command bar: allow to override GAction commands As GAction discovering give us duplicate names for commands, we need a way to circumvent that problem: In gb-command-gaction-provider, GbActionCommandMap action_maps [] gives us a way to define custom commands and the prefix/action name they mask.
Created attachment 302580 [details] [review] gaction-provider: fix discovering of groups We remove the workench manual entry as it's already discover by the widgets hierarchy traversal.
Created attachment 302581 [details] [review] gaction-provider: filtering of duplicates Some commands are duplicates, cmming from different widgets but with the same name : The global quit is renamed to quitall close, save and save-as of view is already handle by view-stack, so we masks them.
Created attachment 302582 [details] [review] command-gaction-provider: add debug helper To better trace the existing GAction for the entire application, we can use this helper : show_prefix_actions () Change #if 0 by #if 1 to activate it ( you can find them at the top of gb-command-gaction-provider.c file : #if 0 #define GB_DEBUG_ACTIONS To get the result in your terminal, show the command bar with ':' then hit 'tab' ( like you do to list all the possible commands ) The result can be nicely seen as a .yaml file with syntax highlight in all GtkSourceVIew based application.
Created attachment 302583 [details] example of actions debug output
Review of attachment 302576 [details] [review]: LGTM
Review of attachment 302577 [details] [review]: LGTM
Review of attachment 302578 [details] [review]: Fix the GType issue and then good to go. ::: src/commands/gb-command-gaction-provider.c @@ -44,2 +47,3 @@ GtkWidget *widget; GList *list = NULL; + gint type; I just learned recently that this does in fact need to be GType, or else weird things can happen with -fPIC/-fPIE. (See Gom bug about crashes). @@ +61,3 @@ + /* We exclude these types, they're already in the widgets hierarchy */ + type = G_OBJECT_TYPE (widget); Generally I use G_TYPE_FROM_INSTANCE(), but looks like this is just an alias for that.
Review of attachment 302579 [details] [review]: LGTM ::: src/commands/gb-command-gaction-provider.c @@ +204,3 @@ + */ +static const GbActionCommandMap action_maps [] = { + { NULL, NULL, NULL } { NULL } suffixes, C (since pre-C89) expands all items to zero that are not specified. @@ +289,1 @@ + if (g_str_equal (prefix, gb_group->prefix) && g_action_group_has_action (group, action_name)) Can prefix ever be NULL here? Should we use (g_strcmp0()==0) instead? Optionally, I'd be happy to have ide_str_equal0() that is a g_str_equal() that allows for NULL.
Review of attachment 302580 [details] [review]: LGTM
Review of attachment 302581 [details] [review]: LGTM
Review of attachment 302582 [details] [review]: LGTM. I wonder if long term we should make tracing able to be broken up into subsystems. (or at least which ones will log to stdout/file). Then we could just have this inside of something like: #ifdef IDE_ENABLE_TRACE ... #endif
Created attachment 302611 [details] [review] command-bar: fix somes errors According to the reviews for preceding patches.
Attachment 302576 [details] pushed as 62b90a4 - command-bar: more columns in the command list Attachment 302577 [details] pushed as a901b1e - vim: fix jump to line in command bar Attachment 302578 [details] pushed as 8058e98 - command bar: better discovering of commands Attachment 302579 [details] pushed as 18c7f17 - vim command bar: allow to override GAction commands Attachment 302580 [details] pushed as 02987c7 - gaction-provider: fix discovering of groups Attachment 302581 [details] pushed as f5bc16e - gaction-provider: filtering of duplicates Attachment 302582 [details] pushed as 4748af9 - command-gaction-provider: add debug helper Attachment 302611 [details] pushed as 4194689 - command-bar: fix somes errors