1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2004-09-22 23:12:24 +08:00
|
|
|
* plug-ins.c
|
|
|
|
*
|
1997-11-25 06:05:25 +08:00
|
|
|
* 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
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-07-16 20:49:04 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "config.h"
|
1999-03-07 20:56:03 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "string.h"
|
1999-06-22 04:04:04 +08:00
|
|
|
|
2003-09-11 06:06:45 +08:00
|
|
|
#include <glib-object.h>
|
1999-06-15 06:18:02 +08:00
|
|
|
|
2001-05-21 21:58:46 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
#include "libgimpbase/gimpprotocol.h"
|
|
|
|
#include "libgimpbase/gimpwire.h"
|
2005-01-26 03:11:26 +08:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2001-12-01 08:14:14 +08:00
|
|
|
#include "plug-in-types.h"
|
2001-05-22 04:30:16 +08:00
|
|
|
|
2002-11-19 04:50:31 +08:00
|
|
|
#include "config/gimpcoreconfig.h"
|
|
|
|
|
2001-07-11 20:39:49 +08:00
|
|
|
#include "core/gimp.h"
|
2001-10-17 19:33:43 +08:00
|
|
|
#include "core/gimpcontext.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpdrawable.h"
|
|
|
|
#include "core/gimpimage.h"
|
2001-04-18 05:43:29 +08:00
|
|
|
|
2006-04-05 01:47:22 +08:00
|
|
|
#include "pdb/gimp-pdb.h"
|
2006-04-07 16:16:26 +08:00
|
|
|
#include "pdb/gimptemporaryprocedure.h"
|
2006-03-31 17:15:08 +08:00
|
|
|
|
2001-12-01 08:14:14 +08:00
|
|
|
#include "plug-in.h"
|
2006-02-21 19:05:43 +08:00
|
|
|
#include "plug-in-data.h"
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "plug-in-def.h"
|
2006-04-10 05:04:37 +08:00
|
|
|
#include "plug-in-help-domain.h"
|
|
|
|
#include "plug-in-locale-domain.h"
|
|
|
|
#include "plug-in-menu-branch.h"
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "plug-in-params.h"
|
|
|
|
#include "plug-in-progress.h"
|
2001-12-28 07:45:12 +08:00
|
|
|
#include "plug-in-rc.h"
|
2006-04-10 00:25:47 +08:00
|
|
|
#include "plug-ins.h"
|
2001-12-01 08:14:14 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
|
2006-04-09 20:33:32 +08:00
|
|
|
static void plug_ins_add_from_file (const GimpDatafileData *file_data,
|
|
|
|
gpointer data);
|
|
|
|
static void plug_ins_add_from_rc (Gimp *gimp,
|
|
|
|
PlugInDef *plug_in_def);
|
|
|
|
static void plug_ins_add_to_db (Gimp *gimp,
|
|
|
|
GimpContext *context);
|
|
|
|
static gint plug_ins_file_proc_compare (gconstpointer a,
|
|
|
|
gconstpointer b,
|
|
|
|
gpointer data);
|
2000-07-16 20:49:04 +08:00
|
|
|
|
1999-05-07 04:56:07 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
/* public functions */
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
void
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_ins_init (Gimp *gimp,
|
2004-07-01 00:55:43 +08:00
|
|
|
GimpContext *context,
|
2002-03-21 01:46:13 +08:00
|
|
|
GimpInitStatusFunc status_callback)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-07-01 00:55:43 +08:00
|
|
|
gchar *filename;
|
|
|
|
gchar *basename;
|
|
|
|
gchar *path;
|
2006-04-09 20:33:32 +08:00
|
|
|
GSList *rc_defs;
|
2004-07-01 00:55:43 +08:00
|
|
|
GSList *list;
|
|
|
|
GList *extensions = NULL;
|
2005-10-31 22:30:29 +08:00
|
|
|
gint n_plugins;
|
|
|
|
gint n_extensions;
|
|
|
|
gint nth;
|
2004-07-01 00:55:43 +08:00
|
|
|
GError *error = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-10-20 00:41:09 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2004-07-01 00:55:43 +08:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2001-10-20 00:41:09 +08:00
|
|
|
g_return_if_fail (status_callback != NULL);
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in_init (gimp);
|
2000-07-16 20:49:04 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* search for binaries in the plug-in directory path */
|
2006-04-09 20:33:32 +08:00
|
|
|
status_callback (_("Searching Plug-Ins"), "", 0.0);
|
|
|
|
|
2002-12-30 08:01:30 +08:00
|
|
|
path = gimp_config_path_expand (gimp->config->plug_in_path, TRUE, NULL);
|
|
|
|
|
|
|
|
gimp_datafiles_read_directories (path,
|
2002-10-23 22:55:07 +08:00
|
|
|
G_FILE_TEST_IS_EXECUTABLE,
|
2006-04-09 20:33:32 +08:00
|
|
|
plug_ins_add_from_file,
|
2003-02-11 20:07:31 +08:00
|
|
|
&gimp->plug_in_defs);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-12-30 08:01:30 +08:00
|
|
|
g_free (path);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* read the pluginrc file for cached data */
|
2002-11-19 04:50:31 +08:00
|
|
|
if (gimp->config->plug_in_rc_path)
|
1998-04-11 13:07:52 +08:00
|
|
|
{
|
2002-12-30 08:18:33 +08:00
|
|
|
filename = gimp_config_path_expand (gimp->config->plug_in_rc_path,
|
|
|
|
TRUE, NULL);
|
|
|
|
|
2004-02-01 18:52:23 +08:00
|
|
|
if (! g_path_is_absolute (filename))
|
2002-12-30 08:18:33 +08:00
|
|
|
{
|
2004-02-01 18:52:23 +08:00
|
|
|
gchar *str = g_build_filename (gimp_directory (), filename, NULL);
|
2003-11-08 07:47:35 +08:00
|
|
|
|
2002-12-30 08:18:33 +08:00
|
|
|
g_free (filename);
|
2004-02-01 18:52:23 +08:00
|
|
|
filename = str;
|
2002-12-30 08:18:33 +08:00
|
|
|
}
|
1998-04-11 13:07:52 +08:00
|
|
|
}
|
|
|
|
else
|
2002-03-21 01:46:13 +08:00
|
|
|
{
|
|
|
|
filename = gimp_personal_rc_file ("pluginrc");
|
|
|
|
}
|
1998-04-11 13:07:52 +08:00
|
|
|
|
2005-11-01 18:20:38 +08:00
|
|
|
status_callback (_("Resource configuration"),
|
2005-11-05 20:18:56 +08:00
|
|
|
gimp_filename_to_utf8 (filename), 0.0);
|
2003-11-08 07:47:35 +08:00
|
|
|
|
2005-11-07 06:01:25 +08:00
|
|
|
if (gimp->be_verbose)
|
|
|
|
g_print (_("Parsing '%s'\n"), gimp_filename_to_utf8 (filename));
|
|
|
|
|
2006-04-09 20:33:32 +08:00
|
|
|
rc_defs = plug_in_rc_parse (gimp, filename, &error);
|
|
|
|
|
|
|
|
if (rc_defs)
|
|
|
|
{
|
|
|
|
for (list = rc_defs; list; list = g_slist_next (list))
|
|
|
|
plug_ins_add_from_rc (gimp, list->data); /* consumes list->data */
|
|
|
|
|
|
|
|
g_slist_free (rc_defs);
|
|
|
|
}
|
|
|
|
else
|
2003-11-08 07:47:35 +08:00
|
|
|
{
|
2004-02-09 02:49:58 +08:00
|
|
|
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
|
|
|
g_message (error->message);
|
|
|
|
|
2004-02-03 23:12:11 +08:00
|
|
|
g_clear_error (&error);
|
2003-11-08 07:47:35 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-11-01 18:20:38 +08:00
|
|
|
/* query any plug-ins that have changed since we last wrote out
|
|
|
|
* the pluginrc file
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2005-11-05 23:00:35 +08:00
|
|
|
status_callback (_("Querying new Plug-ins"), "", 0.0);
|
2002-08-27 23:23:36 +08:00
|
|
|
|
2005-10-31 22:30:29 +08:00
|
|
|
for (list = gimp->plug_in_defs, n_plugins = 0; list; list = list->next)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
PlugInDef *plug_in_def = list->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
if (plug_in_def->needs_query)
|
2005-10-31 22:30:29 +08:00
|
|
|
n_plugins++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (n_plugins)
|
|
|
|
{
|
|
|
|
gimp->write_pluginrc = TRUE;
|
|
|
|
|
2005-11-06 05:56:33 +08:00
|
|
|
for (list = gimp->plug_in_defs, nth = 0; list; list = list->next)
|
2005-10-31 22:30:29 +08:00
|
|
|
{
|
|
|
|
PlugInDef *plug_in_def = list->data;
|
|
|
|
|
2006-04-09 07:12:06 +08:00
|
|
|
if (plug_in_def->needs_query)
|
|
|
|
{
|
|
|
|
basename = g_filename_display_basename (plug_in_def->prog);
|
|
|
|
status_callback (NULL, basename,
|
|
|
|
(gdouble) nth++ / (gdouble) n_plugins);
|
|
|
|
g_free (basename);
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2006-04-09 07:12:06 +08:00
|
|
|
if (gimp->be_verbose)
|
|
|
|
g_print (_("Querying plug-in: '%s'\n"),
|
|
|
|
gimp_filename_to_utf8 (plug_in_def->prog));
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2006-04-09 07:12:06 +08:00
|
|
|
plug_in_call_query (gimp, context, plug_in_def);
|
|
|
|
}
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2004-04-16 06:16:21 +08:00
|
|
|
/* initialize the plug-ins */
|
2005-11-05 23:00:35 +08:00
|
|
|
status_callback (_("Initializing Plug-ins"), "", 0.0);
|
2004-04-16 06:16:21 +08:00
|
|
|
|
2005-10-31 22:30:29 +08:00
|
|
|
for (list = gimp->plug_in_defs, n_plugins = 0; list; list = list->next)
|
2004-04-16 06:16:21 +08:00
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
PlugInDef *plug_in_def = list->data;
|
2004-04-16 06:16:21 +08:00
|
|
|
|
|
|
|
if (plug_in_def->has_init)
|
2005-10-31 22:30:29 +08:00
|
|
|
n_plugins++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (n_plugins)
|
|
|
|
{
|
2005-11-06 05:56:33 +08:00
|
|
|
for (list = gimp->plug_in_defs, nth = 0; list; list = list->next)
|
2005-10-31 22:30:29 +08:00
|
|
|
{
|
|
|
|
PlugInDef *plug_in_def = list->data;
|
|
|
|
|
2006-04-09 07:12:06 +08:00
|
|
|
if (plug_in_def->has_init)
|
|
|
|
{
|
|
|
|
basename = g_filename_display_basename (plug_in_def->prog);
|
|
|
|
status_callback (NULL, basename,
|
|
|
|
(gdouble) nth++ / (gdouble) n_plugins);
|
|
|
|
g_free (basename);
|
2005-10-31 22:30:29 +08:00
|
|
|
|
2006-04-09 07:12:06 +08:00
|
|
|
if (gimp->be_verbose)
|
|
|
|
g_print (_("Initializing plug-in: '%s'\n"),
|
|
|
|
gimp_filename_to_utf8 (plug_in_def->prog));
|
2004-04-16 06:16:21 +08:00
|
|
|
|
2006-04-09 07:12:06 +08:00
|
|
|
plug_in_call_init (gimp, context, plug_in_def);
|
|
|
|
}
|
2005-10-31 22:30:29 +08:00
|
|
|
}
|
2004-04-16 06:16:21 +08:00
|
|
|
}
|
|
|
|
|
2005-11-05 23:00:35 +08:00
|
|
|
status_callback (NULL, "", 1.0);
|
2004-04-16 06:16:21 +08:00
|
|
|
|
2006-04-10 04:35:15 +08:00
|
|
|
/* add the procedures to gimp->plug_in_procedures */
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_defs; list; list = list->next)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
PlugInDef *plug_in_def = list->data;
|
|
|
|
GSList *list2;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-04-07 16:16:26 +08:00
|
|
|
for (list2 = plug_in_def->procedures; list2; list2 = list2->next)
|
2006-04-09 20:33:32 +08:00
|
|
|
{
|
2006-04-10 04:35:15 +08:00
|
|
|
plug_ins_procedure_add (gimp, list2->data);
|
2006-04-09 20:33:32 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* write the pluginrc file if necessary */
|
2003-02-11 20:07:31 +08:00
|
|
|
if (gimp->write_pluginrc)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-12-01 08:14:14 +08:00
|
|
|
if (gimp->be_verbose)
|
2005-11-01 18:20:38 +08:00
|
|
|
g_print (_("Writing '%s'\n"), gimp_filename_to_utf8 (filename));
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2003-03-10 23:48:16 +08:00
|
|
|
if (! plug_in_rc_write (gimp->plug_in_defs, filename, &error))
|
|
|
|
{
|
|
|
|
g_message ("%s", error->message);
|
2004-02-03 23:12:11 +08:00
|
|
|
g_clear_error (&error);
|
2003-03-10 23:48:16 +08:00
|
|
|
}
|
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp->write_pluginrc = FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
g_free (filename);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* add the plug-in procs to the procedure database */
|
2004-04-15 21:10:51 +08:00
|
|
|
plug_ins_add_to_db (gimp, context);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
/* create help_path and locale_domain lists */
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_defs; list; list = list->next)
|
2002-12-11 00:38:16 +08:00
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
PlugInDef *plug_in_def = list->data;
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
if (plug_in_def->locale_domain_name)
|
2006-04-10 05:04:37 +08:00
|
|
|
plug_in_locale_domain_add (gimp,
|
|
|
|
plug_in_def->prog,
|
|
|
|
plug_in_def->locale_domain_name,
|
|
|
|
plug_in_def->locale_domain_path);
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
if (plug_in_def->help_domain_name)
|
2006-04-10 05:04:37 +08:00
|
|
|
plug_in_help_domain_add (gimp,
|
|
|
|
plug_in_def->prog,
|
|
|
|
plug_in_def->help_domain_name,
|
|
|
|
plug_in_def->help_domain_uri);
|
2002-12-11 00:38:16 +08:00
|
|
|
}
|
|
|
|
|
2001-11-18 00:32:34 +08:00
|
|
|
if (! gimp->no_interface)
|
2004-07-17 05:47:06 +08:00
|
|
|
{
|
|
|
|
gimp->load_procs = g_slist_sort_with_data (gimp->load_procs,
|
|
|
|
plug_ins_file_proc_compare,
|
|
|
|
gimp);
|
|
|
|
gimp->save_procs = g_slist_sort_with_data (gimp->save_procs,
|
|
|
|
plug_ins_file_proc_compare,
|
|
|
|
gimp);
|
|
|
|
|
2006-04-10 00:25:47 +08:00
|
|
|
gimp_menus_init (gimp, gimp->plug_in_defs,
|
2006-04-10 05:04:37 +08:00
|
|
|
plug_in_standard_locale_domain ());
|
2004-07-17 05:47:06 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-04-15 19:35:31 +08:00
|
|
|
/* build list of automatically started extensions */
|
2006-04-07 16:16:26 +08:00
|
|
|
for (list = gimp->plug_in_procedures, nth = 0; list; list = list->next, nth++)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *proc = list->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc->prog &&
|
|
|
|
GIMP_PROCEDURE (proc)->proc_type == GIMP_EXTENSION &&
|
|
|
|
GIMP_PROCEDURE (proc)->num_args == 0)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
extensions = g_list_prepend (extensions, proc);
|
2003-04-15 19:35:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extensions = g_list_reverse (extensions);
|
|
|
|
n_extensions = g_list_length (extensions);
|
|
|
|
|
|
|
|
/* run the available extensions */
|
|
|
|
if (extensions)
|
|
|
|
{
|
2004-02-01 18:52:23 +08:00
|
|
|
GList *list;
|
|
|
|
|
2005-11-05 23:00:35 +08:00
|
|
|
status_callback (_("Starting Extensions"), "", 0.0);
|
2003-04-15 19:35:31 +08:00
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = extensions, nth = 0; list; list = g_list_next (list), nth++)
|
2003-04-15 19:35:31 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *proc = list->data;
|
|
|
|
GValueArray *args;
|
2003-04-15 19:35:31 +08:00
|
|
|
|
2001-12-01 08:14:14 +08:00
|
|
|
if (gimp->be_verbose)
|
2006-03-31 19:49:22 +08:00
|
|
|
g_print (_("Starting extension: '%s'\n"),
|
2006-04-07 18:04:27 +08:00
|
|
|
GIMP_OBJECT (proc)->name);
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2006-04-07 18:04:27 +08:00
|
|
|
status_callback (NULL, GIMP_OBJECT (proc)->name,
|
2005-11-01 18:20:38 +08:00
|
|
|
(gdouble) nth / (gdouble) n_extensions);
|
1998-01-26 06:13:00 +08:00
|
|
|
|
2006-04-04 18:30:58 +08:00
|
|
|
args = g_value_array_new (0);
|
|
|
|
|
2006-04-08 02:23:20 +08:00
|
|
|
gimp_procedure_execute_async (GIMP_PROCEDURE (proc),
|
|
|
|
gimp, context, NULL, args, -1);
|
2006-04-04 18:30:58 +08:00
|
|
|
|
|
|
|
g_value_array_free (args);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2003-04-15 19:35:31 +08:00
|
|
|
|
|
|
|
g_list_free (extensions);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2005-11-05 23:00:35 +08:00
|
|
|
status_callback ("", "", 1.0);
|
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
/* free up stuff */
|
2006-04-07 16:16:26 +08:00
|
|
|
g_slist_foreach (gimp->plug_in_defs, (GFunc) plug_in_def_free, NULL);
|
2003-02-11 20:07:31 +08:00
|
|
|
g_slist_free (gimp->plug_in_defs);
|
|
|
|
gimp->plug_in_defs = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_ins_exit (Gimp *gimp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-10 05:04:37 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
plug_in_exit (gimp);
|
2001-01-14 23:18:37 +08:00
|
|
|
|
2006-04-10 05:04:37 +08:00
|
|
|
plug_in_menu_branch_exit (gimp);
|
|
|
|
plug_in_locale_domain_exit (gimp);
|
|
|
|
plug_in_help_domain_exit (gimp);
|
2006-02-21 19:05:43 +08:00
|
|
|
plug_in_data_free (gimp);
|
2006-04-07 16:16:26 +08:00
|
|
|
|
|
|
|
g_slist_foreach (gimp->plug_in_procedures, (GFunc) g_object_unref, NULL);
|
|
|
|
g_slist_free (gimp->plug_in_procedures);
|
|
|
|
gimp->plug_in_procedures = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *
|
2004-05-14 08:01:11 +08:00
|
|
|
plug_ins_file_register_magic (Gimp *gimp,
|
|
|
|
const gchar *name,
|
|
|
|
const gchar *extensions,
|
|
|
|
const gchar *prefixes,
|
|
|
|
const gchar *magics)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *proc;
|
|
|
|
GSList *list;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
2001-01-14 23:18:37 +08:00
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
2004-08-09 18:25:50 +08:00
|
|
|
if (gimp->current_plug_in && gimp->current_plug_in->plug_in_def)
|
2006-04-07 16:16:26 +08:00
|
|
|
list = gimp->current_plug_in->plug_in_def->procedures;
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
2006-04-07 16:16:26 +08:00
|
|
|
list = gimp->plug_in_procedures;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
proc = gimp_plug_in_procedure_find (list, name);
|
2005-05-05 02:53:58 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc)
|
|
|
|
gimp_plug_in_procedure_set_file_proc (proc, extensions, prefixes, magics);
|
2005-05-05 02:53:58 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
return proc;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *
|
2004-05-14 08:01:11 +08:00
|
|
|
plug_ins_file_register_mime (Gimp *gimp,
|
|
|
|
const gchar *name,
|
|
|
|
const gchar *mime_type)
|
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *proc;
|
|
|
|
GSList *list;
|
2004-05-14 08:01:11 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
g_return_val_if_fail (mime_type != NULL, NULL);
|
|
|
|
|
2004-08-09 18:25:50 +08:00
|
|
|
if (gimp->current_plug_in && gimp->current_plug_in->plug_in_def)
|
2006-04-07 16:16:26 +08:00
|
|
|
list = gimp->current_plug_in->plug_in_def->procedures;
|
2004-05-14 08:01:11 +08:00
|
|
|
else
|
2006-04-07 16:16:26 +08:00
|
|
|
list = gimp->plug_in_procedures;
|
2004-05-14 08:01:11 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
proc = gimp_plug_in_procedure_find (list, name);
|
2004-05-14 08:01:11 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc)
|
|
|
|
gimp_plug_in_procedure_set_mime_type (proc, mime_type);
|
2004-05-14 08:01:11 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
return proc;
|
2004-05-14 08:01:11 +08:00
|
|
|
}
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *
|
2004-11-14 01:06:06 +08:00
|
|
|
plug_ins_file_register_thumb_loader (Gimp *gimp,
|
|
|
|
const gchar *load_proc,
|
|
|
|
const gchar *thumb_proc)
|
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *proc;
|
|
|
|
GSList *list;
|
2004-11-14 01:06:06 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
g_return_val_if_fail (load_proc, NULL);
|
|
|
|
g_return_val_if_fail (thumb_proc, NULL);
|
|
|
|
|
|
|
|
if (gimp->current_plug_in && gimp->current_plug_in->plug_in_def)
|
2006-04-07 16:16:26 +08:00
|
|
|
list = gimp->current_plug_in->plug_in_def->procedures;
|
2004-11-14 01:06:06 +08:00
|
|
|
else
|
2006-04-07 16:16:26 +08:00
|
|
|
list = gimp->plug_in_procedures;
|
2004-11-14 01:06:06 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
proc = gimp_plug_in_procedure_find (list, load_proc);
|
2004-11-14 01:06:06 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc)
|
|
|
|
gimp_plug_in_procedure_set_thumb_loader (proc, thumb_proc);
|
2004-11-14 01:06:06 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
return proc;
|
2004-11-14 01:06:06 +08:00
|
|
|
}
|
|
|
|
|
2006-04-10 04:35:15 +08:00
|
|
|
void
|
|
|
|
plug_ins_procedure_add (Gimp *gimp,
|
|
|
|
GimpPlugInProcedure *proc)
|
|
|
|
{
|
|
|
|
GSList *list;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc));
|
|
|
|
|
|
|
|
for (list = gimp->plug_in_procedures; list; list = list->next)
|
|
|
|
{
|
|
|
|
GimpPlugInProcedure *tmp_proc = list->data;
|
|
|
|
|
|
|
|
if (strcmp (GIMP_OBJECT (proc)->name,
|
|
|
|
GIMP_OBJECT (tmp_proc)->name) == 0)
|
|
|
|
{
|
|
|
|
GSList *list2;
|
|
|
|
|
|
|
|
list->data = g_object_ref (proc);
|
|
|
|
|
|
|
|
g_printerr ("removing duplicate PDB procedure \"%s\" "
|
|
|
|
"registered by '%s'\n",
|
|
|
|
GIMP_OBJECT (tmp_proc)->name,
|
|
|
|
gimp_filename_to_utf8 (tmp_proc->prog));
|
|
|
|
|
|
|
|
/* search the plugin list to see if any plugins had references to
|
|
|
|
* the tmp_proc.
|
|
|
|
*/
|
|
|
|
for (list2 = gimp->plug_in_defs; list2; list2 = list2->next)
|
|
|
|
{
|
|
|
|
PlugInDef *plug_in_def = list2->data;
|
|
|
|
|
|
|
|
if (g_slist_find (plug_in_def->procedures, tmp_proc))
|
|
|
|
plug_in_def_remove_procedure (plug_in_def, tmp_proc);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* also remove it from the lists of load and save procs */
|
|
|
|
gimp->load_procs = g_slist_remove (gimp->load_procs, tmp_proc);
|
|
|
|
gimp->save_procs = g_slist_remove (gimp->save_procs, tmp_proc);
|
|
|
|
|
|
|
|
g_object_unref (tmp_proc);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp->plug_in_procedures = g_slist_prepend (gimp->plug_in_procedures,
|
|
|
|
g_object_ref (proc));
|
|
|
|
}
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
void
|
2006-04-07 16:16:26 +08:00
|
|
|
plug_ins_temp_procedure_add (Gimp *gimp,
|
|
|
|
GimpTemporaryProcedure *proc)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-18 02:07:37 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2006-04-07 16:16:26 +08:00
|
|
|
g_return_if_fail (GIMP_IS_TEMPORARY_PROCEDURE (proc));
|
2001-01-14 23:18:37 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
if (! gimp->no_interface)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-07 16:16:26 +08:00
|
|
|
GimpPlugInProcedure *plug_in_proc = GIMP_PLUG_IN_PROCEDURE (proc);
|
|
|
|
|
|
|
|
if (plug_in_proc->menu_label || plug_in_proc->menu_paths)
|
|
|
|
gimp_menus_create_item (gimp, plug_in_proc, NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
/* Register the procedural database entry */
|
2006-04-05 16:38:33 +08:00
|
|
|
gimp_pdb_register (gimp, GIMP_PROCEDURE (proc));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
/* Add the definition to the global list */
|
2006-04-07 16:16:26 +08:00
|
|
|
gimp->plug_in_procedures = g_slist_prepend (gimp->plug_in_procedures,
|
|
|
|
g_object_ref (proc));
|
2003-01-18 02:07:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-04-07 16:16:26 +08:00
|
|
|
plug_ins_temp_procedure_remove (Gimp *gimp,
|
|
|
|
GimpTemporaryProcedure *proc)
|
2003-01-18 02:07:37 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2006-04-07 16:16:26 +08:00
|
|
|
g_return_if_fail (GIMP_IS_TEMPORARY_PROCEDURE (proc));
|
2003-01-18 02:07:37 +08:00
|
|
|
|
|
|
|
if (! gimp->no_interface)
|
|
|
|
{
|
2006-04-07 16:16:26 +08:00
|
|
|
GimpPlugInProcedure *plug_in_proc = GIMP_PLUG_IN_PROCEDURE (proc);
|
|
|
|
|
|
|
|
if (plug_in_proc->menu_label || plug_in_proc->menu_paths)
|
|
|
|
gimp_menus_delete_item (gimp, plug_in_proc);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2006-04-07 16:16:26 +08:00
|
|
|
/* Remove the definition from the global list */
|
|
|
|
gimp->plug_in_procedures = g_slist_remove (gimp->plug_in_procedures, proc);
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
/* Unregister the procedural database entry */
|
2006-04-07 18:04:27 +08:00
|
|
|
gimp_pdb_unregister (gimp, GIMP_OBJECT (proc)->name);
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
g_object_unref (proc);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
static void
|
2006-04-09 20:33:32 +08:00
|
|
|
plug_ins_add_from_file (const GimpDatafileData *file_data,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-18 02:07:37 +08:00
|
|
|
PlugInDef *plug_in_def;
|
2004-07-17 05:47:06 +08:00
|
|
|
GSList **plug_in_defs = data;
|
2003-01-20 20:17:32 +08:00
|
|
|
GSList *list;
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = *plug_in_defs; list; list = list->next)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-20 20:17:32 +08:00
|
|
|
gchar *plug_in_name;
|
|
|
|
|
2005-11-01 18:20:38 +08:00
|
|
|
plug_in_def = list->data;
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in_name = g_path_get_basename (plug_in_def->prog);
|
|
|
|
|
2003-07-03 01:11:00 +08:00
|
|
|
if (g_ascii_strcasecmp (file_data->basename, plug_in_name) == 0)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-11-17 06:21:27 +08:00
|
|
|
g_printerr ("skipping duplicate plug-in: '%s'\n",
|
2004-01-19 09:08:43 +08:00
|
|
|
gimp_filename_to_utf8 (file_data->filename));
|
2003-01-18 02:07:37 +08:00
|
|
|
|
|
|
|
g_free (plug_in_name);
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
return;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
g_free (plug_in_name);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
plug_in_def = plug_in_def_new (file_data->filename);
|
|
|
|
|
|
|
|
plug_in_def_set_mtime (plug_in_def, file_data->mtime);
|
|
|
|
plug_in_def_set_needs_query (plug_in_def, TRUE);
|
Add gimpcolorspace object.
2000-01-04 Tor Lillqvist <tml@iki.fi>
* libgimp/makefile.{cygwin.msc}: Add gimpcolorspace object.
* libgimp/gimp.def: Add functions from it.
Fixes from Hans Breuer:
* app/datafiles.c: redefine the executable flag for Win32
to _S_IREAD, to get _all_ files from the plug-in dirs as
executables (including scripts)
* app/main.c: Win32-specific changes to allow building Gimp as a
console application, with all its benefits (like inheriting the
console), but hide it if the user doesn't want it. Also, if stdout
goes to a console, give the user a chance to read the help or
version messages. (tml: I am not convinced that it is better to
build gimp as a console application, but let's try it this way for
a while.)
* app/makefile.{cygwin,msc}: Build as console application, and
link with shell32 library.
* app/paint_core.c (paint_core_motion): Pass the value of a call
to the function gimage_active_drawable() to the paint_func,
instead of just passing the address of gimage_active_drawable...
(tml: This code is only called when the TOOL_TRACES_ON_WINDOW flag
is on, and only the clone tool sets that, and the clone tool's
paint_func doesn't use the drawable argument, so this hasn't
caused any trouble.)
* app/plug_in.c: On Win32, to support scripts, use new function
xspawn() instead of _spawnv. Add some more code to properly kill
plug-ins.
* libgimp/color_display.h: Add G_MODULE_EXPORT declarations.
2000-01-05 01:46:41 +08:00
|
|
|
|
2004-07-17 06:45:03 +08:00
|
|
|
*plug_in_defs = g_slist_prepend (*plug_in_defs, plug_in_def);
|
2002-03-21 01:46:13 +08:00
|
|
|
}
|
Add gimpcolorspace object.
2000-01-04 Tor Lillqvist <tml@iki.fi>
* libgimp/makefile.{cygwin.msc}: Add gimpcolorspace object.
* libgimp/gimp.def: Add functions from it.
Fixes from Hans Breuer:
* app/datafiles.c: redefine the executable flag for Win32
to _S_IREAD, to get _all_ files from the plug-in dirs as
executables (including scripts)
* app/main.c: Win32-specific changes to allow building Gimp as a
console application, with all its benefits (like inheriting the
console), but hide it if the user doesn't want it. Also, if stdout
goes to a console, give the user a chance to read the help or
version messages. (tml: I am not convinced that it is better to
build gimp as a console application, but let's try it this way for
a while.)
* app/makefile.{cygwin,msc}: Build as console application, and
link with shell32 library.
* app/paint_core.c (paint_core_motion): Pass the value of a call
to the function gimage_active_drawable() to the paint_func,
instead of just passing the address of gimage_active_drawable...
(tml: This code is only called when the TOOL_TRACES_ON_WINDOW flag
is on, and only the clone tool sets that, and the clone tool's
paint_func doesn't use the drawable argument, so this hasn't
caused any trouble.)
* app/plug_in.c: On Win32, to support scripts, use new function
xspawn() instead of _spawnv. Add some more code to properly kill
plug-ins.
* libgimp/color_display.h: Add G_MODULE_EXPORT declarations.
2000-01-05 01:46:41 +08:00
|
|
|
|
2006-04-09 20:33:32 +08:00
|
|
|
static void
|
|
|
|
plug_ins_add_from_rc (Gimp *gimp,
|
|
|
|
PlugInDef *plug_in_def)
|
|
|
|
{
|
|
|
|
GSList *list;
|
|
|
|
gchar *basename1;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (plug_in_def != NULL);
|
|
|
|
g_return_if_fail (plug_in_def->prog != NULL);
|
|
|
|
|
|
|
|
if (! g_path_is_absolute (plug_in_def->prog))
|
|
|
|
{
|
|
|
|
g_warning ("plug_ins_def_add_from_rc: filename not absolute (skipping)");
|
|
|
|
plug_in_def_free (plug_in_def);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
basename1 = g_path_get_basename (plug_in_def->prog);
|
|
|
|
|
|
|
|
/* If this is a file load or save plugin, make sure we have
|
|
|
|
* something for one of the extensions, prefixes, or magic number.
|
|
|
|
* Other bits of code rely on detecting file plugins by the presence
|
|
|
|
* of one of these things, but Nick Lamb's alien/unknown format
|
|
|
|
* loader needs to be able to register no extensions, prefixes or
|
|
|
|
* magics. -- austin 13/Feb/99
|
|
|
|
*/
|
|
|
|
for (list = plug_in_def->procedures; list; list = list->next)
|
|
|
|
{
|
|
|
|
GimpPlugInProcedure *proc = list->data;
|
|
|
|
|
|
|
|
if (! proc->extensions &&
|
|
|
|
! proc->prefixes &&
|
|
|
|
! proc->magics &&
|
|
|
|
proc->menu_paths &&
|
|
|
|
(! strncmp (proc->menu_paths->data, "<Load>", 6) ||
|
|
|
|
! strncmp (proc->menu_paths->data, "<Save>", 6)))
|
|
|
|
{
|
|
|
|
proc->extensions = g_strdup ("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if the entry mentioned in pluginrc matches an executable
|
|
|
|
* found in the plug_in_path.
|
|
|
|
*/
|
|
|
|
for (list = gimp->plug_in_defs; list; list = list->next)
|
|
|
|
{
|
|
|
|
PlugInDef *ondisk_plug_in_def = list->data;
|
|
|
|
gchar *basename2;
|
|
|
|
|
|
|
|
basename2 = g_path_get_basename (ondisk_plug_in_def->prog);
|
|
|
|
|
|
|
|
if (! strcmp (basename1, basename2))
|
|
|
|
{
|
|
|
|
if (! g_ascii_strcasecmp (plug_in_def->prog,
|
|
|
|
ondisk_plug_in_def->prog) &&
|
|
|
|
(plug_in_def->mtime == ondisk_plug_in_def->mtime))
|
|
|
|
{
|
|
|
|
/* Use pluginrc entry, deleting ondisk entry */
|
|
|
|
list->data = plug_in_def;
|
|
|
|
plug_in_def_free (ondisk_plug_in_def);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Use ondisk entry, deleting pluginrc entry */
|
|
|
|
plug_in_def_free (plug_in_def);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (basename2);
|
|
|
|
g_free (basename1);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (basename2);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (basename1);
|
|
|
|
|
|
|
|
gimp->write_pluginrc = TRUE;
|
|
|
|
g_printerr ("executable not found: '%s'\n",
|
|
|
|
gimp_filename_to_utf8 (plug_in_def->prog));
|
|
|
|
plug_in_def_free (plug_in_def);
|
|
|
|
}
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
static void
|
2004-04-15 21:10:51 +08:00
|
|
|
plug_ins_add_to_db (Gimp *gimp,
|
|
|
|
GimpContext *context)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-07 16:16:26 +08:00
|
|
|
GSList *list;
|
2002-03-21 01:46:13 +08:00
|
|
|
|
2006-04-07 16:16:26 +08:00
|
|
|
for (list = gimp->plug_in_procedures; list; list = list->next)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-07 16:16:26 +08:00
|
|
|
GimpPlugInProcedure *proc = list->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-04-09 18:24:05 +08:00
|
|
|
gimp_pdb_register (gimp, GIMP_PROCEDURE (proc));
|
2002-03-21 01:46:13 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc->file_proc)
|
2002-03-21 01:46:13 +08:00
|
|
|
{
|
2006-04-04 18:30:58 +08:00
|
|
|
GValueArray *return_vals;
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc->image_types)
|
2006-03-27 19:40:00 +08:00
|
|
|
{
|
|
|
|
return_vals =
|
2006-04-05 01:47:22 +08:00
|
|
|
gimp_pdb_run_proc (gimp, context, NULL,
|
|
|
|
"gimp-register-save-handler",
|
2006-04-07 18:04:27 +08:00
|
|
|
G_TYPE_STRING, GIMP_OBJECT (proc)->name,
|
2006-04-05 16:38:33 +08:00
|
|
|
G_TYPE_STRING, proc->extensions,
|
|
|
|
G_TYPE_STRING, proc->prefixes,
|
2006-04-05 01:47:22 +08:00
|
|
|
G_TYPE_NONE);
|
2006-03-27 19:40:00 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return_vals =
|
2006-04-05 01:47:22 +08:00
|
|
|
gimp_pdb_run_proc (gimp, context, NULL,
|
|
|
|
"gimp-register-magic-load-handler",
|
2006-04-07 18:04:27 +08:00
|
|
|
G_TYPE_STRING, GIMP_OBJECT (proc)->name,
|
2006-04-05 16:38:33 +08:00
|
|
|
G_TYPE_STRING, proc->extensions,
|
|
|
|
G_TYPE_STRING, proc->prefixes,
|
|
|
|
G_TYPE_STRING, proc->magics,
|
2006-04-05 01:47:22 +08:00
|
|
|
G_TYPE_NONE);
|
2006-03-27 19:40:00 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-04-04 18:30:58 +08:00
|
|
|
g_value_array_free (return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-17 05:47:06 +08:00
|
|
|
static gint
|
|
|
|
plug_ins_file_proc_compare (gconstpointer a,
|
|
|
|
gconstpointer b,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
Gimp *gimp = data;
|
|
|
|
const GimpPlugInProcedure *proc_a = a;
|
|
|
|
const GimpPlugInProcedure *proc_b = b;
|
2006-04-10 00:25:47 +08:00
|
|
|
const gchar *domain_a;
|
|
|
|
const gchar *domain_b;
|
2006-04-05 16:38:33 +08:00
|
|
|
gchar *label_a;
|
|
|
|
gchar *label_b;
|
|
|
|
gint retval = 0;
|
2004-07-17 05:47:06 +08:00
|
|
|
|
2005-08-03 06:52:23 +08:00
|
|
|
if (strncmp (proc_a->prog, "gimp-xcf", 8) == 0)
|
2004-07-17 05:47:06 +08:00
|
|
|
return -1;
|
2005-11-01 18:20:38 +08:00
|
|
|
|
2005-08-03 06:52:23 +08:00
|
|
|
if (strncmp (proc_b->prog, "gimp-xcf", 8) == 0)
|
2004-07-17 05:47:06 +08:00
|
|
|
return 1;
|
|
|
|
|
2006-04-10 05:04:37 +08:00
|
|
|
domain_a = plug_in_locale_domain (gimp, proc_a->prog, NULL);
|
|
|
|
domain_b = plug_in_locale_domain (gimp, proc_b->prog, NULL);
|
2006-04-10 00:25:47 +08:00
|
|
|
|
|
|
|
label_a = gimp_plug_in_procedure_get_label (proc_a, domain_a);
|
|
|
|
label_b = gimp_plug_in_procedure_get_label (proc_b, domain_b);
|
2004-07-17 05:47:06 +08:00
|
|
|
|
|
|
|
if (label_a && label_b)
|
|
|
|
retval = g_utf8_collate (label_a, label_b);
|
|
|
|
|
|
|
|
g_free (label_a);
|
|
|
|
g_free (label_b);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|