Makefile.am libgimpmodule/.cvsignore libgimpmodule/Makefile.am

2002-10-21  Michael Natterer  <mitch@gimp.org>

	* Makefile.am
	* libgimpmodule/.cvsignore
	* libgimpmodule/Makefile.am
	* libgimpmodule/gimpmodule.[ch]
	* libgimpmodule/gimpmodule.def
	* libgimpmodule/gimpmoduletypes.h
	* libgimpmodule/makefile.msc: new library for module loading.

	* configure.in: generate Makefiles for libgimpmodule and its
	devel-docs. Added GMODULE_CFLAGS and GMODULE_LIBS.

	* app/Makefile.am: link the app against it.

	* libgimp/gimpmodule.h
	* app/core/gimpmoduleinfo.[ch]: removed.

	* libgimp/Makefile.am
	* app/core/Makefile.am
	* app/core/core-types.h
	* app/core/gimpmodules.c
	* app/gui/module-browser.c: changed accordingly.

	* modules/cdisplay_gamma.c
	* modules/cdisplay_highcontrast.c
	* modules/colorsel_triangle.c
	* modules/colorsel_water.c: #include "libgimpmodule/gimpmodule.h"

2002-10-21  Michael Natterer  <mitch@gimp.org>

	* Makefile.am
	* libgimpmodule/.cvsignore
	* libgimpmodule/Makefile.am
	* libgimpmodule/libgimpmodule-docs.sgml
	* libgimpmodule/libgimpmodule-sections.txt
	* libgimpmodule/libgimpmodule.types
	* libgimpmodule/tmpl/.cvsignore
	* libgimpmodule/tmpl/gimpmodule.sgml
	* libgimpmodule/tmpl/gimpmoduletypes.sgml: added API docs for the
	new module loading lib.

	* libgimp/tmpl/gimpmodule.sgml: removed.

	* libgimp/libgimp-docs.sgml
	* libgimp/libgimp-sections.txt: changed accordingly.

	* libgimpwidgets/tmpl/gimpcolordisplay.sgml
	* libgimpwidgets/tmpl/gimpcolorselect.sgml
	* libgimpwidgets/tmpl/gimpcolorselector.sgml: updated.

2002-10-21  Michael Natterer  <mitch@gimp.org>

	* POTFILES.in: removed app/core/gimpmoduleinfo.c

2002-10-21  Michael Natterer  <mitch@gimp.org>

	* POTFILES.in: added libgimpmodule/gimpmodule.c
This commit is contained in:
Michael Natterer 2002-10-21 14:15:02 +00:00 committed by Michael Natterer
parent fc451d3352
commit 0f77b4228f
45 changed files with 1501 additions and 1330 deletions

View File

@ -1,3 +1,32 @@
2002-10-21 Michael Natterer <mitch@gimp.org>
* Makefile.am
* libgimpmodule/.cvsignore
* libgimpmodule/Makefile.am
* libgimpmodule/gimpmodule.[ch]
* libgimpmodule/gimpmodule.def
* libgimpmodule/gimpmoduletypes.h
* libgimpmodule/makefile.msc: new library for module loading.
* configure.in: generate Makefiles for libgimpmodule and its
devel-docs. Added GMODULE_CFLAGS and GMODULE_LIBS.
* app/Makefile.am: link the app against it.
* libgimp/gimpmodule.h
* app/core/gimpmoduleinfo.[ch]: removed.
* libgimp/Makefile.am
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpmodules.c
* app/gui/module-browser.c: changed accordingly.
* modules/cdisplay_gamma.c
* modules/cdisplay_highcontrast.c
* modules/colorsel_triangle.c
* modules/colorsel_water.c: #include "libgimpmodule/gimpmodule.h"
2002-10-20 Michael Natterer <mitch@gimp.org>
* app/core/gimpmoduleinfo.[ch]

View File

@ -15,9 +15,10 @@ SUBDIRS = \
data \
etc \
tips \
libgimpbase \
libgimpcolor \
libgimpmath \
libgimpbase \
libgimpmodule \
libgimpwidgets \
libgimpproxy \
libgimptool \

View File

@ -115,6 +115,7 @@ gimp_1_3_LDADD = \
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \
$(top_builddir)/libgimpmath/libgimpmath-$(LT_RELEASE).la \
$(top_builddir)/libgimpbase/libgimpbase-$(LT_RELEASE).la \
$(top_builddir)/libgimpmodule/libgimpmodule-$(LT_RELEASE).la \
$(top_builddir)/libgimpwidgets/libgimpwidgets-$(LT_RELEASE).la \
$(top_builddir)/libgimptool/libgimptool-$(LT_RELEASE).la \
$(GTK_LIBS) \

View File

@ -134,8 +134,6 @@ libappcore_a_sources = \
gimplayermask.h \
gimplist.c \
gimplist.h \
gimpmoduleinfo.c \
gimpmoduleinfo.h \
gimpmodules.c \
gimpmodules.h \
gimpobject.c \

View File

@ -23,6 +23,7 @@
#include "libgimpmath/gimpmath.h"
#include "libgimpmodule/gimpmoduletypes.h"
#include "base/base-types.h"
@ -106,8 +107,6 @@ typedef struct _Gimp Gimp;
typedef struct _GimpParasiteList GimpParasiteList;
typedef struct _GimpModuleInfoObj GimpModuleInfoObj;
typedef struct _GimpContainer GimpContainer;
typedef struct _GimpList GimpList;
typedef struct _GimpDataList GimpDataList;

View File

