[gimp/gimp-2-10] Issue #2863 - Improve error reporting for scripts
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] Issue #2863 - Improve error reporting for scripts
- Date: Sun, 27 Jan 2019 12:43:57 +0000 (UTC)
commit 17e360e34b61bb5fea59c29e78bc167c28f0d137
Author: Michael Natterer <mitch gimp org>
Date: Sun Jan 27 13:24:06 2019 +0100
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 07e3c1c15bf120fb42fe88fdf90d1122b19d714e)
In libgimp, add a note to gimp_install_procedure() stating that
passing a full menu path as "menu_label" is deprecated.
app/plug-in/gimpplugin-message.c | 25 +++++++++++++++++++++----
libgimp/gimp.c | 3 +++
2 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c
index cdbdb27be2..fd2abcd904 100644
--- a/app/plug-in/gimpplugin-message.c
+++ b/app/plug-in/gimpplugin-message.c
@@ -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)
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index d8db802844..d28f86cf15 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -731,6 +731,9 @@ gimp_quit (void)
* "<Domain>/Path/To/My/Menu"
* (e.g. "<Image>/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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]