2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2006-04-29 06:26:51 +08:00
|
|
|
* Copyright (C) 1995-2002 Spencer Kimball, Peter Mattis, and others
|
1997-11-25 06:05:25 +08:00
|
|
|
*
|
2006-04-29 06:26:51 +08:00
|
|
|
* gimppluginmanager.c
|
2004-09-22 23:12:24 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1997-11-25 06:05:25 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1997-11-25 06:05:25 +08:00
|
|
|
* (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
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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
|
|
|
|
2006-04-10 07:40:45 +08:00
|
|
|
#include <string.h>
|
1999-06-22 04:04:04 +08:00
|
|
|
|
2013-10-15 07:58:39 +08:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
2012-03-22 04:58:40 +08:00
|
|
|
#include <gegl.h>
|
1999-06-15 06:18:02 +08:00
|
|
|
|
2001-05-21 21:58:46 +08:00
|
|
|
#include "libgimpbase/gimpbase.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"
|
2015-12-30 18:53:52 +08:00
|
|
|
#include "core/gimp-filter-history.h"
|
2014-08-12 19:57:57 +08:00
|
|
|
#include "core/gimp-memsize.h"
|
2006-04-29 06:26:51 +08:00
|
|
|
#include "core/gimpmarshal.h"
|
2001-04-18 05:43:29 +08:00
|
|
|
|
2006-04-26 17:13:47 +08:00
|
|
|
#include "pdb/gimppdb.h"
|
2006-03-31 17:15:08 +08:00
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
#include "gimpenvirontable.h"
|
|
|
|
#include "gimpinterpreterdb.h"
|
2006-05-04 02:05:06 +08:00
|
|
|
#include "gimpplugin.h"
|
2006-04-29 06:26:51 +08:00
|
|
|
#include "gimpplugindebug.h"
|
2007-02-19 09:16:05 +08:00
|
|
|
#include "gimpplugindef.h"
|
2006-04-29 06:26:51 +08:00
|
|
|
#include "gimppluginmanager.h"
|
|
|
|
#include "gimppluginmanager-data.h"
|
|
|
|
#include "gimppluginmanager-help-domain.h"
|
|
|
|
#include "gimppluginmanager-locale-domain.h"
|
|
|
|
#include "gimppluginmanager-menu-branch.h"
|
|
|
|
#include "gimppluginshm.h"
|
2006-08-06 05:21:01 +08:00
|
|
|
#include "gimptemporaryprocedure.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-29 06:26:51 +08:00
|
|
|
enum
|
|
|
|
{
|
2006-05-05 06:51:21 +08:00
|
|
|
PLUG_IN_OPENED,
|
|
|
|
PLUG_IN_CLOSED,
|
2006-04-29 06:26:51 +08:00
|
|
|
MENU_BRANCH_ADDED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void gimp_plug_in_manager_finalize (GObject *object);
|
|
|
|
|
|
|
|
static gint64 gimp_plug_in_manager_get_memsize (GimpObject *object,
|
|
|
|
gint64 *gui_size);
|
|
|
|
|
|
|
|
|
2006-05-15 17:46:31 +08:00
|
|
|
G_DEFINE_TYPE (GimpPlugInManager, gimp_plug_in_manager, GIMP_TYPE_OBJECT)
|
2006-04-29 06:26:51 +08:00
|
|
|
|
|
|
|
#define parent_class gimp_plug_in_manager_parent_class
|
|
|
|
|
|
|
|
static guint manager_signals[LAST_SIGNAL] = { 0, };
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_plug_in_manager_class_init (GimpPlugInManagerClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
|
|
|
|
2006-05-05 06:51:21 +08:00
|
|
|
manager_signals[PLUG_IN_OPENED] =
|
|
|
|
g_signal_new ("plug-in-opened",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GimpPlugInManagerClass,
|
|
|
|
plug_in_opened),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__OBJECT,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_PLUG_IN);
|
|
|
|
|
|
|
|
manager_signals[PLUG_IN_CLOSED] =
|
|
|
|
g_signal_new ("plug-in-closed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GimpPlugInManagerClass,
|
|
|
|
plug_in_closed),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__OBJECT,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_PLUG_IN);
|
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
manager_signals[MENU_BRANCH_ADDED] =
|
|
|
|
g_signal_new ("menu-branch-added",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GimpPlugInManagerClass,
|
|
|
|
menu_branch_added),
|
|
|
|
NULL, NULL,
|
2014-07-09 03:09:35 +08:00
|
|
|
gimp_marshal_VOID__OBJECT_STRING_STRING,
|
2006-04-29 06:26:51 +08:00
|
|
|
G_TYPE_NONE, 1,
|
2014-07-09 03:09:35 +08:00
|
|
|
G_TYPE_FILE,
|
2006-04-29 06:26:51 +08:00
|
|
|
G_TYPE_STRING,
|
|
|
|
G_TYPE_STRING);
|
|
|
|
|
|
|
|
object_class->finalize = gimp_plug_in_manager_finalize;
|
|
|
|
|
|
|
|
gimp_object_class->get_memsize = gimp_plug_in_manager_get_memsize;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_plug_in_manager_init (GimpPlugInManager *manager)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_plug_in_manager_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GimpPlugInManager *manager = GIMP_PLUG_IN_MANAGER (object);
|
|
|
|
|
2017-07-25 04:18:54 +08:00
|
|
|
g_clear_pointer (&manager->load_procs, g_slist_free);
|
|
|
|
g_clear_pointer (&manager->save_procs, g_slist_free);
|
|
|
|
g_clear_pointer (&manager->export_procs, g_slist_free);
|
|
|
|
g_clear_pointer (&manager->raw_load_procs, g_slist_free);
|
2017-05-05 02:35:53 +08:00
|
|
|
|
2018-07-17 14:19:58 +08:00
|
|
|
g_clear_pointer (&manager->display_load_procs, g_slist_free);
|
|
|
|
g_clear_pointer (&manager->display_save_procs, g_slist_free);
|
|
|
|
g_clear_pointer (&manager->display_export_procs, g_slist_free);
|
|
|
|
g_clear_pointer (&manager->display_raw_load_procs, g_slist_free);
|
|
|
|
|
2006-05-05 05:49:04 +08:00
|
|
|
if (manager->plug_in_procedures)
|
|
|
|
{
|
2011-03-08 00:10:18 +08:00
|
|
|
g_slist_free_full (manager->plug_in_procedures,
|
|
|
|
(GDestroyNotify) g_object_unref);
|
2006-05-05 05:49:04 +08:00
|
|
|
manager->plug_in_procedures = NULL;
|
|
|
|
}
|
|
|
|
|
2007-03-06 04:09:46 +08:00
|
|
|
if (manager->plug_in_defs)
|
|
|
|
{
|
2011-03-08 00:10:18 +08:00
|
|
|
g_slist_free_full (manager->plug_in_defs,
|
|
|
|
(GDestroyNotify) g_object_unref);
|
2007-03-06 04:09:46 +08:00
|
|
|
manager->plug_in_defs = NULL;
|
|
|
|
}
|
|
|
|
|
2017-07-16 00:38:01 +08:00
|
|
|
g_clear_object (&manager->environ_table);
|
|
|
|
g_clear_object (&manager->interpreter_db);
|
2006-04-29 06:26:51 +08:00
|
|
|
|
2017-07-25 04:18:54 +08:00
|
|
|
g_clear_pointer (&manager->debug, gimp_plug_in_debug_free);
|
2006-05-05 05:49:04 +08:00
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
gimp_plug_in_manager_menu_branch_exit (manager);
|
|
|
|
gimp_plug_in_manager_locale_domain_exit (manager);
|
|
|
|
gimp_plug_in_manager_help_domain_exit (manager);
|
|
|
|
gimp_plug_in_manager_data_free (manager);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint64
|
|
|
|
gimp_plug_in_manager_get_memsize (GimpObject *object,
|
|
|
|
gint64 *gui_size)
|
|
|
|
{
|
|
|
|
GimpPlugInManager *manager = GIMP_PLUG_IN_MANAGER (object);
|
|
|
|
gint64 memsize = 0;
|
|
|
|
|
2007-03-06 04:09:46 +08:00
|
|
|
memsize += gimp_g_slist_get_memsize_foreach (manager->plug_in_defs,
|
|
|
|
(GimpMemsizeFunc)
|
|
|
|
gimp_object_get_memsize,
|
|
|
|
gui_size);
|
|
|
|
|
|
|
|
memsize += gimp_g_slist_get_memsize (manager->plug_in_procedures, 0);
|
|
|
|
memsize += gimp_g_slist_get_memsize (manager->load_procs, 0);
|
|
|
|
memsize += gimp_g_slist_get_memsize (manager->save_procs, 0);
|
2009-04-26 21:20:06 +08:00
|
|
|
memsize += gimp_g_slist_get_memsize (manager->export_procs, 0);
|
2018-07-17 14:19:58 +08:00
|
|
|
memsize += gimp_g_slist_get_memsize (manager->raw_load_procs, 0);
|
|
|
|
memsize += gimp_g_slist_get_memsize (manager->display_load_procs, 0);
|
|
|
|
memsize += gimp_g_slist_get_memsize (manager->display_save_procs, 0);
|
|
|
|
memsize += gimp_g_slist_get_memsize (manager->display_export_procs, 0);
|
|
|
|
memsize += gimp_g_slist_get_memsize (manager->display_raw_load_procs, 0);
|
2007-03-06 04:09:46 +08:00
|
|
|
|
|
|
|
memsize += gimp_g_slist_get_memsize (manager->menu_branches, 0 /* FIXME */);
|
|
|
|
memsize += gimp_g_slist_get_memsize (manager->locale_domains, 0 /* FIXME */);
|
|
|
|
memsize += gimp_g_slist_get_memsize (manager->help_domains, 0 /* FIXME */);
|
|
|
|
|
|
|
|
memsize += gimp_g_slist_get_memsize_foreach (manager->open_plug_ins,
|
|
|
|
(GimpMemsizeFunc)
|
|
|
|
gimp_object_get_memsize,
|
|
|
|
gui_size);
|
2007-11-17 02:19:30 +08:00
|
|
|
memsize += gimp_g_slist_get_memsize (manager->plug_in_stack, 0);
|
2006-04-29 06:26:51 +08:00
|
|
|
|
2007-03-06 04:09:46 +08:00
|
|
|
memsize += 0; /* FIXME manager->shm */
|
2018-01-10 17:29:37 +08:00
|
|
|
memsize += /* FIXME */ gimp_g_object_get_memsize (G_OBJECT (manager->interpreter_db));
|
|
|
|
memsize += /* FIXME */ gimp_g_object_get_memsize (G_OBJECT (manager->environ_table));
|
2007-03-06 04:09:46 +08:00
|
|
|
memsize += 0; /* FIXME manager->plug_in_debug */
|
|
|
|
memsize += gimp_g_list_get_memsize (manager->data_list, 0 /* FIXME */);
|
2006-04-29 06:26:51 +08:00
|
|
|
|
|
|
|
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
|
|
|
|
gui_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpPlugInManager *
|
|
|
|
gimp_plug_in_manager_new (Gimp *gimp)
|
|
|
|
{
|
|
|
|
GimpPlugInManager *manager;
|
|
|
|
|
|
|
|
manager = g_object_new (GIMP_TYPE_PLUG_IN_MANAGER, NULL);
|
|
|
|
|
2014-07-15 04:55:53 +08:00
|
|
|
manager->gimp = gimp;
|
|
|
|
manager->interpreter_db = gimp_interpreter_db_new (gimp->be_verbose);
|
|
|
|
manager->environ_table = gimp_environ_table_new (gimp->be_verbose);
|
2006-04-29 06:26:51 +08:00
|
|
|
|
|
|
|
return manager;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_plug_in_manager_initialize (GimpPlugInManager *manager,
|
|
|
|
GimpInitStatusFunc status_callback)
|
|
|
|
{
|
2014-07-21 01:24:06 +08:00
|
|
|
GimpCoreConfig *config;
|
|
|
|
GList *path;
|
2006-04-29 06:26:51 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
|
|
|
g_return_if_fail (status_callback != NULL);
|
2006-04-10 07:40:45 +08:00
|
|
|
|
2014-07-21 01:24:06 +08:00
|
|
|
config = manager->gimp->config;
|
|
|
|
|
2017-03-22 00:45:50 +08:00
|
|
|
status_callback (NULL, _("Plug-in Interpreters"), 0.8);
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2014-07-21 01:24:06 +08:00
|
|
|
path = gimp_config_path_expand_to_files (config->interpreter_path, NULL);
|
2006-04-29 06:26:51 +08:00
|
|
|
gimp_interpreter_db_load (manager->interpreter_db, path);
|
2014-07-21 01:24:06 +08:00
|
|
|
g_list_free_full (path, (GDestroyNotify) g_object_unref);
|
2006-04-29 06:26:51 +08:00
|
|
|
|
2017-03-22 00:45:50 +08:00
|
|
|
status_callback (NULL, _("Plug-in Environment"), 0.9);
|
2006-04-29 06:26:51 +08:00
|
|
|
|
2014-07-21 01:24:06 +08:00
|
|
|
path = gimp_config_path_expand_to_files (config->environ_path, NULL);
|
2006-04-29 06:26:51 +08:00
|
|
|
gimp_environ_table_load (manager->environ_table, path);
|
2014-07-21 01:24:06 +08:00
|
|
|
g_list_free_full (path, (GDestroyNotify) g_object_unref);
|
1999-05-07 04:56:07 +08:00
|
|
|
|
2006-10-24 03:19:22 +08:00
|
|
|
/* allocate a piece of shared memory for use in transporting tiles
|
2006-04-29 06:26:51 +08:00
|
|
|
* to plug-ins. if we can't allocate a piece of shared memory then
|
|
|
|
* we'll fall back on sending the data over the pipe.
|
|
|
|
*/
|
|
|
|
if (manager->gimp->use_shm)
|
|
|
|
manager->shm = gimp_plug_in_shm_new ();
|
|
|
|
|
|
|
|
manager->debug = gimp_plug_in_debug_new ();
|
|
|
|
}
|
2003-01-18 02:07:37 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
void
|
2006-04-29 06:26:51 +08:00
|
|
|
gimp_plug_in_manager_exit (GimpPlugInManager *manager)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-29 06:26:51 +08:00
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
|
|
|
|
2006-05-05 05:49:04 +08:00
|
|
|
while (manager->open_plug_ins)
|
|
|
|
gimp_plug_in_close (manager->open_plug_ins->data, TRUE);
|
2010-02-11 02:37:46 +08:00
|
|
|
|
2018-03-25 04:49:01 +08:00
|
|
|
/* need to detach from shared memory, we can't rely on exit()
|
2010-02-11 02:37:46 +08:00
|
|
|
* cleaning up behind us (see bug #609026)
|
|
|
|
*/
|
|
|
|
if (manager->shm)
|
|
|
|
{
|
|
|
|
gimp_plug_in_shm_free (manager->shm);
|
|
|
|
manager->shm = NULL;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2006-04-10 04:35:15 +08:00
|
|
|
void
|
2006-04-29 06:26:51 +08:00
|
|
|
gimp_plug_in_manager_add_procedure (GimpPlugInManager *manager,
|
|
|
|
GimpPlugInProcedure *procedure)
|
2006-04-10 04:35:15 +08:00
|
|
|
{
|
|
|
|
GSList *list;
|
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (procedure));
|
2006-04-10 04:35:15 +08:00
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
for (list = manager->plug_in_procedures; list; list = list->next)
|
2006-04-10 04:35:15 +08:00
|
|
|
{
|
|
|
|
GimpPlugInProcedure *tmp_proc = list->data;
|
|
|
|
|
2009-08-29 18:40:40 +08:00
|
|
|
if (strcmp (gimp_object_get_name (procedure),
|
|
|
|
gimp_object_get_name (tmp_proc)) == 0)
|
2006-04-10 04:35:15 +08:00
|
|
|
{
|
|
|
|
GSList *list2;
|
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
list->data = g_object_ref (procedure);
|
2006-04-10 04:35:15 +08:00
|
|
|
|
2007-04-17 22:25:09 +08:00
|
|
|
g_printerr ("Removing duplicate PDB procedure '%s' "
|
2006-04-10 04:35:15 +08:00
|
|
|
"registered by '%s'\n",
|
2009-08-29 18:40:40 +08:00
|
|
|
gimp_object_get_name (tmp_proc),
|
2014-07-09 03:09:35 +08:00
|
|
|
gimp_file_get_utf8_name (tmp_proc->file));
|
2006-04-10 04:35:15 +08:00
|
|
|
|
|
|
|
/* search the plugin list to see if any plugins had references to
|
|
|
|
* the tmp_proc.
|
|
|
|
*/
|
2006-04-29 06:26:51 +08:00
|
|
|
for (list2 = manager->plug_in_defs; list2; list2 = list2->next)
|
2006-04-10 04:35:15 +08:00
|
|
|
{
|
2007-02-19 09:16:05 +08:00
|
|
|
GimpPlugInDef *plug_in_def = list2->data;
|
2006-04-10 04:35:15 +08:00
|
|
|
|
|
|
|
if (g_slist_find (plug_in_def->procedures, tmp_proc))
|
2007-02-19 09:16:05 +08:00
|
|
|
gimp_plug_in_def_remove_procedure (plug_in_def, tmp_proc);
|
2006-04-10 04:35:15 +08:00
|
|
|
}
|
|
|
|
|
2009-04-26 21:20:06 +08:00
|
|
|
/* also remove it from the lists of load, save and export procs */
|
2018-07-17 14:19:58 +08:00
|
|
|
manager->load_procs = g_slist_remove (manager->load_procs, tmp_proc);
|
|
|
|
manager->save_procs = g_slist_remove (manager->save_procs, tmp_proc);
|
|
|
|
manager->export_procs = g_slist_remove (manager->export_procs, tmp_proc);
|
|
|
|
manager->raw_load_procs = g_slist_remove (manager->raw_load_procs, tmp_proc);
|
|
|
|
manager->display_load_procs = g_slist_remove (manager->display_load_procs, tmp_proc);
|
|
|
|
manager->display_save_procs = g_slist_remove (manager->display_save_procs, tmp_proc);
|
|
|
|
manager->display_export_procs = g_slist_remove (manager->display_export_procs, tmp_proc);
|
|
|
|
manager->display_raw_load_procs = g_slist_remove (manager->display_raw_load_procs, tmp_proc);
|
2006-04-10 04:35:15 +08:00
|
|
|
|
2006-08-09 00:34:22 +08:00
|
|
|
/* and from the history */
|
2016-01-01 00:05:35 +08:00
|
|
|
gimp_filter_history_remove (manager->gimp, GIMP_PROCEDURE (tmp_proc));
|
2006-08-09 00:34:22 +08:00
|
|
|
|
2006-04-10 04:35:15 +08:00
|
|
|
g_object_unref (tmp_proc);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
manager->plug_in_procedures = g_slist_prepend (manager->plug_in_procedures,
|
|
|
|
g_object_ref (procedure));
|
2006-04-10 04:35:15 +08:00
|
|
|
}
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
void
|
2006-04-29 06:26:51 +08:00
|
|
|
gimp_plug_in_manager_add_temp_proc (GimpPlugInManager *manager,
|
|
|
|
GimpTemporaryProcedure *procedure)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-29 06:26:51 +08:00
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
|
|
|
g_return_if_fail (GIMP_IS_TEMPORARY_PROCEDURE (procedure));
|
2001-01-14 23:18:37 +08:00
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
gimp_pdb_register_procedure (manager->gimp->pdb, GIMP_PROCEDURE (procedure));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
manager->plug_in_procedures = g_slist_prepend (manager->plug_in_procedures,
|
|
|
|
g_object_ref (procedure));
|
2003-01-18 02:07:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-04-29 06:26:51 +08:00
|
|
|
gimp_plug_in_manager_remove_temp_proc (GimpPlugInManager *manager,
|
|
|
|
GimpTemporaryProcedure *procedure)
|
2003-01-18 02:07:37 +08:00
|
|
|
{
|
2006-04-29 06:26:51 +08:00
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
|
|
|
g_return_if_fail (GIMP_IS_TEMPORARY_PROCEDURE (procedure));
|
|
|
|
|
|
|
|
manager->plug_in_procedures = g_slist_remove (manager->plug_in_procedures,
|
|
|
|
procedure);
|
|
|
|
|
2015-12-30 18:53:52 +08:00
|
|
|
gimp_filter_history_remove (manager->gimp,
|
2016-01-01 00:05:35 +08:00
|
|
|
GIMP_PROCEDURE (procedure));
|
2006-08-09 00:34:22 +08:00
|
|
|
|
2006-08-08 23:36:16 +08:00
|
|
|
gimp_pdb_unregister_procedure (manager->gimp->pdb,
|
|
|
|
GIMP_PROCEDURE (procedure));
|
2006-04-29 06:26:51 +08:00
|
|
|
|
|
|
|
g_object_unref (procedure);
|
|
|
|
}
|
|
|
|
|
2006-05-05 06:51:21 +08:00
|
|
|
void
|
|
|
|
gimp_plug_in_manager_add_open_plug_in (GimpPlugInManager *manager,
|
|
|
|
GimpPlugIn *plug_in)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN (plug_in));
|
|
|
|
|
|
|
|
manager->open_plug_ins = g_slist_prepend (manager->open_plug_ins,
|
|
|
|
g_object_ref (plug_in));
|
|
|
|
|
|
|
|
g_signal_emit (manager, manager_signals[PLUG_IN_OPENED], 0,
|
|
|
|
plug_in);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_plug_in_manager_remove_open_plug_in (GimpPlugInManager *manager,
|
|
|
|
GimpPlugIn *plug_in)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN (plug_in));
|
|
|
|
|
|
|
|
manager->open_plug_ins = g_slist_remove (manager->open_plug_ins, plug_in);
|
|
|
|
|
|
|
|
g_signal_emit (manager, manager_signals[PLUG_IN_CLOSED], 0,
|
|
|
|
plug_in);
|
|
|
|
|
|
|
|
g_object_unref (plug_in);
|
|
|
|
}
|
|
|
|
|
2006-04-30 03:03:44 +08:00
|
|
|
void
|
|
|
|
gimp_plug_in_manager_plug_in_push (GimpPlugInManager *manager,
|
2006-05-04 02:05:06 +08:00
|
|
|
GimpPlugIn *plug_in)
|
2006-04-30 03:03:44 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
2006-05-04 02:05:06 +08:00
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN (plug_in));
|
2006-04-30 03:03:44 +08:00
|
|
|
|
|
|
|
manager->current_plug_in = plug_in;
|
|
|
|
|
|
|
|
manager->plug_in_stack = g_slist_prepend (manager->plug_in_stack,
|
|
|
|
manager->current_plug_in);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_plug_in_manager_plug_in_pop (GimpPlugInManager *manager)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
|
|
|
|
|
|
|
if (manager->current_plug_in)
|
|
|
|
manager->plug_in_stack = g_slist_remove (manager->plug_in_stack,
|
|
|
|
manager->plug_in_stack->data);
|
|
|
|
|
|
|
|
if (manager->plug_in_stack)
|
|
|
|
manager->current_plug_in = manager->plug_in_stack->data;
|
|
|
|
else
|
|
|
|
manager->current_plug_in = NULL;
|
|
|
|
}
|