mirror of https://github.com/GNOME/gimp.git
app: use GError in all gimpplugin-proc.[ch] functions, not gimp_message()
This commit is contained in:
parent
b587740a10
commit
a88aa27942
|
@ -286,7 +286,7 @@ pdb_set_proc_image_types_invoker (GimpProcedure *procedure,
|
|||
gimp_pdb_is_canonical_procedure (procedure_name, error))
|
||||
{
|
||||
success = gimp_plug_in_set_proc_image_types (plug_in, procedure_name,
|
||||
image_types);
|
||||
image_types, error);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -361,7 +361,7 @@ pdb_set_proc_menu_label_invoker (GimpProcedure *procedure,
|
|||
gimp_pdb_is_canonical_procedure (procedure_name, error))
|
||||
{
|
||||
success = gimp_plug_in_set_proc_menu_label (plug_in, procedure_name,
|
||||
menu_label);
|
||||
menu_label, error);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -436,7 +436,7 @@ pdb_add_proc_menu_path_invoker (GimpProcedure *procedure,
|
|||
gimp_pdb_is_canonical_procedure (procedure_name, error))
|
||||
{
|
||||
success = gimp_plug_in_add_proc_menu_path (plug_in, procedure_name,
|
||||
menu_path);
|
||||
menu_path, error);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -537,7 +537,8 @@ pdb_set_proc_icon_invoker (GimpProcedure *procedure,
|
|||
{
|
||||
success = gimp_plug_in_set_proc_icon (plug_in, procedure_name,
|
||||
icon_type,
|
||||
icon_data, icon_data_length);
|
||||
icon_data, icon_data_length,
|
||||
error);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -574,7 +575,7 @@ pdb_set_proc_documentation_invoker (GimpProcedure *procedure,
|
|||
gimp_pdb_is_canonical_procedure (procedure_name, error))
|
||||
{
|
||||
success = gimp_plug_in_set_proc_help (plug_in, procedure_name,
|
||||
blurb, help, help_id);
|
||||
blurb, help, help_id, error);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -661,7 +662,8 @@ pdb_set_proc_attribution_invoker (GimpProcedure *procedure,
|
|||
gimp_pdb_is_canonical_procedure (procedure_name, error))
|
||||
{
|
||||
success = gimp_plug_in_set_proc_attribution (plug_in, procedure_name,
|
||||
authors, copyright, date);
|
||||
authors, copyright, date,
|
||||
error);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "plug-in-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "pdb/gimppdberror.h"
|
||||
|
||||
#include "gimpplugin.h"
|
||||
#include "gimpplugin-proc.h"
|
||||
|
@ -46,9 +46,10 @@ static GimpPlugInProcedure * gimp_plug_in_proc_find (GimpPlugIn *plug_in,
|
|||
/* public functions */
|
||||
|
||||
gboolean
|
||||
gimp_plug_in_set_proc_image_types (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *image_types)
|
||||
gimp_plug_in_set_proc_image_types (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *image_types,
|
||||
GError **error)
|
||||
{
|
||||
GimpPlugInProcedure *proc;
|
||||
|
||||
|
@ -59,15 +60,15 @@ gimp_plug_in_set_proc_image_types (GimpPlugIn *plug_in,
|
|||
|
||||
if (! proc)
|
||||
{
|
||||
gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||
"Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register images types "
|
||||
"for procedure \"%s\".\n"
|
||||
"It has however not installed that procedure. "
|
||||
"This is not allowed.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
proc_name);
|
||||
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_PROCEDURE_NOT_FOUND,
|
||||
"Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register images types "
|
||||
"for procedure \"%s\".\n"
|
||||
"It has however not installed that procedure. "
|
||||
"This is not allowed.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
proc_name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -78,12 +79,12 @@ gimp_plug_in_set_proc_image_types (GimpPlugIn *plug_in,
|
|||
}
|
||||
|
||||
gboolean
|
||||
gimp_plug_in_set_proc_menu_label (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *menu_label)
|
||||
gimp_plug_in_set_proc_menu_label (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *menu_label,
|
||||
GError **error)
|
||||
{
|
||||
GimpPlugInProcedure *proc;
|
||||
GError *error = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), FALSE);
|
||||
g_return_val_if_fail (proc_name != NULL, FALSE);
|
||||
|
@ -93,38 +94,29 @@ gimp_plug_in_set_proc_menu_label (GimpPlugIn *plug_in,
|
|||
|
||||
if (! proc)
|
||||
{
|
||||
gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||
"Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register the menu label \"%s\" "
|
||||
"for procedure \"%s\".\n"
|
||||
"It has however not installed that procedure. "
|
||||
"This is not allowed.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
menu_label, proc_name);
|
||||
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_PROCEDURE_NOT_FOUND,
|
||||
"Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register the menu label \"%s\" "
|
||||
"for procedure \"%s\".\n"
|
||||
"It has however not installed that procedure. "
|
||||
"This is not allowed.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
menu_label, proc_name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (! gimp_plug_in_procedure_set_menu_label (proc, menu_label, &error))
|
||||
{
|
||||
gimp_message_literal (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return gimp_plug_in_procedure_set_menu_label (proc, menu_label, error);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_plug_in_add_proc_menu_path (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *menu_path)
|
||||
gimp_plug_in_add_proc_menu_path (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *menu_path,
|
||||
GError **error)
|
||||
{
|
||||
GimpPlugInProcedure *proc;
|
||||
GError *error = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), FALSE);
|
||||
g_return_val_if_fail (proc_name != NULL, FALSE);
|
||||
|
@ -134,80 +126,63 @@ gimp_plug_in_add_proc_menu_path (GimpPlugIn *plug_in,
|
|||
|
||||
if (! proc)
|
||||
{
|
||||
gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||
"Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register the menu item \"%s\" "
|
||||
"for procedure \"%s\".\n"
|
||||
"It has however not installed that procedure. "
|
||||
"This is not allowed.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
menu_path, proc_name);
|
||||
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_PROCEDURE_NOT_FOUND,
|
||||
"Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register the menu item \"%s\" "
|
||||
"for procedure \"%s\".\n"
|
||||
"It has however not installed that procedure. "
|
||||
"This is not allowed.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
menu_path, proc_name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (! gimp_plug_in_procedure_add_menu_path (proc, menu_path, &error))
|
||||
{
|
||||
gimp_message_literal (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return gimp_plug_in_procedure_add_menu_path (proc, menu_path, error);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_plug_in_set_proc_icon (GimpPlugIn *plug_in,
|
||||
gimp_plug_in_set_proc_icon (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
GimpIconType type,
|
||||
const guint8 *data,
|
||||
gint data_length,
|
||||
GError **error)
|
||||
{
|
||||
GimpPlugInProcedure *proc;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), FALSE);
|
||||
g_return_val_if_fail (proc_name != NULL, FALSE);
|
||||
|
||||
proc = gimp_plug_in_proc_find (plug_in, proc_name);
|
||||
|
||||
if (! proc)
|
||||
{
|
||||
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_PROCEDURE_NOT_FOUND,
|
||||
"Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to set the icon "
|
||||
"for procedure \"%s\".\n"
|
||||
"It has however not installed that procedure. "
|
||||
"This is not allowed.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
proc_name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return gimp_plug_in_procedure_set_icon (proc, type, data, data_length,
|
||||
error);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_plug_in_set_proc_help (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
GimpIconType type,
|
||||
const guint8 *data,
|
||||
gint data_length)
|
||||
{
|
||||
GimpPlugInProcedure *proc;
|
||||
GError *error = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), FALSE);
|
||||
g_return_val_if_fail (proc_name != NULL, FALSE);
|
||||
|
||||
proc = gimp_plug_in_proc_find (plug_in, proc_name);
|
||||
|
||||
if (! proc)
|
||||
{
|
||||
gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||
"Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to set the icon "
|
||||
"for procedure \"%s\".\n"
|
||||
"It has however not installed that procedure. "
|
||||
"This is not allowed.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
proc_name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (! gimp_plug_in_procedure_set_icon (proc, type, data, data_length,
|
||||
&error))
|
||||
{
|
||||
gimp_message_literal (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_plug_in_set_proc_help (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *blurb,
|
||||
const gchar *help,
|
||||
const gchar *help_id)
|
||||
const gchar *blurb,
|
||||
const gchar *help,
|
||||
const gchar *help_id,
|
||||
GError **error)
|
||||
{
|
||||
GimpPlugInProcedure *proc;
|
||||
|
||||
|
@ -218,15 +193,15 @@ gimp_plug_in_set_proc_help (GimpPlugIn *plug_in,
|
|||
|
||||
if (! proc)
|
||||
{
|
||||
gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||
"Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register help "
|
||||
"for procedure \"%s\".\n"
|
||||
"It has however not installed that procedure. "
|
||||
"This is not allowed.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
proc_name);
|
||||
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_PROCEDURE_NOT_FOUND,
|
||||
"Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register help "
|
||||
"for procedure \"%s\".\n"
|
||||
"It has however not installed that procedure. "
|
||||
"This is not allowed.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
proc_name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -238,11 +213,12 @@ gimp_plug_in_set_proc_help (GimpPlugIn *plug_in,
|
|||
}
|
||||
|
||||
gboolean
|
||||
gimp_plug_in_set_proc_attribution (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *authors,
|
||||
const gchar *copyright,
|
||||
const gchar *date)
|
||||
gimp_plug_in_set_proc_attribution (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *authors,
|
||||
const gchar *copyright,
|
||||
const gchar *date,
|
||||
GError **error)
|
||||
{
|
||||
GimpPlugInProcedure *proc;
|
||||
|
||||
|
@ -253,15 +229,15 @@ gimp_plug_in_set_proc_attribution (GimpPlugIn *plug_in,
|
|||
|
||||
if (! proc)
|
||||
{
|
||||
gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||
"Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register the attribution "
|
||||
"for procedure \"%s\".\n"
|
||||
"It has however not installed that procedure. "
|
||||
"This is not allowed.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
proc_name);
|
||||
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_PROCEDURE_NOT_FOUND,
|
||||
"Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register the attribution "
|
||||
"for procedure \"%s\".\n"
|
||||
"It has however not installed that procedure. "
|
||||
"This is not allowed.",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
proc_name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -21,30 +21,36 @@
|
|||
#define __GIMP_PLUG_IN_PROC_H__
|
||||
|
||||
|
||||
gboolean gimp_plug_in_set_proc_image_types (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *image_types);
|
||||
gboolean gimp_plug_in_set_proc_menu_label (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *menu_label);
|
||||
gboolean gimp_plug_in_add_proc_menu_path (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *menu_path);
|
||||
gboolean gimp_plug_in_set_proc_icon (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
GimpIconType type,
|
||||
const guint8 *data,
|
||||
gint data_length);
|
||||
gboolean gimp_plug_in_set_proc_help (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *blurb,
|
||||
const gchar *help,
|
||||
const gchar *help_id);
|
||||
gboolean gimp_plug_in_set_proc_attribution (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *authors,
|
||||
const gchar *copyright,
|
||||
const gchar *date);
|
||||
gboolean gimp_plug_in_set_proc_image_types (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *image_types,
|
||||
GError **error);
|
||||
gboolean gimp_plug_in_set_proc_menu_label (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *menu_label,
|
||||
GError **error);
|
||||
gboolean gimp_plug_in_add_proc_menu_path (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *menu_path,
|
||||
GError **error);
|
||||
gboolean gimp_plug_in_set_proc_icon (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
GimpIconType type,
|
||||
const guint8 *data,
|
||||
gint data_length,
|
||||
GError **error);
|
||||
gboolean gimp_plug_in_set_proc_help (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *blurb,
|
||||
const gchar *help,
|
||||
const gchar *help_id,
|
||||
GError **error);
|
||||
gboolean gimp_plug_in_set_proc_attribution (GimpPlugIn *plug_in,
|
||||
const gchar *proc_name,
|
||||
const gchar *authors,
|
||||
const gchar *copyright,
|
||||
const gchar *date,
|
||||
GError **error);
|
||||
|
||||
|
||||
#endif /* __GIMP_PLUG_IN_PROC_H__ */
|
||||
|
|
|
@ -273,7 +273,7 @@ HELP
|
|||
gimp_pdb_is_canonical_procedure (procedure_name, error))
|
||||
{
|
||||
success = gimp_plug_in_set_proc_image_types (plug_in, procedure_name,
|
||||
image_types);
|
||||
image_types, error);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -355,7 +355,7 @@ HELP
|
|||
gimp_pdb_is_canonical_procedure (procedure_name, error))
|
||||
{
|
||||
success = gimp_plug_in_set_proc_menu_label (plug_in, procedure_name,
|
||||
menu_label);
|
||||
menu_label, error);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -436,7 +436,7 @@ HELP
|
|||
gimp_pdb_is_canonical_procedure (procedure_name, error))
|
||||
{
|
||||
success = gimp_plug_in_add_proc_menu_path (plug_in, procedure_name,
|
||||
menu_path);
|
||||
menu_path, error);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -542,7 +542,8 @@ HELP
|
|||
{
|
||||
success = gimp_plug_in_set_proc_icon (plug_in, procedure_name,
|
||||
icon_type,
|
||||
icon_data, icon_data_length);
|
||||
icon_data, icon_data_length,
|
||||
error);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -582,7 +583,7 @@ HELP
|
|||
gimp_pdb_is_canonical_procedure (procedure_name, error))
|
||||
{
|
||||
success = gimp_plug_in_set_proc_help (plug_in, procedure_name,
|
||||
blurb, help, help_id);
|
||||
blurb, help, help_id, error);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -674,7 +675,8 @@ HELP
|
|||
gimp_pdb_is_canonical_procedure (procedure_name, error))
|
||||
{
|
||||
success = gimp_plug_in_set_proc_attribution (plug_in, procedure_name,
|
||||
authors, copyright, date);
|
||||
authors, copyright, date,
|
||||
error);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
|
Loading…
Reference in New Issue