app/plug-in/Makefile.am app/plug-in/plug-in-types.h new object which keeps

2006-04-29  Michael Natterer  <mitch@gimp.org>

	* app/plug-in/Makefile.am
	* app/plug-in/plug-in-types.h
	* app/plug-in/gimppluginmanager.[ch]: new object which keeps all
	plug-in related stuff that was kept in the Gimp instance. Has
	"menu-branch-added" and "last-plug-in-changed" signals.

	* app/plug-in/plug-ins.[ch]: removed, all its functions are in
	GimpPlugInManager now.

	* app/core/gimpmarshal.list: new marshaller for the new object.

	* app/core/gimp.[ch]: removed all plug-in related stuff and keep a
	GimpPlugInManager around.

	* app/plug-in/plug-in-data.[ch]
	* app/plug-in/plug-in-file.[ch]
	* app/plug-in/plug-in-help-domain.[ch]
	* app/plug-in/plug-in-locale-domain.[ch]
	* app/plug-in/plug-in-menu-branch.[ch]
	* app/plug-in/plug-ins-query.[ch]: removed...

	* app/plug-in/gimppluginmanager-data.[ch]
	* app/plug-in/gimppluginmanager-file.[ch]
	* app/plug-in/gimppluginmanager-help-domain.[ch]
	* app/plug-in/gimppluginmanager-locale-domain.[ch]
	* app/plug-in/gimppluginmanager-menu-branch.[ch]
	* app/plug-in/gimppluginmanager-query.[ch]: ...and added as
	methods of GimpPlugInManager.

	* app/plug-in/plug-in-debug.[ch]
	* app/plug-in/plug-in-shm.[ch]: removed...

	* app/plug-in/gimpplugindebug.[ch]
	* app/plug-in/gimppluginshm.[ch]: ...and added as properly
	namespeced structs with constructors and destructors.

	* app/core/Makefile.am
	* app/core/gimpenvirontable.[ch]
	* app/core/gimpinterpreterdb.[ch]: removed...

	* app/plug-in/gimpenvirontable.[ch]
	* app/plug-in/gimpinterpreterdb.[ch]: ...and added here unchanged.

	* app/core/gimp-gui.[ch]
	* app/gui/gui-vtable.c: remove gimp_menus_create_branch() and all
	related stuff.

	* app/actions/plug-in-actions.[ch]: connect to the
	plug-in-manager's "menu-path-added" signal and create menu branch
	actions accordingly.

	* app/plug-in/plug-in-context.c
	* app/plug-in/plug-in-message.c
	* app/plug-in/plug-in-progress.c
	* app/plug-in/plug-in-run.[ch]
	* app/plug-in/plug-in.[ch]
	* app/app_procs.c
	* app/actions/file-commands.c
	* app/actions/plug-in-commands.c
	* app/core/gimpimage.c
	* app/dialogs/file-open-location-dialog.c
	* app/dialogs/file-save-dialog.c
	* app/file/file-open.c
	* app/gui/gui.c
	* app/menus/plug-in-menus.c
	* app/pdb/gimppluginprocedure.c
	* app/pdb/gimptemporaryprocedure.c
	* app/widgets/gimpdnd-xds.c
	* app/widgets/gimpfiledialog.c
	* app/widgets/gimpfileprocview.c
	* app/widgets/gimphelp.c
	* app/widgets/gimpthumbbox.c
	* app/xcf/xcf.c
	* tools/pdbgen/pdb/context.pdb
	* tools/pdbgen/pdb/drawable.pdb
	* tools/pdbgen/pdb/fileops.pdb
	* tools/pdbgen/pdb/help.pdb
	* tools/pdbgen/pdb/message.pdb
	* tools/pdbgen/pdb/plug_in.pdb
	* tools/pdbgen/pdb/procedural_db.pdb
	* tools/pdbgen/pdb/progress.pdb
	* tools/pdbgen/pdb/undo.pdb: follow above refactoring.

	* app/pdb/context_cmds.c
	* app/pdb/drawable_cmds.c
	* app/pdb/fileops_cmds.c
	* app/pdb/help_cmds.c
	* app/pdb/message_cmds.c
	* app/pdb/plug_in_cmds.c
	* app/pdb/procedural_db_cmds.c
	* app/pdb/progress_cmds.c
	* app/pdb/undo_cmds.c: regenerated.
This commit is contained in:
Michael Natterer 2006-04-28 22:26:51 +00:00 committed by Michael Natterer
parent f32828081a
commit f1c3e79a4b
107 changed files with 1706 additions and 5038 deletions

View File

@ -1,3 +1,98 @@
2006-04-29 Michael Natterer <mitch@gimp.org>
* app/plug-in/Makefile.am
* app/plug-in/plug-in-types.h
* app/plug-in/gimppluginmanager.[ch]: new object which keeps all
plug-in related stuff that was kept in the Gimp instance. Has
"menu-branch-added" and "last-plug-in-changed" signals.
* app/plug-in/plug-ins.[ch]: removed, all its functions are in
GimpPlugInManager now.
* app/core/gimpmarshal.list: new marshaller for the new object.
* app/core/gimp.[ch]: removed all plug-in related stuff and keep a
GimpPlugInManager around.
* app/plug-in/plug-in-data.[ch]
* app/plug-in/plug-in-file.[ch]
* app/plug-in/plug-in-help-domain.[ch]
* app/plug-in/plug-in-locale-domain.[ch]
* app/plug-in/plug-in-menu-branch.[ch]
* app/plug-in/plug-ins-query.[ch]: removed...
* app/plug-in/gimppluginmanager-data.[ch]
* app/plug-in/gimppluginmanager-file.[ch]
* app/plug-in/gimppluginmanager-help-domain.[ch]
* app/plug-in/gimppluginmanager-locale-domain.[ch]
* app/plug-in/gimppluginmanager-menu-branch.[ch]
* app/plug-in/gimppluginmanager-query.[ch]: ...and added as
methods of GimpPlugInManager.
* app/plug-in/plug-in-debug.[ch]
* app/plug-in/plug-in-shm.[ch]: removed...
* app/plug-in/gimpplugindebug.[ch]
* app/plug-in/gimppluginshm.[ch]: ...and added as properly
namespeced structs with constructors and destructors.
* app/core/Makefile.am
* app/core/gimpenvirontable.[ch]
* app/core/gimpinterpreterdb.[ch]: removed...
* app/plug-in/gimpenvirontable.[ch]
* app/plug-in/gimpinterpreterdb.[ch]: ...and added here unchanged.
* app/core/gimp-gui.[ch]
* app/gui/gui-vtable.c: remove gimp_menus_create_branch() and all
related stuff.
* app/actions/plug-in-actions.[ch]: connect to the
plug-in-manager's "menu-path-added" signal and create menu branch
actions accordingly.
* app/plug-in/plug-in-context.c
* app/plug-in/plug-in-message.c
* app/plug-in/plug-in-progress.c
* app/plug-in/plug-in-run.[ch]
* app/plug-in/plug-in.[ch]
* app/app_procs.c
* app/actions/file-commands.c
* app/actions/plug-in-commands.c
* app/core/gimpimage.c
* app/dialogs/file-open-location-dialog.c
* app/dialogs/file-save-dialog.c
* app/file/file-open.c
* app/gui/gui.c
* app/menus/plug-in-menus.c
* app/pdb/gimppluginprocedure.c
* app/pdb/gimptemporaryprocedure.c
* app/widgets/gimpdnd-xds.c
* app/widgets/gimpfiledialog.c
* app/widgets/gimpfileprocview.c
* app/widgets/gimphelp.c
* app/widgets/gimpthumbbox.c
* app/xcf/xcf.c
* tools/pdbgen/pdb/context.pdb
* tools/pdbgen/pdb/drawable.pdb
* tools/pdbgen/pdb/fileops.pdb
* tools/pdbgen/pdb/help.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/plug_in.pdb
* tools/pdbgen/pdb/procedural_db.pdb
* tools/pdbgen/pdb/progress.pdb
* tools/pdbgen/pdb/undo.pdb: follow above refactoring.
* app/pdb/context_cmds.c
* app/pdb/drawable_cmds.c
* app/pdb/fileops_cmds.c
* app/pdb/help_cmds.c
* app/pdb/message_cmds.c
* app/pdb/plug_in_cmds.c
* app/pdb/procedural_db_cmds.c
* app/pdb/progress_cmds.c
* app/pdb/undo_cmds.c: regenerated.
2006-04-28 Sven Neumann <sven@gimp.org>
* app/dialogs/user-install-dialog.c: code and user interface cleanup.

View File

