Make sure we create actions for all plug-in procedures which have a

2007-03-19  Michael Natterer  <mitch@gimp.org>

	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
This commit is contained in:
Michael Natterer 2007-03-19 14:41:23 +00:00 committed by Michael Natterer
parent 27192c4a6f
commit e82a31ad91
3 changed files with 49 additions and 25 deletions

View File

@ -1,3 +1,25 @@
2007-03-19 Michael Natterer <mitch@gimp.org>
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 <sven@gimp.org>
* libgimpbase/gimpbaseenums.[ch]: changed labels for

View File

@ -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;

View File

@ -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 "&lt;Domain&gt;/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
* "&lt;Domain&gt;/Path/To/My/Menu"
* (e.g. "&lt;Image&gt;/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().