mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-22 04:22:29 +00:00
0005f0ff5d
2006-08-05 Michael Natterer <mitch@gimp.org> * app/pdb/Makefile.am * app/pdb/gimppluginprocedure.[ch] * app/pdb/gimptemporaryprocedure.[ch]: removed these files... * app/plug-in/Makefile.am * app/plug-in/gimppluginprocedure.[ch] * app/plug-in/gimptemporaryprocedure.[ch]: ...and added them here. * app/Makefile.am * app/config/Makefile.am: reordered stuff to make it link again. * app/pdb/gimppdb.c: removed gimp_pdb_eek() hack. * app/actions/plug-in-actions.c * app/dialogs/file-save-dialog.c * app/file/file-open.c * app/file/file-save.c * app/file/file-utils.c * app/menus/plug-in-menus.c * app/plug-in/gimpplugin-message.c * app/plug-in/gimpplugin-progress.c * app/plug-in/gimpplugin.c * app/plug-in/gimppluginmanager-call.c * app/plug-in/gimppluginmanager-file.c * app/plug-in/gimppluginmanager-query.c * app/plug-in/gimppluginmanager.c * app/plug-in/gimppluginprocframe.c * app/plug-in/plug-in-def.c * app/plug-in/plug-in-rc.c * app/widgets/gimpfiledialog.c * app/widgets/gimpfileprocview.c * app/widgets/gimppluginaction.c * app/xcf/xcf.c * tools/pdbgen/pdb/plug_in.pdb: changed includes accordingly. * app/pdb/plug_in_cmds.c: regenerated.
193 lines
6.2 KiB
C
193 lines
6.2 KiB
C
/* The GIMP -- an image manipulation program
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
*
|
|
* gimppluginmanager-file.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 2 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, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include <glib-object.h>
|
|
|
|
#include "plug-in-types.h"
|
|
|
|
#include "core/gimp.h"
|
|
#include "core/gimpparamspecs.h"
|
|
|
|
#include "gimpplugin.h"
|
|
#include "gimppluginmanager.h"
|
|
#include "gimppluginmanager-file.h"
|
|
#include "gimppluginprocedure.h"
|
|
#include "plug-in-def.h"
|
|
|
|
|
|
/* public functions */
|
|
|
|
gboolean
|
|
gimp_plug_in_manager_register_load_handler (GimpPlugInManager *manager,
|
|
const gchar *name,
|
|
const gchar *extensions,
|
|
const gchar *prefixes,
|
|
const gchar *magics)
|
|
{
|
|
GimpPlugInProcedure *file_proc;
|
|
GimpProcedure *procedure;
|
|
GSList *list;
|
|
|
|
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), FALSE);
|
|
g_return_val_if_fail (name != NULL, FALSE);
|
|
|
|
if (manager->current_plug_in && manager->current_plug_in->plug_in_def)
|
|
list = manager->current_plug_in->plug_in_def->procedures;
|
|
else
|
|
list = manager->plug_in_procedures;
|
|
|
|
file_proc = gimp_plug_in_procedure_find (list, name);
|
|
|
|
if (! file_proc)
|
|
{
|
|
g_message ("attempt to register nonexistent load handler \"%s\"",
|
|
name);
|
|
return FALSE;
|
|
}
|
|
|
|
procedure = GIMP_PROCEDURE (file_proc);
|
|
|
|
if ((procedure->num_args < 3) ||
|
|
(procedure->num_values < 1) ||
|
|
! GIMP_IS_PARAM_SPEC_INT32 (procedure->args[0]) ||
|
|
! G_IS_PARAM_SPEC_STRING (procedure->args[1]) ||
|
|
! G_IS_PARAM_SPEC_STRING (procedure->args[2]) ||
|
|
! GIMP_IS_PARAM_SPEC_IMAGE_ID (procedure->values[0]))
|
|
{
|
|
g_message ("load handler \"%s\" does not take the standard "
|
|
"load handler args", name);
|
|
return FALSE;
|
|
}
|
|
|
|
gimp_plug_in_procedure_set_file_proc (file_proc,
|
|
extensions, prefixes, magics);
|
|
|
|
if (! g_slist_find (manager->load_procs, file_proc))
|
|
manager->load_procs = g_slist_prepend (manager->load_procs, file_proc);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
gboolean
|
|
gimp_plug_in_manager_register_save_handler (GimpPlugInManager *manager,
|
|
const gchar *name,
|
|
const gchar *extensions,
|
|
const gchar *prefixes)
|
|
{
|
|
GimpPlugInProcedure *file_proc;
|
|
GimpProcedure *procedure;
|
|
GSList *list;
|
|
|
|
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), FALSE);
|
|
g_return_val_if_fail (name != NULL, FALSE);
|
|
|
|
if (manager->current_plug_in && manager->current_plug_in->plug_in_def)
|
|
list = manager->current_plug_in->plug_in_def->procedures;
|
|
else
|
|
list = manager->plug_in_procedures;
|
|
|
|
file_proc = gimp_plug_in_procedure_find (list, name);
|
|
|
|
if (! file_proc)
|
|
{
|
|
g_message ("attempt to register nonexistent save handler \"%s\"",
|
|
name);
|
|
return FALSE;
|
|
}
|
|
|
|
procedure = GIMP_PROCEDURE (file_proc);
|
|
|
|
if ((procedure->num_args < 5) ||
|
|
! GIMP_IS_PARAM_SPEC_INT32 (procedure->args[0]) ||
|
|
! GIMP_IS_PARAM_SPEC_IMAGE_ID (procedure->args[1]) ||
|
|
! GIMP_IS_PARAM_SPEC_DRAWABLE_ID (procedure->args[2]) ||
|
|
! G_IS_PARAM_SPEC_STRING (procedure->args[3]) ||
|
|
! G_IS_PARAM_SPEC_STRING (procedure->args[4]))
|
|
{
|
|
g_message ("save handler \"%s\" does not take the standard "
|
|
"save handler args", name);
|
|
return FALSE;
|
|
}
|
|
|
|
gimp_plug_in_procedure_set_file_proc (file_proc,
|
|
extensions, prefixes, NULL);
|
|
|
|
if (! g_slist_find (manager->save_procs, file_proc))
|
|
manager->save_procs = g_slist_prepend (manager->save_procs, file_proc);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
gboolean
|
|
gimp_plug_in_manager_register_mime_type (GimpPlugInManager *manager,
|
|
const gchar *name,
|
|
const gchar *mime_type)
|
|
{
|
|
GimpPlugInProcedure *file_proc;
|
|
GSList *list;
|
|
|
|
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), FALSE);
|
|
g_return_val_if_fail (name != NULL, FALSE);
|
|
g_return_val_if_fail (mime_type != NULL, FALSE);
|
|
|
|
if (manager->current_plug_in && manager->current_plug_in->plug_in_def)
|
|
list = manager->current_plug_in->plug_in_def->procedures;
|
|
else
|
|
list = manager->plug_in_procedures;
|
|
|
|
file_proc = gimp_plug_in_procedure_find (list, name);
|
|
|
|
if (! file_proc)
|
|
return FALSE;
|
|
|
|
gimp_plug_in_procedure_set_mime_type (file_proc, mime_type);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
gboolean
|
|
gimp_plug_in_manager_register_thumb_loader (GimpPlugInManager *manager,
|
|
const gchar *load_proc,
|
|
const gchar *thumb_proc)
|
|
{
|
|
GimpPlugInProcedure *file_proc;
|
|
GSList *list;
|
|
|
|
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), FALSE);
|
|
g_return_val_if_fail (load_proc, FALSE);
|
|
g_return_val_if_fail (thumb_proc, FALSE);
|
|
|
|
if (manager->current_plug_in && manager->current_plug_in->plug_in_def)
|
|
list = manager->current_plug_in->plug_in_def->procedures;
|
|
else
|
|
list = manager->plug_in_procedures;
|
|
|
|
file_proc = gimp_plug_in_procedure_find (list, load_proc);
|
|
|
|
if (! file_proc)
|
|
return FALSE;
|
|
|
|
gimp_plug_in_procedure_set_thumb_loader (file_proc, thumb_proc);
|
|
|
|
return TRUE;
|
|
}
|