Added API to explicitly register dynamic menu items hierarchies. Fixes bug

2005-03-24  Michael Natterer  <mitch@gimp.org>

	Added API to explicitly register dynamic menu items hierarchies.
	Fixes bug #170623.

	* app/core/gimp.h: added "GSList *plug_in_menu_branches".

	* app/plug-in/plug-in-types.h

	* app/plug-in/plug-ins.[ch]: added API to register plug-in menu
	branches, just as for locale and help domans. Cleaned up handling
	of locale and help domains.

	(plug_ins_exit): free the registered menu branches.

	* app/actions/plug-in-actions.[ch] (plug_in_actions_add_branch):
	new function to explicitly add a menu branch action.

	(plug_in_actions_setup): add the registered menu branches to each
	new action group.

	(plug_in_actions_build_path): always strip the untranslated menu
	path from underlines before using it as hash table key or action
	name.

	* app/menus/plug-in-menus.c (plug_in_menus_add_proc): changed
	accordingly: strip underlines from untranslated menu paths before
	passing them to plug_in_menus_build_path().

	* app/core/gimp-gui.[ch]: added gimp_menus_create_branch() plus
	vtable entry to access the new stuff from the core. Renamed the
	functions desling with items from gimp_foo_entry() to
	gimp_foo_item().

	* app/gui/gui-vtable.c: implement create_branch() and add the
	branch action to all existing "plug-in" action groups. Note that
	we don't need to create any menus because that happens implicitly
	when adding menu items.

	* tools/pdbgen/pdb/plug_in.pdb (plugin_menu_branch_register): new
	PDB wrapper to access branch registering from plug-ins.

	* app/pdb/internal_procs.c
	* app/pdb/plug_in_cmds.c
	* libgimp/gimpplugin_pdb.[ch]: regenerated.

	* libgimp/gimp.def: changed accordingly.

	* plug-ins/script-fu/script-fu-scripts.c (script_fu_find_scripts):
	register the menu branches for all included scripts.
This commit is contained in:
Michael Natterer 2005-03-24 16:08:04 +00:00 committed by Michael Natterer
parent 13bd5eabe5
commit 0a5ce16b84
20 changed files with 849 additions and 309 deletions

View File

@ -1,3 +1,54 @@
2005-03-24 Michael Natterer <mitch@gimp.org>
Added API to explicitly register dynamic menu items hierarchies.
Fixes bug #170623.
* app/core/gimp.h: added "GSList *plug_in_menu_branches".
* app/plug-in/plug-in-types.h
* app/plug-in/plug-ins.[ch]: added API to register plug-in menu
branches, just as for locale and help domans. Cleaned up handling
of locale and help domains.
(plug_ins_exit): free the registered menu branches.
* app/actions/plug-in-actions.[ch] (plug_in_actions_add_branch):
new function to explicitly add a menu branch action.
(plug_in_actions_setup): add the registered menu branches to each
new action group.
(plug_in_actions_build_path): always strip the untranslated menu
path from underlines before using it as hash table key or action
name.
* app/menus/plug-in-menus.c (plug_in_menus_add_proc): changed
accordingly: strip underlines from untranslated menu paths before
passing them to plug_in_menus_build_path().
* app/core/gimp-gui.[ch]: added gimp_menus_create_branch() plus
vtable entry to access the new stuff from the core. Renamed the
functions desling with items from gimp_foo_entry() to
gimp_foo_item().
* app/gui/gui-vtable.c: implement create_branch() and add the
branch action to all existing "plug-in" action groups. Note that
we don't need to create any menus because that happens implicitly
when adding menu items.
* tools/pdbgen/pdb/plug_in.pdb (plugin_menu_branch_register): new
PDB wrapper to access branch registering from plug-ins.
* app/pdb/internal_procs.c
* app/pdb/plug_in_cmds.c
* libgimp/gimpplugin_pdb.[ch]: regenerated.
* libgimp/gimp.def: changed accordingly.
* plug-ins/script-fu/script-fu-scripts.c (script_fu_find_scripts):
register the menu branches for all included scripts.
2005-03-24 Sven Neumann <sven@gimp.org>
* app/widgets/gimpcolormapeditor.c: use a GimpColorHexEntry widget.

View File

