2003-11-23 23:35:27 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
2001-10-19 01:27:36 +08:00
|
|
|
*
|
2003-11-23 23:35:27 +08:00
|
|
|
* 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.
|
2001-10-19 01:27:36 +08:00
|
|
|
*
|
2003-11-23 23:35:27 +08:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2001-10-19 01:27:36 +08:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2003-11-23 23:35:27 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2001-10-19 01:27:36 +08:00
|
|
|
*
|
2003-11-23 23:35:27 +08:00
|
|
|
* 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.
|
2001-10-19 01:27:36 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
2002-02-18 22:34:50 +08:00
|
|
|
|
2001-10-19 01:27:36 +08:00
|
|
|
#include <glib-object.h>
|
|
|
|
|
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
#include "gimpmoduletypes.h"
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
#include "gimpmodule.h"
|
|
|
|
#include "gimpmoduledb.h"
|
2001-10-19 01:27:36 +08:00
|
|
|
|
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ADD,
|
|
|
|
REMOVE,
|
|
|
|
MODULE_MODIFIED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-11-06 21:56:37 +08:00
|
|
|
/* #define DUMP_DB 1 */
|
2002-10-20 18:14:17 +08:00
|
|
|
|
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
static void gimp_module_db_finalize (GObject *object);
|
|
|
|
|
2003-07-03 01:11:00 +08:00
|
|
|
static void gimp_module_db_module_initialize (const GimpDatafileData *file_data,
|
|
|
|
gpointer user_data);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
static GimpModule * gimp_module_db_module_find_by_path (GimpModuleDB *db,
|
|
|
|
const char *fullpath);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
|
|
|
#ifdef DUMP_DB
|
2002-10-23 22:55:07 +08:00
|
|
|
static void gimp_module_db_dump_module (gpointer data,
|
|
|
|
gpointer user_data);
|
2001-10-19 01:27:36 +08:00
|
|
|
#endif
|
|
|
|
|
2003-11-15 20:36:09 +08:00
|
|
|
static void gimp_module_db_module_on_disk_func (gpointer data,
|
2002-10-23 22:55:07 +08:00
|
|
|
gpointer user_data);
|
2003-11-15 20:36:09 +08:00
|
|
|
static void gimp_module_db_module_remove_func (gpointer data,
|
2002-10-23 22:55:07 +08:00
|
|
|
gpointer user_data);
|
|
|
|
static void gimp_module_db_module_modified (GimpModule *module,
|
|
|
|
GimpModuleDB *db);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
|
|
|
|
2006-05-15 17:46:31 +08:00
|
|
|
G_DEFINE_TYPE (GimpModuleDB, gimp_module_db, G_TYPE_OBJECT)
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2005-12-21 04:35:23 +08:00
|
|
|
#define parent_class gimp_module_db_parent_class
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2005-12-21 04:35:23 +08:00
|
|
|
static guint db_signals[LAST_SIGNAL] = { 0 };
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
static void
|
|
|
|
gimp_module_db_class_init (GimpModuleDBClass *klass)
|
|
|
|
{
|
2004-01-24 01:24:44 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2002-10-23 22:55:07 +08:00
|
|
|
|
|
|
|
db_signals[ADD] =
|
|
|
|
g_signal_new ("add",
|
2004-07-30 03:22:32 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpModuleDBClass, add),
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__OBJECT,
|
|
|
|
G_TYPE_NONE, 1,
|
2002-10-23 22:55:07 +08:00
|
|
|
GIMP_TYPE_MODULE);
|
|
|
|
|
|
|
|
db_signals[REMOVE] =
|
|
|
|
g_signal_new ("remove",
|
2004-07-30 03:22:32 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpModuleDBClass, remove),
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__OBJECT,
|
|
|
|
G_TYPE_NONE, 1,
|
2002-10-23 22:55:07 +08:00
|
|
|
GIMP_TYPE_MODULE);
|
|
|
|
|
|
|
|
db_signals[MODULE_MODIFIED] =
|
2005-05-27 21:05:26 +08:00
|
|
|
g_signal_new ("module-modified",
|
2004-07-30 03:22:32 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpModuleDBClass, module_modified),
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__OBJECT,
|
|
|
|
G_TYPE_NONE, 1,
|
2002-10-23 22:55:07 +08:00
|
|
|
GIMP_TYPE_MODULE);
|
|
|
|
|
|
|
|
object_class->finalize = gimp_module_db_finalize;
|
|
|
|
|
|
|
|
klass->add = NULL;
|
|
|
|
klass->remove = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_module_db_init (GimpModuleDB *db)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-23 22:55:07 +08:00
|
|
|
db->modules = NULL;
|
|
|
|
db->load_inhibit = NULL;
|
|
|
|
db->verbose = FALSE;
|
|
|
|
}
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
static void
|
|
|
|
gimp_module_db_finalize (GObject *object)
|
|
|
|
{
|
2004-01-24 01:24:44 +08:00
|
|
|
GimpModuleDB *db = GIMP_MODULE_DB (object);
|
2002-10-23 22:55:07 +08:00
|
|
|
|
|
|
|
if (db->modules)
|
|
|
|
{
|
|
|
|
g_list_free (db->modules);
|
|
|
|
db->modules = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (db->load_inhibit)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-23 22:55:07 +08:00
|
|
|
g_free (db->load_inhibit);
|
|
|
|
db->load_inhibit = NULL;
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
2002-10-23 22:55:07 +08:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
2003-01-03 05:34:35 +08:00
|
|
|
/**
|
|
|
|
* gimp_module_db_new:
|
2003-02-07 05:17:12 +08:00
|
|
|
* @verbose: Pass %TRUE to enable debugging output.
|
2003-11-15 20:36:09 +08:00
|
|
|
*
|
2003-01-03 05:34:35 +08:00
|
|
|
* Creates a new #GimpModuleDB instance. The @verbose parameter will be
|
|
|
|
* passed to the created #GimpModule instances using gimp_module_new().
|
2003-11-15 20:36:09 +08:00
|
|
|
*
|
2003-01-03 05:34:35 +08:00
|
|
|
* Return value: The new #GimpModuleDB instance.
|
|
|
|
**/
|
2002-10-23 22:55:07 +08:00
|
|
|
GimpModuleDB *
|
|
|
|
gimp_module_db_new (gboolean verbose)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-23 22:55:07 +08:00
|
|
|
GimpModuleDB *db;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
db = g_object_new (GIMP_TYPE_MODULE_DB, NULL);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
db->verbose = verbose ? TRUE : FALSE;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
return db;
|
|
|
|
}
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
static gboolean
|
|
|
|
is_in_inhibit_list (const gchar *filename,
|
|
|
|
const gchar *inhibit_list)
|
|
|
|
{
|
|
|
|
gchar *p;
|
|
|
|
gint pathlen;
|
|
|
|
const gchar *start;
|
|
|
|
const gchar *end;
|
|
|
|
|
|
|
|
if (! inhibit_list || ! strlen (inhibit_list))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
p = strstr (inhibit_list, filename);
|
|
|
|
if (!p)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* 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 (filename);
|
|
|
|
|
|
|
|
if ((end - start) == pathlen)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
2003-01-03 05:34:35 +08:00
|
|
|
/**
|
|
|
|
* gimp_module_db_set_load_inhibit:
|
|
|
|
* @db: A #GimpModuleDB.
|
|
|
|
* @load_inhibit: A #G_SEARCHPATH_SEPARATOR delimited list of module
|
|
|
|
* filenames to exclude from auto-loading.
|
2003-11-15 20:36:09 +08:00
|
|
|
*
|
2003-01-03 05:34:35 +08:00
|
|
|
* Sets the @load_inhibit flag for all #GimpModule's which are kept
|
|
|
|
* by @db (using gimp_module_set_load_inhibit()).
|
|
|
|
**/
|
2001-10-19 01:27:36 +08:00
|
|
|
void
|
2002-10-23 22:55:07 +08:00
|
|
|
gimp_module_db_set_load_inhibit (GimpModuleDB *db,
|
|
|
|
const gchar *load_inhibit)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2004-01-24 01:24:44 +08:00
|
|
|
GList *list;
|
2002-10-23 22:55:07 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_MODULE_DB (db));
|
|
|
|
|
|
|
|
if (db->load_inhibit)
|
|
|
|
g_free (db->load_inhibit);
|
|
|
|
|
|
|
|
db->load_inhibit = g_strdup (load_inhibit);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
for (list = db->modules; list; list = g_list_next (list))
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2004-01-24 01:24:44 +08:00
|
|
|
GimpModule *module = list->data;
|
2002-10-23 22:55:07 +08:00
|
|
|
|
|
|
|
gimp_module_set_load_inhibit (module,
|
|
|
|
is_in_inhibit_list (module->filename,
|
|
|
|
load_inhibit));
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-03 05:34:35 +08:00
|
|
|
/**
|
|
|
|
* gimp_module_db_get_load_inhibit:
|
|
|
|
* @db: A #GimpModuleDB.
|
2003-11-15 20:36:09 +08:00
|
|
|
*
|
2003-01-03 05:34:35 +08:00
|
|
|
* Return the #G_SEARCHPATH_SEPARATOR selimited list of module filenames
|
|
|
|
* which are excluded from auto-loading.
|
2003-11-15 20:36:09 +08:00
|
|
|
*
|
2003-01-03 05:34:35 +08:00
|
|
|
* Return value: the @db's @load_inhibit string.
|
|
|
|
**/
|
2002-10-23 22:55:07 +08:00
|
|
|
const gchar *
|
|
|
|
gimp_module_db_get_load_inhibit (GimpModuleDB *db)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_MODULE_DB (db), NULL);
|
|
|
|
|
|
|
|
return db->load_inhibit;
|
|
|
|
}
|
|
|
|
|
2003-01-03 05:34:35 +08:00
|
|
|
/**
|
|
|
|
* gimp_module_db_load:
|
|
|
|
* @db: A #GimpModuleDB.
|
|
|
|
* @module_path: A #G_SEARCHPATH_SEPARATOR delimited list of directories
|
|
|
|
* to load modules from.
|
2003-11-15 20:36:09 +08:00
|
|
|
*
|
2003-01-03 05:34:35 +08:00
|
|
|
* Scans the directories contained in @module_path using
|
|
|
|
* gimp_datafiles_read_directories() and creates a #GimpModule
|
|
|
|
* instance for every loadable module contained in the directories.
|
|
|
|
**/
|
2002-10-23 22:55:07 +08:00
|
|
|
void
|
|
|
|
gimp_module_db_load (GimpModuleDB *db,
|
|
|
|
const gchar *module_path)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_MODULE_DB (db));
|
|
|
|
g_return_if_fail (module_path != NULL);
|
|
|
|
|
|
|
|
if (g_module_supported ())
|
|
|
|
gimp_datafiles_read_directories (module_path,
|
|
|
|
G_FILE_TEST_EXISTS,
|
2004-07-30 03:22:32 +08:00
|
|
|
gimp_module_db_module_initialize,
|
2002-10-23 22:55:07 +08:00
|
|
|
db);
|
|
|
|
|
|
|
|
#ifdef DUMP_DB
|
|
|
|
g_list_foreach (db->modules, gimp_module_db_dump_module, NULL);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2003-01-03 05:34:35 +08:00
|
|
|
/**
|
|
|
|
* gimp_module_db_refresh:
|
|
|
|
* @db: A #GimpModuleDB.
|
|
|
|
* @module_path: A #G_SEARCHPATH_SEPARATOR delimited list of directories
|
|
|
|
* to load modules from.
|
2003-11-15 20:36:09 +08:00
|
|
|
*
|
2003-01-03 05:34:35 +08:00
|
|
|
* Does the same as gimp_module_db_load(), plus removes all #GimpModule
|
|
|
|
* instances whose modules have been deleted from disk.
|
|
|
|
*
|
|
|
|
* Note that the #GimpModule's will just be removed from the internal
|
|
|
|
* list and not freed as this is not possible with #GTypeModule
|
|
|
|
* instances which actually implement types.
|
|
|
|
**/
|
2001-10-19 01:27:36 +08:00
|
|
|
void
|
2002-10-23 22:55:07 +08:00
|
|
|
gimp_module_db_refresh (GimpModuleDB *db,
|
|
|
|
const gchar *module_path)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
|
|
|
GList *kill_list = NULL;
|
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
g_return_if_fail (GIMP_IS_MODULE_DB (db));
|
|
|
|
g_return_if_fail (module_path != NULL);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
|
|
|
/* remove modules we don't have on disk anymore */
|
2002-10-23 22:55:07 +08:00
|
|
|
g_list_foreach (db->modules,
|
|
|
|
gimp_module_db_module_on_disk_func,
|
|
|
|
&kill_list);
|
2001-10-19 01:27:36 +08:00
|
|
|
g_list_foreach (kill_list,
|
2002-10-23 22:55:07 +08:00
|
|
|
gimp_module_db_module_remove_func,
|
|
|
|
db);
|
2001-10-19 01:27:36 +08:00
|
|
|
g_list_free (kill_list);
|
|
|
|
|
|
|
|
/* walk filesystem and add new things we find */
|
2002-10-23 22:55:07 +08:00
|
|
|
gimp_datafiles_read_directories (module_path,
|
|
|
|
G_FILE_TEST_EXISTS,
|
2004-07-30 03:22:32 +08:00
|
|
|
gimp_module_db_module_initialize,
|
2002-10-23 22:55:07 +08:00
|
|
|
db);
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-07-03 01:11:00 +08:00
|
|
|
gimp_module_db_module_initialize (const GimpDatafileData *file_data,
|
|
|
|
gpointer user_data)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2004-07-30 03:22:32 +08:00
|
|
|
GimpModuleDB *db = GIMP_MODULE_DB (user_data);
|
2002-10-23 22:55:07 +08:00
|
|
|
GimpModule *module;
|
|
|
|
gboolean load_inhibit;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2007-10-18 23:57:44 +08:00
|
|
|
if (! gimp_datafiles_check_extension (file_data->filename,
|
|
|
|
"." G_MODULE_SUFFIX))
|
2001-10-19 01:27:36 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* don't load if we already know about it */
|
2002-10-23 22:55:07 +08:00
|
|
|
if (gimp_module_db_module_find_by_path (db, file_data->filename))
|
2001-10-19 01:27:36 +08:00
|
|
|
return;
|
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
load_inhibit = is_in_inhibit_list (file_data->filename,
|
|
|
|
db->load_inhibit);
|
|
|
|
|
|
|
|
module = gimp_module_new (file_data->filename,
|
|
|
|
load_inhibit,
|
|
|
|
db->verbose);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (module, "modified",
|
2002-10-23 22:55:07 +08:00
|
|
|
G_CALLBACK (gimp_module_db_module_modified),
|
|
|
|
db);
|
|
|
|
|
|
|
|
db->modules = g_list_append (db->modules, module);
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_emit (db, db_signals[ADD], 0, module);
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
static GimpModule *
|
2002-10-23 22:55:07 +08:00
|
|
|
gimp_module_db_module_find_by_path (GimpModuleDB *db,
|
|
|
|
const char *fullpath)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2004-01-24 01:24:44 +08:00
|
|
|
GList *list;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
for (list = db->modules; list; list = g_list_next (list))
|
2002-10-20 18:14:17 +08:00
|
|
|
{
|
2004-01-24 01:24:44 +08:00
|
|
|
GimpModule *module = list->data;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
if (! strcmp (module->filename, fullpath))
|
|
|
|
return module;
|
2002-10-20 18:14:17 +08:00
|
|
|
}
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-20 18:14:17 +08:00
|
|
|
return NULL;
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DUMP_DB
|
|
|
|
static void
|
2003-11-15 20:36:09 +08:00
|
|
|
gimp_module_db_dump_module (gpointer data,
|
2002-10-23 22:55:07 +08:00
|
|
|
gpointer user_data)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2004-01-24 01:24:44 +08:00
|
|
|
GimpModule *module = data;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
g_print ("\n%s: %s\n",
|
2004-07-30 03:22:32 +08:00
|
|
|
gimp_filename_to_utf8 (module->filename),
|
2004-01-24 01:24:44 +08:00
|
|
|
gimp_module_state_name (module->state));
|
2002-10-20 20:40:30 +08:00
|
|
|
|
2004-01-24 01:24:44 +08:00
|
|
|
g_print (" module: %p lasterr: %s query: %p register: %p\n",
|
2004-07-30 03:22:32 +08:00
|
|
|
module->module,
|
2004-01-24 01:24:44 +08:00
|
|
|
module->last_module_error ? module->last_module_error : "NONE",
|
2004-07-30 03:22:32 +08:00
|
|
|
module->query_module,
|
|
|
|
module->register_module);
|
2002-10-20 20:40:30 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
if (i->info)
|
|
|
|
{
|
|
|
|
g_print (" purpose: %s\n"
|
|
|
|
" author: %s\n"
|
|
|
|
" version: %s\n"
|
|
|
|
" copyright: %s\n"
|
|
|
|
" date: %s\n",
|
2004-01-24 01:24:44 +08:00
|
|
|
module->info->purpose ? module->info->purpose : "NONE",
|
|
|
|
module->info->author ? module->info->author : "NONE",
|
|
|
|
module->info->version ? module->info->version : "NONE",
|
|
|
|
module->info->copyright ? module->info->copyright : "NONE",
|
|
|
|
module->info->date ? module->info->date : "NONE");
|
2002-10-21 22:15:02 +08:00
|
|
|
}
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void
|
2003-11-15 20:36:09 +08:00
|
|
|
gimp_module_db_module_on_disk_func (gpointer data,
|
2002-10-23 22:55:07 +08:00
|
|
|
gpointer user_data)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2004-07-30 03:22:32 +08:00
|
|
|
GimpModule *module = data;
|
|
|
|
GList **kill_list = user_data;
|
|
|
|
gboolean old_on_disk;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
old_on_disk = module->on_disk;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
module->on_disk = g_file_test (module->filename, G_FILE_TEST_IS_REGULAR);
|
2001-10-19 01:27:36 +08:00
|
|
|
|
|
|
|
/* if it's not on the disk, and it isn't in memory, mark it to be
|
|
|
|
* removed later.
|
|
|
|
*/
|
2002-10-21 22:15:02 +08:00
|
|
|
if (! module->on_disk && ! module->module)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2002-10-21 22:15:02 +08:00
|
|
|
*kill_list = g_list_append (*kill_list, module);
|
|
|
|
module = NULL;
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
2002-10-21 22:15:02 +08:00
|
|
|
if (module && module->on_disk != old_on_disk)
|
|
|
|
gimp_module_modified (module);
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-15 20:36:09 +08:00
|
|
|
gimp_module_db_module_remove_func (gpointer data,
|
2002-10-23 22:55:07 +08:00
|
|
|
gpointer user_data)
|
2001-10-19 01:27:36 +08:00
|
|
|
{
|
2004-07-30 03:22:32 +08:00
|
|
|
GimpModule *module = data;
|
|
|
|
GimpModuleDB *db = user_data;
|
2001-10-19 01:27:36 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_handlers_disconnect_by_func (module,
|
2002-10-23 22:55:07 +08:00
|
|
|
gimp_module_db_module_modified,
|
|
|
|
db);
|
|
|
|
|
2006-04-11 01:31:37 +08:00
|
|
|
db->modules = g_list_remove (db->modules, module);
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_emit (db, db_signals[REMOVE], 0, module);
|
2002-10-23 22:55:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_module_db_module_modified (GimpModule *module,
|
|
|
|
GimpModuleDB *db)
|
|
|
|
{
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_emit (db, db_signals[MODULE_MODIFIED], 0, module);
|
2001-10-19 01:27:36 +08:00
|
|
|
}
|