mirror of https://github.com/GNOME/gimp.git
app/plug-in/plug-in.[ch] moved code from the PDB wrapper to a utility
2006-01-11 Sven Neumann <sven@gimp.org> * app/plug-in/plug-in.[ch] * tools/pdbgen/pdb/plug_in.pdb: moved code from the PDB wrapper to a utility function in the core. * app/pdb/plug_in_cmds.c: regenerated.
This commit is contained in:
parent
3682b8e9e0
commit
fdcae9fc0a
|
@ -1,3 +1,11 @@
|
|||
2006-01-11 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/plug-in/plug-in.[ch]
|
||||
* tools/pdbgen/pdb/plug_in.pdb: moved code from the PDB wrapper to
|
||||
a utility function in the core.
|
||||
|
||||
* app/pdb/plug_in_cmds.c: regenerated.
|
||||
|
||||
2006-01-11 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* tools/pdbgen/pdb/plug_in.pdb (plugin_menu_register): warn if a
|
||||
|
|
|
@ -344,106 +344,16 @@ plugin_menu_register_invoker (Gimp *gimp,
|
|||
{
|
||||
if (gimp->current_plug_in)
|
||||
{
|
||||
PlugInProcDef *proc_def = NULL;
|
||||
gchar *canonical;
|
||||
|
||||
canonical = gimp_canonicalize_identifier (procedure_name);
|
||||
|
||||
if (gimp->current_plug_in->plug_in_def)
|
||||
proc_def = plug_in_proc_def_find (gimp->current_plug_in->plug_in_def->proc_defs,
|
||||
canonical);
|
||||
|
||||
if (! proc_def)
|
||||
proc_def = plug_in_proc_def_find (gimp->current_plug_in->temp_proc_defs,
|
||||
canonical);
|
||||
|
||||
if (proc_def)
|
||||
{
|
||||
if (proc_def->menu_label)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (! plug_in_proc_args_check (gimp->current_plug_in->name,
|
||||
gimp->current_plug_in->prog,
|
||||
canonical,
|
||||
menu_path,
|
||||
proc_def->db_info.args,
|
||||
proc_def->db_info.num_args,
|
||||
proc_def->db_info.values,
|
||||
proc_def->db_info.num_values,
|
||||
&error))
|
||||
{
|
||||
g_message (error->message);
|
||||
g_clear_error (&error);
|
||||
|
||||
success = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (proc_def->db_info.proc_type)
|
||||
{
|
||||
case GIMP_INTERNAL:
|
||||
success = FALSE;
|
||||
break;
|
||||
|
||||
case GIMP_PLUGIN:
|
||||
case GIMP_EXTENSION:
|
||||
if (! gimp->current_plug_in->query &&
|
||||
! gimp->current_plug_in->init)
|
||||
success = FALSE;
|
||||
break;
|
||||
|
||||
case GIMP_TEMPORARY:
|
||||
break;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
proc_def->menu_paths = g_list_append (proc_def->menu_paths,
|
||||
g_strdup (menu_path));
|
||||
|
||||
if (! gimp->no_interface &&
|
||||
proc_def->db_info.proc_type == GIMP_TEMPORARY)
|
||||
{
|
||||
gimp_menus_create_item (gimp, proc_def, menu_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message ("Plug-in \"%s\"\n(%s)\n\n"
|
||||
"attempted to register the menu item \"%s\" "
|
||||
"for procedure \"%s\".\n"
|
||||
"The menu label given in gimp_install_procedure() "
|
||||
"already contained a path. To make this work, "
|
||||
"pass just the menu's label to "
|
||||
"gimp_install_procedure().",
|
||||
gimp_filename_to_utf8 (gimp->current_plug_in->name),
|
||||
gimp_filename_to_utf8 (gimp->current_plug_in->prog),
|
||||
menu_path, canonical);
|
||||
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message ("Plug-in \"%s\"\n(%s)\n\n"
|
||||
"attempted to register the menu item \"%s\" "
|
||||
"for the procedure \"%s\"\n."
|
||||
"It has however not installed that procedure. This "
|
||||
"is not allowed.",
|
||||
gimp_filename_to_utf8 (gimp->current_plug_in->name),
|
||||
gimp_filename_to_utf8 (gimp->current_plug_in->prog),
|
||||
menu_path, canonical);
|
||||
|
||||
success = FALSE;
|
||||
}
|
||||
gchar *canonical = gimp_canonicalize_identifier (procedure_name);
|
||||
|
||||
success = plug_in_menu_register (gimp->current_plug_in,
|
||||
canonical, menu_path);
|
||||
g_free (canonical);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
{
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return procedural_db_return_args (&plugin_menu_register_proc, success);
|
||||
|
|
|
@ -1000,3 +1000,97 @@ plug_in_get_undo_desc (PlugIn *plug_in)
|
|||
|
||||
return undo_desc;
|
||||
}
|
||||
|
||||
/* called from the PDB (gimp_plugin_menu_register) */
|
||||
gboolean
|
||||
plug_in_menu_register (PlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *menu_path)
|
||||
{
|
||||
PlugInProcDef *proc_def = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
g_return_val_if_fail (plug_in != NULL, FALSE);
|
||||
g_return_val_if_fail (proc_name != NULL, FALSE);
|
||||
g_return_val_if_fail (menu_path != NULL, FALSE);
|
||||
|
||||
if (plug_in->plug_in_def)
|
||||
proc_def = plug_in_proc_def_find (plug_in->plug_in_def->proc_defs,
|
||||
proc_name);
|
||||
|
||||
if (! proc_def)
|
||||
proc_def = plug_in_proc_def_find (plug_in->temp_proc_defs,
|
||||
proc_name);
|
||||
|
||||
if (! proc_def)
|
||||
{
|
||||
g_message ("Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register the menu item \"%s\" "
|
||||
"for the procedure \"%s\".\n"
|
||||
"It has however not installed that procedure. This "
|
||||
"is not allowed.",
|
||||
gimp_filename_to_utf8 (plug_in->name),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
menu_path, proc_name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (! proc_def->menu_label)
|
||||
{
|
||||
g_message ("Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register the menu item \"%s\" "
|
||||
"for procedure \"%s\".\n"
|
||||
"The menu label given in gimp_install_procedure() "
|
||||
"already contained a path. To make this work, "
|
||||
"pass just the menu's label to "
|
||||
"gimp_install_procedure().",
|
||||
gimp_filename_to_utf8 (plug_in->name),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
menu_path, proc_name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (! plug_in_proc_args_check (plug_in->name,
|
||||
plug_in->prog,
|
||||
proc_name,
|
||||
menu_path,
|
||||
proc_def->db_info.args,
|
||||
proc_def->db_info.num_args,
|
||||
proc_def->db_info.values,
|
||||
proc_def->db_info.num_values,
|
||||
&error))
|
||||
{
|
||||
g_message (error->message);
|
||||
g_clear_error (&error);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch (proc_def->db_info.proc_type)
|
||||
{
|
||||
case GIMP_INTERNAL:
|
||||
return FALSE;
|
||||
|
||||
case GIMP_PLUGIN:
|
||||
case GIMP_EXTENSION:
|
||||
if (! plug_in->query && ! plug_in->init)
|
||||
return FALSE;
|
||||
|
||||
case GIMP_TEMPORARY:
|
||||
break;
|
||||
}
|
||||
|
||||
proc_def->menu_paths = g_list_append (proc_def->menu_paths,
|
||||
g_strdup (menu_path));
|
||||
|
||||
if (proc_def->db_info.proc_type == GIMP_TEMPORARY
|
||||
&& ! plug_in->gimp->no_interface)
|
||||
{
|
||||
gimp_menus_create_item (plug_in->gimp, proc_def, menu_path);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,5 +108,9 @@ void plug_in_main_loop_quit (PlugIn *plug_in);
|
|||
|
||||
gchar * plug_in_get_undo_desc (PlugIn *plug_in);
|
||||
|
||||
gboolean plug_in_menu_register (PlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *menu_path);
|
||||
|
||||
|
||||
#endif /* __PLUG_IN_H__ */
|
||||
|
|
|
@ -1000,3 +1000,97 @@ plug_in_get_undo_desc (PlugIn *plug_in)
|
|||
|
||||
return undo_desc;
|
||||
}
|
||||
|
||||
/* called from the PDB (gimp_plugin_menu_register) */
|
||||
gboolean
|
||||
plug_in_menu_register (PlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *menu_path)
|
||||
{
|
||||
PlugInProcDef *proc_def = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
g_return_val_if_fail (plug_in != NULL, FALSE);
|
||||
g_return_val_if_fail (proc_name != NULL, FALSE);
|
||||
g_return_val_if_fail (menu_path != NULL, FALSE);
|
||||
|
||||
if (plug_in->plug_in_def)
|
||||
proc_def = plug_in_proc_def_find (plug_in->plug_in_def->proc_defs,
|
||||
proc_name);
|
||||
|
||||
if (! proc_def)
|
||||
proc_def = plug_in_proc_def_find (plug_in->temp_proc_defs,
|
||||
proc_name);
|
||||
|
||||
if (! proc_def)
|
||||
{
|
||||
g_message ("Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register the menu item \"%s\" "
|
||||
"for the procedure \"%s\".\n"
|
||||
"It has however not installed that procedure. This "
|
||||
"is not allowed.",
|
||||
gimp_filename_to_utf8 (plug_in->name),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
menu_path, proc_name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (! proc_def->menu_label)
|
||||
{
|
||||
g_message ("Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register the menu item \"%s\" "
|
||||
"for procedure \"%s\".\n"
|
||||
"The menu label given in gimp_install_procedure() "
|
||||
"already contained a path. To make this work, "
|
||||
"pass just the menu's label to "
|
||||
"gimp_install_procedure().",
|
||||
gimp_filename_to_utf8 (plug_in->name),
|
||||
gimp_filename_to_utf8 (plug_in->prog),
|
||||
menu_path, proc_name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (! plug_in_proc_args_check (plug_in->name,
|
||||
plug_in->prog,
|
||||
proc_name,
|
||||
menu_path,
|
||||
proc_def->db_info.args,
|
||||
proc_def->db_info.num_args,
|
||||
proc_def->db_info.values,
|
||||
proc_def->db_info.num_values,
|
||||
&error))
|
||||
{
|
||||
g_message (error->message);
|
||||
g_clear_error (&error);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch (proc_def->db_info.proc_type)
|
||||
{
|
||||
case GIMP_INTERNAL:
|
||||
return FALSE;
|
||||
|
||||
case GIMP_PLUGIN:
|
||||
case GIMP_EXTENSION:
|
||||
if (! plug_in->query && ! plug_in->init)
|
||||
return FALSE;
|
||||
|
||||
case GIMP_TEMPORARY:
|
||||
break;
|
||||
}
|
||||
|
||||
proc_def->menu_paths = g_list_append (proc_def->menu_paths,
|
||||
g_strdup (menu_path));
|
||||
|
||||
if (proc_def->db_info.proc_type == GIMP_TEMPORARY
|
||||
&& ! plug_in->gimp->no_interface)
|
||||
{
|
||||
gimp_menus_create_item (plug_in->gimp, proc_def, menu_path);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,5 +108,9 @@ void plug_in_main_loop_quit (PlugIn *plug_in);
|
|||
|
||||
gchar * plug_in_get_undo_desc (PlugIn *plug_in);
|
||||
|
||||
gboolean plug_in_menu_register (PlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *menu_path);
|
||||
|
||||
|
||||
#endif /* __PLUG_IN_H__ */
|
||||
|
|
|
@ -180,106 +180,16 @@ HELP
|
|||
{
|
||||
if (gimp->current_plug_in)
|
||||
{
|
||||
PlugInProcDef *proc_def = NULL;
|
||||
gchar *canonical;
|
||||
|
||||
canonical = gimp_canonicalize_identifier (procedure_name);
|
||||
|
||||
if (gimp->current_plug_in->plug_in_def)
|
||||
proc_def = plug_in_proc_def_find (gimp->current_plug_in->plug_in_def->proc_defs,
|
||||
canonical);
|
||||
|
||||
if (! proc_def)
|
||||
proc_def = plug_in_proc_def_find (gimp->current_plug_in->temp_proc_defs,
|
||||
canonical);
|
||||
|
||||
if (proc_def)
|
||||
{
|
||||
if (proc_def->menu_label)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (! plug_in_proc_args_check (gimp->current_plug_in->name,
|
||||
gimp->current_plug_in->prog,
|
||||
canonical,
|
||||
menu_path,
|
||||
proc_def->db_info.args,
|
||||
proc_def->db_info.num_args,
|
||||
proc_def->db_info.values,
|
||||
proc_def->db_info.num_values,
|
||||
&error))
|
||||
{
|
||||
g_message (error->message);
|
||||
g_clear_error (&error);
|
||||
|
||||
success = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (proc_def->db_info.proc_type)
|
||||
{
|
||||
case GIMP_INTERNAL:
|
||||
success = FALSE;
|
||||
break;
|
||||
|
||||
case GIMP_PLUGIN:
|
||||
case GIMP_EXTENSION:
|
||||
if (! gimp->current_plug_in->query &&
|
||||
! gimp->current_plug_in->init)
|
||||
success = FALSE;
|
||||
break;
|
||||
|
||||
case GIMP_TEMPORARY:
|
||||
break;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
proc_def->menu_paths = g_list_append (proc_def->menu_paths,
|
||||
g_strdup (menu_path));
|
||||
|
||||
if (! gimp->no_interface &&
|
||||
proc_def->db_info.proc_type == GIMP_TEMPORARY)
|
||||
{
|
||||
gimp_menus_create_item (gimp, proc_def, menu_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message ("Plug-in \"%s\"\n(%s)\n\n"
|
||||
"attempted to register the menu item \"%s\" "
|
||||
"for procedure \"%s\".\n"
|
||||
"The menu label given in gimp_install_procedure() "
|
||||
"already contained a path. To make this work, "
|
||||
"pass just the menu's label to "
|
||||
"gimp_install_procedure().",
|
||||
gimp_filename_to_utf8 (gimp->current_plug_in->name),
|
||||
gimp_filename_to_utf8 (gimp->current_plug_in->prog),
|
||||
menu_path, canonical);
|
||||
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message ("Plug-in \"%s\"\n(%s)\n\n"
|
||||
"attempted to register the menu item \"%s\" "
|
||||
"for the procedure \"%s\"\n."
|
||||
"It has however not installed that procedure. This "
|
||||
"is not allowed.",
|
||||
gimp_filename_to_utf8 (gimp->current_plug_in->name),
|
||||
gimp_filename_to_utf8 (gimp->current_plug_in->prog),
|
||||
menu_path, canonical);
|
||||
|
||||
success = FALSE;
|
||||
}
|
||||
gchar *canonical = gimp_canonicalize_identifier (procedure_name);
|
||||
|
||||
success = plug_in_menu_register (gimp->current_plug_in,
|
||||
canonical, menu_path);
|
||||
g_free (canonical);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
{
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue