gimp/app/plug-in/gimpplugin-proc.c

756 lines
25 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpplugin-proc.c
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gegl.h>
#include "libgimpbase/gimpbase.h"
#include "plug-in-types.h"
#include "core/gimpparamspecs.h"
#include "pdb/gimppdberror.h"
#include "gimpplugin.h"
#include "gimpplugin-proc.h"
#include "gimpplugindef.h"
#include "gimppluginmanager.h"
#include "gimppluginmanager-file.h"
#include "gimppluginprocedure.h"
#include "gimp-intl.h"
/* local function prototypes */
static GimpPlugInProcedure * gimp_plug_in_proc_find (GimpPlugIn *plug_in,
const gchar *proc_name);
/* public functions */
gboolean
gimp_plug_in_set_proc_image_types (GimpPlugIn *plug_in,
const gchar *proc_name,
const gchar *image_types,
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 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;
}
gimp_plug_in_procedure_set_image_types (proc, image_types);
return TRUE;
}
gboolean
gimp_plug_in_set_proc_sensitivity_mask (GimpPlugIn *plug_in,
const gchar *proc_name,
gint sensitivity_mask,
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 register the sensitivity mask \"%x\" "
"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),
sensitivity_mask, proc_name);
return FALSE;
}
gimp_plug_in_procedure_set_sensitivity_mask (proc, sensitivity_mask);
return TRUE;
}
gboolean
gimp_plug_in_set_proc_menu_label (GimpPlugIn *plug_in,
const gchar *proc_name,
const gchar *menu_label,
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);
g_return_val_if_fail (menu_label != NULL && strlen (menu_label), 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 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;
}
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,
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);
g_return_val_if_fail (menu_path != 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 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;
}
return gimp_plug_in_procedure_add_menu_path (proc, menu_path, 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)
{
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,
const gchar *blurb,
const gchar *help,
const gchar *help_id,
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 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;
}
gimp_procedure_set_help (GIMP_PROCEDURE (proc),
blurb, help, help_id);
return TRUE;
}
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)
{
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 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;
}
gimp_procedure_set_attribution (GIMP_PROCEDURE (proc),
authors, copyright, date);
return TRUE;
}
static inline gboolean
GIMP_IS_PARAM_SPEC_RUN_MODE (GParamSpec *pspec)
{
return (G_IS_PARAM_SPEC_ENUM (pspec) &&
pspec->value_type == GIMP_TYPE_RUN_MODE);
}
static inline gboolean
GIMP_IS_PARAM_SPEC_FILE (GParamSpec *pspec)
{
return (G_IS_PARAM_SPEC_OBJECT (pspec) &&
pspec->value_type == G_TYPE_FILE);
}
gboolean
gimp_plug_in_set_file_proc_load_handler (GimpPlugIn *plug_in,
const gchar *proc_name,
const gchar *extensions,
const gchar *prefixes,
const gchar *magics,
GError **error)
{
GimpPlugInProcedure *proc;
GimpProcedure *procedure;
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 register procedure \"%s\" "
"as load handler.\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;
}
procedure = GIMP_PROCEDURE (proc);
if (((procedure->num_args < 2) ||
(procedure->num_values < 1) ||
! GIMP_IS_PARAM_SPEC_RUN_MODE (procedure->args[0]) ||
! GIMP_IS_PARAM_SPEC_FILE (procedure->args[1]) ||
(! proc->generic_file_proc &&
! GIMP_IS_PARAM_SPEC_IMAGE (procedure->values[0]))))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_FAILED,
"Plug-in \"%s\"\n(%s)\n"
"attempted to register procedure \"%s\" "
"as load handler which does not take the standard "
"load procedure arguments: "
"(GimpRunMode, GFile) -> (GimpImage)",
gimp_object_get_name (plug_in),
gimp_file_get_utf8_name (plug_in->file),
proc_name);
return FALSE;
}
gimp_plug_in_procedure_set_file_proc (proc, extensions, prefixes, magics);
gimp_plug_in_manager_add_load_procedure (plug_in->manager, proc);
return TRUE;
}
gboolean
gimp_plug_in_set_file_proc_save_handler (GimpPlugIn *plug_in,
const gchar *proc_name,
const gchar *extensions,
const gchar *prefixes,
GError **error)
{
GimpPlugInProcedure *proc;
GimpProcedure *procedure;
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 register procedure \"%s\" "
"as save handler.\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;
}
procedure = GIMP_PROCEDURE (proc);
if ((procedure->num_args < 4) ||
! GIMP_IS_PARAM_SPEC_RUN_MODE (procedure->args[0]) ||
! GIMP_IS_PARAM_SPEC_IMAGE (procedure->args[1]) ||
app, libgimp*, pdb, plug-ins: review and enhance MR !1549. - Fix annotations for gimp_export_options_get_image() to make it actually introspectable with the GimpImage being both input and output. Even though the logic doesn't change much (the input image may be overriden or not), it doesn't matter for introspection because images are handled centrally by libgimp and therefore must not be freed. Actually deleting the image from the central list of images though remains a manual action depending on code logic, not some automatic action to be handled by binding engines. - Add G_GNUC_WARN_UNUSED_RESULT to gimp_export_options_get_image() because ignoring the returned value is rarely a good idea (as you usually want to delete the image). - Remove gimp_export_options_new(): we don't need this constructor because at this point, the best is to tell plug-in developers to just pass NULL everywhere. This leaves us free to create a more useful default constructor if needed, in the future. Main description for GimpExportOptions has also been updated to say this. - Add a data_destroy callback for the user data passed in gimp_export_procedure_set_capabilities(). - Fixing annotations of 'export_options' object from pdb/pdb.pl: input args would actually be (nullable) and would not transfer ownership (calling code must still free the object). Return value's ownership on the other hand is fully transfered. - Add C and Python unit testing for GimpExportOptions and gimp_export_options_get_image() in particular. - Fix or improve various details. Note that I have also considered for a long time changing the signature of gimp_export_options_get_image() to return a boolean indicating whether `image` had been replaced (hence needed deletion) or not. This also meant getting rid of the GimpExportReturn enum. Right now it would work because there are no third case, but I was considering the future possibility that for instance we got some impossible conversion for some future capability. I'm not sure it would ever happen; and for sure, this is not desirable because it implies an export failure a bit late in the workflow. But just in case, let's keep the enum return value. It does not even make the using code that much more complicated (well just a value comparison instead of a simple boolean test).
2024-08-17 21:06:27 +08:00
! GIMP_IS_PARAM_SPEC_FILE (procedure->args[2]) ||
! GIMP_IS_PARAM_SPEC_EXPORT_OPTIONS (procedure->args[3]))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_FAILED,
"Plug-in \"%s\"\n(%s)\n"
"attempted to register procedure \"%s\" "
"as save handler which does not take the standard "
"save procedure arguments:\n"
"(GimpRunMode, GimpImage, GFile, GimpExportOptions)",
gimp_object_get_name (plug_in),
gimp_file_get_utf8_name (plug_in->file),
proc_name);
return FALSE;
}
gimp_plug_in_procedure_set_file_proc (proc, extensions, prefixes, NULL);
gimp_plug_in_manager_add_save_procedure (plug_in->manager, proc);
return TRUE;
}
gboolean
gimp_plug_in_set_file_proc_priority (GimpPlugIn *plug_in,
const gchar *proc_name,
gint priority,
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 register the priority "
"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;
}
gimp_plug_in_procedure_set_priority (proc, priority);
return TRUE;
}
gboolean
gimp_plug_in_set_file_proc_mime_types (GimpPlugIn *plug_in,
const gchar *proc_name,
const gchar *mime_types,
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 register mime 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;
}
gimp_plug_in_procedure_set_mime_types (proc, mime_types);
return TRUE;
}
gboolean
gimp_plug_in_set_file_proc_handles_remote (GimpPlugIn *plug_in,
const gchar *proc_name,
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 register 'handles remote' "
"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;
}
gimp_plug_in_procedure_set_handles_remote (proc);
return TRUE;
}
gboolean
gimp_plug_in_set_file_proc_handles_raw (GimpPlugIn *plug_in,
const gchar *proc_name,
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 register 'handles raw' "
"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 (proc->handles_vector)
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_FAILED,
"Plug-in \"%s\"\n(%s)\n"
"attempted to register 'handles raw' "
"for procedure \"%s\" which already 'handles vector'.\n"
"It cannot handle both.",
gimp_object_get_name (plug_in),
gimp_file_get_utf8_name (plug_in->file),
proc_name);
return FALSE;
}
gimp_plug_in_procedure_set_handles_raw (proc);
return TRUE;
}
gboolean
gimp_plug_in_set_file_proc_handles_vector (GimpPlugIn *plug_in,
const gchar *proc_name,
GError **error)
{
GimpPlugInProcedure *proc;
GimpProcedure *procedure;
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 register 'handles vector' "
"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;
}
procedure = GIMP_PROCEDURE (proc);
if (procedure->num_args < 4 ||
procedure->num_values < 1 ||
! GIMP_IS_PARAM_SPEC_RUN_MODE (procedure->args[0]) ||
! GIMP_IS_PARAM_SPEC_FILE (procedure->args[1]) ||
! G_IS_PARAM_SPEC_INT (procedure->args[2]) ||
! G_IS_PARAM_SPEC_INT (procedure->args[3]) ||
! GIMP_IS_PARAM_SPEC_IMAGE (procedure->values[0]))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_FAILED,
"Plug-in \"%s\"\n(%s)\n"
"attempted to register procedure \"%s\" "
"as a vector load procedure which does not take the "
"standard load procedure procedure arguments: "
"(GimpRunMode, file, int, int) -> (image)",
gimp_object_get_name (plug_in),
gimp_file_get_utf8_name (plug_in->file),
proc_name);
return FALSE;
}
if (proc->handles_raw)
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_FAILED,
"Plug-in \"%s\"\n(%s)\n"
"attempted to register 'handles vector' "
"for procedure \"%s\" which already 'handles raw'.\n"
"It cannot handle both.",
gimp_object_get_name (plug_in),
gimp_file_get_utf8_name (plug_in->file),
proc_name);
return FALSE;
}
gimp_plug_in_procedure_set_handles_vector (proc);
return TRUE;
}
gboolean
gimp_plug_in_set_file_proc_thumb_loader (GimpPlugIn *plug_in,
const gchar *proc_name,
const gchar *thumb_proc_name,
GError **error)
{
GimpPlugInProcedure *proc;
GimpPlugInProcedure *thumb_proc;
g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), FALSE);
g_return_val_if_fail (proc_name != NULL, FALSE);
g_return_val_if_fail (thumb_proc_name != NULL, FALSE);
proc = gimp_plug_in_proc_find (plug_in, proc_name);
thumb_proc = gimp_plug_in_proc_find (plug_in, thumb_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 register a thumbnail loader "
"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 (! thumb_proc)
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_PROCEDURE_NOT_FOUND,
"Plug-in \"%s\"\n(%s)\n"
"attempted to register a procedure \"%s\" "
"as thumbnail loader.\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),
thumb_proc_name);
return FALSE;
}
gimp_plug_in_procedure_set_thumb_loader (proc, thumb_proc_name);
return TRUE;
}
gboolean
gimp_plug_in_set_batch_interpreter (GimpPlugIn *plug_in,
const gchar *proc_name,
const gchar *interpreter_name,
GError **error)
{
GimpPlugInProcedure *proc;
GimpProcedure *procedure;
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 register procedure \"%s\" "
"as a 'batch interpreter'.\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;
}
procedure = GIMP_PROCEDURE (proc);
if (procedure->num_args < 2 ||
! GIMP_IS_PARAM_SPEC_RUN_MODE (procedure->args[0]) ||
! G_IS_PARAM_SPEC_STRING (procedure->args[1]))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_FAILED,
"Plug-in \"%s\"\n(%s)\n"
"attempted to register procedure \"%s\" "
"as a batch interpreter which does not take the standard "
"batch interpreter procedure arguments: "
"(GimpRunMode, gchar *) -> ()",
gimp_object_get_name (plug_in),
gimp_file_get_utf8_name (plug_in->file),
proc_name);
return FALSE;
}
gimp_plug_in_procedure_set_batch_interpreter (proc, interpreter_name);
gimp_plug_in_manager_add_batch_procedure (plug_in->manager, proc);
return TRUE;
}
/* private functions */
static GimpPlugInProcedure *
gimp_plug_in_proc_find (GimpPlugIn *plug_in,
const gchar *proc_name)
{
GimpPlugInProcedure *proc = NULL;
if (plug_in->plug_in_def)
proc = gimp_plug_in_procedure_find (plug_in->plug_in_def->procedures,
proc_name);
if (! proc)
proc = gimp_plug_in_procedure_find (plug_in->temp_procedures, proc_name);
return proc;
}