@ -34,6 +34,8 @@
#include "core/gimpprogress.h"
#include "core/gimptemplate.h"
#include "plug-in/gimppluginmanager.h"
#include "file/file-open.h"
#include "file/file-save.h"
#include "file/file-utils.h"
@ -204,7 +206,8 @@ file_save_cmd_callback (GtkAction *action,
save_proc = gimp_image_get_save_proc (image);
if (uri && ! save_proc)
save_proc = file_utils_find_proc (image->gimp->save_procs, uri);
save_proc = file_utils_find_proc (image->gimp->plug_in_manager->save_procs,
uri);
if (! (uri && save_proc))
{

View File

@ -35,9 +35,10 @@
#include "pdb/gimppluginprocedure.h"
#include "plug-in/plug-in-help-domain.h"
#include "plug-in/plug-in-locale-domain.h"
#include "plug-in/plug-in-menu-branch.h"
#include "plug-in/gimppluginmanager.h"
#include "plug-in/gimppluginmanager-help-domain.h"
#include "plug-in/gimppluginmanager-locale-domain.h"
#include "plug-in/gimppluginmanager-menu-branch.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimphelp-ids.h"
@ -51,6 +52,11 @@
/* local function prototypes */
static void plug_in_actions_menu_branch_added (GimpPlugInManager *manager,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label,
GimpActionGroup *group);
static void plug_in_actions_register_procedure (GimpPDB *pdb,
GimpProcedure *procedure,
GimpActionGroup *group);
@ -63,7 +69,7 @@ static void plug_in_actions_menu_path_added (GimpPlugInProcedure *proc,
static void plug_in_actions_add_proc (GimpActionGroup *group,
GimpPlugInProcedure *proc);
static void plug_in_actions_last_changed (Gimp *gimp,
static void plug_in_actions_last_changed (GimpPlugInManager *manager,
GimpActionGroup *group);
static gboolean plug_in_actions_check_translation (const gchar *original,
const gchar *translated);
@ -137,19 +143,25 @@ plug_in_actions_setup (GimpActionGroup *group)
G_N_ELEMENTS (plug_in_repeat_actions),
G_CALLBACK (plug_in_repeat_cmd_callback));
for (list = group->gimp->plug_in_menu_branches;
for (list = group->gimp->plug_in_manager->menu_branches;
list;
list = g_slist_next (list))
{
PlugInMenuBranch *branch = list->data;
GimpPlugInMenuBranch *branch = list->data;
plug_in_actions_add_branch (group,
branch->prog_name,
branch->menu_path,
branch->menu_label);
plug_in_actions_menu_branch_added (group->gimp->plug_in_manager,
branch->prog_name,
branch->menu_path,
branch->menu_label,
group);
}
for (list = group->gimp->plug_in_procedures;
g_signal_connect_object (group->gimp->plug_in_manager,
"menu-branch-added",
G_CALLBACK (plug_in_actions_menu_branch_added),
group, 0);
for (list = group->gimp->plug_in_manager->plug_in_procedures;
list;
list = g_slist_next (list))
{
@ -209,21 +221,25 @@ plug_in_actions_setup (GimpActionGroup *group)
g_free (entries);
g_signal_connect_object (group->gimp, "last-plug-ins-changed",
g_signal_connect_object (group->gimp->plug_in_manager,
"last-plug-ins-changed",
G_CALLBACK (plug_in_actions_last_changed),
group, 0);
plug_in_actions_last_changed (group->gimp, group);
plug_in_actions_last_changed (group->gimp->plug_in_manager, group);
}
void
plug_in_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *image = action_data_get_image (data);
GimpImageType type = -1;
GSList *list;
gint i;
GimpImage *image = action_data_get_image (data);
GimpPlugInManager *manager;
GimpImageType type = -1;
GSList *list;
gint i;
manager = group->gimp->plug_in_manager;
if (image)
{
@ -233,9 +249,7 @@ plug_in_actions_update (GimpActionGroup *group,
type = gimp_drawable_type (drawable);
}
for (list = group->gimp->plug_in_procedures;
list;
list = g_slist_next (list))
for (list = manager->plug_in_procedures; list; list = g_slist_next (list))
{
GimpPlugInProcedure *proc = list->data;
@ -254,8 +268,8 @@ plug_in_actions_update (GimpActionGroup *group,
}
}
if (group->gimp->last_plug_ins &&
gimp_plug_in_procedure_get_sensitive (group->gimp->last_plug_ins->data,
if (manager->last_plug_ins &&
gimp_plug_in_procedure_get_sensitive (manager->last_plug_ins->data,
type))
{
gimp_action_group_set_action_sensitive (group, "plug-in-repeat", TRUE);
@ -267,7 +281,7 @@ plug_in_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_sensitive (group, "plug-in-reshow", FALSE);
}
for (list = group->gimp->last_plug_ins, i = 0; list; list = list->next, i++)
for (list = manager->last_plug_ins, i = 0; list; list = list->next, i++)
{
GimpPlugInProcedure *proc = list->data;
gchar *name = g_strdup_printf ("plug-in-recent-%02d",
@ -282,11 +296,15 @@ plug_in_actions_update (GimpActionGroup *group,
}
}
void
plug_in_actions_add_branch (GimpActionGroup *group,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label)
/* private functions */
static void
plug_in_actions_menu_branch_added (GimpPlugInManager *manager,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label,
GimpActionGroup *group)
{
const gchar *locale_domain;
const gchar *path_translated;
@ -294,11 +312,9 @@ plug_in_actions_add_branch (GimpActionGroup *group,
gchar *full;
gchar *full_translated;
g_return_if_fail (GIMP_IS_ACTION_GROUP (group));
g_return_if_fail (menu_path != NULL);
g_return_if_fail (menu_label != NULL);
locale_domain = plug_in_locale_domain (group->gimp, progname, NULL);
locale_domain =
gimp_plug_in_manager_get_locale_domain (group->gimp->plug_in_manager,
progname, NULL);
path_translated = dgettext (locale_domain, menu_path);
label_translated = dgettext (locale_domain, menu_label);
@ -315,9 +331,6 @@ plug_in_actions_add_branch (GimpActionGroup *group,
g_free (full);
}
/* private functions */
static void
plug_in_actions_register_procedure (GimpPDB *pdb,
GimpProcedure *procedure,
@ -390,7 +403,8 @@ plug_in_actions_menu_path_added (GimpPlugInProcedure *plug_in_proc,
progname = gimp_plug_in_procedure_get_progname (plug_in_proc);
locale_domain = plug_in_locale_domain (group->gimp, progname, NULL);
locale_domain = gimp_plug_in_manager_get_locale_domain (group->gimp->plug_in_manager,
progname, NULL);
path_translated = dgettext (locale_domain, menu_path);
@ -413,13 +427,12 @@ plug_in_actions_add_proc (GimpActionGroup *group,
gchar *path_original = NULL;
gchar *path_translated = NULL;
g_return_if_fail (GIMP_IS_ACTION_GROUP (group));
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc));
progname = gimp_plug_in_procedure_get_progname (proc);
locale_domain = plug_in_locale_domain (group->gimp, progname, NULL);
help_domain = plug_in_help_domain (group->gimp, progname, NULL);
locale_domain = gimp_plug_in_manager_get_locale_domain (group->gimp->plug_in_manager,
progname, NULL);
help_domain = gimp_plug_in_manager_get_help_domain (group->gimp->plug_in_manager,
progname, NULL);
if (proc->menu_label)
{
@ -494,23 +507,24 @@ plug_in_actions_add_proc (GimpActionGroup *group,
}
static void
plug_in_actions_last_changed (Gimp *gimp,
GimpActionGroup *group)
plug_in_actions_last_changed (GimpPlugInManager *manager,
GimpActionGroup *group)
{
GSList *list;
const gchar *progname;
const gchar *domain;
gint i;
if (gimp->last_plug_ins)
if (manager->last_plug_ins)
{
GimpPlugInProcedure *proc = gimp->last_plug_ins->data;
GimpPlugInProcedure *proc = manager->last_plug_ins->data;
gchar *label;
gchar *repeat;
gchar *reshow;
progname = gimp_plug_in_procedure_get_progname (proc);
domain = plug_in_locale_domain (gimp, progname, NULL);
domain = gimp_plug_in_manager_get_locale_domain (manager,
progname, NULL);
label = gimp_plug_in_procedure_get_label (proc, domain);
@ -533,7 +547,7 @@ plug_in_actions_last_changed (Gimp *gimp,
_("Re-Show Last"));
}
for (list = gimp->last_plug_ins, i = 0; list; list = list->next, i++)
for (list = manager->last_plug_ins, i = 0; list; list = list->next, i++)
{
GtkAction *action;
GimpPlugInProcedure *proc = list->data;
@ -545,7 +559,8 @@ plug_in_actions_last_changed (Gimp *gimp,
g_free (name);
progname = gimp_plug_in_procedure_get_progname (proc);
domain = plug_in_locale_domain (gimp, progname, NULL);
domain = gimp_plug_in_manager_get_locale_domain (manager,
progname, NULL);
label = gimp_plug_in_procedure_get_label (proc, domain);
@ -558,7 +573,7 @@ plug_in_actions_last_changed (Gimp *gimp,
g_free (label);
}
for (; i < gimp->config->plug_in_history_size; i++)
for (; i < manager->gimp->config->plug_in_history_size; i++)
{
GtkAction *action;
gchar *name = g_strdup_printf ("plug-in-recent-%02d", i + 1);
@ -572,7 +587,7 @@ plug_in_actions_last_changed (Gimp *gimp,
}
/* update sensitivity of the actions */
plug_in_actions_update (group, gimp);
plug_in_actions_update (group, manager->gimp);
}
static gboolean

View File

@ -20,14 +20,9 @@
#define __PLUG_IN_ACTIONS_H__
void plug_in_actions_setup (GimpActionGroup *group);
void plug_in_actions_update (GimpActionGroup *group,
gpointer data);
void plug_in_actions_add_branch (GimpActionGroup *group,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label);
void plug_in_actions_setup (GimpActionGroup *group);
void plug_in_actions_update (GimpActionGroup *group,
gpointer data);
#endif /* __PLUG_IN_ACTIONS_H__ */

View File

@ -34,7 +34,8 @@
#include "core/gimpparamspecs.h"
#include "core/gimpprogress.h"
#include "plug-in/plug-in-data.h"
#include "plug-in/gimppluginmanager.h"
#include "plug-in/gimppluginmanager-data.h"
#include "pdb/gimpprocedure.h"
@ -134,7 +135,7 @@ plug_in_run_cmd_callback (GtkAction *action,
GIMP_IS_PARAM_SPEC_IMAGE_ID (procedure->args[1]) &&
GIMP_IS_PARAM_SPEC_DRAWABLE_ID (procedure->args[2]))
{
gimp_set_last_plug_in (gimp, proc);
gimp_plug_in_manager_set_last_plug_in (gimp->plug_in_manager, proc);
}
error:
@ -161,7 +162,7 @@ plug_in_repeat_cmd_callback (GtkAction *action,
if (strcmp (gtk_action_get_name (action), "plug-in-repeat") == 0)
interactive = FALSE;
procedure = g_slist_nth_data (gimp->last_plug_ins, value);
procedure = g_slist_nth_data (gimp->plug_in_manager->last_plug_ins, value);
if (procedure)
{
@ -229,5 +230,5 @@ plug_in_reset_all_response (GtkWidget *dialog,
gtk_widget_destroy (dialog);
if (response_id == GTK_RESPONSE_OK)
plug_in_data_free (gimp);
gimp_plug_in_manager_data_free (gimp->plug_in_manager);
}

View File

@ -42,6 +42,8 @@
#include "core/gimp.h"
#include "plug-in/gimppluginmanager.h"
#include "file/file-open.h"
#include "file/file-utils.h"
@ -306,7 +308,7 @@ app_run (const gchar *full_prog_name,
}
else
{
uri = file_utils_filename_to_uri (gimp->load_procs,
uri = file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
filenames[i], &error);
}

View File

@ -107,8 +107,6 @@ libappcore_a_sources = \
gimpdrawable-stroke.h \
gimpdrawable-transform.c \
gimpdrawable-transform.h \
gimpenvirontable.h \
gimpenvirontable.c \
gimpgradient.c \
gimpgradient.h \
gimpgradient-load.c \
@ -167,8 +165,6 @@ libappcore_a_sources = \
gimpimagefile.h \
gimpimagemap.c \
gimpimagemap.h \
gimpinterpreterdb.c \
gimpinterpreterdb.h \
gimpitem.c \
gimpitem.h \
gimpitem-align.c \

View File

@ -56,7 +56,6 @@ gimp_gui_init (Gimp *gimp)
gimp->gui.display_create = NULL;
gimp->gui.display_delete = NULL;
gimp->gui.displays_reconnect = NULL;
gimp->gui.menus_create_branch = NULL;
gimp->gui.progress_new = NULL;
gimp->gui.progress_free = NULL;
gimp->gui.pdb_dialog_set = NULL;
@ -293,20 +292,6 @@ gimp_reconnect_displays (Gimp *gimp,
gimp->gui.displays_reconnect (gimp, old_image, new_image);
}
void
gimp_menus_create_branch (Gimp *gimp,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (menu_path != NULL);
g_return_if_fail (menu_label != NULL);
if (gimp->gui.menus_create_branch)
gimp->gui.menus_create_branch (gimp, progname, menu_path, menu_label);
}
GimpProgress *
gimp_new_progress (Gimp *gimp,
GimpObject *display)

View File

@ -55,11 +55,6 @@ struct _GimpGui
GimpImage *old_image,
GimpImage *new_image);
void (* menus_create_branch) (Gimp *gimp,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label);
GimpProgress * (* progress_new) (Gimp *gimp,
GimpObject *display);
void (* progress_free) (Gimp *gimp,
@ -116,11 +111,6 @@ void gimp_help (Gimp *gimp,
const gchar *help_domain,
const gchar *help_id);
void gimp_menus_create_branch (Gimp *gimp,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label);
GimpProgress * gimp_new_progress (Gimp *gimp,
GimpObject *display);
void gimp_free_progress (Gimp *gimp,

View File

@ -31,7 +31,7 @@
#include "pdb/gimp-pdb.h"
#include "plug-in/plug-ins.h"
#include "plug-in/gimppluginmanager.h"
#include "paint/gimp-paint.h"
@ -56,12 +56,10 @@
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdocumentlist.h"
#include "gimpenvirontable.h"
#include "gimpgradient.h"
#include "gimpgradient-load.h"
#include "gimpimage.h"
#include "gimpimagefile.h"
#include "gimpinterpreterdb.h"
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimppalette.h"
@ -79,7 +77,6 @@ enum
RESTORE,
EXIT,
BUFFER_CHANGED,
LAST_PLUG_INS_CHANGED,
LAST_SIGNAL
};
@ -157,15 +154,6 @@ gimp_class_init (GimpClass *klass)
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gimp_signals[LAST_PLUG_INS_CHANGED] =
g_signal_new ("last-plug-ins-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GimpClass, last_plug_ins_changed),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->dispose = gimp_dispose;
object_class->finalize = gimp_finalize;
@ -202,11 +190,7 @@ gimp_init (Gimp *gimp)
gimp_modules_init (gimp);
gimp->interpreter_db = gimp_interpreter_db_new ();
gimp->environ_table = gimp_environ_table_new ();
gimp->plug_in_debug = NULL;
gimp->plug_in_data_list = NULL;
gimp->plug_in_manager = gimp_plug_in_manager_new (gimp);
gimp->images = gimp_list_new_weak (GIMP_TYPE_IMAGE, FALSE);
gimp_object_set_static_name (GIMP_OBJECT (gimp->images), "images");
@ -237,9 +221,6 @@ gimp_init (Gimp *gimp)
gimp_pdb_initialize (gimp);
gimp->load_procs = NULL;
gimp->save_procs = NULL;
xcf_init (gimp);
gimp->tool_info_list = gimp_list_new (GIMP_TYPE_TOOL_INFO, FALSE);
@ -293,12 +274,6 @@ gimp_finalize (GObject *object)
gimp_contexts_exit (gimp);
if (gimp->last_plug_ins)
{
g_slist_free (gimp->last_plug_ins);
gimp->last_plug_ins = NULL;
}
if (gimp->image_new_last_template)
{
g_object_unref (gimp->image_new_last_template);
@ -329,18 +304,6 @@ gimp_finalize (GObject *object)
gimp_pdb_exit (gimp);
if (gimp->load_procs)
{
g_slist_free (gimp->load_procs);
gimp->load_procs = NULL;
}
if (gimp->save_procs)
{
g_slist_free (gimp->save_procs);
gimp->save_procs = NULL;
}
if (gimp->brush_factory)
{
g_object_unref (gimp->brush_factory);
@ -407,16 +370,10 @@ gimp_finalize (GObject *object)
gimp->images = NULL;
}
if (gimp->environ_table)
if (gimp->plug_in_manager)
{
g_object_unref (gimp->environ_table);
gimp->environ_table = NULL;
}
if (gimp->interpreter_db)
{
g_object_unref (gimp->interpreter_db);
gimp->interpreter_db = NULL;
g_object_unref (gimp->plug_in_manager);
gimp->plug_in_manager = NULL;
}
if (gimp->module_db)
@ -463,19 +420,7 @@ gimp_get_memsize (GimpObject *object,
gui_size);
memsize += gimp_g_object_get_memsize (G_OBJECT (gimp->module_db));
memsize += gimp_g_slist_get_memsize (gimp->plug_in_menu_branches,
0 /* FIXME */);
memsize += gimp_g_slist_get_memsize (gimp->plug_in_locale_domains,
0 /* FIXME */);
memsize += gimp_g_slist_get_memsize (gimp->plug_in_help_domains,
0 /* FIXME */);
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->interpreter_db),
gui_size);
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->environ_table),
gui_size);
memsize += gimp_g_list_get_memsize (gimp->plug_in_data_list,
0 /* FIXME */);
memsize += gimp_g_object_get_memsize (G_OBJECT (gimp->plug_in_manager));
memsize += gimp_g_hash_table_get_memsize (gimp->image_table);
memsize += gimp_g_hash_table_get_memsize (gimp->item_table);
@ -501,9 +446,6 @@ gimp_get_memsize (GimpObject *object,
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->pdb), gui_size);
memsize += gimp_g_slist_get_memsize (gimp->load_procs, 0 /* FIXME */);
memsize += gimp_g_slist_get_memsize (gimp->save_procs, 0 /* FIXME */);
memsize += (gimp_object_get_memsize (GIMP_OBJECT (gimp->tool_info_list),
gui_size) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->standard_tool_info),
@ -530,8 +472,6 @@ static void
gimp_real_initialize (Gimp *gimp,
GimpInitStatusFunc status_callback)
{
gchar *path;
static const GimpDataFactoryLoaderEntry brush_loader_entries[] =
{
{ gimp_brush_load, GIMP_BRUSH_FILE_EXTENSION, FALSE },
@ -628,17 +568,7 @@ gimp_real_initialize (Gimp *gimp,
status_callback (NULL,_("Internal Procedures"), 0.2);
gimp_pdb_init_procs (gimp);
status_callback (NULL, _("Plug-In Interpreters"), 0.8);
path = gimp_config_path_expand (gimp->config->interpreter_path, TRUE, NULL);
gimp_interpreter_db_load (gimp->interpreter_db, path);
g_free (path);
status_callback (NULL, _("Plug-In Environment"), 0.9);
path = gimp_config_path_expand (gimp->config->environ_path, TRUE, NULL);
gimp_environ_table_load (gimp->environ_table, path);
g_free (path);
gimp_plug_in_manager_initialize (gimp->plug_in_manager, status_callback);
status_callback (NULL, "", 1.0);
}
@ -650,7 +580,10 @@ gimp_real_restore (Gimp *gimp,
if (gimp->be_verbose)
g_print ("INIT: gimp_real_restore\n");
plug_ins_init (gimp, gimp_get_user_context (gimp), status_callback);
gimp_plug_in_manager_restore (gimp->plug_in_manager,
gimp_get_user_context (gimp), status_callback);
status_callback ("", "", 1.0);
}
static gboolean
@ -660,7 +593,7 @@ gimp_real_exit (Gimp *gimp,
if (gimp->be_verbose)
g_print ("EXIT: gimp_real_exit\n");
plug_ins_exit (gimp);
gimp_plug_in_manager_exit (gimp->plug_in_manager);
gimp_modules_unload (gimp);
gimp_data_factory_data_save (gimp->brush_factory);
@ -934,31 +867,6 @@ gimp_set_global_buffer (Gimp *gimp,
g_signal_emit (gimp, gimp_signals[BUFFER_CHANGED], 0);
}
void
gimp_set_last_plug_in (Gimp *gimp,
GimpPlugInProcedure *procedure)
{
GSList *list;
gint history_size;
g_return_if_fail (GIMP_IS_GIMP (gimp));
history_size = MAX (1, gimp->config->plug_in_history_size);
gimp->last_plug_ins = g_slist_remove (gimp->last_plug_ins, procedure);
gimp->last_plug_ins = g_slist_prepend (gimp->last_plug_ins, procedure);
list = g_slist_nth (gimp->last_plug_ins, history_size);
if (list)
{
gimp->last_plug_ins = g_slist_remove_link (gimp->last_plug_ins, list);
g_slist_free (list);
}
g_signal_emit (gimp, gimp_signals[LAST_PLUG_INS_CHANGED], 0);
}
GimpImage *
gimp_create_image (Gimp *gimp,
gint width,

View File

@ -69,24 +69,7 @@ struct _Gimp
GimpModuleDB *module_db;
gboolean write_modulerc;
GSList *plug_in_defs;
gboolean write_pluginrc;
GSList *plug_in_procedures;
GSList *plug_in_menu_branches;
GSList *plug_in_locale_domains;
GSList *plug_in_help_domains;
PlugIn *current_plug_in;
GSList *open_plug_ins;
GSList *plug_in_stack;
GSList *last_plug_ins;
PlugInShm *plug_in_shm;
GimpInterpreterDB *interpreter_db;
GimpEnvironTable *environ_table;
GimpPlugInDebug *plug_in_debug;
GList *plug_in_data_list;
GimpPlugInManager *plug_in_manager;
GimpContainer *images;
gint next_image_ID;
@ -112,9 +95,6 @@ struct _Gimp
GimpPDB *pdb;
GSList *load_procs;
GSList *save_procs;
GimpContainer *tool_info_list;
GimpToolInfo *standard_tool_info;
@ -139,15 +119,14 @@ struct _GimpClass
{
GimpObjectClass parent_class;
void (* initialize) (Gimp *gimp,
GimpInitStatusFunc status_callback);
void (* restore) (Gimp *gimp,
GimpInitStatusFunc status_callback);
gboolean (* exit) (Gimp *gimp,
gboolean force);
void (* initialize) (Gimp *gimp,
GimpInitStatusFunc status_callback);
void (* restore) (Gimp *gimp,
GimpInitStatusFunc status_callback);
gboolean (* exit) (Gimp *gimp,
gboolean force);
void (* buffer_changed) (Gimp *gimp);
void (* last_plug_ins_changed) (Gimp *gimp);
void (* buffer_changed) (Gimp *gimp);
};
@ -177,8 +156,6 @@ void gimp_exit (Gimp *gimp,
void gimp_set_global_buffer (Gimp *gimp,
GimpBuffer *buffer);
void gimp_set_last_plug_in (Gimp *gimp,
GimpPlugInProcedure *procedure);
GimpImage * gimp_create_image (Gimp *gimp,
gint width,

View File

@ -1,428 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpenvirontable.c
* (C) 2002 Manish Singh <yosh@gimp.org>
*
* 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 <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include <glib/gstdio.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpconfig/gimpconfig.h"
#include "core-types.h"
#include "gimpenvirontable.h"
#include "gimp-intl.h"
typedef struct _GimpEnvironValue GimpEnvironValue;
struct _GimpEnvironValue
{
gchar *value;
gchar *separator;
};
/* FIXME: check how portable this is */
extern char **environ;
static void gimp_environ_table_finalize (GObject *object);
static void gimp_environ_table_load_env_file (const GimpDatafileData *file_data,
gpointer user_data);
static gboolean gimp_environ_table_legal_name (gchar *name);
static void gimp_environ_table_populate (GimpEnvironTable *environ_table);
static void gimp_environ_table_populate_one (const gchar *name,
GimpEnvironValue *val,
GPtrArray *env_array);
static gboolean gimp_environ_table_pass_through (GimpEnvironTable *environ_table,
const gchar *name);
static void gimp_environ_table_clear_vars (GimpEnvironTable *environ_table);
static void gimp_environ_table_clear_internal (GimpEnvironTable *environ_table);
static void gimp_environ_table_clear_envp (GimpEnvironTable *environ_table);
static void gimp_environ_table_free_value (gpointer value);
G_DEFINE_TYPE (GimpEnvironTable, gimp_environ_table, G_TYPE_OBJECT);
#define parent_class gimp_environ_table_parent_class
static void
gimp_environ_table_class_init (GimpEnvironTableClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = gimp_environ_table_finalize;
}
static void
gimp_environ_table_init (GimpEnvironTable *environ_table)
{
environ_table->vars = NULL;
environ_table->internal = NULL;
environ_table->envp = NULL;
}
static void
gimp_environ_table_finalize (GObject *object)
{
GimpEnvironTable *environ_table = GIMP_ENVIRON_TABLE (object);
gimp_environ_table_clear_all (environ_table);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GimpEnvironTable *
gimp_environ_table_new (void)
{
return g_object_new (GIMP_TYPE_ENVIRON_TABLE, NULL);
}
void
gimp_environ_table_load (GimpEnvironTable *environ_table,
const gchar *env_path)
{
g_return_if_fail (GIMP_IS_ENVIRON_TABLE (environ_table));
gimp_environ_table_clear (environ_table);
environ_table->vars =
g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, gimp_environ_table_free_value);
gimp_datafiles_read_directories (env_path,
G_FILE_TEST_EXISTS,
gimp_environ_table_load_env_file,
environ_table);
}
void
gimp_environ_table_add (GimpEnvironTable *environ_table,
const gchar *name,
const gchar *value,
const gchar *separator)
{
GimpEnvironValue *val;
g_return_if_fail (GIMP_IS_ENVIRON_TABLE (environ_table));
gimp_environ_table_clear_envp (environ_table);
if (! environ_table->internal)
environ_table->internal =
g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, gimp_environ_table_free_value);
val = g_new (GimpEnvironValue, 1);
val->value = g_strdup (value);
val->separator = g_strdup (separator);
g_hash_table_insert (environ_table->internal, g_strdup (name), val);
}
void
gimp_environ_table_remove (GimpEnvironTable *environ_table,
const gchar *name)
{
g_return_if_fail (GIMP_IS_ENVIRON_TABLE (environ_table));
if (! environ_table->internal)
return;
gimp_environ_table_clear_envp (environ_table);
g_hash_table_remove (environ_table->internal, name);
if (g_hash_table_size (environ_table->internal) == 0)
gimp_environ_table_clear_internal (environ_table);
}
void
gimp_environ_table_clear (GimpEnvironTable *environ_table)
{
g_return_if_fail (GIMP_IS_ENVIRON_TABLE (environ_table));
gimp_environ_table_clear_envp (environ_table);
gimp_environ_table_clear_vars (environ_table);
}
void
gimp_environ_table_clear_all (GimpEnvironTable *environ_table)
{
g_return_if_fail (GIMP_IS_ENVIRON_TABLE (environ_table));
gimp_environ_table_clear_envp (environ_table);
gimp_environ_table_clear_vars (environ_table);
gimp_environ_table_clear_internal (environ_table);
}
gchar **
gimp_environ_table_get_envp (GimpEnvironTable *environ_table)
{
g_return_val_if_fail (GIMP_IS_ENVIRON_TABLE (environ_table), NULL);
/* Hmm.. should we return a copy here in the future? Not thread safe atm,
* but the rest of it isn't either.
*/
if (! environ_table->envp)
gimp_environ_table_populate (environ_table);
return environ_table->envp;
}
/* private */
static void
gimp_environ_table_load_env_file (const GimpDatafileData *file_data,
gpointer user_data)
{
GimpEnvironTable *environ_table = GIMP_ENVIRON_TABLE (user_data);
FILE *env;
gchar buffer[4096];
gsize len;
gchar *name, *value, *separator, *p, *q;
GimpEnvironValue *val;
env = g_fopen (file_data->filename, "r");
if (! env)
return;
while (fgets (buffer, sizeof (buffer), env))
{
/* Skip comments */
if (buffer[0] == '#')
continue;
len = strlen (buffer) - 1;
/* Skip too long lines */
if (buffer[len] != '\n')
continue;
buffer[len] = '\0';
p = strchr (buffer, '=');
if (! p)
continue;
*p = '\0';
name = buffer;
value = p + 1;
if (name[0] == '\0')
{
g_message (_("Empty variable name in environment file %s"),
gimp_filename_to_utf8 (file_data->filename));
continue;
}
separator = NULL;
q = strchr (name, ' ');
if (q)
{
*q = '\0';
separator = name;
name = q + 1;
}
if (! gimp_environ_table_legal_name (name))
{
g_message (_("Illegal variable name in environment file %s: %s"),
gimp_filename_to_utf8 (file_data->filename), name);
continue;
}
if (! g_hash_table_lookup (environ_table->vars, name))
{
val = g_new (GimpEnvironValue, 1);
val->value = gimp_config_path_expand (value, FALSE, NULL);
val->separator = g_strdup (separator);
g_hash_table_insert (environ_table->vars, g_strdup (name), val);
}
}
fclose (env);
}
static gboolean
gimp_environ_table_legal_name (gchar *name)
{
gchar *s;
if (! g_ascii_isalpha (*name) && (*name != '_'))
return FALSE;
for (s = name + 1; *s; s++)
if (! g_ascii_isalnum (*s) && (*s != '_'))
return FALSE;
return TRUE;
}
static void
gimp_environ_table_populate (GimpEnvironTable *environ_table)
{
gchar **var = environ;
gchar *name, *p;
GPtrArray *env_array;
env_array = g_ptr_array_new ();
while (*var)
{
p = strchr (*var, '=');
/* shouldn't happen... but just to be safe... */
if (p)
{
name = g_strndup (*var, p - *var);
if (gimp_environ_table_pass_through (environ_table, name))
g_ptr_array_add (env_array, g_strdup (*var));
g_free (name);
}
var++;
}
if (environ_table->vars)
g_hash_table_foreach (environ_table->vars,
(GHFunc) gimp_environ_table_populate_one,
env_array);
if (environ_table->internal)
g_hash_table_foreach (environ_table->internal,
(GHFunc) gimp_environ_table_populate_one,
env_array);
g_ptr_array_add (env_array, NULL);
environ_table->envp = (gchar **) g_ptr_array_free (env_array, FALSE);
#ifdef ENVP_DEBUG
var = environ_table->envp;
g_print ("GimpEnvironTable:\n");
while (*var)
{
g_print ("%s\n", *var);
var++;
}
#endif /* ENVP_DEBUG */
}
static void
gimp_environ_table_populate_one (const gchar *name,
GimpEnvironValue *val,
GPtrArray *env_array)
{
gchar *old, *var = NULL;
if (val->separator)
{
old = getenv (name);
if (old)
var = g_strconcat (name, "=", val->value, val->separator, old, NULL);
}
if (! var)
var = g_strconcat (name, "=", val->value, NULL);
g_ptr_array_add (env_array, var);
}
static gboolean
gimp_environ_table_pass_through (GimpEnvironTable *environ_table,
const gchar *name)
{
gboolean vars, internal;
vars = environ_table->vars &&
g_hash_table_lookup (environ_table->vars, name);
internal = environ_table->internal &&
g_hash_table_lookup (environ_table->internal, name);
return (!vars && !internal);
}
static void
gimp_environ_table_clear_vars (GimpEnvironTable *environ_table)
{
if (environ_table->vars)
{
g_hash_table_destroy (environ_table->vars);
environ_table->vars = NULL;
}
}
static void
gimp_environ_table_clear_internal (GimpEnvironTable *environ_table)
{
if (environ_table->internal)
{
g_hash_table_destroy (environ_table->internal);
environ_table->internal = NULL;
}
}
static void
gimp_environ_table_clear_envp (GimpEnvironTable *environ_table)
{
if (environ_table->envp)
{
g_strfreev (environ_table->envp);
environ_table->envp = NULL;
}
}
static void
gimp_environ_table_free_value (gpointer value)
{
GimpEnvironValue *val = value;
g_free (val->value);
g_free (val->separator);
g_free (val);
}

View File

@ -1,71 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpenvirontable.h
* (C) 2002 Manish Singh <yosh@gimp.org>
*
* 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.
*/
#ifndef __GIMP_ENVIRON_TABLE_H__
#define __GIMP_ENVIRON_TABLE_H__
#define GIMP_TYPE_ENVIRON_TABLE (gimp_environ_table_get_type ())
#define GIMP_ENVIRON_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ENVIRON_TABLE, GimpEnvironTable))
#define GIMP_ENVIRON_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ENVIRON_TABLE, GimpEnvironTableClass))
#define GIMP_IS_ENVIRON_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ENVIRON_TABLE))
#define GIMP_IS_ENVIRON_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ENVIRON_TABLE))
#define GIMP_ENVIRON_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ENVIRON_TABLE, GimpEnvironTableClass))
typedef struct _GimpEnvironTableClass GimpEnvironTableClass;
struct _GimpEnvironTable
{
GObject parent_instance;
GHashTable *vars;
GHashTable *internal;
gchar **envp;
};
struct _GimpEnvironTableClass
{
GObjectClass parent_class;
};
GType gimp_environ_table_get_type (void) G_GNUC_CONST;
GimpEnvironTable * gimp_environ_table_new (void);
void gimp_environ_table_load (GimpEnvironTable *environ_table,
const gchar *env_path);
void gimp_environ_table_add (GimpEnvironTable *environ_table,
const gchar *name,
const gchar *value,
const gchar *separator);
void gimp_environ_table_remove (GimpEnvironTable *environ_table,
const gchar *name);
void gimp_environ_table_clear (GimpEnvironTable *environ_table);
void gimp_environ_table_clear_all (GimpEnvironTable *environ_table);
gchar ** gimp_environ_table_get_envp (GimpEnvironTable *environ_table);
#endif /* __GIMP_ENVIRON_TABLE_H__ */

View File

@ -61,6 +61,8 @@
#include "gimptemplate.h"
#include "gimpundostack.h"
#include "plug-in/gimppluginmanager.h"
#include "file/file-utils.h"
#include "vectors/gimpvectors.h"
@ -1326,8 +1328,8 @@ gimp_image_set_filename (GimpImage *image,
{
gchar *uri;
uri = file_utils_filename_to_uri (image->gimp->load_procs, filename,
NULL);
uri = file_utils_filename_to_uri (image->gimp->plug_in_manager->load_procs,
filename, NULL);
gimp_image_set_uri (image, uri);

View File

@ -1,739 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpinterpreterdb.c
* (C) 2005 Manish Singh <yosh@gimp.org>
*
* 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.
*/
/*
* The binfmt_misc bits are derived from linux/fs/binfmt_misc.c
* Copyright (C) 1997 Richard Günther
*/
/*
* The sh-bang code is derived from linux/fs/binfmt_script.c
* Copyright (C) 1996 Martin von Löwis
* original #!-checking implemented by tytso.
*/
#include "config.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#include <glib-object.h>
#include <glib/gstdio.h>
#ifdef G_OS_WIN32
#include <io.h>
#endif
#ifndef _O_BINARY
#define _O_BINARY 0
#endif
#include "libgimpbase/gimpbase.h"
#include "core-types.h"
#include "gimpinterpreterdb.h"
#include "gimp-intl.h"
#define BUFSIZE 4096
typedef struct _GimpInterpreterMagic GimpInterpreterMagic;
struct _GimpInterpreterMagic
{
gulong offset;
gchar *magic;
gchar *mask;
guint size;
gchar *program;
};
static void gimp_interpreter_db_finalize (GObject *object);
static void gimp_interpreter_db_load_interp_file (const GimpDatafileData *file_data,
gpointer user_data);
static void gimp_interpreter_db_add_program (GimpInterpreterDB *db,
const GimpDatafileData *file_data,
gchar *buffer);
static void gimp_interpreter_db_add_binfmt_misc (GimpInterpreterDB *db,
const GimpDatafileData *file_data,
gchar *buffer);
static gboolean gimp_interpreter_db_add_extension (GimpInterpreterDB *db,
gchar **tokens);
static gboolean gimp_interpreter_db_add_magic (GimpInterpreterDB *db,
gchar **tokens);
static void gimp_interpreter_db_clear_magics (GimpInterpreterDB *db);
static void gimp_interpreter_db_resolve_programs (GimpInterpreterDB *db);
G_DEFINE_TYPE (GimpInterpreterDB, gimp_interpreter_db, G_TYPE_OBJECT);
#define parent_class gimp_interpreter_db_parent_class
static void
gimp_interpreter_db_class_init (GimpInterpreterDBClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = gimp_interpreter_db_finalize;
}
static void
gimp_interpreter_db_init (GimpInterpreterDB *db)
{
db->programs = NULL;
db->magics = NULL;
db->magic_names = NULL;
db->extensions = NULL;
db->extension_names = NULL;
}
static void
gimp_interpreter_db_finalize (GObject *object)
{
GimpInterpreterDB *db = GIMP_INTERPRETER_DB (object);
gimp_interpreter_db_clear (db);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GimpInterpreterDB *
gimp_interpreter_db_new (void)
{
return g_object_new (GIMP_TYPE_INTERPRETER_DB, NULL);
}
void
gimp_interpreter_db_load (GimpInterpreterDB *db,
const gchar *interp_path)
{
g_return_if_fail (GIMP_IS_INTERPRETER_DB (db));
gimp_interpreter_db_clear (db);
db->programs = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free);
db->extensions = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free);
db->magic_names = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
db->extension_names = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
gimp_datafiles_read_directories (interp_path,
G_FILE_TEST_EXISTS,
gimp_interpreter_db_load_interp_file,
db);
gimp_interpreter_db_resolve_programs (db);
}
void
gimp_interpreter_db_clear (GimpInterpreterDB *db)
{
g_return_if_fail (GIMP_IS_INTERPRETER_DB (db));
if (db->magic_names)
{
g_hash_table_destroy (db->magic_names);
db->magic_names = NULL;
}
if (db->extension_names)
{
g_hash_table_destroy (db->extension_names);
db->extension_names = NULL;
}
if (db->programs)
{
g_hash_table_destroy (db->programs);
db->programs = NULL;
}
if (db->extensions)
{
g_hash_table_destroy (db->extensions);
db->extensions = NULL;
}
gimp_interpreter_db_clear_magics (db);
}
static void
gimp_interpreter_db_load_interp_file (const GimpDatafileData *file_data,
gpointer user_data)
{
GimpInterpreterDB *db;
FILE *interp_file;
gchar buffer[4096];
gsize len;
db = GIMP_INTERPRETER_DB (user_data);
interp_file = g_fopen (file_data->filename, "r");
if (! interp_file)
return;
while (fgets (buffer, sizeof (buffer), interp_file))
{
/* Skip comments */
if (buffer[0] == '#')
continue;
len = strlen (buffer) - 1;
/* Skip too long lines */
if (buffer[len] != '\n')
continue;
buffer[len] = '\0';
if (g_ascii_isalnum (buffer[0]) || (buffer[0] == '/'))
gimp_interpreter_db_add_program (db, file_data, buffer);
else if (! g_ascii_isspace (buffer[0]) && (buffer[0] != '\0'))
gimp_interpreter_db_add_binfmt_misc (db, file_data, buffer);
}
fclose (interp_file);
}
static void
gimp_interpreter_db_add_program (GimpInterpreterDB *db,
const GimpDatafileData *file_data,
gchar *buffer)
{
gchar *name, *program, *p;
p = strchr (buffer, '=');
if (! p)
return;
*p = '\0';
name = buffer;
program = p + 1;
if (! g_file_test (program, G_FILE_TEST_IS_EXECUTABLE))
{
g_message (_("Bad interpreter referenced in interpreter file %s: %s"),
gimp_filename_to_utf8 (file_data->filename),
gimp_filename_to_utf8 (program));
return;
}
if (! g_hash_table_lookup (db->programs, name))
g_hash_table_insert (db->programs, g_strdup (name), g_strdup (program));
}
static void
gimp_interpreter_db_add_binfmt_misc (GimpInterpreterDB *db,
const GimpDatafileData *file_data,
gchar *buffer)
{
gchar **tokens = NULL;
gchar *name, *type, *program;
gsize count;
gchar del[2];
count = strlen (buffer);
if ((count < 10) || (count > 255))
goto bail;
del[0] = *buffer;
del[1] = '\0';
memset (buffer + count, del[0], 8);
tokens = g_strsplit (buffer + 1, del, -1);
name = tokens[0];
type = tokens[1];
program = tokens[5];
if (name[0] == '\0' || program == '\0' || type[0] == '\0' || type[1] != '\0')
goto bail;
switch (type[0])
{
case 'E':
if (! gimp_interpreter_db_add_extension (db, tokens))
goto bail;
break;
case 'M':
if (! gimp_interpreter_db_add_magic (db, tokens))
goto bail;
break;
default:
goto bail;
}
goto out;
bail:
g_message (_("Bad binary format string in interpreter file %s"),
gimp_filename_to_utf8 (file_data->filename));
out:
g_strfreev (tokens);
}
static gboolean
gimp_interpreter_db_add_extension (GimpInterpreterDB *db,
gchar **tokens)
{
gchar *name, *extension, *program;
name = tokens[0];
extension = tokens[3];
program = tokens[5];
if (! g_hash_table_lookup (db->extension_names, name))
{
if (extension[0] == '\0' || extension[0] == '/')
return FALSE;
program = g_strdup (program);
g_hash_table_insert (db->extensions, g_strdup (extension), program);
g_hash_table_insert (db->extension_names, g_strdup (name), program);
}
return TRUE;
}
static gboolean
scanarg (gchar *s)
{
gchar c;
while ((c = *s++) != '\0')
{
if (c == '\\' && *s == 'x')
{
s++;
if (! g_ascii_isxdigit (*s++))
return FALSE;
if (! g_ascii_isxdigit (*s++))
return FALSE;
}
}
return TRUE;
}
static guint
unquote (gchar *from)
{
gchar c, *s = from, *p = from;
while ((c = *s++) != '\0')
{
if (c == '\\' && *s == 'x')
{
s++;
*p = g_ascii_xdigit_value (*s++) << 4;
*p++ |= g_ascii_xdigit_value (*s++);
continue;
}
*p++ = c;
}
return p - from;
}
static gboolean
gimp_interpreter_db_add_magic (GimpInterpreterDB *db,
gchar **tokens)
{
GimpInterpreterMagic *interp_magic;
gchar *name, *num, *magic, *mask, *program;
gulong offset;
guint size;
name = tokens[0];
num = tokens[2];
magic = tokens[3];
mask = tokens[4];
program = tokens[5];
if (! g_hash_table_lookup (db->magic_names, name))
{
if (num[0] != '\0')
{
offset = strtoul (num, &num, 10);
if (num[0] != '\0')
return FALSE;
if (offset > (BUFSIZE / 4))
return FALSE;
}
else
offset = 0;
if (! scanarg (magic))
return FALSE;
if (! scanarg (mask))
return FALSE;
size = unquote (magic);
if ((size + offset) > (BUFSIZE / 2))
return FALSE;
if (mask[0] == '\0')
mask = NULL;
else if (unquote (mask) != size)
return FALSE;
interp_magic = g_new (GimpInterpreterMagic, 1);
interp_magic->offset = offset;
interp_magic->magic = g_memdup (magic, size);
interp_magic->mask = g_memdup (mask, size);
interp_magic->size = size;
interp_magic->program = g_strdup (program);
db->magics = g_slist_append (db->magics, interp_magic);
g_hash_table_insert (db->magic_names, g_strdup (name), interp_magic);
}
return TRUE;
}
static void
gimp_interpreter_db_clear_magics (GimpInterpreterDB *db)
{
GimpInterpreterMagic *magic;
GSList *list, *last;
list = db->magics;
db->magics = NULL;
while (list)
{
magic = list->data;
g_free (magic->magic);
g_free (magic->mask);
g_free (magic->program);
g_free (magic);
last = list;
list = list->next;
g_slist_free_1 (last);
}
}
#ifdef INTERP_DEBUG
static void
print_kv (gpointer key,
gpointer value,
gpointer user_data)
{
g_print ("%s: %s\n", (gchar *) key, (gchar *) value);
}
static gchar *
quote (gchar *s,
guint size)
{
GString *d;
guint i;
if (s == NULL)
return "(null)";
d = g_string_sized_new (size * 4);
for (i = 0; i < size; i++)
g_string_append_printf (d, "\\x%02x", ((guint) s[i]) & 0xff);
return g_string_free (d, FALSE);
}
#endif
static gboolean
resolve_program (gpointer key,
gpointer value,
gpointer user_data)
{
GimpInterpreterDB *db = user_data;
gchar *program;
program = g_hash_table_lookup (db->programs, value);
if (program != NULL)
{
g_free (value);
value = g_strdup (program);
}
g_hash_table_insert (db->extensions, key, value);
return TRUE;
}
static void
gimp_interpreter_db_resolve_programs (GimpInterpreterDB *db)
{
GSList *list;
gchar *program;
GimpInterpreterMagic *magic;
GHashTable *extensions;
list = db->magics;
while (list)
{
magic = list->data;
program = g_hash_table_lookup (db->programs, magic->program);
if (program != NULL)
{
g_free (magic->program);
magic->program = g_strdup (program);
}
list = list->next;
}
extensions = db->extensions;
db->extensions = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free);
g_hash_table_foreach_steal (extensions, resolve_program, db);
g_hash_table_destroy (extensions);
#ifdef INTERP_DEBUG
g_print ("Programs:\n");
g_hash_table_foreach (db->programs, print_kv, NULL);
g_print ("\nExtensions:\n");
g_hash_table_foreach (db->extensions, print_kv, NULL);
g_print ("\nMagics:\n");
list = db->magics;
while (list)
{
GimpInterpreterMagic *magic;
magic = list->data;
g_print ("program: %s, offset: %lu, magic: %s, mask: %s\n",
magic->program, magic->offset,
quote (magic->magic, magic->size),
quote (magic->mask, magic->size));
list = list->next;
}
g_print ("\n");
#endif
}
static gchar *
resolve_extension (GimpInterpreterDB *db,
const gchar *program_path)
{
gchar *filename;
gchar *p;
const gchar *program;
filename = g_path_get_basename (program_path);
p = strrchr (filename, '.');
if (! p)
{
g_free (filename);
return NULL;
}
program = g_hash_table_lookup (db->extensions, p + 1);
g_free (filename);
return g_strdup (program);
}
static gchar *
resolve_sh_bang (GimpInterpreterDB *db,
const gchar *program_path,
gchar *buffer,
gssize len,
gchar **interp_arg)
{
gchar *cp, *name, *program;
cp = strchr (buffer, '\n');
if (! cp)
cp = buffer + len - 1;
*cp = '\0';
while (cp > buffer)
{
cp--;
if ((*cp == ' ') || (*cp == '\t') || (*cp == '\r'))
*cp = '\0';
else
break;
}
for (cp = buffer + 2; (*cp == ' ') || (*cp == '\t'); cp++);
if (*cp == '\0')
return NULL;
name = cp;
for ( ; *cp && (*cp != ' ') && (*cp != '\t'); cp++)
/* nothing */ ;
while ((*cp == ' ') || (*cp == '\t'))
*cp++ = '\0';
if (*cp)
{
if (strcmp ("/usr/bin/env", name) == 0)
{
program = g_hash_table_lookup (db->programs, cp);
if (program)
return g_strdup (program);
}
*interp_arg = g_strdup (cp);
}
program = g_hash_table_lookup (db->programs, name);
if (! program)
program = name;
return g_strdup (program);
}
static gchar *
resolve_magic (GimpInterpreterDB *db,
const gchar *program_path,
gchar *buffer)
{
GSList *list;
GimpInterpreterMagic *magic;
gchar *s;
guint i;
list = db->magics;
while (list)
{
magic = list->data;
s = buffer + magic->offset;
if (magic->mask)
{
for (i = 0; i < magic->size; i++)
if ((*s++ ^ magic->magic[i]) & magic->mask[i])
break;
}
else
{
for (i = 0; i < magic->size; i++)
if ((*s++ ^ magic->magic[i]))
break;
}
if (i == magic->size)
return g_strdup (magic->program);
list = list->next;
}
return resolve_extension (db, program_path);
}
gchar *
gimp_interpreter_db_resolve (GimpInterpreterDB *db,
const gchar *program_path,
gchar **interp_arg)
{
gint fd;
gssize len;
gchar buffer[BUFSIZE];
*interp_arg = NULL;
fd = g_open (program_path, O_RDONLY | _O_BINARY, 0);
if (fd == -1)
return resolve_extension (db, program_path);
memset (buffer, 0, sizeof (buffer));
len = read (fd, buffer, sizeof (buffer));
close (fd);
if (len <= 0)
return resolve_extension (db, program_path);
if (len > 3 && buffer[0] == '#' && buffer[1] == '!')
return resolve_sh_bang (db, program_path, buffer, len, interp_arg);
return resolve_magic (db, program_path, buffer);
}

View File

@ -1,68 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpinterpreterdb.h
* (C) 2005 Manish Singh <yosh@gimp.org>
*
* 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.
*/
#ifndef __GIMP_INTERPRETER_DB_H__
#define __GIMP_INTERPRETER_DB_H__
#define GIMP_TYPE_INTERPRETER_DB (gimp_interpreter_db_get_type ())
#define GIMP_INTERPRETER_DB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_INTERPRETER_DB, GimpInterpreterDB))
#define GIMP_INTERPRETER_DB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_INTERPRETER_DB, GimpInterpreterDBClass))
#define GIMP_IS_INTERPRETER_DB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_INTERPRETER_DB))
#define GIMP_IS_INTERPRETER_DB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_INTERPRETER_DB))
#define GIMP_INTERPRETER_DB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_INTERPRETER_DB, GimpInterpreterDBClass))
typedef struct _GimpInterpreterDBClass GimpInterpreterDBClass;
struct _GimpInterpreterDB
{
GObject parent_instance;
GHashTable *programs;
GSList *magics;
GHashTable *magic_names;
GHashTable *extensions;
GHashTable *extension_names;
};
struct _GimpInterpreterDBClass
{
GObjectClass parent_class;
};
GType gimp_interpreter_db_get_type (void) G_GNUC_CONST;
GimpInterpreterDB * gimp_interpreter_db_new (void);
void gimp_interpreter_db_load (GimpInterpreterDB *db,
const gchar *interp_path);
void gimp_interpreter_db_clear (GimpInterpreterDB *db);
gchar * gimp_interpreter_db_resolve (GimpInterpreterDB *db,
const gchar *program_path,
gchar **interp_arg);
#endif /* __GIMP_INTERPRETER_DB_H__ */

View File

@ -50,4 +50,5 @@ VOID: POINTER, ENUM
VOID: STRING
VOID: STRING, BOOLEAN, UINT, FLAGS
VOID: STRING, FLAGS
VOID: STRING, STRING, STRING
VOID: VOID

View File

@ -30,6 +30,8 @@
#include "core/gimp.h"
#include "core/gimpprogress.h"
#include "plug-in/gimppluginmanager.h"
#include "file/file-open.h"
#include "file/file-utils.h"
@ -178,7 +180,8 @@ file_open_location_response (GtkDialog *dialog,
}
else
{
uri = file_utils_filename_to_uri (gimp->load_procs, text, NULL);
uri = file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
text, NULL);
}
box = gimp_progress_box_new ();

View File

@ -33,6 +33,8 @@
#include "pdb/gimppluginprocedure.h"
#include "plug-in/gimppluginmanager.h"
#include "file/file-save.h"
#include "file/file-utils.h"
@ -178,8 +180,10 @@ file_save_dialog_check_uri (GtkWidget *save_dialog,
basename = g_path_get_basename (uri);
save_proc = dialog->file_proc;
uri_proc = file_utils_find_proc (gimp->save_procs, uri);
basename_proc = file_utils_find_proc (gimp->save_procs, basename);
uri_proc = file_utils_find_proc (gimp->plug_in_manager->save_procs,
uri);
basename_proc = file_utils_find_proc (gimp->plug_in_manager->save_procs,
basename);
g_print ("\n\n%s: URI = %s\n",
G_STRFUNC, uri);
@ -230,8 +234,10 @@ file_save_dialog_check_uri (GtkWidget *save_dialog,
uri = ext_uri;
basename = ext_basename;
uri_proc = file_utils_find_proc (gimp->save_procs, uri);
basename_proc = file_utils_find_proc (gimp->save_procs, basename);
uri_proc = file_utils_find_proc (gimp->plug_in_manager->save_procs,
uri);
basename_proc = file_utils_find_proc (gimp->plug_in_manager->save_procs,
basename);
utf8 = g_filename_to_utf8 (basename, -1, NULL, NULL, NULL);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (save_dialog),

View File

@ -59,6 +59,8 @@
#include "pdb/gimppdb.h"
#include "pdb/gimppluginprocedure.h"
#include "plug-in/gimppluginmanager.h"
#include "file-open.h"
#include "file-utils.h"
#include "gimprecentlist.h"
@ -96,7 +98,7 @@ file_open_image (Gimp *gimp,
*status = GIMP_PDB_EXECUTION_ERROR;
if (! file_proc)
file_proc = file_utils_find_proc (gimp->load_procs, uri);
file_proc = file_utils_find_proc (gimp->plug_in_manager->load_procs, uri);
if (! file_proc)
{
@ -201,7 +203,7 @@ file_open_thumbnail (Gimp *gimp,
*image_width = 0;
*image_height = 0;
file_proc = file_utils_find_proc (gimp->load_procs, uri);
file_proc = file_utils_find_proc (gimp->plug_in_manager->load_procs, uri);
if (! file_proc || ! file_proc->thumb_loader)
return NULL;

View File

@ -43,8 +43,6 @@
#include "pdb/gimppluginprocedure.h"
#include "plug-in/plug-ins.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpbrushselect.h"
#include "widgets/gimpdialogfactory.h"
@ -102,10 +100,6 @@ static void gui_display_delete (GimpObject *display);
static void gui_displays_reconnect (Gimp *gimp,
GimpImage *old_image,
GimpImage *new_image);
static void gui_menus_create_branch (Gimp *gimp,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label);
static GimpProgress * gui_new_progress (Gimp *gimp,
GimpObject *display);
static void gui_free_progress (Gimp *gimp,
@ -150,7 +144,6 @@ gui_vtable_init (Gimp *gimp)
gimp->gui.display_create = gui_display_create;
gimp->gui.display_delete = gui_display_delete;
gimp->gui.displays_reconnect = gui_displays_reconnect;
gimp->gui.menus_create_branch = gui_menus_create_branch;
gimp->gui.progress_new = gui_new_progress;
gimp->gui.progress_free = gui_free_progress;
gimp->gui.pdb_dialog_new = gui_pdb_dialog_new;
@ -367,22 +360,6 @@ gui_displays_reconnect (Gimp *gimp,
gimp_displays_reconnect (gimp, old_image, new_image);
}
static void
gui_menus_create_branch (Gimp *gimp,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label)
{
GList *list;
for (list = gimp_action_groups_from_name ("plug-in");
list;
list = g_list_next (list))
{
plug_in_actions_add_branch (list->data, progname, menu_path, menu_label);
}
}
static GimpProgress *
gui_new_progress (Gimp *gimp,
GimpObject *display)

View File

@ -33,11 +33,13 @@
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpenvirontable.h"
#include "core/gimpimage.h"
#include "core/gimplist.h"
#include "core/gimptoolinfo.h"
#include "plug-in/gimpenvirontable.h"
#include "plug-in/gimppluginmanager.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplayshell.h"
@ -336,7 +338,8 @@ gui_initialize_after_callback (Gimp *gimp,
gchar *display;
display = gdk_get_display ();
gimp_environ_table_add (gimp->environ_table, name, display, NULL);
gimp_environ_table_add (gimp->plug_in_manager->environ_table,
name, display, NULL);
g_free (display);
}

View File

@ -32,7 +32,8 @@
#include "pdb/gimppluginprocedure.h"
#include "plug-in/plug-in-locale-domain.h"
#include "plug-in/gimppluginmanager.h"
#include "plug-in/gimppluginmanager-locale-domain.h"
#include "widgets/gimpuimanager.h"
@ -112,7 +113,7 @@ plug_in_menus_setup (GimpUIManager *manager,
menu_entries = g_tree_new_full ((GCompareDataFunc) strcmp, NULL,
g_free, g_free);
for (list = manager->gimp->plug_in_procedures;
for (list = manager->gimp->plug_in_manager->plug_in_procedures;
list;
list = g_slist_next (list))
{
@ -146,8 +147,8 @@ plug_in_menus_setup (GimpUIManager *manager,
progname = gimp_plug_in_procedure_get_progname (plug_in_proc);
locale_domain = plug_in_locale_domain (manager->gimp,
progname, NULL);
locale_domain = gimp_plug_in_manager_get_locale_domain (manager->gimp->plug_in_manager,
progname, NULL);
if (plug_in_proc->menu_label)
{

View File

@ -34,6 +34,7 @@
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
#include "plug-in/gimppluginmanager.h"
#include "plug-in/plug-in-context.h"
#include "plug-in/plug-in.h"
@ -46,8 +47,9 @@ context_push_invoker (GimpProcedure *procedure,
const GValueArray *args)
{
gboolean success = TRUE;
if (gimp->current_plug_in && gimp->current_plug_in->open)
success = plug_in_context_push (gimp->current_plug_in);
if (gimp->plug_in_manager->current_plug_in &&
gimp->plug_in_manager->current_plug_in->open)
success = plug_in_context_push (gimp->plug_in_manager->current_plug_in);
else
success = FALSE;
return gimp_procedure_get_return_values (procedure, success);
@ -61,8 +63,9 @@ context_pop_invoker (GimpProcedure *procedure,
const GValueArray *args)
{
gboolean success = TRUE;
if (gimp->current_plug_in && gimp->current_plug_in->open)
success = plug_in_context_pop (gimp->current_plug_in);
if (gimp->plug_in_manager->current_plug_in &&
gimp->plug_in_manager->current_plug_in->open)
success = plug_in_context_pop (gimp->plug_in_manager->current_plug_in);
else
success = FALSE;
return gimp_procedure_get_return_values (procedure, success);

View File

@ -41,6 +41,7 @@
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "gimp-intl.h"
#include "plug-in/gimppluginmanager.h"
#include "plug-in/plug-in.h"
@ -762,8 +763,8 @@ drawable_merge_shadow_invoker (GimpProcedure *procedure,
{
gchar *undo_desc = NULL;
if (gimp->current_plug_in)
undo_desc = plug_in_get_undo_desc (gimp->current_plug_in);
if (gimp->plug_in_manager->current_plug_in)
undo_desc = plug_in_get_undo_desc (gimp->plug_in_manager->current_plug_in);
if (! undo_desc)
undo_desc = g_strdup (_("Plug-In"));

View File

@ -38,7 +38,8 @@
#include "core/gimplayer.h"
#include "file/file-open.h"
#include "file/file-utils.h"
#include "plug-in/plug-in-file.h"
#include "plug-in/gimppluginmanager-file.h"
#include "plug-in/gimppluginmanager.h"
static GValueArray *
@ -55,14 +56,14 @@ file_load_invoker (GimpProcedure *procedure,
gchar *uri;
gint i;
uri = file_utils_filename_to_uri (gimp->load_procs,
uri = file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
g_value_get_string (&args->values[1]),
NULL);
if (! uri)
return gimp_procedure_get_return_values (procedure, FALSE);
file_proc = file_utils_find_proc (gimp->load_procs, uri);
file_proc = file_utils_find_proc (gimp->plug_in_manager->load_procs, uri);
g_free (uri);
@ -110,7 +111,7 @@ file_load_layer_invoker (GimpProcedure *procedure,
if (success)
{
gchar *uri = file_utils_filename_to_uri (gimp->load_procs,
gchar *uri = file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
filename, NULL);
if (uri)
@ -149,14 +150,14 @@ file_save_invoker (GimpProcedure *procedure,
gchar *uri;
gint i;
uri = file_utils_filename_to_uri (gimp->load_procs,
uri = file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
g_value_get_string (&args->values[3]),
NULL);
if (! uri)
return gimp_procedure_get_return_values (procedure, FALSE);
file_proc = file_utils_find_proc (gimp->save_procs, uri);
file_proc = file_utils_find_proc (gimp->plug_in_manager->save_procs, uri);
g_free (uri);
@ -303,8 +304,9 @@ register_magic_load_handler_invoker (GimpProcedure *procedure,
{
gchar *canonical = gimp_canonicalize_identifier (procedure_name);
success = plug_in_file_register_load_handler (gimp, canonical,
extensions, prefixes, magics);
success = gimp_plug_in_manager_register_load_handler (gimp->plug_in_manager,
canonical,
extensions, prefixes, magics);
g_free (canonical);
}
@ -332,8 +334,9 @@ register_load_handler_invoker (GimpProcedure *procedure,
{
gchar *canonical = gimp_canonicalize_identifier (procedure_name);
success = plug_in_file_register_load_handler (gimp, canonical,
extensions, prefixes, NULL);
success = gimp_plug_in_manager_register_load_handler (gimp->plug_in_manager,
canonical,
extensions, prefixes, NULL);
g_free (canonical);
}
@ -361,8 +364,9 @@ register_save_handler_invoker (GimpProcedure *procedure,
{
gchar *canonical = gimp_canonicalize_identifier (procedure_name);
success = plug_in_file_register_save_handler (gimp, canonical,
extensions, prefixes);
success = gimp_plug_in_manager_register_save_handler (gimp->plug_in_manager,
canonical,
extensions, prefixes);
g_free (canonical);
}
@ -388,7 +392,8 @@ register_file_handler_mime_invoker (GimpProcedure *procedure,
{
gchar *canonical = gimp_canonicalize_identifier (procedure_name);
success = plug_in_file_register_mime_type (gimp, canonical, mime_type);
success = gimp_plug_in_manager_register_mime_type (gimp->plug_in_manager,
canonical, mime_type);
g_free (canonical);
}
@ -414,7 +419,8 @@ register_thumbnail_loader_invoker (GimpProcedure *procedure,
{
gchar *canonical = gimp_canonicalize_identifier (load_proc);
success = plug_in_file_register_thumb_loader (gimp, canonical, thumb_proc);
success = gimp_plug_in_manager_register_thumb_loader (gimp->plug_in_manager,
canonical, thumb_proc);
g_free (canonical);
}

View File

@ -34,7 +34,6 @@
#include "core/gimpparamspecs.h"
#include "plug-in/plug-in.h"
#include "plug-in/plug-ins.h"
#define __YES_I_NEED_PLUG_IN_RUN__
#include "plug-in/plug-in-run.h"
@ -218,7 +217,7 @@ gimp_plug_in_procedure_execute (GimpProcedure *procedure,
context, progress,
args);
return plug_in_run (gimp, context, progress,
return plug_in_run (gimp->plug_in_manager, context, progress,
GIMP_PLUG_IN_PROCEDURE (procedure),
args, TRUE, FALSE, -1);
}
@ -231,7 +230,7 @@ gimp_plug_in_procedure_execute_async (GimpProcedure *procedure,
GValueArray *args,
gint32 display_ID)
{
plug_in_run (gimp, context, progress,
plug_in_run (gimp->plug_in_manager, context, progress,
GIMP_PLUG_IN_PROCEDURE (procedure),
args, FALSE, TRUE, display_ID);
}

View File

@ -24,6 +24,8 @@
#include "pdb-types.h"
#include "core/gimp.h"
#include "plug-in/plug-in.h"
#define __YES_I_NEED_PLUG_IN_RUN__
#include "plug-in/plug-in-run.h"
@ -92,7 +94,7 @@ gimp_temporary_procedure_execute (GimpProcedure *procedure,
GimpProgress *progress,
GValueArray *args)
{
return plug_in_run_temp (gimp, context, progress,
return plug_in_run_temp (gimp->plug_in_manager, context, progress,
GIMP_TEMPORARY_PROCEDURE (procedure),
args);
}
@ -107,7 +109,7 @@ gimp_temporary_procedure_execute_async (GimpProcedure *procedure,
{
GValueArray *return_vals;
return_vals = plug_in_run_temp (gimp, context, progress,
return_vals = plug_in_run_temp (gimp->plug_in_manager, context, progress,
GIMP_TEMPORARY_PROCEDURE (procedure),
args);

View File

@ -29,7 +29,8 @@
#include "core/gimpparamspecs.h"
#include "core/gimp.h"
#include "plug-in/plug-in-help-domain.h"
#include "plug-in/gimppluginmanager-help-domain.h"
#include "plug-in/gimppluginmanager.h"
#include "plug-in/plug-in.h"
@ -49,9 +50,13 @@ help_invoker (GimpProcedure *procedure,
if (success)
{
if (! help_domain && gimp->current_plug_in)
GimpPlugInManager *manager = gimp->plug_in_manager;
if (! help_domain && manager->current_plug_in)
help_domain = (gchar *)
plug_in_help_domain (gimp, gimp->current_plug_in->prog, NULL);
gimp_plug_in_manager_get_help_domain (manager,
manager->current_plug_in->prog,
NULL);
gimp_help (gimp, help_domain, help_id);
}

View File

@ -31,6 +31,7 @@
#include "core/gimp.h"
#include "gimp-intl.h"
#include "plug-in/gimppluginmanager.h"
#include "plug-in/plug-in-progress.h"
#include "plug-in/plug-in.h"
@ -49,8 +50,8 @@ message_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp->current_plug_in)
plug_in_progress_message (gimp->current_plug_in, message);
if (gimp->plug_in_manager->current_plug_in)
plug_in_progress_message (gimp->plug_in_manager->current_plug_in, message);
else
gimp_message (gimp, NULL, message);
}

View File

@ -34,11 +34,11 @@
#include "core/gimp.h"
#include "gimppluginprocedure.h"
#include "plug-in/gimppluginmanager-menu-branch.h"
#include "plug-in/gimppluginmanager-query.h"
#include "plug-in/gimppluginmanager.h"
#include "plug-in/plug-in-def.h"
#include "plug-in/plug-in-menu-branch.h"
#include "plug-in/plug-in.h"
#include "plug-in/plug-ins-query.h"
#include "plug-in/plug-ins.h"
static GValueArray *
@ -60,13 +60,14 @@ plugins_query_invoker (GimpProcedure *procedure,
search_string = g_value_get_string (&args->values[0]);
num_plugins = plug_ins_query (gimp, search_string,
&menu_path,
&plugin_accelerator,
&plugin_location,
&plugin_image_type,
&plugin_real_name,
&plugin_install_time);
num_plugins = gimp_plug_in_manager_query (gimp->plug_in_manager,
search_string,
&menu_path,
&plugin_accelerator,
&plugin_location,
&plugin_image_type,
&plugin_real_name,
&plugin_install_time);
return_vals = gimp_procedure_get_return_values (procedure, TRUE);
@ -102,12 +103,12 @@ plugin_domain_register_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp->current_plug_in && gimp->current_plug_in->query)
PlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
if (plug_in && plug_in->query)
{
plug_in_def_set_locale_domain_name (gimp->current_plug_in->plug_in_def,
domain_name);
plug_in_def_set_locale_domain_path (gimp->current_plug_in->plug_in_def,
domain_path);
plug_in_def_set_locale_domain_name (plug_in->plug_in_def, domain_name);
plug_in_def_set_locale_domain_path (plug_in->plug_in_def, domain_path);
}
else
success = FALSE;
@ -132,12 +133,12 @@ plugin_help_register_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp->current_plug_in && gimp->current_plug_in->query)
PlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
if (plug_in && plug_in->query)
{
plug_in_def_set_help_domain_name (gimp->current_plug_in->plug_in_def,
domain_name);
plug_in_def_set_help_domain_uri (gimp->current_plug_in->plug_in_def,
domain_uri);
plug_in_def_set_help_domain_name (plug_in->plug_in_def, domain_name);
plug_in_def_set_help_domain_uri (plug_in->plug_in_def, domain_uri);
}
else
success = FALSE;
@ -162,12 +163,12 @@ plugin_menu_register_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp->current_plug_in)
PlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
if (plug_in)
{
gchar *canonical = gimp_canonicalize_identifier (procedure_name);
success = plug_in_menu_register (gimp->current_plug_in,
canonical, menu_path);
success = plug_in_menu_register (plug_in, canonical, menu_path);
g_free (canonical);
}
else
@ -195,10 +196,12 @@ plugin_menu_branch_register_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp->current_plug_in)
PlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
if (plug_in)
{
plug_in_menu_branch_add (gimp, gimp->current_plug_in->prog,
menu_path, menu_name);
gimp_plug_in_manager_add_menu_branch (gimp->plug_in_manager,
plug_in->prog, menu_path, menu_name);
}
else
success = FALSE;
@ -227,14 +230,16 @@ plugin_icon_register_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp->current_plug_in && gimp->current_plug_in->query)
PlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
if (plug_in && plug_in->query)
{
GimpPlugInProcedure *proc;
gchar *canonical;
canonical = gimp_canonicalize_identifier (procedure_name);
proc = gimp_plug_in_procedure_find (gimp->current_plug_in->plug_in_def->procedures,
proc = gimp_plug_in_procedure_find (plug_in->plug_in_def->procedures,
canonical);
g_free (canonical);

View File

@ -33,7 +33,7 @@
#include "core/gimp.h"
#include "gimp-pdb-compat.h"
#include "gimppdb-query.h"
#include "plug-in/plug-in-data.h"
#include "plug-in/gimppluginmanager-data.h"
static GValueArray *
@ -322,7 +322,8 @@ procedural_db_get_data_invoker (GimpProcedure *procedure,
gchar *canonical = gimp_canonicalize_identifier (identifier);
const guint8 *orig_data;
orig_data = plug_in_data_get (gimp, canonical, &bytes);
orig_data = gimp_plug_in_manager_get_data (gimp->plug_in_manager,
canonical, &bytes);
g_free (canonical);
@ -361,7 +362,8 @@ procedural_db_get_data_size_invoker (GimpProcedure *procedure,
{
gchar *canonical = gimp_canonicalize_identifier (identifier);
if (! plug_in_data_get (gimp, canonical, &bytes))
if (! gimp_plug_in_manager_get_data (gimp->plug_in_manager,
canonical, &bytes))
success = FALSE;
g_free (canonical);
@ -395,7 +397,8 @@ procedural_db_set_data_invoker (GimpProcedure *procedure,
{
gchar *canonical = gimp_canonicalize_identifier (identifier);
plug_in_data_set (gimp, canonical, bytes, data);
gimp_plug_in_manager_set_data (gimp->plug_in_manager,
canonical, bytes, data);
g_free (canonical);
}

View File

@ -29,6 +29,7 @@
#include "core/gimpparamspecs.h"
#include "core/gimp.h"
#include "plug-in/gimppluginmanager.h"
#include "plug-in/plug-in-progress.h"
#include "plug-in/plug-in.h"
@ -49,10 +50,12 @@ progress_init_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp->current_plug_in && gimp->current_plug_in->open)
PlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
if (plug_in && plug_in->open)
{
if (! gimp->no_interface)
plug_in_progress_start (gimp->current_plug_in, message, gdisplay);
plug_in_progress_start (plug_in, message, gdisplay);
}
else
success = FALSE;
@ -75,10 +78,12 @@ progress_update_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp->current_plug_in && gimp->current_plug_in->open)
PlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
if (plug_in && plug_in->open)
{
if (! gimp->no_interface)
plug_in_progress_set_value (gimp->current_plug_in, percentage);
plug_in_progress_set_value (plug_in, percentage);
}
else
success = FALSE;
@ -95,13 +100,16 @@ progress_pulse_invoker (GimpProcedure *procedure,
const GValueArray *args)
{
gboolean success = TRUE;
if (gimp->current_plug_in && gimp->current_plug_in->open)
PlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
if (plug_in && plug_in->open)
{
if (! gimp->no_interface)
plug_in_progress_pulse (gimp->current_plug_in);
plug_in_progress_pulse (plug_in);
}
else
success = FALSE;
return gimp_procedure_get_return_values (procedure, success);
}
@ -119,10 +127,12 @@ progress_set_text_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp->current_plug_in && gimp->current_plug_in->open)
PlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
if (plug_in && plug_in->open)
{
if (! gimp->no_interface)
plug_in_progress_set_text (gimp->current_plug_in, message);
plug_in_progress_set_text (plug_in, message);
}
else
success = FALSE;
@ -142,10 +152,12 @@ progress_get_window_handle_invoker (GimpProcedure *procedure,
GValueArray *return_vals;
gint32 window = 0;
if (gimp->current_plug_in && gimp->current_plug_in->open)
PlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
if (plug_in && plug_in->open)
{
if (! gimp->no_interface)
window = plug_in_progress_get_window (gimp->current_plug_in);
window = plug_in_progress_get_window (plug_in);
}
else
success = FALSE;
@ -172,9 +184,10 @@ progress_install_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp->current_plug_in && gimp->current_plug_in->open)
success = plug_in_progress_install (gimp->current_plug_in,
progress_callback);
PlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
if (plug_in && plug_in->open)
success = plug_in_progress_install (plug_in, progress_callback);
else
success = FALSE;
}
@ -196,9 +209,10 @@ progress_uninstall_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp->current_plug_in && gimp->current_plug_in->open)
success = plug_in_progress_uninstall (gimp->current_plug_in,
progress_callback);
PlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
if (plug_in && plug_in->open)
success = plug_in_progress_uninstall (plug_in, progress_callback);
else
success = FALSE;
}
@ -220,9 +234,10 @@ progress_cancel_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp->current_plug_in && gimp->current_plug_in->open)
success = plug_in_progress_cancel (gimp->current_plug_in,
progress_callback);
PlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
if (plug_in && plug_in->open)
success = plug_in_progress_cancel (plug_in, progress_callback);
else
success = FALSE;
}

View File

@ -31,6 +31,7 @@
#include "core/gimp.h"
#include "core/gimpimage-undo.h"
#include "core/gimpimage.h"
#include "plug-in/gimppluginmanager.h"
#include "plug-in/plug-in.h"
@ -48,10 +49,11 @@ image_undo_group_start_invoker (GimpProcedure *procedure,
if (success)
{
gchar *undo_desc = NULL;
PlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
gchar *undo_desc = NULL;
if (gimp->current_plug_in)
undo_desc = plug_in_get_undo_desc (gimp->current_plug_in);
if (plug_in)
undo_desc = plug_in_get_undo_desc (plug_in);
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_MISC, undo_desc);

View File

@ -15,45 +15,51 @@ INCLUDES = \
noinst_LIBRARIES = libappplug-in.a
libappplug_in_a_SOURCES = \
plug-in-enums.c \
plug-in-enums.h \
plug-in-types.h \
plug-in.c \
plug-in.h \
plug-in-context.c \
plug-in-context.h \
plug-in-data.c \
plug-in-data.h \
plug-in-debug.c \
plug-in-debug.h \
plug-in-def.c \
plug-in-def.h \
plug-in-file.c \
plug-in-file.h \
plug-in-help-domain.c \
plug-in-help-domain.h \
plug-in-locale-domain.c \
plug-in-locale-domain.h \
plug-in-menu-branch.c \
plug-in-menu-branch.h \
plug-in-message.c \
plug-in-message.h \
plug-in-params.c \
plug-in-params.h \
plug-in-proc-frame.c \
plug-in-proc-frame.h \
plug-in-progress.c \
plug-in-progress.h \
plug-in-rc.c \
plug-in-rc.h \
plug-in-run.c \
plug-in-run.h \
plug-in-shm.c \
plug-in-shm.h \
plug-ins.c \
plug-ins.h \
plug-ins-query.c \
plug-ins-query.h
plug-in-enums.c \
plug-in-enums.h \
plug-in-types.h \
\
gimpenvirontable.c \
gimpenvirontable.h \
gimpinterpreterdb.c \
gimpinterpreterdb.h \
gimpplugindebug.c \
gimpplugindebug.h \
gimppluginmanager.c \
gimppluginmanager.h \
gimppluginmanager-data.c \
gimppluginmanager-data.h \
gimppluginmanager-file.c \
gimppluginmanager-file.h \
gimppluginmanager-help-domain.c \
gimppluginmanager-help-domain.h \
gimppluginmanager-locale-domain.c \
gimppluginmanager-locale-domain.h \
gimppluginmanager-menu-branch.c \
gimppluginmanager-menu-branch.h \
gimppluginmanager-query.c \
gimppluginmanager-query.h \
gimppluginshm.c \
gimppluginshm.h \
\
plug-in.c \
plug-in.h \
plug-in-context.c \
plug-in-context.h \
plug-in-def.c \
plug-in-def.h \
plug-in-message.c \
plug-in-message.h \
plug-in-params.c \
plug-in-params.h \
plug-in-proc-frame.c \
plug-in-proc-frame.h \
plug-in-progress.c \
plug-in-progress.h \
plug-in-rc.c \
plug-in-rc.h \
plug-in-run.c \
plug-in-run.h
EXTRA_DIST = makefile.msc

View File

@ -30,7 +30,7 @@
#include "libgimpbase/gimpbase.h"
#include "libgimpconfig/gimpconfig.h"
#include "core-types.h"
#include "plug-in-types.h"
#include "gimpenvirontable.h"

View File

@ -58,7 +58,7 @@
#include "libgimpbase/gimpbase.h"
#include "core-types.h"
#include "plug-in-types.h"
#include "gimpinterpreterdb.h"

View File

@ -25,6 +25,7 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "gimppluginmanager.h"
#include "plug-in.h"
#include "plug-in-context.h"
@ -45,7 +46,7 @@ plug_in_context_push (PlugIn *plug_in)
else
parent = proc_frame->main_context;
context = gimp_context_new (plug_in->gimp, "plug-in context", NULL);
context = gimp_context_new (plug_in->manager->gimp, "plug-in context", NULL);
gimp_context_copy_properties (parent, context, GIMP_CONTEXT_ALL_PROPS_MASK);
proc_frame->context_stack = g_list_prepend (proc_frame->context_stack,

View File

@ -40,10 +40,10 @@
#include "pdb/gimp-pdb-compat.h"
#include "pdb/gimptemporaryprocedure.h"
#include "gimppluginmanager.h"
#include "plug-in.h"
#include "plug-in-def.h"
#include "plug-in-params.h"
#include "plug-in-shm.h"
/* local function prototypes */
@ -164,7 +164,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
Tile *tile;
gint shm_ID;
shm_ID = plug_in_shm_get_ID (plug_in->gimp);
shm_ID = gimp_plug_in_manager_get_shm_ID (plug_in->manager);
if (tile_req->drawable_ID == -1)
{
@ -202,7 +202,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_info = msg.data;
drawable = (GimpDrawable *) gimp_item_get_by_ID (plug_in->gimp,
drawable = (GimpDrawable *) gimp_item_get_by_ID (plug_in->manager->gimp,
tile_info->drawable_ID);
if (! GIMP_IS_DRAWABLE (drawable))
@ -234,7 +234,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
if (tile_data.use_shm)
memcpy (tile_data_pointer (tile, 0, 0),
plug_in_shm_get_addr (plug_in->gimp),
gimp_plug_in_manager_get_shm_addr (plug_in->manager),
tile_size (tile));
else
memcpy (tile_data_pointer (tile, 0, 0),
@ -255,7 +255,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
{
/* this branch communicates with libgimp/gimptile.c:gimp_tile_get() */
drawable = (GimpDrawable *) gimp_item_get_by_ID (plug_in->gimp,
drawable = (GimpDrawable *) gimp_item_get_by_ID (plug_in->manager->gimp,
tile_req->drawable_ID);
if (! GIMP_IS_DRAWABLE (drawable))
@ -294,7 +294,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (plug_in_shm_get_addr (plug_in->gimp),
memcpy (gimp_plug_in_manager_get_shm_addr (plug_in->manager),
tile_data_pointer (tile, 0, 0),
tile_size (tile));
else
@ -343,18 +343,20 @@ plug_in_handle_proc_run (PlugIn *plug_in,
proc_frame = plug_in_get_proc_frame (plug_in);
procedure = gimp_pdb_lookup_procedure (plug_in->gimp->pdb, canonical);
procedure = gimp_pdb_lookup_procedure (plug_in->manager->gimp->pdb,
canonical);
if (! procedure)
{
proc_name = gimp_pdb_lookup_compat_proc_name (plug_in->gimp->pdb,
proc_name = gimp_pdb_lookup_compat_proc_name (plug_in->manager->gimp->pdb,
canonical);
if (proc_name)
{
procedure = gimp_pdb_lookup_procedure (plug_in->gimp->pdb, proc_name);
procedure = gimp_pdb_lookup_procedure (plug_in->manager->gimp->pdb,
proc_name);
if (plug_in->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_WARN)
if (plug_in->manager->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_WARN)
{
g_message ("WARNING: Plug-In \"%s\"\n(%s)\n"
"called deprecated procedure '%s'.\n"
@ -367,7 +369,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
}
else if (procedure->deprecated)
{
if (plug_in->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_WARN)
if (plug_in->manager->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_WARN)
{
if (! strcmp (procedure->deprecated, "NONE"))
{
@ -387,7 +389,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
canonical, procedure->deprecated);
}
}
else if (plug_in->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_OFF)
else if (plug_in->manager->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_OFF)
{
procedure = NULL;
}
@ -405,15 +407,15 @@ plug_in_handle_proc_run (PlugIn *plug_in,
* returned NULL, gimp_pdb_execute_procedure_by_name_args() will
* return appropriate error return_vals.
*/
plug_in_push (plug_in->gimp, plug_in);
return_vals = gimp_pdb_execute_procedure_by_name_args (plug_in->gimp->pdb,
plug_in_push (plug_in->manager, plug_in);
return_vals = gimp_pdb_execute_procedure_by_name_args (plug_in->manager->gimp->pdb,
proc_frame->context_stack ?
proc_frame->context_stack->data :
proc_frame->main_context,
proc_frame->progress,
proc_name,
args);
plug_in_pop (plug_in->gimp);
plug_in_pop (plug_in->manager);
g_free (canonical);
@ -611,7 +613,7 @@ plug_in_handle_proc_install (PlugIn *plug_in,
for (i = 0; i < proc_install->nparams; i++)
{
GParamSpec *pspec =
gimp_pdb_compat_param_spec (plug_in->gimp,
gimp_pdb_compat_param_spec (plug_in->manager->gimp,
proc_install->params[i].type,
proc_install->params[i].name,
proc_install->params[i].description);
@ -622,7 +624,7 @@ plug_in_handle_proc_install (PlugIn *plug_in,
for (i = 0; i < proc_install->nreturn_vals; i++)
{
GParamSpec *pspec =
gimp_pdb_compat_param_spec (plug_in->gimp,
gimp_pdb_compat_param_spec (plug_in->manager->gimp,
proc_install->return_vals[i].type,
proc_install->return_vals[i].name,
proc_install->return_vals[i].description);

View File

@ -32,6 +32,7 @@
#include "pdb/gimppdb.h"
#include "pdb/gimptemporaryprocedure.h"
#include "gimppluginmanager.h"
#include "plug-in.h"
#include "plug-in-progress.h"
@ -58,7 +59,8 @@ plug_in_progress_start (PlugIn *plug_in,
if (! proc_frame->progress)
{
proc_frame->progress = gimp_new_progress (plug_in->gimp, display);
proc_frame->progress = gimp_new_progress (plug_in->manager->gimp,
display);
if (proc_frame->progress)
{
@ -116,7 +118,7 @@ plug_in_progress_end (PlugIn *plug_in)
if (proc_frame->progress_created)
{
gimp_free_progress (plug_in->gimp, proc_frame->progress);
gimp_free_progress (plug_in->manager->gimp, proc_frame->progress);
g_object_unref (proc_frame->progress);
proc_frame->progress = NULL;
}
@ -203,7 +205,7 @@ plug_in_progress_install (PlugIn *plug_in,
g_return_val_if_fail (plug_in != NULL, FALSE);
g_return_val_if_fail (progress_callback != NULL, FALSE);
procedure = gimp_pdb_lookup_procedure (plug_in->gimp->pdb,
procedure = gimp_pdb_lookup_procedure (plug_in->manager->gimp->pdb,
progress_callback);
if (! GIMP_IS_TEMPORARY_PROCEDURE (procedure) ||
@ -230,7 +232,7 @@ plug_in_progress_install (PlugIn *plug_in,
}
proc_frame->progress = g_object_new (GIMP_TYPE_PDB_PROGRESS,
"pdb", plug_in->gimp->pdb,
"pdb", plug_in->manager->gimp->pdb,
"context", proc_frame->main_context,
"callback-name", progress_callback,
NULL);
@ -288,11 +290,11 @@ plug_in_progress_message (PlugIn *plug_in,
if (proc_frame->progress)
{
gimp_progress_message (proc_frame->progress,
plug_in->gimp, domain, message);
plug_in->manager->gimp, domain, message);
}
else
{
gimp_message (plug_in->gimp, domain, message);
gimp_message (plug_in->manager->gimp, domain, message);
}
g_free (domain);

View File

@ -72,21 +72,20 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpenvirontable.h"
#include "core/gimpinterpreterdb.h"
#include "core/gimpprogress.h"
#include "pdb/gimptemporaryprocedure.h"
#include "gimpenvirontable.h"
#include "gimpinterpreterdb.h"
#include "gimpplugindebug.h"
#include "gimppluginmanager.h"
#include "gimppluginmanager-locale-domain.h"
#include "plug-in.h"
#include "plug-in-debug.h"
#include "plug-in-def.h"
#include "plug-in-locale-domain.h"
#include "plug-in-message.h"
#include "plug-in-params.h"
#include "plug-in-progress.h"
#include "plug-in-shm.h"
#include "plug-ins.h"
#include "gimp-intl.h"
@ -110,9 +109,9 @@ static void plug_in_prep_for_exec (gpointer data);
void
plug_in_init (Gimp *gimp)
plug_in_init (GimpPlugInManager *manager)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
/* initialize the gimp protocol library and set the read and
* write handlers.
@ -121,30 +120,16 @@ plug_in_init (Gimp *gimp)
gimp_wire_set_writer (plug_in_write);
gimp_wire_set_flusher (plug_in_flush);
/* allocate a piece of shared memory for use in transporting tiles
* 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 (gimp->use_shm)
plug_in_shm_init (gimp);
plug_in_debug_init (gimp);
}
void
plug_in_exit (Gimp *gimp)
plug_in_exit (GimpPlugInManager *manager)
{
GSList *list;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
plug_in_debug_exit (gimp);
if (gimp->use_shm)
plug_in_shm_exit (gimp);
list = gimp->open_plug_ins;
list = manager->open_plug_ins;
while (list)
{
PlugIn *plug_in = list->data;
@ -159,17 +144,17 @@ plug_in_exit (Gimp *gimp)
}
void
plug_in_call_query (Gimp *gimp,
GimpContext *context,
PlugInDef *plug_in_def)
plug_in_call_query (GimpPlugInManager *manager,
GimpContext *context,
PlugInDef *plug_in_def)
{
PlugIn *plug_in;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (GIMP_IS_CONTEXT (context));
g_return_if_fail (plug_in_def != NULL);
plug_in = plug_in_new (gimp, context, NULL, NULL, plug_in_def->prog);
plug_in = plug_in_new (manager, context, NULL, NULL, plug_in_def->prog);
if (plug_in)
{
@ -200,17 +185,17 @@ plug_in_call_query (Gimp *gimp,
}
void
plug_in_call_init (Gimp *gimp,
GimpContext *context,
PlugInDef *plug_in_def)
plug_in_call_init (GimpPlugInManager *manager,
GimpContext *context,
PlugInDef *plug_in_def)
{
PlugIn *plug_in;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (GIMP_IS_CONTEXT (context));
g_return_if_fail (plug_in_def != NULL);
plug_in = plug_in_new (gimp, context, NULL, NULL, plug_in_def->prog);
plug_in = plug_in_new (manager, context, NULL, NULL, plug_in_def->prog);
if (plug_in)
{
@ -241,15 +226,15 @@ plug_in_call_init (Gimp *gimp,
}
PlugIn *
plug_in_new (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpProcedure *procedure,
const gchar *prog)
plug_in_new (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpProcedure *procedure,
const gchar *prog)
{
PlugIn *plug_in;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
g_return_val_if_fail (prog != NULL, NULL);
@ -257,7 +242,7 @@ plug_in_new (Gimp *gimp,
plug_in = g_new0 (PlugIn, 1);
plug_in->gimp = gimp;
plug_in->manager = manager;
plug_in->ref_count = 1;
@ -347,21 +332,18 @@ plug_in_open (PlugIn *plug_in)
gint my_read[2];
gint my_write[2];
gchar **envp;
gchar *args[9], **argv, **debug_argv;
gchar *args[9], **argv;
gint argc;
gchar *interp, *interp_arg;
gchar *read_fd, *write_fd;
gchar *mode, *stm;
GError *error = NULL;
Gimp *gimp;
gboolean debug;
guint debug_flag;
guint spawn_flags;
g_return_val_if_fail (plug_in != NULL, FALSE);
gimp = plug_in->gimp;
/* Open two pipes. (Bidirectional communication).
*/
if ((pipe (my_read) == -1) || (pipe (my_write) == -1))
@ -427,9 +409,9 @@ plug_in_open (PlugIn *plug_in)
debug_flag = GIMP_DEBUG_WRAP_RUN;
}
stm = g_strdup_printf ("%d", plug_in->gimp->stack_trace_mode);
stm = g_strdup_printf ("%d", plug_in->manager->gimp->stack_trace_mode);
interp = gimp_interpreter_db_resolve (plug_in->gimp->interpreter_db,
interp = gimp_interpreter_db_resolve (plug_in->manager->interpreter_db,
plug_in->prog, &interp_arg);
argc = 0;
@ -449,16 +431,18 @@ plug_in_open (PlugIn *plug_in)
args[argc++] = NULL;
argv = args;
envp = gimp_environ_table_get_envp (plug_in->gimp->environ_table);
envp = gimp_environ_table_get_envp (plug_in->manager->environ_table);
spawn_flags = (G_SPAWN_LEAVE_DESCRIPTORS_OPEN |
G_SPAWN_DO_NOT_REAP_CHILD |
G_SPAWN_CHILD_INHERITS_STDIN);
debug = FALSE;
if (gimp->plug_in_debug)
if (plug_in->manager->debug)
{
debug_argv = plug_in_debug_argv (gimp, plug_in->name, debug_flag, args);
gchar **debug_argv = gimp_plug_in_debug_argv (plug_in->manager->debug,
plug_in->name,
debug_flag, args);
if (debug_argv)
{
@ -506,7 +490,8 @@ plug_in_open (PlugIn *plug_in)
plug_in->input_id = g_source_attach (source, NULL);
g_source_unref (source);
gimp->open_plug_ins = g_slist_prepend (gimp->open_plug_ins, plug_in);
plug_in->manager->open_plug_ins =
g_slist_prepend (plug_in->manager->open_plug_ins, plug_in);
}
plug_in->open = TRUE;
@ -529,7 +514,6 @@ void
plug_in_close (PlugIn *plug_in,
gboolean kill_it)
{
Gimp *gimp;
#ifndef G_OS_WIN32
gint status;
struct timeval tv;
@ -539,8 +523,6 @@ plug_in_close (PlugIn *plug_in,
g_return_if_fail (plug_in != NULL);
g_return_if_fail (plug_in->open == TRUE);
gimp = plug_in->gimp;
if (! plug_in->open)
return;
@ -568,7 +550,7 @@ plug_in_close (PlugIn *plug_in,
if (kill_it)
{
if (gimp->be_verbose)
if (plug_in->manager->gimp->be_verbose)
g_print (_("Terminating plug-in: '%s'\n"),
gimp_filename_to_utf8 (plug_in->prog));
@ -693,9 +675,10 @@ plug_in_close (PlugIn *plug_in,
plug_in_remove_temp_proc (plug_in, plug_in->temp_procedures->data);
/* Close any dialogs that this plugin might have opened */
gimp_pdb_dialogs_check (plug_in->gimp);
gimp_pdb_dialogs_check (plug_in->manager->gimp);
gimp->open_plug_ins = g_slist_remove (gimp->open_plug_ins, plug_in);
plug_in->manager->open_plug_ins =
g_slist_remove (plug_in->manager->open_plug_ins, plug_in);
}
static gboolean
@ -847,31 +830,31 @@ plug_in_flush (GIOChannel *channel,
}
void
plug_in_push (Gimp *gimp,
PlugIn *plug_in)
plug_in_push (GimpPlugInManager *manager,
PlugIn *plug_in)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (plug_in != NULL);
gimp->current_plug_in = plug_in;
manager->current_plug_in = plug_in;
gimp->plug_in_stack = g_slist_prepend (gimp->plug_in_stack,
gimp->current_plug_in);
manager->plug_in_stack = g_slist_prepend (manager->plug_in_stack,
manager->current_plug_in);
}
void
plug_in_pop (Gimp *gimp)
plug_in_pop (GimpPlugInManager *manager)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
if (gimp->current_plug_in)
gimp->plug_in_stack = g_slist_remove (gimp->plug_in_stack,
gimp->plug_in_stack->data);
if (manager->current_plug_in)
manager->plug_in_stack = g_slist_remove (manager->plug_in_stack,
manager->plug_in_stack->data);
if (gimp->plug_in_stack)
gimp->current_plug_in = gimp->plug_in_stack->data;
if (manager->plug_in_stack)
manager->current_plug_in = manager->plug_in_stack->data;
else
gimp->current_plug_in = NULL;
manager->current_plug_in = NULL;
}
PlugInProcFrame *
@ -936,9 +919,9 @@ plug_in_main_loop (PlugIn *plug_in)
proc_frame->main_loop = g_main_loop_new (NULL, FALSE);
gimp_threads_leave (plug_in->gimp);
gimp_threads_leave (plug_in->manager->gimp);
g_main_loop_run (proc_frame->main_loop);
gimp_threads_enter (plug_in->gimp);
gimp_threads_enter (plug_in->manager->gimp);
g_main_loop_unref (proc_frame->main_loop);
proc_frame->main_loop = NULL;
@ -975,8 +958,10 @@ plug_in_get_undo_desc (PlugIn *plug_in)
if (proc)
{
const gchar *domain = plug_in_locale_domain (plug_in->gimp,
plug_in->prog, NULL);
const gchar *domain;
domain = gimp_plug_in_manager_get_locale_domain (plug_in->manager,
plug_in->prog, NULL);
undo_desc = gimp_plug_in_procedure_get_label (proc, domain);
}
@ -1071,7 +1056,7 @@ plug_in_add_temp_proc (PlugIn *plug_in,
plug_in->temp_procedures = g_slist_prepend (plug_in->temp_procedures,
g_object_ref (proc));
plug_ins_temp_procedure_add (plug_in->gimp, proc);
gimp_plug_in_manager_add_temp_proc (plug_in->manager, proc);
}
void
@ -1083,6 +1068,6 @@ plug_in_remove_temp_proc (PlugIn *plug_in,
plug_in->temp_procedures = g_slist_remove (plug_in->temp_procedures,
proc);
plug_ins_temp_procedure_remove (plug_in->gimp, proc);
gimp_plug_in_manager_remove_temp_proc (plug_in->manager, proc);
g_object_unref (proc);
}

View File

@ -32,7 +32,7 @@
struct _PlugIn
{
Gimp *gimp;
GimpPlugInManager *manager;
gint ref_count;
@ -68,17 +68,17 @@ struct _PlugIn
};
void plug_in_init (Gimp *gimp);
void plug_in_exit (Gimp *gimp);
void plug_in_init (GimpPlugInManager *manager);
void plug_in_exit (GimpPlugInManager *manager);
void plug_in_call_query (Gimp *gimp,
void plug_in_call_query (GimpPlugInManager *manager,
GimpContext *context,
PlugInDef *plug_in_def);
void plug_in_call_init (Gimp *gimp,
void plug_in_call_init (GimpPlugInManager *manager,
GimpContext *context,
PlugInDef *plug_in_def);
PlugIn * plug_in_new (Gimp *gimp,
PlugIn * plug_in_new (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpProcedure *procedure,
@ -91,9 +91,9 @@ gboolean plug_in_open (PlugIn *plug_in);
void plug_in_close (PlugIn *plug_in,
gboolean kill_it);
void plug_in_push (Gimp *gimp,
PlugIn *plug_in);
void plug_in_pop (Gimp *gimp);
void plug_in_push (GimpPlugInManager *manager,
PlugIn *plug_in);
void plug_in_pop (GimpPlugInManager *manager);
PlugInProcFrame * plug_in_get_proc_frame (PlugIn *plug_in);

View File

@ -1,6 +1,8 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpplugindebug.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
@ -22,11 +24,9 @@
#include <glib-object.h>
#include "core/core-types.h"
#include "plug-in-types.h"
#include "core/gimp.h"
#include "plug-in-debug.h"
#include "gimpplugindebug.h"
struct _GimpPlugInDebug
@ -37,106 +37,92 @@ struct _GimpPlugInDebug
};
static const GDebugKey gimp_debug_wrap_keys[] = {
{"query", GIMP_DEBUG_WRAP_QUERY},
{"init", GIMP_DEBUG_WRAP_INIT},
{"run", GIMP_DEBUG_WRAP_RUN},
{"on", GIMP_DEBUG_WRAP_DEFAULT}
static const GDebugKey gimp_debug_wrap_keys[] =
{
{ "query", GIMP_DEBUG_WRAP_QUERY },
{ "init", GIMP_DEBUG_WRAP_INIT },
{ "run", GIMP_DEBUG_WRAP_RUN },
{ "on", GIMP_DEBUG_WRAP_DEFAULT }
};
void
plug_in_debug_init (Gimp *gimp)
GimpPlugInDebug *
gimp_plug_in_debug_new (void)
{
GimpPlugInDebug *dbg;
GimpPlugInDebug *debug;
const gchar *wrap, *wrapper;
gchar *debug_string;
gchar **args;
GError *error = NULL;
g_return_if_fail (GIMP_IS_GIMP (gimp));
wrap = g_getenv ("GIMP_PLUGIN_DEBUG_WRAP");
wrapper = g_getenv ("GIMP_PLUGIN_DEBUG_WRAPPER");
if (!(wrap && wrapper))
return;
return NULL;
if (!g_shell_parse_argv (wrapper, NULL, &args, &error))
{
g_warning ("Unable to parse debug wrapper: \"%s\"\n%s",
wrapper, error->message);
g_error_free (error);
return;
return NULL;
}
dbg = g_new (GimpPlugInDebug, 1);
debug = g_new (GimpPlugInDebug, 1);
dbg->args = args;
debug->args = args;
debug_string = strchr (wrap, ',');
if (debug_string)
{
dbg->name = g_strndup (wrap, debug_string - wrap);
dbg->flags = g_parse_debug_string (debug_string + 1,
gimp_debug_wrap_keys,
G_N_ELEMENTS (gimp_debug_wrap_keys));
debug->name = g_strndup (wrap, debug_string - wrap);
debug->flags = g_parse_debug_string (debug_string + 1,
gimp_debug_wrap_keys,
G_N_ELEMENTS (gimp_debug_wrap_keys));
}
else
{
dbg->name = g_strdup (wrap);
dbg->flags = GIMP_DEBUG_WRAP_DEFAULT;
debug->name = g_strdup (wrap);
debug->flags = GIMP_DEBUG_WRAP_DEFAULT;
}
gimp->plug_in_debug = dbg;
return debug;
}
void
plug_in_debug_exit (Gimp *gimp)
gimp_plug_in_debug_free (GimpPlugInDebug *debug)
{
GimpPlugInDebug *dbg;
g_return_if_fail (debug != NULL);
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (debug->name)
g_free (debug->name);
dbg = gimp->plug_in_debug;
if (debug->args)
g_strfreev (debug->args);
if (dbg == NULL)
return;
if (dbg->name)
g_free (dbg->name);
if (dbg->args)
g_strfreev (dbg->args);
g_free (dbg);
gimp->plug_in_debug = NULL;
g_free (debug);
}
gchar **
plug_in_debug_argv (Gimp *gimp,
const gchar *name,
GimpDebugWrapFlag flag,
gchar **args)
gimp_plug_in_debug_argv (GimpPlugInDebug *debug,
const gchar *name,
GimpDebugWrapFlag flag,
gchar **args)
{
GimpPlugInDebug *dbg;
GPtrArray *argv;
gchar **arg;
GPtrArray *argv;
gchar **arg;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (gimp->plug_in_debug != NULL, NULL);
g_return_val_if_fail (debug != NULL, NULL);
g_return_val_if_fail (args != NULL, NULL);
dbg = gimp->plug_in_debug;
if (!(dbg->flags & flag) || (strcmp (dbg->name, name) != 0))
if (!(debug->flags & flag) || (strcmp (debug->name, name) != 0))
return NULL;
argv = g_ptr_array_sized_new (8);
for (arg = gimp->plug_in_debug->args; *arg != NULL; arg++)
for (arg = debug->args; *arg != NULL; arg++)
g_ptr_array_add (argv, *arg);
for (arg = args; *arg != NULL; arg++)

View File

@ -1,6 +1,8 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpplugindebug.h
*
* 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
@ -16,8 +18,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PLUG_IN_DEBUG_H__
#define __PLUG_IN_DEBUG_H__
#ifndef __GIMP_PLUG_IN_DEBUG_H__
#define __GIMP_PLUG_IN_DEBUG_H__
typedef enum
@ -30,13 +32,13 @@ typedef enum
} GimpDebugWrapFlag;
void plug_in_debug_init (Gimp *gimp);
void plug_in_debug_exit (Gimp *gimp);
GimpPlugInDebug * gimp_plug_in_debug_new (void);
void gimp_plug_in_debug_free (GimpPlugInDebug *debug);
gchar **plug_in_debug_argv (Gimp *gimp,
const gchar *name,
GimpDebugWrapFlag flag,
gchar **args);
gchar ** gimp_plug_in_debug_argv (GimpPlugInDebug *debug,
const gchar *name,
GimpDebugWrapFlag flag,
gchar **args);
#endif /* __PLUG_IN_DEBUG_H__ */
#endif /* __GIMP_PLUG_IN_DEBUG_H__ */

View File

@ -38,11 +38,11 @@
#include "pdb/gimptemporaryprocedure.h"
#include "gimppluginmanager.h"
#include "plug-in.h"
#include "plug-in-params.h"
#define __YES_I_NEED_PLUG_IN_RUN__
#include "plug-in-run.h"
#include "plug-in-shm.h"
#include "gimp-intl.h"
@ -50,7 +50,7 @@
/* public functions */
GValueArray *
plug_in_run (Gimp *gimp,
plug_in_run (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpPlugInProcedure *procedure,
@ -62,19 +62,21 @@ plug_in_run (Gimp *gimp,
GValueArray *return_vals = NULL;
PlugIn *plug_in;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
g_return_val_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (procedure), NULL);
g_return_val_if_fail (args != NULL, NULL);
plug_in = plug_in_new (gimp, context, progress, GIMP_PROCEDURE (procedure),
plug_in = plug_in_new (manager, context, progress,
GIMP_PROCEDURE (procedure),
procedure->prog);
if (plug_in)
{
GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (gimp->config);
GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config);
GimpCoreConfig *core_config = manager->gimp->config;
GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (core_config);
GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (core_config);
GPConfig config;
GPProcRun proc_run;
gint monitor;
@ -88,7 +90,7 @@ plug_in_run (Gimp *gimp,
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.shm_ID = gimp_plug_in_manager_get_shm_ID (manager);
config.check_size = display_config->transparency_size;
config.check_type = display_config->transparency_type;
config.show_help_button = (gui_config->use_help &&
@ -98,13 +100,13 @@ plug_in_run (Gimp *gimp,
config.gimp_reserved_6 = 0;
config.gimp_reserved_7 = 0;
config.gimp_reserved_8 = 0;
config.install_cmap = gimp->config->install_cmap;
config.install_cmap = core_config->install_cmap;
config.show_tooltips = gui_config->show_tooltips;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.min_colors = CLAMP (core_config->min_colors, 27, 256);
config.gdisp_ID = display_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp,
config.wm_class = (gchar *) gimp_get_program_class (manager->gimp);
config.display_name = gimp_get_display_name (manager->gimp,
display_ID, &monitor);
config.monitor_number = monitor;
@ -137,9 +139,9 @@ plug_in_run (Gimp *gimp,
{
plug_in->ext_main_loop = g_main_loop_new (NULL, FALSE);
gimp_threads_leave (gimp);
gimp_threads_leave (manager->gimp);
g_main_loop_run (plug_in->ext_main_loop);
gimp_threads_enter (gimp);
gimp_threads_enter (manager->gimp);
/* main_loop is quit in plug_in_handle_extension_ack() */
@ -156,9 +158,9 @@ plug_in_run (Gimp *gimp,
proc_frame->main_loop = g_main_loop_new (NULL, FALSE);
gimp_threads_leave (gimp);
gimp_threads_leave (manager->gimp);
g_main_loop_run (proc_frame->main_loop);
gimp_threads_enter (gimp);
gimp_threads_enter (manager->gimp);
/* main_loop is quit in plug_in_handle_proc_return() */
@ -182,7 +184,7 @@ plug_in_run (Gimp *gimp,
}
GValueArray *
plug_in_run_temp (Gimp *gimp,
plug_in_run_temp (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpTemporaryProcedure *procedure,
@ -191,7 +193,7 @@ plug_in_run_temp (Gimp *gimp,
GValueArray *return_vals = NULL;
PlugIn *plug_in;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
g_return_val_if_fail (GIMP_IS_TEMPORARY_PROCEDURE (procedure), NULL);

View File

@ -28,7 +28,7 @@
/* Run a plug-in as if it were a procedure database procedure
*/
GValueArray * plug_in_run (Gimp *gimp,
GValueArray * plug_in_run (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpPlugInProcedure *procedure,
@ -39,7 +39,7 @@ GValueArray * plug_in_run (Gimp *gimp,
/* Run a temp plug-in proc as if it were a procedure database procedure
*/
GValueArray * plug_in_run_temp (Gimp *gimp,
GValueArray * plug_in_run_temp (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpTemporaryProcedure *procedure,

View File

@ -1,6 +1,8 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimppluginmanager-data.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
@ -24,14 +26,13 @@
#include "plug-in-types.h"
#include "core/gimp.h"
#include "plug-in-data.h"
#include "gimppluginmanager.h"
#include "gimppluginmanager-data.h"
typedef struct _PlugInData PlugInData;
typedef struct _GimpPlugInData GimpPlugInData;
struct _PlugInData
struct _GimpPlugInData
{
gchar *identifier;
gint32 bytes;
@ -42,45 +43,45 @@ struct _PlugInData
/* public functions */
void
plug_in_data_free (Gimp *gimp)
gimp_plug_in_manager_data_free (GimpPlugInManager *manager)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
if (gimp->plug_in_data_list)
if (manager->data_list)
{
GList *list;
for (list = gimp->plug_in_data_list;
for (list = manager->data_list;
list;
list = g_list_next (list))
{
PlugInData *data = list->data;
GimpPlugInData *data = list->data;
g_free (data->identifier);
g_free (data->data);
g_free (data);
}
g_list_free (gimp->plug_in_data_list);
gimp->plug_in_data_list = NULL;
g_list_free (manager->data_list);
manager->data_list = NULL;
}
}
void
plug_in_data_set (Gimp *gimp,
const gchar *identifier,
gint32 bytes,
const guint8 *data)
gimp_plug_in_manager_set_data (GimpPlugInManager *manager,
const gchar *identifier,
gint32 bytes,
const guint8 *data)
{
GList *list;
PlugInData *plug_in_data;
GimpPlugInData *plug_in_data;
GList *list;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (identifier != NULL);
g_return_if_fail (bytes > 0);
g_return_if_fail (data != NULL);
for (list = gimp->plug_in_data_list; list; list = g_list_next (list))
for (list = manager->data_list; list; list = g_list_next (list))
{
plug_in_data = list->data;
@ -91,11 +92,10 @@ plug_in_data_set (Gimp *gimp,
/* If there isn't already data with the specified identifier, create one */
if (list == NULL)
{
plug_in_data = g_new0 (PlugInData, 1);
plug_in_data = g_new0 (GimpPlugInData, 1);
plug_in_data->identifier = g_strdup (identifier);
gimp->plug_in_data_list = g_list_prepend (gimp->plug_in_data_list,
plug_in_data);
manager->data_list = g_list_prepend (manager->data_list, plug_in_data);
}
else
{
@ -107,21 +107,21 @@ plug_in_data_set (Gimp *gimp,
}
const guint8 *
plug_in_data_get (Gimp *gimp,
const gchar *identifier,
gint32 *bytes)
gimp_plug_in_manager_get_data (GimpPlugInManager *manager,
const gchar *identifier,
gint32 *bytes)
{
GList *list;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
g_return_val_if_fail (identifier != NULL, NULL);
g_return_val_if_fail (bytes != NULL, NULL);
*bytes = 0;
for (list = gimp->plug_in_data_list; list; list = g_list_next (list))
for (list = manager->data_list; list; list = g_list_next (list))
{
PlugInData *plug_in_data = list->data;
GimpPlugInData *plug_in_data = list->data;
if (! strcmp (plug_in_data->identifier, identifier))
{

View File

@ -1,6 +1,8 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimppluginmanager-data.h
*
* 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
@ -16,19 +18,19 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PLUG_IN_DATA_H__
#define __PLUG_IN_DATA_H__
#ifndef __GIMP_PLUG_IN_MANAGER_DATA_H__
#define __GIMP_PLUG_IN_MANAGER_DATA_H__
void plug_in_data_free (Gimp *gimp);
void gimp_plug_in_manager_data_free (GimpPlugInManager *manager);
void plug_in_data_set (Gimp *gimp,
const gchar *identifier,
gint32 bytes,
const guint8 *data);
const guint8 * plug_in_data_get (Gimp *gimp,
const gchar *identifier,
gint32 *bytes);
void gimp_plug_in_manager_set_data (GimpPlugInManager *manager,
const gchar *identifier,
gint32 bytes,
const guint8 *data);
const guint8 * gimp_plug_in_manager_get_data (GimpPlugInManager *manager,
const gchar *identifier,
gint32 *bytes);
#endif /* __PLUG_IN_DATA_H__ */
#endif /* __GIMP_PLUG_IN_MANAGER_DATA_H__ */

View File

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-file.c
* 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
@ -30,31 +30,32 @@
#include "pdb/gimp-pdb.h"
#include "pdb/gimppluginprocedure.h"
#include "gimppluginmanager.h"
#include "gimppluginmanager-file.h"
#include "plug-in.h"
#include "plug-in-def.h"
#include "plug-in-file.h"
/* public functions */
gboolean
plug_in_file_register_load_handler (Gimp *gimp,
const gchar *name,
const gchar *extensions,
const gchar *prefixes,
const gchar *magics)
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_GIMP (gimp), FALSE);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), FALSE);
g_return_val_if_fail (name != NULL, FALSE);
if (gimp->current_plug_in && gimp->current_plug_in->plug_in_def)
list = gimp->current_plug_in->plug_in_def->procedures;
if (manager->current_plug_in && manager->current_plug_in->plug_in_def)
list = manager->current_plug_in->plug_in_def->procedures;
else
list = gimp->plug_in_procedures;
list = manager->plug_in_procedures;
file_proc = gimp_plug_in_procedure_find (list, name);
@ -82,29 +83,29 @@ plug_in_file_register_load_handler (Gimp *gimp,
gimp_plug_in_procedure_set_file_proc (file_proc,
extensions, prefixes, magics);
if (! g_slist_find (gimp->load_procs, file_proc))
gimp->load_procs = g_slist_prepend (gimp->load_procs, file_proc);
if (! g_slist_find (manager->load_procs, file_proc))
manager->load_procs = g_slist_prepend (manager->load_procs, file_proc);
return TRUE;
}
gboolean
plug_in_file_register_save_handler (Gimp *gimp,
const gchar *name,
const gchar *extensions,
const gchar *prefixes)
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_GIMP (gimp), FALSE);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), FALSE);
g_return_val_if_fail (name != NULL, FALSE);
if (gimp->current_plug_in && gimp->current_plug_in->plug_in_def)
list = gimp->current_plug_in->plug_in_def->procedures;
if (manager->current_plug_in && manager->current_plug_in->plug_in_def)
list = manager->current_plug_in->plug_in_def->procedures;
else
list = gimp->plug_in_procedures;
list = manager->plug_in_procedures;
file_proc = gimp_plug_in_procedure_find (list, name);
@ -132,28 +133,28 @@ plug_in_file_register_save_handler (Gimp *gimp,
gimp_plug_in_procedure_set_file_proc (file_proc,
extensions, prefixes, NULL);
if (! g_slist_find (gimp->save_procs, file_proc))
gimp->save_procs = g_slist_prepend (gimp->save_procs, file_proc);
if (! g_slist_find (manager->save_procs, file_proc))
manager->save_procs = g_slist_prepend (manager->save_procs, file_proc);
return TRUE;
}
gboolean
plug_in_file_register_mime_type (Gimp *gimp,
const gchar *name,
const gchar *mime_type)
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_GIMP (gimp), FALSE);
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 (gimp->current_plug_in && gimp->current_plug_in->plug_in_def)
list = gimp->current_plug_in->plug_in_def->procedures;
if (manager->current_plug_in && manager->current_plug_in->plug_in_def)
list = manager->current_plug_in->plug_in_def->procedures;
else
list = gimp->plug_in_procedures;
list = manager->plug_in_procedures;
file_proc = gimp_plug_in_procedure_find (list, name);
@ -166,21 +167,21 @@ plug_in_file_register_mime_type (Gimp *gimp,
}
gboolean
plug_in_file_register_thumb_loader (Gimp *gimp,
const gchar *load_proc,
const gchar *thumb_proc)
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_GIMP (gimp), FALSE);
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 (gimp->current_plug_in && gimp->current_plug_in->plug_in_def)
list = gimp->current_plug_in->plug_in_def->procedures;
if (manager->current_plug_in && manager->current_plug_in->plug_in_def)
list = manager->current_plug_in->plug_in_def->procedures;
else
list = gimp->plug_in_procedures;
list = manager->plug_in_procedures;
file_proc = gimp_plug_in_procedure_find (list, load_proc);

View File

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-file.h
* gimppluginmanager-file.h
*
* 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
@ -18,27 +18,27 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PLUG_IN_FILE_H__
#define __PLUG_IN_FILE_H__
#ifndef __GIMP_PLUG_IN_MANAGER_FILE_H__
#define __GIMP_PLUG_IN_MANAGER_FILE_H__
gboolean plug_in_file_register_load_handler (Gimp *gimp,
const gchar *name,
const gchar *extensions,
const gchar *prefixes,
const gchar *magics);
gboolean plug_in_file_register_save_handler (Gimp *gimp,
const gchar *name,
const gchar *extensions,
const gchar *prefixes);
gboolean gimp_plug_in_manager_register_load_handler (GimpPlugInManager *manager,
const gchar *name,
const gchar *extensions,
const gchar *prefixes,
const gchar *magics);
gboolean gimp_plug_in_manager_register_save_handler (GimpPlugInManager *manager,
const gchar *name,
const gchar *extensions,
const gchar *prefixes);
gboolean plug_in_file_register_mime_type (Gimp *gimp,
const gchar *name,
const gchar *mime_type);
gboolean gimp_plug_in_manager_register_mime_type (GimpPlugInManager *manager,
const gchar *name,
const gchar *mime_type);
gboolean plug_in_file_register_thumb_loader (Gimp *gimp,
const gchar *load_proc,
const gchar *thumb_proc);
gboolean gimp_plug_in_manager_register_thumb_loader (GimpPlugInManager *manager,
const gchar *load_proc,
const gchar *thumb_proc);
#endif /* __PLUG_IN_FILE_H__ */
#endif /* __GIMP_PLUG_IN_MANAGER_FILE_H__ */

View File

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-help-domain.c
* gimppluginmanager-help-domain.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
@ -26,14 +26,13 @@
#include "plug-in-types.h"
#include "core/gimp.h"
#include "plug-in-help-domain.h"
#include "gimppluginmanager.h"
#include "gimppluginmanager-help-domain.h"
typedef struct _PlugInHelpDomain PlugInHelpDomain;
typedef struct _GimpPlugInHelpDomain GimpPlugInHelpDomain;
struct _PlugInHelpDomain
struct _GimpPlugInHelpDomain
{
gchar *prog_name;
gchar *domain_name;
@ -42,15 +41,15 @@ struct _PlugInHelpDomain
void
plug_in_help_domain_exit (Gimp *gimp)
gimp_plug_in_manager_help_domain_exit (GimpPlugInManager *manager)
{
GSList *list;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
for (list = gimp->plug_in_help_domains; list; list = list->next)
for (list = manager->help_domains; list; list = list->next)
{
PlugInHelpDomain *domain = list->data;
GimpPlugInHelpDomain *domain = list->data;
g_free (domain->prog_name);
g_free (domain->domain_name);
@ -58,30 +57,29 @@ plug_in_help_domain_exit (Gimp *gimp)
g_free (domain);
}
g_slist_free (gimp->plug_in_help_domains);
gimp->plug_in_help_domains = NULL;
g_slist_free (manager->help_domains);
manager->help_domains = NULL;
}
void
plug_in_help_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_uri)
gimp_plug_in_manager_add_help_domain (GimpPlugInManager *manager,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_uri)
{
PlugInHelpDomain *domain;
GimpPlugInHelpDomain *domain;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (prog_name != NULL);
g_return_if_fail (domain_name != NULL);
domain = g_new (PlugInHelpDomain, 1);
domain = g_new (GimpPlugInHelpDomain, 1);
domain->prog_name = g_strdup (prog_name);
domain->domain_name = g_strdup (domain_name);
domain->domain_uri = g_strdup (domain_uri);
gimp->plug_in_help_domains = g_slist_prepend (gimp->plug_in_help_domains,
domain);
manager->help_domains = g_slist_prepend (manager->help_domains, domain);
#ifdef VERBOSE
g_print ("added help domain \"%s\" for base uri \"%s\"\n",
@ -91,13 +89,13 @@ plug_in_help_domain_add (Gimp *gimp,
}
const gchar *
plug_in_help_domain (Gimp *gimp,
const gchar *prog_name,
const gchar **domain_uri)
gimp_plug_in_manager_get_help_domain (GimpPlugInManager *manager,
const gchar *prog_name,
const gchar **domain_uri)
{
GSList *list;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
if (domain_uri)
*domain_uri = NULL;
@ -106,9 +104,9 @@ plug_in_help_domain (Gimp *gimp,
if (! prog_name)
return NULL;
for (list = gimp->plug_in_help_domains; list; list = list->next)
for (list = manager->help_domains; list; list = list->next)
{
PlugInHelpDomain *domain = list->data;
GimpPlugInHelpDomain *domain = list->data;
if (domain && domain->prog_name &&
! strcmp (domain->prog_name, prog_name))
@ -124,26 +122,26 @@ plug_in_help_domain (Gimp *gimp,
}
gint
plug_in_help_domains (Gimp *gimp,
gchar ***help_domains,
gchar ***help_uris)
gimp_plug_in_manager_get_help_domains (GimpPlugInManager *manager,
gchar ***help_domains,
gchar ***help_uris)
{
GSList *list;
gint n_domains;
gint i;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), 0);
g_return_val_if_fail (help_domains != NULL, 0);
g_return_val_if_fail (help_uris != NULL, 0);
n_domains = g_slist_length (gimp->plug_in_help_domains);
n_domains = g_slist_length (manager->help_domains);
*help_domains = g_new0 (gchar *, n_domains);
*help_uris = g_new0 (gchar *, n_domains);
for (list = gimp->plug_in_help_domains, i = 0; list; list = list->next, i++)
for (list = manager->help_domains, i = 0; list; list = list->next, i++)
{
PlugInHelpDomain *domain = list->data;
GimpPlugInHelpDomain *domain = list->data;
(*help_domains)[i] = g_strdup (domain->domain_name);
(*help_uris)[i] = g_strdup (domain->domain_uri);

View File

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-help-domain.h
* gimppluginmanager-help-domain.h
*
* 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
@ -18,27 +18,27 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PLUG_IN_HELP_DOMAIN_H__
#define __PLUG_IN_HELP_DOMAIN_H__
#ifndef __GIMP_PLUG_IN_MANAGER_HELP_DOMAIN_H__
#define __GIMP_PLUG_IN_MANAGER_HELP_DOMAIN_H__
void plug_in_help_domain_exit (Gimp *gimp);
void gimp_plug_in_manager_help_domain_exit (GimpPlugInManager *manager);
/* Add a help domain */
void plug_in_help_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_uri);
void gimp_plug_in_manager_add_help_domain (GimpPlugInManager *manager,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_uri);
/* Retrieve a plug-ins help domain */
const gchar * plug_in_help_domain (Gimp *gimp,
const gchar *prog_name,
const gchar **help_uri);
const gchar * gimp_plug_in_manager_get_help_domain (GimpPlugInManager *manager,
const gchar *prog_name,
const gchar **help_uri);
/* Retrieve all help domains */
gint plug_in_help_domains (Gimp *gimp,
gchar ***help_domains,
gchar ***help_uris);
gint gimp_plug_in_manager_get_help_domains (GimpPlugInManager *manager,
gchar ***help_domains,
gchar ***help_uris);
#endif /* __PLUG_INS_HELP_DOMAIN_H__ */
#endif /* __GIMP_PLUG_IN_MANAGER_HELP_DOMAIN_H__ */

View File

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-locale-domain.c
* gimppluginmanager-locale-domain.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
@ -28,17 +28,16 @@
#include "plug-in-types.h"
#include "core/gimp.h"
#include "plug-in-locale-domain.h"
#include "gimppluginmanager.h"
#include "gimppluginmanager-locale-domain.h"
#define STD_PLUG_INS_LOCALE_DOMAIN GETTEXT_PACKAGE "-std-plug-ins"
typedef struct _PlugInLocaleDomain PlugInLocaleDomain;
typedef struct _GimpPlugInLocaleDomain GimpPlugInLocaleDomain;
struct _PlugInLocaleDomain
struct _GimpPlugInLocaleDomain
{
gchar *prog_name;
gchar *domain_name;
@ -47,15 +46,15 @@ struct _PlugInLocaleDomain
void
plug_in_locale_domain_exit (Gimp *gimp)
gimp_plug_in_manager_locale_domain_exit (GimpPlugInManager *manager)
{
GSList *list;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
for (list = gimp->plug_in_locale_domains; list; list = list->next)
for (list = manager->locale_domains; list; list = list->next)
{
PlugInLocaleDomain *domain = list->data;
GimpPlugInLocaleDomain *domain = list->data;
g_free (domain->prog_name);
g_free (domain->domain_name);
@ -63,30 +62,29 @@ plug_in_locale_domain_exit (Gimp *gimp)
g_free (domain);
}
g_slist_free (gimp->plug_in_locale_domains);
gimp->plug_in_locale_domains = NULL;
g_slist_free (manager->locale_domains);
manager->locale_domains = NULL;
}
void
plug_in_locale_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_path)
gimp_plug_in_manager_add_locale_domain (GimpPlugInManager *manager,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_path)
{
PlugInLocaleDomain *domain;
GimpPlugInLocaleDomain *domain;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (prog_name != NULL);
g_return_if_fail (domain_name != NULL);
domain = g_new (PlugInLocaleDomain, 1);
domain = g_new (GimpPlugInLocaleDomain, 1);
domain->prog_name = g_strdup (prog_name);
domain->domain_name = g_strdup (domain_name);
domain->domain_path = g_strdup (domain_path);
gimp->plug_in_locale_domains = g_slist_prepend (gimp->plug_in_locale_domains,
domain);
manager->locale_domains = g_slist_prepend (manager->locale_domains, domain);
#ifdef VERBOSE
g_print ("added locale domain \"%s\" for path \"%s\"\n",
@ -97,13 +95,13 @@ plug_in_locale_domain_add (Gimp *gimp,
}
const gchar *
plug_in_locale_domain (Gimp *gimp,
const gchar *prog_name,
const gchar **domain_path)
gimp_plug_in_manager_get_locale_domain (GimpPlugInManager *manager,
const gchar *prog_name,
const gchar **domain_path)
{
GSList *list;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
if (domain_path)
*domain_path = gimp_locale_directory ();
@ -112,9 +110,9 @@ plug_in_locale_domain (Gimp *gimp,
if (! prog_name)
return NULL;
for (list = gimp->plug_in_locale_domains; list; list = list->next)
for (list = manager->locale_domains; list; list = list->next)
{
PlugInLocaleDomain *domain = list->data;
GimpPlugInLocaleDomain *domain = list->data;
if (domain && domain->prog_name &&
! strcmp (domain->prog_name, prog_name))
@ -130,23 +128,23 @@ plug_in_locale_domain (Gimp *gimp,
}
gint
plug_in_locale_domains (Gimp *gimp,
gchar ***locale_domains,
gchar ***locale_paths)
gimp_plug_in_manager_get_locale_domains (GimpPlugInManager *manager,
gchar ***locale_domains,
gchar ***locale_paths)
{
GSList *list;
GSList *unique = NULL;
gint n_domains;
gint i;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), 0);
g_return_val_if_fail (locale_domains != NULL, 0);
g_return_val_if_fail (locale_paths != NULL, 0);
for (list = gimp->plug_in_locale_domains; list; list = list->next)
for (list = manager->locale_domains; list; list = list->next)
{
PlugInLocaleDomain *domain = list->data;
GSList *tmp;
GimpPlugInLocaleDomain *domain = list->data;
GSList *tmp;
for (tmp = unique; tmp; tmp = tmp->next)
if (! strcmp (domain->domain_name, (const gchar *) tmp->data))
@ -168,7 +166,7 @@ plug_in_locale_domains (Gimp *gimp,
for (list = unique, i = 1; list; list = list->next, i++)
{
PlugInLocaleDomain *domain = list->data;
GimpPlugInLocaleDomain *domain = list->data;
(*locale_domains)[i] = g_strdup (domain->domain_name);
(*locale_paths)[i] = (domain->domain_path ?

View File

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-locale-domain.h
* gimppluginmanager-locale-domain.h
*
* 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
@ -18,27 +18,27 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PLUG_IN_LOCALE_DOMAIN_H__
#define __PLUG_IN_LOCALE_DOMAIN_H__
#ifndef __GIMP_PLUG_IN_MANAGER_LOCALE_DOMAIN_H__
#define __GIMP_PLUG_IN_MANAGER_LOCALE_DOMAIN_H__
void plug_in_locale_domain_exit (Gimp *gimp);
void gimp_plug_in_manager_locale_domain_exit (GimpPlugInManager *manager);
/* Add a locale domain */
void plug_in_locale_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_path);
void gimp_plug_in_manager_add_locale_domain (GimpPlugInManager *manager,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_path);
/* Retrieve a plug-ins locale domain */
const gchar * plug_in_locale_domain (Gimp *gimp,
const gchar *prog_name,
const gchar **locale_path);
const gchar * gimp_plug_in_manager_get_locale_domain (GimpPlugInManager *manager,
const gchar *prog_name,
const gchar **locale_path);
/* Retrieve all help domains */
gint plug_in_locale_domains (Gimp *gimp,
gchar ***locale_domains,
gchar ***locale_paths);
gint gimp_plug_in_manager_get_locale_domains (GimpPlugInManager *manager,
gchar ***locale_domains,
gchar ***locale_paths);
#endif /* __PLUG_IN_LOCALE_DOMAIN_H__ */
#endif /* __GIMP_PLUG_IN_MANAGER_LOCALE_DOMAIN_H__ */

View File

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-menu-branch.c
* gimppluginmanager-menu-branch.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
@ -24,23 +24,22 @@
#include "plug-in-types.h"
#include "core/gimp.h"
#include "plug-in-menu-branch.h"
#include "gimppluginmanager.h"
#include "gimppluginmanager-menu-branch.h"
/* public functions */
void
plug_in_menu_branch_exit (Gimp *gimp)
gimp_plug_in_manager_menu_branch_exit (GimpPlugInManager *manager)
{
GSList *list;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
for (list = gimp->plug_in_menu_branches; list; list = list->next)
for (list = manager->menu_branches; list; list = list->next)
{
PlugInMenuBranch *branch = list->data;
GimpPlugInMenuBranch *branch = list->data;
g_free (branch->prog_name);
g_free (branch->menu_path);
@ -48,34 +47,33 @@ plug_in_menu_branch_exit (Gimp *gimp)
g_free (branch);
}
g_slist_free (gimp->plug_in_menu_branches);
gimp->plug_in_menu_branches = NULL;
g_slist_free (manager->menu_branches);
manager->menu_branches = NULL;
}
void
plug_in_menu_branch_add (Gimp *gimp,
const gchar *prog_name,
const gchar *menu_path,
const gchar *menu_label)
gimp_plug_in_manager_add_menu_branch (GimpPlugInManager *manager,
const gchar *prog_name,
const gchar *menu_path,
const gchar *menu_label)
{
PlugInMenuBranch *branch;
GimpPlugInMenuBranch *branch;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (prog_name != NULL);
g_return_if_fail (menu_path != NULL);
g_return_if_fail (menu_label != NULL);
if (! gimp->no_interface)
gimp_menus_create_branch (gimp, prog_name, menu_path, menu_label);
branch = g_new (PlugInMenuBranch, 1);
branch = g_new (GimpPlugInMenuBranch, 1);
branch->prog_name = g_strdup (prog_name);
branch->menu_path = g_strdup (menu_path);
branch->menu_label = g_strdup (menu_label);
gimp->plug_in_menu_branches = g_slist_append (gimp->plug_in_menu_branches,
branch);
manager->menu_branches = g_slist_append (manager->menu_branches, branch);
g_signal_emit_by_name (manager, "menu-branch-added",
prog_name, menu_path, menu_label);
#ifdef VERBOSE
g_print ("added menu branch \"%s\" at path \"%s\"\n",

View File

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-menu-branch.h
* gimppluginmanager-menu-branch.h
*
* 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
@ -18,11 +18,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PLUG_IN_MENU_BRANCH_H__
#define __PLUG_IN_MENU_BRANCH_H__
#ifndef __GIMP_PLUG_IN_MANAGER_MENU_BRANCH_H__
#define __GIMP_PLUG_IN_MANAGER_MENU_BRANCH_H__
struct _PlugInMenuBranch
struct _GimpPlugInMenuBranch
{
gchar *prog_name;
gchar *menu_path;
@ -30,13 +30,13 @@ struct _PlugInMenuBranch
};
void plug_in_menu_branch_exit (Gimp *gimp);
void gimp_plug_in_manager_menu_branch_exit (GimpPlugInManager *manager);
/* Add a menu branch */
void plug_in_menu_branch_add (Gimp *gimp,
const gchar *prog_name,
const gchar *menu_path,
const gchar *menu_label);
void gimp_plug_in_manager_add_menu_branch (GimpPlugInManager *manager,
const gchar *prog_name,
const gchar *menu_path,
const gchar *menu_label);
#endif /* __PLUG_IN_MENU_BRANCH_H__ */
#endif /* __GIMP_PLUG_IN_MANAGER_MENU_BRANCH_H__ */

View File

@ -34,10 +34,11 @@
#include "plug-in-types.h"
#include "core/gimp.h"
#include "pdb/gimppluginprocedure.h"
#include "gimppluginmanager.h"
#include "gimppluginmanager-query.h"
static int
match_strings (regex_t *preg,
@ -47,14 +48,14 @@ match_strings (regex_t *preg,
}
gint
plug_ins_query (Gimp *gimp,
const gchar *search_str,
gchar ***menu_strs,
gchar ***accel_strs,
gchar ***prog_strs,
gchar ***types_strs,
gchar ***realname_strs,
gint32 **time_ints)
gimp_plug_in_manager_query (GimpPlugInManager *manager,
const gchar *search_str,
gchar ***menu_strs,
gchar ***accel_strs,
gchar ***prog_strs,
gchar ***types_strs,
gchar ***realname_strs,
gint32 **time_ints)
{
gint32 num_plugins = 0;
GSList *list;
@ -62,7 +63,7 @@ plug_ins_query (Gimp *gimp,
gint i = 0;
regex_t sregex;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), 0);
g_return_val_if_fail (menu_strs != NULL, 0);
g_return_val_if_fail (accel_strs != NULL, 0);
g_return_val_if_fail (prog_strs != NULL, 0);
@ -87,7 +88,7 @@ plug_ins_query (Gimp *gimp,
* where we can store the strings.
*/
for (list = gimp->plug_in_procedures; list; list = g_slist_next (list))
for (list = manager->plug_in_procedures; list; list = g_slist_next (list))
{
GimpPlugInProcedure *proc = list->data;

View File

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-ins-query.h
* gimppluginmanager-query.h
*
* 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
@ -18,18 +18,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PLUG_INS_QUERY_H__
#define __PLUG_INS_QUERY_H__
#ifndef __GIMP_PLUG_IN_MANAGER_QUERY_H__
#define __GIMP_PLUG_IN_MANAGER_QUERY_H__
gint plug_ins_query (Gimp *gimp,
const gchar *search_str,
gchar ***menu_strs,
gchar ***accel_strs,
gchar ***prog_strs,
gchar ***types_strs,
gchar ***realname_strs,
gint32 **time_ints);
gint gimp_plug_in_manager_query (GimpPlugInManager *manager,
const gchar *search_str,
gchar ***menu_strs,
gchar ***accel_strs,
gchar ***prog_strs,
gchar ***types_strs,
gchar ***realname_strs,
gint32 **time_ints);
#endif /* __PLUG_INS_QUERY_H__ */
#endif /* __GIMP_PLUG_IN_MANAGER_QUERY_H__ */

View File

@ -38,11 +38,11 @@
#include "pdb/gimptemporaryprocedure.h"
#include "gimppluginmanager.h"
#include "plug-in.h"
#include "plug-in-params.h"
#define __YES_I_NEED_PLUG_IN_RUN__
#include "plug-in-run.h"
#include "plug-in-shm.h"
#include "gimp-intl.h"
@ -50,7 +50,7 @@
/* public functions */
GValueArray *
plug_in_run (Gimp *gimp,
plug_in_run (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpPlugInProcedure *procedure,
@ -62,19 +62,21 @@ plug_in_run (Gimp *gimp,
GValueArray *return_vals = NULL;
PlugIn *plug_in;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
g_return_val_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (procedure), NULL);
g_return_val_if_fail (args != NULL, NULL);
plug_in = plug_in_new (gimp, context, progress, GIMP_PROCEDURE (procedure),
plug_in = plug_in_new (manager, context, progress,
GIMP_PROCEDURE (procedure),
procedure->prog);
if (plug_in)
{
GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (gimp->config);
GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config);
GimpCoreConfig *core_config = manager->gimp->config;
GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (core_config);
GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (core_config);
GPConfig config;
GPProcRun proc_run;
gint monitor;
@ -88,7 +90,7 @@ plug_in_run (Gimp *gimp,
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.shm_ID = gimp_plug_in_manager_get_shm_ID (manager);
config.check_size = display_config->transparency_size;
config.check_type = display_config->transparency_type;
config.show_help_button = (gui_config->use_help &&
@ -98,13 +100,13 @@ plug_in_run (Gimp *gimp,
config.gimp_reserved_6 = 0;
config.gimp_reserved_7 = 0;
config.gimp_reserved_8 = 0;
config.install_cmap = gimp->config->install_cmap;
config.install_cmap = core_config->install_cmap;
config.show_tooltips = gui_config->show_tooltips;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.min_colors = CLAMP (core_config->min_colors, 27, 256);
config.gdisp_ID = display_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp,
config.wm_class = (gchar *) gimp_get_program_class (manager->gimp);
config.display_name = gimp_get_display_name (manager->gimp,
display_ID, &monitor);
config.monitor_number = monitor;
@ -137,9 +139,9 @@ plug_in_run (Gimp *gimp,
{
plug_in->ext_main_loop = g_main_loop_new (NULL, FALSE);
gimp_threads_leave (gimp);
gimp_threads_leave (manager->gimp);
g_main_loop_run (plug_in->ext_main_loop);
gimp_threads_enter (gimp);
gimp_threads_enter (manager->gimp);
/* main_loop is quit in plug_in_handle_extension_ack() */
@ -156,9 +158,9 @@ plug_in_run (Gimp *gimp,
proc_frame->main_loop = g_main_loop_new (NULL, FALSE);
gimp_threads_leave (gimp);
gimp_threads_leave (manager->gimp);
g_main_loop_run (proc_frame->main_loop);
gimp_threads_enter (gimp);
gimp_threads_enter (manager->gimp);
/* main_loop is quit in plug_in_handle_proc_return() */
@ -182,7 +184,7 @@ plug_in_run (Gimp *gimp,
}
GValueArray *
plug_in_run_temp (Gimp *gimp,
plug_in_run_temp (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpTemporaryProcedure *procedure,
@ -191,7 +193,7 @@ plug_in_run_temp (Gimp *gimp,
GValueArray *return_vals = NULL;
PlugIn *plug_in;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
g_return_val_if_fail (GIMP_IS_TEMPORARY_PROCEDURE (procedure), NULL);

View File

@ -28,7 +28,7 @@
/* Run a plug-in as if it were a procedure database procedure
*/
GValueArray * plug_in_run (Gimp *gimp,
GValueArray * plug_in_run (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpPlugInProcedure *procedure,
@ -39,7 +39,7 @@ GValueArray * plug_in_run (Gimp *gimp,
/* Run a temp plug-in proc as if it were a procedure database procedure
*/
GValueArray * plug_in_run_temp (Gimp *gimp,
GValueArray * plug_in_run_temp (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpTemporaryProcedure *procedure,

View File

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
* Copyright (C) 1995-2002 Spencer Kimball, Peter Mattis, and others
*
* plug-ins.c
* gimppluginmanager.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
@ -25,7 +25,6 @@
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpbase/gimpprotocol.h"
#include "libgimpconfig/gimpconfig.h"
#include "plug-in-types.h"
@ -33,71 +32,259 @@
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimp-utils.h"
#include "core/gimpcontext.h"
#include "core/gimpmarshal.h"
#include "pdb/gimppdb.h"
#include "pdb/gimptemporaryprocedure.h"
#include "gimpenvirontable.h"
#include "gimpinterpreterdb.h"
#include "gimpplugindebug.h"
#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"
#include "plug-in.h"
#include "plug-in-data.h"
#include "plug-in-def.h"
#include "plug-in-help-domain.h"
#include "plug-in-locale-domain.h"
#include "plug-in-menu-branch.h"
#include "plug-in-rc.h"
#include "plug-ins.h"
#include "gimp-intl.h"
/* local function prototypes */
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,
GimpPlugInProcedure *proc);
static gint plug_ins_file_proc_compare (gconstpointer a,
gconstpointer b,
gpointer data);
enum
{
MENU_BRANCH_ADDED,
LAST_PLUG_INS_CHANGED,
LAST_SIGNAL
};
/* public functions */
static void gimp_plug_in_manager_finalize (GObject *object);
static gint64 gimp_plug_in_manager_get_memsize (GimpObject *object,
gint64 *gui_size);
static void gimp_plug_in_manager_add_from_file (const GimpDatafileData *file_data,
gpointer data);
static void gimp_plug_in_manager_add_from_rc (GimpPlugInManager *manager,
PlugInDef *plug_in_def);
static void gimp_plug_in_manager_add_to_db (GimpPlugInManager *manager,
GimpContext *context,
GimpPlugInProcedure *proc);
static gint gimp_plug_in_manager_file_proc_compare (gconstpointer a,
gconstpointer b,
gpointer data);
G_DEFINE_TYPE (GimpPlugInManager, gimp_plug_in_manager, GIMP_TYPE_OBJECT);
#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);
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,
gimp_marshal_VOID__STRING_STRING_STRING,
G_TYPE_NONE, 1,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING);
manager_signals[LAST_PLUG_INS_CHANGED] =
g_signal_new ("last-plug-ins-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GimpPlugInManagerClass,
last_plug_ins_changed),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
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)
{
manager->plug_in_procedures = NULL;
manager->load_procs = NULL;
manager->save_procs = NULL;
manager->interpreter_db = gimp_interpreter_db_new ();
manager->environ_table = gimp_environ_table_new ();
manager->debug = NULL;
manager->data_list = NULL;
}
static void
gimp_plug_in_manager_finalize (GObject *object)
{
GimpPlugInManager *manager = GIMP_PLUG_IN_MANAGER (object);
if (manager->load_procs)
{
g_slist_free (manager->load_procs);
manager->load_procs = NULL;
}
if (manager->save_procs)
{
g_slist_free (manager->save_procs);
manager->save_procs = NULL;
}
if (manager->last_plug_ins)
{
g_slist_free (manager->last_plug_ins);
manager->last_plug_ins = NULL;
}
if (manager->environ_table)
{
g_object_unref (manager->environ_table);
manager->environ_table = NULL;
}
if (manager->interpreter_db)
{
g_object_unref (manager->interpreter_db);
manager->interpreter_db = NULL;
}
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;
memsize += gimp_g_slist_get_memsize (manager->load_procs, 0 /* FIXME */);
memsize += gimp_g_slist_get_memsize (manager->save_procs, 0 /* FIXME */);
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_object_get_memsize (GIMP_OBJECT (manager->interpreter_db),
gui_size);
memsize += gimp_object_get_memsize (GIMP_OBJECT (manager->environ_table),
gui_size);
memsize += gimp_g_list_get_memsize (manager->data_list,
0 /* FIXME */);
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);
manager->gimp = gimp;
return manager;
}
void
plug_ins_init (Gimp *gimp,
GimpContext *context,
GimpInitStatusFunc status_callback)
gimp_plug_in_manager_initialize (GimpPlugInManager *manager,
GimpInitStatusFunc status_callback)
{
gchar *pluginrc;
gchar *path;
GSList *rc_defs;
GSList *list;
GList *extensions = NULL;
gint n_plugins;
gint n_extensions;
gint nth;
GError *error = NULL;
gchar *path;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (status_callback != NULL);
status_callback (NULL, _("Plug-In Interpreters"), 0.8);
path = gimp_config_path_expand (manager->gimp->config->interpreter_path,
TRUE, NULL);
gimp_interpreter_db_load (manager->interpreter_db, path);
g_free (path);
status_callback (NULL, _("Plug-In Environment"), 0.9);
path = gimp_config_path_expand (manager->gimp->config->environ_path,
TRUE, NULL);
gimp_environ_table_load (manager->environ_table, path);
g_free (path);
plug_in_init (manager);
/* allocate a piece of shared memory for use in transporting tiles
* 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 ();
}
void
gimp_plug_in_manager_restore (GimpPlugInManager *manager,
GimpContext *context,
GimpInitStatusFunc status_callback)
{
Gimp *gimp;
gchar *pluginrc;
GSList *rc_defs;
GSList *list;
gint n_plugins;
gint nth;
GError *error = NULL;
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (GIMP_IS_CONTEXT (context));
g_return_if_fail (status_callback != NULL);
plug_in_init (gimp);
gimp = manager->gimp;
/* search for binaries in the plug-in directory path */
status_callback (_("Searching Plug-Ins"), "", 0.0);
{
gchar *path;
path = gimp_config_path_expand (gimp->config->plug_in_path, TRUE, NULL);
status_callback (_("Searching Plug-Ins"), "", 0.0);
gimp_datafiles_read_directories (path,
G_FILE_TEST_IS_EXECUTABLE,
plug_ins_add_from_file,
&gimp->plug_in_defs);
path = gimp_config_path_expand (gimp->config->plug_in_path, TRUE, NULL);
g_free (path);
gimp_datafiles_read_directories (path,
G_FILE_TEST_IS_EXECUTABLE,
gimp_plug_in_manager_add_from_file,
manager);
g_free (path);
}
/* read the pluginrc file for cached data */
if (gimp->config->plug_in_rc_path)
@ -129,7 +316,7 @@ plug_ins_init (Gimp *gimp,
if (rc_defs)
{
for (list = rc_defs; list; list = g_slist_next (list))
plug_ins_add_from_rc (gimp, list->data); /* consumes list->data */
gimp_plug_in_manager_add_from_rc (manager, list->data); /* consumes list->data */
g_slist_free (rc_defs);
}
@ -146,7 +333,7 @@ plug_ins_init (Gimp *gimp,
*/
status_callback (_("Querying new Plug-ins"), "", 0.0);
for (list = gimp->plug_in_defs, n_plugins = 0; list; list = list->next)
for (list = manager->plug_in_defs, n_plugins = 0; list; list = list->next)
{
PlugInDef *plug_in_def = list->data;
@ -156,9 +343,9 @@ plug_ins_init (Gimp *gimp,
if (n_plugins)
{
gimp->write_pluginrc = TRUE;
manager->write_pluginrc = TRUE;
for (list = gimp->plug_in_defs, nth = 0; list; list = list->next)
for (list = manager->plug_in_defs, nth = 0; list; list = list->next)
{
PlugInDef *plug_in_def = list->data;
@ -175,7 +362,7 @@ plug_ins_init (Gimp *gimp,
g_print (_("Querying plug-in: '%s'\n"),
gimp_filename_to_utf8 (plug_in_def->prog));
plug_in_call_query (gimp, context, plug_in_def);
plug_in_call_query (manager, context, plug_in_def);
}
}
}
@ -183,7 +370,7 @@ plug_ins_init (Gimp *gimp,
/* initialize the plug-ins */
status_callback (_("Initializing Plug-ins"), "", 0.0);
for (list = gimp->plug_in_defs, n_plugins = 0; list; list = list->next)
for (list = manager->plug_in_defs, n_plugins = 0; list; list = list->next)
{
PlugInDef *plug_in_def = list->data;
@ -193,7 +380,7 @@ plug_ins_init (Gimp *gimp,
if (n_plugins)
{
for (list = gimp->plug_in_defs, nth = 0; list; list = list->next)
for (list = manager->plug_in_defs, nth = 0; list; list = list->next)
{
PlugInDef *plug_in_def = list->data;
@ -210,64 +397,64 @@ plug_ins_init (Gimp *gimp,
g_print (_("Initializing plug-in: '%s'\n"),
gimp_filename_to_utf8 (plug_in_def->prog));
plug_in_call_init (gimp, context, plug_in_def);
plug_in_call_init (manager, context, plug_in_def);
}
}
}
status_callback (NULL, "", 1.0);
/* add the procedures to gimp->plug_in_procedures */
for (list = gimp->plug_in_defs; list; list = list->next)
/* add the procedures to manager->plug_in_procedures */
for (list = manager->plug_in_defs; list; list = list->next)
{
PlugInDef *plug_in_def = list->data;
GSList *list2;
for (list2 = plug_in_def->procedures; list2; list2 = list2->next)
{
plug_ins_procedure_add (gimp, list2->data);
gimp_plug_in_manager_add_procedure (manager, list2->data);
}
}
/* write the pluginrc file if necessary */
if (gimp->write_pluginrc)
if (manager->write_pluginrc)
{
if (gimp->be_verbose)
g_print (_("Writing '%s'\n"), gimp_filename_to_utf8 (pluginrc));
if (! plug_in_rc_write (gimp->plug_in_defs, pluginrc, &error))
if (! plug_in_rc_write (manager->plug_in_defs, pluginrc, &error))
{
g_message ("%s", error->message);
g_clear_error (&error);
}
gimp->write_pluginrc = FALSE;
manager->write_pluginrc = FALSE;
}
g_free (pluginrc);
/* create help_path and locale_domain lists */
for (list = gimp->plug_in_defs; list; list = list->next)
for (list = manager->plug_in_defs; list; list = list->next)
{
PlugInDef *plug_in_def = list->data;
if (plug_in_def->locale_domain_name)
plug_in_locale_domain_add (gimp,
plug_in_def->prog,
plug_in_def->locale_domain_name,
plug_in_def->locale_domain_path);
gimp_plug_in_manager_add_locale_domain (manager,
plug_in_def->prog,
plug_in_def->locale_domain_name,
plug_in_def->locale_domain_path);
if (plug_in_def->help_domain_name)
plug_in_help_domain_add (gimp,
plug_in_def->prog,
plug_in_def->help_domain_name,
plug_in_def->help_domain_uri);
gimp_plug_in_manager_add_help_domain (manager,
plug_in_def->prog,
plug_in_def->help_domain_name,
plug_in_def->help_domain_uri);
}
/* we're done with the plug-in-defs */
g_slist_foreach (gimp->plug_in_defs, (GFunc) plug_in_def_free, NULL);
g_slist_free (gimp->plug_in_defs);
gimp->plug_in_defs = NULL;
g_slist_foreach (manager->plug_in_defs, (GFunc) plug_in_def_free, NULL);
g_slist_free (manager->plug_in_defs);
manager->plug_in_defs = NULL;
if (! gimp->no_interface)
{
@ -276,15 +463,16 @@ plug_ins_init (Gimp *gimp,
gint n_domains;
gint i;
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);
manager->load_procs = g_slist_sort_with_data (manager->load_procs,
gimp_plug_in_manager_file_proc_compare,
manager);
manager->save_procs = g_slist_sort_with_data (manager->save_procs,
gimp_plug_in_manager_file_proc_compare,
manager);
n_domains = plug_in_locale_domains (gimp, &locale_domains,
&locale_paths);
n_domains = gimp_plug_in_manager_get_locale_domains (manager,
&locale_domains,
&locale_paths);
for (i = 0; i < n_domains; i++)
{
@ -299,96 +487,107 @@ plug_ins_init (Gimp *gimp,
}
/* add the plug-in procs to the procedure database */
for (list = gimp->plug_in_procedures; list; list = list->next)
for (list = manager->plug_in_procedures; list; list = list->next)
{
plug_ins_add_to_db (gimp, context, list->data);
gimp_plug_in_manager_add_to_db (manager, context, list->data);
}
/* build list of automatically started extensions */
for (list = gimp->plug_in_procedures, nth = 0; list; list = list->next, nth++)
{
GimpPlugInProcedure *proc = list->data;
/* run automatically started extensions */
{
GList *extensions = NULL;
gint n_extensions;
if (proc->prog &&
GIMP_PROCEDURE (proc)->proc_type == GIMP_EXTENSION &&
GIMP_PROCEDURE (proc)->num_args == 0)
{
extensions = g_list_prepend (extensions, proc);
}
}
/* build list of automatically started extensions */
for (list = manager->plug_in_procedures; list; list = list->next)
{
GimpPlugInProcedure *proc = list->data;
extensions = g_list_reverse (extensions);
n_extensions = g_list_length (extensions);
if (proc->prog &&
GIMP_PROCEDURE (proc)->proc_type == GIMP_EXTENSION &&
GIMP_PROCEDURE (proc)->num_args == 0)
{
extensions = g_list_prepend (extensions, proc);
}
}
/* run the available extensions */
if (extensions)
{
GList *list;
extensions = g_list_reverse (extensions);
n_extensions = g_list_length (extensions);
status_callback (_("Starting Extensions"), "", 0.0);
/* run the available extensions */
if (extensions)
{
GList *list;
for (list = extensions, nth = 0; list; list = g_list_next (list), nth++)
{
GimpPlugInProcedure *proc = list->data;
GValueArray *args;
status_callback (_("Starting Extensions"), "", 0.0);
if (gimp->be_verbose)
g_print (_("Starting extension: '%s'\n"),
GIMP_OBJECT (proc)->name);
for (list = extensions, nth = 0; list; list = g_list_next (list), nth++)
{
GimpPlugInProcedure *proc = list->data;
GValueArray *args;
status_callback (NULL, GIMP_OBJECT (proc)->name,
(gdouble) nth / (gdouble) n_extensions);
if (gimp->be_verbose)
g_print (_("Starting extension: '%s'\n"),
GIMP_OBJECT (proc)->name);
args = g_value_array_new (0);
status_callback (NULL, GIMP_OBJECT (proc)->name,
(gdouble) nth / (gdouble) n_extensions);
gimp_procedure_execute_async (GIMP_PROCEDURE (proc),
gimp, context, NULL, args, -1);
args = g_value_array_new (0);
g_value_array_free (args);
}
gimp_procedure_execute_async (GIMP_PROCEDURE (proc),
gimp, context, NULL, args, -1);
g_list_free (extensions);
}
g_value_array_free (args);
}
status_callback ("", "", 1.0);
g_list_free (extensions);
}
}
}
void
plug_ins_exit (Gimp *gimp)
gimp_plug_in_manager_exit (GimpPlugInManager *manager)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
plug_in_exit (gimp);
if (manager->debug)
{
gimp_plug_in_debug_free (manager->debug);
manager->debug = NULL;
}
plug_in_menu_branch_exit (gimp);
plug_in_locale_domain_exit (gimp);
plug_in_help_domain_exit (gimp);
plug_in_data_free (gimp);
if (manager->shm)
{
gimp_plug_in_shm_free (manager->shm);
manager->shm = NULL;
}
g_slist_foreach (gimp->plug_in_procedures, (GFunc) g_object_unref, NULL);
g_slist_free (gimp->plug_in_procedures);
gimp->plug_in_procedures = NULL;
plug_in_exit (manager);
g_slist_foreach (manager->plug_in_procedures, (GFunc) g_object_unref, NULL);
g_slist_free (manager->plug_in_procedures);
manager->plug_in_procedures = NULL;
}
void
plug_ins_procedure_add (Gimp *gimp,
GimpPlugInProcedure *proc)
gimp_plug_in_manager_add_procedure (GimpPlugInManager *manager,
GimpPlugInProcedure *procedure)
{
GSList *list;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (procedure));
for (list = gimp->plug_in_procedures; list; list = list->next)
for (list = manager->plug_in_procedures; list; list = list->next)
{
GimpPlugInProcedure *tmp_proc = list->data;
if (strcmp (GIMP_OBJECT (proc)->name,
if (strcmp (GIMP_OBJECT (procedure)->name,
GIMP_OBJECT (tmp_proc)->name) == 0)
{
GSList *list2;
list->data = g_object_ref (proc);
list->data = g_object_ref (procedure);
g_printerr ("removing duplicate PDB procedure \"%s\" "
"registered by '%s'\n",
@ -398,7 +597,7 @@ plug_ins_procedure_add (Gimp *gimp,
/* 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)
for (list2 = manager->plug_in_defs; list2; list2 = list2->next)
{
PlugInDef *plug_in_def = list2->data;
@ -407,8 +606,8 @@ plug_ins_procedure_add (Gimp *gimp,
}
/* 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);
manager->load_procs = g_slist_remove (manager->load_procs, tmp_proc);
manager->save_procs = g_slist_remove (manager->save_procs, tmp_proc);
g_object_unref (tmp_proc);
@ -416,53 +615,92 @@ plug_ins_procedure_add (Gimp *gimp,
}
}
gimp->plug_in_procedures = g_slist_prepend (gimp->plug_in_procedures,
g_object_ref (proc));
manager->plug_in_procedures = g_slist_prepend (manager->plug_in_procedures,
g_object_ref (procedure));
}
void
plug_ins_temp_procedure_add (Gimp *gimp,
GimpTemporaryProcedure *proc)
gimp_plug_in_manager_add_temp_proc (GimpPlugInManager *manager,
GimpTemporaryProcedure *procedure)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_TEMPORARY_PROCEDURE (proc));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (GIMP_IS_TEMPORARY_PROCEDURE (procedure));
/* Register the procedural database entry */
gimp_pdb_register_procedure (gimp->pdb, GIMP_PROCEDURE (proc));
gimp_pdb_register_procedure (manager->gimp->pdb, GIMP_PROCEDURE (procedure));
/* Add the definition to the global list */
gimp->plug_in_procedures = g_slist_prepend (gimp->plug_in_procedures,
g_object_ref (proc));
manager->plug_in_procedures = g_slist_prepend (manager->plug_in_procedures,
g_object_ref (procedure));
}
void
plug_ins_temp_procedure_remove (Gimp *gimp,
GimpTemporaryProcedure *proc)
gimp_plug_in_manager_remove_temp_proc (GimpPlugInManager *manager,
GimpTemporaryProcedure *procedure)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_TEMPORARY_PROCEDURE (proc));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (GIMP_IS_TEMPORARY_PROCEDURE (procedure));
/* Remove the definition from the global list */
gimp->plug_in_procedures = g_slist_remove (gimp->plug_in_procedures, proc);
manager->plug_in_procedures = g_slist_remove (manager->plug_in_procedures,
procedure);
/* Unregister the procedural database entry */
gimp_pdb_unregister_procedure (gimp->pdb, GIMP_PROCEDURE (proc));
gimp_pdb_unregister_procedure (manager->gimp->pdb, GIMP_PROCEDURE (procedure));
g_object_unref (proc);
g_object_unref (procedure);
}
void
gimp_plug_in_manager_set_last_plug_in (GimpPlugInManager *manager,
GimpPlugInProcedure *procedure)
{
GSList *list;
gint history_size;
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
history_size = MAX (1, manager->gimp->config->plug_in_history_size);
manager->last_plug_ins = g_slist_remove (manager->last_plug_ins, procedure);
manager->last_plug_ins = g_slist_prepend (manager->last_plug_ins, procedure);
list = g_slist_nth (manager->last_plug_ins, history_size);
if (list)
{
manager->last_plug_ins = g_slist_remove_link (manager->last_plug_ins,
list);
g_slist_free (list);
}
g_signal_emit (manager, manager_signals[LAST_PLUG_INS_CHANGED], 0);
}
gint
gimp_plug_in_manager_get_shm_ID (GimpPlugInManager *manager)
{
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), -1);
return manager->shm ? gimp_plug_in_shm_get_ID (manager->shm) : -1;
}
guchar *
gimp_plug_in_manager_get_shm_addr (GimpPlugInManager *manager)
{
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
return manager->shm ? gimp_plug_in_shm_get_addr (manager->shm) : NULL;
}
/* private functions */
static void
plug_ins_add_from_file (const GimpDatafileData *file_data,
gpointer data)
gimp_plug_in_manager_add_from_file (const GimpDatafileData *file_data,
gpointer data)
{
PlugInDef *plug_in_def;
GSList **plug_in_defs = data;
GSList *list;
GimpPlugInManager *manager = data;
PlugInDef *plug_in_def;
GSList *list;
for (list = *plug_in_defs; list; list = list->next)
for (list = manager->plug_in_defs; list; list = list->next)
{
gchar *plug_in_name;
@ -487,17 +725,17 @@ plug_ins_add_from_file (const GimpDatafileData *file_data,
plug_in_def_set_mtime (plug_in_def, file_data->mtime);
plug_in_def_set_needs_query (plug_in_def, TRUE);
*plug_in_defs = g_slist_prepend (*plug_in_defs, plug_in_def);
manager->plug_in_defs = g_slist_prepend (manager->plug_in_defs, plug_in_def);
}
static void
plug_ins_add_from_rc (Gimp *gimp,
PlugInDef *plug_in_def)
gimp_plug_in_manager_add_from_rc (GimpPlugInManager *manager,
PlugInDef *plug_in_def)
{
GSList *list;
gchar *basename1;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (plug_in_def != NULL);
g_return_if_fail (plug_in_def->prog != NULL);
@ -535,7 +773,7 @@ plug_ins_add_from_rc (Gimp *gimp,
/* 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)
for (list = manager->plug_in_defs; list; list = list->next)
{
PlugInDef *ondisk_plug_in_def = list->data;
gchar *basename2;
@ -569,18 +807,18 @@ plug_ins_add_from_rc (Gimp *gimp,
g_free (basename1);
gimp->write_pluginrc = TRUE;
manager->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);
}
static void
plug_ins_add_to_db (Gimp *gimp,
GimpContext *context,
GimpPlugInProcedure *proc)
gimp_plug_in_manager_add_to_db (GimpPlugInManager *manager,
GimpContext *context,
GimpPlugInProcedure *proc)
{
gimp_pdb_register_procedure (gimp->pdb, GIMP_PROCEDURE (proc));
gimp_pdb_register_procedure (manager->gimp->pdb, GIMP_PROCEDURE (proc));
if (proc->file_proc)
{
@ -589,7 +827,8 @@ plug_ins_add_to_db (Gimp *gimp,
if (proc->image_types)
{
return_vals =
gimp_pdb_execute_procedure_by_name (gimp->pdb, context, NULL,
gimp_pdb_execute_procedure_by_name (manager->gimp->pdb,
context, NULL,
"gimp-register-save-handler",
G_TYPE_STRING, GIMP_OBJECT (proc)->name,
G_TYPE_STRING, proc->extensions,
@ -599,7 +838,8 @@ plug_ins_add_to_db (Gimp *gimp,
else
{
return_vals =
gimp_pdb_execute_procedure_by_name (gimp->pdb, context, NULL,
gimp_pdb_execute_procedure_by_name (manager->gimp->pdb,
context, NULL,
"gimp-register-magic-load-handler",
G_TYPE_STRING, GIMP_OBJECT (proc)->name,
G_TYPE_STRING, proc->extensions,
@ -613,18 +853,18 @@ plug_ins_add_to_db (Gimp *gimp,
}
static gint
plug_ins_file_proc_compare (gconstpointer a,
gconstpointer b,
gpointer data)
gimp_plug_in_manager_file_proc_compare (gconstpointer a,
gconstpointer b,
gpointer data)
{
Gimp *gimp = data;
const GimpPlugInProcedure *proc_a = a;
const GimpPlugInProcedure *proc_b = b;
GimpPlugInManager *manager = data;
const GimpPlugInProcedure *proc_a = a;
const GimpPlugInProcedure *proc_b = b;
const gchar *domain_a;
const gchar *domain_b;
gchar *label_a;
gchar *label_b;
gint retval = 0;
gint retval = 0;
if (strncmp (proc_a->prog, "gimp-xcf", 8) == 0)
return -1;
@ -632,8 +872,10 @@ plug_ins_file_proc_compare (gconstpointer a,
if (strncmp (proc_b->prog, "gimp-xcf", 8) == 0)
return 1;
domain_a = plug_in_locale_domain (gimp, proc_a->prog, NULL);
domain_b = plug_in_locale_domain (gimp, proc_b->prog, NULL);
domain_a = gimp_plug_in_manager_get_locale_domain (manager, proc_a->prog,
NULL);
domain_b = gimp_plug_in_manager_get_locale_domain (manager, proc_b->prog,
NULL);
label_a = gimp_plug_in_procedure_get_label (proc_a, domain_a);
label_b = gimp_plug_in_procedure_get_label (proc_b, domain_b);

View File

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* plug-ins.h
* gimppluginmanager.h
*
* 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
@ -18,27 +18,92 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PLUG_INS_H__
#define __PLUG_INS_H__
#ifndef __GIMP_PLUG_IN_MANAGER_H__
#define __GIMP_PLUG_IN_MANAGER_H__
void plug_ins_init (Gimp *gimp,
GimpContext *context,
GimpInitStatusFunc status_callback);
void plug_ins_exit (Gimp *gimp);
#include "core/gimpobject.h"
#define GIMP_TYPE_PLUG_IN_MANAGER (gimp_plug_in_manager_get_type ())
#define GIMP_PLUG_IN_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PLUG_IN_MANAGER, GimpPlugInManager))
#define GIMP_PLUG_IN_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PLUG_IN_MANAGER, GimpPlugInManagerClass))
#define GIMP_IS_PLUG_IN_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PLUG_IN_MANAGER))
#define GIMP_IS_PLUG_IN_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PLUG_IN_MANAGER))
typedef struct _GimpPlugInManagerClass GimpPlugInManagerClass;
struct _GimpPlugInManager
{
GimpObject parent_instance;
Gimp *gimp;
GSList *plug_in_defs;
gboolean write_pluginrc;
GSList *plug_in_procedures;
GSList *load_procs;
GSList *save_procs;
GSList *menu_branches;
GSList *locale_domains;
GSList *help_domains;
PlugIn *current_plug_in;
GSList *open_plug_ins;
GSList *plug_in_stack;
GSList *last_plug_ins;
GimpPlugInShm *shm;
GimpInterpreterDB *interpreter_db;
GimpEnvironTable *environ_table;
GimpPlugInDebug *debug;
GList *data_list;
};
struct _GimpPlugInManagerClass
{
GimpObjectClass parent_class;
void (* menu_branch_added) (GimpPlugInManager *manager,
const gchar *prog_name,
const gchar *menu_path,
const gchar *menu_label);
void (* last_plug_ins_changed) (GimpPlugInManager *manager);
};
GType gimp_plug_in_manager_get_type (void) G_GNUC_CONST;
GimpPlugInManager * gimp_plug_in_manager_new (Gimp *gimp);
void gimp_plug_in_manager_initialize (GimpPlugInManager *manager,
GimpInitStatusFunc status_callback);
void gimp_plug_in_manager_restore (GimpPlugInManager *manager,
GimpContext *context,
GimpInitStatusFunc status_callback);
void gimp_plug_in_manager_exit (GimpPlugInManager *manager);
/* Register a plug-in. This function is public for file load-save
* handlers, which are organized around the plug-in data structure.
* This could all be done a little better, but oh well. -josh
*/
void plug_ins_procedure_add (Gimp *gimp,
GimpPlugInProcedure *proc);
void gimp_plug_in_manager_add_procedure (GimpPlugInManager *manager,
GimpPlugInProcedure *procedure);
/* Add/Remove temporary procedures. */
void plug_ins_temp_procedure_add (Gimp *gimp,
GimpTemporaryProcedure *proc);
void plug_ins_temp_procedure_remove (Gimp *gimp,
GimpTemporaryProcedure *proc);
void gimp_plug_in_manager_add_temp_proc (GimpPlugInManager *manager,
GimpTemporaryProcedure *procedure);
void gimp_plug_in_manager_remove_temp_proc (GimpPlugInManager *manager,
GimpTemporaryProcedure *procedure);
void gimp_plug_in_manager_set_last_plug_in (GimpPlugInManager *manager,
GimpPlugInProcedure *procedure);
gint gimp_plug_in_manager_get_shm_ID (GimpPlugInManager *manager);
guchar * gimp_plug_in_manager_get_shm_addr (GimpPlugInManager *manager);
#endif /* __PLUG_INS_H__ */
#endif /* __GIMP_PLUG_IN_MANAGER_H__ */

View File

@ -34,7 +34,6 @@
#include "core/gimpparamspecs.h"
#include "plug-in/plug-in.h"
#include "plug-in/plug-ins.h"
#define __YES_I_NEED_PLUG_IN_RUN__
#include "plug-in/plug-in-run.h"
@ -218,7 +217,7 @@ gimp_plug_in_procedure_execute (GimpProcedure *procedure,
context, progress,
args);
return plug_in_run (gimp, context, progress,
return plug_in_run (gimp->plug_in_manager, context, progress,
GIMP_PLUG_IN_PROCEDURE (procedure),
args, TRUE, FALSE, -1);
}
@ -231,7 +230,7 @@ gimp_plug_in_procedure_execute_async (GimpProcedure *procedure,
GValueArray *args,
gint32 display_ID)
{
plug_in_run (gimp, context, progress,
plug_in_run (gimp->plug_in_manager, context, progress,
GIMP_PLUG_IN_PROCEDURE (procedure),
args, FALSE, TRUE, display_ID);
}

View File

@ -1,6 +1,8 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimppluginhsm.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
@ -64,12 +66,10 @@
#include "base/tile.h"
#include "core/gimp.h"
#include "plug-in-shm.h"
#include "gimppluginshm.h"
struct _PlugInShm
struct _GimpPlugInShm
{
gint shm_ID;
guchar *shm_addr;
@ -84,41 +84,38 @@ struct _PlugInShm
#define ERRMSG_SHM_DISABLE "Disabling shared memory tile transport"
void
plug_in_shm_init (Gimp *gimp)
GimpPlugInShm *
gimp_plug_in_shm_new (void)
{
/* allocate a piece of shared memory for use in transporting tiles
* 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.
*/
GimpPlugInShm *shm = g_new0 (GimpPlugInShm, 1);
#if defined(USE_SYSV_SHM)
/* Use SysV shared memory mechanisms for transferring tile data. */
g_return_if_fail (GIMP_IS_GIMP (gimp));
shm->shm_ID = -1;
gimp->plug_in_shm = g_new0 (PlugInShm, 1);
gimp->plug_in_shm->shm_ID = -1;
shm->shm_ID = shmget (IPC_PRIVATE, TILE_MAP_SIZE, IPC_CREAT | 0600);
gimp->plug_in_shm->shm_ID = shmget (IPC_PRIVATE, TILE_MAP_SIZE,
IPC_CREAT | 0600);
if (gimp->plug_in_shm->shm_ID != -1)
if (shm->shm_ID != -1)
{
gimp->plug_in_shm->shm_addr = (guchar *)
shmat (gimp->plug_in_shm->shm_ID, NULL, 0);
shm->shm_addr = (guchar *) shmat (shm->shm_ID, NULL, 0);
if (gimp->plug_in_shm->shm_addr == (guchar *) -1)
if (shm->shm_addr == (guchar *) -1)
{
g_warning ("shmat() failed: %s\n" ERRMSG_SHM_DISABLE,
g_strerror (errno));
shmctl (gimp->plug_in_shm->shm_ID, IPC_RMID, NULL);
gimp->plug_in_shm->shm_ID = -1;
shmctl (shm->shm_ID, IPC_RMID, NULL);
shm->shm_ID = -1;
}
#ifdef IPC_RMID_DEFERRED_RELEASE
if (gimp->plug_in_shm->shm_addr != (guchar *) -1)
shmctl (gimp->plug_in_shm->shm_ID, IPC_RMID, NULL);
if (shm->shm_addr != (guchar *) -1)
shmctl (shm->shm_ID, IPC_RMID, NULL);
#endif
}
else
@ -134,10 +131,7 @@ plug_in_shm_init (Gimp *gimp)
gint pid;
gchar fileMapName[MAX_PATH];
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->plug_in_shm = g_new0 (PlugInShm, 1);
gimp->plug_in_shm->shm_ID = -1;
shm->shm_ID = -1;
/* Our shared memory id will be our process ID */
pid = GetCurrentProcessId ();
@ -146,22 +140,21 @@ plug_in_shm_init (Gimp *gimp)
g_snprintf (fileMapName, sizeof (fileMapName), "GIMP%d.SHM", pid);
/* Create the file mapping into paging space */
gimp->plug_in_shm->shm_handle = CreateFileMapping ((HANDLE) 0xFFFFFFFF, NULL,
PAGE_READWRITE, 0,
TILE_MAP_SIZE,
fileMapName);
shm->shm_handle = CreateFileMapping ((HANDLE) 0xFFFFFFFF, NULL,
PAGE_READWRITE, 0,
TILE_MAP_SIZE,
fileMapName);
if (gimp->plug_in_shm->shm_handle)
if (shm->shm_handle)
{
/* Map the shared memory into our address space for use */
gimp->plug_in_shm->shm_addr = (guchar *)
MapViewOfFile (gimp->plug_in_shm->shm_handle,
FILE_MAP_ALL_ACCESS,
0, 0, TILE_MAP_SIZE);
shm->shm_addr = (guchar *) MapViewOfFile (shm->shm_handle,
FILE_MAP_ALL_ACCESS,
0, 0, TILE_MAP_SIZE);
/* Verify that we mapped our view */
if (gimp->plug_in_shm->shm_addr)
gimp->plug_in_shm->shm_ID = pid;
if (shm->shm_addr)
shm->shm_ID = pid;
else
g_warning ("MapViewOfFile error: %d... " ERRMSG_SHM_DISABLE,
GetLastError ());
@ -180,10 +173,7 @@ plug_in_shm_init (Gimp *gimp)
gchar shm_handle[32];
gint shm_fd;
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->plug_in_shm = g_new0 (PlugInShm, 1);
gimp->plug_in_shm->shm_ID = -1;
shm->shm_ID = -1;
/* Our shared memory id will be our process ID */
pid = getpid ();
@ -199,14 +189,14 @@ plug_in_shm_init (Gimp *gimp)
if (ftruncate (shm_fd, TILE_MAP_SIZE) != -1)
{
/* Map the shared memory into our address space for use */
gimp->plug_in_shm->shm_addr = (guchar *)
mmap (NULL, TILE_MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
shm_fd, 0);
shm->shm_addr = (guchar *) mmap (NULL, TILE_MAP_SIZE,
PROT_READ | PROT_WRITE, MAP_SHARED,
shm_fd, 0);
/* Verify that we mapped our view */
if (gimp->plug_in_shm->shm_addr != MAP_FAILED)
if (shm->shm_addr != MAP_FAILED)
{
gimp->plug_in_shm->shm_ID = pid;
shm->shm_ID = pid;
}
else
{
@ -233,69 +223,68 @@ plug_in_shm_init (Gimp *gimp)
}
#endif
return shm;
}
void
plug_in_shm_exit (Gimp *gimp)
gimp_plug_in_shm_free (GimpPlugInShm *shm)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (gimp->plug_in_shm != NULL);
g_return_if_fail (shm != NULL);
#if defined (USE_SYSV_SHM)
#ifndef IPC_RMID_DEFERRED_RELEASE
if (gimp->plug_in_shm->shm_ID != -1)
if (shm->shm_ID != -1)
{
shmdt (gimp->plug_in_shm->shm_addr);
shmctl (gimp->plug_in_shm->shm_ID, IPC_RMID, NULL);
shmdt (shm->shm_addr);
shmctl (shm->shm_ID, IPC_RMID, NULL);
}
#else /* IPC_RMID_DEFERRED_RELEASE */
if (gimp->plug_in_shm->shm_ID != -1)
if (shm->shm_ID != -1)
{
shmdt (gimp->plug_in_shm->shm_addr);
shmdt (shm->shm_addr);
}
#endif
#elif defined(USE_WIN32_SHM)
if (gimp->plug_in_shm->shm_handle)
if (shm->shm_handle)
{
CloseHandle (gimp->plug_in_shm->shm_handle);
CloseHandle (shm->shm_handle);
}
#elif defined(USE_POSIX_SHM)
if (gimp->plug_in_shm->shm_ID != -1)
if (shm->shm_ID != -1)
{
gchar shm_handle[32];
munmap (gimp->plug_in_shm->shm_addr, TILE_MAP_SIZE);
munmap (shm->shm_addr, TILE_MAP_SIZE);
g_snprintf (shm_handle, sizeof (shm_handle), "/gimp-shm-%d",
gimp->plug_in_shm->shm_ID);
shm->shm_ID);
shm_unlink (shm_handle);
}
#endif
g_free (gimp->plug_in_shm);
gimp->plug_in_shm = NULL;
g_free (shm);
}
gint
plug_in_shm_get_ID (Gimp *gimp)
gimp_plug_in_shm_get_ID (GimpPlugInShm *shm)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), -1);
g_return_val_if_fail (shm != NULL, -1);
return gimp->plug_in_shm ? gimp->plug_in_shm->shm_ID : -1;
return shm->shm_ID;
}
guchar *
plug_in_shm_get_addr (Gimp *gimp)
gimp_plug_in_shm_get_addr (GimpPlugInShm *shm)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (gimp->plug_in_shm != NULL, NULL);
g_return_val_if_fail (shm != NULL, NULL);
return gimp->plug_in_shm->shm_addr;
return shm->shm_addr;
}

View File

@ -1,6 +1,8 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimppluginshm.h
*
* 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
@ -16,15 +18,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PLUG_IN_SHM_H__
#define __PLUG_IN_SHM_H__
#ifndef __GIMP_PLUG_IN_SHM_H__
#define __GIMP_PLUG_IN_SHM_H__
void plug_in_shm_init (Gimp *gimp);
void plug_in_shm_exit (Gimp *gimp);
GimpPlugInShm * gimp_plug_in_shm_new (void);
void gimp_plug_in_shm_free (GimpPlugInShm *shm);
gint plug_in_shm_get_ID (Gimp *gimp);
guchar * plug_in_shm_get_addr (Gimp *gimp);
gint gimp_plug_in_shm_get_ID (GimpPlugInShm *shm);
guchar * gimp_plug_in_shm_get_addr (GimpPlugInShm *shm);
#endif /* __PLUG_IN_SHM_H__ */
#endif /* __GIMP_PLUG_IN_SHM_H__ */

View File

@ -24,6 +24,8 @@
#include "pdb-types.h"
#include "core/gimp.h"
#include "plug-in/plug-in.h"
#define __YES_I_NEED_PLUG_IN_RUN__
#include "plug-in/plug-in-run.h"
@ -92,7 +94,7 @@ gimp_temporary_procedure_execute (GimpProcedure *procedure,
GimpProgress *progress,
GValueArray *args)
{
return plug_in_run_temp (gimp, context, progress,
return plug_in_run_temp (gimp->plug_in_manager, context, progress,
GIMP_TEMPORARY_PROCEDURE (procedure),
args);
}
@ -107,7 +109,7 @@ gimp_temporary_procedure_execute_async (GimpProcedure *procedure,
{
GValueArray *return_vals;
return_vals = plug_in_run_temp (gimp, context, progress,
return_vals = plug_in_run_temp (gimp->plug_in_manager, context, progress,
GIMP_TEMPORARY_PROCEDURE (procedure),
args);

View File

@ -25,6 +25,7 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "gimppluginmanager.h"
#include "plug-in.h"
#include "plug-in-context.h"
@ -45,7 +46,7 @@ plug_in_context_push (PlugIn *plug_in)
else
parent = proc_frame->main_context;
context = gimp_context_new (plug_in->gimp, "plug-in context", NULL);
context = gimp_context_new (plug_in->manager->gimp, "plug-in context", NULL);
gimp_context_copy_properties (parent, context, GIMP_CONTEXT_ALL_PROPS_MASK);
proc_frame->context_stack = g_list_prepend (proc_frame->context_stack,

View File

@ -1,134 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 <string.h>
#include <glib-object.h>
#include "plug-in-types.h"
#include "core/gimp.h"
#include "plug-in-data.h"
typedef struct _PlugInData PlugInData;
struct _PlugInData
{
gchar *identifier;
gint32 bytes;
guint8 *data;
};
/* public functions */
void
plug_in_data_free (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimp->plug_in_data_list)
{
GList *list;
for (list = gimp->plug_in_data_list;
list;
list = g_list_next (list))
{
PlugInData *data = list->data;
g_free (data->identifier);
g_free (data->data);
g_free (data);
}
g_list_free (gimp->plug_in_data_list);
gimp->plug_in_data_list = NULL;
}
}
void
plug_in_data_set (Gimp *gimp,
const gchar *identifier,
gint32 bytes,
const guint8 *data)
{
GList *list;
PlugInData *plug_in_data;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (identifier != NULL);
g_return_if_fail (bytes > 0);
g_return_if_fail (data != NULL);
for (list = gimp->plug_in_data_list; list; list = g_list_next (list))
{
plug_in_data = list->data;
if (! strcmp (plug_in_data->identifier, identifier))
break;
}
/* If there isn't already data with the specified identifier, create one */
if (list == NULL)
{
plug_in_data = g_new0 (PlugInData, 1);
plug_in_data->identifier = g_strdup (identifier);
gimp->plug_in_data_list = g_list_prepend (gimp->plug_in_data_list,
plug_in_data);
}
else
{
g_free (plug_in_data->data);
}
plug_in_data->bytes = bytes;
plug_in_data->data = g_memdup (data, bytes);
}
const guint8 *
plug_in_data_get (Gimp *gimp,
const gchar *identifier,
gint32 *bytes)
{
GList *list;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (identifier != NULL, NULL);
g_return_val_if_fail (bytes != NULL, NULL);
*bytes = 0;
for (list = gimp->plug_in_data_list; list; list = g_list_next (list))
{
PlugInData *plug_in_data = list->data;
if (! strcmp (plug_in_data->identifier, identifier))
{
*bytes = plug_in_data->bytes;
return plug_in_data->data;
}
}
return NULL;
}

View File

@ -1,34 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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.
*/
#ifndef __PLUG_IN_DATA_H__
#define __PLUG_IN_DATA_H__
void plug_in_data_free (Gimp *gimp);
void plug_in_data_set (Gimp *gimp,
const gchar *identifier,
gint32 bytes,
const guint8 *data);
const guint8 * plug_in_data_get (Gimp *gimp,
const gchar *identifier,
gint32 *bytes);
#endif /* __PLUG_IN_DATA_H__ */

View File

@ -1,148 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 <string.h>
#include <glib-object.h>
#include "core/core-types.h"
#include "core/gimp.h"
#include "plug-in-debug.h"
struct _GimpPlugInDebug
{
gchar *name;
guint flags;
gchar **args;
};
static const GDebugKey gimp_debug_wrap_keys[] = {
{"query", GIMP_DEBUG_WRAP_QUERY},
{"init", GIMP_DEBUG_WRAP_INIT},
{"run", GIMP_DEBUG_WRAP_RUN},
{"on", GIMP_DEBUG_WRAP_DEFAULT}
};
void
plug_in_debug_init (Gimp *gimp)
{
GimpPlugInDebug *dbg;
const gchar *wrap, *wrapper;
gchar *debug_string;
gchar **args;
GError *error = NULL;
g_return_if_fail (GIMP_IS_GIMP (gimp));
wrap = g_getenv ("GIMP_PLUGIN_DEBUG_WRAP");
wrapper = g_getenv ("GIMP_PLUGIN_DEBUG_WRAPPER");
if (!(wrap && wrapper))
return;
if (!g_shell_parse_argv (wrapper, NULL, &args, &error))
{
g_warning ("Unable to parse debug wrapper: \"%s\"\n%s",
wrapper, error->message);
g_error_free (error);
return;
}
dbg = g_new (GimpPlugInDebug, 1);
dbg->args = args;
debug_string = strchr (wrap, ',');
if (debug_string)
{
dbg->name = g_strndup (wrap, debug_string - wrap);
dbg->flags = g_parse_debug_string (debug_string + 1,
gimp_debug_wrap_keys,
G_N_ELEMENTS (gimp_debug_wrap_keys));
}
else
{
dbg->name = g_strdup (wrap);
dbg->flags = GIMP_DEBUG_WRAP_DEFAULT;
}
gimp->plug_in_debug = dbg;
}
void
plug_in_debug_exit (Gimp *gimp)
{
GimpPlugInDebug *dbg;
g_return_if_fail (GIMP_IS_GIMP (gimp));
dbg = gimp->plug_in_debug;
if (dbg == NULL)
return;
if (dbg->name)
g_free (dbg->name);
if (dbg->args)
g_strfreev (dbg->args);
g_free (dbg);
gimp->plug_in_debug = NULL;
}
gchar **
plug_in_debug_argv (Gimp *gimp,
const gchar *name,
GimpDebugWrapFlag flag,
gchar **args)
{
GimpPlugInDebug *dbg;
GPtrArray *argv;
gchar **arg;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (gimp->plug_in_debug != NULL, NULL);
g_return_val_if_fail (args != NULL, NULL);
dbg = gimp->plug_in_debug;
if (!(dbg->flags & flag) || (strcmp (dbg->name, name) != 0))
return NULL;
argv = g_ptr_array_sized_new (8);
for (arg = gimp->plug_in_debug->args; *arg != NULL; arg++)
g_ptr_array_add (argv, *arg);
for (arg = args; *arg != NULL; arg++)
g_ptr_array_add (argv, *arg);
g_ptr_array_add (argv, NULL);
return (gchar **) g_ptr_array_free (argv, FALSE);
}

View File

@ -1,42 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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.
*/
#ifndef __PLUG_IN_DEBUG_H__
#define __PLUG_IN_DEBUG_H__
typedef enum
{
GIMP_DEBUG_WRAP_QUERY = 1 << 0,
GIMP_DEBUG_WRAP_INIT = 1 << 1,
GIMP_DEBUG_WRAP_RUN = 1 << 2,
GIMP_DEBUG_WRAP_DEFAULT = GIMP_DEBUG_WRAP_RUN
} GimpDebugWrapFlag;
void plug_in_debug_init (Gimp *gimp);
void plug_in_debug_exit (Gimp *gimp);
gchar **plug_in_debug_argv (Gimp *gimp,
const gchar *name,
GimpDebugWrapFlag flag,
gchar **args);
#endif /* __PLUG_IN_DEBUG_H__ */

View File

@ -1,193 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-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 "pdb/gimp-pdb.h"
#include "pdb/gimppluginprocedure.h"
#include "plug-in.h"
#include "plug-in-def.h"
#include "plug-in-file.h"
/* public functions */
gboolean
plug_in_file_register_load_handler (Gimp *gimp,
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_GIMP (gimp), FALSE);
g_return_val_if_fail (name != NULL, FALSE);
if (gimp->current_plug_in && gimp->current_plug_in->plug_in_def)
list = gimp->current_plug_in->plug_in_def->procedures;
else
list = gimp->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 (gimp->load_procs, file_proc))
gimp->load_procs = g_slist_prepend (gimp->load_procs, file_proc);
return TRUE;
}
gboolean
plug_in_file_register_save_handler (Gimp *gimp,
const gchar *name,
const gchar *extensions,
const gchar *prefixes)
{
GimpPlugInProcedure *file_proc;
GimpProcedure *procedure;
GSList *list;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (name != NULL, FALSE);
if (gimp->current_plug_in && gimp->current_plug_in->plug_in_def)
list = gimp->current_plug_in->plug_in_def->procedures;
else
list = gimp->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 (gimp->save_procs, file_proc))
gimp->save_procs = g_slist_prepend (gimp->save_procs, file_proc);
return TRUE;
}
gboolean
plug_in_file_register_mime_type (Gimp *gimp,
const gchar *name,
const gchar *mime_type)
{
GimpPlugInProcedure *file_proc;
GSList *list;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (name != NULL, FALSE);
g_return_val_if_fail (mime_type != NULL, FALSE);
if (gimp->current_plug_in && gimp->current_plug_in->plug_in_def)
list = gimp->current_plug_in->plug_in_def->procedures;
else
list = gimp->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
plug_in_file_register_thumb_loader (Gimp *gimp,
const gchar *load_proc,
const gchar *thumb_proc)
{
GimpPlugInProcedure *file_proc;
GSList *list;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (load_proc, FALSE);
g_return_val_if_fail (thumb_proc, FALSE);
if (gimp->current_plug_in && gimp->current_plug_in->plug_in_def)
list = gimp->current_plug_in->plug_in_def->procedures;
else
list = gimp->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;
}

View File

@ -1,44 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-file.h
*
* 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.
*/
#ifndef __PLUG_IN_FILE_H__
#define __PLUG_IN_FILE_H__
gboolean plug_in_file_register_load_handler (Gimp *gimp,
const gchar *name,
const gchar *extensions,
const gchar *prefixes,
const gchar *magics);
gboolean plug_in_file_register_save_handler (Gimp *gimp,
const gchar *name,
const gchar *extensions,
const gchar *prefixes);
gboolean plug_in_file_register_mime_type (Gimp *gimp,
const gchar *name,
const gchar *mime_type);
gboolean plug_in_file_register_thumb_loader (Gimp *gimp,
const gchar *load_proc,
const gchar *thumb_proc);
#endif /* __PLUG_IN_FILE_H__ */

View File

@ -1,153 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-help-domain.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 <string.h>
#include <glib-object.h>
#include "plug-in-types.h"
#include "core/gimp.h"
#include "plug-in-help-domain.h"
typedef struct _PlugInHelpDomain PlugInHelpDomain;
struct _PlugInHelpDomain
{
gchar *prog_name;
gchar *domain_name;
gchar *domain_uri;
};
void
plug_in_help_domain_exit (Gimp *gimp)
{
GSList *list;
g_return_if_fail (GIMP_IS_GIMP (gimp));
for (list = gimp->plug_in_help_domains; list; list = list->next)
{
PlugInHelpDomain *domain = list->data;
g_free (domain->prog_name);
g_free (domain->domain_name);
g_free (domain->domain_uri);
g_free (domain);
}
g_slist_free (gimp->plug_in_help_domains);
gimp->plug_in_help_domains = NULL;
}
void
plug_in_help_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_uri)
{
PlugInHelpDomain *domain;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (prog_name != NULL);
g_return_if_fail (domain_name != NULL);
domain = g_new (PlugInHelpDomain, 1);
domain->prog_name = g_strdup (prog_name);
domain->domain_name = g_strdup (domain_name);
domain->domain_uri = g_strdup (domain_uri);
gimp->plug_in_help_domains = g_slist_prepend (gimp->plug_in_help_domains,
domain);
#ifdef VERBOSE
g_print ("added help domain \"%s\" for base uri \"%s\"\n",
domain->domain_name ? domain->domain_name : "(null)",
domain->domain_uri ? domain->domain_uri : "(null)");
#endif
}
const gchar *
plug_in_help_domain (Gimp *gimp,
const gchar *prog_name,
const gchar **domain_uri)
{
GSList *list;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (domain_uri)
*domain_uri = NULL;
/* A NULL prog_name is GIMP itself, return the default domain */
if (! prog_name)
return NULL;
for (list = gimp->plug_in_help_domains; list; list = list->next)
{
PlugInHelpDomain *domain = list->data;
if (domain && domain->prog_name &&
! strcmp (domain->prog_name, prog_name))
{
if (domain_uri && domain->domain_uri)
*domain_uri = domain->domain_uri;
return domain->domain_name;
}
}
return NULL;
}
gint
plug_in_help_domains (Gimp *gimp,
gchar ***help_domains,
gchar ***help_uris)
{
GSList *list;
gint n_domains;
gint i;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
g_return_val_if_fail (help_domains != NULL, 0);
g_return_val_if_fail (help_uris != NULL, 0);
n_domains = g_slist_length (gimp->plug_in_help_domains);
*help_domains = g_new0 (gchar *, n_domains);
*help_uris = g_new0 (gchar *, n_domains);
for (list = gimp->plug_in_help_domains, i = 0; list; list = list->next, i++)
{
PlugInHelpDomain *domain = list->data;
(*help_domains)[i] = g_strdup (domain->domain_name);
(*help_uris)[i] = g_strdup (domain->domain_uri);
}
return n_domains;
}

View File

@ -1,44 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-help-domain.h
*
* 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.
*/
#ifndef __PLUG_IN_HELP_DOMAIN_H__
#define __PLUG_IN_HELP_DOMAIN_H__
void plug_in_help_domain_exit (Gimp *gimp);
/* Add a help domain */
void plug_in_help_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_uri);
/* Retrieve a plug-ins help domain */
const gchar * plug_in_help_domain (Gimp *gimp,
const gchar *prog_name,
const gchar **help_uri);
/* Retrieve all help domains */
gint plug_in_help_domains (Gimp *gimp,
gchar ***help_domains,
gchar ***help_uris);
#endif /* __PLUG_INS_HELP_DOMAIN_H__ */

View File

@ -1,182 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-locale-domain.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 <string.h>
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "plug-in-types.h"
#include "core/gimp.h"
#include "plug-in-locale-domain.h"
#define STD_PLUG_INS_LOCALE_DOMAIN GETTEXT_PACKAGE "-std-plug-ins"
typedef struct _PlugInLocaleDomain PlugInLocaleDomain;
struct _PlugInLocaleDomain
{
gchar *prog_name;
gchar *domain_name;
gchar *domain_path;
};
void
plug_in_locale_domain_exit (Gimp *gimp)
{
GSList *list;
g_return_if_fail (GIMP_IS_GIMP (gimp));
for (list = gimp->plug_in_locale_domains; list; list = list->next)
{
PlugInLocaleDomain *domain = list->data;
g_free (domain->prog_name);
g_free (domain->domain_name);
g_free (domain->domain_path);
g_free (domain);
}
g_slist_free (gimp->plug_in_locale_domains);
gimp->plug_in_locale_domains = NULL;
}
void
plug_in_locale_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_path)
{
PlugInLocaleDomain *domain;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (prog_name != NULL);
g_return_if_fail (domain_name != NULL);
domain = g_new (PlugInLocaleDomain, 1);
domain->prog_name = g_strdup (prog_name);
domain->domain_name = g_strdup (domain_name);
domain->domain_path = g_strdup (domain_path);
gimp->plug_in_locale_domains = g_slist_prepend (gimp->plug_in_locale_domains,
domain);
#ifdef VERBOSE
g_print ("added locale domain \"%s\" for path \"%s\"\n",
domain->domain_name ? domain->domain_name : "(null)",
domain->domain_path ?
gimp_filename_to_utf8 (domain->domain_path) : "(null)");
#endif
}
const gchar *
plug_in_locale_domain (Gimp *gimp,
const gchar *prog_name,
const gchar **domain_path)
{
GSList *list;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (domain_path)
*domain_path = gimp_locale_directory ();
/* A NULL prog_name is GIMP itself, return the default domain */
if (! prog_name)
return NULL;
for (list = gimp->plug_in_locale_domains; list; list = list->next)
{
PlugInLocaleDomain *domain = list->data;
if (domain && domain->prog_name &&
! strcmp (domain->prog_name, prog_name))
{
if (domain_path && domain->domain_path)
*domain_path = domain->domain_path;
return domain->domain_name;
}
}
return STD_PLUG_INS_LOCALE_DOMAIN;
}
gint
plug_in_locale_domains (Gimp *gimp,
gchar ***locale_domains,
gchar ***locale_paths)
{
GSList *list;
GSList *unique = NULL;
gint n_domains;
gint i;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
g_return_val_if_fail (locale_domains != NULL, 0);
g_return_val_if_fail (locale_paths != NULL, 0);
for (list = gimp->plug_in_locale_domains; list; list = list->next)
{
PlugInLocaleDomain *domain = list->data;
GSList *tmp;
for (tmp = unique; tmp; tmp = tmp->next)
if (! strcmp (domain->domain_name, (const gchar *) tmp->data))
break;
if (! tmp)
unique = g_slist_prepend (unique, domain);
}
unique = g_slist_reverse (unique);
n_domains = g_slist_length (unique) + 1;
*locale_domains = g_new0 (gchar *, n_domains);
*locale_paths = g_new0 (gchar *, n_domains);
(*locale_domains)[0] = g_strdup (STD_PLUG_INS_LOCALE_DOMAIN);
(*locale_paths)[0] = g_strdup (gimp_locale_directory ());
for (list = unique, i = 1; list; list = list->next, i++)
{
PlugInLocaleDomain *domain = list->data;
(*locale_domains)[i] = g_strdup (domain->domain_name);
(*locale_paths)[i] = (domain->domain_path ?
g_strdup (domain->domain_path) :
g_strdup (gimp_locale_directory ()));
}
g_slist_free (unique);
return n_domains;
}

View File

@ -1,44 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-locale-domain.h
*
* 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.
*/
#ifndef __PLUG_IN_LOCALE_DOMAIN_H__
#define __PLUG_IN_LOCALE_DOMAIN_H__
void plug_in_locale_domain_exit (Gimp *gimp);
/* Add a locale domain */
void plug_in_locale_domain_add (Gimp *gimp,
const gchar *prog_name,
const gchar *domain_name,
const gchar *domain_path);
/* Retrieve a plug-ins locale domain */
const gchar * plug_in_locale_domain (Gimp *gimp,
const gchar *prog_name,
const gchar **locale_path);
/* Retrieve all help domains */
gint plug_in_locale_domains (Gimp *gimp,
gchar ***locale_domains,
gchar ***locale_paths);
#endif /* __PLUG_IN_LOCALE_DOMAIN_H__ */

View File

@ -1,84 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-menu-branch.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 "plug-in-menu-branch.h"
/* public functions */
void
plug_in_menu_branch_exit (Gimp *gimp)
{
GSList *list;
g_return_if_fail (GIMP_IS_GIMP (gimp));
for (list = gimp->plug_in_menu_branches; list; list = list->next)
{
PlugInMenuBranch *branch = list->data;
g_free (branch->prog_name);
g_free (branch->menu_path);
g_free (branch->menu_label);
g_free (branch);
}
g_slist_free (gimp->plug_in_menu_branches);
gimp->plug_in_menu_branches = NULL;
}
void
plug_in_menu_branch_add (Gimp *gimp,
const gchar *prog_name,
const gchar *menu_path,
const gchar *menu_label)
{
PlugInMenuBranch *branch;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (prog_name != NULL);
g_return_if_fail (menu_path != NULL);
g_return_if_fail (menu_label != NULL);
if (! gimp->no_interface)
gimp_menus_create_branch (gimp, prog_name, menu_path, menu_label);
branch = g_new (PlugInMenuBranch, 1);
branch->prog_name = g_strdup (prog_name);
branch->menu_path = g_strdup (menu_path);
branch->menu_label = g_strdup (menu_label);
gimp->plug_in_menu_branches = g_slist_append (gimp->plug_in_menu_branches,
branch);
#ifdef VERBOSE
g_print ("added menu branch \"%s\" at path \"%s\"\n",
branch->menu_label, branch->menu_path);
#endif
}

View File

@ -1,42 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-menu-branch.h
*
* 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.
*/
#ifndef __PLUG_IN_MENU_BRANCH_H__
#define __PLUG_IN_MENU_BRANCH_H__
struct _PlugInMenuBranch
{
gchar *prog_name;
gchar *menu_path;
gchar *menu_label;
};
void plug_in_menu_branch_exit (Gimp *gimp);
/* Add a menu branch */
void plug_in_menu_branch_add (Gimp *gimp,
const gchar *prog_name,
const gchar *menu_path,
const gchar *menu_label);
#endif /* __PLUG_IN_MENU_BRANCH_H__ */

View File

@ -40,10 +40,10 @@
#include "pdb/gimp-pdb-compat.h"
#include "pdb/gimptemporaryprocedure.h"
#include "gimppluginmanager.h"
#include "plug-in.h"
#include "plug-in-def.h"
#include "plug-in-params.h"
#include "plug-in-shm.h"
/* local function prototypes */
@ -164,7 +164,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
Tile *tile;
gint shm_ID;
shm_ID = plug_in_shm_get_ID (plug_in->gimp);
shm_ID = gimp_plug_in_manager_get_shm_ID (plug_in->manager);
if (tile_req->drawable_ID == -1)
{
@ -202,7 +202,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_info = msg.data;
drawable = (GimpDrawable *) gimp_item_get_by_ID (plug_in->gimp,
drawable = (GimpDrawable *) gimp_item_get_by_ID (plug_in->manager->gimp,
tile_info->drawable_ID);
if (! GIMP_IS_DRAWABLE (drawable))
@ -234,7 +234,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
if (tile_data.use_shm)
memcpy (tile_data_pointer (tile, 0, 0),
plug_in_shm_get_addr (plug_in->gimp),
gimp_plug_in_manager_get_shm_addr (plug_in->manager),
tile_size (tile));
else
memcpy (tile_data_pointer (tile, 0, 0),
@ -255,7 +255,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
{
/* this branch communicates with libgimp/gimptile.c:gimp_tile_get() */
drawable = (GimpDrawable *) gimp_item_get_by_ID (plug_in->gimp,
drawable = (GimpDrawable *) gimp_item_get_by_ID (plug_in->manager->gimp,
tile_req->drawable_ID);
if (! GIMP_IS_DRAWABLE (drawable))
@ -294,7 +294,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (plug_in_shm_get_addr (plug_in->gimp),
memcpy (gimp_plug_in_manager_get_shm_addr (plug_in->manager),
tile_data_pointer (tile, 0, 0),
tile_size (tile));
else
@ -343,18 +343,20 @@ plug_in_handle_proc_run (PlugIn *plug_in,
proc_frame = plug_in_get_proc_frame (plug_in);
procedure = gimp_pdb_lookup_procedure (plug_in->gimp->pdb, canonical);
procedure = gimp_pdb_lookup_procedure (plug_in->manager->gimp->pdb,
canonical);
if (! procedure)
{
proc_name = gimp_pdb_lookup_compat_proc_name (plug_in->gimp->pdb,
proc_name = gimp_pdb_lookup_compat_proc_name (plug_in->manager->gimp->pdb,
canonical);
if (proc_name)
{
procedure = gimp_pdb_lookup_procedure (plug_in->gimp->pdb, proc_name);
procedure = gimp_pdb_lookup_procedure (plug_in->manager->gimp->pdb,
proc_name);
if (plug_in->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_WARN)
if (plug_in->manager->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_WARN)
{
g_message ("WARNING: Plug-In \"%s\"\n(%s)\n"
"called deprecated procedure '%s'.\n"
@ -367,7 +369,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
}
else if (procedure->deprecated)
{
if (plug_in->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_WARN)
if (plug_in->manager->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_WARN)
{
if (! strcmp (procedure->deprecated, "NONE"))
{
@ -387,7 +389,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
canonical, procedure->deprecated);
}
}
else if (plug_in->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_OFF)
else if (plug_in->manager->gimp->pdb_compat_mode == GIMP_PDB_COMPAT_OFF)
{
procedure = NULL;
}
@ -405,15 +407,15 @@ plug_in_handle_proc_run (PlugIn *plug_in,
* returned NULL, gimp_pdb_execute_procedure_by_name_args() will
* return appropriate error return_vals.
*/
plug_in_push (plug_in->gimp, plug_in);
return_vals = gimp_pdb_execute_procedure_by_name_args (plug_in->gimp->pdb,
plug_in_push (plug_in->manager, plug_in);
return_vals = gimp_pdb_execute_procedure_by_name_args (plug_in->manager->gimp->pdb,
proc_frame->context_stack ?
proc_frame->context_stack->data :
proc_frame->main_context,
proc_frame->progress,
proc_name,
args);
plug_in_pop (plug_in->gimp);
plug_in_pop (plug_in->manager);
g_free (canonical);
@ -611,7 +613,7 @@ plug_in_handle_proc_install (PlugIn *plug_in,
for (i = 0; i < proc_install->nparams; i++)
{
GParamSpec *pspec =
gimp_pdb_compat_param_spec (plug_in->gimp,
gimp_pdb_compat_param_spec (plug_in->manager->gimp,
proc_install->params[i].type,
proc_install->params[i].name,
proc_install->params[i].description);
@ -622,7 +624,7 @@ plug_in_handle_proc_install (PlugIn *plug_in,
for (i = 0; i < proc_install->nreturn_vals; i++)
{
GParamSpec *pspec =
gimp_pdb_compat_param_spec (plug_in->gimp,
gimp_pdb_compat_param_spec (plug_in->manager->gimp,
proc_install->return_vals[i].type,
proc_install->return_vals[i].name,
proc_install->return_vals[i].description);

View File

@ -32,6 +32,7 @@
#include "pdb/gimppdb.h"
#include "pdb/gimptemporaryprocedure.h"
#include "gimppluginmanager.h"
#include "plug-in.h"
#include "plug-in-progress.h"
@ -58,7 +59,8 @@ plug_in_progress_start (PlugIn *plug_in,
if (! proc_frame->progress)
{
proc_frame->progress = gimp_new_progress (plug_in->gimp, display);
proc_frame->progress = gimp_new_progress (plug_in->manager->gimp,
display);
if (proc_frame->progress)
{
@ -116,7 +118,7 @@ plug_in_progress_end (PlugIn *plug_in)
if (proc_frame->progress_created)
{
gimp_free_progress (plug_in->gimp, proc_frame->progress);
gimp_free_progress (plug_in->manager->gimp, proc_frame->progress);
g_object_unref (proc_frame->progress);
proc_frame->progress = NULL;
}
@ -203,7 +205,7 @@ plug_in_progress_install (PlugIn *plug_in,
g_return_val_if_fail (plug_in != NULL, FALSE);
g_return_val_if_fail (progress_callback != NULL, FALSE);
procedure = gimp_pdb_lookup_procedure (plug_in->gimp->pdb,
procedure = gimp_pdb_lookup_procedure (plug_in->manager->gimp->pdb,
progress_callback);
if (! GIMP_IS_TEMPORARY_PROCEDURE (procedure) ||
@ -230,7 +232,7 @@ plug_in_progress_install (PlugIn *plug_in,
}
proc_frame->progress = g_object_new (GIMP_TYPE_PDB_PROGRESS,
"pdb", plug_in->gimp->pdb,
"pdb", plug_in->manager->gimp->pdb,
"context", proc_frame->main_context,
"callback-name", progress_callback,
NULL);
@ -288,11 +290,11 @@ plug_in_progress_message (PlugIn *plug_in,
if (proc_frame->progress)
{
gimp_progress_message (proc_frame->progress,
plug_in->gimp, domain, message);
plug_in->manager->gimp, domain, message);
}
else
{
gimp_message (plug_in->gimp, domain, message);
gimp_message (plug_in->manager->gimp, domain, message);
}
g_free (domain);

View File

@ -38,11 +38,11 @@
#include "pdb/gimptemporaryprocedure.h"
#include "gimppluginmanager.h"
#include "plug-in.h"
#include "plug-in-params.h"
#define __YES_I_NEED_PLUG_IN_RUN__
#include "plug-in-run.h"
#include "plug-in-shm.h"
#include "gimp-intl.h"
@ -50,7 +50,7 @@
/* public functions */
GValueArray *
plug_in_run (Gimp *gimp,
plug_in_run (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpPlugInProcedure *procedure,
@ -62,19 +62,21 @@ plug_in_run (Gimp *gimp,
GValueArray *return_vals = NULL;
PlugIn *plug_in;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
g_return_val_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (procedure), NULL);
g_return_val_if_fail (args != NULL, NULL);
plug_in = plug_in_new (gimp, context, progress, GIMP_PROCEDURE (procedure),
plug_in = plug_in_new (manager, context, progress,
GIMP_PROCEDURE (procedure),
procedure->prog);
if (plug_in)
{
GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (gimp->config);
GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config);
GimpCoreConfig *core_config = manager->gimp->config;
GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (core_config);
GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (core_config);
GPConfig config;
GPProcRun proc_run;
gint monitor;
@ -88,7 +90,7 @@ plug_in_run (Gimp *gimp,
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.shm_ID = gimp_plug_in_manager_get_shm_ID (manager);
config.check_size = display_config->transparency_size;
config.check_type = display_config->transparency_type;
config.show_help_button = (gui_config->use_help &&
@ -98,13 +100,13 @@ plug_in_run (Gimp *gimp,
config.gimp_reserved_6 = 0;
config.gimp_reserved_7 = 0;
config.gimp_reserved_8 = 0;
config.install_cmap = gimp->config->install_cmap;
config.install_cmap = core_config->install_cmap;
config.show_tooltips = gui_config->show_tooltips;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.min_colors = CLAMP (core_config->min_colors, 27, 256);
config.gdisp_ID = display_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp,
config.wm_class = (gchar *) gimp_get_program_class (manager->gimp);
config.display_name = gimp_get_display_name (manager->gimp,
display_ID, &monitor);
config.monitor_number = monitor;
@ -137,9 +139,9 @@ plug_in_run (Gimp *gimp,
{
plug_in->ext_main_loop = g_main_loop_new (NULL, FALSE);
gimp_threads_leave (gimp);
gimp_threads_leave (manager->gimp);
g_main_loop_run (plug_in->ext_main_loop);
gimp_threads_enter (gimp);
gimp_threads_enter (manager->gimp);
/* main_loop is quit in plug_in_handle_extension_ack() */
@ -156,9 +158,9 @@ plug_in_run (Gimp *gimp,
proc_frame->main_loop = g_main_loop_new (NULL, FALSE);
gimp_threads_leave (gimp);
gimp_threads_leave (manager->gimp);
g_main_loop_run (proc_frame->main_loop);
gimp_threads_enter (gimp);
gimp_threads_enter (manager->gimp);
/* main_loop is quit in plug_in_handle_proc_return() */
@ -182,7 +184,7 @@ plug_in_run (Gimp *gimp,
}
GValueArray *
plug_in_run_temp (Gimp *gimp,
plug_in_run_temp (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpTemporaryProcedure *procedure,
@ -191,7 +193,7 @@ plug_in_run_temp (Gimp *gimp,
GValueArray *return_vals = NULL;
PlugIn *plug_in;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
g_return_val_if_fail (GIMP_IS_TEMPORARY_PROCEDURE (procedure), NULL);

View File

@ -28,7 +28,7 @@
/* Run a plug-in as if it were a procedure database procedure
*/
GValueArray * plug_in_run (Gimp *gimp,
GValueArray * plug_in_run (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpPlugInProcedure *procedure,
@ -39,7 +39,7 @@ GValueArray * plug_in_run (Gimp *gimp,
/* Run a temp plug-in proc as if it were a procedure database procedure
*/
GValueArray * plug_in_run_temp (Gimp *gimp,
GValueArray * plug_in_run_temp (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpTemporaryProcedure *procedure,

View File

@ -1,301 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 <sys/types.h>
#include <errno.h>
#if defined(USE_SYSV_SHM)
#ifdef HAVE_IPC_H
#include <sys/ipc.h>
#endif
#ifdef HAVE_SHM_H
#include <sys/shm.h>
#endif
#elif defined(USE_POSIX_SHM)
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#include <sys/mman.h>
#endif /* USE_POSIX_SHM */
#include <glib-object.h>
#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
#define STRICT
#include <windows.h>
#include <process.h>
#ifdef G_OS_WIN32
#include <fcntl.h>
#include <io.h>
#endif
#define USE_WIN32_SHM 1
#endif /* G_OS_WIN32 || G_WITH_CYGWIN */
#include "plug-in-types.h"
#include "base/tile.h"
#include "core/gimp.h"
#include "plug-in-shm.h"
struct _PlugInShm
{
gint shm_ID;
guchar *shm_addr;
#if defined(USE_WIN32_SHM)
HANDLE shm_handle;
#endif
};
#define TILE_MAP_SIZE (TILE_WIDTH * TILE_HEIGHT * 4)
#define ERRMSG_SHM_DISABLE "Disabling shared memory tile transport"
void
plug_in_shm_init (Gimp *gimp)
{
/* allocate a piece of shared memory for use in transporting tiles
* 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 defined(USE_SYSV_SHM)
/* Use SysV shared memory mechanisms for transferring tile data. */
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->plug_in_shm = g_new0 (PlugInShm, 1);
gimp->plug_in_shm->shm_ID = -1;
gimp->plug_in_shm->shm_ID = shmget (IPC_PRIVATE, TILE_MAP_SIZE,
IPC_CREAT | 0600);
if (gimp->plug_in_shm->shm_ID != -1)
{
gimp->plug_in_shm->shm_addr = (guchar *)
shmat (gimp->plug_in_shm->shm_ID, NULL, 0);
if (gimp->plug_in_shm->shm_addr == (guchar *) -1)
{
g_warning ("shmat() failed: %s\n" ERRMSG_SHM_DISABLE,
g_strerror (errno));
shmctl (gimp->plug_in_shm->shm_ID, IPC_RMID, NULL);
gimp->plug_in_shm->shm_ID = -1;
}
#ifdef IPC_RMID_DEFERRED_RELEASE
if (gimp->plug_in_shm->shm_addr != (guchar *) -1)
shmctl (gimp->plug_in_shm->shm_ID, IPC_RMID, NULL);
#endif
}
else
{
g_warning ("shmget() failed: %s\n" ERRMSG_SHM_DISABLE,
g_strerror (errno));
}
#elif defined(USE_WIN32_SHM)
/* Use Win32 shared memory mechanisms for transferring tile data. */
gint pid;
gchar fileMapName[MAX_PATH];
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->plug_in_shm = g_new0 (PlugInShm, 1);
gimp->plug_in_shm->shm_ID = -1;
/* Our shared memory id will be our process ID */
pid = GetCurrentProcessId ();
/* From the id, derive the file map name */
g_snprintf (fileMapName, sizeof (fileMapName), "GIMP%d.SHM", pid);
/* Create the file mapping into paging space */
gimp->plug_in_shm->shm_handle = CreateFileMapping ((HANDLE) 0xFFFFFFFF, NULL,
PAGE_READWRITE, 0,
TILE_MAP_SIZE,
fileMapName);
if (gimp->plug_in_shm->shm_handle)
{
/* Map the shared memory into our address space for use */
gimp->plug_in_shm->shm_addr = (guchar *)
MapViewOfFile (gimp->plug_in_shm->shm_handle,
FILE_MAP_ALL_ACCESS,
0, 0, TILE_MAP_SIZE);
/* Verify that we mapped our view */
if (gimp->plug_in_shm->shm_addr)
gimp->plug_in_shm->shm_ID = pid;
else
g_warning ("MapViewOfFile error: %d... " ERRMSG_SHM_DISABLE,
GetLastError ());
}
else
{
g_warning ("CreateFileMapping error: %d... " ERRMSG_SHM_DISABLE,
GetLastError ());
}
#elif defined(USE_POSIX_SHM)
/* Use POSIX shared memory mechanisms for transferring tile data. */
gint pid;
gchar shm_handle[32];
gint shm_fd;
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->plug_in_shm = g_new0 (PlugInShm, 1);
gimp->plug_in_shm->shm_ID = -1;
/* Our shared memory id will be our process ID */
pid = getpid ();
/* From the id, derive the file map name */
g_snprintf (shm_handle, sizeof (shm_handle), "/gimp-shm-%d", pid);
/* Create the file mapping into paging space */
shm_fd = shm_open (shm_handle, O_RDWR | O_CREAT, 0600);
if (shm_fd != -1)
{
if (ftruncate (shm_fd, TILE_MAP_SIZE) != -1)
{
/* Map the shared memory into our address space for use */
gimp->plug_in_shm->shm_addr = (guchar *)
mmap (NULL, TILE_MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
shm_fd, 0);
/* Verify that we mapped our view */
if (gimp->plug_in_shm->shm_addr != MAP_FAILED)
{
gimp->plug_in_shm->shm_ID = pid;
}
else
{
g_warning ("mmap() failed: %s\n" ERRMSG_SHM_DISABLE,
g_strerror (errno));
shm_unlink (shm_handle);
}
}
else
{
g_warning ("ftruncate() failed: %s\n" ERRMSG_SHM_DISABLE,
g_strerror (errno));
shm_unlink (shm_handle);
}
close (shm_fd);
}
else
{
g_warning ("shm_open() failed: %s\n" ERRMSG_SHM_DISABLE,
g_strerror (errno));
}
#endif
}
void
plug_in_shm_exit (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (gimp->plug_in_shm != NULL);
#if defined (USE_SYSV_SHM)
#ifndef IPC_RMID_DEFERRED_RELEASE
if (gimp->plug_in_shm->shm_ID != -1)
{
shmdt (gimp->plug_in_shm->shm_addr);
shmctl (gimp->plug_in_shm->shm_ID, IPC_RMID, NULL);
}
#else /* IPC_RMID_DEFERRED_RELEASE */
if (gimp->plug_in_shm->shm_ID != -1)
{
shmdt (gimp->plug_in_shm->shm_addr);
}
#endif
#elif defined(USE_WIN32_SHM)
if (gimp->plug_in_shm->shm_handle)
{
CloseHandle (gimp->plug_in_shm->shm_handle);
}
#elif defined(USE_POSIX_SHM)
if (gimp->plug_in_shm->shm_ID != -1)
{
gchar shm_handle[32];
munmap (gimp->plug_in_shm->shm_addr, TILE_MAP_SIZE);
g_snprintf (shm_handle, sizeof (shm_handle), "/gimp-shm-%d",
gimp->plug_in_shm->shm_ID);
shm_unlink (shm_handle);
}
#endif
g_free (gimp->plug_in_shm);
gimp->plug_in_shm = NULL;
}
gint
plug_in_shm_get_ID (Gimp *gimp)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), -1);
return gimp->plug_in_shm ? gimp->plug_in_shm->shm_ID : -1;
}
guchar *
plug_in_shm_get_addr (Gimp *gimp)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (gimp->plug_in_shm != NULL, NULL);
return gimp->plug_in_shm->shm_addr;
}

View File

@ -1,30 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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.
*/
#ifndef __PLUG_IN_SHM_H__
#define __PLUG_IN_SHM_H__
void plug_in_shm_init (Gimp *gimp);
void plug_in_shm_exit (Gimp *gimp);
gint plug_in_shm_get_ID (Gimp *gimp);
guchar * plug_in_shm_get_addr (Gimp *gimp);
#endif /* __PLUG_IN_SHM_H__ */

View File

@ -25,11 +25,12 @@
#include "plug-in/plug-in-enums.h"
typedef struct _PlugIn PlugIn;
typedef struct _PlugInDef PlugInDef;
typedef struct _PlugInMenuBranch PlugInMenuBranch;
typedef struct _PlugInProcFrame PlugInProcFrame;
typedef struct _PlugInShm PlugInShm;
typedef struct _GimpPlugInManager GimpPlugInManager;
typedef struct _GimpPlugInMenuBranch GimpPlugInMenuBranch;
typedef struct _GimpPlugInShm GimpPlugInShm;
typedef struct _PlugIn PlugIn;
typedef struct _PlugInDef PlugInDef;
typedef struct _PlugInProcFrame PlugInProcFrame;
#endif /* __PLUG_IN_TYPES_H__ */

View File

@ -72,21 +72,20 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpenvirontable.h"
#include "core/gimpinterpreterdb.h"
#include "core/gimpprogress.h"
#include "pdb/gimptemporaryprocedure.h"
#include "gimpenvirontable.h"
#include "gimpinterpreterdb.h"
#include "gimpplugindebug.h"
#include "gimppluginmanager.h"
#include "gimppluginmanager-locale-domain.h"
#include "plug-in.h"
#include "plug-in-debug.h"
#include "plug-in-def.h"
#include "plug-in-locale-domain.h"
#include "plug-in-message.h"
#include "plug-in-params.h"
#include "plug-in-progress.h"
#include "plug-in-shm.h"
#include "plug-ins.h"
#include "gimp-intl.h"
@ -110,9 +109,9 @@ static void plug_in_prep_for_exec (gpointer data);
void
plug_in_init (Gimp *gimp)
plug_in_init (GimpPlugInManager *manager)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
/* initialize the gimp protocol library and set the read and
* write handlers.
@ -121,30 +120,16 @@ plug_in_init (Gimp *gimp)
gimp_wire_set_writer (plug_in_write);
gimp_wire_set_flusher (plug_in_flush);
/* allocate a piece of shared memory for use in transporting tiles
* 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 (gimp->use_shm)
plug_in_shm_init (gimp);
plug_in_debug_init (gimp);
}
void
plug_in_exit (Gimp *gimp)
plug_in_exit (GimpPlugInManager *manager)
{
GSList *list;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
plug_in_debug_exit (gimp);
if (gimp->use_shm)
plug_in_shm_exit (gimp);
list = gimp->open_plug_ins;
list = manager->open_plug_ins;
while (list)
{
PlugIn *plug_in = list->data;
@ -159,17 +144,17 @@ plug_in_exit (Gimp *gimp)
}
void
plug_in_call_query (Gimp *gimp,
GimpContext *context,
PlugInDef *plug_in_def)
plug_in_call_query (GimpPlugInManager *manager,
GimpContext *context,
PlugInDef *plug_in_def)
{
PlugIn *plug_in;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (GIMP_IS_CONTEXT (context));
g_return_if_fail (plug_in_def != NULL);
plug_in = plug_in_new (gimp, context, NULL, NULL, plug_in_def->prog);
plug_in = plug_in_new (manager, context, NULL, NULL, plug_in_def->prog);
if (plug_in)
{
@ -200,17 +185,17 @@ plug_in_call_query (Gimp *gimp,
}
void
plug_in_call_init (Gimp *gimp,
GimpContext *context,
PlugInDef *plug_in_def)
plug_in_call_init (GimpPlugInManager *manager,
GimpContext *context,
PlugInDef *plug_in_def)
{
PlugIn *plug_in;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (GIMP_IS_CONTEXT (context));
g_return_if_fail (plug_in_def != NULL);
plug_in = plug_in_new (gimp, context, NULL, NULL, plug_in_def->prog);
plug_in = plug_in_new (manager, context, NULL, NULL, plug_in_def->prog);
if (plug_in)
{
@ -241,15 +226,15 @@ plug_in_call_init (Gimp *gimp,
}
PlugIn *
plug_in_new (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpProcedure *procedure,
const gchar *prog)
plug_in_new (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpProcedure *procedure,
const gchar *prog)
{
PlugIn *plug_in;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
g_return_val_if_fail (prog != NULL, NULL);
@ -257,7 +242,7 @@ plug_in_new (Gimp *gimp,
plug_in = g_new0 (PlugIn, 1);
plug_in->gimp = gimp;
plug_in->manager = manager;
plug_in->ref_count = 1;
@ -347,21 +332,18 @@ plug_in_open (PlugIn *plug_in)
gint my_read[2];
gint my_write[2];
gchar **envp;
gchar *args[9], **argv, **debug_argv;
gchar *args[9], **argv;
gint argc;
gchar *interp, *interp_arg;
gchar *read_fd, *write_fd;
gchar *mode, *stm;
GError *error = NULL;
Gimp *gimp;
gboolean debug;
guint debug_flag;
guint spawn_flags;
g_return_val_if_fail (plug_in != NULL, FALSE);
gimp = plug_in->gimp;
/* Open two pipes. (Bidirectional communication).
*/
if ((pipe (my_read) == -1) || (pipe (my_write) == -1))
@ -427,9 +409,9 @@ plug_in_open (PlugIn *plug_in)
debug_flag = GIMP_DEBUG_WRAP_RUN;
}
stm = g_strdup_printf ("%d", plug_in->gimp->stack_trace_mode);
stm = g_strdup_printf ("%d", plug_in->manager->gimp->stack_trace_mode);
interp = gimp_interpreter_db_resolve (plug_in->gimp->interpreter_db,
interp = gimp_interpreter_db_resolve (plug_in->manager->interpreter_db,
plug_in->prog, &interp_arg);
argc = 0;
@ -449,16 +431,18 @@ plug_in_open (PlugIn *plug_in)
args[argc++] = NULL;
argv = args;
envp = gimp_environ_table_get_envp (plug_in->gimp->environ_table);
envp = gimp_environ_table_get_envp (plug_in->manager->environ_table);
spawn_flags = (G_SPAWN_LEAVE_DESCRIPTORS_OPEN |
G_SPAWN_DO_NOT_REAP_CHILD |
G_SPAWN_CHILD_INHERITS_STDIN);
debug = FALSE;
if (gimp->plug_in_debug)
if (plug_in->manager->debug)
{
debug_argv = plug_in_debug_argv (gimp, plug_in->name, debug_flag, args);
gchar **debug_argv = gimp_plug_in_debug_argv (plug_in->manager->debug,
plug_in->name,
debug_flag, args);
if (debug_argv)
{
@ -506,7 +490,8 @@ plug_in_open (PlugIn *plug_in)
plug_in->input_id = g_source_attach (source, NULL);
g_source_unref (source);
gimp->open_plug_ins = g_slist_prepend (gimp->open_plug_ins, plug_in);
plug_in->manager->open_plug_ins =
g_slist_prepend (plug_in->manager->open_plug_ins, plug_in);
}
plug_in->open = TRUE;
@ -529,7 +514,6 @@ void
plug_in_close (PlugIn *plug_in,
gboolean kill_it)
{
Gimp *gimp;
#ifndef G_OS_WIN32
gint status;
struct timeval tv;
@ -539,8 +523,6 @@ plug_in_close (PlugIn *plug_in,
g_return_if_fail (plug_in != NULL);
g_return_if_fail (plug_in->open == TRUE);
gimp = plug_in->gimp;
if (! plug_in->open)
return;
@ -568,7 +550,7 @@ plug_in_close (PlugIn *plug_in,
if (kill_it)
{
if (gimp->be_verbose)
if (plug_in->manager->gimp->be_verbose)
g_print (_("Terminating plug-in: '%s'\n"),
gimp_filename_to_utf8 (plug_in->prog));
@ -693,9 +675,10 @@ plug_in_close (PlugIn *plug_in,
plug_in_remove_temp_proc (plug_in, plug_in->temp_procedures->data);
/* Close any dialogs that this plugin might have opened */
gimp_pdb_dialogs_check (plug_in->gimp);
gimp_pdb_dialogs_check (plug_in->manager->gimp);
gimp->open_plug_ins = g_slist_remove (gimp->open_plug_ins, plug_in);
plug_in->manager->open_plug_ins =
g_slist_remove (plug_in->manager->open_plug_ins, plug_in);
}
static gboolean
@ -847,31 +830,31 @@ plug_in_flush (GIOChannel *channel,
}
void
plug_in_push (Gimp *gimp,
PlugIn *plug_in)
plug_in_push (GimpPlugInManager *manager,
PlugIn *plug_in)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
g_return_if_fail (plug_in != NULL);
gimp->current_plug_in = plug_in;
manager->current_plug_in = plug_in;
gimp->plug_in_stack = g_slist_prepend (gimp->plug_in_stack,
gimp->current_plug_in);
manager->plug_in_stack = g_slist_prepend (manager->plug_in_stack,
manager->current_plug_in);
}
void
plug_in_pop (Gimp *gimp)
plug_in_pop (GimpPlugInManager *manager)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
if (gimp->current_plug_in)
gimp->plug_in_stack = g_slist_remove (gimp->plug_in_stack,
gimp->plug_in_stack->data);
if (manager->current_plug_in)
manager->plug_in_stack = g_slist_remove (manager->plug_in_stack,
manager->plug_in_stack->data);
if (gimp->plug_in_stack)
gimp->current_plug_in = gimp->plug_in_stack->data;
if (manager->plug_in_stack)
manager->current_plug_in = manager->plug_in_stack->data;
else
gimp->current_plug_in = NULL;
manager->current_plug_in = NULL;
}
PlugInProcFrame *
@ -936,9 +919,9 @@ plug_in_main_loop (PlugIn *plug_in)
proc_frame->main_loop = g_main_loop_new (NULL, FALSE);
gimp_threads_leave (plug_in->gimp);
gimp_threads_leave (plug_in->manager->gimp);
g_main_loop_run (proc_frame->main_loop);
gimp_threads_enter (plug_in->gimp);
gimp_threads_enter (plug_in->manager->gimp);
g_main_loop_unref (proc_frame->main_loop);
proc_frame->main_loop = NULL;
@ -975,8 +958,10 @@ plug_in_get_undo_desc (PlugIn *plug_in)
if (proc)
{
const gchar *domain = plug_in_locale_domain (plug_in->gimp,
plug_in->prog, NULL);
const gchar *domain;
domain = gimp_plug_in_manager_get_locale_domain (plug_in->manager,
plug_in->prog, NULL);
undo_desc = gimp_plug_in_procedure_get_label (proc, domain);
}
@ -1071,7 +1056,7 @@ plug_in_add_temp_proc (PlugIn *plug_in,
plug_in->temp_procedures = g_slist_prepend (plug_in->temp_procedures,
g_object_ref (proc));
plug_ins_temp_procedure_add (plug_in->gimp, proc);
gimp_plug_in_manager_add_temp_proc (plug_in->manager, proc);
}
void
@ -1083,6 +1068,6 @@ plug_in_remove_temp_proc (PlugIn *plug_in,
plug_in->temp_procedures = g_slist_remove (plug_in->temp_procedures,
proc);
plug_ins_temp_procedure_remove (plug_in->gimp, proc);
gimp_plug_in_manager_remove_temp_proc (plug_in->manager, proc);
g_object_unref (proc);
}

View File

@ -32,7 +32,7 @@
struct _PlugIn
{
Gimp *gimp;
GimpPlugInManager *manager;
gint ref_count;
@ -68,17 +68,17 @@ struct _PlugIn
};
void plug_in_init (Gimp *gimp);
void plug_in_exit (Gimp *gimp);
void plug_in_init (GimpPlugInManager *manager);
void plug_in_exit (GimpPlugInManager *manager);
void plug_in_call_query (Gimp *gimp,
void plug_in_call_query (GimpPlugInManager *manager,
GimpContext *context,
PlugInDef *plug_in_def);
void plug_in_call_init (Gimp *gimp,
void plug_in_call_init (GimpPlugInManager *manager,
GimpContext *context,
PlugInDef *plug_in_def);
PlugIn * plug_in_new (Gimp *gimp,
PlugIn * plug_in_new (GimpPlugInManager *manager,
GimpContext *context,
GimpProgress *progress,
GimpProcedure *procedure,
@ -91,9 +91,9 @@ gboolean plug_in_open (PlugIn *plug_in);
void plug_in_close (PlugIn *plug_in,
gboolean kill_it);
void plug_in_push (Gimp *gimp,
PlugIn *plug_in);
void plug_in_pop (Gimp *gimp);
void plug_in_push (GimpPlugInManager *manager,
PlugIn *plug_in);
void plug_in_pop (GimpPlugInManager *manager);
PlugInProcFrame * plug_in_get_proc_frame (PlugIn *plug_in);

View File

@ -1,163 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
*
* plug-ins-query.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 <string.h>
#ifdef HAVE_GLIBC_REGEX
#include <regex.h>
#else
#include "regexrepl/regex.h"
#endif
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "plug-in-types.h"
#include "core/gimp.h"
#include "pdb/gimppluginprocedure.h"
static int
match_strings (regex_t *preg,
gchar *a)
{
return regexec (preg, a, 0, NULL, 0);
}
gint
plug_ins_query (Gimp *gimp,
const gchar *search_str,
gchar ***menu_strs,
gchar ***accel_strs,
gchar ***prog_strs,
gchar ***types_strs,
gchar ***realname_strs,
gint32 **time_ints)
{
gint32 num_plugins = 0;
GSList *list;
GSList *matched = NULL;
gint i = 0;
regex_t sregex;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
g_return_val_if_fail (menu_strs != NULL, 0);
g_return_val_if_fail (accel_strs != NULL, 0);
g_return_val_if_fail (prog_strs != NULL, 0);
g_return_val_if_fail (types_strs != NULL, 0);
g_return_val_if_fail (realname_strs != NULL, 0);
g_return_val_if_fail (time_ints != NULL, 0);
*menu_strs = NULL;
*accel_strs = NULL;
*prog_strs = NULL;
*types_strs = NULL;
*realname_strs = NULL;
*time_ints = NULL;
if (search_str && ! strlen (search_str))
search_str = NULL;
if (search_str && regcomp (&sregex, search_str, REG_ICASE))
return 0;
/* count number of plugin entries, then allocate arrays of correct size
* where we can store the strings.
*/
for (list = gimp->plug_in_procedures; list; list = g_slist_next (list))
{
GimpPlugInProcedure *proc = list->data;
if (proc->prog && proc->menu_paths)
{
gchar *name;
if (proc->menu_label)
{
name = proc->menu_label;
}
else
{
name = strrchr (proc->menu_paths->data, '/');
if (name)
name = name + 1;
else
name = proc->menu_paths->data;
}
name = gimp_strip_uline (name);
if (! search_str || ! match_strings (&sregex, name))
{
num_plugins++;
matched = g_slist_prepend (matched, proc);
}
g_free (name);
}
}
*menu_strs = g_new (gchar *, num_plugins);
*accel_strs = g_new (gchar *, num_plugins);
*prog_strs = g_new (gchar *, num_plugins);
*types_strs = g_new (gchar *, num_plugins);
*realname_strs = g_new (gchar *, num_plugins);
*time_ints = g_new (gint, num_plugins);
matched = g_slist_reverse (matched);
for (list = matched; list; list = g_slist_next (list))
{
GimpPlugInProcedure *proc = list->data;
gchar *name;
if (proc->menu_label)
name = g_strdup_printf ("%s/%s",
(gchar *) proc->menu_paths->data,
proc->menu_label);
else
name = g_strdup (proc->menu_paths->data);
(*menu_strs)[i] = gimp_strip_uline (name);
(*accel_strs)[i] = NULL;
(*prog_strs)[i] = g_strdup (proc->prog);
(*types_strs)[i] = g_strdup (proc->image_types);
(*realname_strs)[i] = g_strdup (GIMP_OBJECT (proc)->name);
(*time_ints)[i] = proc->mtime;
g_free (name);
i++;
}
g_slist_free (matched);
if (search_str)
regfree (&sregex);
return num_plugins;
}

View File

@ -1,35 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-ins-query.h
*
* 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.
*/
#ifndef __PLUG_INS_QUERY_H__
#define __PLUG_INS_QUERY_H__
gint plug_ins_query (Gimp *gimp,
const gchar *search_str,
gchar ***menu_strs,
gchar ***accel_strs,
gchar ***prog_strs,
gchar ***types_strs,
gchar ***realname_strs,
gint32 **time_ints);
#endif /* __PLUG_INS_QUERY_H__ */

View File

@ -1,648 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-ins.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 <string.h>
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpbase/gimpprotocol.h"
#include "libgimpconfig/gimpconfig.h"
#include "plug-in-types.h"
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "pdb/gimppdb.h"
#include "pdb/gimptemporaryprocedure.h"
#include "plug-in.h"
#include "plug-in-data.h"
#include "plug-in-def.h"
#include "plug-in-help-domain.h"
#include "plug-in-locale-domain.h"
#include "plug-in-menu-branch.h"
#include "plug-in-rc.h"
#include "plug-ins.h"
#include "gimp-intl.h"
/* local function prototypes */
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,
GimpPlugInProcedure *proc);
static gint plug_ins_file_proc_compare (gconstpointer a,
gconstpointer b,
gpointer data);
/* public functions */
void
plug_ins_init (Gimp *gimp,
GimpContext *context,
GimpInitStatusFunc status_callback)
{
gchar *pluginrc;
gchar *path;
GSList *rc_defs;
GSList *list;
GList *extensions = NULL;
gint n_plugins;
gint n_extensions;
gint nth;
GError *error = NULL;
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_CONTEXT (context));
g_return_if_fail (status_callback != NULL);
plug_in_init (gimp);
/* search for binaries in the plug-in directory path */
status_callback (_("Searching Plug-Ins"), "", 0.0);
path = gimp_config_path_expand (gimp->config->plug_in_path, TRUE, NULL);
gimp_datafiles_read_directories (path,
G_FILE_TEST_IS_EXECUTABLE,
plug_ins_add_from_file,
&gimp->plug_in_defs);
g_free (path);
/* read the pluginrc file for cached data */
if (gimp->config->plug_in_rc_path)
{
pluginrc = gimp_config_path_expand (gimp->config->plug_in_rc_path,
TRUE, NULL);
if (! g_path_is_absolute (pluginrc))
{
gchar *str = g_build_filename (gimp_directory (), pluginrc, NULL);
g_free (pluginrc);
pluginrc = str;
}
}
else
{
pluginrc = gimp_personal_rc_file ("pluginrc");
}
status_callback (_("Resource configuration"),
gimp_filename_to_utf8 (pluginrc), 0.0);
if (gimp->be_verbose)
g_print (_("Parsing '%s'\n"), gimp_filename_to_utf8 (pluginrc));
rc_defs = plug_in_rc_parse (gimp, pluginrc, &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
{
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
g_message (error->message);
g_clear_error (&error);
}
/* query any plug-ins that have changed since we last wrote out
* the pluginrc file
*/
status_callback (_("Querying new Plug-ins"), "", 0.0);
for (list = gimp->plug_in_defs, n_plugins = 0; list; list = list->next)
{
PlugInDef *plug_in_def = list->data;
if (plug_in_def->needs_query)
n_plugins++;
}
if (n_plugins)
{
gimp->write_pluginrc = TRUE;
for (list = gimp->plug_in_defs, nth = 0; list; list = list->next)
{
PlugInDef *plug_in_def = list->data;
if (plug_in_def->needs_query)
{
gchar *basename;
basename = g_filename_display_basename (plug_in_def->prog);
status_callback (NULL, basename,
(gdouble) nth++ / (gdouble) n_plugins);
g_free (basename);
if (gimp->be_verbose)
g_print (_("Querying plug-in: '%s'\n"),
gimp_filename_to_utf8 (plug_in_def->prog));
plug_in_call_query (gimp, context, plug_in_def);
}
}
}
/* initialize the plug-ins */
status_callback (_("Initializing Plug-ins"), "", 0.0);
for (list = gimp->plug_in_defs, n_plugins = 0; list; list = list->next)
{
PlugInDef *plug_in_def = list->data;
if (plug_in_def->has_init)
n_plugins++;
}
if (n_plugins)
{
for (list = gimp->plug_in_defs, nth = 0; list; list = list->next)
{
PlugInDef *plug_in_def = list->data;
if (plug_in_def->has_init)
{
gchar *basename;
basename = g_filename_display_basename (plug_in_def->prog);
status_callback (NULL, basename,
(gdouble) nth++ / (gdouble) n_plugins);
g_free (basename);
if (gimp->be_verbose)
g_print (_("Initializing plug-in: '%s'\n"),
gimp_filename_to_utf8 (plug_in_def->prog));
plug_in_call_init (gimp, context, plug_in_def);
}
}
}
status_callback (NULL, "", 1.0);
/* add the procedures to gimp->plug_in_procedures */
for (list = gimp->plug_in_defs; list; list = list->next)
{
PlugInDef *plug_in_def = list->data;
GSList *list2;
for (list2 = plug_in_def->procedures; list2; list2 = list2->next)
{
plug_ins_procedure_add (gimp, list2->data);
}
}
/* write the pluginrc file if necessary */
if (gimp->write_pluginrc)
{
if (gimp->be_verbose)
g_print (_("Writing '%s'\n"), gimp_filename_to_utf8 (pluginrc));
if (! plug_in_rc_write (gimp->plug_in_defs, pluginrc, &error))
{
g_message ("%s", error->message);
g_clear_error (&error);
}
gimp->write_pluginrc = FALSE;
}
g_free (pluginrc);
/* create help_path and locale_domain lists */
for (list = gimp->plug_in_defs; list; list = list->next)
{
PlugInDef *plug_in_def = list->data;
if (plug_in_def->locale_domain_name)
plug_in_locale_domain_add (gimp,
plug_in_def->prog,
plug_in_def->locale_domain_name,
plug_in_def->locale_domain_path);
if (plug_in_def->help_domain_name)
plug_in_help_domain_add (gimp,
plug_in_def->prog,
plug_in_def->help_domain_name,
plug_in_def->help_domain_uri);
}
/* we're done with the plug-in-defs */
g_slist_foreach (gimp->plug_in_defs, (GFunc) plug_in_def_free, NULL);
g_slist_free (gimp->plug_in_defs);
gimp->plug_in_defs = NULL;
if (! gimp->no_interface)
{
gchar **locale_domains;
gchar **locale_paths;
gint n_domains;
gint i;
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);
n_domains = plug_in_locale_domains (gimp, &locale_domains,
&locale_paths);
for (i = 0; i < n_domains; i++)
{
bindtextdomain (locale_domains[i], locale_paths[i]);
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (locale_domains[i], "UTF-8");
#endif
}
g_strfreev (locale_domains);
g_strfreev (locale_paths);
}
/* add the plug-in procs to the procedure database */
for (list = gimp->plug_in_procedures; list; list = list->next)
{
plug_ins_add_to_db (gimp, context, list->data);
}
/* build list of automatically started extensions */
for (list = gimp->plug_in_procedures, nth = 0; list; list = list->next, nth++)
{
GimpPlugInProcedure *proc = list->data;
if (proc->prog &&
GIMP_PROCEDURE (proc)->proc_type == GIMP_EXTENSION &&
GIMP_PROCEDURE (proc)->num_args == 0)
{
extensions = g_list_prepend (extensions, proc);
}
}
extensions = g_list_reverse (extensions);
n_extensions = g_list_length (extensions);
/* run the available extensions */
if (extensions)
{
GList *list;
status_callback (_("Starting Extensions"), "", 0.0);
for (list = extensions, nth = 0; list; list = g_list_next (list), nth++)
{
GimpPlugInProcedure *proc = list->data;
GValueArray *args;
if (gimp->be_verbose)
g_print (_("Starting extension: '%s'\n"),
GIMP_OBJECT (proc)->name);
status_callback (NULL, GIMP_OBJECT (proc)->name,
(gdouble) nth / (gdouble) n_extensions);
args = g_value_array_new (0);
gimp_procedure_execute_async (GIMP_PROCEDURE (proc),
gimp, context, NULL, args, -1);
g_value_array_free (args);
}
g_list_free (extensions);
}
status_callback ("", "", 1.0);
}
void
plug_ins_exit (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
plug_in_exit (gimp);
plug_in_menu_branch_exit (gimp);
plug_in_locale_domain_exit (gimp);
plug_in_help_domain_exit (gimp);
plug_in_data_free (gimp);
g_slist_foreach (gimp->plug_in_procedures, (GFunc) g_object_unref, NULL);
g_slist_free (gimp->plug_in_procedures);
gimp->plug_in_procedures = NULL;
}
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));
}
void
plug_ins_temp_procedure_add (Gimp *gimp,
GimpTemporaryProcedure *proc)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_TEMPORARY_PROCEDURE (proc));
/* Register the procedural database entry */
gimp_pdb_register_procedure (gimp->pdb, GIMP_PROCEDURE (proc));
/* Add the definition to the global list */
gimp->plug_in_procedures = g_slist_prepend (gimp->plug_in_procedures,
g_object_ref (proc));
}
void
plug_ins_temp_procedure_remove (Gimp *gimp,
GimpTemporaryProcedure *proc)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_TEMPORARY_PROCEDURE (proc));
/* Remove the definition from the global list */
gimp->plug_in_procedures = g_slist_remove (gimp->plug_in_procedures, proc);
/* Unregister the procedural database entry */
gimp_pdb_unregister_procedure (gimp->pdb, GIMP_PROCEDURE (proc));
g_object_unref (proc);
}
/* private functions */
static void
plug_ins_add_from_file (const GimpDatafileData *file_data,
gpointer data)
{
PlugInDef *plug_in_def;
GSList **plug_in_defs = data;
GSList *list;
for (list = *plug_in_defs; list; list = list->next)
{
gchar *plug_in_name;
plug_in_def = list->data;
plug_in_name = g_path_get_basename (plug_in_def->prog);
if (g_ascii_strcasecmp (file_data->basename, plug_in_name) == 0)
{
g_printerr ("skipping duplicate plug-in: '%s'\n",
gimp_filename_to_utf8 (file_data->filename));
g_free (plug_in_name);
return;
}
g_free (plug_in_name);
}
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);
*plug_in_defs = g_slist_prepend (*plug_in_defs, plug_in_def);
}
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);
}
static void
plug_ins_add_to_db (Gimp *gimp,
GimpContext *context,
GimpPlugInProcedure *proc)
{
gimp_pdb_register_procedure (gimp->pdb, GIMP_PROCEDURE (proc));
if (proc->file_proc)
{
GValueArray *return_vals;
if (proc->image_types)
{
return_vals =
gimp_pdb_execute_procedure_by_name (gimp->pdb, context, NULL,
"gimp-register-save-handler",
G_TYPE_STRING, GIMP_OBJECT (proc)->name,
G_TYPE_STRING, proc->extensions,
G_TYPE_STRING, proc->prefixes,
G_TYPE_NONE);
}
else
{
return_vals =
gimp_pdb_execute_procedure_by_name (gimp->pdb, context, NULL,
"gimp-register-magic-load-handler",
G_TYPE_STRING, GIMP_OBJECT (proc)->name,
G_TYPE_STRING, proc->extensions,
G_TYPE_STRING, proc->prefixes,
G_TYPE_STRING, proc->magics,
G_TYPE_NONE);
}
g_value_array_free (return_vals);
}
}
static gint
plug_ins_file_proc_compare (gconstpointer a,
gconstpointer b,
gpointer data)
{
Gimp *gimp = data;
const GimpPlugInProcedure *proc_a = a;
const GimpPlugInProcedure *proc_b = b;
const gchar *domain_a;
const gchar *domain_b;
gchar *label_a;
gchar *label_b;
gint retval = 0;
if (strncmp (proc_a->prog, "gimp-xcf", 8) == 0)
return -1;
if (strncmp (proc_b->prog, "gimp-xcf", 8) == 0)
return 1;
domain_a = plug_in_locale_domain (gimp, proc_a->prog, NULL);
domain_b = plug_in_locale_domain (gimp, proc_b->prog, NULL);
label_a = gimp_plug_in_procedure_get_label (proc_a, domain_a);
label_b = gimp_plug_in_procedure_get_label (proc_b, domain_b);
if (label_a && label_b)
retval = g_utf8_collate (label_a, label_b);
g_free (label_a);
g_free (label_b);
return retval;
}

View File

@ -1,44 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-ins.h
*
* 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.
*/
#ifndef __PLUG_INS_H__
#define __PLUG_INS_H__
void plug_ins_init (Gimp *gimp,
GimpContext *context,
GimpInitStatusFunc status_callback);
void plug_ins_exit (Gimp *gimp);
/* Register a plug-in. This function is public for file load-save
* handlers, which are organized around the plug-in data structure.
* This could all be done a little better, but oh well. -josh
*/
void plug_ins_procedure_add (Gimp *gimp,
GimpPlugInProcedure *proc);
/* Add/Remove temporary procedures. */
void plug_ins_temp_procedure_add (Gimp *gimp,
GimpTemporaryProcedure *proc);
void plug_ins_temp_procedure_remove (Gimp *gimp,
GimpTemporaryProcedure *proc);
#endif /* __PLUG_INS_H__ */

View File

@ -38,6 +38,8 @@
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "plug-in/gimppluginmanager.h"
#include "file/file-save.h"
#include "file/file-utils.h"
@ -139,7 +141,7 @@ gimp_dnd_xds_save_image (GdkDragContext *context,
uri = g_strndup ((const gchar *) data, length);
g_free (data);
proc = file_utils_find_proc (image->gimp->save_procs, uri);
proc = file_utils_find_proc (image->gimp->plug_in_manager->save_procs, uri);
if (proc)
{

View File

@ -37,7 +37,8 @@
#include "file/file-utils.h"
#include "plug-in/plug-in-locale-domain.h"
#include "plug-in/gimppluginmanager.h"
#include "plug-in/gimppluginmanager-locale-domain.h"
#include "pdb/gimppdb.h"
#include "pdb/gimppluginprocedure.h"
@ -263,7 +264,7 @@ gimp_file_dialog_new (Gimp *gimp,
switch (action)
{
case GTK_FILE_CHOOSER_ACTION_OPEN:
file_procs = gimp->load_procs;
file_procs = gimp->plug_in_manager->load_procs;
automatic = _("Automatically Detected");
automatic_help_id = GIMP_HELP_FILE_OPEN_BY_EXTENSION;
@ -273,7 +274,7 @@ gimp_file_dialog_new (Gimp *gimp,
break;
case GTK_FILE_CHOOSER_ACTION_SAVE:
file_procs = gimp->save_procs;
file_procs = gimp->plug_in_manager->save_procs;
automatic = _("By Extension");
automatic_help_id = GIMP_HELP_FILE_SAVE_BY_EXTENSION;
@ -462,7 +463,9 @@ gimp_file_dialog_add_filters (GimpFileDialog *dialog,
GSList *ext;
gint i;
domain = plug_in_locale_domain (gimp, file_proc->prog, NULL);
domain = gimp_plug_in_manager_get_locale_domain (gimp->plug_in_manager,
file_proc->prog,
NULL);
label = gimp_plug_in_procedure_get_label (file_proc, domain);

View File

@ -30,11 +30,11 @@
#include "core/gimp.h"
#include "core/gimpmarshal.h"
#include "plug-in/plug-in-help-domain.h"
#include "plug-in/plug-in-locale-domain.h"
#include "pdb/gimppluginprocedure.h"
#include "plug-in/gimppluginmanager-help-domain.h"
#include "plug-in/gimppluginmanager-locale-domain.h"
#include "gimpfileprocview.h"
#include "gimp-intl.h"
@ -148,8 +148,10 @@ gimp_file_proc_view_new (Gimp *gimp,
gchar *help_id;
GSList *list2;
locale_domain = plug_in_locale_domain (gimp, proc->prog, NULL);
help_domain = plug_in_help_domain (gimp, proc->prog, NULL);
locale_domain = gimp_plug_in_manager_get_locale_domain (gimp->plug_in_manager,
proc->prog, NULL);
help_domain = gimp_plug_in_manager_get_help_domain (gimp->plug_in_manager,
proc->prog, NULL);
label = gimp_plug_in_procedure_get_label (proc, locale_domain);
help_id = gimp_plug_in_procedure_get_help_id (proc, help_domain);

View File

@ -39,7 +39,7 @@
#include "pdb/gimppdb.h"
#include "pdb/gimpprocedure.h"
#include "plug-in/plug-in-help-domain.h"
#include "plug-in/gimppluginmanager-help-domain.h"
#include "gimphelp.h"
#include "gimphelp-ids.h"
@ -281,7 +281,9 @@ gimp_help_call (Gimp *gimp,
/* FIXME: error msg */
return;
n_domains = plug_in_help_domains (gimp, &help_domains, &help_uris);
n_domains = gimp_plug_in_manager_get_help_domains (gimp->plug_in_manager,
&help_domains,
&help_uris);
args = gimp_procedure_get_arguments (procedure);
gimp_value_array_truncate (args, 4);

View File

@ -34,6 +34,8 @@
#include "core/gimpimagefile.h"
#include "core/gimpprogress.h"
#include "plug-in/gimppluginmanager.h"
#include "file/file-utils.h"
#include "gimpfiledialog.h" /* eek */
@ -710,7 +712,8 @@ gimp_thumb_box_auto_thumbnail (GimpThumbBox *box)
case GIMP_THUMB_STATE_OLD:
if (thumb->image_filesize < gimp->config->thumbnail_filesize_limit &&
! gimp_thumbnail_has_failed (thumb) &&
file_utils_find_proc_by_extension (gimp->load_procs, uri))
file_utils_find_proc_by_extension (gimp->plug_in_manager->load_procs,
uri))
{
if (thumb->image_filesize > 0)
{

View File

@ -35,7 +35,7 @@
#include "pdb/gimppluginprocedure.h"
#include "plug-in/plug-ins.h"
#include "plug-in/gimppluginmanager.h"
#include "xcf.h"
#include "xcf-private.h"
@ -199,7 +199,7 @@ xcf_init (Gimp *gimp)
"file, in UTF-8",
FALSE, FALSE, NULL,
GIMP_PARAM_READWRITE));
plug_ins_procedure_add (gimp, proc);
gimp_plug_in_manager_add_procedure (gimp->plug_in_manager, proc);
g_object_unref (procedure);
/* gimp-xcf-load */
@ -260,7 +260,7 @@ xcf_init (Gimp *gimp)
"Output image",
gimp,
GIMP_PARAM_READWRITE));
plug_ins_procedure_add (gimp, proc);
gimp_plug_in_manager_add_procedure (gimp->plug_in_manager, proc);
g_object_unref (procedure);
}

View File

@ -38,8 +38,9 @@ HELP
%invoke = (
code => <<'CODE'
{
if (gimp->current_plug_in && gimp->current_plug_in->open)
success = plug_in_context_push (gimp->current_plug_in);
if (gimp->plug_in_manager->current_plug_in &&
gimp->plug_in_manager->current_plug_in->open)
success = plug_in_context_push (gimp->plug_in_manager->current_plug_in);
else
success = FALSE;
}
@ -61,8 +62,9 @@ HELP
%invoke = (
code => <<'CODE'
{
if (gimp->current_plug_in && gimp->current_plug_in->open)
success = plug_in_context_pop (gimp->current_plug_in);
if (gimp->plug_in_manager->current_plug_in &&
gimp->plug_in_manager->current_plug_in->open)
success = plug_in_context_pop (gimp->plug_in_manager->current_plug_in);
else
success = FALSE;
}
@ -684,7 +686,8 @@ CODE
@headers = qw("core/gimp.h" "core/gimpcontainer.h" "core/gimpcontext.h"
"core/gimpdatafactory.h"
"plug-in/plug-in.h" "plug-in/plug-in-context.h");
"plug-in/gimppluginmanager.h" "plug-in/plug-in.h"
"plug-in/plug-in-context.h");
@procs = qw(context_push context_pop
context_get_paint_method context_set_paint_method

View File

@ -38,15 +38,15 @@ HELP
);
%invoke = (
headers => [ qw("plug-in/plug-in.h") ],
headers => [ qw("plug-in/gimppluginmanager.h" "plug-in/plug-in.h") ],
code => <<'CODE'
{
if (gimp_item_is_attached (GIMP_ITEM (drawable)))
{
gchar *undo_desc = NULL;
if (gimp->current_plug_in)
undo_desc = plug_in_get_undo_desc (gimp->current_plug_in);
if (gimp->plug_in_manager->current_plug_in)
undo_desc = plug_in_get_undo_desc (gimp->plug_in_manager->current_plug_in);
if (! undo_desc)
undo_desc = g_strdup (_("Plug-In"));

Some files were not shown because too many files have changed in this diff Show More