@ -32,6 +32,7 @@
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpmodule/gimpmodule.h"
#include "core-types.h"
@ -39,7 +40,6 @@
#include "gimpcoreconfig.h"
#include "gimpdatafiles.h"
#include "gimplist.h"
#include "gimpmoduleinfo.h"
#include "gimpmodules.h"
#include "gimprc.h"
@ -50,23 +50,23 @@
#define DUMP_DB 1
static void gimp_modules_module_initialize (const gchar *filename,
gpointer loader_data);
static void gimp_modules_module_initialize (const gchar *filename,
gpointer loader_data);
static GimpModuleInfoObj * gimp_modules_module_find_by_path (Gimp *gimp,
const char *fullpath);
static GimpModule * gimp_modules_module_find_by_path (Gimp *gimp,
const char *fullpath);
#ifdef DUMP_DB
static void print_module_info (gpointer data,
gpointer user_data);
static void gimp_modules_dump_module (gpointer data,
gpointer user_data);
#endif
static gboolean gimp_modules_write_modulerc (Gimp *gimp);
static gboolean gimp_modules_write_modulerc (Gimp *gimp);
static void gimp_modules_module_on_disk_func (gpointer data,
gpointer user_data);
static void gimp_modules_module_remove_func (gpointer data,
gpointer user_data);
static void gimp_modules_module_on_disk_func (gpointer data,
gpointer user_data);
static void gimp_modules_module_remove_func (gpointer data,
gpointer user_data);
void
@ -74,7 +74,7 @@ gimp_modules_init (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->modules = gimp_list_new (GIMP_TYPE_MODULE_INFO,
gimp->modules = gimp_list_new (GIMP_TYPE_MODULE,
GIMP_CONTAINER_POLICY_STRONG);
gimp_object_set_name (GIMP_OBJECT (gimp->modules), "modules");
@ -111,7 +111,7 @@ gimp_modules_load (Gimp *gimp)
gimp);
#ifdef DUMP_DB
gimp_container_foreach (gimp->modules, print_module_info, NULL);
gimp_container_foreach (gimp->modules, gimp_modules_dump_module, NULL);
#endif
}
@ -156,13 +156,13 @@ static void
add_to_inhibit_string (gpointer data,
gpointer user_data)
{
GimpModuleInfoObj *module_info = data;
GString *str = user_data;
GimpModule *module = data;
GString *str = user_data;
if (module_info->load_inhibit)
if (module->load_inhibit)
{
str = g_string_append_c (str, G_SEARCHPATH_SEPARATOR);
str = g_string_append (str, module_info->filename);
str = g_string_append (str, module->filename);
}
}
@ -239,8 +239,8 @@ static void
gimp_modules_module_initialize (const gchar *filename,
gpointer loader_data)
{
GimpModuleInfoObj *module_info;
Gimp *gimp;
GimpModule *module;
Gimp *gimp;
gimp = GIMP (loader_data);
@ -251,26 +251,26 @@ gimp_modules_module_initialize (const gchar *filename,
if (gimp_modules_module_find_by_path (gimp, filename))
return;
module_info = gimp_module_info_new (filename,
gimp->config->module_db_load_inhibit,
gimp->be_verbose);
module = gimp_module_new (filename,
gimp->config->module_db_load_inhibit,
gimp->be_verbose);
gimp_container_add (gimp->modules, (GimpObject *) module_info);
gimp_container_add (gimp->modules, (GimpObject *) module);
}
static GimpModuleInfoObj *
static GimpModule *
gimp_modules_module_find_by_path (Gimp *gimp,
const char *fullpath)
{
GimpModuleInfoObj *module_info;
GList *list;
GimpModule *module;
GList *list;
for (list = GIMP_LIST (gimp->modules)->list; list; list = g_list_next (list))
{
module_info = (GimpModuleInfoObj *) list->data;
module = (GimpModule *) list->data;
if (! strcmp (module_info->filename, fullpath))
return module_info;
if (! strcmp (module->filename, fullpath))
return module;
}
return NULL;
@ -278,10 +278,10 @@ gimp_modules_module_find_by_path (Gimp *gimp,
#ifdef DUMP_DB
static void
print_module_info (gpointer data,
gpointer user_data)
gimp_modules_dump_module (gpointer data,
gpointer user_data)
{
GimpModuleInfoObj *i = data;
GimpModule *i = data;
g_print ("\n%s: %i\n",
i->filename,
@ -293,16 +293,19 @@ print_module_info (gpointer data,
i->query_module,
i->register_module);
g_print (" purpose: %s\n"
" author: %s\n"
" version: %s\n"
" copyright: %s\n"
" date: %s\n",
i->info.purpose ? i->info.purpose : "NONE",
i->info.author ? i->info.author : "NONE",
i->info.version ? i->info.version : "NONE",
i->info.copyright ? i->info.copyright : "NONE",
i->info.date ? i->info.date : "NONE");
if (i->info)
{
g_print (" purpose: %s\n"
" author: %s\n"
" version: %s\n"
" copyright: %s\n"
" date: %s\n",
i->info->purpose ? i->info->purpose : "NONE",
i->info->author ? i->info->author : "NONE",
i->info->version ? i->info->version : "NONE",
i->info->copyright ? i->info->copyright : "NONE",
i->info->date ? i->info->date : "NONE");
}
}
#endif
@ -310,40 +313,39 @@ static void
gimp_modules_module_on_disk_func (gpointer data,
gpointer user_data)
{
GimpModuleInfoObj *module_info;
GList **kill_list;
gint old_on_disk;
GimpModule *module;
GList **kill_list;
gint old_on_disk;
module_info = (GimpModuleInfoObj *) data;
kill_list = (GList **) user_data;
module = (GimpModule *) data;
kill_list = (GList **) user_data;
old_on_disk = module_info->on_disk;
old_on_disk = module->on_disk;
module_info->on_disk = g_file_test (module_info->filename,
G_FILE_TEST_IS_REGULAR);
module->on_disk = g_file_test (module->filename, G_FILE_TEST_IS_REGULAR);
/* if it's not on the disk, and it isn't in memory, mark it to be
* removed later.
*/
if (! module_info->on_disk && ! module_info->module)
if (! module->on_disk && ! module->module)
{
*kill_list = g_list_append (*kill_list, module_info);
module_info = NULL;
*kill_list = g_list_append (*kill_list, module);
module = NULL;
}
if (module_info && module_info->on_disk != old_on_disk)
gimp_module_info_modified (module_info);
if (module && module->on_disk != old_on_disk)
gimp_module_modified (module);
}
static void
gimp_modules_module_remove_func (gpointer data,
gpointer user_data)
{
GimpModuleInfoObj *module_info;
Gimp *gimp;
GimpModule *module;
Gimp *gimp;
module_info = (GimpModuleInfoObj *) data;
gimp = (Gimp *) user_data;
module = (GimpModule *) data;
gimp = (Gimp *) user_data;
gimp_container_remove (gimp->modules, (GimpObject *) module_info);
gimp_container_remove (gimp->modules, (GimpObject *) module);
}

View File

@ -1,373 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpmoduleinfo.c
* (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>
#include "libgimp/gimpmodule.h"
#include "core-types.h"
#include "gimpmarshal.h"
#include "gimpmoduleinfo.h"
#include "libgimp/gimpintl.h"
enum
{
MODIFIED,
LAST_SIGNAL
};
static void gimp_module_info_class_init (GimpModuleInfoObjClass *klass);
static void gimp_module_info_init (GimpModuleInfoObj *mod);
static void gimp_module_info_finalize (GObject *object);
static gboolean gimp_module_info_load (GTypeModule *module);
static void gimp_module_info_unload (GTypeModule *module);
static void gimp_module_info_set_last_error (GimpModuleInfoObj *module_info,
const gchar *error_str);
static guint module_info_signals[LAST_SIGNAL];
static GTypeModuleClass *parent_class = NULL;
GType
gimp_module_info_get_type (void)
{
static GType module_info_type = 0;
if (! module_info_type)
{
static const GTypeInfo module_info_info =
{
sizeof (GimpModuleInfoObjClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gimp_module_info_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpModuleInfoObj),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_module_info_init,
};
module_info_type = g_type_register_static (G_TYPE_TYPE_MODULE,
"GimpModuleInfoObj",
&module_info_info, 0);
}
return module_info_type;
}
static void
gimp_module_info_class_init (GimpModuleInfoObjClass *klass)
{
GObjectClass *object_class;
GTypeModuleClass *module_class;
object_class = G_OBJECT_CLASS (klass);
module_class = G_TYPE_MODULE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
module_info_signals[MODIFIED] =
g_signal_new ("modified",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpModuleInfoObjClass, modified),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->finalize = gimp_module_info_finalize;
module_class->load = gimp_module_info_load;
module_class->unload = gimp_module_info_unload;
klass->modified = NULL;
}
static void
gimp_module_info_init (GimpModuleInfoObj *module_info)
{
module_info->filename = NULL;
module_info->verbose = FALSE;
module_info->state = GIMP_MODULE_STATE_ERROR;
module_info->on_disk = FALSE;
module_info->load_inhibit = FALSE;
module_info->module = NULL;
module_info->last_module_error = NULL;
module_info->register_module = NULL;
}
static void
gimp_module_info_finalize (GObject *object)
{
GimpModuleInfoObj *mod;
mod = GIMP_MODULE_INFO (object);
if (mod->last_module_error)
{
g_free (mod->last_module_error);
mod->last_module_error = NULL;
}
if (mod->filename)
{
g_free (mod->filename);
mod->filename = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gboolean
gimp_module_info_load (GTypeModule *module)
{
GimpModuleInfoObj *module_info;
const GimpModuleInfo *info;
gpointer symbol;
gboolean retval;
g_return_val_if_fail (GIMP_IS_MODULE_INFO (module), FALSE);
module_info = GIMP_MODULE_INFO (module);
g_return_val_if_fail (module_info->filename != NULL, FALSE);
g_return_val_if_fail (module_info->module == NULL, FALSE);
if (module_info->verbose)
g_print (_("loading module: '%s'\n"), module_info->filename);
module_info->module = g_module_open (module_info->filename,
G_MODULE_BIND_LAZY);
if (! module_info->module)
{
module_info->state = GIMP_MODULE_STATE_ERROR;
gimp_module_info_set_last_error (module_info, g_module_error ());
if (module_info->verbose)
g_message (_("Module '%s' load error:\n%s"),
module_info->filename, module_info->last_module_error);
return FALSE;
}
/* find the gimp_module_query symbol */
if (! g_module_symbol (module_info->module, "gimp_module_query", &symbol))
{
module_info->state = GIMP_MODULE_STATE_ERROR;
gimp_module_info_set_last_error (module_info,
_("Missing gimp_module_query() symbol"));
if (module_info->verbose)
g_message (_("Module '%s' load error:\n%s"),
module_info->filename, module_info->last_module_error);
g_module_close (module_info->module);
module_info->module = NULL;
return FALSE;
}
module_info->query_module = symbol;
info = module_info->query_module (module);
if (! info)
{
module_info->state = GIMP_MODULE_STATE_ERROR;
gimp_module_info_set_last_error (module_info,
_("gimp_module_query() returned NULL"));
if (module_info->verbose)
g_message (_("Module '%s' load error:\n%s"),
module_info->filename, module_info->last_module_error);
g_module_close (module_info->module);
module_info->module = NULL;
module_info->query_module = NULL;
return FALSE;
}
g_free ((gchar *) module_info->info.purpose);
module_info->info.purpose = g_strdup (info->purpose);
g_free ((gchar *) module_info->info.author);
module_info->info.author = g_strdup (info->author);
g_free ((gchar *) module_info->info.version);
module_info->info.version = g_strdup (info->version);
g_free ((gchar *) module_info->info.copyright);
module_info->info.copyright = g_strdup (info->copyright);
g_free ((gchar *) module_info->info.date);
module_info->info.date = g_strdup (info->date);
/* find the gimp_module_register symbol */
if (! g_module_symbol (module_info->module, "gimp_module_register", &symbol))
{
module_info->state = GIMP_MODULE_STATE_ERROR;
gimp_module_info_set_last_error (module_info,
_("Missing gimp_module_register() symbol"));
if (module_info->verbose)
g_message (_("Module '%s' load error:\n%s"),
module_info->filename, module_info->last_module_error);
g_module_close (module_info->module);
module_info->module = NULL;
return FALSE;
}
module_info->register_module = symbol;
retval = module_info->register_module (module);
if (retval)
module_info->state = GIMP_MODULE_STATE_LOADED_OK;
else
module_info->state = GIMP_MODULE_STATE_LOAD_FAILED;
return retval;
}
static void
gimp_module_info_unload (GTypeModule *module)
{
GimpModuleInfoObj *module_info;
g_return_if_fail (GIMP_IS_MODULE_INFO (module));
module_info = GIMP_MODULE_INFO (module);
g_return_if_fail (module_info->module != NULL);
g_module_close (module_info->module); /* FIXME: error handling */
module_info->module = NULL;
module_info->query_module = NULL;
module_info->register_module = NULL;
module_info->state = GIMP_MODULE_STATE_UNLOADED_OK;
}
GimpModuleInfoObj *
gimp_module_info_new (const gchar *filename,
const gchar *inhibit_list,
gboolean verbose)
{
GimpModuleInfoObj *module_info;
g_return_val_if_fail (filename != NULL, NULL);
module_info = g_object_new (GIMP_TYPE_MODULE_INFO, NULL);
module_info->filename = g_strdup (filename);
module_info->verbose = verbose ? TRUE : FALSE;
module_info->on_disk = TRUE;
gimp_module_info_set_load_inhibit (module_info, inhibit_list);
if (! module_info->load_inhibit)
{
if (gimp_module_info_load (G_TYPE_MODULE (module_info)))
gimp_module_info_unload (G_TYPE_MODULE (module_info));
}
else
{
if (verbose)
g_print (_("skipping module: '%s'\n"), filename);
module_info->state = GIMP_MODULE_STATE_UNLOADED_OK;
}
return module_info;
}
void
gimp_module_info_modified (GimpModuleInfoObj *module_info)
{
g_return_if_fail (GIMP_IS_MODULE_INFO (module_info));
g_signal_emit (G_OBJECT (module_info), module_info_signals[MODIFIED], 0);
}
void
gimp_module_info_set_load_inhibit (GimpModuleInfoObj *module_info,
const gchar *inhibit_list)
{
gchar *p;
gint pathlen;
const gchar *start;
const gchar *end;
g_return_if_fail (GIMP_IS_MODULE_INFO (module_info));
g_return_if_fail (module_info->filename != NULL);
module_info->load_inhibit = FALSE;
if (! inhibit_list || ! strlen (inhibit_list))
return;
p = strstr (inhibit_list, module_info->filename);
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);
pathlen = strlen (module_info->filename);
if ((end - start) == pathlen)
module_info->load_inhibit = TRUE;
}
static void
gimp_module_info_set_last_error (GimpModuleInfoObj *module_info,
const gchar *error_str)
{
if (module_info->last_module_error)
g_free (module_info->last_module_error);
module_info->last_module_error = g_strdup (error_str);
}

View File

@ -1,87 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpmoduleinfo.h
* (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.
*/
#ifndef __GIMP_MODULE_INFO_H__
#define __GIMP_MODULE_INFO_H__
#include "libgimp/gimpmodule.h"
typedef enum
{
GIMP_MODULE_STATE_ERROR, /* missing module_load function or other error */
GIMP_MODULE_STATE_LOADED_OK, /* happy and running (normal state of affairs) */
GIMP_MODULE_STATE_LOAD_FAILED, /* module_load returned GIMP_MODULE_UNLOAD */
GIMP_MODULE_STATE_UNLOAD_REQUESTED, /* sent unload request, waiting for callback */
GIMP_MODULE_STATE_UNLOADED_OK /* callback arrived, module not in memory anymore */
} GimpModuleState;
#define GIMP_TYPE_MODULE_INFO (gimp_module_info_get_type ())
#define GIMP_MODULE_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MODULE_INFO, GimpModuleInfoObj))
#define GIMP_MODULE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MODULE_INFO, GimpModuleInfoObjClass))
#define GIMP_IS_MODULE_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MODULE_INFO))
#define GIMP_IS_MODULE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MODULE_INFO))
#define GIMP_MODULE_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MODULE_INFO, GimpModuleInfoObjClass))
typedef struct _GimpModuleInfoObjClass GimpModuleInfoObjClass;
struct _GimpModuleInfoObj
{
GTypeModule parent_instance;
gchar *filename; /* path to the module */
gboolean verbose; /* verbose error reporting */
GimpModuleState state; /* what's happened to the module */
gboolean on_disk; /* TRUE if file still exists */
gboolean load_inhibit; /* user requests not to load at boot time */
/* stuff from now on may be NULL depending on the state the module is in */
GModule *module; /* handle on the module */
GimpModuleInfo info; /* returned values from module_query */
gchar *last_module_error;
const GimpModuleInfo * (* query_module) (GTypeModule *module);
gboolean (* register_module) (GTypeModule *module);
};
struct _GimpModuleInfoObjClass
{
GTypeModuleClass parent_class;
void (* modified) (GimpModuleInfoObj *module_info);
};
GType gimp_module_info_get_type (void) G_GNUC_CONST;
GimpModuleInfoObj * gimp_module_info_new (const gchar *filename,
const gchar *inhibit_str,
gboolean verbose);
void gimp_module_info_modified (GimpModuleInfoObj *module);
void gimp_module_info_set_load_inhibit (GimpModuleInfoObj *module,
const gchar *inhibit_list);
#endif /* __GIMP_MODULE_INFO_H__ */

View File

@ -32,6 +32,7 @@
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpmodule/gimpmodule.h"
#include "core-types.h"
@ -39,7 +40,6 @@
#include "gimpcoreconfig.h"
#include "gimpdatafiles.h"
#include "gimplist.h"
#include "gimpmoduleinfo.h"
#include "gimpmodules.h"
#include "gimprc.h"
@ -50,23 +50,23 @@
#define DUMP_DB 1
static void gimp_modules_module_initialize (const gchar *filename,
gpointer loader_data);
static void gimp_modules_module_initialize (const gchar *filename,
gpointer loader_data);
static GimpModuleInfoObj * gimp_modules_module_find_by_path (Gimp *gimp,
const char *fullpath);
static GimpModule * gimp_modules_module_find_by_path (Gimp *gimp,
const char *fullpath);
#ifdef DUMP_DB
static void print_module_info (gpointer data,
gpointer user_data);
static void gimp_modules_dump_module (gpointer data,
gpointer user_data);
#endif
static gboolean gimp_modules_write_modulerc (Gimp *gimp);
static gboolean gimp_modules_write_modulerc (Gimp *gimp);
static void gimp_modules_module_on_disk_func (gpointer data,
gpointer user_data);
static void gimp_modules_module_remove_func (gpointer data,
gpointer user_data);
static void gimp_modules_module_on_disk_func (gpointer data,
gpointer user_data);
static void gimp_modules_module_remove_func (gpointer data,
gpointer user_data);
void
@ -74,7 +74,7 @@ gimp_modules_init (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->modules = gimp_list_new (GIMP_TYPE_MODULE_INFO,
gimp->modules = gimp_list_new (GIMP_TYPE_MODULE,
GIMP_CONTAINER_POLICY_STRONG);
gimp_object_set_name (GIMP_OBJECT (gimp->modules), "modules");
@ -111,7 +111,7 @@ gimp_modules_load (Gimp *gimp)
gimp);
#ifdef DUMP_DB
gimp_container_foreach (gimp->modules, print_module_info, NULL);
gimp_container_foreach (gimp->modules, gimp_modules_dump_module, NULL);
#endif
}
@ -156,13 +156,13 @@ static void
add_to_inhibit_string (gpointer data,
gpointer user_data)
{
GimpModuleInfoObj *module_info = data;
GString *str = user_data;
GimpModule *module = data;
GString *str = user_data;
if (module_info->load_inhibit)
if (module->load_inhibit)
{
str = g_string_append_c (str, G_SEARCHPATH_SEPARATOR);
str = g_string_append (str, module_info->filename);
str = g_string_append (str, module->filename);
}
}
@ -239,8 +239,8 @@ static void
gimp_modules_module_initialize (const gchar *filename,
gpointer loader_data)
{
GimpModuleInfoObj *module_info;
Gimp *gimp;
GimpModule *module;
Gimp *gimp;
gimp = GIMP (loader_data);
@ -251,26 +251,26 @@ gimp_modules_module_initialize (const gchar *filename,
if (gimp_modules_module_find_by_path (gimp, filename))
return;
module_info = gimp_module_info_new (filename,
gimp->config->module_db_load_inhibit,
gimp->be_verbose);
module = gimp_module_new (filename,
gimp->config->module_db_load_inhibit,
gimp->be_verbose);
gimp_container_add (gimp->modules, (GimpObject *) module_info);
gimp_container_add (gimp->modules, (GimpObject *) module);
}
static GimpModuleInfoObj *
static GimpModule *
gimp_modules_module_find_by_path (Gimp *gimp,
const char *fullpath)
{
GimpModuleInfoObj *module_info;
GList *list;
GimpModule *module;
GList *list;
for (list = GIMP_LIST (gimp->modules)->list; list; list = g_list_next (list))
{
module_info = (GimpModuleInfoObj *) list->data;
module = (GimpModule *) list->data;
if (! strcmp (module_info->filename, fullpath))
return module_info;
if (! strcmp (module->filename, fullpath))
return module;
}
return NULL;
@ -278,10 +278,10 @@ gimp_modules_module_find_by_path (Gimp *gimp,
#ifdef DUMP_DB
static void
print_module_info (gpointer data,
gpointer user_data)
gimp_modules_dump_module (gpointer data,
gpointer user_data)
{
GimpModuleInfoObj *i = data;
GimpModule *i = data;
g_print ("\n%s: %i\n",
i->filename,
@ -293,16 +293,19 @@ print_module_info (gpointer data,
i->query_module,
i->register_module);
g_print (" purpose: %s\n"
" author: %s\n"
" version: %s\n"
" copyright: %s\n"
" date: %s\n",
i->info.purpose ? i->info.purpose : "NONE",
i->info.author ? i->info.author : "NONE",
i->info.version ? i->info.version : "NONE",
i->info.copyright ? i->info.copyright : "NONE",
i->info.date ? i->info.date : "NONE");
if (i->info)
{
g_print (" purpose: %s\n"
" author: %s\n"
" version: %s\n"
" copyright: %s\n"
" date: %s\n",
i->info->purpose ? i->info->purpose : "NONE",
i->info->author ? i->info->author : "NONE",
i->info->version ? i->info->version : "NONE",
i->info->copyright ? i->info->copyright : "NONE",
i->info->date ? i->info->date : "NONE");
}
}
#endif
@ -310,40 +313,39 @@ static void
gimp_modules_module_on_disk_func (gpointer data,
gpointer user_data)
{
GimpModuleInfoObj *module_info;
GList **kill_list;
gint old_on_disk;
GimpModule *module;
GList **kill_list;
gint old_on_disk;
module_info = (GimpModuleInfoObj *) data;
kill_list = (GList **) user_data;
module = (GimpModule *) data;
kill_list = (GList **) user_data;
old_on_disk = module_info->on_disk;
old_on_disk = module->on_disk;
module_info->on_disk = g_file_test (module_info->filename,
G_FILE_TEST_IS_REGULAR);
module->on_disk = g_file_test (module->filename, G_FILE_TEST_IS_REGULAR);
/* if it's not on the disk, and it isn't in memory, mark it to be
* removed later.
*/
if (! module_info->on_disk && ! module_info->module)
if (! module->on_disk && ! module->module)
{
*kill_list = g_list_append (*kill_list, module_info);
module_info = NULL;
*kill_list = g_list_append (*kill_list, module);
module = NULL;
}
if (module_info && module_info->on_disk != old_on_disk)
gimp_module_info_modified (module_info);
if (module && module->on_disk != old_on_disk)
gimp_module_modified (module);
}
static void
gimp_modules_module_remove_func (gpointer data,
gpointer user_data)
{
GimpModuleInfoObj *module_info;
Gimp *gimp;
GimpModule *module;
Gimp *gimp;
module_info = (GimpModuleInfoObj *) data;
gimp = (Gimp *) user_data;
module = (GimpModule *) data;
gimp = (Gimp *) user_data;
gimp_container_remove (gimp->modules, (GimpObject *) module_info);
gimp_container_remove (gimp->modules, (GimpObject *) module);
}

View File

@ -23,13 +23,14 @@
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpmodule/gimpmodule.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpmoduleinfo.h"
#include "core/gimpmodules.h"
#include "module-browser.h"
@ -37,55 +38,58 @@
#include "libgimp/gimpintl.h"
#define NUM_INFO_LINES 7
#define NUM_INFO_LINES 8
enum {
enum
{
PATH_COLUMN,
INFO_COLUMN,
MODULE_COLUMN,
NUM_COLUMNS
};
typedef struct
{
GtkWidget *table;
GtkWidget *label[NUM_INFO_LINES];
GtkWidget *button_label;
GimpModuleInfoObj *last_update;
GtkWidget *button;
GtkListStore *list;
GtkWidget *load_inhibit_check;
typedef struct _ModuleBrowser ModuleBrowser;
GQuark modules_handler_id;
Gimp *gimp;
} BrowserState;
struct _ModuleBrowser
{
GtkWidget *table;
GtkWidget *label[NUM_INFO_LINES];
GtkWidget *button_label;
GimpModule *last_update;
GtkWidget *button;
GtkListStore *list;
GtkWidget *load_inhibit_check;
GQuark modules_handler_id;
Gimp *gimp;
};
/* local function prototypes */
static void browser_popdown_callback (GtkWidget *widget,
gpointer data);
static void browser_destroy_callback (GtkWidget *widget,
gpointer data);
static void browser_load_inhibit_callback (GtkWidget *widget,
gpointer data);
static void browser_select_callback (GtkTreeSelection *sel,
gpointer data);
static void browser_load_unload_callback (GtkWidget *widget,
gpointer data);
static void browser_refresh_callback (GtkWidget *widget,
gpointer data);
static void make_list_item (gpointer data,
gpointer user_data);
static void browser_info_add (GimpContainer *container,
GimpModuleInfoObj *mod,
BrowserState *st);
static void browser_info_remove (GimpContainer *container,
GimpModuleInfoObj *mod,
BrowserState *st);
static void browser_info_update (GimpModuleInfoObj *mod,
BrowserState *st);
static void browser_info_init (BrowserState *st,
GtkWidget *table);
static void browser_popdown_callback (GtkWidget *widget,
gpointer data);
static void browser_destroy_callback (GtkWidget *widget,
ModuleBrowser *browser);
static void browser_load_inhibit_callback (GtkWidget *widget,
ModuleBrowser *browser);
static void browser_select_callback (GtkTreeSelection *sel,
ModuleBrowser *browser);
static void browser_load_unload_callback (GtkWidget *widget,
ModuleBrowser *browser);
static void browser_refresh_callback (GtkWidget *widget,
ModuleBrowser *browser);
static void make_list_item (gpointer data,
gpointer user_data);
static void browser_info_add (GimpContainer *container,
GimpModule *module,
ModuleBrowser *browser);
static void browser_info_remove (GimpContainer *container,
GimpModule *module,
ModuleBrowser *browser);
static void browser_info_update (GimpModule *module,
ModuleBrowser *browser);
static void browser_info_init (ModuleBrowser *browser,
GtkWidget *table);
/* public functions */
@ -99,7 +103,7 @@ module_browser_new (Gimp *gimp)
GtkWidget *listbox;
GtkWidget *button;
GtkWidget *tv;
BrowserState *st;
ModuleBrowser *browser;
GtkTreeSelection *sel;
GtkTreeIter iter;
@ -131,15 +135,16 @@ module_browser_new (Gimp *gimp)
gtk_widget_set_size_request (listbox, 125, 100);
gtk_widget_show (listbox);
st = g_new0 (BrowserState, 1);
browser = g_new0 (ModuleBrowser, 1);
st->gimp = gimp;
browser->gimp = gimp;
st->list = gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER);
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (st->list));
g_object_unref (st->list);
browser->list = gtk_list_store_new (NUM_COLUMNS,
G_TYPE_STRING, G_TYPE_POINTER);
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (browser->list));
g_object_unref (browser->list);
gimp_container_foreach (gimp->modules, make_list_item, st);
gimp_container_foreach (gimp->modules, make_list_item, browser);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tv),
-1, NULL,
@ -152,59 +157,63 @@ module_browser_new (Gimp *gimp)
gtk_container_add (GTK_CONTAINER (listbox), tv);
gtk_widget_show (tv);
st->table = gtk_table_new (5, NUM_INFO_LINES + 1, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (st->table), 4);
gtk_box_pack_start (GTK_BOX (vbox), st->table, FALSE, FALSE, 0);
gtk_widget_show (st->table);
browser->table = gtk_table_new (5, NUM_INFO_LINES + 1, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (browser->table), 4);
gtk_box_pack_start (GTK_BOX (vbox), browser->table, FALSE, FALSE, 0);
gtk_widget_show (browser->table);
hbox = gtk_hbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, FALSE, 5);
gtk_widget_show (hbox);
button = gtk_button_new_with_label (_("Refresh"));
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_widget_show (button);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (browser_refresh_callback),
st);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
browser);
st->button = gtk_button_new_with_label ("");
st->button_label = gtk_bin_get_child (GTK_BIN (st->button));
gtk_box_pack_start (GTK_BOX (hbox), st->button, TRUE, TRUE, 0);
gtk_widget_show (st->button);
g_signal_connect (G_OBJECT (st->button), "clicked",
browser->button = gtk_button_new_with_label ("");
browser->button_label = gtk_bin_get_child (GTK_BIN (browser->button));
gtk_box_pack_start (GTK_BOX (hbox), browser->button, TRUE, TRUE, 0);
gtk_widget_show (browser->button);
g_signal_connect (G_OBJECT (browser->button), "clicked",
G_CALLBACK (browser_load_unload_callback),
st);
browser);
browser_info_init (st, st->table);
browser_info_update (st->last_update, st);
browser_info_init (browser, browser->table);
browser_info_update (browser->last_update, browser);
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tv));
g_signal_connect (G_OBJECT (sel), "changed",
G_CALLBACK (browser_select_callback), st);
if (gtk_tree_model_get_iter_root (GTK_TREE_MODEL (st->list), &iter))
g_signal_connect (G_OBJECT (sel), "changed",
G_CALLBACK (browser_select_callback),
browser);
if (gtk_tree_model_get_iter_root (GTK_TREE_MODEL (browser->list), &iter))
gtk_tree_selection_select_iter (sel, &iter);
/* hook the GimpContainer signals so we can refresh the display
* appropriately.
*/
st->modules_handler_id =
browser->modules_handler_id =
gimp_container_add_handler (gimp->modules, "modified",
G_CALLBACK (browser_info_update), st);
G_CALLBACK (browser_info_update),
browser);
g_signal_connect (G_OBJECT (gimp->modules), "add",
G_CALLBACK (browser_info_add),
st);
browser);
g_signal_connect (G_OBJECT (gimp->modules), "remove",
G_CALLBACK (browser_info_remove),
st);
browser);
g_signal_connect (G_OBJECT (shell), "destroy",
G_CALLBACK (browser_destroy_callback),
st);
browser);
return shell;
}
@ -220,180 +229,172 @@ browser_popdown_callback (GtkWidget *widget,
}
static void
browser_destroy_callback (GtkWidget *widget,
gpointer data)
browser_destroy_callback (GtkWidget *widget,
ModuleBrowser *browser)
{
BrowserState *st = data;
g_signal_handlers_disconnect_by_func (G_OBJECT (st->gimp->modules),
g_signal_handlers_disconnect_by_func (G_OBJECT (browser->gimp->modules),
browser_info_add,
data);
g_signal_handlers_disconnect_by_func (G_OBJECT (st->gimp->modules),
browser);
g_signal_handlers_disconnect_by_func (G_OBJECT (browser->gimp->modules),
browser_info_remove,
data);
gimp_container_remove_handler (st->gimp->modules, st->modules_handler_id);
g_free (data);
browser);
gimp_container_remove_handler (browser->gimp->modules,
browser->modules_handler_id);
g_free (browser);
}
static void
browser_load_inhibit_callback (GtkWidget *widget,
gpointer data)
browser_load_inhibit_callback (GtkWidget *widget,
ModuleBrowser *browser)
{
BrowserState *st = data;
gboolean new_value;
gboolean new_value;
g_return_if_fail (st->last_update != NULL);
g_return_if_fail (browser->last_update != NULL);
new_value = ! GTK_TOGGLE_BUTTON (widget)->active;
if (new_value == st->last_update->load_inhibit)
if (new_value == browser->last_update->load_inhibit)
return;
st->last_update->load_inhibit = new_value;
gimp_module_info_modified (st->last_update);
browser->last_update->load_inhibit = new_value;
gimp_module_modified (browser->last_update);
st->gimp->write_modulerc = TRUE;
browser->gimp->write_modulerc = TRUE;
}
static void
browser_select_callback (GtkTreeSelection *sel,
gpointer data)
ModuleBrowser *browser)
{
BrowserState *st = data;
GimpModuleInfoObj *info;
GtkTreeIter iter;
GimpModule *module;
GtkTreeIter iter;
gtk_tree_selection_get_selected (sel, NULL, &iter);
gtk_tree_model_get (GTK_TREE_MODEL (st->list), &iter, INFO_COLUMN, &info, -1);
gtk_tree_model_get (GTK_TREE_MODEL (browser->list), &iter,
MODULE_COLUMN, &module, -1);
if (st->last_update == info)
if (browser->last_update == module)
return;
st->last_update = info;
browser->last_update = module;
browser_info_update (st->last_update, st);
browser_info_update (browser->last_update, browser);
}
static void
browser_load_unload_callback (GtkWidget *widget,
gpointer data)
browser_load_unload_callback (GtkWidget *widget,
ModuleBrowser *browser)
{
BrowserState *st = data;
if (st->last_update->state != GIMP_MODULE_STATE_LOADED_OK)
if (browser->last_update->state != GIMP_MODULE_STATE_LOADED_OK)
{
if (g_type_module_use (G_TYPE_MODULE (st->last_update)))
g_type_module_unuse (G_TYPE_MODULE (st->last_update));
if (g_type_module_use (G_TYPE_MODULE (browser->last_update)))
g_type_module_unuse (G_TYPE_MODULE (browser->last_update));
}
gimp_module_info_modified (st->last_update);
gimp_module_modified (browser->last_update);
}
static void
browser_refresh_callback (GtkWidget *widget,
gpointer data)
browser_refresh_callback (GtkWidget *widget,
ModuleBrowser *browser)
{
BrowserState *st = data;
gimp_modules_refresh (st->gimp);
gimp_modules_refresh (browser->gimp);
}
static void
make_list_item (gpointer data,
gpointer user_data)
{
GimpModuleInfoObj *info = data;
BrowserState *st = user_data;
GtkTreeIter iter;
GimpModule *module = data;
ModuleBrowser *browser = user_data;
GtkTreeIter iter;
if (!st->last_update)
st->last_update = info;
if (! browser->last_update)
browser->last_update = module;
gtk_list_store_append (st->list, &iter);
gtk_list_store_set (st->list, &iter,
PATH_COLUMN, info->filename,
INFO_COLUMN, info,
gtk_list_store_append (browser->list, &iter);
gtk_list_store_set (browser->list, &iter,
PATH_COLUMN, module->filename,
MODULE_COLUMN, module,
-1);
}
static void
browser_info_add (GimpContainer *container,
GimpModuleInfoObj *mod,
BrowserState *st)
browser_info_add (GimpContainer *container,
GimpModule *module,
ModuleBrowser *browser)
{
make_list_item (mod, st);
make_list_item (module, browser);
}
static void
browser_info_remove (GimpContainer *container,
GimpModuleInfoObj *mod,
BrowserState *st)
browser_info_remove (GimpContainer *container,
GimpModule *mod,
ModuleBrowser *browser)
{
GtkTreeIter iter;
GimpModuleInfoObj *info;
GtkTreeIter iter;
GimpModule *module;
/* FIXME: Use gtk_list_store_foreach_remove when it becomes available */
if (! gtk_tree_model_get_iter_root (GTK_TREE_MODEL (st->list), &iter))
if (! gtk_tree_model_get_iter_root (GTK_TREE_MODEL (browser->list), &iter))
return;
do
{
gtk_tree_model_get (GTK_TREE_MODEL (st->list), &iter,
INFO_COLUMN, &info,
gtk_tree_model_get (GTK_TREE_MODEL (browser->list), &iter,
MODULE_COLUMN, &module,
-1);
if (info == mod)
if (module == mod)
{
gtk_list_store_remove (st->list, &iter);
gtk_list_store_remove (browser->list, &iter);
return;
}
}
while (gtk_tree_model_iter_next (GTK_TREE_MODEL (st->list), &iter));
while (gtk_tree_model_iter_next (GTK_TREE_MODEL (browser->list), &iter));
g_warning ("%s: Tried to remove a module not in the browser's list.",
G_STRLOC);
}
static void
browser_info_update (GimpModuleInfoObj *mod,
BrowserState *st)
browser_info_update (GimpModule *module,
ModuleBrowser *browser)
{
const gchar *text[NUM_INFO_LINES];
gint i;
const gchar *text[NUM_INFO_LINES - 1];
gchar *status;
static const gchar * const statename[] =
{
N_("Module error"),
N_("Loaded OK"),
N_("Load failed"),
N_("Unload requested"),
N_("Unloaded OK")
};
/* only update the info if we're actually showing it */
if (mod != st->last_update)
if (module != browser->last_update)
return;
if (! mod)
if (! module)
{
for (i = 0; i < NUM_INFO_LINES; i++)
gtk_label_set_text (GTK_LABEL (st->label[i]), "");
gtk_label_set_text (GTK_LABEL(st->button_label), _("<No modules>"));
gtk_widget_set_sensitive (GTK_WIDGET (st->button), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), FALSE);
gtk_label_set_text (GTK_LABEL (browser->label[i]), "");
gtk_label_set_text (GTK_LABEL (browser->button_label), _("<No modules>"));
gtk_widget_set_sensitive (GTK_WIDGET (browser->button), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (browser->load_inhibit_check), FALSE);
return;
}
if (mod->info.purpose)
if (module->info)
{
text[0] = mod->info.purpose;
text[1] = mod->info.author;
text[2] = mod->info.version;
text[3] = mod->info.copyright;
text[4] = mod->info.date;
text[5] = mod->on_disk ? _("On disk") : _("Only in memory");
text[0] = module->info->purpose;
text[1] = module->info->author;
text[2] = module->info->version;
text[3] = module->info->copyright;
text[4] = module->info->date;
text[5] = module->on_disk ? _("On disk") : _("Only in memory");
}
else
{
@ -402,62 +403,48 @@ browser_info_update (GimpModuleInfoObj *mod,
text[2] = "--";
text[3] = "--";
text[4] = "--";
text[5] = mod->on_disk ? _("On disk") : _("No longer available");
text[5] = module->on_disk ? _("On disk") : _("No longer available");
}
if (mod->state == GIMP_MODULE_STATE_ERROR && mod->last_module_error)
{
status = g_strdup_printf ("%s\n(%s)", gettext (statename[mod->state]),
mod->last_module_error);
}
text[6] = gettext (statename[module->state]);
if (module->state == GIMP_MODULE_STATE_ERROR && module->last_module_error)
text[7] = module->last_module_error;
else
{
status = g_strdup (gettext (statename[mod->state]));
}
text[7] = "--";
for (i=0; i < NUM_INFO_LINES - 1; i++)
{
gtk_label_set_text (GTK_LABEL (st->label[i]), gettext (text[i]));
}
for (i = 0; i < NUM_INFO_LINES; i++)
gtk_label_set_text (GTK_LABEL (browser->label[i]), gettext (text[i]));
gtk_label_set_text (GTK_LABEL (st->label[NUM_INFO_LINES-1]), status);
g_free (status);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (st->load_inhibit_check),
!mod->load_inhibit);
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (browser->load_inhibit_check),
! module->load_inhibit);
gtk_widget_set_sensitive (GTK_WIDGET (browser->load_inhibit_check), TRUE);
/* work out what the button should do (if anything) */
switch (mod->state)
switch (module->state)
{
case GIMP_MODULE_STATE_ERROR:
case GIMP_MODULE_STATE_LOAD_FAILED:
case GIMP_MODULE_STATE_UNLOADED_OK:
gtk_label_set_text (GTK_LABEL(st->button_label), _("Load"));
gtk_widget_set_sensitive (GTK_WIDGET (st->button), mod->on_disk);
break;
case GIMP_MODULE_STATE_UNLOAD_REQUESTED:
gtk_label_set_text (GTK_LABEL(st->button_label), _("Unload"));
gtk_widget_set_sensitive (GTK_WIDGET (st->button), FALSE);
gtk_label_set_text (GTK_LABEL (browser->button_label), _("Load"));
gtk_widget_set_sensitive (GTK_WIDGET (browser->button), module->on_disk);
break;
case GIMP_MODULE_STATE_LOADED_OK:
gtk_label_set_text (GTK_LABEL(st->button_label), _("Unload"));
gtk_widget_set_sensitive (GTK_WIDGET (st->button), FALSE);
gtk_label_set_text (GTK_LABEL (browser->button_label), _("Unload"));
gtk_widget_set_sensitive (GTK_WIDGET (browser->button), FALSE);
break;
}
}
static void
browser_info_init (BrowserState *st,
GtkWidget *table)
browser_info_init (ModuleBrowser *browser,
GtkWidget *table)
{
GtkWidget *label;
gint i;
gint i;
gchar *text[] =
static const gchar *text[] =
{
N_("Purpose:"),
N_("Author:"),
@ -465,30 +452,34 @@ browser_info_init (BrowserState *st,
N_("Copyright:"),
N_("Date:"),
N_("Location:"),
N_("State:")
N_("State:"),
N_("Last Error:")
};
for (i=0; i < sizeof(text) / sizeof(char *); i++)
for (i = 0; i < G_N_ELEMENTS (text); i++)
{
label = gtk_label_new (gettext (text[i]));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, i, i+1,
gtk_table_attach (GTK_TABLE (table), label, 0, 1, i, i + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
gtk_widget_show (label);
st->label[i] = gtk_label_new ("");
gtk_misc_set_alignment (GTK_MISC (st->label[i]), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (st->table), st->label[i], 1, 2, i, i+1,
browser->label[i] = gtk_label_new ("");
gtk_misc_set_alignment (GTK_MISC (browser->label[i]), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (browser->table), browser->label[i],
1, 2, i, i + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
gtk_widget_show (st->label[i]);
gtk_widget_show (browser->label[i]);
}
st->load_inhibit_check =
browser->load_inhibit_check =
gtk_check_button_new_with_label (_("Autoload during start-up"));
gtk_widget_show (st->load_inhibit_check);
gtk_table_attach (GTK_TABLE (table), st->load_inhibit_check,
0, 2, i, i+1,
gtk_table_attach (GTK_TABLE (table), browser->load_inhibit_check,
0, 2, i, i + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
g_signal_connect (G_OBJECT (st->load_inhibit_check), "toggled",
G_CALLBACK (browser_load_inhibit_callback), st);
gtk_widget_show (browser->load_inhibit_check);
g_signal_connect (G_OBJECT (browser->load_inhibit_check), "toggled",
G_CALLBACK (browser_load_inhibit_callback),
browser);
}

View File

@ -23,13 +23,14 @@
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpmodule/gimpmodule.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpmoduleinfo.h"
#include "core/gimpmodules.h"
#include "module-browser.h"
@ -37,55 +38,58 @@
#include "libgimp/gimpintl.h"
#define NUM_INFO_LINES 7
#define NUM_INFO_LINES 8
enum {
enum
{
PATH_COLUMN,
INFO_COLUMN,
MODULE_COLUMN,
NUM_COLUMNS
};
typedef struct
{
GtkWidget *table;
GtkWidget *label[NUM_INFO_LINES];
GtkWidget *button_label;
GimpModuleInfoObj *last_update;
GtkWidget *button;
GtkListStore *list;
GtkWidget *load_inhibit_check;
typedef struct _ModuleBrowser ModuleBrowser;
GQuark modules_handler_id;
Gimp *gimp;
} BrowserState;
struct _ModuleBrowser
{
GtkWidget *table;
GtkWidget *label[NUM_INFO_LINES];
GtkWidget *button_label;
GimpModule *last_update;
GtkWidget *button;
GtkListStore *list;
GtkWidget *load_inhibit_check;
GQuark modules_handler_id;
Gimp *gimp;
};
/* local function prototypes */
static void browser_popdown_callback (GtkWidget *widget,
gpointer data);
static void browser_destroy_callback (GtkWidget *widget,
gpointer data);
static void browser_load_inhibit_callback (GtkWidget *widget,
gpointer data);
static void browser_select_callback (GtkTreeSelection *sel,
gpointer data);
static void browser_load_unload_callback (GtkWidget *widget,
gpointer data);
static void browser_refresh_callback (GtkWidget *widget,
gpointer data);
static void make_list_item (gpointer data,
gpointer user_data);
static void browser_info_add (GimpContainer *container,
GimpModuleInfoObj *mod,
BrowserState *st);
static void browser_info_remove (GimpContainer *container,
GimpModuleInfoObj *mod,
BrowserState *st);
static void browser_info_update (GimpModuleInfoObj *mod,
BrowserState *st);
static void browser_info_init (BrowserState *st,
GtkWidget *table);
static void browser_popdown_callback (GtkWidget *widget,
gpointer data);
static void browser_destroy_callback (GtkWidget *widget,
ModuleBrowser *browser);
static void browser_load_inhibit_callback (GtkWidget *widget,
ModuleBrowser *browser);
static void browser_select_callback (GtkTreeSelection *sel,
ModuleBrowser *browser);
static void browser_load_unload_callback (GtkWidget *widget,
ModuleBrowser *browser);
static void browser_refresh_callback (GtkWidget *widget,
ModuleBrowser *browser);
static void make_list_item (gpointer data,
gpointer user_data);
static void browser_info_add (GimpContainer *container,
GimpModule *module,
ModuleBrowser *browser);
static void browser_info_remove (GimpContainer *container,
GimpModule *module,
ModuleBrowser *browser);
static void browser_info_update (GimpModule *module,
ModuleBrowser *browser);
static void browser_info_init (ModuleBrowser *browser,
GtkWidget *table);
/* public functions */
@ -99,7 +103,7 @@ module_browser_new (Gimp *gimp)
GtkWidget *listbox;
GtkWidget *button;
GtkWidget *tv;
BrowserState *st;
ModuleBrowser *browser;
GtkTreeSelection *sel;
GtkTreeIter iter;
@ -131,15 +135,16 @@ module_browser_new (Gimp *gimp)
gtk_widget_set_size_request (listbox, 125, 100);
gtk_widget_show (listbox);
st = g_new0 (BrowserState, 1);
browser = g_new0 (ModuleBrowser, 1);
st->gimp = gimp;
browser->gimp = gimp;
st->list = gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER);
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (st->list));
g_object_unref (st->list);
browser->list = gtk_list_store_new (NUM_COLUMNS,
G_TYPE_STRING, G_TYPE_POINTER);
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (browser->list));
g_object_unref (browser->list);
gimp_container_foreach (gimp->modules, make_list_item, st);
gimp_container_foreach (gimp->modules, make_list_item, browser);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tv),
-1, NULL,
@ -152,59 +157,63 @@ module_browser_new (Gimp *gimp)
gtk_container_add (GTK_CONTAINER (listbox), tv);
gtk_widget_show (tv);
st->table = gtk_table_new (5, NUM_INFO_LINES + 1, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (st->table), 4);
gtk_box_pack_start (GTK_BOX (vbox), st->table, FALSE, FALSE, 0);
gtk_widget_show (st->table);
browser->table = gtk_table_new (5, NUM_INFO_LINES + 1, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (browser->table), 4);
gtk_box_pack_start (GTK_BOX (vbox), browser->table, FALSE, FALSE, 0);
gtk_widget_show (browser->table);
hbox = gtk_hbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, FALSE, 5);
gtk_widget_show (hbox);
button = gtk_button_new_with_label (_("Refresh"));
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_widget_show (button);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (browser_refresh_callback),
st);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
browser);
st->button = gtk_button_new_with_label ("");
st->button_label = gtk_bin_get_child (GTK_BIN (st->button));
gtk_box_pack_start (GTK_BOX (hbox), st->button, TRUE, TRUE, 0);
gtk_widget_show (st->button);
g_signal_connect (G_OBJECT (st->button), "clicked",
browser->button = gtk_button_new_with_label ("");
browser->button_label = gtk_bin_get_child (GTK_BIN (browser->button));
gtk_box_pack_start (GTK_BOX (hbox), browser->button, TRUE, TRUE, 0);
gtk_widget_show (browser->button);
g_signal_connect (G_OBJECT (browser->button), "clicked",
G_CALLBACK (browser_load_unload_callback),
st);
browser);
browser_info_init (st, st->table);
browser_info_update (st->last_update, st);
browser_info_init (browser, browser->table);
browser_info_update (browser->last_update, browser);
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tv));
g_signal_connect (G_OBJECT (sel), "changed",
G_CALLBACK (browser_select_callback), st);
if (gtk_tree_model_get_iter_root (GTK_TREE_MODEL (st->list), &iter))
g_signal_connect (G_OBJECT (sel), "changed",
G_CALLBACK (browser_select_callback),
browser);
if (gtk_tree_model_get_iter_root (GTK_TREE_MODEL (browser->list), &iter))
gtk_tree_selection_select_iter (sel, &iter);
/* hook the GimpContainer signals so we can refresh the display
* appropriately.
*/
st->modules_handler_id =
browser->modules_handler_id =
gimp_container_add_handler (gimp->modules, "modified",
G_CALLBACK (browser_info_update), st);
G_CALLBACK (browser_info_update),
browser);
g_signal_connect (G_OBJECT (gimp->modules), "add",
G_CALLBACK (browser_info_add),
st);
browser);
g_signal_connect (G_OBJECT (gimp->modules), "remove",
G_CALLBACK (browser_info_remove),
st);
browser);
g_signal_connect (G_OBJECT (shell), "destroy",
G_CALLBACK (browser_destroy_callback),
st);
browser);
return shell;
}
@ -220,180 +229,172 @@ browser_popdown_callback (GtkWidget *widget,
}
static void
browser_destroy_callback (GtkWidget *widget,
gpointer data)
browser_destroy_callback (GtkWidget *widget,
ModuleBrowser *browser)
{
BrowserState *st = data;
g_signal_handlers_disconnect_by_func (G_OBJECT (st->gimp->modules),
g_signal_handlers_disconnect_by_func (G_OBJECT (browser->gimp->modules),
browser_info_add,
data);
g_signal_handlers_disconnect_by_func (G_OBJECT (st->gimp->modules),
browser);
g_signal_handlers_disconnect_by_func (G_OBJECT (browser->gimp->modules),
browser_info_remove,
data);
gimp_container_remove_handler (st->gimp->modules, st->modules_handler_id);
g_free (data);
browser);
gimp_container_remove_handler (browser->gimp->modules,
browser->modules_handler_id);
g_free (browser);
}
static void
browser_load_inhibit_callback (GtkWidget *widget,
gpointer data)
browser_load_inhibit_callback (GtkWidget *widget,
ModuleBrowser *browser)
{
BrowserState *st = data;
gboolean new_value;
gboolean new_value;
g_return_if_fail (st->last_update != NULL);
g_return_if_fail (browser->last_update != NULL);
new_value = ! GTK_TOGGLE_BUTTON (widget)->active;
if (new_value == st->last_update->load_inhibit)
if (new_value == browser->last_update->load_inhibit)
return;
st->last_update->load_inhibit = new_value;
gimp_module_info_modified (st->last_update);
browser->last_update->load_inhibit = new_value;
gimp_module_modified (browser->last_update);
st->gimp->write_modulerc = TRUE;
browser->gimp->write_modulerc = TRUE;
}
static void
browser_select_callback (GtkTreeSelection *sel,
gpointer data)
ModuleBrowser *browser)
{
BrowserState *st = data;
GimpModuleInfoObj *info;
GtkTreeIter iter;
GimpModule *module;
GtkTreeIter iter;
gtk_tree_selection_get_selected (sel, NULL, &iter);
gtk_tree_model_get (GTK_TREE_MODEL (st->list), &iter, INFO_COLUMN, &info, -1);
gtk_tree_model_get (GTK_TREE_MODEL (browser->list), &iter,
MODULE_COLUMN, &module, -1);
if (st->last_update == info)
if (browser->last_update == module)
return;
st->last_update = info;
browser->last_update = module;
browser_info_update (st->last_update, st);
browser_info_update (browser->last_update, browser);
}
static void
browser_load_unload_callback (GtkWidget *widget,
gpointer data)
browser_load_unload_callback (GtkWidget *widget,
ModuleBrowser *browser)
{
BrowserState *st = data;
if (st->last_update->state != GIMP_MODULE_STATE_LOADED_OK)
if (browser->last_update->state != GIMP_MODULE_STATE_LOADED_OK)
{
if (g_type_module_use (G_TYPE_MODULE (st->last_update)))
g_type_module_unuse (G_TYPE_MODULE (st->last_update));
if (g_type_module_use (G_TYPE_MODULE (browser->last_update)))
g_type_module_unuse (G_TYPE_MODULE (browser->last_update));
}
gimp_module_info_modified (st->last_update);
gimp_module_modified (browser->last_update);
}
static void
browser_refresh_callback (GtkWidget *widget,
gpointer data)
browser_refresh_callback (GtkWidget *widget,
ModuleBrowser *browser)
{
BrowserState *st = data;
gimp_modules_refresh (st->gimp);
gimp_modules_refresh (browser->gimp);
}
static void
make_list_item (gpointer data,
gpointer user_data)
{
GimpModuleInfoObj *info = data;
BrowserState *st = user_data;
GtkTreeIter iter;
GimpModule *module = data;
ModuleBrowser *browser = user_data;
GtkTreeIter iter;
if (!st->last_update)
st->last_update = info;
if (! browser->last_update)
browser->last_update = module;
gtk_list_store_append (st->list, &iter);
gtk_list_store_set (st->list, &iter,
PATH_COLUMN, info->filename,
INFO_COLUMN, info,
gtk_list_store_append (browser->list, &iter);
gtk_list_store_set (browser->list, &iter,
PATH_COLUMN, module->filename,
MODULE_COLUMN, module,
-1);
}
static void
browser_info_add (GimpContainer *container,
GimpModuleInfoObj *mod,
BrowserState *st)
browser_info_add (GimpContainer *container,
GimpModule *module,
ModuleBrowser *browser)
{
make_list_item (mod, st);
make_list_item (module, browser);
}
static void
browser_info_remove (GimpContainer *container,
GimpModuleInfoObj *mod,
BrowserState *st)
browser_info_remove (GimpContainer *container,
GimpModule *mod,
ModuleBrowser *browser)
{
GtkTreeIter iter;
GimpModuleInfoObj *info;
GtkTreeIter iter;
GimpModule *module;
/* FIXME: Use gtk_list_store_foreach_remove when it becomes available */
if (! gtk_tree_model_get_iter_root (GTK_TREE_MODEL (st->list), &iter))
if (! gtk_tree_model_get_iter_root (GTK_TREE_MODEL (browser->list), &iter))
return;
do
{
gtk_tree_model_get (GTK_TREE_MODEL (st->list), &iter,
INFO_COLUMN, &info,
gtk_tree_model_get (GTK_TREE_MODEL (browser->list), &iter,
MODULE_COLUMN, &module,
-1);
if (info == mod)
if (module == mod)
{
gtk_list_store_remove (st->list, &iter);
gtk_list_store_remove (browser->list, &iter);
return;
}
}
while (gtk_tree_model_iter_next (GTK_TREE_MODEL (st->list), &iter));
while (gtk_tree_model_iter_next (GTK_TREE_MODEL (browser->list), &iter));
g_warning ("%s: Tried to remove a module not in the browser's list.",
G_STRLOC);
}
static void
browser_info_update (GimpModuleInfoObj *mod,
BrowserState *st)
browser_info_update (GimpModule *module,
ModuleBrowser *browser)
{
const gchar *text[NUM_INFO_LINES];
gint i;
const gchar *text[NUM_INFO_LINES - 1];
gchar *status;
static const gchar * const statename[] =
{
N_("Module error"),
N_("Loaded OK"),
N_("Load failed"),
N_("Unload requested"),
N_("Unloaded OK")
};
/* only update the info if we're actually showing it */
if (mod != st->last_update)
if (module != browser->last_update)
return;
if (! mod)
if (! module)
{
for (i = 0; i < NUM_INFO_LINES; i++)
gtk_label_set_text (GTK_LABEL (st->label[i]), "");
gtk_label_set_text (GTK_LABEL(st->button_label), _("<No modules>"));
gtk_widget_set_sensitive (GTK_WIDGET (st->button), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), FALSE);
gtk_label_set_text (GTK_LABEL (browser->label[i]), "");
gtk_label_set_text (GTK_LABEL (browser->button_label), _("<No modules>"));
gtk_widget_set_sensitive (GTK_WIDGET (browser->button), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (browser->load_inhibit_check), FALSE);
return;
}
if (mod->info.purpose)
if (module->info)
{
text[0] = mod->info.purpose;
text[1] = mod->info.author;
text[2] = mod->info.version;
text[3] = mod->info.copyright;
text[4] = mod->info.date;
text[5] = mod->on_disk ? _("On disk") : _("Only in memory");
text[0] = module->info->purpose;
text[1] = module->info->author;
text[2] = module->info->version;
text[3] = module->info->copyright;
text[4] = module->info->date;
text[5] = module->on_disk ? _("On disk") : _("Only in memory");
}
else
{
@ -402,62 +403,48 @@ browser_info_update (GimpModuleInfoObj *mod,
text[2] = "--";
text[3] = "--";
text[4] = "--";
text[5] = mod->on_disk ? _("On disk") : _("No longer available");
text[5] = module->on_disk ? _("On disk") : _("No longer available");
}
if (mod->state == GIMP_MODULE_STATE_ERROR && mod->last_module_error)
{
status = g_strdup_printf ("%s\n(%s)", gettext (statename[mod->state]),
mod->last_module_error);
}
text[6] = gettext (statename[module->state]);
if (module->state == GIMP_MODULE_STATE_ERROR && module->last_module_error)
text[7] = module->last_module_error;
else
{
status = g_strdup (gettext (statename[mod->state]));
}
text[7] = "--";
for (i=0; i < NUM_INFO_LINES - 1; i++)
{
gtk_label_set_text (GTK_LABEL (st->label[i]), gettext (text[i]));
}
for (i = 0; i < NUM_INFO_LINES; i++)
gtk_label_set_text (GTK_LABEL (browser->label[i]), gettext (text[i]));
gtk_label_set_text (GTK_LABEL (st->label[NUM_INFO_LINES-1]), status);
g_free (status);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (st->load_inhibit_check),
!mod->load_inhibit);
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (browser->load_inhibit_check),
! module->load_inhibit);
gtk_widget_set_sensitive (GTK_WIDGET (browser->load_inhibit_check), TRUE);
/* work out what the button should do (if anything) */
switch (mod->state)
switch (module->state)
{
case GIMP_MODULE_STATE_ERROR:
case GIMP_MODULE_STATE_LOAD_FAILED:
case GIMP_MODULE_STATE_UNLOADED_OK:
gtk_label_set_text (GTK_LABEL(st->button_label), _("Load"));
gtk_widget_set_sensitive (GTK_WIDGET (st->button), mod->on_disk);
break;
case GIMP_MODULE_STATE_UNLOAD_REQUESTED:
gtk_label_set_text (GTK_LABEL(st->button_label), _("Unload"));
gtk_widget_set_sensitive (GTK_WIDGET (st->button), FALSE);
gtk_label_set_text (GTK_LABEL (browser->button_label), _("Load"));
gtk_widget_set_sensitive (GTK_WIDGET (browser->button), module->on_disk);
break;
case GIMP_MODULE_STATE_LOADED_OK:
gtk_label_set_text (GTK_LABEL(st->button_label), _("Unload"));
gtk_widget_set_sensitive (GTK_WIDGET (st->button), FALSE);
gtk_label_set_text (GTK_LABEL (browser->button_label), _("Unload"));
gtk_widget_set_sensitive (GTK_WIDGET (browser->button), FALSE);
break;
}
}
static void
browser_info_init (BrowserState *st,
GtkWidget *table)
browser_info_init (ModuleBrowser *browser,
GtkWidget *table)
{
GtkWidget *label;
gint i;
gint i;
gchar *text[] =
static const gchar *text[] =
{
N_("Purpose:"),
N_("Author:"),
@ -465,30 +452,34 @@ browser_info_init (BrowserState *st,
N_("Copyright:"),
N_("Date:"),
N_("Location:"),
N_("State:")
N_("State:"),
N_("Last Error:")
};
for (i=0; i < sizeof(text) / sizeof(char *); i++)
for (i = 0; i < G_N_ELEMENTS (text); i++)
{
label = gtk_label_new (gettext (text[i]));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, i, i+1,
gtk_table_attach (GTK_TABLE (table), label, 0, 1, i, i + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
gtk_widget_show (label);
st->label[i] = gtk_label_new ("");
gtk_misc_set_alignment (GTK_MISC (st->label[i]), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (st->table), st->label[i], 1, 2, i, i+1,
browser->label[i] = gtk_label_new ("");
gtk_misc_set_alignment (GTK_MISC (browser->label[i]), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (browser->table), browser->label[i],
1, 2, i, i + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
gtk_widget_show (st->label[i]);
gtk_widget_show (browser->label[i]);
}
st->load_inhibit_check =
browser->load_inhibit_check =
gtk_check_button_new_with_label (_("Autoload during start-up"));
gtk_widget_show (st->load_inhibit_check);
gtk_table_attach (GTK_TABLE (table), st->load_inhibit_check,
0, 2, i, i+1,
gtk_table_attach (GTK_TABLE (table), browser->load_inhibit_check,
0, 2, i, i + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
g_signal_connect (G_OBJECT (st->load_inhibit_check), "toggled",
G_CALLBACK (browser_load_inhibit_callback), st);
gtk_widget_show (browser->load_inhibit_check);
g_signal_connect (G_OBJECT (browser->load_inhibit_check), "toggled",
G_CALLBACK (browser_load_inhibit_callback),
browser);
}

View File

@ -237,6 +237,10 @@ AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION,,
AC_MSG_ERROR(Test for GLIB failed. See the file 'INSTALL' for help.),
gobject)
PKG_CHECK_MODULES(GMODULE, gmodule-2.0)
AC_SUBST(GMODULE_CFLAGS)
AC_SUBST(GMODULE_LIBS)
dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
gimp_save_LIBS=$LIBS
LIBS="$LIBS $GLIB_LIBS"
@ -1101,6 +1105,7 @@ libgimpcolor/Makefile
libgimpcolor/makefile.mingw
libgimpmath/Makefile
libgimpmath/makefile.mingw
libgimpmodule/Makefile
libgimpproxy/Makefile
libgimptool/Makefile
libgimpwidgets/Makefile
@ -1167,6 +1172,7 @@ devel-docs/libgimp/Makefile
devel-docs/libgimpbase/Makefile
devel-docs/libgimpcolor/Makefile
devel-docs/libgimpmath/Makefile
devel-docs/libgimpmodule/Makefile
devel-docs/libgimpwidgets/Makefile
docs/Makefile
docs/gimp-1.3.1

View File

@ -1,3 +1,25 @@
2002-10-21 Michael Natterer <mitch@gimp.org>
* Makefile.am
* libgimpmodule/.cvsignore
* libgimpmodule/Makefile.am
* libgimpmodule/libgimpmodule-docs.sgml
* libgimpmodule/libgimpmodule-sections.txt
* libgimpmodule/libgimpmodule.types
* libgimpmodule/tmpl/.cvsignore
* libgimpmodule/tmpl/gimpmodule.sgml
* libgimpmodule/tmpl/gimpmoduletypes.sgml: added API docs for the
new module loading lib.
* libgimp/tmpl/gimpmodule.sgml: removed.
* libgimp/libgimp-docs.sgml
* libgimp/libgimp-sections.txt: changed accordingly.
* libgimpwidgets/tmpl/gimpcolordisplay.sgml
* libgimpwidgets/tmpl/gimpcolorselect.sgml
* libgimpwidgets/tmpl/gimpcolorselector.sgml: updated.
2002-10-20 Michael Natterer <mitch@gimp.org>
* libgimp/tmpl/gimpcolordisplay.sgml

View File

@ -1,6 +1,12 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = libgimpcolor libgimpmath libgimpbase libgimpwidgets libgimp
SUBDIRS = \
libgimpcolor \
libgimpmath \
libgimpbase \
libgimpmodule \
libgimpwidgets \
libgimp
EXTRA_DIST = \
ChangeLog \

View File

@ -28,7 +28,6 @@
<!entity GimpTools SYSTEM "sgml/gimptools.sgml">
<!entity GimpUndo SYSTEM "sgml/gimpundo.sgml">
<!entity GimpEnums SYSTEM "sgml/gimpenums.sgml">
<!entity GimpModule SYSTEM "sgml/gimpmodule.sgml">
<!entity GimpExport SYSTEM "sgml/gimpexport.sgml">
<!entity GimpMenu SYSTEM "sgml/gimpmenu.sgml">
<!entity GimpUI SYSTEM "sgml/gimpui.sgml">
@ -81,9 +80,4 @@
&GimpExport;
&GimpMenu;
</chapter>
<chapter id="gimpmodule">
<title>GIMP Module Header Files</title>
&GimpModule;
</chapter>
</book>

View File

@ -87,13 +87,6 @@ gimp_gradients_set_active
gimp_ui_init
</SECTION>
<SECTION>
<FILE>gimpmodule</FILE>
GimpModuleInfo
GimpModuleQueryFunc
GimpModuleRegisterFunc
</SECTION>
<SECTION>
<FILE>gimpexport</FILE>
GimpExportCapabilities

View File

@ -0,0 +1,12 @@
Makefile
Makefile.in
libgimpmodule.args
libgimpmodule.hierarchy
libgimpmodule.signals
libgimpmodule-decl.txt
libgimpmodule-decl-list.txt
libgimpmodule-unused.txt
libgimpmodule-undocumented.txt
html
sgml
*.stamp

View File

@ -0,0 +1,184 @@
## Process this file with automake to produce Makefile.in
# The name of the module.
DOC_MODULE = libgimpmodule
# The top-level SGML file.
DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.sgml
# The directory containing the source code.
DOC_SOURCE_DIR = $(top_srcdir)/$(DOC_MODULE)
# Extra options to pass to gtkdoc-scangobj
SCANGOBJ_OPTIONS =
# Extra options to supply to gtkdoc-scan
SCAN_OPTIONS =
# Extra options to supply to gtkdoc-mkdb
MKDB_OPTIONS =
# Extra options to supply to gtkdoc-fixref
FIXXREF_OPTIONS =
# Used for dependencies
HFILE_GLOB = $(DOC_SOURCE_DIR)/*.h
CFILE_GLOB = $(DOC_SOURCE_DIR)/*.c
# Header files to ignore when scanning
IGNORE_HFILES =
# Images to copy into HTML directory
HTML_IMAGES=
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE)
content_files =
# Other files to distribute
extra_files =
# CFLAGS and LDFLAGS for compiling scan program. Only needed
# if $(DOC_MODULE).types is non-empty.
GTKDOC_CFLAGS = \
@CFLAGS@ \
-I$(top_srcdir) \
-I$(top_builddir) \
@GMODULE_CFLAGS@
GTKDOC_LIBS = \
$(top_builddir)/libgimpmodule/libgimpmodule-$(LT_RELEASE).la \
@GMODULE_LIBS@
GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC)
GTKDOC_LD = $(LIBTOOL) --mode=link $(CC)
####################################
# Everything below here is generic #
####################################
# We set GPATH here; this gives us semantics for GNU make
# which are more like other make's VPATH, when it comes to
# whether a source that is a target of one rule is then
# searched for in VPATH/GPATH.
#
GPATH = $(srcdir)
TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
EXTRA_DIST = \
$(content_files) \
$(extra_files) \
$(HTML_IMAGES) \
$(DOC_MAIN_SGML_FILE) \
$(DOC_MODULE).types \
$(DOC_MODULE)-sections.txt
DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \
$(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp
SCANOBJ_FILES = \
$(DOC_MODULE).args \
$(DOC_MODULE).hierarchy \
$(DOC_MODULE).signals
if ENABLE_GTK_DOC
all-local: html-build.stamp
#### scan ####
scan-build.stamp: $(HFILE_GLOB)
@echo '*** Scanning header files ***'
if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null ; then \
CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
else \
cd $(srcdir) ; \
for i in $(SCANOBJ_FILES) ; do \
test -f $$i || touch $$i ; \
done \
fi
cd $(srcdir) && \
gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
touch scan-build.stamp
$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp
@true
#### templates ####
tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt
@echo '*** Rebuilding template files ***'
cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE)
touch tmpl-build.stamp
tmpl.stamp: tmpl-build.stamp
@true
#### sgml ####
sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml
@echo '*** Building SGML ***'
cd $(srcdir) && \
gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) $(MKDB_OPTIONS)
touch sgml-build.stamp
sgml.stamp: sgml-build.stamp
@true
#### html ####
html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
@echo '*** Building HTML ***'
rm -rf $(srcdir)/html
mkdir $(srcdir)/html
cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
@echo '-- Fixing Crossreferences'
cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
touch html-build.stamp
else
all-local:
endif
##############
clean-local:
rm -f *~ *.bak $(SCANOBJ_FILES) *-unused.txt $(DOC_STAMPS)
maintainer-clean-local: clean
cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
(installfiles=`echo $(srcdir)/html/*`; \
if test "$$installfiles" = '$(srcdir)/html/*'; \
then echo '-- Nothing to install' ; \
else \
for i in $$installfiles; do \
echo '-- Installing '$$i ; \
$(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
done; \
echo '-- Installing $(srcdir)/html/index.sgml' ; \
$(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \
fi)
#
# Require gtk-doc when making dist
#
if ENABLE_GTK_DOC
dist-check-gtkdoc:
else
dist-check-gtkdoc:
@echo "*** gtk-doc must be installed and enabled in order to make dist"
@false
endif
dist-hook: dist-check-gtkdoc dist-hook-local
mkdir $(distdir)/tmpl
mkdir $(distdir)/sgml
mkdir $(distdir)/html
-cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
-cp $(srcdir)/sgml/*.sgml $(distdir)/sgml
-cp $(srcdir)/html/* $(distdir)/html
.PHONY : dist-hook-local

View File

@ -0,0 +1,15 @@
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
<!entity GimpModuleTypes SYSTEM "sgml/gimpmoduletypes.sgml">
<!entity GimpModule SYSTEM "sgml/gimpmodule.sgml">
]>
<book id="index">
<bookinfo>
<title>GIMP Module Library Reference Manual</title>
</bookinfo>
<chapter id="libgimpmodule">
<title>GIMP Module Library</title>
&GimpModuleTypes;
&GimpModule;
</chapter>
</book>

View File

@ -0,0 +1,28 @@
<SECTION>
<FILE>gimpmodule</FILE>
GimpModuleState
GimpModuleInfo
GimpModuleQueryFunc
GimpModuleRegisterFunc
<TITLE>GimpModule</TITLE>
gimp_module_new
gimp_module_modified
gimp_module_set_load_inhibit
gimp_module_info_new
gimp_module_info_copy
gimp_module_info_free
<SUBSECTION Standard>
GIMP_MODULE
GIMP_IS_MODULE
GIMP_TYPE_MODULE
gimp_module_get_type
GIMP_MODULE_CLASS
GIMP_IS_MODULE_CLASS
GIMP_MODULE_GET_CLASS
</SECTION>
<SECTION>
<FILE>gimpmoduletypes</FILE>
GimpModule
GimpModuleInfo
</SECTION>

View File

@ -0,0 +1,4 @@
#include <glib-object.h>
#include <libgimpmodule/gimpmodule.h>
gimp_module_get_type

View File

@ -0,0 +1 @@
libgimpmodule-unused.sgml

View File

@ -0,0 +1,123 @@
<!-- ##### SECTION Title ##### -->
GimpModule
<!-- ##### SECTION Short_Description ##### -->
Common definitions for creating a pluggable GIMP module.
<!-- ##### SECTION Long_Description ##### -->
<para>
Common definitions for creating a pluggable GIMP module.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GModule
</para>
<para>
#GTypeModule
</para>
<!-- ##### ENUM GimpModuleState ##### -->
<para>
</para>
@GIMP_MODULE_STATE_ERROR:
@GIMP_MODULE_STATE_LOADED_OK:
@GIMP_MODULE_STATE_LOAD_FAILED:
@GIMP_MODULE_STATE_UNLOADED_OK:
<!-- ##### STRUCT GimpModuleInfo ##### -->
<para>
</para>
@purpose:
@author:
@version:
@copyright:
@date:
<!-- ##### USER_FUNCTION GimpModuleQueryFunc ##### -->
<para>
</para>
@module:
@Returns:
<!-- ##### USER_FUNCTION GimpModuleRegisterFunc ##### -->
<para>
</para>
@module:
@Returns:
<!-- ##### FUNCTION gimp_module_new ##### -->
<para>
</para>
@filename:
@inhibit_str:
@verbose:
@Returns:
<!-- ##### FUNCTION gimp_module_modified ##### -->
<para>
</para>
@module:
<!-- ##### FUNCTION gimp_module_set_load_inhibit ##### -->
<para>
</para>
@module:
@inhibit_list:
<!-- ##### FUNCTION gimp_module_info_new ##### -->
<para>
</para>
@purpose:
@author:
@version:
@copyright:
@date:
@Returns:
<!-- ##### FUNCTION gimp_module_info_copy ##### -->
<para>
</para>
@info:
@Returns:
<!-- ##### FUNCTION gimp_module_info_free ##### -->
<para>
</para>
@info:
<!-- ##### SIGNAL GimpModule::modified ##### -->
<para>
</para>
@gimpmodule: the object which received the signal.

View File

@ -1,20 +1,25 @@
<!-- ##### SECTION Title ##### -->
gimpmodule
gimpmoduletypes
<!-- ##### SECTION Short_Description ##### -->
Common definitions for creating a pluggable GIMP module.
<!-- ##### SECTION Long_Description ##### -->
<para>
Common definitions for creating a pluggable GIMP module.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GModule
</para>
<!-- ##### STRUCT GimpModule ##### -->
<para>
</para>
<!-- ##### STRUCT GimpModuleInfo ##### -->
<para>
@ -26,21 +31,3 @@ Common definitions for creating a pluggable GIMP module.
@copyright:
@date:
<!-- ##### USER_FUNCTION GimpModuleQueryFunc ##### -->
<para>
</para>
@module:
@Returns:
<!-- ##### USER_FUNCTION GimpModuleRegisterFunc ##### -->
<para>
</para>
@module:
@Returns:

View File

@ -5,14 +5,12 @@ GimpColorDisplay
Functions and definitiions for creating a pluggable GIMP
display color correction module.
<!-- ##### SECTION Long_Description ##### -->
<para>
Functions and definitiions for creating a pluggable GIMP
display color correction module.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GModule
@ -24,7 +22,6 @@ display color correction module.
#libgimp-gimpmodule
</para>
<!-- ##### FUNCTION gimp_color_display_new ##### -->
<para>

View File

@ -9,13 +9,11 @@ gimpcolorselect
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### STRUCT GimpColorSelectClass ##### -->
<para>

View File

@ -11,7 +11,6 @@ Functions and definitiions for creating a pluggable GIMP
color selector module.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GModule
@ -23,7 +22,6 @@ color selector module.
#libgimp-gimpmodule
</para>
<!-- ##### MACRO GIMP_COLOR_SELECTOR_SIZE ##### -->
<para>

View File

@ -148,7 +148,6 @@ gimpinclude_HEADERS = \
gimpenums.h \
gimpimage.h \
gimplayer.h \
gimpmodule.h \
gimppixelrgn.h \
gimpproceduraldb.h \
gimpselection.h \

View File

@ -1,49 +0,0 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpmodule.h (C) 1999 Austin Donnelly <austin@greenend.org.uk>
*
* 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_MODULE_H__
#define __GIMP_MODULE_H__
#include <gmodule.h>
G_BEGIN_DECLS
/* For information look at the html documentation */
typedef struct _GimpModuleInfo GimpModuleInfo;
struct _GimpModuleInfo
{
const gchar *purpose;
const gchar *author;
const gchar *version;
const gchar *copyright;
const gchar *date;
};
typedef const GimpModuleInfo * (* GimpModuleQueryFunc) (GTypeModule *module);
typedef gboolean (* GimpModuleRegisterFunc) (GTypeModule *module);
G_END_DECLS
#endif /* __GIMP_MODULE_H__ */

10
libgimpmodule/.cvsignore Normal file
View File

@ -0,0 +1,10 @@
Makefile
Makefile.in
makefile.mingw
*.lo
_libs
.libs
.deps
*.la
*.lib
*.exp

83
libgimpmodule/Makefile.am Normal file
View File

@ -0,0 +1,83 @@
## Process this file with automake to produce Makefile.in
if PLATFORM_WIN32
no_undefined = -no-undefined
endif
if OS_WIN32
gimpmodule_def = gimpmodule.def
libgimpmodule_export_symbols = -export-symbols gimpmodule.def
install-libtool-import-lib:
$(INSTALL) .libs/libgimpmodule-1.3.dll.a $(DESTDIR)$(libdir)
uninstall-libtool-import-lib:
-rm $(DESTDIR)$(libdir)/libgimpmodule-1.3.dll.a
else
install-libtool-import-lib:
uninstall-libtool-import-lib:
endif
if MS_LIB_AVAILABLE
noinst_DATA = gimpmodule-1.3.lib
install-ms-lib:
$(INSTALL) gimpmodule-1.3.lib $(DESTDIR)$(libdir)
uninstall-ms-lib:
-rm $(DESTDIR)$(libdir)/gimpmodule-1.3.lib
gimpmodule-1.3.lib: gimpmodule.def
lib -name:libgimpmodule-1.3-@LT_CURRENT_MINUS_AGE@.dll -def:gimpmodule.def -out:$@
else
install-ms-lib:
uninstall-ms-lib:
endif
libgimpmoduleincludedir = $(includedir)/gimp-$(LT_RELEASE)/libgimpmodule
AM_CPPFLAGS = \
-DPREFIX=\""$(prefix)"\" \
-DGIMPDIR=\""$(gimpdir)"\" \
-DDATADIR=\""$(gimpdatadir)"\" \
-DLOCALEDIR=\""$(localedir)"\" \
-DPLUGINDIR=\""$(gimpplugindir)"\" \
-DSYSCONFDIR=\""$(gimpsysconfdir)"\" \
-DG_LOG_DOMAIN=\"LibGimpModule\" \
@GIMP_THREAD_FLAGS@
INCLUDES = \
-I$(top_srcdir) \
$(GLIB_CFLAGS) \
-I$(includedir)
EXTRA_DIST = \
makefile.msc \
gimpmodule.def
lib_LTLIBRARIES = libgimpmodule-1.3.la
libgimpmodule_1_3_la_SOURCES = \
gimpmoduletypes.h \
gimpmodule.c \
gimpmodule.h
libgimpmoduleinclude_HEADERS = \
gimpmoduletypes.h \
gimpmodule.h
EXTRA_HEADERS =
libgimpmodule_1_3_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
$(no_undefined) \
$(libgimpmodule_export_symbols)
libgimpmodule_1_3_la_DEPENDENCIES = $(gimpmodule_def)
libgimpmodule_1_3_la_LIBADD = $(GLIB_LIBS)
install-data-local: install-ms-lib install-libtool-import-lib
uninstall-local: uninstall-ms-lib uninstall-libtool-import-lib

View File

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpmoduleinfo.c
* gimpmodule.c
* (C) 1999 Austin Donnelly <austin@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
@ -25,12 +25,7 @@
#include <glib-object.h>
#include "libgimp/gimpmodule.h"
#include "core-types.h"
#include "gimpmarshal.h"
#include "gimpmoduleinfo.h"
#include "gimpmodule.h"
#include "libgimp/gimpintl.h"
@ -42,53 +37,53 @@ enum
};
static void gimp_module_info_class_init (GimpModuleInfoObjClass *klass);
static void gimp_module_info_init (GimpModuleInfoObj *mod);
static void gimp_module_class_init (GimpModuleClass *klass);
static void gimp_module_init (GimpModule *module);
static void gimp_module_info_finalize (GObject *object);
static void gimp_module_finalize (GObject *object);
static gboolean gimp_module_info_load (GTypeModule *module);
static void gimp_module_info_unload (GTypeModule *module);
static gboolean gimp_module_load (GTypeModule *module);
static void gimp_module_unload (GTypeModule *module);
static void gimp_module_info_set_last_error (GimpModuleInfoObj *module_info,
const gchar *error_str);
static void gimp_module_set_last_error (GimpModule *module,
const gchar *error_str);
static guint module_info_signals[LAST_SIGNAL];
static guint module_signals[LAST_SIGNAL];
static GTypeModuleClass *parent_class = NULL;
GType
gimp_module_info_get_type (void)
gimp_module_get_type (void)
{
static GType module_info_type = 0;
static GType module_type = 0;
if (! module_info_type)
if (! module_type)
{
static const GTypeInfo module_info_info =
static const GTypeInfo module_info =
{
sizeof (GimpModuleInfoObjClass),
sizeof (GimpModuleClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gimp_module_info_class_init,
(GClassInitFunc) gimp_module_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpModuleInfoObj),
sizeof (GimpModule),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_module_info_init,
(GInstanceInitFunc) gimp_module_init,
};
module_info_type = g_type_register_static (G_TYPE_TYPE_MODULE,
"GimpModuleInfoObj",
&module_info_info, 0);
module_type = g_type_register_static (G_TYPE_TYPE_MODULE,
"GimpModule",
&module_info, 0);
}
return module_info_type;
return module_type;
}
static void
gimp_module_info_class_init (GimpModuleInfoObjClass *klass)
gimp_module_class_init (GimpModuleClass *klass)
{
GObjectClass *object_class;
GTypeModuleClass *module_class;
@ -98,249 +93,250 @@ gimp_module_info_class_init (GimpModuleInfoObjClass *klass)
parent_class = g_type_class_peek_parent (klass);
module_info_signals[MODIFIED] =
module_signals[MODIFIED] =
g_signal_new ("modified",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpModuleInfoObjClass, modified),
G_STRUCT_OFFSET (GimpModuleClass, modified),
NULL, NULL,
gimp_marshal_VOID__VOID,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->finalize = gimp_module_info_finalize;
object_class->finalize = gimp_module_finalize;
module_class->load = gimp_module_info_load;
module_class->unload = gimp_module_info_unload;
module_class->load = gimp_module_load;
module_class->unload = gimp_module_unload;
klass->modified = NULL;
}
static void
gimp_module_info_init (GimpModuleInfoObj *module_info)
gimp_module_init (GimpModule *module)
{
module_info->filename = NULL;
module_info->verbose = FALSE;
module_info->state = GIMP_MODULE_STATE_ERROR;
module_info->on_disk = FALSE;
module_info->load_inhibit = FALSE;
module->filename = NULL;
module->verbose = FALSE;
module->state = GIMP_MODULE_STATE_ERROR;
module->on_disk = FALSE;
module->load_inhibit = FALSE;
module_info->module = NULL;
module_info->last_module_error = NULL;
module->module = NULL;
module->info = NULL;
module->last_module_error = NULL;
module_info->register_module = NULL;
module->query_module = NULL;
module->register_module = NULL;
}
static void
gimp_module_info_finalize (GObject *object)
gimp_module_finalize (GObject *object)
{
GimpModuleInfoObj *mod;
GimpModule *module;
mod = GIMP_MODULE_INFO (object);
module = GIMP_MODULE (object);
if (mod->last_module_error)
if (module->info)
{
g_free (mod->last_module_error);
mod->last_module_error = NULL;
gimp_module_info_free (module->info);
module->info = NULL;
}
if (mod->filename)
if (module->last_module_error)
{
g_free (mod->filename);
mod->filename = NULL;
g_free (module->last_module_error);
module->last_module_error = NULL;
}
if (module->filename)
{
g_free (module->filename);
module->filename = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gboolean
gimp_module_info_load (GTypeModule *module)
gimp_module_load (GTypeModule *module)
{
GimpModuleInfoObj *module_info;
GimpModule *gimp_module;
const GimpModuleInfo *info;
gpointer symbol;
gboolean retval;
g_return_val_if_fail (GIMP_IS_MODULE_INFO (module), FALSE);
g_return_val_if_fail (GIMP_IS_MODULE (module), FALSE);
module_info = GIMP_MODULE_INFO (module);
gimp_module = GIMP_MODULE (module);
g_return_val_if_fail (module_info->filename != NULL, FALSE);
g_return_val_if_fail (module_info->module == NULL, FALSE);
g_return_val_if_fail (gimp_module->filename != NULL, FALSE);
g_return_val_if_fail (gimp_module->module == NULL, FALSE);
if (module_info->verbose)
g_print (_("loading module: '%s'\n"), module_info->filename);
if (gimp_module->verbose)
g_print (_("loading module: '%s'\n"), gimp_module->filename);
module_info->module = g_module_open (module_info->filename,
gimp_module->module = g_module_open (gimp_module->filename,
G_MODULE_BIND_LAZY);
if (! module_info->module)
if (! gimp_module->module)
{
module_info->state = GIMP_MODULE_STATE_ERROR;
gimp_module_info_set_last_error (module_info, g_module_error ());
gimp_module->state = GIMP_MODULE_STATE_ERROR;
gimp_module_set_last_error (gimp_module, g_module_error ());
if (module_info->verbose)
if (gimp_module->verbose)
g_message (_("Module '%s' load error:\n%s"),
module_info->filename, module_info->last_module_error);
gimp_module->filename, gimp_module->last_module_error);
return FALSE;
}
/* find the gimp_module_query symbol */
if (! g_module_symbol (module_info->module, "gimp_module_query", &symbol))
if (! g_module_symbol (gimp_module->module, "gimp_module_query", &symbol))
{
module_info->state = GIMP_MODULE_STATE_ERROR;
gimp_module->state = GIMP_MODULE_STATE_ERROR;
gimp_module_info_set_last_error (module_info,
_("Missing gimp_module_query() symbol"));
gimp_module_set_last_error (gimp_module,
_("Missing gimp_module_query() symbol"));
if (module_info->verbose)
if (gimp_module->verbose)
g_message (_("Module '%s' load error:\n%s"),
module_info->filename, module_info->last_module_error);
g_module_close (module_info->module);
module_info->module = NULL;
gimp_module->filename, gimp_module->last_module_error);
g_module_close (gimp_module->module);
gimp_module->module = NULL;
return FALSE;
}
module_info->query_module = symbol;
gimp_module->query_module = symbol;
info = module_info->query_module (module);
info = gimp_module->query_module (module);
if (gimp_module->info)
{
gimp_module_info_free (gimp_module->info);
gimp_module->info = NULL;
}
if (! info)
{
module_info->state = GIMP_MODULE_STATE_ERROR;
gimp_module->state = GIMP_MODULE_STATE_ERROR;
gimp_module_info_set_last_error (module_info,
_("gimp_module_query() returned NULL"));
gimp_module_set_last_error (gimp_module,
_("gimp_module_query() returned NULL"));
if (module_info->verbose)
if (gimp_module->verbose)
g_message (_("Module '%s' load error:\n%s"),
module_info->filename, module_info->last_module_error);
g_module_close (module_info->module);
module_info->module = NULL;
module_info->query_module = NULL;
gimp_module->filename, gimp_module->last_module_error);
g_module_close (gimp_module->module);
gimp_module->module = NULL;
gimp_module->query_module = NULL;
return FALSE;
}
g_free ((gchar *) module_info->info.purpose);
module_info->info.purpose = g_strdup (info->purpose);
g_free ((gchar *) module_info->info.author);
module_info->info.author = g_strdup (info->author);
g_free ((gchar *) module_info->info.version);
module_info->info.version = g_strdup (info->version);
g_free ((gchar *) module_info->info.copyright);
module_info->info.copyright = g_strdup (info->copyright);
g_free ((gchar *) module_info->info.date);
module_info->info.date = g_strdup (info->date);
gimp_module->info = gimp_module_info_copy (info);
/* find the gimp_module_register symbol */
if (! g_module_symbol (module_info->module, "gimp_module_register", &symbol))
if (! g_module_symbol (gimp_module->module, "gimp_module_register", &symbol))
{
module_info->state = GIMP_MODULE_STATE_ERROR;
gimp_module->state = GIMP_MODULE_STATE_ERROR;
gimp_module_info_set_last_error (module_info,
_("Missing gimp_module_register() symbol"));
gimp_module_set_last_error (gimp_module,
_("Missing gimp_module_register() symbol"));
if (module_info->verbose)
if (gimp_module->verbose)
g_message (_("Module '%s' load error:\n%s"),
module_info->filename, module_info->last_module_error);
g_module_close (module_info->module);
module_info->module = NULL;
gimp_module->filename, gimp_module->last_module_error);
g_module_close (gimp_module->module);
gimp_module->module = NULL;
return FALSE;
}
module_info->register_module = symbol;
gimp_module->register_module = symbol;
retval = module_info->register_module (module);
retval = gimp_module->register_module (module);
if (retval)
module_info->state = GIMP_MODULE_STATE_LOADED_OK;
gimp_module->state = GIMP_MODULE_STATE_LOADED_OK;
else
module_info->state = GIMP_MODULE_STATE_LOAD_FAILED;
gimp_module->state = GIMP_MODULE_STATE_LOAD_FAILED;
return retval;
}
static void
gimp_module_info_unload (GTypeModule *module)
gimp_module_unload (GTypeModule *module)
{
GimpModuleInfoObj *module_info;
GimpModule *gimp_module;
g_return_if_fail (GIMP_IS_MODULE_INFO (module));
g_return_if_fail (GIMP_IS_MODULE (module));
module_info = GIMP_MODULE_INFO (module);
gimp_module = GIMP_MODULE (module);
g_return_if_fail (module_info->module != NULL);
g_return_if_fail (gimp_module->module != NULL);
g_module_close (module_info->module); /* FIXME: error handling */
module_info->module = NULL;
module_info->query_module = NULL;
module_info->register_module = NULL;
g_module_close (gimp_module->module); /* FIXME: error handling */
gimp_module->module = NULL;
gimp_module->query_module = NULL;
gimp_module->register_module = NULL;
module_info->state = GIMP_MODULE_STATE_UNLOADED_OK;
gimp_module->state = GIMP_MODULE_STATE_UNLOADED_OK;
}
GimpModuleInfoObj *
gimp_module_info_new (const gchar *filename,
const gchar *inhibit_list,
gboolean verbose)
GimpModule *
gimp_module_new (const gchar *filename,
const gchar *inhibit_list,
gboolean verbose)
{
GimpModuleInfoObj *module_info;
GimpModule *module;
g_return_val_if_fail (filename != NULL, NULL);
module_info = g_object_new (GIMP_TYPE_MODULE_INFO, NULL);
module = g_object_new (GIMP_TYPE_MODULE, NULL);
module_info->filename = g_strdup (filename);
module_info->verbose = verbose ? TRUE : FALSE;
module_info->on_disk = TRUE;
module->filename = g_strdup (filename);
module->verbose = verbose ? TRUE : FALSE;
module->on_disk = TRUE;
gimp_module_info_set_load_inhibit (module_info, inhibit_list);
gimp_module_set_load_inhibit (module, inhibit_list);
if (! module_info->load_inhibit)
if (! module->load_inhibit)
{
if (gimp_module_info_load (G_TYPE_MODULE (module_info)))
gimp_module_info_unload (G_TYPE_MODULE (module_info));
if (gimp_module_load (G_TYPE_MODULE (module)))
gimp_module_unload (G_TYPE_MODULE (module));
}
else
{
if (verbose)
g_print (_("skipping module: '%s'\n"), filename);
module_info->state = GIMP_MODULE_STATE_UNLOADED_OK;
module->state = GIMP_MODULE_STATE_UNLOADED_OK;
}
return module_info;
return module;
}
void
gimp_module_info_modified (GimpModuleInfoObj *module_info)
gimp_module_modified (GimpModule *module)
{
g_return_if_fail (GIMP_IS_MODULE_INFO (module_info));
g_return_if_fail (GIMP_IS_MODULE (module));
g_signal_emit (G_OBJECT (module_info), module_info_signals[MODIFIED], 0);
g_signal_emit (G_OBJECT (module), module_signals[MODIFIED], 0);
}
void
gimp_module_info_set_load_inhibit (GimpModuleInfoObj *module_info,
const gchar *inhibit_list)
gimp_module_set_load_inhibit (GimpModule *module,
const gchar *inhibit_list)
{
gchar *p;
gint pathlen;
const gchar *start;
const gchar *end;
g_return_if_fail (GIMP_IS_MODULE_INFO (module_info));
g_return_if_fail (module_info->filename != NULL);
g_return_if_fail (GIMP_IS_MODULE (module));
g_return_if_fail (module->filename != NULL);
module_info->load_inhibit = FALSE;
module->load_inhibit = FALSE;
if (! inhibit_list || ! strlen (inhibit_list))
return;
p = strstr (inhibit_list, module_info->filename);
p = strstr (inhibit_list, module->filename);
if (!p)
return;
@ -356,18 +352,67 @@ gimp_module_info_set_load_inhibit (GimpModuleInfoObj *module_info,
if (! end)
end = inhibit_list + strlen (inhibit_list);
pathlen = strlen (module_info->filename);
pathlen = strlen (module->filename);
if ((end - start) == pathlen)
module_info->load_inhibit = TRUE;
module->load_inhibit = TRUE;
}
static void
gimp_module_info_set_last_error (GimpModuleInfoObj *module_info,
const gchar *error_str)
gimp_module_set_last_error (GimpModule *module,
const gchar *error_str)
{
if (module_info->last_module_error)
g_free (module_info->last_module_error);
if (module->last_module_error)
g_free (module->last_module_error);
module_info->last_module_error = g_strdup (error_str);
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)
{
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);
g_free (info);
}

View File

@ -0,0 +1,8 @@
EXPORTS
gimp_module_get_type
gimp_module_new
gimp_module_modified
gimp_module_set_load_inhibit
gimp_module_info_new
gimp_module_info_copy
gimp_module_info_free

View File

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpmoduleinfo.h
* gimpmodule.h
* (C) 1999 Austin Donnelly <austin@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
@ -19,34 +19,57 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_MODULE_INFO_H__
#define __GIMP_MODULE_INFO_H__
#ifndef __GIMP_MODULE_H__
#define __GIMP_MODULE_H__
#include <gmodule.h>
#include "libgimp/gimpmodule.h"
#include <libgimpmodule/gimpmoduletypes.h>
G_BEGIN_DECLS
typedef enum
{
GIMP_MODULE_STATE_ERROR, /* missing module_load function or other error */
GIMP_MODULE_STATE_LOADED_OK, /* happy and running (normal state of affairs) */
GIMP_MODULE_STATE_LOAD_FAILED, /* module_load returned GIMP_MODULE_UNLOAD */
GIMP_MODULE_STATE_UNLOAD_REQUESTED, /* sent unload request, waiting for callback */
GIMP_MODULE_STATE_UNLOADED_OK /* callback arrived, module not in memory anymore */
GIMP_MODULE_STATE_ERROR, /* missing gimp_module_register function
* or other error
*/
GIMP_MODULE_STATE_LOADED_OK, /* an instance of a type implemented by
* this module is allocated
*/
GIMP_MODULE_STATE_LOAD_FAILED, /* gimp_module_register returned FALSE
*/
GIMP_MODULE_STATE_UNLOADED_OK /* there are no instances allocated of
* types implemented by this module
*/
} GimpModuleState;
#define GIMP_TYPE_MODULE_INFO (gimp_module_info_get_type ())
#define GIMP_MODULE_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MODULE_INFO, GimpModuleInfoObj))
#define GIMP_MODULE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MODULE_INFO, GimpModuleInfoObjClass))
#define GIMP_IS_MODULE_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MODULE_INFO))
#define GIMP_IS_MODULE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MODULE_INFO))
#define GIMP_MODULE_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MODULE_INFO, GimpModuleInfoObjClass))
struct _GimpModuleInfo
{
gchar *purpose;
gchar *author;
gchar *version;
gchar *copyright;
gchar *date;
};
typedef struct _GimpModuleInfoObjClass GimpModuleInfoObjClass;
typedef const GimpModuleInfo * (* GimpModuleQueryFunc) (GTypeModule *module);
typedef gboolean (* GimpModuleRegisterFunc) (GTypeModule *module);
struct _GimpModuleInfoObj
#define GIMP_TYPE_MODULE (gimp_module_get_type ())
#define GIMP_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MODULE, GimpModule))
#define GIMP_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MODULE, GimpModuleClass))
#define GIMP_IS_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MODULE))
#define GIMP_IS_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MODULE))
#define GIMP_MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MODULE, GimpModuleClass))
typedef struct _GimpModuleClass GimpModuleClass;
struct _GimpModule
{
GTypeModule parent_instance;
@ -58,30 +81,43 @@ struct _GimpModuleInfoObj
/* stuff from now on may be NULL depending on the state the module is in */
GModule *module; /* handle on the module */
GimpModuleInfo info; /* returned values from module_query */
GimpModuleInfo *info; /* returned values from module_query */
gchar *last_module_error;
const GimpModuleInfo * (* query_module) (GTypeModule *module);
gboolean (* register_module) (GTypeModule *module);
GimpModuleQueryFunc query_module;
GimpModuleRegisterFunc register_module;
};
struct _GimpModuleInfoObjClass
struct _GimpModuleClass
{
GTypeModuleClass parent_class;
void (* modified) (GimpModuleInfoObj *module_info);
void (* modified) (GimpModule *module);
};
GType gimp_module_info_get_type (void) G_GNUC_CONST;
GType gimp_module_get_type (void) G_GNUC_CONST;
GimpModuleInfoObj * gimp_module_info_new (const gchar *filename,
const gchar *inhibit_str,
gboolean verbose);
GimpModule * gimp_module_new (const gchar *filename,
const gchar *inhibit_str,
gboolean verbose);
void gimp_module_info_modified (GimpModuleInfoObj *module);
void gimp_module_info_set_load_inhibit (GimpModuleInfoObj *module,
const gchar *inhibit_list);
void gimp_module_modified (GimpModule *module);
void gimp_module_set_load_inhibit (GimpModule *module,
const gchar *inhibit_list);
/* GimpModuleInfo functions */
GimpModuleInfo * gimp_module_info_new (const gchar *purpose,
const gchar *author,
const gchar *version,
const gchar *copyright,
const gchar *date);
GimpModuleInfo * gimp_module_info_copy (const GimpModuleInfo *info);
void gimp_module_info_free (GimpModuleInfo *info);
G_END_DECLS
#endif /* __GIMP_MODULE_INFO_H__ */

View File

@ -32,6 +32,7 @@
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpmodule/gimpmodule.h"
#include "core-types.h"
@ -39,7 +40,6 @@
#include "gimpcoreconfig.h"
#include "gimpdatafiles.h"
#include "gimplist.h"
#include "gimpmoduleinfo.h"
#include "gimpmodules.h"
#include "gimprc.h"
@ -50,23 +50,23 @@
#define DUMP_DB 1
static void gimp_modules_module_initialize (const gchar *filename,
gpointer loader_data);
static void gimp_modules_module_initialize (const gchar *filename,
gpointer loader_data);
static GimpModuleInfoObj * gimp_modules_module_find_by_path (Gimp *gimp,
const char *fullpath);
static GimpModule * gimp_modules_module_find_by_path (Gimp *gimp,
const char *fullpath);
#ifdef DUMP_DB
static void print_module_info (gpointer data,
gpointer user_data);
static void gimp_modules_dump_module (gpointer data,
gpointer user_data);
#endif
static gboolean gimp_modules_write_modulerc (Gimp *gimp);
static gboolean gimp_modules_write_modulerc (Gimp *gimp);
static void gimp_modules_module_on_disk_func (gpointer data,
gpointer user_data);
static void gimp_modules_module_remove_func (gpointer data,
gpointer user_data);
static void gimp_modules_module_on_disk_func (gpointer data,
gpointer user_data);
static void gimp_modules_module_remove_func (gpointer data,
gpointer user_data);
void
@ -74,7 +74,7 @@ gimp_modules_init (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->modules = gimp_list_new (GIMP_TYPE_MODULE_INFO,
gimp->modules = gimp_list_new (GIMP_TYPE_MODULE,
GIMP_CONTAINER_POLICY_STRONG);
gimp_object_set_name (GIMP_OBJECT (gimp->modules), "modules");
@ -111,7 +111,7 @@ gimp_modules_load (Gimp *gimp)
gimp);
#ifdef DUMP_DB
gimp_container_foreach (gimp->modules, print_module_info, NULL);
gimp_container_foreach (gimp->modules, gimp_modules_dump_module, NULL);
#endif
}
@ -156,13 +156,13 @@ static void
add_to_inhibit_string (gpointer data,
gpointer user_data)
{
GimpModuleInfoObj *module_info = data;
GString *str = user_data;
GimpModule *module = data;
GString *str = user_data;
if (module_info->load_inhibit)
if (module->load_inhibit)
{
str = g_string_append_c (str, G_SEARCHPATH_SEPARATOR);
str = g_string_append (str, module_info->filename);
str = g_string_append (str, module->filename);
}
}
@ -239,8 +239,8 @@ static void
gimp_modules_module_initialize (const gchar *filename,
gpointer loader_data)
{
GimpModuleInfoObj *module_info;
Gimp *gimp;
GimpModule *module;
Gimp *gimp;
gimp = GIMP (loader_data);
@ -251,26 +251,26 @@ gimp_modules_module_initialize (const gchar *filename,
if (gimp_modules_module_find_by_path (gimp, filename))
return;
module_info = gimp_module_info_new (filename,
gimp->config->module_db_load_inhibit,
gimp->be_verbose);
module = gimp_module_new (filename,
gimp->config->module_db_load_inhibit,
gimp->be_verbose);
gimp_container_add (gimp->modules, (GimpObject *) module_info);
gimp_container_add (gimp->modules, (GimpObject *) module);
}
static GimpModuleInfoObj *
static GimpModule *
gimp_modules_module_find_by_path (Gimp *gimp,
const char *fullpath)
{
GimpModuleInfoObj *module_info;
GList *list;
GimpModule *module;
GList *list;
for (list = GIMP_LIST (gimp->modules)->list; list; list = g_list_next (list))
{
module_info = (GimpModuleInfoObj *) list->data;
module = (GimpModule *) list->data;
if (! strcmp (module_info->filename, fullpath))
return module_info;
if (! strcmp (module->filename, fullpath))
return module;
}
return NULL;
@ -278,10 +278,10 @@ gimp_modules_module_find_by_path (Gimp *gimp,
#ifdef DUMP_DB
static void
print_module_info (gpointer data,
gpointer user_data)
gimp_modules_dump_module (gpointer data,
gpointer user_data)
{
GimpModuleInfoObj *i = data;
GimpModule *i = data;
g_print ("\n%s: %i\n",
i->filename,
@ -293,16 +293,19 @@ print_module_info (gpointer data,
i->query_module,
i->register_module);
g_print (" purpose: %s\n"
" author: %s\n"
" version: %s\n"
" copyright: %s\n"
" date: %s\n",
i->info.purpose ? i->info.purpose : "NONE",
i->info.author ? i->info.author : "NONE",
i->info.version ? i->info.version : "NONE",
i->info.copyright ? i->info.copyright : "NONE",
i->info.date ? i->info.date : "NONE");
if (i->info)
{
g_print (" purpose: %s\n"
" author: %s\n"
" version: %s\n"
" copyright: %s\n"
" date: %s\n",
i->info->purpose ? i->info->purpose : "NONE",
i->info->author ? i->info->author : "NONE",
i->info->version ? i->info->version : "NONE",
i->info->copyright ? i->info->copyright : "NONE",
i->info->date ? i->info->date : "NONE");
}
}
#endif
@ -310,40 +313,39 @@ static void
gimp_modules_module_on_disk_func (gpointer data,
gpointer user_data)
{
GimpModuleInfoObj *module_info;
GList **kill_list;
gint old_on_disk;
GimpModule *module;
GList **kill_list;
gint old_on_disk;
module_info = (GimpModuleInfoObj *) data;
kill_list = (GList **) user_data;
module = (GimpModule *) data;
kill_list = (GList **) user_data;
old_on_disk = module_info->on_disk;
old_on_disk = module->on_disk;
module_info->on_disk = g_file_test (module_info->filename,
G_FILE_TEST_IS_REGULAR);
module->on_disk = g_file_test (module->filename, G_FILE_TEST_IS_REGULAR);
/* if it's not on the disk, and it isn't in memory, mark it to be
* removed later.
*/
if (! module_info->on_disk && ! module_info->module)
if (! module->on_disk && ! module->module)
{
*kill_list = g_list_append (*kill_list, module_info);
module_info = NULL;
*kill_list = g_list_append (*kill_list, module);
module = NULL;
}
if (module_info && module_info->on_disk != old_on_disk)
gimp_module_info_modified (module_info);
if (module && module->on_disk != old_on_disk)
gimp_module_modified (module);
}
static void
gimp_modules_module_remove_func (gpointer data,
gpointer user_data)
{
GimpModuleInfoObj *module_info;
Gimp *gimp;
GimpModule *module;
Gimp *gimp;
module_info = (GimpModuleInfoObj *) data;
gimp = (Gimp *) user_data;
module = (GimpModule *) data;
gimp = (Gimp *) user_data;
gimp_container_remove (gimp->modules, (GimpObject *) module_info);
gimp_container_remove (gimp->modules, (GimpObject *) module);
}

View File

@ -0,0 +1,34 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_MODULE_TYPES_H__
#define __GIMP_MODULE_TYPES_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
typedef struct _GimpModule GimpModule;
typedef struct _GimpModuleInfo GimpModuleInfo;
G_END_DECLS
#endif /* __GIMP_MODULE_TYPES_H__ */

View File

@ -0,0 +1,77 @@
# autogenerated from automake.am with automake.py
# and slightly modified
TOP = ..\..
PRJ_TOP = ..
PACKAGE = gimpmodule
PKG_VER = 1.3
!INCLUDE $(TOP)\glib\build\win32\make.msc
# The name of the directory in your %HOME% where the GIMP's personal settings
# and stuff is saved.
GIMPDIR = _gimp$(PKG_VER)
DEFINES = -DGIMPDIR=\"$(GIMPDIR)\" -DDATADIR=\"\" -DSYSCONFDIR=\"\" \
-DPLUGINDIR=\"plug-ins\" -DLOCALEDIR=\"locale\"
top_srcdir = $(PRJ_TOP)
top_builddir = $(PRJ_TOP)
includedir = $(PRJ_TOP)
LT_RELEASE = $(PKG_VER)
INCLUDES = \
-FImsvc_recommended_pragmas.h \
-I$(top_srcdir) \
-I$(top_srcdir)/intl \
-I../intl \
$(GLIB_CFLAGS) \
-I$(includedir) \
PKG_LINK = \
$(GLIB_LIBS)
OBJECTS = \
gimpmodule.obj
lib_LTLIBRARIES = \
libgimpmodule-1.3.la
libgimpmodule_1_3_la_LIBADD = \
$(GLIB_LIBS)
libgimpmoduleincludedir = \
$(includedir)/gimp-$(LT_RELEASE)/libgimpmodule
EXTRA_DIST = \
gimpversion.h.in \
makefile.mingw \
makefile.mingw.in \
makefile.msc \
gimpmodule.def
libgimpmodule_1_3_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
libgimpmoduleinclude_HEADERS = \
gimpmoduletypes.h \
gimpmodule.h
all : \
$(PRJ_TOP)\config.h \
$(PACKAGE)-$(PKG_VER).dll
$(PRJ_TOP)\config.h: $(PRJ_TOP)\config.h.win32
copy $(PRJ_TOP)\config.h.win32 $(PRJ_TOP)\config.h
RESOURCE = $(PACKAGE).res
$(PACKAGE).lib : $(OBJECTS)
lib /out:$(PACKAGE).lib $(OBJECTS)
$(PACKAGE)-$(PKG_VER).dll : $(OBJECTS) $(PACKAGE).def
$(CC) $(CFLAGS) -LD -Fe$(PACKAGE)-$(PKG_VER).dll $(OBJECTS) $(PKG_LINK) user32.lib advapi32.lib wsock32.lib $(LDFLAGS) /def:$(PACKAGE).def
$(PACKAGE).exe : $(OBJECTS) $(PACKAGE).def $(PACKAGE).res
$(CC) $(CFLAGS) -Fe$(PACKAGE).exe $(PACKAGE).res $(OBJECTS) $(PKG_LINK) \
user32.lib advapi32.lib shell32.lib wsock32.lib winspool.lib $(LDFLAGS) /def:$(PACKAGE).def
.c.obj :
$(CC) $(CFLAGS) -GD -c $(PKG_CFLAGS) $<

View File

@ -24,10 +24,9 @@
#include "libgimpbase/gimpbase.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpmodule/gimpmodule.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "libgimp/gimpmodule.h"
#include "libgimp/gimpintl.h"

View File

@ -24,10 +24,9 @@
#include "libgimpbase/gimpbase.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpmodule/gimpmodule.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "libgimp/gimpmodule.h"
#include "libgimp/gimpintl.h"

View File

@ -31,10 +31,9 @@
#include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpmodule/gimpmodule.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "libgimp/gimpmodule.h"
#include "libgimp/gimpintl.h"

View File

@ -31,10 +31,9 @@
#include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpmodule/gimpmodule.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "libgimp/gimpmodule.h"
#include "libgimp/gimpintl.h"

View File

@ -1,3 +1,7 @@
2002-10-21 Michael Natterer <mitch@gimp.org>
* POTFILES.in: added libgimpmodule/gimpmodule.c
2002-10-15 Ole Laursen <olau@hardworking.dk>
* da.po: Updated Danish translation.

View File

@ -4,6 +4,7 @@
libgimp/gimpexport.c
libgimp/gimpmenu.c
libgimp/gimpunit.c
libgimpmodule/gimpmodule.c
libgimpwidgets/gimpcolorbutton.c
libgimpwidgets/gimpfileselection.c
libgimpwidgets/gimpquerybox.c

View File

@ -1,3 +1,7 @@
2002-10-21 Michael Natterer <mitch@gimp.org>
* POTFILES.in: removed app/core/gimpmoduleinfo.c
2002-10-15 Ole Laursen <olau@hardworking.dk>
* da.po: Updated Danish translation.

View File

@ -38,7 +38,6 @@ app/core/gimpitem.c
app/core/gimplayer.c
app/core/gimplayer-floating-sel.c
app/core/gimplayermask.c
app/core/gimpmoduleinfo.c
app/core/gimpmodules.c
app/core/gimppalette-import.c
app/core/gimppalette.c