mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-22 12:32:37 +00:00
f1c3e79a4b
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.
135 lines
3.4 KiB
C
135 lines
3.4 KiB
C
/* 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
|
|
* (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 "gimppluginmanager.h"
|
|
#include "gimppluginmanager-data.h"
|
|
|
|
|
|
typedef struct _GimpPlugInData GimpPlugInData;
|
|
|
|
struct _GimpPlugInData
|
|
{
|
|
gchar *identifier;
|
|
gint32 bytes;
|
|
guint8 *data;
|
|
};
|
|
|
|
|
|
/* public functions */
|
|
|
|
void
|
|
gimp_plug_in_manager_data_free (GimpPlugInManager *manager)
|
|
{
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
|
|
|
if (manager->data_list)
|
|
{
|
|
GList *list;
|
|
|
|
for (list = manager->data_list;
|
|
list;
|
|
list = g_list_next (list))
|
|
{
|
|
GimpPlugInData *data = list->data;
|
|
|
|
g_free (data->identifier);
|
|
g_free (data->data);
|
|
g_free (data);
|
|
}
|
|
|
|
g_list_free (manager->data_list);
|
|
manager->data_list = NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
gimp_plug_in_manager_set_data (GimpPlugInManager *manager,
|
|
const gchar *identifier,
|
|
gint32 bytes,
|
|
const guint8 *data)
|
|
{
|
|
GimpPlugInData *plug_in_data;
|
|
GList *list;
|
|
|
|
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 = manager->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 (GimpPlugInData, 1);
|
|
plug_in_data->identifier = g_strdup (identifier);
|
|
|
|
manager->data_list = g_list_prepend (manager->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 *
|
|
gimp_plug_in_manager_get_data (GimpPlugInManager *manager,
|
|
const gchar *identifier,
|
|
gint32 *bytes)
|
|
{
|
|
GList *list;
|
|
|
|
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 = manager->data_list; list; list = g_list_next (list))
|
|
{
|
|
GimpPlugInData *plug_in_data = list->data;
|
|
|
|
if (! strcmp (plug_in_data->identifier, identifier))
|
|
{
|
|
*bytes = plug_in_data->bytes;
|
|
return plug_in_data->data;
|
|
}
|
|
}
|
|
|
|
return NULL;
|
|
}
|