From e82a31ad91352506fba1cf22ef935b4f112c64b2 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 19 Mar 2007 14:41:23 +0000 Subject: [PATCH] Make sure we create actions for all plug-in procedures which have a 2007-03-19 Michael Natterer Make sure we create actions for all plug-in procedures which have a menu_label, so it's possible to assign shortcuts to them. Fixes bug #371300. * app/actions/plug-in-actions.c (plug_in_actions_setup): removed duplicate code and simply call plug_in_actions_register_procedure() on all actions, it already does all needed checks and signal connections by itself. (plug_in_actions_update) (plug_in_actions_register_procedure) (plug_in_actions_unregister_procedure): unified checks for whether a plug-in procedure needs an action or not: it needs either a menu_label or menu_paths and must not have extensions, prefixes or magics. * libgimp/gimp.c (gimp_install_procedure): document that it's possible to install shortcut-only procedures by registering a menu_label but no menu_paths. svn path=/trunk/; revision=22147 --- ChangeLog | 22 +++++++++++++++++++++ app/actions/plug-in-actions.c | 36 ++++++++++++++++------------------- libgimp/gimp.c | 16 +++++++++++----- 3 files changed, 49 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0137e53b4d..b83f430dc5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2007-03-19 Michael Natterer + + Make sure we create actions for all plug-in procedures which have + a menu_label, so it's possible to assign shortcuts to them. + Fixes bug #371300. + + * app/actions/plug-in-actions.c (plug_in_actions_setup): removed + duplicate code and simply call plug_in_actions_register_procedure() + on all actions, it already does all needed checks and signal + connections by itself. + + (plug_in_actions_update) + (plug_in_actions_register_procedure) + (plug_in_actions_unregister_procedure): unified checks for whether + a plug-in procedure needs an action or not: it needs either a + menu_label or menu_paths and must not have extensions, prefixes or + magics. + + * libgimp/gimp.c (gimp_install_procedure): document that it's + possible to install shortcut-only procedures by registering a + menu_label but no menu_paths. + 2007-03-19 Sven Neumann * libgimpbase/gimpbaseenums.[ch]: changed labels for diff --git a/app/actions/plug-in-actions.c b/app/actions/plug-in-actions.c index 2f0631a8e2..53b1deda62 100644 --- a/app/actions/plug-in-actions.c +++ b/app/actions/plug-in-actions.c @@ -165,23 +165,10 @@ plug_in_actions_setup (GimpActionGroup *group) { GimpPlugInProcedure *plug_in_proc = list->data; - if (! plug_in_proc->prog) - continue; - - g_signal_connect_object (plug_in_proc, "menu-path-added", - G_CALLBACK (plug_in_actions_menu_path_added), - group, 0); - - if (plug_in_proc->prog && - plug_in_proc->menu_paths && - ! plug_in_proc->extensions && - ! plug_in_proc->prefixes && - ! plug_in_proc->magics) - { - plug_in_actions_register_procedure (group->gimp->pdb, - GIMP_PROCEDURE (plug_in_proc), - group); - } + if (plug_in_proc->prog) + plug_in_actions_register_procedure (group->gimp->pdb, + GIMP_PROCEDURE (plug_in_proc), + group); } g_signal_connect_object (group->gimp->pdb, "register-procedure", @@ -248,7 +235,8 @@ plug_in_actions_update (GimpActionGroup *group, { GimpPlugInProcedure *proc = list->data; - if (proc->menu_paths && + if ((proc->menu_label || + proc->menu_paths) && proc->image_types_val && ! proc->extensions && ! proc->prefixes && @@ -337,7 +325,11 @@ plug_in_actions_register_procedure (GimpPDB *pdb, G_CALLBACK (plug_in_actions_menu_path_added), group, 0); - if (plug_in_proc->menu_label || plug_in_proc->menu_paths) + if ((plug_in_proc->menu_label || + plug_in_proc->menu_paths) && + ! plug_in_proc->extensions && + ! plug_in_proc->prefixes && + ! plug_in_proc->magics) { #if 0 g_print ("%s: %s\n", G_STRFUNC, @@ -362,7 +354,11 @@ plug_in_actions_unregister_procedure (GimpPDB *pdb, plug_in_actions_menu_path_added, group); - if (plug_in_proc->menu_label || plug_in_proc->menu_paths) + if ((plug_in_proc->menu_label || + plug_in_proc->menu_paths) && + ! plug_in_proc->extensions && + ! plug_in_proc->prefixes && + ! plug_in_proc->magics) { GtkAction *action; diff --git a/libgimp/gimp.c b/libgimp/gimp.c index 464ba7beeb..6e8baae18a 100644 --- a/libgimp/gimp.c +++ b/libgimp/gimp.c @@ -503,13 +503,19 @@ gimp_quit (void) * documentation, should you. * * @menu_label defines the label that should be used for the - * procedure's menu entry (use #NULL if the procedure shouldn't have a - * menu entry). The position where to register in the menu hierarchy - * is chosen using gimp_plugin_menu_register(). This function also - * still accepts the old (pre-2.2) way of registering a menu entry and - * takes a string in the form "<Domain>/Path/To/My/Menu" + * procedure's menu entry. The position where to register in the menu + * hierarchy is chosen using gimp_plugin_menu_register(). This + * function also still accepts the old (pre-2.2) way of registering a + * menu entry and takes a string in the form + * "<Domain>/Path/To/My/Menu" * (e.g. "<Image>/Filters/Render/Useless"). * + * It is possible to register a procedure for keyboard-shortcut activation + * only by not registering any menu path with gimp_plugin_menu_register() + * but still passing a @menu_label to gimp_install_procedure(). In this + * case, the given @menu_label will only be used as the procedure's + * user-visible name in the keyboard shortcut editor. + * * @type must be one of #GIMP_PLUGIN or #GIMP_EXTENSION. Note that * temporary procedures must be installed using * gimp_install_temp_proc().