@ -117,6 +117,18 @@ plug_in_actions_setup (GimpActionGroup *group)
G_N_ELEMENTS (plug_in_repeat_actions),
G_CALLBACK (plug_in_repeat_cmd_callback));
for (list = group->gimp->plug_in_menu_branches;
list;
list = g_slist_next (list))
{
PlugInMenuBranch *branch = list->data;
plug_in_actions_add_branch (group,
branch->prog_name,
branch->menu_path,
branch->menu_label);
}
for (list = group->gimp->plug_in_proc_defs;
list;
list = g_slist_next (list))
@ -284,7 +296,7 @@ plug_in_actions_add_path (GimpActionGroup *group,
{
const gchar *progname;
const gchar *locale_domain;
gchar *path_translated = NULL;
const gchar *path_translated;
g_return_if_fail (GIMP_IS_ACTION_GROUP (group));
g_return_if_fail (proc_def != NULL);
@ -325,6 +337,36 @@ plug_in_actions_remove_proc (GimpActionGroup *group,
}
}
void
plug_in_actions_add_branch (GimpActionGroup *group,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label)
{
const gchar *locale_domain;
const gchar *path_translated;
const gchar *label_translated;
gchar *full;
gchar *full_translated;
g_return_if_fail (GIMP_IS_ACTION_GROUP (group));
g_return_if_fail (menu_path != NULL);
g_return_if_fail (menu_label != NULL);
locale_domain = plug_ins_locale_domain (group->gimp, progname, NULL);
path_translated = dgettext (locale_domain, menu_path);
label_translated = dgettext (locale_domain, menu_label);
full = g_strconcat (menu_path, "/", menu_label, NULL);
full_translated = g_strconcat (path_translated, "/", label_translated, NULL);
if (plug_in_actions_check_translation (full, full_translated))
plug_in_actions_build_path (group, full, full_translated);
else
plug_in_actions_build_path (group, full, full);
}
/* private functions */
@ -430,6 +472,8 @@ plug_in_actions_build_path (GimpActionGroup *group,
const gchar *path_translated)
{
GHashTable *path_table;
gchar *copy_original;
gchar *copy_translated;
gchar *p1, *p2;
path_table = g_object_get_data (G_OBJECT (group), "plug-in-path-table");
@ -444,13 +488,14 @@ plug_in_actions_build_path (GimpActionGroup *group,
(GDestroyNotify) g_hash_table_destroy);
}
p1 = strrchr (path_original, '/');
p2 = strrchr (path_translated, '/');
copy_original = gimp_strip_uline (path_original);
copy_translated = g_strdup (path_translated);
if (p1 && p2 && ! g_hash_table_lookup (path_table, path_original))
p1 = strrchr (copy_original, '/');
p2 = strrchr (copy_translated, '/');
if (p1 && p2 && ! g_hash_table_lookup (path_table, copy_original))
{
gchar *copy_original = g_strdup (path_original);
gchar *copy_translated = g_strdup (path_translated);
gchar *label;
GtkAction *action;
@ -458,24 +503,21 @@ plug_in_actions_build_path (GimpActionGroup *group,
#if 0
g_print ("adding plug-in submenu '%s' (%s)\n",
path_original, label);
copy_original, label);
#endif
action = gtk_action_new (path_original, label, NULL, NULL);
action = gtk_action_new (copy_original, label, NULL, NULL);
gtk_action_group_add_action (GTK_ACTION_GROUP (group), action);
g_object_unref (action);
g_hash_table_insert (path_table, g_strdup (path_original), action);
p1 = strrchr (copy_original, '/');
p2 = strrchr (copy_translated, '/');
g_hash_table_insert (path_table, g_strdup (copy_original), action);
*p1 = '\0';
*p2 = '\0';
plug_in_actions_build_path (group, copy_original, copy_translated);
}
g_free (copy_original);
g_free (copy_translated);
}
}

View File

