2001-10-19 01:27:36 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2002-10-21 22:15:02 +08:00
|
|
|
* gimpmodule.c
|
2001-10-19 01:27:36 +08:00
|
|
|
* (C) 1999 Austin Donnelly <austin@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 <string.h>
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
#include "gimpmodule.h"
|
2001-10-19 01:27:36 +08:00
|
|
|
|
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
MODIFIED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
static void gimp_module_class_init (GimpModuleClass *klass);
|
|
|
|
static void gimp_module_init (GimpModule *module);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
static void gimp_module_finalize (GObject *object);
|
2002-01-31 00:14:26 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
static gboolean gimp_module_load (GTypeModule *module);
|
|
|
|
static void gimp_module_unload (GTypeModule *module);
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
static void gimp_module_set_last_error (GimpModule *module,
|
|
|
|
const gchar *error_str);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
static guint module_signals[LAST_SIGNAL];
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-20 18:14:17 +08:00
|
|
|
static GTypeModuleClass *parent_class = NULL;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
GType
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module_get_type (void)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
static GType module_type = 0;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
if (! module_type)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
static const GTypeInfo module_info =
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
sizeof (GimpModuleClass),
|
2001-10-19 01:27:36 +08:00
|
|
|
NULL, /* base_init */
|
|
|
|
NULL, /* base_finalize */
|
2002-10-21 22:15:02 +08:00
|
|
|
(GClassInitFunc) gimp_module_class_init,
|
2001-10-19 01:27:36 +08:00
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
2002-10-21 22:15:02 +08:00
|
|
|
sizeof (GimpModule),
|
2001-10-19 01:27:36 +08:00
|
|
|
0, /* n_preallocs */
|
2002-10-21 22:15:02 +08:00
|
|
|
(GInstanceInitFunc) gimp_module_init,
|
2001-10-19 01:27:36 +08:00
|
|
|
};
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
module_type = g_type_register_static (G_TYPE_TYPE_MODULE,
|
|
|
|
"GimpModule",
|
|
|
|
&module_info, 0);
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
return module_type;
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module_class_init (GimpModuleClass *klass)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-20 18:14:17 +08:00
|
|
|
GObjectClass *object_class;
|
|
|
|
GTypeModuleClass *module_class;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-20 18:14:17 +08:00
|
|
|
object_class = G_OBJECT_CLASS (klass);
|
|
|
|
module_class = G_TYPE_MODULE_CLASS (klass);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
module_signals[MODIFIED] =
|
2001-10-19 01:27:36 +08:00
|
|
|
g_signal_new ("modified",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
2002-10-21 22:15:02 +08:00
|
|
|
G_STRUCT_OFFSET (GimpModuleClass, modified),
|
2001-10-19 01:27:36 +08:00
|
|
|
NULL, NULL,
|
2002-10-21 22:15:02 +08:00
|
|
|
g_cclosure_marshal_VOID__VOID,
|
2001-10-19 01:27:36 +08:00
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
object_class->finalize = gimp_module_finalize;
|
2002-01-31 00:14:26 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
module_class->load = gimp_module_load;
|
|
|
|
module_class->unload = gimp_module_unload;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-20 18:14:17 +08:00
|
|
|
klass->modified = NULL;
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module_init (GimpModule *module)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
module->filename = NULL;
|
|
|
|
module->verbose = FALSE;
|
|
|
|
module->state = GIMP_MODULE_STATE_ERROR;
|
|
|
|
module->on_disk = FALSE;
|
|
|
|
module->load_inhibit = FALSE;
|
|
|
|
|
|
|
|
module->module = NULL;
|
|
|
|
module->info = NULL;
|
|
|
|
module->last_module_error = NULL;
|
|
|
|
|
|
|
|
module->query_module = NULL;
|
|
|
|
module->register_module = NULL;
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module_finalize (GObject *object)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
GimpModule *module;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
module = GIMP_MODULE (object);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
if (module->info)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module_info_free (module->info);
|
|
|
|
module->info = NULL;
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
if (module->last_module_error)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
g_free (module->last_module_error);
|
|
|
|
module->last_module_error = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (module->filename)
|
|
|
|
{
|
|
|
|
g_free (module->filename);
|
|
|
|
module->filename = NULL;
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2002-10-20 18:14:17 +08:00
|
|
|
static gboolean
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module_load (GTypeModule *module)
|
2002-10-20 18:14:17 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
GimpModule *gimp_module;
|
2002-10-20 20:40:30 +08:00
|
|
|
const GimpModuleInfo *info;
|
|
|
|
gpointer symbol;
|
|
|
|
gboolean retval;
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_MODULE (module), FALSE);
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module = GIMP_MODULE (module);
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
g_return_val_if_fail (gimp_module->filename != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (gimp_module->module == NULL, FALSE);
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
if (gimp_module->verbose)
|
|
|
|
g_print (_("loading module: '%s'\n"), gimp_module->filename);
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->module = g_module_open (gimp_module->filename,
|
2002-10-20 18:14:17 +08:00
|
|
|
G_MODULE_BIND_LAZY);
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
if (! gimp_module->module)
|
2002-10-20 18:14:17 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->state = GIMP_MODULE_STATE_ERROR;
|
|
|
|
gimp_module_set_last_error (gimp_module, g_module_error ());
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
if (gimp_module->verbose)
|
2002-10-20 18:14:17 +08:00
|
|
|
g_message (_("Module '%s' load error:\n%s"),
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->filename, gimp_module->last_module_error);
|
2002-10-20 18:14:17 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-10-20 20:40:30 +08:00
|
|
|
/* find the gimp_module_query symbol */
|
2002-10-21 22:15:02 +08:00
|
|
|
if (! g_module_symbol (gimp_module->module, "gimp_module_query", &symbol))
|
2002-10-20 20:40:30 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->state = GIMP_MODULE_STATE_ERROR;
|
2002-10-20 20:40:30 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module_set_last_error (gimp_module,
|
|
|
|
_("Missing gimp_module_query() symbol"));
|
2002-10-20 20:40:30 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
if (gimp_module->verbose)
|
2002-10-20 20:40:30 +08:00
|
|
|
g_message (_("Module '%s' load error:\n%s"),
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->filename, gimp_module->last_module_error);
|
|
|
|
g_module_close (gimp_module->module);
|
|
|
|
gimp_module->module = NULL;
|
2002-10-20 20:40:30 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->query_module = symbol;
|
|
|
|
|
|
|
|
info = gimp_module->query_module (module);
|
2002-10-20 20:40:30 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
if (gimp_module->info)
|
|
|
|
{
|
|
|
|
gimp_module_info_free (gimp_module->info);
|
|
|
|
gimp_module->info = NULL;
|
|
|
|
}
|
2002-10-20 20:40:30 +08:00
|
|
|
|
|
|
|
if (! info)
|
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->state = GIMP_MODULE_STATE_ERROR;
|
2002-10-20 20:40:30 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module_set_last_error (gimp_module,
|
|
|
|
_("gimp_module_query() returned NULL"));
|
2002-10-20 20:40:30 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
if (gimp_module->verbose)
|
2002-10-20 20:40:30 +08:00
|
|
|
g_message (_("Module '%s' load error:\n%s"),
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->filename, gimp_module->last_module_error);
|
|
|
|
g_module_close (gimp_module->module);
|
|
|
|
gimp_module->module = NULL;
|
|
|
|
gimp_module->query_module = NULL;
|
2002-10-20 20:40:30 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->info = gimp_module_info_copy (info);
|
2002-10-20 20:40:30 +08:00
|
|
|
|
|
|
|
/* find the gimp_module_register symbol */
|
2002-10-21 22:15:02 +08:00
|
|
|
if (! g_module_symbol (gimp_module->module, "gimp_module_register", &symbol))
|
2002-10-20 18:14:17 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->state = GIMP_MODULE_STATE_ERROR;
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module_set_last_error (gimp_module,
|
|
|
|
_("Missing gimp_module_register() symbol"));
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
if (gimp_module->verbose)
|
2002-10-20 18:14:17 +08:00
|
|
|
g_message (_("Module '%s' load error:\n%s"),
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->filename, gimp_module->last_module_error);
|
|
|
|
g_module_close (gimp_module->module);
|
|
|
|
gimp_module->module = NULL;
|
2002-10-20 18:14:17 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->register_module = symbol;
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
retval = gimp_module->register_module (module);
|
2002-10-20 18:14:17 +08:00
|
|
|
|
|
|
|
if (retval)
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->state = GIMP_MODULE_STATE_LOADED_OK;
|
2002-10-20 18:14:17 +08:00
|
|
|
else
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->state = GIMP_MODULE_STATE_LOAD_FAILED;
|
2002-10-20 18:14:17 +08:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module_unload (GTypeModule *module)
|
2002-01-31 00:14:26 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
GimpModule *gimp_module;
|
2002-01-31 00:14:26 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
g_return_if_fail (GIMP_IS_MODULE (module));
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module = GIMP_MODULE (module);
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
g_return_if_fail (gimp_module->module != NULL);
|
2002-01-31 00:14:26 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
g_module_close (gimp_module->module); /* FIXME: error handling */
|
|
|
|
gimp_module->module = NULL;
|
|
|
|
gimp_module->query_module = NULL;
|
|
|
|
gimp_module->register_module = NULL;
|
2002-01-31 00:14:26 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module->state = GIMP_MODULE_STATE_UNLOADED_OK;
|
2002-01-31 00:14:26 +08:00
|
|
|
}
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
GimpModule *
|
|
|
|
gimp_module_new (const gchar *filename,
|
|
|
|
const gchar *inhibit_list,
|
|
|
|
gboolean verbose)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
GimpModule *module;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (filename != NULL, NULL);
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
module = g_object_new (GIMP_TYPE_MODULE, NULL);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
module->filename = g_strdup (filename);
|
|
|
|
module->verbose = verbose ? TRUE : FALSE;
|
|
|
|
module->on_disk = TRUE;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module_set_load_inhibit (module, inhibit_list);
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
if (! module->load_inhibit)
|
2002-10-20 18:14:17 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
if (gimp_module_load (G_TYPE_MODULE (module)))
|
|
|
|
gimp_module_unload (G_TYPE_MODULE (module));
|
2002-10-20 18:14:17 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (verbose)
|
|
|
|
g_print (_("skipping module: '%s'\n"), filename);
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
module->state = GIMP_MODULE_STATE_UNLOADED_OK;
|
2002-10-20 18:14:17 +08:00
|
|
|
}
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
return module;
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module_modified (GimpModule *module)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
g_return_if_fail (GIMP_IS_MODULE (module));
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
g_signal_emit (G_OBJECT (module), module_signals[MODIFIED], 0);
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module_set_load_inhibit (GimpModule *module,
|
|
|
|
const gchar *inhibit_list)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
|
|
|
gchar *p;
|
|
|
|
gint pathlen;
|
|
|
|
const gchar *start;
|
|
|
|
const gchar *end;
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
g_return_if_fail (GIMP_IS_MODULE (module));
|
|
|
|
g_return_if_fail (module->filename != NULL);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
module->load_inhibit = FALSE;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
|
|
|
if (! inhibit_list || ! strlen (inhibit_list))
|
|
|
|
return;
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
p = strstr (inhibit_list, module->filename);
|
2001-10-19 01:27:36 +08:00
|
|
|
if (!p)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* we have a substring, but check for colons either side */
|
|
|
|
start = p;
|
|
|
|
while (start != inhibit_list && *start != G_SEARCHPATH_SEPARATOR)
|
|
|
|
start--;
|
|
|
|
|
|
|
|
if (*start == G_SEARCHPATH_SEPARATOR)
|
|
|
|
start++;
|
|
|
|
|
|
|
|
end = strchr (p, G_SEARCHPATH_SEPARATOR);
|
|
|
|
if (! end)
|
|
|
|
end = inhibit_list + strlen (inhibit_list);
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
pathlen = strlen (module->filename);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
|
|
|
if ((end - start) == pathlen)
|
2002-10-21 22:15:02 +08:00
|
|
|
module->load_inhibit = TRUE;
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-10-21 22:15:02 +08:00
|
|
|
gimp_module_set_last_error (GimpModule *module,
|
|
|
|
const gchar *error_str)
|
|
|
|
{
|
|
|
|
if (module->last_module_error)
|
|
|
|
g_free (module->last_module_error);
|
|
|
|
|
|
|
|
module->last_module_error = g_strdup (error_str);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* GimpModuleInfo functions */
|
|
|
|
|
|
|
|
GimpModuleInfo *
|
|
|
|
gimp_module_info_new (const gchar *purpose,
|
|
|
|
const gchar *author,
|
|
|
|
const gchar *version,
|
|
|
|
const gchar *copyright,
|
|
|
|
const gchar *date)
|
|
|
|
{
|
|
|
|
GimpModuleInfo *info;
|
|
|
|
|
|
|
|
info = g_new0 (GimpModuleInfo, 1);
|
|
|
|
|
|
|
|
info->purpose = g_strdup (purpose);
|
|
|
|
info->author = g_strdup (author);
|
|
|
|
info->version = g_strdup (version);
|
|
|
|
info->copyright = g_strdup (copyright);
|
|
|
|
info->date = g_strdup (date);
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpModuleInfo *
|
|
|
|
gimp_module_info_copy (const GimpModuleInfo *info)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (info != NULL, NULL);
|
|
|
|
|
|
|
|
return gimp_module_info_new (info->purpose,
|
|
|
|
info->author,
|
|
|
|
info->version,
|
|
|
|
info->copyright,
|
|
|
|
info->date);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_module_info_free (GimpModuleInfo *info)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
g_return_if_fail (info != NULL);
|
|
|
|
|
|
|
|
g_free (info->purpose);
|
|
|
|
g_free (info->author);
|
|
|
|
g_free (info->version);
|
|
|
|
g_free (info->copyright);
|
|
|
|
g_free (info->date);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
g_free (info);
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|