Issue #2863 - Improve error reporting for scripts

gimp_plug_in_handle_proc_install(): print the procedure name when
bailing out of a wrong proc install call. For an obsolete full-path
menu label, also print the label. Original patch by Liam Quin.

(cherry picked from commit 07e3c1c15b)

In libgimp, add a note to gimp_install_procedure() stating that
passing a full menu path as "menu_label" is deprecated.
This commit is contained in:
Michael Natterer
2019-01-27 13:24:06 +01:00
parent 316c47da6f
commit 17e360e34b
2 changed files with 24 additions and 4 deletions

View File

@ -792,9 +792,11 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in,
{
gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
"Plug-in \"%s\"\n(%s)\n\n"
"attempted to install a procedure NULL parameter name.",
"attempted to install procedure \"%s\" with a "
"NULL parameter name.",
gimp_object_get_name (plug_in),
gimp_file_get_utf8_name (plug_in->file));
gimp_file_get_utf8_name (plug_in->file),
canonical);
g_free (canonical);
return;
}
@ -803,13 +805,28 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in,
{
gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
"Plug-in \"%s\"\n(%s)\n\n"
"attempted to install a procedure with invalid UTF-8 strings.",
"attempted to install procedure \"%s\" with "
"invalid UTF-8 strings.",
gimp_object_get_name (plug_in),
gimp_file_get_utf8_name (plug_in->file));
gimp_file_get_utf8_name (plug_in->file),
canonical);
g_free (canonical);
return;
}
if (proc_install->menu_path && strlen (proc_install->menu_path) &&
proc_install->menu_path[0] == '<')
{
g_printerr ("Plug-in \"%s\"\n(%s) "
"is installing procedure \"%s\" with a full "
"menu path \"%s\" as menu label, this deprecated and will "
"be an error in GIMP 3.0\n",
gimp_object_get_name (plug_in),
gimp_file_get_utf8_name (plug_in->file),
canonical,
proc_install->menu_path);
}
/* Create the procedure object */
switch (proc_install->type)

View File

@ -731,6 +731,9 @@ gimp_quit (void)
* "&lt;Domain&gt;/Path/To/My/Menu"
* (e.g. "&lt;Image&gt;/Filters/Render/Useless").
*
* Note that registering a full (pre-2.2-style) menu path is
* deprecated and will cause a failure in GIMP 3.0 and newer.
*
* It is possible to register a procedure only for keyboard-shortcut
* activation by passing a @menu_label to gimp_install_procedure() but
* not registering any menu path with gimp_plugin_menu_register(). In