@ -32,5 +32,10 @@ void plug_in_actions_add_path (GimpActionGroup *group,
void plug_in_actions_remove_proc (GimpActionGroup *group,
PlugInProcDef *proc_def);
void plug_in_actions_add_branch (GimpActionGroup *group,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label);
#endif /* __PLUG_IN_ACTIONS_H__ */

View File

@ -54,8 +54,9 @@ gimp_gui_init (Gimp *gimp)
gimp->gui.display_delete = NULL;
gimp->gui.displays_reconnect = NULL;
gimp->gui.menus_init = NULL;
gimp->gui.menus_create = NULL;
gimp->gui.menus_delete = NULL;
gimp->gui.menus_create_item = NULL;
gimp->gui.menus_delete_item = NULL;
gimp->gui.menus_create_branch = NULL;
gimp->gui.progress_new = NULL;
gimp->gui.progress_free = NULL;
gimp->gui.pdb_dialog_set = NULL;
@ -292,26 +293,40 @@ gimp_menus_init (Gimp *gimp,
}
void
gimp_menus_create_entry (Gimp *gimp,
gimp_menus_create_item (Gimp *gimp,
PlugInProcDef *proc_def,
const gchar *menu_path)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (proc_def != NULL);
if (gimp->gui.menus_create)
gimp->gui.menus_create (gimp, proc_def, menu_path);
if (gimp->gui.menus_create_item)
gimp->gui.menus_create_item (gimp, proc_def, menu_path);
}
void
gimp_menus_delete_entry (Gimp *gimp,
gimp_menus_delete_item (Gimp *gimp,
PlugInProcDef *proc_def)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (proc_def != NULL);
if (gimp->gui.menus_delete)
gimp->gui.menus_delete (gimp, proc_def);
if (gimp->gui.menus_delete_item)
gimp->gui.menus_delete_item (gimp, proc_def);
}
void
gimp_menus_create_branch (Gimp *gimp,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (menu_path != NULL);
g_return_if_fail (menu_label != NULL);
if (gimp->gui.menus_create_branch)
gimp->gui.menus_create_branch (gimp, progname, menu_path, menu_label);
}
GimpProgress *

View File

@ -57,11 +57,15 @@ struct _GimpGui
void (* menus_init) (Gimp *gimp,
GSList *plug_in_defs,
const gchar *std_domain);
void (* menus_create) (Gimp *gimp,
void (* menus_create_item) (Gimp *gimp,
PlugInProcDef *proc_def,
const gchar *menu_path);
void (* menus_delete) (Gimp *gimp,
void (* menus_delete_item) (Gimp *gimp,
PlugInProcDef *proc_def);
void (* menus_create_branch) (Gimp *gimp,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label);
GimpProgress * (* progress_new) (Gimp *gimp,
gint display_ID);
@ -120,11 +124,15 @@ void gimp_help (Gimp *gimp,
void gimp_menus_init (Gimp *gimp,
GSList *plug_in_defs,
const gchar *std_plugins_domain);
void gimp_menus_create_entry (Gimp *gimp,
void gimp_menus_create_item (Gimp *gimp,
PlugInProcDef *proc_def,
const gchar *menu_path);
void gimp_menus_delete_entry (Gimp *gimp,
void gimp_menus_delete_item (Gimp *gimp,
PlugInProcDef *proc_def);
void gimp_menus_create_branch (Gimp *gimp,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label);
GimpProgress * gimp_new_progress (Gimp *gimp,
gint display_ID);

View File

@ -72,6 +72,7 @@ struct _Gimp
gboolean write_pluginrc;
GSList *plug_in_proc_defs;
GSList *plug_in_menu_branches;
GSList *plug_in_locale_domains;
GSList *plug_in_help_domains;

View File

@ -103,11 +103,15 @@ static void gui_displays_reconnect (Gimp *gimp,
static void gui_menus_init (Gimp *gimp,
GSList *plug_in_defs,
const gchar *plugins_domain);
static void gui_menus_create_entry (Gimp *gimp,
static void gui_menus_create_item (Gimp *gimp,
PlugInProcDef *proc_def,
const gchar *menu_path);
static void gui_menus_delete_entry (Gimp *gimp,
static void gui_menus_delete_item (Gimp *gimp,
PlugInProcDef *proc_def);
static void gui_menus_create_branch (Gimp *gimp,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label);
static GimpProgress * gui_new_progress (Gimp *gimp,
gint display_ID);
static void gui_free_progress (Gimp *gimp,
@ -152,8 +156,9 @@ gui_vtable_init (Gimp *gimp)
gimp->gui.display_delete = gui_display_delete;
gimp->gui.displays_reconnect = gui_displays_reconnect;
gimp->gui.menus_init = gui_menus_init;
gimp->gui.menus_create = gui_menus_create_entry;
gimp->gui.menus_delete = gui_menus_delete_entry;
gimp->gui.menus_create_item = gui_menus_create_item;
gimp->gui.menus_delete_item = gui_menus_delete_item;
gimp->gui.menus_create_branch = gui_menus_create_branch;
gimp->gui.progress_new = gui_new_progress;
gimp->gui.progress_free = gui_free_progress;
gimp->gui.pdb_dialog_new = gui_pdb_dialog_new;
@ -435,7 +440,7 @@ gui_menus_delete_proc (Gimp *gimp,
}
static void
gui_menus_create_entry (Gimp *gimp,
gui_menus_create_item (Gimp *gimp,
PlugInProcDef *proc_def,
const gchar *menu_path)
{
@ -467,7 +472,7 @@ gui_menus_create_entry (Gimp *gimp,
}
static void
gui_menus_delete_entry (Gimp *gimp,
gui_menus_delete_item (Gimp *gimp,
PlugInProcDef *proc_def)
{
GList *list;
@ -483,6 +488,22 @@ gui_menus_delete_entry (Gimp *gimp,
}
}
static void
gui_menus_create_branch (Gimp *gimp,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label)
{
GList *list;
for (list = gimp_action_groups_from_name ("plug-in");
list;
list = g_list_next (list))
{
plug_in_actions_add_branch (list->data, progname, menu_path, menu_label);
}
}
static GimpProgress *
gui_new_progress (Gimp *gimp,
gint display_ID)

View File

@ -211,6 +211,7 @@ plug_in_menus_add_proc (GimpUIManager *manager,
{
gchar *path;
gchar *merge_key;
gchar *stripped_path;
gchar *action_path;
guint merge_id;
guint menu_merge_id;
@ -262,8 +263,10 @@ plug_in_menus_add_proc (GimpUIManager *manager,
GUINT_TO_POINTER (menu_merge_id));
}
stripped_path = gimp_strip_uline (path);
action_path = plug_in_menus_build_path (manager, ui_path, menu_merge_id,
path, FALSE);
stripped_path, FALSE);
g_free (stripped_path);
if (! action_path)
{

View File

@ -74,7 +74,7 @@ void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 455 procedures registered total */
/* 456 procedures registered total */
void
internal_procs_init (Gimp *gimp,
@ -107,13 +107,13 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Display procedures"), 0.178);
register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.187);
(* status_callback) (NULL, _("Drawable procedures"), 0.186);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Transformation procedures"), 0.262);
(* status_callback) (NULL, _("Transformation procedures"), 0.261);
register_drawable_transform_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.297);
(* status_callback) (NULL, _("Edit procedures"), 0.296);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.316);
@ -122,70 +122,70 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Floating selections"), 0.338);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.352);
(* status_callback) (NULL, _("Font UI"), 0.351);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.358);
(* status_callback) (NULL, _("Fonts"), 0.357);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.363);
(* status_callback) (NULL, _("Gimprc procedures"), 0.362);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient"), 0.376);
(* status_callback) (NULL, _("Gradient"), 0.375);
register_gradient_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.442);
(* status_callback) (NULL, _("Gradient UI"), 0.441);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.448);
(* status_callback) (NULL, _("Gradients"), 0.447);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.459);
(* status_callback) (NULL, _("Guide procedures"), 0.458);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.473);
(* status_callback) (NULL, _("Help procedures"), 0.471);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.475);
(* status_callback) (NULL, _("Image"), 0.474);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.611);
(* status_callback) (NULL, _("Layer"), 0.61);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.67);
(* status_callback) (NULL, _("Message procedures"), 0.669);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.677);
(* status_callback) (NULL, _("Miscellaneous"), 0.675);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.681);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.68);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.714);
(* status_callback) (NULL, _("Palette"), 0.713);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.745);
(* status_callback) (NULL, _("Palette UI"), 0.743);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.752);
(* status_callback) (NULL, _("Palettes"), 0.75);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.76);
(* status_callback) (NULL, _("Parasite procedures"), 0.759);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.787);
(* status_callback) (NULL, _("Paths"), 0.785);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern"), 0.822);
(* status_callback) (NULL, _("Pattern"), 0.82);
register_pattern_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.826);
(* status_callback) (NULL, _("Pattern UI"), 0.825);
register_pattern_select_procs (gimp);
(* status_callback) (NULL, _("Patterns"), 0.833);
(* status_callback) (NULL, _("Patterns"), 0.831);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.842);
(* status_callback) (NULL, _("Plug-in"), 0.84);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.853);

View File

@ -48,6 +48,7 @@ static ProcRecord plugins_query_proc;
static ProcRecord plugin_domain_register_proc;
static ProcRecord plugin_help_register_proc;
static ProcRecord plugin_menu_register_proc;
static ProcRecord plugin_menu_branch_register_proc;
static ProcRecord plugin_icon_register_proc;
void
@ -57,6 +58,7 @@ register_plug_in_procs (Gimp *gimp)
procedural_db_register (gimp, &plugin_domain_register_proc);
procedural_db_register (gimp, &plugin_help_register_proc);
procedural_db_register (gimp, &plugin_menu_register_proc);
procedural_db_register (gimp, &plugin_menu_branch_register_proc);
procedural_db_register (gimp, &plugin_icon_register_proc);
}
@ -526,7 +528,7 @@ plugin_menu_register_invoker (Gimp *gimp,
if (! gimp->no_interface &&
proc_def->db_info.proc_type == GIMP_TEMPORARY)
{
gimp_menus_create_entry (gimp, proc_def, menu_path);
gimp_menus_create_item (gimp, proc_def, menu_path);
}
}
}
@ -588,6 +590,77 @@ static ProcRecord plugin_menu_register_proc =
{ { plugin_menu_register_invoker } }
};
static Argument *
plugin_menu_branch_register_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
gchar *menu_path;
gchar *menu_name;
menu_path = (gchar *) args[0].value.pdb_pointer;
if (menu_path == NULL || !g_utf8_validate (menu_path, -1, NULL))
success = FALSE;
menu_name = (gchar *) args[1].value.pdb_pointer;
if (menu_name == NULL || !g_utf8_validate (menu_name, -1, NULL))
success = FALSE;
if (success)
{
if (gimp->current_plug_in)
{
plug_ins_menu_branch_add (gimp, gimp->current_plug_in->prog,
menu_path, menu_name);
if (! gimp->no_interface)
{
gimp_menus_create_branch (gimp, gimp->current_plug_in->prog,
menu_path, menu_name);
}
else
success = FALSE;
}
else
success = FALSE;
}
return procedural_db_return_args (&plugin_menu_branch_register_proc, success);
}
static ProcArg plugin_menu_branch_register_inargs[] =
{
{
GIMP_PDB_STRING,
"menu_path",
"The sub-menu's menu path"
},
{
GIMP_PDB_STRING,
"menu_name",
"The name of the sub-menu"
}
};
static ProcRecord plugin_menu_branch_register_proc =
{
"gimp_plugin_menu_branch_register",
"Register a sub-menu.",
"This procedure installs an sub-menu which does not belong to any procedure.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer <mitch@gimp.org>",
"2005",
NULL,
GIMP_INTERNAL,
2,
plugin_menu_branch_register_inargs,
0,
NULL,
{ { plugin_menu_branch_register_invoker } }
};
static Argument *
plugin_icon_register_invoker (Gimp *gimp,
GimpContext *context,

View File

@ -53,17 +53,17 @@
#define STD_PLUGINS_DOMAIN GETTEXT_PACKAGE "-std-plug-ins"
typedef struct _PlugInLocaleDomainDef PlugInLocaleDomainDef;
typedef struct _PlugInHelpDomainDef PlugInHelpDomainDef;
typedef struct _PlugInLocaleDomain PlugInLocaleDomain;
typedef struct _PlugInHelpDomain PlugInHelpDomain;
struct _PlugInLocaleDomainDef
struct _PlugInLocaleDomain
{
gchar *prog_name;
gchar *domain_name;
gchar *domain_path;
};
struct _PlugInHelpDomainDef
struct _PlugInHelpDomain
{
gchar *prog_name;
gchar *domain_name;
@ -273,45 +273,16 @@ plug_ins_init (Gimp *gimp,
PlugInDef *plug_in_def = list->data;
if (plug_in_def->locale_domain_name)
{
PlugInLocaleDomainDef *def;
def = g_new (PlugInLocaleDomainDef, 1);
def->prog_name = g_strdup (plug_in_def->prog);
def->domain_name = g_strdup (plug_in_def->locale_domain_name);
def->domain_path = g_strdup (plug_in_def->locale_domain_path);
gimp->plug_in_locale_domains =
g_slist_prepend (gimp->plug_in_locale_domains, def);
#ifdef VERBOSE
g_print ("added locale domain \"%s\" for path \"%s\"\n",
def->domain_name ? def->domain_name : "(null)",
def->domain_path ?
gimp_filename_to_utf8 (def->domain_path) : "(null)");
#endif
}
plug_ins_locale_domain_add (gimp,
plug_in_def->prog,
plug_in_def->locale_domain_name,
plug_in_def->locale_domain_path);
if (plug_in_def->help_domain_name)
{
PlugInHelpDomainDef *def;
def = g_new (PlugInHelpDomainDef, 1);
def->prog_name = g_strdup (plug_in_def->prog);
def->domain_name = g_strdup (plug_in_def->help_domain_name);
def->domain_uri = g_strdup (plug_in_def->help_domain_uri);
gimp->plug_in_help_domains =
g_slist_prepend (gimp->plug_in_help_domains, def);
#ifdef VERBOSE
g_print ("added help domain \"%s\" for base uri \"%s\"\n",
def->domain_name ? def->domain_name : "(null)",
def->domain_uri ? def->domain_uri : "(null)");
#endif
}
plug_ins_help_domain_add (gimp,
plug_in_def->prog,
plug_in_def->help_domain_name,
plug_in_def->help_domain_uri);
}
if (! gimp->no_interface)
@ -382,14 +353,27 @@ plug_ins_exit (Gimp *gimp)
plug_in_exit (gimp);
for (list = gimp->plug_in_menu_branches; list; list = list->next)
{
PlugInMenuBranch *branch = list->data;
g_free (branch->prog_name);
g_free (branch->menu_path);
g_free (branch->menu_label);
g_free (branch);
}
g_slist_free (gimp->plug_in_menu_branches);
gimp->plug_in_menu_branches = NULL;
for (list = gimp->plug_in_locale_domains; list; list = list->next)
{
PlugInLocaleDomainDef *def = list->data;
PlugInLocaleDomain *domain = list->data;
g_free (def->prog_name);
g_free (def->domain_name);
g_free (def->domain_path);
g_free (def);
g_free (domain->prog_name);
g_free (domain->domain_name);
g_free (domain->domain_path);
g_free (domain);
}
g_slist_free (gimp->plug_in_locale_domains);
@ -397,12 +381,12 @@ plug_ins_exit (Gimp *gimp)
for (list = gimp->plug_in_help_domains; list; list = list->next)
{
PlugInHelpDomainDef *def = list->data;
PlugInHelpDomain *domain = list->data;
g_free (def->prog_name);
g_free (def->domain_name);
g_free (def->domain_uri);
g_free (def);
g_free (domain->prog_name);
g_free (domain->domain_name);
g_free (domain->domain_uri);
g_free (domain);
}
g_slist_free (gimp->plug_in_help_domains);
@ -641,7 +625,7 @@ plug_ins_temp_proc_def_add (Gimp *gimp,
if (! gimp->no_interface)
{
if (proc_def->menu_label || proc_def->menu_paths)
gimp_menus_create_entry (gimp, proc_def, NULL);
gimp_menus_create_item (gimp, proc_def, NULL);
}
/* Register the procedural database entry */
@ -661,7 +645,7 @@ plug_ins_temp_proc_def_remove (Gimp *gimp,
if (! gimp->no_interface)
{
if (proc_def->menu_label || proc_def->menu_paths)
gimp_menus_delete_entry (gimp, proc_def);
gimp_menus_delete_item (gimp, proc_def);
}
/* Unregister the procedural database entry */
@ -674,6 +658,63 @@ plug_ins_temp_proc_def_remove (Gimp *gimp,
plug_in_proc_def_free (proc_def);
}
void
plug_ins_menu_branch_add (Gimp *gimp,
const gchar *prog_name,
const gchar *menu_path,
const gchar *menu_label)
{
PlugInMenuBranch *branch;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (prog_name != NULL);
g_return_if_fail (menu_path != NULL);
g_return_if_fail (menu_label != NULL);
branch = g_new (PlugInMenuBranch, 1);
branch->prog_name = g_strdup (prog_name);
branch->menu_path = g_strdup (menu_path);
branch->menu_label = g_strdup (menu_label);
gimp->plug_in_menu_branches = g_slist_append (gimp->plug_in_menu_branches,
branch);
#ifdef VERBOSE
g_print ("added menu branch \"%s\" at path \"%s\"\n",
branch->menu_label, branch->menu_path);
#endif
}
void
plug_ins_locale_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_path)
{
PlugInLocaleDomain *domain;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (prog_name != NULL);
g_return_if_fail (domain_name != NULL);
domain = g_new (PlugInLocaleDomain, 1);
domain->prog_name = g_strdup (prog_name);
domain->domain_name = g_strdup (domain_name);
domain->domain_path = g_strdup (domain_path);
gimp->plug_in_locale_domains = g_slist_prepend (gimp->plug_in_locale_domains,
domain);
#ifdef VERBOSE
g_print ("added locale domain \"%s\" for path \"%s\"\n",
domain->domain_name ? domain->domain_name : "(null)",
domain->domain_path ?
gimp_filename_to_utf8 (domain->domain_path) : "(null)");
#endif
}
const gchar *
plug_ins_locale_domain (Gimp *gimp,
const gchar *prog_name,
@ -692,20 +733,49 @@ plug_ins_locale_domain (Gimp *gimp,
for (list = gimp->plug_in_locale_domains; list; list = list->next)
{
PlugInLocaleDomainDef *def = list->data;
PlugInLocaleDomain *domain = list->data;
if (def && def->prog_name && ! strcmp (def->prog_name, prog_name))
if (domain && domain->prog_name &&
! strcmp (domain->prog_name, prog_name))
{
if (domain_path && def->domain_path)
*domain_path = def->domain_path;
if (domain_path && domain->domain_path)
*domain_path = domain->domain_path;
return def->domain_name;
return domain->domain_name;
}
}
return STD_PLUGINS_DOMAIN;
}
void
plug_ins_help_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_uri)
{
PlugInHelpDomain *domain;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (prog_name != NULL);
g_return_if_fail (domain_name != NULL);
domain = g_new (PlugInHelpDomain, 1);
domain->prog_name = g_strdup (prog_name);
domain->domain_name = g_strdup (domain_name);
domain->domain_uri = g_strdup (domain_uri);
gimp->plug_in_help_domains = g_slist_prepend (gimp->plug_in_help_domains,
domain);
#ifdef VERBOSE
g_print ("added help domain \"%s\" for base uri \"%s\"\n",
domain->domain_name ? domain->domain_name : "(null)",
domain->domain_uri ? domain->domain_uri : "(null)");
#endif
}
const gchar *
plug_ins_help_domain (Gimp *gimp,
const gchar *prog_name,
@ -724,14 +794,15 @@ plug_ins_help_domain (Gimp *gimp,
for (list = gimp->plug_in_help_domains; list; list = list->next)
{
PlugInHelpDomainDef *def = list->data;
PlugInHelpDomain *domain = list->data;
if (def && def->prog_name && ! strcmp (def->prog_name, prog_name))
if (domain && domain->prog_name &&
! strcmp (domain->prog_name, prog_name))
{
if (domain_uri && def->domain_uri)
*domain_uri = def->domain_uri;
if (domain_uri && domain->domain_uri)
*domain_uri = domain->domain_uri;
return def->domain_name;
return domain->domain_name;
}
}
@ -758,10 +829,10 @@ plug_ins_help_domains (Gimp *gimp,
for (list = gimp->plug_in_help_domains, i = 0; list; list = list->next, i++)
{
PlugInHelpDomainDef *def = list->data;
PlugInHelpDomain *domain = list->data;
(*help_domains)[i] = g_strdup (def->domain_name);
(*help_uris)[i] = g_strdup (def->domain_uri);
(*help_domains)[i] = g_strdup (domain->domain_name);
(*help_uris)[i] = g_strdup (domain->domain_uri);
}
return n_domains;

View File

@ -22,6 +22,14 @@
#define __PLUG_INS_H__
struct _PlugInMenuBranch
{
gchar *prog_name;
gchar *menu_path;
gchar *menu_label;
};
void plug_ins_init (Gimp *gimp,
GimpContext *context,
GimpInitStatusFunc status_callback);
@ -61,11 +69,29 @@ void plug_ins_temp_proc_def_add (Gimp *gimp,
void plug_ins_temp_proc_def_remove (Gimp *gimp,
PlugInProcDef *proc_def);
/* Add a menu branch */
void plug_ins_menu_branch_add (Gimp *gimp,
const gchar *prog_name,
const gchar *menu_path,
const gchar *menu_label);
/* Add a locale domain */
void plug_ins_locale_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_path);
/* Retrieve a plug-ins locale domain */
const gchar * plug_ins_locale_domain (Gimp *gimp,
const gchar *prog_name,
const gchar **locale_path);
/* Add a help domain */
void plug_ins_help_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_uri);
/* Retrieve a plug-ins help domain */
const gchar * plug_ins_help_domain (Gimp *gimp,
const gchar *prog_name,

View File

@ -27,6 +27,7 @@
typedef struct _PlugIn PlugIn;
typedef struct _PlugInDef PlugInDef;
typedef struct _PlugInMenuBranch PlugInMenuBranch;
typedef struct _PlugInProcDef PlugInProcDef;
typedef struct _PlugInProcFrame PlugInProcFrame;
typedef struct _PlugInShm PlugInShm;

View File

@ -53,17 +53,17 @@
#define STD_PLUGINS_DOMAIN GETTEXT_PACKAGE "-std-plug-ins"
typedef struct _PlugInLocaleDomainDef PlugInLocaleDomainDef;
typedef struct _PlugInHelpDomainDef PlugInHelpDomainDef;
typedef struct _PlugInLocaleDomain PlugInLocaleDomain;
typedef struct _PlugInHelpDomain PlugInHelpDomain;
struct _PlugInLocaleDomainDef
struct _PlugInLocaleDomain
{
gchar *prog_name;
gchar *domain_name;
gchar *domain_path;
};
struct _PlugInHelpDomainDef
struct _PlugInHelpDomain
{
gchar *prog_name;
gchar *domain_name;
@ -273,45 +273,16 @@ plug_ins_init (Gimp *gimp,
PlugInDef *plug_in_def = list->data;
if (plug_in_def->locale_domain_name)
{
PlugInLocaleDomainDef *def;
def = g_new (PlugInLocaleDomainDef, 1);
def->prog_name = g_strdup (plug_in_def->prog);
def->domain_name = g_strdup (plug_in_def->locale_domain_name);
def->domain_path = g_strdup (plug_in_def->locale_domain_path);
gimp->plug_in_locale_domains =
g_slist_prepend (gimp->plug_in_locale_domains, def);
#ifdef VERBOSE
g_print ("added locale domain \"%s\" for path \"%s\"\n",
def->domain_name ? def->domain_name : "(null)",
def->domain_path ?
gimp_filename_to_utf8 (def->domain_path) : "(null)");
#endif
}
plug_ins_locale_domain_add (gimp,
plug_in_def->prog,
plug_in_def->locale_domain_name,
plug_in_def->locale_domain_path);
if (plug_in_def->help_domain_name)
{
PlugInHelpDomainDef *def;
def = g_new (PlugInHelpDomainDef, 1);
def->prog_name = g_strdup (plug_in_def->prog);
def->domain_name = g_strdup (plug_in_def->help_domain_name);
def->domain_uri = g_strdup (plug_in_def->help_domain_uri);
gimp->plug_in_help_domains =
g_slist_prepend (gimp->plug_in_help_domains, def);
#ifdef VERBOSE
g_print ("added help domain \"%s\" for base uri \"%s\"\n",
def->domain_name ? def->domain_name : "(null)",
def->domain_uri ? def->domain_uri : "(null)");
#endif
}
plug_ins_help_domain_add (gimp,
plug_in_def->prog,
plug_in_def->help_domain_name,
plug_in_def->help_domain_uri);
}
if (! gimp->no_interface)
@ -382,14 +353,27 @@ plug_ins_exit (Gimp *gimp)
plug_in_exit (gimp);
for (list = gimp->plug_in_menu_branches; list; list = list->next)
{
PlugInMenuBranch *branch = list->data;
g_free (branch->prog_name);
g_free (branch->menu_path);
g_free (branch->menu_label);
g_free (branch);
}
g_slist_free (gimp->plug_in_menu_branches);
gimp->plug_in_menu_branches = NULL;
for (list = gimp->plug_in_locale_domains; list; list = list->next)
{
PlugInLocaleDomainDef *def = list->data;
PlugInLocaleDomain *domain = list->data;
g_free (def->prog_name);
g_free (def->domain_name);
g_free (def->domain_path);
g_free (def);
g_free (domain->prog_name);
g_free (domain->domain_name);
g_free (domain->domain_path);
g_free (domain);
}
g_slist_free (gimp->plug_in_locale_domains);
@ -397,12 +381,12 @@ plug_ins_exit (Gimp *gimp)
for (list = gimp->plug_in_help_domains; list; list = list->next)
{
PlugInHelpDomainDef *def = list->data;
PlugInHelpDomain *domain = list->data;
g_free (def->prog_name);
g_free (def->domain_name);
g_free (def->domain_uri);
g_free (def);
g_free (domain->prog_name);
g_free (domain->domain_name);
g_free (domain->domain_uri);
g_free (domain);
}
g_slist_free (gimp->plug_in_help_domains);
@ -641,7 +625,7 @@ plug_ins_temp_proc_def_add (Gimp *gimp,
if (! gimp->no_interface)
{
if (proc_def->menu_label || proc_def->menu_paths)
gimp_menus_create_entry (gimp, proc_def, NULL);
gimp_menus_create_item (gimp, proc_def, NULL);
}
/* Register the procedural database entry */
@ -661,7 +645,7 @@ plug_ins_temp_proc_def_remove (Gimp *gimp,
if (! gimp->no_interface)
{
if (proc_def->menu_label || proc_def->menu_paths)
gimp_menus_delete_entry (gimp, proc_def);
gimp_menus_delete_item (gimp, proc_def);
}
/* Unregister the procedural database entry */
@ -674,6 +658,63 @@ plug_ins_temp_proc_def_remove (Gimp *gimp,
plug_in_proc_def_free (proc_def);
}
void
plug_ins_menu_branch_add (Gimp *gimp,
const gchar *prog_name,
const gchar *menu_path,
const gchar *menu_label)
{
PlugInMenuBranch *branch;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (prog_name != NULL);
g_return_if_fail (menu_path != NULL);
g_return_if_fail (menu_label != NULL);
branch = g_new (PlugInMenuBranch, 1);
branch->prog_name = g_strdup (prog_name);
branch->menu_path = g_strdup (menu_path);
branch->menu_label = g_strdup (menu_label);
gimp->plug_in_menu_branches = g_slist_append (gimp->plug_in_menu_branches,
branch);
#ifdef VERBOSE
g_print ("added menu branch \"%s\" at path \"%s\"\n",
branch->menu_label, branch->menu_path);
#endif
}
void
plug_ins_locale_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_path)
{
PlugInLocaleDomain *domain;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (prog_name != NULL);
g_return_if_fail (domain_name != NULL);
domain = g_new (PlugInLocaleDomain, 1);
domain->prog_name = g_strdup (prog_name);
domain->domain_name = g_strdup (domain_name);
domain->domain_path = g_strdup (domain_path);
gimp->plug_in_locale_domains = g_slist_prepend (gimp->plug_in_locale_domains,
domain);
#ifdef VERBOSE
g_print ("added locale domain \"%s\" for path \"%s\"\n",
domain->domain_name ? domain->domain_name : "(null)",
domain->domain_path ?
gimp_filename_to_utf8 (domain->domain_path) : "(null)");
#endif
}
const gchar *
plug_ins_locale_domain (Gimp *gimp,
const gchar *prog_name,
@ -692,20 +733,49 @@ plug_ins_locale_domain (Gimp *gimp,
for (list = gimp->plug_in_locale_domains; list; list = list->next)
{
PlugInLocaleDomainDef *def = list->data;
PlugInLocaleDomain *domain = list->data;
if (def && def->prog_name && ! strcmp (def->prog_name, prog_name))
if (domain && domain->prog_name &&
! strcmp (domain->prog_name, prog_name))
{
if (domain_path && def->domain_path)
*domain_path = def->domain_path;
if (domain_path && domain->domain_path)
*domain_path = domain->domain_path;
return def->domain_name;
return domain->domain_name;
}
}
return STD_PLUGINS_DOMAIN;
}
void
plug_ins_help_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_uri)
{
PlugInHelpDomain *domain;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (prog_name != NULL);
g_return_if_fail (domain_name != NULL);
domain = g_new (PlugInHelpDomain, 1);
domain->prog_name = g_strdup (prog_name);
domain->domain_name = g_strdup (domain_name);
domain->domain_uri = g_strdup (domain_uri);
gimp->plug_in_help_domains = g_slist_prepend (gimp->plug_in_help_domains,
domain);
#ifdef VERBOSE
g_print ("added help domain \"%s\" for base uri \"%s\"\n",
domain->domain_name ? domain->domain_name : "(null)",
domain->domain_uri ? domain->domain_uri : "(null)");
#endif
}
const gchar *
plug_ins_help_domain (Gimp *gimp,
const gchar *prog_name,
@ -724,14 +794,15 @@ plug_ins_help_domain (Gimp *gimp,
for (list = gimp->plug_in_help_domains; list; list = list->next)
{
PlugInHelpDomainDef *def = list->data;
PlugInHelpDomain *domain = list->data;
if (def && def->prog_name && ! strcmp (def->prog_name, prog_name))
if (domain && domain->prog_name &&
! strcmp (domain->prog_name, prog_name))
{
if (domain_uri && def->domain_uri)
*domain_uri = def->domain_uri;
if (domain_uri && domain->domain_uri)
*domain_uri = domain->domain_uri;
return def->domain_name;
return domain->domain_name;
}
}
@ -758,10 +829,10 @@ plug_ins_help_domains (Gimp *gimp,
for (list = gimp->plug_in_help_domains, i = 0; list; list = list->next, i++)
{
PlugInHelpDomainDef *def = list->data;
PlugInHelpDomain *domain = list->data;
(*help_domains)[i] = g_strdup (def->domain_name);
(*help_uris)[i] = g_strdup (def->domain_uri);
(*help_domains)[i] = g_strdup (domain->domain_name);
(*help_uris)[i] = g_strdup (domain->domain_uri);
}
return n_domains;

View File

@ -22,6 +22,14 @@
#define __PLUG_INS_H__
struct _PlugInMenuBranch
{
gchar *prog_name;
gchar *menu_path;
gchar *menu_label;
};
void plug_ins_init (Gimp *gimp,
GimpContext *context,
GimpInitStatusFunc status_callback);
@ -61,11 +69,29 @@ void plug_ins_temp_proc_def_add (Gimp *gimp,
void plug_ins_temp_proc_def_remove (Gimp *gimp,
PlugInProcDef *proc_def);
/* Add a menu branch */
void plug_ins_menu_branch_add (Gimp *gimp,
const gchar *prog_name,
const gchar *menu_path,
const gchar *menu_label);
/* Add a locale domain */
void plug_ins_locale_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_path);
/* Retrieve a plug-ins locale domain */
const gchar * plug_ins_locale_domain (Gimp *gimp,
const gchar *prog_name,
const gchar **locale_path);
/* Add a help domain */
void plug_ins_help_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_uri);
/* Retrieve a plug-ins help domain */
const gchar * plug_ins_help_domain (Gimp *gimp,
const gchar *prog_name,

View File

@ -471,6 +471,7 @@ EXPORTS
gimp_plugin_help_register
gimp_plugin_icon_register
gimp_plugin_menu_register
gimp_plugin_menu_branch_register
gimp_posterize
gimp_procedural_db_dump
gimp_procedural_db_get_data

View File

@ -133,6 +133,41 @@ gimp_plugin_menu_register (const gchar *procedure_name,
return success;
}
/**
* gimp_plugin_menu_branch_register:
* @menu_path: The sub-menu's menu path.
* @menu_name: The name of the sub-menu.
*
* Register a sub-menu.
*
* This procedure installs an sub-menu which does not belong to any
* procedure.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_plugin_menu_branch_register (const gchar *menu_path,
const gchar *menu_name)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_plugin_menu_branch_register",
&nreturn_vals,
GIMP_PDB_STRING, menu_path,
GIMP_PDB_STRING, menu_name,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* _gimp_plugin_icon_register:
* @procedure_name: The procedure for which to install the icon.

View File

@ -35,6 +35,8 @@ gboolean gimp_plugin_help_register (const gchar *domain_name,
const gchar *domain_uri);
gboolean gimp_plugin_menu_register (const gchar *procedure_name,
const gchar *menu_path);
gboolean gimp_plugin_menu_branch_register (const gchar *menu_path,
const gchar *menu_name);
gboolean _gimp_plugin_icon_register (const gchar *procedure_name,
GimpIconType icon_type,
gint icon_data_length,

View File

@ -129,6 +129,52 @@ script_fu_find_scripts (void)
script_fu_load_script,
NULL);
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns",
N_("_Script-Fu"));
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu",
N_("_Buttons"));
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu",
N_("_Logos"));
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu",
N_("Make Br_ush"));
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu",
N_("_Misc"));
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu",
N_("_Patterns"));
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu",
N_("_Test"));
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu",
N_("_Utils"));
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu",
N_("_Web Page Themes"));
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu/Web Page Themes",
N_("_Alien Glow"));
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu/Web Page Themes",
N_("_Beveled Pattern"));
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu/Web Page Themes",
N_("_Classic.Gimp.Org"));
gimp_plugin_menu_branch_register ("<Image>",
N_("S_cript-Fu"));
gimp_plugin_menu_branch_register ("<Image>/Script-Fu",
N_("_Alchemy"));
gimp_plugin_menu_branch_register ("<Image>/Script-Fu",
N_("Alpha to _Logo"));
gimp_plugin_menu_branch_register ("<Image>/Script-Fu",
N_("A_nimators"));
gimp_plugin_menu_branch_register ("<Image>/Script-Fu",
N_("_Decor"));
gimp_plugin_menu_branch_register ("<Image>/Script-Fu",
N_("_Render"));
gimp_plugin_menu_branch_register ("<Image>/Script-Fu",
N_("_Selection"));
gimp_plugin_menu_branch_register ("<Image>/Script-Fu",
N_("S_hadow"));
gimp_plugin_menu_branch_register ("<Image>/Script-Fu",
N_("Stencil _Ops"));
gimp_plugin_menu_branch_register ("<Image>/Script-Fu",
N_("_Utils"));
/* Now that all scripts are read in and sorted, tell gimp about them */
g_tree_foreach (script_tree,
(GTraverseFunc) script_fu_install_script,

View File

@ -354,7 +354,7 @@ HELP
if (! gimp->no_interface &&
proc_def->db_info.proc_type == GIMP_TEMPORARY)
{
gimp_menus_create_entry (gimp, proc_def, menu_path);
gimp_menus_create_item (gimp, proc_def, menu_path);
}
}
}
@ -385,6 +385,47 @@ CODE
);
}
sub plugin_menu_branch_register {
$blurb = "Register a sub-menu.";
$help = <<HELP;
This procedure installs an sub-menu which does not belong to any procedure.
HELP
$author = $copyright = 'Michael Natterer <mitch@gimp.org>';
$date = '2005';
$since = '2.4';
@inargs = (
{ name => 'menu_path', type => 'string',
desc => "The sub-menu's menu path" },
{ name => 'menu_name', type => 'string',
desc => 'The name of the sub-menu' }
);
%invoke = (
code => <<'CODE',
{
if (gimp->current_plug_in)
{
plug_ins_menu_branch_add (gimp, gimp->current_plug_in->prog,
menu_path, menu_name);
if (! gimp->no_interface)
{
gimp_menus_create_branch (gimp, gimp->current_plug_in->prog,
menu_path, menu_name);
}
else
success = FALSE;
}
else
success = FALSE;
}
CODE
);
}
sub plugin_icon_register {
$blurb = "Register an icon for a plug-in procedure.";
@ -478,8 +519,9 @@ CODE
@procs = qw(plugins_query
plugin_domain_register plugin_help_register
plugin_menu_register plugin_icon_register);
%exports = (app => [@procs], lib => [@procs[1,2,3,4]]);
plugin_menu_register plugin_menu_branch_register
plugin_icon_register);
%exports = (app => [@procs], lib => [@procs[1,2,3,4,5]]);
$desc = 'Plug-in';