mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 09:23:24 +00:00
libgimp/gimp.h libgimp/gimpcolordisplay.h libgimp/gimpcolorselector.h
2000-05-28 Michael Natterer <mitch@gimp.org> * libgimp/gimp.h * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h * libgimp/gimpmatrix.h * libgimp/gimpmodule.h * libgimp/gimpunit_pdb.c: purely cosmetic stuff and added some typedefs to make the html documentation nicer. Moved the module documentation from the headers to the sgml files. * app/module_db.[ch]: The type of the "init" and "unload" functions has changed. Code cleanup. 2000-05-28 Michael Natterer <mitch@gimp.org> * libgimp/libgimp-decl.txt * libgimp/libgimp-docs.sgml * libgimp/libgimp-sections.txt * libgimp/tmpl/gimp.sgml * libgimp/tmpl/gimpcolorbutton.sgml * libgimp/tmpl/gimpcolordisplay.sgml * libgimp/tmpl/gimpcolorselector.sgml * libgimp/tmpl/gimpcolorspace.sgml * libgimp/tmpl/gimpcompat.sgml * libgimp/tmpl/gimpenums.sgml * libgimp/tmpl/gimpfeatures.sgml * libgimp/tmpl/gimplimits.sgml * libgimp/tmpl/gimpmath.sgml * libgimp/tmpl/gimpmodule.sgml * libgimp/tmpl/gimpparasite.sgml * libgimp/tmpl/gimpparasiteio.sgml * libgimp/tmpl/gimppixmap.sgml * libgimp/tmpl/gimpprotocol.sgml * libgimp/tmpl/gimpsignal.sgml * libgimp/tmpl/gimpui.sgml * libgimp/tmpl/gimpunit.sgml * libgimp/tmpl/gimputils.sgml * libgimp/tmpl/gimpvector.sgml * libgimp/tmpl/gimpwire.sgml * libgimp/tmpl/libgimp-unused.sgml: Moved the module documentation from the libgimp headers here, updates, cleanups.
This commit is contained in:
parent
f2e4a9a490
commit
2b775b6b8c
39 changed files with 1865 additions and 1579 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
2000-05-28 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* libgimp/gimp.h
|
||||||
|
* libgimp/gimpcolordisplay.h
|
||||||
|
* libgimp/gimpcolorselector.h
|
||||||
|
* libgimp/gimpmatrix.h
|
||||||
|
* libgimp/gimpmodule.h
|
||||||
|
* libgimp/gimpunit_pdb.c: purely cosmetic stuff and added some
|
||||||
|
typedefs to make the html documentation nicer. Moved the module
|
||||||
|
documentation from the headers to the sgml files.
|
||||||
|
|
||||||
|
* app/module_db.[ch]: The type of the "init" and "unload" functions
|
||||||
|
has changed. Code cleanup.
|
||||||
|
|
||||||
2000-05-27 Sven Neumann <sven@gimp.org>
|
2000-05-27 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/color_select.c: use spinbuttons in the GIMP
|
* app/color_select.c: use spinbuttons in the GIMP
|
||||||
|
|
|
@ -41,12 +41,15 @@
|
||||||
|
|
||||||
#include "libgimp/gimpenv.h"
|
#include "libgimp/gimpenv.h"
|
||||||
#include "libgimp/gimpmodule.h"
|
#include "libgimp/gimpmodule.h"
|
||||||
|
|
||||||
#include "libgimp/gimpintl.h"
|
#include "libgimp/gimpintl.h"
|
||||||
|
|
||||||
/* export this to gimprc.c */
|
|
||||||
char *module_db_load_inhibit = NULL;
|
|
||||||
|
|
||||||
typedef enum {
|
/* export this to gimprc.c */
|
||||||
|
gchar *module_db_load_inhibit = NULL;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
ST_MODULE_ERROR, /* missing module_load function or other error */
|
ST_MODULE_ERROR, /* missing module_load function or other error */
|
||||||
ST_LOADED_OK, /* happy and running (normal state of affairs) */
|
ST_LOADED_OK, /* happy and running (normal state of affairs) */
|
||||||
ST_LOAD_FAILED, /* module_load returned GIMP_MODULE_UNLOAD */
|
ST_LOAD_FAILED, /* module_load returned GIMP_MODULE_UNLOAD */
|
||||||
|
@ -54,7 +57,8 @@ typedef enum {
|
||||||
ST_UNLOADED_OK /* callback arrived, module not in memory anymore */
|
ST_UNLOADED_OK /* callback arrived, module not in memory anymore */
|
||||||
} module_state;
|
} module_state;
|
||||||
|
|
||||||
static const char * const statename[] = {
|
static const gchar * const statename[] =
|
||||||
|
{
|
||||||
N_("Module error"),
|
N_("Module error"),
|
||||||
N_("Loaded OK"),
|
N_("Loaded OK"),
|
||||||
N_("Load failed"),
|
N_("Load failed"),
|
||||||
|
@ -63,68 +67,76 @@ static const char * const statename[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
extern void gimp_color_selector_register();
|
extern void gimp_color_selector_register ();
|
||||||
extern void gimp_color_selector_unregister();
|
extern void gimp_color_selector_unregister ();
|
||||||
extern void gimp_color_display_register();
|
extern void gimp_color_display_register ();
|
||||||
extern void gimp_color_display_unregister();
|
extern void gimp_color_display_unregister ();
|
||||||
extern void dialog_register();
|
extern void dialog_register ();
|
||||||
extern void dialog_unregister();
|
extern void dialog_unregister ();
|
||||||
|
|
||||||
static struct main_funcs_struc {
|
static struct main_funcs_struc
|
||||||
|
{
|
||||||
gchar *name;
|
gchar *name;
|
||||||
void (*func)();
|
void (*func) ();
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_main_funcs[] = {
|
gimp_main_funcs[] =
|
||||||
{ "gimp_color_selector_register", gimp_color_selector_register },
|
{
|
||||||
|
{ "gimp_color_selector_register", gimp_color_selector_register },
|
||||||
{ "gimp_color_selector_unregister", gimp_color_selector_unregister },
|
{ "gimp_color_selector_unregister", gimp_color_selector_unregister },
|
||||||
{ "gimp_color_display_register", gimp_color_display_register },
|
{ "gimp_color_display_register", gimp_color_display_register },
|
||||||
{ "gimp_color_display_unregister", gimp_color_display_unregister },
|
{ "gimp_color_display_unregister", gimp_color_display_unregister },
|
||||||
{ "dialog_register", dialog_register },
|
{ "dialog_register", dialog_register },
|
||||||
{ "dialog_unregister", dialog_unregister },
|
{ "dialog_unregister", dialog_unregister },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* one of these objects is kept per-module */
|
/* one of these objects is kept per-module */
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
GtkObject object;
|
GtkObject object;
|
||||||
|
|
||||||
gchar *fullpath; /* path to the module */
|
gchar *fullpath; /* path to the module */
|
||||||
module_state state; /* what's happened to the module */
|
module_state state; /* what's happened to the module */
|
||||||
gboolean ondisk; /* TRUE if file still exists */
|
gboolean ondisk; /* TRUE if file still exists */
|
||||||
gboolean load_inhibit; /* user requests not to load at boot time */
|
gboolean load_inhibit; /* user requests not to load at boot time */
|
||||||
gint refs; /* how many time we're running in the module */
|
gint refs; /* how many time we're running in the module */
|
||||||
|
|
||||||
/* stuff from now on may be NULL depending on the state the module is in */
|
/* stuff from now on may be NULL depending on the state the module is in */
|
||||||
GimpModuleInfo *info; /* returned values from module_init */
|
GimpModuleInfo *info; /* returned values from module_init */
|
||||||
GModule *module; /* handle on the module */
|
GModule *module; /* handle on the module */
|
||||||
gchar *last_module_error;
|
gchar *last_module_error;
|
||||||
GimpModuleInitFunc *init;
|
|
||||||
GimpModuleUnloadFunc *unload;
|
GimpModuleInitFunc init;
|
||||||
} module_info;
|
GimpModuleUnloadFunc unload;
|
||||||
|
} ModuleInfo;
|
||||||
|
|
||||||
|
|
||||||
static guint module_info_get_type (void);
|
static guint module_info_get_type (void);
|
||||||
|
|
||||||
#define MODULE_INFO_TYPE module_info_get_type()
|
#define MODULE_INFO_TYPE module_info_get_type()
|
||||||
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, module_info)
|
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo)
|
||||||
#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)
|
#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)
|
||||||
|
|
||||||
|
|
||||||
#define NUM_INFO_LINES 7
|
#define NUM_INFO_LINES 7
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
GtkWidget *table;
|
{
|
||||||
GtkWidget *label[NUM_INFO_LINES];
|
GtkWidget *table;
|
||||||
GtkWidget *button_label;
|
GtkWidget *label[NUM_INFO_LINES];
|
||||||
module_info *last_update;
|
GtkWidget *button_label;
|
||||||
GtkWidget *button;
|
ModuleInfo *last_update;
|
||||||
GtkWidget *list;
|
GtkWidget *button;
|
||||||
GtkWidget *load_inhibit_check;
|
GtkWidget *list;
|
||||||
} browser_st;
|
GtkWidget *load_inhibit_check;
|
||||||
|
} BrowserState;
|
||||||
|
|
||||||
/* global set of module_info pointers */
|
/* global set of module_info pointers */
|
||||||
static GimpSet *modules;
|
static GimpSet *modules;
|
||||||
static GimpSetHandlerId modules_handler;
|
static GimpSetHandlerId modules_handler;
|
||||||
|
|
||||||
/* If the inhibit state of any modules changes, we might need to
|
/* If the inhibit state of any modules changes, we might need to
|
||||||
* re-write the modulerc. */
|
* re-write the modulerc. */
|
||||||
|
@ -146,26 +158,43 @@ static gboolean need_to_rewrite_modulerc = FALSE;
|
||||||
|
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
static void module_initialize (char *filename);
|
static void module_initialize (gchar *filename);
|
||||||
static void mod_load (module_info *mod, gboolean verbose);
|
static void mod_load (ModuleInfo *mod,
|
||||||
static void mod_unload (module_info *mod, gboolean verbose);
|
gboolean verbose);
|
||||||
static module_info *module_find_by_path (const char *fullpath);
|
static void mod_unload (ModuleInfo *mod,
|
||||||
#ifdef DUMP_DB
|
gboolean verbose);
|
||||||
static void print_module_info (gpointer data, gpointer user_data);
|
static ModuleInfo * module_find_by_path (const gchar *fullpath);
|
||||||
#endif
|
|
||||||
static void browser_popdown_callback (GtkWidget *w, gpointer client_data);
|
|
||||||
static void browser_destroy_callback (GtkWidget *w, gpointer client_data);
|
|
||||||
static void browser_info_update (module_info *, browser_st *);
|
|
||||||
static void browser_info_add (GimpSet *, module_info *, browser_st *);
|
|
||||||
static void browser_info_remove (GimpSet *, module_info *, browser_st *);
|
|
||||||
static void browser_info_init (browser_st *st, GtkWidget *table);
|
|
||||||
static void browser_select_callback (GtkWidget *widget, GtkWidget *child);
|
|
||||||
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 gimp_module_ref (module_info *mod);
|
#ifdef DUMP_DB
|
||||||
static void gimp_module_unref (module_info *mod);
|
static void print_module_info (gpointer data,
|
||||||
|
gpointer user_data);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void browser_popdown_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static void browser_destroy_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static void browser_info_update (ModuleInfo *mod,
|
||||||
|
BrowserState *st);
|
||||||
|
static void browser_info_add (GimpSet *set,
|
||||||
|
ModuleInfo *mod,
|
||||||
|
BrowserState *st);
|
||||||
|
static void browser_info_remove (GimpSet *set,
|
||||||
|
ModuleInfo *mod,
|
||||||
|
BrowserState *st);
|
||||||
|
static void browser_info_init (BrowserState *st,
|
||||||
|
GtkWidget *table);
|
||||||
|
static void browser_select_callback (GtkWidget *widget,
|
||||||
|
GtkWidget *child);
|
||||||
|
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 gimp_module_ref (ModuleInfo *mod);
|
||||||
|
static void gimp_module_unref (ModuleInfo *mod);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,7 +204,7 @@ static void gimp_module_unref (module_info *mod);
|
||||||
void
|
void
|
||||||
module_db_init (void)
|
module_db_init (void)
|
||||||
{
|
{
|
||||||
char *filename;
|
gchar *filename;
|
||||||
|
|
||||||
/* load the modulerc file */
|
/* load the modulerc file */
|
||||||
filename = gimp_personal_rc_file ("modulerc");
|
filename = gimp_personal_rc_file ("modulerc");
|
||||||
|
@ -198,7 +227,7 @@ static void
|
||||||
free_a_single_module (gpointer data,
|
free_a_single_module (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
|
|
||||||
if (mod->module && mod->unload && mod->state == ST_LOADED_OK)
|
if (mod->module && mod->unload && mod->state == ST_LOADED_OK)
|
||||||
{
|
{
|
||||||
|
@ -210,8 +239,8 @@ static void
|
||||||
add_to_inhibit_string (gpointer data,
|
add_to_inhibit_string (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
GString *str = user_data;
|
GString *str = user_data;
|
||||||
|
|
||||||
if (mod->load_inhibit)
|
if (mod->load_inhibit)
|
||||||
{
|
{
|
||||||
|
@ -224,11 +253,11 @@ add_to_inhibit_string (gpointer data,
|
||||||
static gboolean
|
static gboolean
|
||||||
module_db_write_modulerc (void)
|
module_db_write_modulerc (void)
|
||||||
{
|
{
|
||||||
GString *str;
|
GString *str;
|
||||||
gchar *p;
|
gchar *p;
|
||||||
char *filename;
|
gchar *filename;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
gboolean saved = FALSE;
|
gboolean saved = FALSE;
|
||||||
|
|
||||||
str = g_string_new (NULL);
|
str = g_string_new (NULL);
|
||||||
gimp_set_foreach (modules, add_to_inhibit_string, str);
|
gimp_set_foreach (modules, add_to_inhibit_string, str);
|
||||||
|
@ -256,12 +285,12 @@ void
|
||||||
module_db_free (void)
|
module_db_free (void)
|
||||||
{
|
{
|
||||||
if (need_to_rewrite_modulerc)
|
if (need_to_rewrite_modulerc)
|
||||||
{
|
{
|
||||||
if (module_db_write_modulerc ())
|
if (module_db_write_modulerc ())
|
||||||
{
|
{
|
||||||
need_to_rewrite_modulerc = FALSE;
|
need_to_rewrite_modulerc = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gimp_set_foreach (modules, free_a_single_module, NULL);
|
gimp_set_foreach (modules, free_a_single_module, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +303,7 @@ module_db_browser_new (void)
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *listbox;
|
GtkWidget *listbox;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
browser_st *st;
|
BrowserState *st;
|
||||||
|
|
||||||
shell = gimp_dialog_new (_("Module DB"), "module_db_dialog",
|
shell = gimp_dialog_new (_("Module DB"), "module_db_dialog",
|
||||||
gimp_standard_help_func,
|
gimp_standard_help_func,
|
||||||
|
@ -300,7 +329,7 @@ module_db_browser_new (void)
|
||||||
gtk_widget_set_usize (listbox, 125, 100);
|
gtk_widget_set_usize (listbox, 125, 100);
|
||||||
gtk_widget_show (listbox);
|
gtk_widget_show (listbox);
|
||||||
|
|
||||||
st = g_new0 (browser_st, 1);
|
st = g_new0 (BrowserState, 1);
|
||||||
|
|
||||||
st->list = gtk_list_new ();
|
st->list = gtk_list_new ();
|
||||||
gtk_list_set_selection_mode (GTK_LIST (st->list), GTK_SELECTION_BROWSE);
|
gtk_list_set_selection_mode (GTK_LIST (st->list), GTK_SELECTION_BROWSE);
|
||||||
|
@ -361,14 +390,16 @@ module_db_browser_new (void)
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
/* module_info object glue */
|
/* ModuleInfo object glue */
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
GtkObjectClass parent_class;
|
GtkObjectClass parent_class;
|
||||||
} module_infoClass;
|
} ModuleInfoClass;
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
MODIFIED,
|
MODIFIED,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
@ -378,7 +409,7 @@ static guint module_info_signals[LAST_SIGNAL];
|
||||||
static void
|
static void
|
||||||
module_info_destroy (GtkObject *object)
|
module_info_destroy (GtkObject *object)
|
||||||
{
|
{
|
||||||
module_info *mod = MODULE_INFO (object);
|
ModuleInfo *mod = MODULE_INFO (object);
|
||||||
|
|
||||||
/* if this trips, then we're onto some serious lossage in a moment */
|
/* if this trips, then we're onto some serious lossage in a moment */
|
||||||
g_return_if_fail (mod->refs == 0);
|
g_return_if_fail (mod->refs == 0);
|
||||||
|
@ -389,25 +420,25 @@ module_info_destroy (GtkObject *object)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_info_class_init (module_infoClass *klass)
|
module_info_class_init (ModuleInfoClass *klass)
|
||||||
{
|
{
|
||||||
GtkObjectClass *object_class;
|
GtkObjectClass *object_class;
|
||||||
GtkType type;
|
GtkType type;
|
||||||
|
|
||||||
object_class = GTK_OBJECT_CLASS(klass);
|
object_class = GTK_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
type = object_class->type;
|
type = object_class->type;
|
||||||
|
|
||||||
object_class->destroy = module_info_destroy;
|
object_class->destroy = module_info_destroy;
|
||||||
|
|
||||||
module_info_signals[MODIFIED] =
|
module_info_signals[MODIFIED] =
|
||||||
gimp_signal_new ("modified", 0, type, 0, gimp_sigtype_void);
|
gimp_signal_new ("modified", 0, type, 0, gimp_sigtype_void);
|
||||||
|
|
||||||
gtk_object_class_add_signals(object_class, module_info_signals, LAST_SIGNAL);
|
gtk_object_class_add_signals (object_class, module_info_signals, LAST_SIGNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_info_init (module_info *mod)
|
module_info_init (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
/* don't need to do anything */
|
/* don't need to do anything */
|
||||||
}
|
}
|
||||||
|
@ -421,9 +452,9 @@ module_info_get_type (void)
|
||||||
{
|
{
|
||||||
static const GtkTypeInfo module_info_info =
|
static const GtkTypeInfo module_info_info =
|
||||||
{
|
{
|
||||||
"module_info",
|
"ModuleInfo",
|
||||||
sizeof (module_info),
|
sizeof (ModuleInfo),
|
||||||
sizeof (module_infoClass),
|
sizeof (ModuleInfoClass),
|
||||||
(GtkClassInitFunc) module_info_class_init,
|
(GtkClassInitFunc) module_info_class_init,
|
||||||
(GtkObjectInitFunc) module_info_init,
|
(GtkObjectInitFunc) module_info_init,
|
||||||
/* reserved_1 */ NULL,
|
/* reserved_1 */ NULL,
|
||||||
|
@ -431,8 +462,8 @@ module_info_get_type (void)
|
||||||
(GtkClassInitFunc) NULL,
|
(GtkClassInitFunc) NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
module_info_type = gtk_type_unique (gtk_object_get_type(),
|
module_info_type =
|
||||||
&module_info_info);
|
gtk_type_unique (gtk_object_get_type (), &module_info_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
return module_info_type;
|
return module_info_type;
|
||||||
|
@ -441,19 +472,19 @@ module_info_get_type (void)
|
||||||
/* exported API: */
|
/* exported API: */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_info_modified (module_info *mod)
|
module_info_modified (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
gtk_signal_emit (GTK_OBJECT (mod), module_info_signals[MODIFIED]);
|
gtk_signal_emit (GTK_OBJECT (mod), module_info_signals[MODIFIED]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static module_info *
|
static ModuleInfo *
|
||||||
module_info_new (void)
|
module_info_new (void)
|
||||||
{
|
{
|
||||||
return MODULE_INFO (gtk_type_new (module_info_get_type ()));
|
return MODULE_INFO (gtk_type_new (module_info_get_type ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_info_free (module_info *mod)
|
module_info_free (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
gtk_object_unref (GTK_OBJECT (mod));
|
gtk_object_unref (GTK_OBJECT (mod));
|
||||||
}
|
}
|
||||||
|
@ -465,10 +496,10 @@ module_info_free (module_info *mod)
|
||||||
|
|
||||||
/* name must be of the form lib*.so (Unix) or *.dll (Win32) */
|
/* name must be of the form lib*.so (Unix) or *.dll (Win32) */
|
||||||
static gboolean
|
static gboolean
|
||||||
valid_module_name (const char *filename)
|
valid_module_name (const gchar *filename)
|
||||||
{
|
{
|
||||||
const char *basename;
|
const gchar *basename;
|
||||||
int len;
|
gint len;
|
||||||
|
|
||||||
basename = g_basename (filename);
|
basename = g_basename (filename);
|
||||||
|
|
||||||
|
@ -496,12 +527,13 @@ valid_module_name (const char *filename)
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
module_inhibited (const char *fullpath,
|
module_inhibited (const gchar *fullpath,
|
||||||
const char *inhibit_list)
|
const gchar *inhibit_list)
|
||||||
{
|
{
|
||||||
char *p;
|
gchar *p;
|
||||||
int pathlen;
|
gint pathlen;
|
||||||
const char *start, *end;
|
const gchar *start;
|
||||||
|
const gchar *end;
|
||||||
|
|
||||||
/* common case optimisation: the list is empty */
|
/* common case optimisation: the list is empty */
|
||||||
if (!inhibit_list || *inhibit_list == '\000')
|
if (!inhibit_list || *inhibit_list == '\000')
|
||||||
|
@ -531,9 +563,9 @@ module_inhibited (const char *fullpath,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_initialize (char *filename)
|
module_initialize (gchar *filename)
|
||||||
{
|
{
|
||||||
module_info *mod;
|
ModuleInfo *mod;
|
||||||
|
|
||||||
if (!valid_module_name (filename))
|
if (!valid_module_name (filename))
|
||||||
return;
|
return;
|
||||||
|
@ -581,8 +613,8 @@ module_initialize (char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mod_load (module_info *mod,
|
mod_load (ModuleInfo *mod,
|
||||||
gboolean verbose)
|
gboolean verbose)
|
||||||
{
|
{
|
||||||
gpointer symbol;
|
gpointer symbol;
|
||||||
|
|
||||||
|
@ -632,12 +664,12 @@ mod_load (module_info *mod,
|
||||||
mod->info = NULL;
|
mod->info = NULL;
|
||||||
gimp_module_ref (mod); /* loaded modules are assumed to have a ref of 1 */
|
gimp_module_ref (mod); /* loaded modules are assumed to have a ref of 1 */
|
||||||
if (mod->init (&mod->info) == GIMP_MODULE_UNLOAD)
|
if (mod->init (&mod->info) == GIMP_MODULE_UNLOAD)
|
||||||
{
|
{
|
||||||
mod->state = ST_LOAD_FAILED;
|
mod->state = ST_LOAD_FAILED;
|
||||||
gimp_module_unref (mod);
|
gimp_module_unref (mod);
|
||||||
mod->info = NULL;
|
mod->info = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* module is now happy */
|
/* module is now happy */
|
||||||
mod->state = ST_LOADED_OK;
|
mod->state = ST_LOADED_OK;
|
||||||
|
@ -648,14 +680,13 @@ mod_load (module_info *mod,
|
||||||
mod->unload = symbol;
|
mod->unload = symbol;
|
||||||
else
|
else
|
||||||
mod->unload = NULL;
|
mod->unload = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mod_unload_completed_callback (void *data)
|
mod_unload_completed_callback (void *data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
|
|
||||||
g_return_if_fail (mod->state == ST_UNLOAD_REQUESTED);
|
g_return_if_fail (mod->state == ST_UNLOAD_REQUESTED);
|
||||||
|
|
||||||
|
@ -672,8 +703,8 @@ mod_unload_completed_callback (void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mod_unload (module_info *mod,
|
mod_unload (ModuleInfo *mod,
|
||||||
gboolean verbose)
|
gboolean verbose)
|
||||||
{
|
{
|
||||||
g_return_if_fail (mod->module != NULL);
|
g_return_if_fail (mod->module != NULL);
|
||||||
g_return_if_fail (mod->unload != NULL);
|
g_return_if_fail (mod->unload != NULL);
|
||||||
|
@ -694,31 +725,30 @@ mod_unload (module_info *mod,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DUMP_DB
|
#ifdef DUMP_DB
|
||||||
static void
|
static void
|
||||||
print_module_info (gpointer data,
|
print_module_info (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *i = data;
|
ModuleInfo *i = data;
|
||||||
|
|
||||||
printf ("\n%s: %s\n",
|
g_print ("\n%s: %s\n",
|
||||||
i->fullpath, statename[i->state]);
|
i->fullpath, statename[i->state]);
|
||||||
printf (" module:%p lasterr:%s init:%p unload:%p\n",
|
g_print (" module:%p lasterr:%s init:%p unload:%p\n",
|
||||||
i->module, i->last_module_error? i->last_module_error : "NONE",
|
i->module, i->last_module_error? i->last_module_error : "NONE",
|
||||||
i->init, i->unload);
|
i->init, i->unload);
|
||||||
if (i->info)
|
if (i->info)
|
||||||
{
|
{
|
||||||
printf (" shutdown_data: %p\n"
|
g_print (" shutdown_data: %p\n"
|
||||||
" purpose: %s\n"
|
" purpose: %s\n"
|
||||||
" author: %s\n"
|
" author: %s\n"
|
||||||
" version: %s\n"
|
" version: %s\n"
|
||||||
" copyright: %s\n"
|
" copyright: %s\n"
|
||||||
" date: %s\n",
|
" date: %s\n",
|
||||||
i->info->shutdown_data,
|
i->info->shutdown_data,
|
||||||
i->info->purpose, i->info->author, i->info->version,
|
i->info->purpose, i->info->author, i->info->version,
|
||||||
i->info->copyright, i->info->date);
|
i->info->copyright, i->info->date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -728,31 +758,31 @@ print_module_info (gpointer data,
|
||||||
/* UI functions */
|
/* UI functions */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_popdown_callback (GtkWidget *w,
|
browser_popdown_callback (GtkWidget *widget,
|
||||||
gpointer client_data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gtk_widget_destroy (GTK_WIDGET (client_data));
|
gtk_widget_destroy (GTK_WIDGET (data));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_destroy_callback (GtkWidget *w,
|
browser_destroy_callback (GtkWidget *widget,
|
||||||
gpointer client_data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), client_data);
|
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), data);
|
||||||
gimp_set_remove_handler (modules, modules_handler);
|
gimp_set_remove_handler (modules, modules_handler);
|
||||||
g_free (client_data);
|
g_free (data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_load_inhibit_callback (GtkWidget *w,
|
browser_load_inhibit_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
browser_st *st = data;
|
BrowserState *st = data;
|
||||||
gboolean new_value;
|
gboolean new_value;
|
||||||
|
|
||||||
g_return_if_fail (st->last_update != NULL);
|
g_return_if_fail (st->last_update != NULL);
|
||||||
|
|
||||||
new_value = ! GTK_TOGGLE_BUTTON (w)->active;
|
new_value = ! GTK_TOGGLE_BUTTON (widget)->active;
|
||||||
|
|
||||||
if (new_value == st->last_update->load_inhibit)
|
if (new_value == st->last_update->load_inhibit)
|
||||||
return;
|
return;
|
||||||
|
@ -764,59 +794,58 @@ browser_load_inhibit_callback (GtkWidget *w,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_info_update (module_info *mod,
|
browser_info_update (ModuleInfo *mod,
|
||||||
browser_st *st)
|
BrowserState *st)
|
||||||
{
|
{
|
||||||
int i;
|
gint i;
|
||||||
const char *text[NUM_INFO_LINES - 1];
|
const gchar *text[NUM_INFO_LINES - 1];
|
||||||
char *status;
|
gchar *status;
|
||||||
|
|
||||||
/* only update the info if we're actually showing it */
|
/* only update the info if we're actually showing it */
|
||||||
if (mod != st->last_update)
|
if (mod != st->last_update)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!mod)
|
if (!mod)
|
||||||
{
|
{
|
||||||
for (i=0; i < NUM_INFO_LINES; i++)
|
for (i=0; i < NUM_INFO_LINES; i++)
|
||||||
gtk_label_set_text (GTK_LABEL (st->label[i]), "");
|
gtk_label_set_text (GTK_LABEL (st->label[i]), "");
|
||||||
gtk_label_set_text (GTK_LABEL(st->button_label), _("<No modules>"));
|
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->button), FALSE);
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), FALSE);
|
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mod->info)
|
if (mod->info)
|
||||||
{
|
{
|
||||||
text[0] = mod->info->purpose;
|
text[0] = mod->info->purpose;
|
||||||
text[1] = mod->info->author;
|
text[1] = mod->info->author;
|
||||||
text[2] = mod->info->version;
|
text[2] = mod->info->version;
|
||||||
text[3] = mod->info->copyright;
|
text[3] = mod->info->copyright;
|
||||||
text[4] = mod->info->date;
|
text[4] = mod->info->date;
|
||||||
text[5] = mod->ondisk? _("on disk") : _("only in memory");
|
text[5] = mod->ondisk? _("on disk") : _("only in memory");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
text[0] = "--";
|
text[0] = "--";
|
||||||
text[1] = "--";
|
text[1] = "--";
|
||||||
text[2] = "--";
|
text[2] = "--";
|
||||||
text[3] = "--";
|
text[3] = "--";
|
||||||
text[4] = "--";
|
text[4] = "--";
|
||||||
text[5] = mod->ondisk? _("on disk") : _("nowhere (click 'refresh')");
|
text[5] = mod->ondisk? _("on disk") : _("nowhere (click 'refresh')");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (mod->state == ST_MODULE_ERROR && mod->last_module_error)
|
if (mod->state == ST_MODULE_ERROR && mod->last_module_error)
|
||||||
status = g_strdup_printf ("%s (%s)", gettext (statename[mod->state]),
|
status = g_strdup_printf ("%s (%s)", gettext (statename[mod->state]),
|
||||||
mod->last_module_error);
|
mod->last_module_error);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = g_strdup (gettext (statename[mod->state]));
|
status = g_strdup (gettext (statename[mod->state]));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i < NUM_INFO_LINES - 1; i++)
|
for (i=0; i < NUM_INFO_LINES - 1; i++)
|
||||||
{
|
{
|
||||||
gtk_label_set_text (GTK_LABEL (st->label[i]), gettext (text[i]));
|
gtk_label_set_text (GTK_LABEL (st->label[i]), gettext (text[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_label_set_text (GTK_LABEL (st->label[NUM_INFO_LINES-1]), status);
|
gtk_label_set_text (GTK_LABEL (st->label[NUM_INFO_LINES-1]), status);
|
||||||
|
|
||||||
|
@ -827,33 +856,36 @@ browser_info_update (module_info *mod,
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), TRUE);
|
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), TRUE);
|
||||||
|
|
||||||
/* work out what the button should do (if anything) */
|
/* work out what the button should do (if anything) */
|
||||||
switch (mod->state) {
|
switch (mod->state)
|
||||||
case ST_MODULE_ERROR:
|
{
|
||||||
case ST_LOAD_FAILED:
|
case ST_MODULE_ERROR:
|
||||||
case ST_UNLOADED_OK:
|
case ST_LOAD_FAILED:
|
||||||
gtk_label_set_text (GTK_LABEL(st->button_label), _("Load"));
|
case ST_UNLOADED_OK:
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->button), mod->ondisk);
|
gtk_label_set_text (GTK_LABEL(st->button_label), _("Load"));
|
||||||
break;
|
gtk_widget_set_sensitive (GTK_WIDGET (st->button), mod->ondisk);
|
||||||
|
break;
|
||||||
|
|
||||||
case ST_UNLOAD_REQUESTED:
|
case ST_UNLOAD_REQUESTED:
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->button), FALSE);
|
gtk_widget_set_sensitive (GTK_WIDGET (st->button), FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_LOADED_OK:
|
case ST_LOADED_OK:
|
||||||
gtk_label_set_text (GTK_LABEL(st->button_label), _("Unload"));
|
gtk_label_set_text (GTK_LABEL(st->button_label), _("Unload"));
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->button),
|
gtk_widget_set_sensitive (GTK_WIDGET (st->button),
|
||||||
mod->unload? TRUE : FALSE);
|
mod->unload? TRUE : FALSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_info_init (browser_st *st,
|
browser_info_init (BrowserState *st,
|
||||||
GtkWidget *table)
|
GtkWidget *table)
|
||||||
{
|
{
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
int i;
|
gint i;
|
||||||
char *text[] = {
|
|
||||||
|
gchar *text[] =
|
||||||
|
{
|
||||||
N_("Purpose:"),
|
N_("Purpose:"),
|
||||||
N_("Author:"),
|
N_("Author:"),
|
||||||
N_("Version:"),
|
N_("Version:"),
|
||||||
|
@ -864,22 +896,22 @@ browser_info_init (browser_st *st,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i=0; i < sizeof(text) / sizeof(char *); i++)
|
for (i=0; i < sizeof(text) / sizeof(char *); i++)
|
||||||
{
|
{
|
||||||
label = gtk_label_new (gettext (text[i]));
|
label = gtk_label_new (gettext (text[i]));
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
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_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
st->label[i] = gtk_label_new ("");
|
st->label[i] = gtk_label_new ("");
|
||||||
gtk_misc_set_alignment (GTK_MISC (st->label[i]), 0.0, 0.5);
|
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,
|
gtk_table_attach (GTK_TABLE (st->table), st->label[i], 1, 2, i, i+1,
|
||||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
|
||||||
gtk_widget_show (st->label[i]);
|
gtk_widget_show (st->label[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
st->load_inhibit_check =
|
st->load_inhibit_check =
|
||||||
gtk_check_button_new_with_label (_("Autoload during startup"));
|
gtk_check_button_new_with_label (_("Autoload during startup"));
|
||||||
gtk_widget_show (st->load_inhibit_check);
|
gtk_widget_show (st->load_inhibit_check);
|
||||||
gtk_table_attach (GTK_TABLE (table), st->load_inhibit_check,
|
gtk_table_attach (GTK_TABLE (table), st->load_inhibit_check,
|
||||||
0, 2, i, i+1,
|
0, 2, i, i+1,
|
||||||
|
@ -892,8 +924,8 @@ static void
|
||||||
browser_select_callback (GtkWidget *widget,
|
browser_select_callback (GtkWidget *widget,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
module_info *i;
|
ModuleInfo *i;
|
||||||
browser_st *st;
|
BrowserState *st;
|
||||||
|
|
||||||
i = gtk_object_get_user_data (GTK_OBJECT (child));
|
i = gtk_object_get_user_data (GTK_OBJECT (child));
|
||||||
st = gtk_object_get_user_data (GTK_OBJECT (widget));
|
st = gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||||
|
@ -911,7 +943,7 @@ static void
|
||||||
browser_load_unload_callback (GtkWidget *widget,
|
browser_load_unload_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
browser_st *st = data;
|
BrowserState *st = data;
|
||||||
|
|
||||||
if (st->last_update->state == ST_LOADED_OK)
|
if (st->last_update->state == ST_LOADED_OK)
|
||||||
mod_unload (st->last_update, FALSE);
|
mod_unload (st->last_update, FALSE);
|
||||||
|
@ -926,9 +958,9 @@ static void
|
||||||
make_list_item (gpointer data,
|
make_list_item (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *info = data;
|
ModuleInfo *info = data;
|
||||||
browser_st *st = user_data;
|
BrowserState *st = user_data;
|
||||||
GtkWidget *list_item;
|
GtkWidget *list_item;
|
||||||
|
|
||||||
if (!st->last_update)
|
if (!st->last_update)
|
||||||
st->last_update = info;
|
st->last_update = info;
|
||||||
|
@ -943,22 +975,22 @@ make_list_item (gpointer data,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_info_add (GimpSet *set,
|
browser_info_add (GimpSet *set,
|
||||||
module_info *mod,
|
ModuleInfo *mod,
|
||||||
browser_st *st)
|
BrowserState *st)
|
||||||
{
|
{
|
||||||
make_list_item (mod, st);
|
make_list_item (mod, st);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_info_remove (GimpSet *set,
|
browser_info_remove (GimpSet *set,
|
||||||
module_info *mod,
|
ModuleInfo *mod,
|
||||||
browser_st *st)
|
BrowserState *st)
|
||||||
{
|
{
|
||||||
GList *dlist, *free_list;
|
GList *dlist, *free_list;
|
||||||
GtkWidget *list_item;
|
GtkWidget *list_item;
|
||||||
module_info *i;
|
ModuleInfo *i;
|
||||||
|
|
||||||
dlist = gtk_container_children (GTK_CONTAINER (st->list));
|
dlist = gtk_container_children (GTK_CONTAINER (st->list));
|
||||||
free_list = dlist;
|
free_list = dlist;
|
||||||
|
@ -990,10 +1022,10 @@ static void
|
||||||
module_db_module_ondisk (gpointer data,
|
module_db_module_ondisk (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
int ret;
|
gint ret;
|
||||||
int old_ondisk = mod->ondisk;
|
gint old_ondisk = mod->ondisk;
|
||||||
GSList **kill_list = user_data;
|
GSList **kill_list = user_data;
|
||||||
|
|
||||||
ret = stat (mod->fullpath, &statbuf);
|
ret = stat (mod->fullpath, &statbuf);
|
||||||
|
@ -1005,10 +1037,10 @@ module_db_module_ondisk (gpointer data,
|
||||||
/* if it's not on the disk, and it isn't in memory, mark it to be
|
/* if it's not on the disk, and it isn't in memory, mark it to be
|
||||||
* removed later. */
|
* removed later. */
|
||||||
if (!mod->ondisk && !mod->module)
|
if (!mod->ondisk && !mod->module)
|
||||||
{
|
{
|
||||||
*kill_list = g_slist_append (*kill_list, mod);
|
*kill_list = g_slist_append (*kill_list, mod);
|
||||||
mod = NULL;
|
mod = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mod && mod->ondisk != old_ondisk)
|
if (mod && mod->ondisk != old_ondisk)
|
||||||
module_info_modified (mod);
|
module_info_modified (mod);
|
||||||
|
@ -1019,7 +1051,7 @@ static void
|
||||||
module_db_module_remove (gpointer data,
|
module_db_module_remove (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
|
|
||||||
gimp_set_remove (modules, mod);
|
gimp_set_remove (modules, mod);
|
||||||
|
|
||||||
|
@ -1028,23 +1060,24 @@ module_db_module_remove (gpointer data,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
const char *search_key;
|
{
|
||||||
module_info *found;
|
const gchar *search_key;
|
||||||
|
ModuleInfo *found;
|
||||||
} find_by_path_closure;
|
} find_by_path_closure;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_db_path_cmp (gpointer data,
|
module_db_path_cmp (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
find_by_path_closure *cl = user_data;
|
find_by_path_closure *cl = user_data;
|
||||||
|
|
||||||
if (!strcmp (mod->fullpath, cl->search_key))
|
if (!strcmp (mod->fullpath, cl->search_key))
|
||||||
cl->found = mod;
|
cl->found = mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
static module_info *
|
static ModuleInfo *
|
||||||
module_find_by_path (const char *fullpath)
|
module_find_by_path (const char *fullpath)
|
||||||
{
|
{
|
||||||
find_by_path_closure cl;
|
find_by_path_closure cl;
|
||||||
|
@ -1078,7 +1111,7 @@ browser_refresh_callback (GtkWidget *widget,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_module_ref (module_info *mod)
|
gimp_module_ref (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
g_return_if_fail (mod->refs >= 0);
|
g_return_if_fail (mod->refs >= 0);
|
||||||
g_return_if_fail (mod->module != NULL);
|
g_return_if_fail (mod->module != NULL);
|
||||||
|
@ -1086,7 +1119,7 @@ gimp_module_ref (module_info *mod)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_module_unref (module_info *mod)
|
gimp_module_unref (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
g_return_if_fail (mod->refs > 0);
|
g_return_if_fail (mod->refs > 0);
|
||||||
g_return_if_fail (mod->module != NULL);
|
g_return_if_fail (mod->module != NULL);
|
||||||
|
@ -1094,11 +1127,11 @@ gimp_module_unref (module_info *mod)
|
||||||
mod->refs--;
|
mod->refs--;
|
||||||
|
|
||||||
if (mod->refs == 0)
|
if (mod->refs == 0)
|
||||||
{
|
{
|
||||||
TRC (("module %p refs hit 0, g_module_closing it\n", mod));
|
TRC (("module %p refs hit 0, g_module_closing it\n", mod));
|
||||||
g_module_close (mod->module);
|
g_module_close (mod->module);
|
||||||
mod->module = NULL;
|
mod->module = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* End of module_db.c */
|
/* End of module_db.c */
|
||||||
|
|
|
@ -17,14 +17,14 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __MODULE_DB_H__
|
#ifndef __MODULE_DB_H__
|
||||||
|
|
||||||
|
|
||||||
/* Load any modules we find on the module-path set in the gimprc */
|
/* Load any modules we find on the module-path set in the gimprc */
|
||||||
void module_db_init (void);
|
void module_db_init (void);
|
||||||
|
|
||||||
/* Unload all modules, in case a module needs some cleanups */
|
/* Unload all modules, in case a module needs some cleanups */
|
||||||
void module_db_free (void);
|
void module_db_free (void);
|
||||||
|
|
||||||
GtkWidget *module_db_browser_new (void);
|
GtkWidget *module_db_browser_new (void);
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,15 @@
|
||||||
|
|
||||||
#include "libgimp/gimpenv.h"
|
#include "libgimp/gimpenv.h"
|
||||||
#include "libgimp/gimpmodule.h"
|
#include "libgimp/gimpmodule.h"
|
||||||
|
|
||||||
#include "libgimp/gimpintl.h"
|
#include "libgimp/gimpintl.h"
|
||||||
|
|
||||||
/* export this to gimprc.c */
|
|
||||||
char *module_db_load_inhibit = NULL;
|
|
||||||
|
|
||||||
typedef enum {
|
/* export this to gimprc.c */
|
||||||
|
gchar *module_db_load_inhibit = NULL;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
ST_MODULE_ERROR, /* missing module_load function or other error */
|
ST_MODULE_ERROR, /* missing module_load function or other error */
|
||||||
ST_LOADED_OK, /* happy and running (normal state of affairs) */
|
ST_LOADED_OK, /* happy and running (normal state of affairs) */
|
||||||
ST_LOAD_FAILED, /* module_load returned GIMP_MODULE_UNLOAD */
|
ST_LOAD_FAILED, /* module_load returned GIMP_MODULE_UNLOAD */
|
||||||
|
@ -54,7 +57,8 @@ typedef enum {
|
||||||
ST_UNLOADED_OK /* callback arrived, module not in memory anymore */
|
ST_UNLOADED_OK /* callback arrived, module not in memory anymore */
|
||||||
} module_state;
|
} module_state;
|
||||||
|
|
||||||
static const char * const statename[] = {
|
static const gchar * const statename[] =
|
||||||
|
{
|
||||||
N_("Module error"),
|
N_("Module error"),
|
||||||
N_("Loaded OK"),
|
N_("Loaded OK"),
|
||||||
N_("Load failed"),
|
N_("Load failed"),
|
||||||
|
@ -63,68 +67,76 @@ static const char * const statename[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
extern void gimp_color_selector_register();
|
extern void gimp_color_selector_register ();
|
||||||
extern void gimp_color_selector_unregister();
|
extern void gimp_color_selector_unregister ();
|
||||||
extern void gimp_color_display_register();
|
extern void gimp_color_display_register ();
|
||||||
extern void gimp_color_display_unregister();
|
extern void gimp_color_display_unregister ();
|
||||||
extern void dialog_register();
|
extern void dialog_register ();
|
||||||
extern void dialog_unregister();
|
extern void dialog_unregister ();
|
||||||
|
|
||||||
static struct main_funcs_struc {
|
static struct main_funcs_struc
|
||||||
|
{
|
||||||
gchar *name;
|
gchar *name;
|
||||||
void (*func)();
|
void (*func) ();
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_main_funcs[] = {
|
gimp_main_funcs[] =
|
||||||
{ "gimp_color_selector_register", gimp_color_selector_register },
|
{
|
||||||
|
{ "gimp_color_selector_register", gimp_color_selector_register },
|
||||||
{ "gimp_color_selector_unregister", gimp_color_selector_unregister },
|
{ "gimp_color_selector_unregister", gimp_color_selector_unregister },
|
||||||
{ "gimp_color_display_register", gimp_color_display_register },
|
{ "gimp_color_display_register", gimp_color_display_register },
|
||||||
{ "gimp_color_display_unregister", gimp_color_display_unregister },
|
{ "gimp_color_display_unregister", gimp_color_display_unregister },
|
||||||
{ "dialog_register", dialog_register },
|
{ "dialog_register", dialog_register },
|
||||||
{ "dialog_unregister", dialog_unregister },
|
{ "dialog_unregister", dialog_unregister },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* one of these objects is kept per-module */
|
/* one of these objects is kept per-module */
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
GtkObject object;
|
GtkObject object;
|
||||||
|
|
||||||
gchar *fullpath; /* path to the module */
|
gchar *fullpath; /* path to the module */
|
||||||
module_state state; /* what's happened to the module */
|
module_state state; /* what's happened to the module */
|
||||||
gboolean ondisk; /* TRUE if file still exists */
|
gboolean ondisk; /* TRUE if file still exists */
|
||||||
gboolean load_inhibit; /* user requests not to load at boot time */
|
gboolean load_inhibit; /* user requests not to load at boot time */
|
||||||
gint refs; /* how many time we're running in the module */
|
gint refs; /* how many time we're running in the module */
|
||||||
|
|
||||||
/* stuff from now on may be NULL depending on the state the module is in */
|
/* stuff from now on may be NULL depending on the state the module is in */
|
||||||
GimpModuleInfo *info; /* returned values from module_init */
|
GimpModuleInfo *info; /* returned values from module_init */
|
||||||
GModule *module; /* handle on the module */
|
GModule *module; /* handle on the module */
|
||||||
gchar *last_module_error;
|
gchar *last_module_error;
|
||||||
GimpModuleInitFunc *init;
|
|
||||||
GimpModuleUnloadFunc *unload;
|
GimpModuleInitFunc init;
|
||||||
} module_info;
|
GimpModuleUnloadFunc unload;
|
||||||
|
} ModuleInfo;
|
||||||
|
|
||||||
|
|
||||||
static guint module_info_get_type (void);
|
static guint module_info_get_type (void);
|
||||||
|
|
||||||
#define MODULE_INFO_TYPE module_info_get_type()
|
#define MODULE_INFO_TYPE module_info_get_type()
|
||||||
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, module_info)
|
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo)
|
||||||
#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)
|
#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)
|
||||||
|
|
||||||
|
|
||||||
#define NUM_INFO_LINES 7
|
#define NUM_INFO_LINES 7
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
GtkWidget *table;
|
{
|
||||||
GtkWidget *label[NUM_INFO_LINES];
|
GtkWidget *table;
|
||||||
GtkWidget *button_label;
|
GtkWidget *label[NUM_INFO_LINES];
|
||||||
module_info *last_update;
|
GtkWidget *button_label;
|
||||||
GtkWidget *button;
|
ModuleInfo *last_update;
|
||||||
GtkWidget *list;
|
GtkWidget *button;
|
||||||
GtkWidget *load_inhibit_check;
|
GtkWidget *list;
|
||||||
} browser_st;
|
GtkWidget *load_inhibit_check;
|
||||||
|
} BrowserState;
|
||||||
|
|
||||||
/* global set of module_info pointers */
|
/* global set of module_info pointers */
|
||||||
static GimpSet *modules;
|
static GimpSet *modules;
|
||||||
static GimpSetHandlerId modules_handler;
|
static GimpSetHandlerId modules_handler;
|
||||||
|
|
||||||
/* If the inhibit state of any modules changes, we might need to
|
/* If the inhibit state of any modules changes, we might need to
|
||||||
* re-write the modulerc. */
|
* re-write the modulerc. */
|
||||||
|
@ -146,26 +158,43 @@ static gboolean need_to_rewrite_modulerc = FALSE;
|
||||||
|
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
static void module_initialize (char *filename);
|
static void module_initialize (gchar *filename);
|
||||||
static void mod_load (module_info *mod, gboolean verbose);
|
static void mod_load (ModuleInfo *mod,
|
||||||
static void mod_unload (module_info *mod, gboolean verbose);
|
gboolean verbose);
|
||||||
static module_info *module_find_by_path (const char *fullpath);
|
static void mod_unload (ModuleInfo *mod,
|
||||||
#ifdef DUMP_DB
|
gboolean verbose);
|
||||||
static void print_module_info (gpointer data, gpointer user_data);
|
static ModuleInfo * module_find_by_path (const gchar *fullpath);
|
||||||
#endif
|
|
||||||
static void browser_popdown_callback (GtkWidget *w, gpointer client_data);
|
|
||||||
static void browser_destroy_callback (GtkWidget *w, gpointer client_data);
|
|
||||||
static void browser_info_update (module_info *, browser_st *);
|
|
||||||
static void browser_info_add (GimpSet *, module_info *, browser_st *);
|
|
||||||
static void browser_info_remove (GimpSet *, module_info *, browser_st *);
|
|
||||||
static void browser_info_init (browser_st *st, GtkWidget *table);
|
|
||||||
static void browser_select_callback (GtkWidget *widget, GtkWidget *child);
|
|
||||||
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 gimp_module_ref (module_info *mod);
|
#ifdef DUMP_DB
|
||||||
static void gimp_module_unref (module_info *mod);
|
static void print_module_info (gpointer data,
|
||||||
|
gpointer user_data);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void browser_popdown_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static void browser_destroy_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static void browser_info_update (ModuleInfo *mod,
|
||||||
|
BrowserState *st);
|
||||||
|
static void browser_info_add (GimpSet *set,
|
||||||
|
ModuleInfo *mod,
|
||||||
|
BrowserState *st);
|
||||||
|
static void browser_info_remove (GimpSet *set,
|
||||||
|
ModuleInfo *mod,
|
||||||
|
BrowserState *st);
|
||||||
|
static void browser_info_init (BrowserState *st,
|
||||||
|
GtkWidget *table);
|
||||||
|
static void browser_select_callback (GtkWidget *widget,
|
||||||
|
GtkWidget *child);
|
||||||
|
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 gimp_module_ref (ModuleInfo *mod);
|
||||||
|
static void gimp_module_unref (ModuleInfo *mod);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,7 +204,7 @@ static void gimp_module_unref (module_info *mod);
|
||||||
void
|
void
|
||||||
module_db_init (void)
|
module_db_init (void)
|
||||||
{
|
{
|
||||||
char *filename;
|
gchar *filename;
|
||||||
|
|
||||||
/* load the modulerc file */
|
/* load the modulerc file */
|
||||||
filename = gimp_personal_rc_file ("modulerc");
|
filename = gimp_personal_rc_file ("modulerc");
|
||||||
|
@ -198,7 +227,7 @@ static void
|
||||||
free_a_single_module (gpointer data,
|
free_a_single_module (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
|
|
||||||
if (mod->module && mod->unload && mod->state == ST_LOADED_OK)
|
if (mod->module && mod->unload && mod->state == ST_LOADED_OK)
|
||||||
{
|
{
|
||||||
|
@ -210,8 +239,8 @@ static void
|
||||||
add_to_inhibit_string (gpointer data,
|
add_to_inhibit_string (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
GString *str = user_data;
|
GString *str = user_data;
|
||||||
|
|
||||||
if (mod->load_inhibit)
|
if (mod->load_inhibit)
|
||||||
{
|
{
|
||||||
|
@ -224,11 +253,11 @@ add_to_inhibit_string (gpointer data,
|
||||||
static gboolean
|
static gboolean
|
||||||
module_db_write_modulerc (void)
|
module_db_write_modulerc (void)
|
||||||
{
|
{
|
||||||
GString *str;
|
GString *str;
|
||||||
gchar *p;
|
gchar *p;
|
||||||
char *filename;
|
gchar *filename;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
gboolean saved = FALSE;
|
gboolean saved = FALSE;
|
||||||
|
|
||||||
str = g_string_new (NULL);
|
str = g_string_new (NULL);
|
||||||
gimp_set_foreach (modules, add_to_inhibit_string, str);
|
gimp_set_foreach (modules, add_to_inhibit_string, str);
|
||||||
|
@ -256,12 +285,12 @@ void
|
||||||
module_db_free (void)
|
module_db_free (void)
|
||||||
{
|
{
|
||||||
if (need_to_rewrite_modulerc)
|
if (need_to_rewrite_modulerc)
|
||||||
{
|
{
|
||||||
if (module_db_write_modulerc ())
|
if (module_db_write_modulerc ())
|
||||||
{
|
{
|
||||||
need_to_rewrite_modulerc = FALSE;
|
need_to_rewrite_modulerc = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gimp_set_foreach (modules, free_a_single_module, NULL);
|
gimp_set_foreach (modules, free_a_single_module, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +303,7 @@ module_db_browser_new (void)
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *listbox;
|
GtkWidget *listbox;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
browser_st *st;
|
BrowserState *st;
|
||||||
|
|
||||||
shell = gimp_dialog_new (_("Module DB"), "module_db_dialog",
|
shell = gimp_dialog_new (_("Module DB"), "module_db_dialog",
|
||||||
gimp_standard_help_func,
|
gimp_standard_help_func,
|
||||||
|
@ -300,7 +329,7 @@ module_db_browser_new (void)
|
||||||
gtk_widget_set_usize (listbox, 125, 100);
|
gtk_widget_set_usize (listbox, 125, 100);
|
||||||
gtk_widget_show (listbox);
|
gtk_widget_show (listbox);
|
||||||
|
|
||||||
st = g_new0 (browser_st, 1);
|
st = g_new0 (BrowserState, 1);
|
||||||
|
|
||||||
st->list = gtk_list_new ();
|
st->list = gtk_list_new ();
|
||||||
gtk_list_set_selection_mode (GTK_LIST (st->list), GTK_SELECTION_BROWSE);
|
gtk_list_set_selection_mode (GTK_LIST (st->list), GTK_SELECTION_BROWSE);
|
||||||
|
@ -361,14 +390,16 @@ module_db_browser_new (void)
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
/* module_info object glue */
|
/* ModuleInfo object glue */
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
GtkObjectClass parent_class;
|
GtkObjectClass parent_class;
|
||||||
} module_infoClass;
|
} ModuleInfoClass;
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
MODIFIED,
|
MODIFIED,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
@ -378,7 +409,7 @@ static guint module_info_signals[LAST_SIGNAL];
|
||||||
static void
|
static void
|
||||||
module_info_destroy (GtkObject *object)
|
module_info_destroy (GtkObject *object)
|
||||||
{
|
{
|
||||||
module_info *mod = MODULE_INFO (object);
|
ModuleInfo *mod = MODULE_INFO (object);
|
||||||
|
|
||||||
/* if this trips, then we're onto some serious lossage in a moment */
|
/* if this trips, then we're onto some serious lossage in a moment */
|
||||||
g_return_if_fail (mod->refs == 0);
|
g_return_if_fail (mod->refs == 0);
|
||||||
|
@ -389,25 +420,25 @@ module_info_destroy (GtkObject *object)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_info_class_init (module_infoClass *klass)
|
module_info_class_init (ModuleInfoClass *klass)
|
||||||
{
|
{
|
||||||
GtkObjectClass *object_class;
|
GtkObjectClass *object_class;
|
||||||
GtkType type;
|
GtkType type;
|
||||||
|
|
||||||
object_class = GTK_OBJECT_CLASS(klass);
|
object_class = GTK_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
type = object_class->type;
|
type = object_class->type;
|
||||||
|
|
||||||
object_class->destroy = module_info_destroy;
|
object_class->destroy = module_info_destroy;
|
||||||
|
|
||||||
module_info_signals[MODIFIED] =
|
module_info_signals[MODIFIED] =
|
||||||
gimp_signal_new ("modified", 0, type, 0, gimp_sigtype_void);
|
gimp_signal_new ("modified", 0, type, 0, gimp_sigtype_void);
|
||||||
|
|
||||||
gtk_object_class_add_signals(object_class, module_info_signals, LAST_SIGNAL);
|
gtk_object_class_add_signals (object_class, module_info_signals, LAST_SIGNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_info_init (module_info *mod)
|
module_info_init (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
/* don't need to do anything */
|
/* don't need to do anything */
|
||||||
}
|
}
|
||||||
|
@ -421,9 +452,9 @@ module_info_get_type (void)
|
||||||
{
|
{
|
||||||
static const GtkTypeInfo module_info_info =
|
static const GtkTypeInfo module_info_info =
|
||||||
{
|
{
|
||||||
"module_info",
|
"ModuleInfo",
|
||||||
sizeof (module_info),
|
sizeof (ModuleInfo),
|
||||||
sizeof (module_infoClass),
|
sizeof (ModuleInfoClass),
|
||||||
(GtkClassInitFunc) module_info_class_init,
|
(GtkClassInitFunc) module_info_class_init,
|
||||||
(GtkObjectInitFunc) module_info_init,
|
(GtkObjectInitFunc) module_info_init,
|
||||||
/* reserved_1 */ NULL,
|
/* reserved_1 */ NULL,
|
||||||
|
@ -431,8 +462,8 @@ module_info_get_type (void)
|
||||||
(GtkClassInitFunc) NULL,
|
(GtkClassInitFunc) NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
module_info_type = gtk_type_unique (gtk_object_get_type(),
|
module_info_type =
|
||||||
&module_info_info);
|
gtk_type_unique (gtk_object_get_type (), &module_info_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
return module_info_type;
|
return module_info_type;
|
||||||
|
@ -441,19 +472,19 @@ module_info_get_type (void)
|
||||||
/* exported API: */
|
/* exported API: */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_info_modified (module_info *mod)
|
module_info_modified (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
gtk_signal_emit (GTK_OBJECT (mod), module_info_signals[MODIFIED]);
|
gtk_signal_emit (GTK_OBJECT (mod), module_info_signals[MODIFIED]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static module_info *
|
static ModuleInfo *
|
||||||
module_info_new (void)
|
module_info_new (void)
|
||||||
{
|
{
|
||||||
return MODULE_INFO (gtk_type_new (module_info_get_type ()));
|
return MODULE_INFO (gtk_type_new (module_info_get_type ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_info_free (module_info *mod)
|
module_info_free (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
gtk_object_unref (GTK_OBJECT (mod));
|
gtk_object_unref (GTK_OBJECT (mod));
|
||||||
}
|
}
|
||||||
|
@ -465,10 +496,10 @@ module_info_free (module_info *mod)
|
||||||
|
|
||||||
/* name must be of the form lib*.so (Unix) or *.dll (Win32) */
|
/* name must be of the form lib*.so (Unix) or *.dll (Win32) */
|
||||||
static gboolean
|
static gboolean
|
||||||
valid_module_name (const char *filename)
|
valid_module_name (const gchar *filename)
|
||||||
{
|
{
|
||||||
const char *basename;
|
const gchar *basename;
|
||||||
int len;
|
gint len;
|
||||||
|
|
||||||
basename = g_basename (filename);
|
basename = g_basename (filename);
|
||||||
|
|
||||||
|
@ -496,12 +527,13 @@ valid_module_name (const char *filename)
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
module_inhibited (const char *fullpath,
|
module_inhibited (const gchar *fullpath,
|
||||||
const char *inhibit_list)
|
const gchar *inhibit_list)
|
||||||
{
|
{
|
||||||
char *p;
|
gchar *p;
|
||||||
int pathlen;
|
gint pathlen;
|
||||||
const char *start, *end;
|
const gchar *start;
|
||||||
|
const gchar *end;
|
||||||
|
|
||||||
/* common case optimisation: the list is empty */
|
/* common case optimisation: the list is empty */
|
||||||
if (!inhibit_list || *inhibit_list == '\000')
|
if (!inhibit_list || *inhibit_list == '\000')
|
||||||
|
@ -531,9 +563,9 @@ module_inhibited (const char *fullpath,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_initialize (char *filename)
|
module_initialize (gchar *filename)
|
||||||
{
|
{
|
||||||
module_info *mod;
|
ModuleInfo *mod;
|
||||||
|
|
||||||
if (!valid_module_name (filename))
|
if (!valid_module_name (filename))
|
||||||
return;
|
return;
|
||||||
|
@ -581,8 +613,8 @@ module_initialize (char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mod_load (module_info *mod,
|
mod_load (ModuleInfo *mod,
|
||||||
gboolean verbose)
|
gboolean verbose)
|
||||||
{
|
{
|
||||||
gpointer symbol;
|
gpointer symbol;
|
||||||
|
|
||||||
|
@ -632,12 +664,12 @@ mod_load (module_info *mod,
|
||||||
mod->info = NULL;
|
mod->info = NULL;
|
||||||
gimp_module_ref (mod); /* loaded modules are assumed to have a ref of 1 */
|
gimp_module_ref (mod); /* loaded modules are assumed to have a ref of 1 */
|
||||||
if (mod->init (&mod->info) == GIMP_MODULE_UNLOAD)
|
if (mod->init (&mod->info) == GIMP_MODULE_UNLOAD)
|
||||||
{
|
{
|
||||||
mod->state = ST_LOAD_FAILED;
|
mod->state = ST_LOAD_FAILED;
|
||||||
gimp_module_unref (mod);
|
gimp_module_unref (mod);
|
||||||
mod->info = NULL;
|
mod->info = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* module is now happy */
|
/* module is now happy */
|
||||||
mod->state = ST_LOADED_OK;
|
mod->state = ST_LOADED_OK;
|
||||||
|
@ -648,14 +680,13 @@ mod_load (module_info *mod,
|
||||||
mod->unload = symbol;
|
mod->unload = symbol;
|
||||||
else
|
else
|
||||||
mod->unload = NULL;
|
mod->unload = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mod_unload_completed_callback (void *data)
|
mod_unload_completed_callback (void *data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
|
|
||||||
g_return_if_fail (mod->state == ST_UNLOAD_REQUESTED);
|
g_return_if_fail (mod->state == ST_UNLOAD_REQUESTED);
|
||||||
|
|
||||||
|
@ -672,8 +703,8 @@ mod_unload_completed_callback (void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mod_unload (module_info *mod,
|
mod_unload (ModuleInfo *mod,
|
||||||
gboolean verbose)
|
gboolean verbose)
|
||||||
{
|
{
|
||||||
g_return_if_fail (mod->module != NULL);
|
g_return_if_fail (mod->module != NULL);
|
||||||
g_return_if_fail (mod->unload != NULL);
|
g_return_if_fail (mod->unload != NULL);
|
||||||
|
@ -694,31 +725,30 @@ mod_unload (module_info *mod,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DUMP_DB
|
#ifdef DUMP_DB
|
||||||
static void
|
static void
|
||||||
print_module_info (gpointer data,
|
print_module_info (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *i = data;
|
ModuleInfo *i = data;
|
||||||
|
|
||||||
printf ("\n%s: %s\n",
|
g_print ("\n%s: %s\n",
|
||||||
i->fullpath, statename[i->state]);
|
i->fullpath, statename[i->state]);
|
||||||
printf (" module:%p lasterr:%s init:%p unload:%p\n",
|
g_print (" module:%p lasterr:%s init:%p unload:%p\n",
|
||||||
i->module, i->last_module_error? i->last_module_error : "NONE",
|
i->module, i->last_module_error? i->last_module_error : "NONE",
|
||||||
i->init, i->unload);
|
i->init, i->unload);
|
||||||
if (i->info)
|
if (i->info)
|
||||||
{
|
{
|
||||||
printf (" shutdown_data: %p\n"
|
g_print (" shutdown_data: %p\n"
|
||||||
" purpose: %s\n"
|
" purpose: %s\n"
|
||||||
" author: %s\n"
|
" author: %s\n"
|
||||||
" version: %s\n"
|
" version: %s\n"
|
||||||
" copyright: %s\n"
|
" copyright: %s\n"
|
||||||
" date: %s\n",
|
" date: %s\n",
|
||||||
i->info->shutdown_data,
|
i->info->shutdown_data,
|
||||||
i->info->purpose, i->info->author, i->info->version,
|
i->info->purpose, i->info->author, i->info->version,
|
||||||
i->info->copyright, i->info->date);
|
i->info->copyright, i->info->date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -728,31 +758,31 @@ print_module_info (gpointer data,
|
||||||
/* UI functions */
|
/* UI functions */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_popdown_callback (GtkWidget *w,
|
browser_popdown_callback (GtkWidget *widget,
|
||||||
gpointer client_data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gtk_widget_destroy (GTK_WIDGET (client_data));
|
gtk_widget_destroy (GTK_WIDGET (data));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_destroy_callback (GtkWidget *w,
|
browser_destroy_callback (GtkWidget *widget,
|
||||||
gpointer client_data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), client_data);
|
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), data);
|
||||||
gimp_set_remove_handler (modules, modules_handler);
|
gimp_set_remove_handler (modules, modules_handler);
|
||||||
g_free (client_data);
|
g_free (data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_load_inhibit_callback (GtkWidget *w,
|
browser_load_inhibit_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
browser_st *st = data;
|
BrowserState *st = data;
|
||||||
gboolean new_value;
|
gboolean new_value;
|
||||||
|
|
||||||
g_return_if_fail (st->last_update != NULL);
|
g_return_if_fail (st->last_update != NULL);
|
||||||
|
|
||||||
new_value = ! GTK_TOGGLE_BUTTON (w)->active;
|
new_value = ! GTK_TOGGLE_BUTTON (widget)->active;
|
||||||
|
|
||||||
if (new_value == st->last_update->load_inhibit)
|
if (new_value == st->last_update->load_inhibit)
|
||||||
return;
|
return;
|
||||||
|
@ -764,59 +794,58 @@ browser_load_inhibit_callback (GtkWidget *w,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_info_update (module_info *mod,
|
browser_info_update (ModuleInfo *mod,
|
||||||
browser_st *st)
|
BrowserState *st)
|
||||||
{
|
{
|
||||||
int i;
|
gint i;
|
||||||
const char *text[NUM_INFO_LINES - 1];
|
const gchar *text[NUM_INFO_LINES - 1];
|
||||||
char *status;
|
gchar *status;
|
||||||
|
|
||||||
/* only update the info if we're actually showing it */
|
/* only update the info if we're actually showing it */
|
||||||
if (mod != st->last_update)
|
if (mod != st->last_update)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!mod)
|
if (!mod)
|
||||||
{
|
{
|
||||||
for (i=0; i < NUM_INFO_LINES; i++)
|
for (i=0; i < NUM_INFO_LINES; i++)
|
||||||
gtk_label_set_text (GTK_LABEL (st->label[i]), "");
|
gtk_label_set_text (GTK_LABEL (st->label[i]), "");
|
||||||
gtk_label_set_text (GTK_LABEL(st->button_label), _("<No modules>"));
|
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->button), FALSE);
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), FALSE);
|
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mod->info)
|
if (mod->info)
|
||||||
{
|
{
|
||||||
text[0] = mod->info->purpose;
|
text[0] = mod->info->purpose;
|
||||||
text[1] = mod->info->author;
|
text[1] = mod->info->author;
|
||||||
text[2] = mod->info->version;
|
text[2] = mod->info->version;
|
||||||
text[3] = mod->info->copyright;
|
text[3] = mod->info->copyright;
|
||||||
text[4] = mod->info->date;
|
text[4] = mod->info->date;
|
||||||
text[5] = mod->ondisk? _("on disk") : _("only in memory");
|
text[5] = mod->ondisk? _("on disk") : _("only in memory");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
text[0] = "--";
|
text[0] = "--";
|
||||||
text[1] = "--";
|
text[1] = "--";
|
||||||
text[2] = "--";
|
text[2] = "--";
|
||||||
text[3] = "--";
|
text[3] = "--";
|
||||||
text[4] = "--";
|
text[4] = "--";
|
||||||
text[5] = mod->ondisk? _("on disk") : _("nowhere (click 'refresh')");
|
text[5] = mod->ondisk? _("on disk") : _("nowhere (click 'refresh')");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (mod->state == ST_MODULE_ERROR && mod->last_module_error)
|
if (mod->state == ST_MODULE_ERROR && mod->last_module_error)
|
||||||
status = g_strdup_printf ("%s (%s)", gettext (statename[mod->state]),
|
status = g_strdup_printf ("%s (%s)", gettext (statename[mod->state]),
|
||||||
mod->last_module_error);
|
mod->last_module_error);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = g_strdup (gettext (statename[mod->state]));
|
status = g_strdup (gettext (statename[mod->state]));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i < NUM_INFO_LINES - 1; i++)
|
for (i=0; i < NUM_INFO_LINES - 1; i++)
|
||||||
{
|
{
|
||||||
gtk_label_set_text (GTK_LABEL (st->label[i]), gettext (text[i]));
|
gtk_label_set_text (GTK_LABEL (st->label[i]), gettext (text[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_label_set_text (GTK_LABEL (st->label[NUM_INFO_LINES-1]), status);
|
gtk_label_set_text (GTK_LABEL (st->label[NUM_INFO_LINES-1]), status);
|
||||||
|
|
||||||
|
@ -827,33 +856,36 @@ browser_info_update (module_info *mod,
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), TRUE);
|
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), TRUE);
|
||||||
|
|
||||||
/* work out what the button should do (if anything) */
|
/* work out what the button should do (if anything) */
|
||||||
switch (mod->state) {
|
switch (mod->state)
|
||||||
case ST_MODULE_ERROR:
|
{
|
||||||
case ST_LOAD_FAILED:
|
case ST_MODULE_ERROR:
|
||||||
case ST_UNLOADED_OK:
|
case ST_LOAD_FAILED:
|
||||||
gtk_label_set_text (GTK_LABEL(st->button_label), _("Load"));
|
case ST_UNLOADED_OK:
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->button), mod->ondisk);
|
gtk_label_set_text (GTK_LABEL(st->button_label), _("Load"));
|
||||||
break;
|
gtk_widget_set_sensitive (GTK_WIDGET (st->button), mod->ondisk);
|
||||||
|
break;
|
||||||
|
|
||||||
case ST_UNLOAD_REQUESTED:
|
case ST_UNLOAD_REQUESTED:
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->button), FALSE);
|
gtk_widget_set_sensitive (GTK_WIDGET (st->button), FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_LOADED_OK:
|
case ST_LOADED_OK:
|
||||||
gtk_label_set_text (GTK_LABEL(st->button_label), _("Unload"));
|
gtk_label_set_text (GTK_LABEL(st->button_label), _("Unload"));
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->button),
|
gtk_widget_set_sensitive (GTK_WIDGET (st->button),
|
||||||
mod->unload? TRUE : FALSE);
|
mod->unload? TRUE : FALSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_info_init (browser_st *st,
|
browser_info_init (BrowserState *st,
|
||||||
GtkWidget *table)
|
GtkWidget *table)
|
||||||
{
|
{
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
int i;
|
gint i;
|
||||||
char *text[] = {
|
|
||||||
|
gchar *text[] =
|
||||||
|
{
|
||||||
N_("Purpose:"),
|
N_("Purpose:"),
|
||||||
N_("Author:"),
|
N_("Author:"),
|
||||||
N_("Version:"),
|
N_("Version:"),
|
||||||
|
@ -864,22 +896,22 @@ browser_info_init (browser_st *st,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i=0; i < sizeof(text) / sizeof(char *); i++)
|
for (i=0; i < sizeof(text) / sizeof(char *); i++)
|
||||||
{
|
{
|
||||||
label = gtk_label_new (gettext (text[i]));
|
label = gtk_label_new (gettext (text[i]));
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
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_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
st->label[i] = gtk_label_new ("");
|
st->label[i] = gtk_label_new ("");
|
||||||
gtk_misc_set_alignment (GTK_MISC (st->label[i]), 0.0, 0.5);
|
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,
|
gtk_table_attach (GTK_TABLE (st->table), st->label[i], 1, 2, i, i+1,
|
||||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
|
||||||
gtk_widget_show (st->label[i]);
|
gtk_widget_show (st->label[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
st->load_inhibit_check =
|
st->load_inhibit_check =
|
||||||
gtk_check_button_new_with_label (_("Autoload during startup"));
|
gtk_check_button_new_with_label (_("Autoload during startup"));
|
||||||
gtk_widget_show (st->load_inhibit_check);
|
gtk_widget_show (st->load_inhibit_check);
|
||||||
gtk_table_attach (GTK_TABLE (table), st->load_inhibit_check,
|
gtk_table_attach (GTK_TABLE (table), st->load_inhibit_check,
|
||||||
0, 2, i, i+1,
|
0, 2, i, i+1,
|
||||||
|
@ -892,8 +924,8 @@ static void
|
||||||
browser_select_callback (GtkWidget *widget,
|
browser_select_callback (GtkWidget *widget,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
module_info *i;
|
ModuleInfo *i;
|
||||||
browser_st *st;
|
BrowserState *st;
|
||||||
|
|
||||||
i = gtk_object_get_user_data (GTK_OBJECT (child));
|
i = gtk_object_get_user_data (GTK_OBJECT (child));
|
||||||
st = gtk_object_get_user_data (GTK_OBJECT (widget));
|
st = gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||||
|
@ -911,7 +943,7 @@ static void
|
||||||
browser_load_unload_callback (GtkWidget *widget,
|
browser_load_unload_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
browser_st *st = data;
|
BrowserState *st = data;
|
||||||
|
|
||||||
if (st->last_update->state == ST_LOADED_OK)
|
if (st->last_update->state == ST_LOADED_OK)
|
||||||
mod_unload (st->last_update, FALSE);
|
mod_unload (st->last_update, FALSE);
|
||||||
|
@ -926,9 +958,9 @@ static void
|
||||||
make_list_item (gpointer data,
|
make_list_item (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *info = data;
|
ModuleInfo *info = data;
|
||||||
browser_st *st = user_data;
|
BrowserState *st = user_data;
|
||||||
GtkWidget *list_item;
|
GtkWidget *list_item;
|
||||||
|
|
||||||
if (!st->last_update)
|
if (!st->last_update)
|
||||||
st->last_update = info;
|
st->last_update = info;
|
||||||
|
@ -943,22 +975,22 @@ make_list_item (gpointer data,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_info_add (GimpSet *set,
|
browser_info_add (GimpSet *set,
|
||||||
module_info *mod,
|
ModuleInfo *mod,
|
||||||
browser_st *st)
|
BrowserState *st)
|
||||||
{
|
{
|
||||||
make_list_item (mod, st);
|
make_list_item (mod, st);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_info_remove (GimpSet *set,
|
browser_info_remove (GimpSet *set,
|
||||||
module_info *mod,
|
ModuleInfo *mod,
|
||||||
browser_st *st)
|
BrowserState *st)
|
||||||
{
|
{
|
||||||
GList *dlist, *free_list;
|
GList *dlist, *free_list;
|
||||||
GtkWidget *list_item;
|
GtkWidget *list_item;
|
||||||
module_info *i;
|
ModuleInfo *i;
|
||||||
|
|
||||||
dlist = gtk_container_children (GTK_CONTAINER (st->list));
|
dlist = gtk_container_children (GTK_CONTAINER (st->list));
|
||||||
free_list = dlist;
|
free_list = dlist;
|
||||||
|
@ -990,10 +1022,10 @@ static void
|
||||||
module_db_module_ondisk (gpointer data,
|
module_db_module_ondisk (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
int ret;
|
gint ret;
|
||||||
int old_ondisk = mod->ondisk;
|
gint old_ondisk = mod->ondisk;
|
||||||
GSList **kill_list = user_data;
|
GSList **kill_list = user_data;
|
||||||
|
|
||||||
ret = stat (mod->fullpath, &statbuf);
|
ret = stat (mod->fullpath, &statbuf);
|
||||||
|
@ -1005,10 +1037,10 @@ module_db_module_ondisk (gpointer data,
|
||||||
/* if it's not on the disk, and it isn't in memory, mark it to be
|
/* if it's not on the disk, and it isn't in memory, mark it to be
|
||||||
* removed later. */
|
* removed later. */
|
||||||
if (!mod->ondisk && !mod->module)
|
if (!mod->ondisk && !mod->module)
|
||||||
{
|
{
|
||||||
*kill_list = g_slist_append (*kill_list, mod);
|
*kill_list = g_slist_append (*kill_list, mod);
|
||||||
mod = NULL;
|
mod = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mod && mod->ondisk != old_ondisk)
|
if (mod && mod->ondisk != old_ondisk)
|
||||||
module_info_modified (mod);
|
module_info_modified (mod);
|
||||||
|
@ -1019,7 +1051,7 @@ static void
|
||||||
module_db_module_remove (gpointer data,
|
module_db_module_remove (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
|
|
||||||
gimp_set_remove (modules, mod);
|
gimp_set_remove (modules, mod);
|
||||||
|
|
||||||
|
@ -1028,23 +1060,24 @@ module_db_module_remove (gpointer data,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
const char *search_key;
|
{
|
||||||
module_info *found;
|
const gchar *search_key;
|
||||||
|
ModuleInfo *found;
|
||||||
} find_by_path_closure;
|
} find_by_path_closure;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_db_path_cmp (gpointer data,
|
module_db_path_cmp (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
find_by_path_closure *cl = user_data;
|
find_by_path_closure *cl = user_data;
|
||||||
|
|
||||||
if (!strcmp (mod->fullpath, cl->search_key))
|
if (!strcmp (mod->fullpath, cl->search_key))
|
||||||
cl->found = mod;
|
cl->found = mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
static module_info *
|
static ModuleInfo *
|
||||||
module_find_by_path (const char *fullpath)
|
module_find_by_path (const char *fullpath)
|
||||||
{
|
{
|
||||||
find_by_path_closure cl;
|
find_by_path_closure cl;
|
||||||
|
@ -1078,7 +1111,7 @@ browser_refresh_callback (GtkWidget *widget,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_module_ref (module_info *mod)
|
gimp_module_ref (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
g_return_if_fail (mod->refs >= 0);
|
g_return_if_fail (mod->refs >= 0);
|
||||||
g_return_if_fail (mod->module != NULL);
|
g_return_if_fail (mod->module != NULL);
|
||||||
|
@ -1086,7 +1119,7 @@ gimp_module_ref (module_info *mod)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_module_unref (module_info *mod)
|
gimp_module_unref (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
g_return_if_fail (mod->refs > 0);
|
g_return_if_fail (mod->refs > 0);
|
||||||
g_return_if_fail (mod->module != NULL);
|
g_return_if_fail (mod->module != NULL);
|
||||||
|
@ -1094,11 +1127,11 @@ gimp_module_unref (module_info *mod)
|
||||||
mod->refs--;
|
mod->refs--;
|
||||||
|
|
||||||
if (mod->refs == 0)
|
if (mod->refs == 0)
|
||||||
{
|
{
|
||||||
TRC (("module %p refs hit 0, g_module_closing it\n", mod));
|
TRC (("module %p refs hit 0, g_module_closing it\n", mod));
|
||||||
g_module_close (mod->module);
|
g_module_close (mod->module);
|
||||||
mod->module = NULL;
|
mod->module = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* End of module_db.c */
|
/* End of module_db.c */
|
||||||
|
|
|
@ -17,14 +17,14 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __MODULE_DB_H__
|
#ifndef __MODULE_DB_H__
|
||||||
|
|
||||||
|
|
||||||
/* Load any modules we find on the module-path set in the gimprc */
|
/* Load any modules we find on the module-path set in the gimprc */
|
||||||
void module_db_init (void);
|
void module_db_init (void);
|
||||||
|
|
||||||
/* Unload all modules, in case a module needs some cleanups */
|
/* Unload all modules, in case a module needs some cleanups */
|
||||||
void module_db_free (void);
|
void module_db_free (void);
|
||||||
|
|
||||||
GtkWidget *module_db_browser_new (void);
|
GtkWidget *module_db_browser_new (void);
|
||||||
|
|
||||||
|
|
509
app/module_db.c
509
app/module_db.c
|
@ -41,12 +41,15 @@
|
||||||
|
|
||||||
#include "libgimp/gimpenv.h"
|
#include "libgimp/gimpenv.h"
|
||||||
#include "libgimp/gimpmodule.h"
|
#include "libgimp/gimpmodule.h"
|
||||||
|
|
||||||
#include "libgimp/gimpintl.h"
|
#include "libgimp/gimpintl.h"
|
||||||
|
|
||||||
/* export this to gimprc.c */
|
|
||||||
char *module_db_load_inhibit = NULL;
|
|
||||||
|
|
||||||
typedef enum {
|
/* export this to gimprc.c */
|
||||||
|
gchar *module_db_load_inhibit = NULL;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
ST_MODULE_ERROR, /* missing module_load function or other error */
|
ST_MODULE_ERROR, /* missing module_load function or other error */
|
||||||
ST_LOADED_OK, /* happy and running (normal state of affairs) */
|
ST_LOADED_OK, /* happy and running (normal state of affairs) */
|
||||||
ST_LOAD_FAILED, /* module_load returned GIMP_MODULE_UNLOAD */
|
ST_LOAD_FAILED, /* module_load returned GIMP_MODULE_UNLOAD */
|
||||||
|
@ -54,7 +57,8 @@ typedef enum {
|
||||||
ST_UNLOADED_OK /* callback arrived, module not in memory anymore */
|
ST_UNLOADED_OK /* callback arrived, module not in memory anymore */
|
||||||
} module_state;
|
} module_state;
|
||||||
|
|
||||||
static const char * const statename[] = {
|
static const gchar * const statename[] =
|
||||||
|
{
|
||||||
N_("Module error"),
|
N_("Module error"),
|
||||||
N_("Loaded OK"),
|
N_("Loaded OK"),
|
||||||
N_("Load failed"),
|
N_("Load failed"),
|
||||||
|
@ -63,68 +67,76 @@ static const char * const statename[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
extern void gimp_color_selector_register();
|
extern void gimp_color_selector_register ();
|
||||||
extern void gimp_color_selector_unregister();
|
extern void gimp_color_selector_unregister ();
|
||||||
extern void gimp_color_display_register();
|
extern void gimp_color_display_register ();
|
||||||
extern void gimp_color_display_unregister();
|
extern void gimp_color_display_unregister ();
|
||||||
extern void dialog_register();
|
extern void dialog_register ();
|
||||||
extern void dialog_unregister();
|
extern void dialog_unregister ();
|
||||||
|
|
||||||
static struct main_funcs_struc {
|
static struct main_funcs_struc
|
||||||
|
{
|
||||||
gchar *name;
|
gchar *name;
|
||||||
void (*func)();
|
void (*func) ();
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_main_funcs[] = {
|
gimp_main_funcs[] =
|
||||||
{ "gimp_color_selector_register", gimp_color_selector_register },
|
{
|
||||||
|
{ "gimp_color_selector_register", gimp_color_selector_register },
|
||||||
{ "gimp_color_selector_unregister", gimp_color_selector_unregister },
|
{ "gimp_color_selector_unregister", gimp_color_selector_unregister },
|
||||||
{ "gimp_color_display_register", gimp_color_display_register },
|
{ "gimp_color_display_register", gimp_color_display_register },
|
||||||
{ "gimp_color_display_unregister", gimp_color_display_unregister },
|
{ "gimp_color_display_unregister", gimp_color_display_unregister },
|
||||||
{ "dialog_register", dialog_register },
|
{ "dialog_register", dialog_register },
|
||||||
{ "dialog_unregister", dialog_unregister },
|
{ "dialog_unregister", dialog_unregister },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* one of these objects is kept per-module */
|
/* one of these objects is kept per-module */
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
GtkObject object;
|
GtkObject object;
|
||||||
|
|
||||||
gchar *fullpath; /* path to the module */
|
gchar *fullpath; /* path to the module */
|
||||||
module_state state; /* what's happened to the module */
|
module_state state; /* what's happened to the module */
|
||||||
gboolean ondisk; /* TRUE if file still exists */
|
gboolean ondisk; /* TRUE if file still exists */
|
||||||
gboolean load_inhibit; /* user requests not to load at boot time */
|
gboolean load_inhibit; /* user requests not to load at boot time */
|
||||||
gint refs; /* how many time we're running in the module */
|
gint refs; /* how many time we're running in the module */
|
||||||
|
|
||||||
/* stuff from now on may be NULL depending on the state the module is in */
|
/* stuff from now on may be NULL depending on the state the module is in */
|
||||||
GimpModuleInfo *info; /* returned values from module_init */
|
GimpModuleInfo *info; /* returned values from module_init */
|
||||||
GModule *module; /* handle on the module */
|
GModule *module; /* handle on the module */
|
||||||
gchar *last_module_error;
|
gchar *last_module_error;
|
||||||
GimpModuleInitFunc *init;
|
|
||||||
GimpModuleUnloadFunc *unload;
|
GimpModuleInitFunc init;
|
||||||
} module_info;
|
GimpModuleUnloadFunc unload;
|
||||||
|
} ModuleInfo;
|
||||||
|
|
||||||
|
|
||||||
static guint module_info_get_type (void);
|
static guint module_info_get_type (void);
|
||||||
|
|
||||||
#define MODULE_INFO_TYPE module_info_get_type()
|
#define MODULE_INFO_TYPE module_info_get_type()
|
||||||
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, module_info)
|
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo)
|
||||||
#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)
|
#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)
|
||||||
|
|
||||||
|
|
||||||
#define NUM_INFO_LINES 7
|
#define NUM_INFO_LINES 7
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
GtkWidget *table;
|
{
|
||||||
GtkWidget *label[NUM_INFO_LINES];
|
GtkWidget *table;
|
||||||
GtkWidget *button_label;
|
GtkWidget *label[NUM_INFO_LINES];
|
||||||
module_info *last_update;
|
GtkWidget *button_label;
|
||||||
GtkWidget *button;
|
ModuleInfo *last_update;
|
||||||
GtkWidget *list;
|
GtkWidget *button;
|
||||||
GtkWidget *load_inhibit_check;
|
GtkWidget *list;
|
||||||
} browser_st;
|
GtkWidget *load_inhibit_check;
|
||||||
|
} BrowserState;
|
||||||
|
|
||||||
/* global set of module_info pointers */
|
/* global set of module_info pointers */
|
||||||
static GimpSet *modules;
|
static GimpSet *modules;
|
||||||
static GimpSetHandlerId modules_handler;
|
static GimpSetHandlerId modules_handler;
|
||||||
|
|
||||||
/* If the inhibit state of any modules changes, we might need to
|
/* If the inhibit state of any modules changes, we might need to
|
||||||
* re-write the modulerc. */
|
* re-write the modulerc. */
|
||||||
|
@ -146,26 +158,43 @@ static gboolean need_to_rewrite_modulerc = FALSE;
|
||||||
|
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
static void module_initialize (char *filename);
|
static void module_initialize (gchar *filename);
|
||||||
static void mod_load (module_info *mod, gboolean verbose);
|
static void mod_load (ModuleInfo *mod,
|
||||||
static void mod_unload (module_info *mod, gboolean verbose);
|
gboolean verbose);
|
||||||
static module_info *module_find_by_path (const char *fullpath);
|
static void mod_unload (ModuleInfo *mod,
|
||||||
#ifdef DUMP_DB
|
gboolean verbose);
|
||||||
static void print_module_info (gpointer data, gpointer user_data);
|
static ModuleInfo * module_find_by_path (const gchar *fullpath);
|
||||||
#endif
|
|
||||||
static void browser_popdown_callback (GtkWidget *w, gpointer client_data);
|
|
||||||
static void browser_destroy_callback (GtkWidget *w, gpointer client_data);
|
|
||||||
static void browser_info_update (module_info *, browser_st *);
|
|
||||||
static void browser_info_add (GimpSet *, module_info *, browser_st *);
|
|
||||||
static void browser_info_remove (GimpSet *, module_info *, browser_st *);
|
|
||||||
static void browser_info_init (browser_st *st, GtkWidget *table);
|
|
||||||
static void browser_select_callback (GtkWidget *widget, GtkWidget *child);
|
|
||||||
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 gimp_module_ref (module_info *mod);
|
#ifdef DUMP_DB
|
||||||
static void gimp_module_unref (module_info *mod);
|
static void print_module_info (gpointer data,
|
||||||
|
gpointer user_data);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void browser_popdown_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static void browser_destroy_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static void browser_info_update (ModuleInfo *mod,
|
||||||
|
BrowserState *st);
|
||||||
|
static void browser_info_add (GimpSet *set,
|
||||||
|
ModuleInfo *mod,
|
||||||
|
BrowserState *st);
|
||||||
|
static void browser_info_remove (GimpSet *set,
|
||||||
|
ModuleInfo *mod,
|
||||||
|
BrowserState *st);
|
||||||
|
static void browser_info_init (BrowserState *st,
|
||||||
|
GtkWidget *table);
|
||||||
|
static void browser_select_callback (GtkWidget *widget,
|
||||||
|
GtkWidget *child);
|
||||||
|
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 gimp_module_ref (ModuleInfo *mod);
|
||||||
|
static void gimp_module_unref (ModuleInfo *mod);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,7 +204,7 @@ static void gimp_module_unref (module_info *mod);
|
||||||
void
|
void
|
||||||
module_db_init (void)
|
module_db_init (void)
|
||||||
{
|
{
|
||||||
char *filename;
|
gchar *filename;
|
||||||
|
|
||||||
/* load the modulerc file */
|
/* load the modulerc file */
|
||||||
filename = gimp_personal_rc_file ("modulerc");
|
filename = gimp_personal_rc_file ("modulerc");
|
||||||
|
@ -198,7 +227,7 @@ static void
|
||||||
free_a_single_module (gpointer data,
|
free_a_single_module (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
|
|
||||||
if (mod->module && mod->unload && mod->state == ST_LOADED_OK)
|
if (mod->module && mod->unload && mod->state == ST_LOADED_OK)
|
||||||
{
|
{
|
||||||
|
@ -210,8 +239,8 @@ static void
|
||||||
add_to_inhibit_string (gpointer data,
|
add_to_inhibit_string (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
GString *str = user_data;
|
GString *str = user_data;
|
||||||
|
|
||||||
if (mod->load_inhibit)
|
if (mod->load_inhibit)
|
||||||
{
|
{
|
||||||
|
@ -224,11 +253,11 @@ add_to_inhibit_string (gpointer data,
|
||||||
static gboolean
|
static gboolean
|
||||||
module_db_write_modulerc (void)
|
module_db_write_modulerc (void)
|
||||||
{
|
{
|
||||||
GString *str;
|
GString *str;
|
||||||
gchar *p;
|
gchar *p;
|
||||||
char *filename;
|
gchar *filename;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
gboolean saved = FALSE;
|
gboolean saved = FALSE;
|
||||||
|
|
||||||
str = g_string_new (NULL);
|
str = g_string_new (NULL);
|
||||||
gimp_set_foreach (modules, add_to_inhibit_string, str);
|
gimp_set_foreach (modules, add_to_inhibit_string, str);
|
||||||
|
@ -256,12 +285,12 @@ void
|
||||||
module_db_free (void)
|
module_db_free (void)
|
||||||
{
|
{
|
||||||
if (need_to_rewrite_modulerc)
|
if (need_to_rewrite_modulerc)
|
||||||
{
|
{
|
||||||
if (module_db_write_modulerc ())
|
if (module_db_write_modulerc ())
|
||||||
{
|
{
|
||||||
need_to_rewrite_modulerc = FALSE;
|
need_to_rewrite_modulerc = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gimp_set_foreach (modules, free_a_single_module, NULL);
|
gimp_set_foreach (modules, free_a_single_module, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +303,7 @@ module_db_browser_new (void)
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *listbox;
|
GtkWidget *listbox;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
browser_st *st;
|
BrowserState *st;
|
||||||
|
|
||||||
shell = gimp_dialog_new (_("Module DB"), "module_db_dialog",
|
shell = gimp_dialog_new (_("Module DB"), "module_db_dialog",
|
||||||
gimp_standard_help_func,
|
gimp_standard_help_func,
|
||||||
|
@ -300,7 +329,7 @@ module_db_browser_new (void)
|
||||||
gtk_widget_set_usize (listbox, 125, 100);
|
gtk_widget_set_usize (listbox, 125, 100);
|
||||||
gtk_widget_show (listbox);
|
gtk_widget_show (listbox);
|
||||||
|
|
||||||
st = g_new0 (browser_st, 1);
|
st = g_new0 (BrowserState, 1);
|
||||||
|
|
||||||
st->list = gtk_list_new ();
|
st->list = gtk_list_new ();
|
||||||
gtk_list_set_selection_mode (GTK_LIST (st->list), GTK_SELECTION_BROWSE);
|
gtk_list_set_selection_mode (GTK_LIST (st->list), GTK_SELECTION_BROWSE);
|
||||||
|
@ -361,14 +390,16 @@ module_db_browser_new (void)
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
/* module_info object glue */
|
/* ModuleInfo object glue */
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
GtkObjectClass parent_class;
|
GtkObjectClass parent_class;
|
||||||
} module_infoClass;
|
} ModuleInfoClass;
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
MODIFIED,
|
MODIFIED,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
@ -378,7 +409,7 @@ static guint module_info_signals[LAST_SIGNAL];
|
||||||
static void
|
static void
|
||||||
module_info_destroy (GtkObject *object)
|
module_info_destroy (GtkObject *object)
|
||||||
{
|
{
|
||||||
module_info *mod = MODULE_INFO (object);
|
ModuleInfo *mod = MODULE_INFO (object);
|
||||||
|
|
||||||
/* if this trips, then we're onto some serious lossage in a moment */
|
/* if this trips, then we're onto some serious lossage in a moment */
|
||||||
g_return_if_fail (mod->refs == 0);
|
g_return_if_fail (mod->refs == 0);
|
||||||
|
@ -389,25 +420,25 @@ module_info_destroy (GtkObject *object)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_info_class_init (module_infoClass *klass)
|
module_info_class_init (ModuleInfoClass *klass)
|
||||||
{
|
{
|
||||||
GtkObjectClass *object_class;
|
GtkObjectClass *object_class;
|
||||||
GtkType type;
|
GtkType type;
|
||||||
|
|
||||||
object_class = GTK_OBJECT_CLASS(klass);
|
object_class = GTK_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
type = object_class->type;
|
type = object_class->type;
|
||||||
|
|
||||||
object_class->destroy = module_info_destroy;
|
object_class->destroy = module_info_destroy;
|
||||||
|
|
||||||
module_info_signals[MODIFIED] =
|
module_info_signals[MODIFIED] =
|
||||||
gimp_signal_new ("modified", 0, type, 0, gimp_sigtype_void);
|
gimp_signal_new ("modified", 0, type, 0, gimp_sigtype_void);
|
||||||
|
|
||||||
gtk_object_class_add_signals(object_class, module_info_signals, LAST_SIGNAL);
|
gtk_object_class_add_signals (object_class, module_info_signals, LAST_SIGNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_info_init (module_info *mod)
|
module_info_init (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
/* don't need to do anything */
|
/* don't need to do anything */
|
||||||
}
|
}
|
||||||
|
@ -421,9 +452,9 @@ module_info_get_type (void)
|
||||||
{
|
{
|
||||||
static const GtkTypeInfo module_info_info =
|
static const GtkTypeInfo module_info_info =
|
||||||
{
|
{
|
||||||
"module_info",
|
"ModuleInfo",
|
||||||
sizeof (module_info),
|
sizeof (ModuleInfo),
|
||||||
sizeof (module_infoClass),
|
sizeof (ModuleInfoClass),
|
||||||
(GtkClassInitFunc) module_info_class_init,
|
(GtkClassInitFunc) module_info_class_init,
|
||||||
(GtkObjectInitFunc) module_info_init,
|
(GtkObjectInitFunc) module_info_init,
|
||||||
/* reserved_1 */ NULL,
|
/* reserved_1 */ NULL,
|
||||||
|
@ -431,8 +462,8 @@ module_info_get_type (void)
|
||||||
(GtkClassInitFunc) NULL,
|
(GtkClassInitFunc) NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
module_info_type = gtk_type_unique (gtk_object_get_type(),
|
module_info_type =
|
||||||
&module_info_info);
|
gtk_type_unique (gtk_object_get_type (), &module_info_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
return module_info_type;
|
return module_info_type;
|
||||||
|
@ -441,19 +472,19 @@ module_info_get_type (void)
|
||||||
/* exported API: */
|
/* exported API: */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_info_modified (module_info *mod)
|
module_info_modified (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
gtk_signal_emit (GTK_OBJECT (mod), module_info_signals[MODIFIED]);
|
gtk_signal_emit (GTK_OBJECT (mod), module_info_signals[MODIFIED]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static module_info *
|
static ModuleInfo *
|
||||||
module_info_new (void)
|
module_info_new (void)
|
||||||
{
|
{
|
||||||
return MODULE_INFO (gtk_type_new (module_info_get_type ()));
|
return MODULE_INFO (gtk_type_new (module_info_get_type ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_info_free (module_info *mod)
|
module_info_free (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
gtk_object_unref (GTK_OBJECT (mod));
|
gtk_object_unref (GTK_OBJECT (mod));
|
||||||
}
|
}
|
||||||
|
@ -465,10 +496,10 @@ module_info_free (module_info *mod)
|
||||||
|
|
||||||
/* name must be of the form lib*.so (Unix) or *.dll (Win32) */
|
/* name must be of the form lib*.so (Unix) or *.dll (Win32) */
|
||||||
static gboolean
|
static gboolean
|
||||||
valid_module_name (const char *filename)
|
valid_module_name (const gchar *filename)
|
||||||
{
|
{
|
||||||
const char *basename;
|
const gchar *basename;
|
||||||
int len;
|
gint len;
|
||||||
|
|
||||||
basename = g_basename (filename);
|
basename = g_basename (filename);
|
||||||
|
|
||||||
|
@ -496,12 +527,13 @@ valid_module_name (const char *filename)
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
module_inhibited (const char *fullpath,
|
module_inhibited (const gchar *fullpath,
|
||||||
const char *inhibit_list)
|
const gchar *inhibit_list)
|
||||||
{
|
{
|
||||||
char *p;
|
gchar *p;
|
||||||
int pathlen;
|
gint pathlen;
|
||||||
const char *start, *end;
|
const gchar *start;
|
||||||
|
const gchar *end;
|
||||||
|
|
||||||
/* common case optimisation: the list is empty */
|
/* common case optimisation: the list is empty */
|
||||||
if (!inhibit_list || *inhibit_list == '\000')
|
if (!inhibit_list || *inhibit_list == '\000')
|
||||||
|
@ -531,9 +563,9 @@ module_inhibited (const char *fullpath,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_initialize (char *filename)
|
module_initialize (gchar *filename)
|
||||||
{
|
{
|
||||||
module_info *mod;
|
ModuleInfo *mod;
|
||||||
|
|
||||||
if (!valid_module_name (filename))
|
if (!valid_module_name (filename))
|
||||||
return;
|
return;
|
||||||
|
@ -581,8 +613,8 @@ module_initialize (char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mod_load (module_info *mod,
|
mod_load (ModuleInfo *mod,
|
||||||
gboolean verbose)
|
gboolean verbose)
|
||||||
{
|
{
|
||||||
gpointer symbol;
|
gpointer symbol;
|
||||||
|
|
||||||
|
@ -632,12 +664,12 @@ mod_load (module_info *mod,
|
||||||
mod->info = NULL;
|
mod->info = NULL;
|
||||||
gimp_module_ref (mod); /* loaded modules are assumed to have a ref of 1 */
|
gimp_module_ref (mod); /* loaded modules are assumed to have a ref of 1 */
|
||||||
if (mod->init (&mod->info) == GIMP_MODULE_UNLOAD)
|
if (mod->init (&mod->info) == GIMP_MODULE_UNLOAD)
|
||||||
{
|
{
|
||||||
mod->state = ST_LOAD_FAILED;
|
mod->state = ST_LOAD_FAILED;
|
||||||
gimp_module_unref (mod);
|
gimp_module_unref (mod);
|
||||||
mod->info = NULL;
|
mod->info = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* module is now happy */
|
/* module is now happy */
|
||||||
mod->state = ST_LOADED_OK;
|
mod->state = ST_LOADED_OK;
|
||||||
|
@ -648,14 +680,13 @@ mod_load (module_info *mod,
|
||||||
mod->unload = symbol;
|
mod->unload = symbol;
|
||||||
else
|
else
|
||||||
mod->unload = NULL;
|
mod->unload = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mod_unload_completed_callback (void *data)
|
mod_unload_completed_callback (void *data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
|
|
||||||
g_return_if_fail (mod->state == ST_UNLOAD_REQUESTED);
|
g_return_if_fail (mod->state == ST_UNLOAD_REQUESTED);
|
||||||
|
|
||||||
|
@ -672,8 +703,8 @@ mod_unload_completed_callback (void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mod_unload (module_info *mod,
|
mod_unload (ModuleInfo *mod,
|
||||||
gboolean verbose)
|
gboolean verbose)
|
||||||
{
|
{
|
||||||
g_return_if_fail (mod->module != NULL);
|
g_return_if_fail (mod->module != NULL);
|
||||||
g_return_if_fail (mod->unload != NULL);
|
g_return_if_fail (mod->unload != NULL);
|
||||||
|
@ -694,31 +725,30 @@ mod_unload (module_info *mod,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DUMP_DB
|
#ifdef DUMP_DB
|
||||||
static void
|
static void
|
||||||
print_module_info (gpointer data,
|
print_module_info (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *i = data;
|
ModuleInfo *i = data;
|
||||||
|
|
||||||
printf ("\n%s: %s\n",
|
g_print ("\n%s: %s\n",
|
||||||
i->fullpath, statename[i->state]);
|
i->fullpath, statename[i->state]);
|
||||||
printf (" module:%p lasterr:%s init:%p unload:%p\n",
|
g_print (" module:%p lasterr:%s init:%p unload:%p\n",
|
||||||
i->module, i->last_module_error? i->last_module_error : "NONE",
|
i->module, i->last_module_error? i->last_module_error : "NONE",
|
||||||
i->init, i->unload);
|
i->init, i->unload);
|
||||||
if (i->info)
|
if (i->info)
|
||||||
{
|
{
|
||||||
printf (" shutdown_data: %p\n"
|
g_print (" shutdown_data: %p\n"
|
||||||
" purpose: %s\n"
|
" purpose: %s\n"
|
||||||
" author: %s\n"
|
" author: %s\n"
|
||||||
" version: %s\n"
|
" version: %s\n"
|
||||||
" copyright: %s\n"
|
" copyright: %s\n"
|
||||||
" date: %s\n",
|
" date: %s\n",
|
||||||
i->info->shutdown_data,
|
i->info->shutdown_data,
|
||||||
i->info->purpose, i->info->author, i->info->version,
|
i->info->purpose, i->info->author, i->info->version,
|
||||||
i->info->copyright, i->info->date);
|
i->info->copyright, i->info->date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -728,31 +758,31 @@ print_module_info (gpointer data,
|
||||||
/* UI functions */
|
/* UI functions */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_popdown_callback (GtkWidget *w,
|
browser_popdown_callback (GtkWidget *widget,
|
||||||
gpointer client_data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gtk_widget_destroy (GTK_WIDGET (client_data));
|
gtk_widget_destroy (GTK_WIDGET (data));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_destroy_callback (GtkWidget *w,
|
browser_destroy_callback (GtkWidget *widget,
|
||||||
gpointer client_data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), client_data);
|
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), data);
|
||||||
gimp_set_remove_handler (modules, modules_handler);
|
gimp_set_remove_handler (modules, modules_handler);
|
||||||
g_free (client_data);
|
g_free (data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_load_inhibit_callback (GtkWidget *w,
|
browser_load_inhibit_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
browser_st *st = data;
|
BrowserState *st = data;
|
||||||
gboolean new_value;
|
gboolean new_value;
|
||||||
|
|
||||||
g_return_if_fail (st->last_update != NULL);
|
g_return_if_fail (st->last_update != NULL);
|
||||||
|
|
||||||
new_value = ! GTK_TOGGLE_BUTTON (w)->active;
|
new_value = ! GTK_TOGGLE_BUTTON (widget)->active;
|
||||||
|
|
||||||
if (new_value == st->last_update->load_inhibit)
|
if (new_value == st->last_update->load_inhibit)
|
||||||
return;
|
return;
|
||||||
|
@ -764,59 +794,58 @@ browser_load_inhibit_callback (GtkWidget *w,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_info_update (module_info *mod,
|
browser_info_update (ModuleInfo *mod,
|
||||||
browser_st *st)
|
BrowserState *st)
|
||||||
{
|
{
|
||||||
int i;
|
gint i;
|
||||||
const char *text[NUM_INFO_LINES - 1];
|
const gchar *text[NUM_INFO_LINES - 1];
|
||||||
char *status;
|
gchar *status;
|
||||||
|
|
||||||
/* only update the info if we're actually showing it */
|
/* only update the info if we're actually showing it */
|
||||||
if (mod != st->last_update)
|
if (mod != st->last_update)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!mod)
|
if (!mod)
|
||||||
{
|
{
|
||||||
for (i=0; i < NUM_INFO_LINES; i++)
|
for (i=0; i < NUM_INFO_LINES; i++)
|
||||||
gtk_label_set_text (GTK_LABEL (st->label[i]), "");
|
gtk_label_set_text (GTK_LABEL (st->label[i]), "");
|
||||||
gtk_label_set_text (GTK_LABEL(st->button_label), _("<No modules>"));
|
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->button), FALSE);
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), FALSE);
|
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mod->info)
|
if (mod->info)
|
||||||
{
|
{
|
||||||
text[0] = mod->info->purpose;
|
text[0] = mod->info->purpose;
|
||||||
text[1] = mod->info->author;
|
text[1] = mod->info->author;
|
||||||
text[2] = mod->info->version;
|
text[2] = mod->info->version;
|
||||||
text[3] = mod->info->copyright;
|
text[3] = mod->info->copyright;
|
||||||
text[4] = mod->info->date;
|
text[4] = mod->info->date;
|
||||||
text[5] = mod->ondisk? _("on disk") : _("only in memory");
|
text[5] = mod->ondisk? _("on disk") : _("only in memory");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
text[0] = "--";
|
text[0] = "--";
|
||||||
text[1] = "--";
|
text[1] = "--";
|
||||||
text[2] = "--";
|
text[2] = "--";
|
||||||
text[3] = "--";
|
text[3] = "--";
|
||||||
text[4] = "--";
|
text[4] = "--";
|
||||||
text[5] = mod->ondisk? _("on disk") : _("nowhere (click 'refresh')");
|
text[5] = mod->ondisk? _("on disk") : _("nowhere (click 'refresh')");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (mod->state == ST_MODULE_ERROR && mod->last_module_error)
|
if (mod->state == ST_MODULE_ERROR && mod->last_module_error)
|
||||||
status = g_strdup_printf ("%s (%s)", gettext (statename[mod->state]),
|
status = g_strdup_printf ("%s (%s)", gettext (statename[mod->state]),
|
||||||
mod->last_module_error);
|
mod->last_module_error);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = g_strdup (gettext (statename[mod->state]));
|
status = g_strdup (gettext (statename[mod->state]));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i < NUM_INFO_LINES - 1; i++)
|
for (i=0; i < NUM_INFO_LINES - 1; i++)
|
||||||
{
|
{
|
||||||
gtk_label_set_text (GTK_LABEL (st->label[i]), gettext (text[i]));
|
gtk_label_set_text (GTK_LABEL (st->label[i]), gettext (text[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_label_set_text (GTK_LABEL (st->label[NUM_INFO_LINES-1]), status);
|
gtk_label_set_text (GTK_LABEL (st->label[NUM_INFO_LINES-1]), status);
|
||||||
|
|
||||||
|
@ -827,33 +856,36 @@ browser_info_update (module_info *mod,
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), TRUE);
|
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), TRUE);
|
||||||
|
|
||||||
/* work out what the button should do (if anything) */
|
/* work out what the button should do (if anything) */
|
||||||
switch (mod->state) {
|
switch (mod->state)
|
||||||
case ST_MODULE_ERROR:
|
{
|
||||||
case ST_LOAD_FAILED:
|
case ST_MODULE_ERROR:
|
||||||
case ST_UNLOADED_OK:
|
case ST_LOAD_FAILED:
|
||||||
gtk_label_set_text (GTK_LABEL(st->button_label), _("Load"));
|
case ST_UNLOADED_OK:
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->button), mod->ondisk);
|
gtk_label_set_text (GTK_LABEL(st->button_label), _("Load"));
|
||||||
break;
|
gtk_widget_set_sensitive (GTK_WIDGET (st->button), mod->ondisk);
|
||||||
|
break;
|
||||||
|
|
||||||
case ST_UNLOAD_REQUESTED:
|
case ST_UNLOAD_REQUESTED:
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->button), FALSE);
|
gtk_widget_set_sensitive (GTK_WIDGET (st->button), FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_LOADED_OK:
|
case ST_LOADED_OK:
|
||||||
gtk_label_set_text (GTK_LABEL(st->button_label), _("Unload"));
|
gtk_label_set_text (GTK_LABEL(st->button_label), _("Unload"));
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (st->button),
|
gtk_widget_set_sensitive (GTK_WIDGET (st->button),
|
||||||
mod->unload? TRUE : FALSE);
|
mod->unload? TRUE : FALSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_info_init (browser_st *st,
|
browser_info_init (BrowserState *st,
|
||||||
GtkWidget *table)
|
GtkWidget *table)
|
||||||
{
|
{
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
int i;
|
gint i;
|
||||||
char *text[] = {
|
|
||||||
|
gchar *text[] =
|
||||||
|
{
|
||||||
N_("Purpose:"),
|
N_("Purpose:"),
|
||||||
N_("Author:"),
|
N_("Author:"),
|
||||||
N_("Version:"),
|
N_("Version:"),
|
||||||
|
@ -864,22 +896,22 @@ browser_info_init (browser_st *st,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i=0; i < sizeof(text) / sizeof(char *); i++)
|
for (i=0; i < sizeof(text) / sizeof(char *); i++)
|
||||||
{
|
{
|
||||||
label = gtk_label_new (gettext (text[i]));
|
label = gtk_label_new (gettext (text[i]));
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
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_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
st->label[i] = gtk_label_new ("");
|
st->label[i] = gtk_label_new ("");
|
||||||
gtk_misc_set_alignment (GTK_MISC (st->label[i]), 0.0, 0.5);
|
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,
|
gtk_table_attach (GTK_TABLE (st->table), st->label[i], 1, 2, i, i+1,
|
||||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
|
||||||
gtk_widget_show (st->label[i]);
|
gtk_widget_show (st->label[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
st->load_inhibit_check =
|
st->load_inhibit_check =
|
||||||
gtk_check_button_new_with_label (_("Autoload during startup"));
|
gtk_check_button_new_with_label (_("Autoload during startup"));
|
||||||
gtk_widget_show (st->load_inhibit_check);
|
gtk_widget_show (st->load_inhibit_check);
|
||||||
gtk_table_attach (GTK_TABLE (table), st->load_inhibit_check,
|
gtk_table_attach (GTK_TABLE (table), st->load_inhibit_check,
|
||||||
0, 2, i, i+1,
|
0, 2, i, i+1,
|
||||||
|
@ -892,8 +924,8 @@ static void
|
||||||
browser_select_callback (GtkWidget *widget,
|
browser_select_callback (GtkWidget *widget,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
module_info *i;
|
ModuleInfo *i;
|
||||||
browser_st *st;
|
BrowserState *st;
|
||||||
|
|
||||||
i = gtk_object_get_user_data (GTK_OBJECT (child));
|
i = gtk_object_get_user_data (GTK_OBJECT (child));
|
||||||
st = gtk_object_get_user_data (GTK_OBJECT (widget));
|
st = gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||||
|
@ -911,7 +943,7 @@ static void
|
||||||
browser_load_unload_callback (GtkWidget *widget,
|
browser_load_unload_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
browser_st *st = data;
|
BrowserState *st = data;
|
||||||
|
|
||||||
if (st->last_update->state == ST_LOADED_OK)
|
if (st->last_update->state == ST_LOADED_OK)
|
||||||
mod_unload (st->last_update, FALSE);
|
mod_unload (st->last_update, FALSE);
|
||||||
|
@ -926,9 +958,9 @@ static void
|
||||||
make_list_item (gpointer data,
|
make_list_item (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *info = data;
|
ModuleInfo *info = data;
|
||||||
browser_st *st = user_data;
|
BrowserState *st = user_data;
|
||||||
GtkWidget *list_item;
|
GtkWidget *list_item;
|
||||||
|
|
||||||
if (!st->last_update)
|
if (!st->last_update)
|
||||||
st->last_update = info;
|
st->last_update = info;
|
||||||
|
@ -943,22 +975,22 @@ make_list_item (gpointer data,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_info_add (GimpSet *set,
|
browser_info_add (GimpSet *set,
|
||||||
module_info *mod,
|
ModuleInfo *mod,
|
||||||
browser_st *st)
|
BrowserState *st)
|
||||||
{
|
{
|
||||||
make_list_item (mod, st);
|
make_list_item (mod, st);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
browser_info_remove (GimpSet *set,
|
browser_info_remove (GimpSet *set,
|
||||||
module_info *mod,
|
ModuleInfo *mod,
|
||||||
browser_st *st)
|
BrowserState *st)
|
||||||
{
|
{
|
||||||
GList *dlist, *free_list;
|
GList *dlist, *free_list;
|
||||||
GtkWidget *list_item;
|
GtkWidget *list_item;
|
||||||
module_info *i;
|
ModuleInfo *i;
|
||||||
|
|
||||||
dlist = gtk_container_children (GTK_CONTAINER (st->list));
|
dlist = gtk_container_children (GTK_CONTAINER (st->list));
|
||||||
free_list = dlist;
|
free_list = dlist;
|
||||||
|
@ -990,10 +1022,10 @@ static void
|
||||||
module_db_module_ondisk (gpointer data,
|
module_db_module_ondisk (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
int ret;
|
gint ret;
|
||||||
int old_ondisk = mod->ondisk;
|
gint old_ondisk = mod->ondisk;
|
||||||
GSList **kill_list = user_data;
|
GSList **kill_list = user_data;
|
||||||
|
|
||||||
ret = stat (mod->fullpath, &statbuf);
|
ret = stat (mod->fullpath, &statbuf);
|
||||||
|
@ -1005,10 +1037,10 @@ module_db_module_ondisk (gpointer data,
|
||||||
/* if it's not on the disk, and it isn't in memory, mark it to be
|
/* if it's not on the disk, and it isn't in memory, mark it to be
|
||||||
* removed later. */
|
* removed later. */
|
||||||
if (!mod->ondisk && !mod->module)
|
if (!mod->ondisk && !mod->module)
|
||||||
{
|
{
|
||||||
*kill_list = g_slist_append (*kill_list, mod);
|
*kill_list = g_slist_append (*kill_list, mod);
|
||||||
mod = NULL;
|
mod = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mod && mod->ondisk != old_ondisk)
|
if (mod && mod->ondisk != old_ondisk)
|
||||||
module_info_modified (mod);
|
module_info_modified (mod);
|
||||||
|
@ -1019,7 +1051,7 @@ static void
|
||||||
module_db_module_remove (gpointer data,
|
module_db_module_remove (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
|
|
||||||
gimp_set_remove (modules, mod);
|
gimp_set_remove (modules, mod);
|
||||||
|
|
||||||
|
@ -1028,23 +1060,24 @@ module_db_module_remove (gpointer data,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
const char *search_key;
|
{
|
||||||
module_info *found;
|
const gchar *search_key;
|
||||||
|
ModuleInfo *found;
|
||||||
} find_by_path_closure;
|
} find_by_path_closure;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
module_db_path_cmp (gpointer data,
|
module_db_path_cmp (gpointer data,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
module_info *mod = data;
|
ModuleInfo *mod = data;
|
||||||
find_by_path_closure *cl = user_data;
|
find_by_path_closure *cl = user_data;
|
||||||
|
|
||||||
if (!strcmp (mod->fullpath, cl->search_key))
|
if (!strcmp (mod->fullpath, cl->search_key))
|
||||||
cl->found = mod;
|
cl->found = mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
static module_info *
|
static ModuleInfo *
|
||||||
module_find_by_path (const char *fullpath)
|
module_find_by_path (const char *fullpath)
|
||||||
{
|
{
|
||||||
find_by_path_closure cl;
|
find_by_path_closure cl;
|
||||||
|
@ -1078,7 +1111,7 @@ browser_refresh_callback (GtkWidget *widget,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_module_ref (module_info *mod)
|
gimp_module_ref (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
g_return_if_fail (mod->refs >= 0);
|
g_return_if_fail (mod->refs >= 0);
|
||||||
g_return_if_fail (mod->module != NULL);
|
g_return_if_fail (mod->module != NULL);
|
||||||
|
@ -1086,7 +1119,7 @@ gimp_module_ref (module_info *mod)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_module_unref (module_info *mod)
|
gimp_module_unref (ModuleInfo *mod)
|
||||||
{
|
{
|
||||||
g_return_if_fail (mod->refs > 0);
|
g_return_if_fail (mod->refs > 0);
|
||||||
g_return_if_fail (mod->module != NULL);
|
g_return_if_fail (mod->module != NULL);
|
||||||
|
@ -1094,11 +1127,11 @@ gimp_module_unref (module_info *mod)
|
||||||
mod->refs--;
|
mod->refs--;
|
||||||
|
|
||||||
if (mod->refs == 0)
|
if (mod->refs == 0)
|
||||||
{
|
{
|
||||||
TRC (("module %p refs hit 0, g_module_closing it\n", mod));
|
TRC (("module %p refs hit 0, g_module_closing it\n", mod));
|
||||||
g_module_close (mod->module);
|
g_module_close (mod->module);
|
||||||
mod->module = NULL;
|
mod->module = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* End of module_db.c */
|
/* End of module_db.c */
|
||||||
|
|
|
@ -17,14 +17,14 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __MODULE_DB_H__
|
#ifndef __MODULE_DB_H__
|
||||||
|
|
||||||
|
|
||||||
/* Load any modules we find on the module-path set in the gimprc */
|
/* Load any modules we find on the module-path set in the gimprc */
|
||||||
void module_db_init (void);
|
void module_db_init (void);
|
||||||
|
|
||||||
/* Unload all modules, in case a module needs some cleanups */
|
/* Unload all modules, in case a module needs some cleanups */
|
||||||
void module_db_free (void);
|
void module_db_free (void);
|
||||||
|
|
||||||
GtkWidget *module_db_browser_new (void);
|
GtkWidget *module_db_browser_new (void);
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,32 @@
|
||||||
|
2000-05-28 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* libgimp/libgimp-decl.txt
|
||||||
|
* libgimp/libgimp-docs.sgml
|
||||||
|
* libgimp/libgimp-sections.txt
|
||||||
|
* libgimp/tmpl/gimp.sgml
|
||||||
|
* libgimp/tmpl/gimpcolorbutton.sgml
|
||||||
|
* libgimp/tmpl/gimpcolordisplay.sgml
|
||||||
|
* libgimp/tmpl/gimpcolorselector.sgml
|
||||||
|
* libgimp/tmpl/gimpcolorspace.sgml
|
||||||
|
* libgimp/tmpl/gimpcompat.sgml
|
||||||
|
* libgimp/tmpl/gimpenums.sgml
|
||||||
|
* libgimp/tmpl/gimpfeatures.sgml
|
||||||
|
* libgimp/tmpl/gimplimits.sgml
|
||||||
|
* libgimp/tmpl/gimpmath.sgml
|
||||||
|
* libgimp/tmpl/gimpmodule.sgml
|
||||||
|
* libgimp/tmpl/gimpparasite.sgml
|
||||||
|
* libgimp/tmpl/gimpparasiteio.sgml
|
||||||
|
* libgimp/tmpl/gimppixmap.sgml
|
||||||
|
* libgimp/tmpl/gimpprotocol.sgml
|
||||||
|
* libgimp/tmpl/gimpsignal.sgml
|
||||||
|
* libgimp/tmpl/gimpui.sgml
|
||||||
|
* libgimp/tmpl/gimpunit.sgml
|
||||||
|
* libgimp/tmpl/gimputils.sgml
|
||||||
|
* libgimp/tmpl/gimpvector.sgml
|
||||||
|
* libgimp/tmpl/gimpwire.sgml
|
||||||
|
* libgimp/tmpl/libgimp-unused.sgml: Moved the module documentation
|
||||||
|
from the libgimp headers here, updates, cleanups.
|
||||||
|
|
||||||
2000-05-27 Michael Natterer <mitch@gimp.org>
|
2000-05-27 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* libgimp/*: lotsa files removed/added/changed to reflect the
|
* libgimp/*: lotsa files removed/added/changed to reflect the
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -66,6 +66,7 @@
|
||||||
|
|
||||||
<chapter id="libgimpui">
|
<chapter id="libgimpui">
|
||||||
<title>GIMP User Interface Library</title>
|
<title>GIMP User Interface Library</title>
|
||||||
|
&libgimp-gimpui;
|
||||||
&GimpChainButton;
|
&GimpChainButton;
|
||||||
&GimpColorButton;
|
&GimpColorButton;
|
||||||
&GimpFileSelection;
|
&GimpFileSelection;
|
||||||
|
@ -78,7 +79,6 @@
|
||||||
&libgimp-gimphelpui;
|
&libgimp-gimphelpui;
|
||||||
&libgimp-gimpmenu;
|
&libgimp-gimpmenu;
|
||||||
&libgimp-gimpquerybox;
|
&libgimp-gimpquerybox;
|
||||||
&libgimp-gimpui;
|
|
||||||
&libgimp-gimpwidgets;
|
&libgimp-gimpwidgets;
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,6 @@ gimp_parasite_find
|
||||||
gimp_parasite_attach
|
gimp_parasite_attach
|
||||||
gimp_attach_new_parasite
|
gimp_attach_new_parasite
|
||||||
gimp_parasite_detach
|
gimp_parasite_detach
|
||||||
gimp_plugin_help_func
|
|
||||||
gimp_help
|
gimp_help
|
||||||
gimp_plugin_help_register
|
gimp_plugin_help_register
|
||||||
gimp_plugin_domain_add_with_path
|
gimp_plugin_domain_add_with_path
|
||||||
|
@ -528,6 +527,7 @@ GimpColorSelector_SetColorFunc
|
||||||
GimpColorSelectorMethods
|
GimpColorSelectorMethods
|
||||||
GimpColorSelectorID
|
GimpColorSelectorID
|
||||||
gimp_color_selector_register
|
gimp_color_selector_register
|
||||||
|
GimpColorSelectorFinishedCB
|
||||||
gimp_color_selector_unregister
|
gimp_color_selector_unregister
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
|
@ -535,6 +535,9 @@ gimp_color_selector_unregister
|
||||||
<FILE>gimpmodule</FILE>
|
<FILE>gimpmodule</FILE>
|
||||||
GimpModuleStatus
|
GimpModuleStatus
|
||||||
GimpModuleInfo
|
GimpModuleInfo
|
||||||
|
GimpModuleInitFunc
|
||||||
|
GimpModuleCompletedCB
|
||||||
|
GimpModuleUnloadFunc
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
@ -631,6 +634,7 @@ gimp_image_disable_undo
|
||||||
gimp_image_enable_undo
|
gimp_image_enable_undo
|
||||||
gimp_image_freeze_undo
|
gimp_image_freeze_undo
|
||||||
gimp_image_thaw_undo
|
gimp_image_thaw_undo
|
||||||
|
gimp_plugin_help_func
|
||||||
Parasite
|
Parasite
|
||||||
PARASITE_PERSISTENT
|
PARASITE_PERSISTENT
|
||||||
PARASITE_UNDOABLE
|
PARASITE_UNDOABLE
|
||||||
|
|
|
@ -2,10 +2,13 @@
|
||||||
gimp
|
gimp
|
||||||
|
|
||||||
<!-- ##### SECTION Short_Description ##### -->
|
<!-- ##### SECTION Short_Description ##### -->
|
||||||
|
Main functions needed for building a GIMP plug-in. This header includes
|
||||||
|
all other GIMP Library headers.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Main functions needed for building a GIMP plug-in. This header includes
|
||||||
|
all other GIMP Library headers.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@ -2177,15 +2180,6 @@ gimp
|
||||||
@name:
|
@name:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gimp_plugin_help_func ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<!-- # Unused Parameters # -->
|
|
||||||
@help_data:
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gimp_help ##### -->
|
<!-- ##### FUNCTION gimp_help ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ Note that the color is changed in place.
|
||||||
|
|
||||||
<!-- ##### SECTION See_Also ##### -->
|
<!-- ##### SECTION See_Also ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
#libgimp-gimpcolorspace
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### STRUCT GimpColorButton ##### -->
|
<!-- ##### STRUCT GimpColorButton ##### -->
|
||||||
|
|
|
@ -2,16 +2,22 @@
|
||||||
gimpcolordisplay
|
gimpcolordisplay
|
||||||
|
|
||||||
<!-- ##### SECTION Short_Description ##### -->
|
<!-- ##### SECTION Short_Description ##### -->
|
||||||
|
Functions and definitiions for creating a pluggable GIMP
|
||||||
|
display color correction module.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Functions and definitiions for creating a pluggable GIMP
|
||||||
|
display color correction module.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### SECTION See_Also ##### -->
|
<!-- ##### SECTION See_Also ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
#GModule
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
#libgimp-gimpmodule
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### USER_FUNCTION GimpColorDisplayInit ##### -->
|
<!-- ##### USER_FUNCTION GimpColorDisplayInit ##### -->
|
||||||
|
|
|
@ -2,61 +2,91 @@
|
||||||
gimpcolorselector
|
gimpcolorselector
|
||||||
|
|
||||||
<!-- ##### SECTION Short_Description ##### -->
|
<!-- ##### SECTION Short_Description ##### -->
|
||||||
|
Functions and definitiions for creating a pluggable GIMP
|
||||||
|
color selector module.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Functions and definitiions for creating a pluggable GIMP
|
||||||
|
color selector module.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### SECTION See_Also ##### -->
|
<!-- ##### SECTION See_Also ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
#GModule
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
#libgimp-gimpmodule
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### USER_FUNCTION GimpColorSelector_Callback ##### -->
|
<!-- ##### USER_FUNCTION GimpColorSelector_Callback ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
A function of this type should be called by the color selector each
|
||||||
|
time the user modifies the selected color.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@data:
|
@data: The @data passed to the #GimpColorSelector_NewFunc function.
|
||||||
@r:
|
@r: The new color's red component.
|
||||||
@g:
|
@g: The new color's green component.
|
||||||
@b:
|
@b: The new color's blue component.
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### USER_FUNCTION GimpColorSelector_NewFunc ##### -->
|
<!-- ##### USER_FUNCTION GimpColorSelector_NewFunc ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
A function of this type is called to create a new instance of the
|
||||||
|
color selector. The new selector should set its current color to
|
||||||
|
the RGB triple given (each component is in the range 0 - 255
|
||||||
|
inclusive, with white at 255,255,255 and black at 0,0,0).
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
The selector should call @cb with argument @data each time the
|
||||||
|
user modifies the selected color.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
The selector must return a #GtkWidget which implements the color
|
||||||
|
selection UI. The selector can optionally return @selector_data,
|
||||||
|
an opaque pointer which will be passed in to subsequent invokations
|
||||||
|
on the selector.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@r:
|
@r: The red component of intitial color.
|
||||||
@g:
|
@g: The green component of intitial color.
|
||||||
@b:
|
@b: The blue component of intitial color.
|
||||||
@cb:
|
@cb: The function to call each time the user modifies the selected color.
|
||||||
@data:
|
@data: The @data to pass to @cb.
|
||||||
@selector_data:
|
@selector_data: An optional data pointer which will be passed in to subsequent invokations on the selector.
|
||||||
@Returns:
|
@Returns: A #GtkWidget which implements the color selection UI.
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### USER_FUNCTION GimpColorSelector_FreeFunc ##### -->
|
<!-- ##### USER_FUNCTION GimpColorSelector_FreeFunc ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
A function of this type is called when the color selector is no
|
||||||
|
longer required. This function should *not* free widgets that are
|
||||||
|
containted within the UI widget returned by new(), since they are
|
||||||
|
destroyed on behalf of the selector by the caller of this
|
||||||
|
function.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@selector_data:
|
@selector_data: The @selector_data pointer returned by the #GimpColorSelector_NewFunc function.
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### USER_FUNCTION GimpColorSelector_SetColorFunc ##### -->
|
<!-- ##### USER_FUNCTION GimpColorSelector_SetColorFunc ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
A function of this type is called to change the selector's current
|
||||||
|
color. The required color is specified as in the new() function.
|
||||||
|
If the @set_current parameter is #FALSE, then only the old color
|
||||||
|
should be set - if @set_current is #TRUE, both the old color and
|
||||||
|
the current color should be set to the RGB triple given. This
|
||||||
|
function merely gives a hint to the color selector; the selector
|
||||||
|
can choose to ignore this information.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@selector_data:
|
@selector_data: The @selector_data pointer returned by the #GimpColorSelector_NewFunc function.
|
||||||
@r:
|
@r: The new color's red component.
|
||||||
@g:
|
@g: The new color's green component.
|
||||||
@b:
|
@b: The new color's blue component.
|
||||||
@set_current:
|
@set_current: Set the current color.
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### STRUCT GimpColorSelectorMethods ##### -->
|
<!-- ##### STRUCT GimpColorSelectorMethods ##### -->
|
||||||
|
@ -73,23 +103,40 @@ gimpcolorselector
|
||||||
|
|
||||||
<!-- ##### FUNCTION gimp_color_selector_register ##### -->
|
<!-- ##### FUNCTION gimp_color_selector_register ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Register a color selector. Returns an identifier for the color
|
||||||
|
selector on success, or #NULL if the name is already in use. Both
|
||||||
|
the @name and @methods table are internalised, so may be g_free()'d after
|
||||||
|
this call.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@name:
|
@name: The color selector's name.
|
||||||
@help_page:
|
@help_page: The help page.
|
||||||
@methods:
|
@methods: The color selector's methods.
|
||||||
@Returns:
|
@Returns: The #GimpColorSelectorID of the new color selector.
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### USER_FUNCTION GimpColorSelectorFinishedCB ##### -->
|
||||||
|
<para>
|
||||||
|
A function of this type will be called once all instances of a color
|
||||||
|
selector have finished after the selector module called
|
||||||
|
gimp_color_selector_unregister().
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@finished_data: The @finished_data as specified in gimp_color_selector_register().
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gimp_color_selector_unregister ##### -->
|
<!-- ##### FUNCTION gimp_color_selector_unregister ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Remove the selector @id from active service. New instances of the
|
||||||
|
selector will not be created, but existing ones are allowed to
|
||||||
|
continue. If @finished_cb is non-#NULL, it will be called once all
|
||||||
|
instances have finished. The callback could be used to unload
|
||||||
|
dynamiclly loaded code, for example.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@id:
|
@id: The @id as returned by gimp_color_selector_register().
|
||||||
@callback:
|
@finished_cb: Optional callback which will be called once all instances have finished.
|
||||||
@data:
|
@finished_data: The @finished_data which will be passed to @finished_cb.
|
||||||
@Returns:
|
@Returns: #TRUE on success, #FALSE if @id was not found.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,14 @@
|
||||||
gimpcolorspace
|
gimpcolorspace
|
||||||
|
|
||||||
<!-- ##### SECTION Short_Description ##### -->
|
<!-- ##### SECTION Short_Description ##### -->
|
||||||
|
Utility functions which convert colors between different color models.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
When programming pixel data manipulation functions you will often use
|
||||||
|
algorithms operating on a color model different from the one GIMP
|
||||||
|
uses. This file provides utility functions to concert colors between
|
||||||
|
different color spaces.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ Compatibility definitions for older plug-ins.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Compatibility definitions for older plug-ins.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@ -147,6 +148,15 @@ Compatibility definitions for older plug-ins.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### MACRO gimp_plugin_help_func ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<!-- # Unused Parameters # -->
|
||||||
|
@help_data:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO Parasite ##### -->
|
<!-- ##### MACRO Parasite ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
gimpenums
|
gimpenums
|
||||||
|
|
||||||
<!-- ##### SECTION Short_Description ##### -->
|
<!-- ##### SECTION Short_Description ##### -->
|
||||||
|
Enums and definitions.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Enums and definitions.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,13 @@
|
||||||
gimpfeatures
|
gimpfeatures
|
||||||
|
|
||||||
<!-- ##### SECTION Short_Description ##### -->
|
<!-- ##### SECTION Short_Description ##### -->
|
||||||
|
Macros and constants useful for determining GIMP's version number and
|
||||||
|
capabilities.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Macros and constants useful for determining GIMP's version number and
|
||||||
|
capabilities.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
gimplimits
|
gimplimits
|
||||||
|
|
||||||
<!-- ##### SECTION Short_Description ##### -->
|
<!-- ##### SECTION Short_Description ##### -->
|
||||||
|
Boundaries of some GIMP data types and some global constants.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Boundaries of some GIMP data types and some global constants.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ Mathematical definitions and macros.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Mathematical definitions and macros.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
|
@ -2,16 +2,17 @@
|
||||||
gimpmodule
|
gimpmodule
|
||||||
|
|
||||||
<!-- ##### SECTION Short_Description ##### -->
|
<!-- ##### SECTION Short_Description ##### -->
|
||||||
|
Common definitions for creating a pluggable GIMP module.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Common definitions for creating a pluggable GIMP module.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### SECTION See_Also ##### -->
|
<!-- ##### SECTION See_Also ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
#GModule
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### ENUM GimpModuleStatus ##### -->
|
<!-- ##### ENUM GimpModuleStatus ##### -->
|
||||||
|
@ -26,3 +27,59 @@ gimpmodule
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### USER_FUNCTION GimpModuleInitFunc ##### -->
|
||||||
|
<para>
|
||||||
|
GIMP modules should #G_MODULE_EXPORT a function named "module_init"
|
||||||
|
of this type.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
The "module_init" function is called by the GIMP at startup,
|
||||||
|
and should return either #GIMP_MODULE_OK if it sucessfully initialised or
|
||||||
|
#GIMP_MODULE_UNLOAD if the module failed to hook whatever functions
|
||||||
|
it wanted. #GIMP_MODULE_UNLOAD causes the module to be closed, so
|
||||||
|
the module must not have registered any internal functions or given
|
||||||
|
out pointers to its data to anyone.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
If the module returns #GIMP_MODULE_OK, it should also return a
|
||||||
|
#GimpModuleInfo structure describing itself.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@module_info: Returns the #GimpModuleInfo desribing the module.
|
||||||
|
@Returns: A #GimpModuleStatus value indicating success.
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### USER_FUNCTION GimpModuleCompletedCB ##### -->
|
||||||
|
<para>
|
||||||
|
The type of the @completed_cb passed to the "module_unload" function
|
||||||
|
(see below).
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@completed_data: <para>
|
||||||
|
Must be the @completed_data pointer provided by the "module_unload"
|
||||||
|
function.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### USER_FUNCTION GimpModuleUnloadFunc ##### -->
|
||||||
|
<para>
|
||||||
|
If GIMP modules want to allow themselves to be unloaded, they
|
||||||
|
should #G_MODULE_EXPORT a function named "module_unload" of
|
||||||
|
this type.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
GIMP calls the "module_unload" unload request function to ask
|
||||||
|
a module to prepare itself to be unloaded. It is called with the
|
||||||
|
value of @shutdown_data supplied in the #GimpModuleInfo struct.
|
||||||
|
The module should ensure that none of its code or data are being
|
||||||
|
used, and then call the supplied @completed_cb callback function with
|
||||||
|
the @completed_data provided. Typically the shutdown request function
|
||||||
|
will queue de-registration activities then return. Only when the
|
||||||
|
de-registration has finished should the @completed_cb be invoked.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@shutdown_data: The @shutdown_data supplied in the #GimpModuleInfo struct.
|
||||||
|
@completed_cb: The function to call after successful unload.
|
||||||
|
@completed_data: Has to be passed to the @completed_cb.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,16 +2,18 @@
|
||||||
gimpparasite
|
gimpparasite
|
||||||
|
|
||||||
<!-- ##### SECTION Short_Description ##### -->
|
<!-- ##### SECTION Short_Description ##### -->
|
||||||
|
Arbitrary pieces of data which can be attached to various GIMP objects.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Arbitrary pieces of data which can be attached to various GIMP objects.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### SECTION See_Also ##### -->
|
<!-- ##### SECTION See_Also ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
gimp_image_parasite_attach(), gimp_drawable_parasite_attach(),
|
||||||
|
gimp_parasite_attach() and their related functions.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### STRUCT GimpParasite ##### -->
|
<!-- ##### STRUCT GimpParasite ##### -->
|
||||||
|
|
|
@ -2,16 +2,17 @@
|
||||||
gimpparasiteio
|
gimpparasiteio
|
||||||
|
|
||||||
<!-- ##### SECTION Short_Description ##### -->
|
<!-- ##### SECTION Short_Description ##### -->
|
||||||
|
Utility functions to (de)serialize certain C structures to/from #GimpParasite's.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Utility functions to (de)serialize certain C structures to/from #GimpParasite's.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### SECTION See_Also ##### -->
|
<!-- ##### SECTION See_Also ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
#GimpParasite
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### MACRO GIMP_PIXPIPE_MAXDIM ##### -->
|
<!-- ##### MACRO GIMP_PIXPIPE_MAXDIM ##### -->
|
||||||
|
|
|
@ -6,13 +6,25 @@ Widget which creates a #GtkPixmap from XPM data.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Widget which creates a #GtkPixmap from XPM data.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Use this widget instead of #GtkPixmap if you don't want to worry about
|
||||||
|
the parent container's "realized" state.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Note that the drawback of the easy interface is that the actual #GdkPixmap
|
||||||
|
and it's mask have to be constructed every time you call gimp_pixmap_new()
|
||||||
|
and cannot be cached in memory without doing bad hacks.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### SECTION See_Also ##### -->
|
<!-- ##### SECTION See_Also ##### -->
|
||||||
<para>
|
<para>
|
||||||
gimp_pixmap_button_new()
|
gimp_pixmap_button_new()
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
#GtkPixmap
|
||||||
|
</para>
|
||||||
|
|
||||||
<!-- ##### STRUCT GimpPixmap ##### -->
|
<!-- ##### STRUCT GimpPixmap ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
|
@ -2,16 +2,17 @@
|
||||||
gimpprotocol
|
gimpprotocol
|
||||||
|
|
||||||
<!-- ##### SECTION Short_Description ##### -->
|
<!-- ##### SECTION Short_Description ##### -->
|
||||||
|
The communication protocol between GIMP and it's plug-ins.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
The communication protocol between GIMP and it's plug-ins.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### SECTION See_Also ##### -->
|
<!-- ##### SECTION See_Also ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
#libgimp-gimpwire
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### MACRO GP_VERSION ##### -->
|
<!-- ##### MACRO GP_VERSION ##### -->
|
||||||
|
|
|
@ -6,6 +6,7 @@ Portable signal handling.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Portable signal handling.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,13 @@
|
||||||
gimpui
|
gimpui
|
||||||
|
|
||||||
<!-- ##### SECTION Short_Description ##### -->
|
<!-- ##### SECTION Short_Description ##### -->
|
||||||
Common user interface functions.
|
Common user interface functions. This header includes all other GIMP User
|
||||||
|
Interface Library headers.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Common user interface functions. This header includes all other GIMP User
|
||||||
|
Interface Library headers.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ user-defined units.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Provides a collection of predefined units and functions for creating
|
||||||
|
user-defined units.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ provide it here.
|
||||||
|
|
||||||
<!-- ##### SECTION See_Also ##### -->
|
<!-- ##### SECTION See_Also ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
g_strescape()
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### FUNCTION gimp_strescape ##### -->
|
<!-- ##### FUNCTION gimp_strescape ##### -->
|
||||||
|
|
|
@ -6,6 +6,7 @@ Utilities to set up and manipulate vectors.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
Utilities to set up and manipulate vectors.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
|
@ -2,16 +2,19 @@
|
||||||
gimpwire
|
gimpwire
|
||||||
|
|
||||||
<!-- ##### SECTION Short_Description ##### -->
|
<!-- ##### SECTION Short_Description ##### -->
|
||||||
|
The lowlevel I/O protocol used for communication between GIMP and
|
||||||
|
it's plug-ins.
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
<!-- ##### SECTION Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
The lowlevel I/O protocol used for communication between GIMP and
|
||||||
|
it's plug-ins.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### SECTION See_Also ##### -->
|
<!-- ##### SECTION See_Also ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
#libgimp-gimpprotocol
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### STRUCT WireMessage ##### -->
|
<!-- ##### STRUCT WireMessage ##### -->
|
||||||
|
|
|
@ -96,16 +96,16 @@ parasiteF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### SECTION ./tmpl/color_selector.sgml:Short_Description ##### -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### SECTION ./tmpl/parasiteF.sgml:Long_Description ##### -->
|
<!-- ##### SECTION ./tmpl/parasiteF.sgml:Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### SECTION ./tmpl/color_selector.sgml:Short_Description ##### -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### SECTION ./tmpl/parasiteio.sgml:See_Also ##### -->
|
<!-- ##### SECTION ./tmpl/parasiteio.sgml:See_Also ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
|
945
libgimp/gimp.h
945
libgimp/gimp.h
File diff suppressed because it is too large
Load diff
|
@ -62,14 +62,15 @@ struct _GimpColorDisplayMethods
|
||||||
GimpColorDisplayConfigureCancel cancel;
|
GimpColorDisplayConfigureCancel cancel;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* The following two functions are implemted and exported by gimp/app
|
/* The following two functions are implemted and exported by gimp/app
|
||||||
* but need to be marked for it here too ...
|
* but need to be marked for it here too ...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
G_MODULE_EXPORT
|
G_MODULE_EXPORT
|
||||||
gboolean gimp_color_display_register (const char *name,
|
gboolean gimp_color_display_register (const gchar *name,
|
||||||
GimpColorDisplayMethods *methods);
|
GimpColorDisplayMethods *methods);
|
||||||
G_MODULE_EXPORT
|
G_MODULE_EXPORT
|
||||||
gboolean gimp_color_display_unregister (const char *name);
|
gboolean gimp_color_display_unregister (const gchar *name);
|
||||||
|
|
||||||
#endif /* __GIMP_COLOR_DISPLAY_H__ */
|
#endif /* __GIMP_COLOR_DISPLAY_H__ */
|
||||||
|
|
|
@ -21,89 +21,55 @@
|
||||||
#ifndef __COLOR_SELECTOR_H__
|
#ifndef __COLOR_SELECTOR_H__
|
||||||
#define __COLOR_SELECTOR_H__
|
#define __COLOR_SELECTOR_H__
|
||||||
|
|
||||||
|
/* For information look at the html documentation */
|
||||||
/********************************/
|
|
||||||
/* color selector registration */
|
|
||||||
|
|
||||||
|
|
||||||
/* A function of this type should be called by the color selector each
|
typedef void (* GimpColorSelector_Callback) (gpointer data,
|
||||||
* time the user modifies the selected color. */
|
gint r,
|
||||||
typedef void (*GimpColorSelector_Callback)(void *data, int r, int g, int b);
|
gint g,
|
||||||
|
gint b);
|
||||||
|
|
||||||
|
typedef GtkWidget * (* GimpColorSelector_NewFunc) (gint r,
|
||||||
|
gint g,
|
||||||
|
gint b,
|
||||||
|
GimpColorSelector_Callback cb,
|
||||||
|
gpointer data,
|
||||||
|
gpointer *selector_data);
|
||||||
|
|
||||||
|
typedef void (* GimpColorSelector_FreeFunc) (gpointer selector_data);
|
||||||
|
|
||||||
|
|
||||||
/* A function of this type is called to create a new instance of the
|
typedef void (* GimpColorSelector_SetColorFunc) (gpointer selector_data,
|
||||||
* color selector. The new selector should set its current color to
|
gint r,
|
||||||
* the RGB triple given (each component is in the range 0 - 255
|
gint g,
|
||||||
* inclusive, with white at 255,255,255 and black at 0,0,0).
|
gint b,
|
||||||
*
|
gboolean set_current);
|
||||||
* The selector should call "cb" with argument "data" each time the
|
|
||||||
* user modifies the selected color.
|
|
||||||
*
|
|
||||||
* The selector must return a GtkWidget which implements the color
|
|
||||||
* selection UI. The selector can optionally return "selector_data",
|
|
||||||
* an opaque pointer which will be passed in to subsequent invokations
|
|
||||||
* on the selector. */
|
|
||||||
typedef GtkWidget * (*GimpColorSelector_NewFunc)(int r, int g, int b,
|
|
||||||
GimpColorSelector_Callback cb,
|
|
||||||
void *data,
|
|
||||||
void **selector_data);
|
|
||||||
|
|
||||||
/* A function of this type is called when the color selector is no
|
|
||||||
* longer required. This function should not free widgets that are
|
|
||||||
* containted within the UI widget returned by new(), since they are
|
|
||||||
* destroyed on behalf of the selector by the caller of this
|
|
||||||
* function. */
|
|
||||||
typedef void (*GimpColorSelector_FreeFunc)(void *selector_data);
|
|
||||||
|
|
||||||
|
|
||||||
/* A function of this type is called to change the selector's current
|
|
||||||
* color. The required color is specified as in the new() function.
|
|
||||||
* If the "set_current" parameter is FALSE, then only the old color
|
|
||||||
* should be set - if "set_current" is TRUE, both the old color and
|
|
||||||
* the current color should be set to the RGB triple given. This
|
|
||||||
* function merely gives a hint to the color selector; the selector
|
|
||||||
* can choose to ignore this information. */
|
|
||||||
typedef void (*GimpColorSelector_SetColorFunc)(void *selector_data,
|
|
||||||
int r, int g, int b,
|
|
||||||
int set_current);
|
|
||||||
|
|
||||||
typedef struct _GimpColorSelectorMethods GimpColorSelectorMethods;
|
typedef struct _GimpColorSelectorMethods GimpColorSelectorMethods;
|
||||||
|
|
||||||
struct _GimpColorSelectorMethods {
|
struct _GimpColorSelectorMethods
|
||||||
|
{
|
||||||
GimpColorSelector_NewFunc new;
|
GimpColorSelector_NewFunc new;
|
||||||
GimpColorSelector_FreeFunc free;
|
GimpColorSelector_FreeFunc free;
|
||||||
GimpColorSelector_SetColorFunc setcolor;
|
GimpColorSelector_SetColorFunc setcolor;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void *GimpColorSelectorID;
|
typedef gpointer GimpColorSelectorID;
|
||||||
|
|
||||||
#ifndef __COLOR_NOTEBOOK_C__ /* Bypass when compiling the source for
|
#ifndef __COLOR_NOTEBOOK_C__
|
||||||
* these functions. */
|
|
||||||
|
|
||||||
/* Register a color selector. Returns an identifier for the color
|
/* Bypass when compiling the source for these functions.
|
||||||
* selector on success, or NULL if the name is already in use. Both
|
*/
|
||||||
* the name and method table are internalised, so may be freed after
|
GimpColorSelectorID gimp_color_selector_register (const gchar *name,
|
||||||
* this call. */
|
const gchar *help_page,
|
||||||
GimpColorSelectorID gimp_color_selector_register (const char *name,
|
GimpColorSelectorMethods *methods);
|
||||||
const char *help_page,
|
|
||||||
GimpColorSelectorMethods *methods);
|
typedef void (* GimpColorSelectorFinishedCB) (gpointer finished_data);
|
||||||
|
|
||||||
|
gboolean gimp_color_selector_unregister (GimpColorSelectorID id,
|
||||||
|
GimpColorSelectorFinishedCB finished_cb,
|
||||||
|
gpointer finished_data);
|
||||||
|
|
||||||
/* Remove the selector "id" from active service. New instances of the
|
|
||||||
* selector will not be created, but existing ones are allowed to
|
|
||||||
* continue. If "callback" is non-NULL, it will be called once all
|
|
||||||
* instances have finished. The callback could be used to unload
|
|
||||||
* dynamiclly loaded code, for example.
|
|
||||||
*
|
|
||||||
* Returns TRUE on success, FALSE if "id" was not found. */
|
|
||||||
gboolean gimp_color_selector_unregister (GimpColorSelectorID id,
|
|
||||||
void (*callback)(void *data),
|
|
||||||
void *data);
|
|
||||||
#endif /* !__COLOR_NOTEBOOK_C__ */
|
#endif /* !__COLOR_NOTEBOOK_C__ */
|
||||||
|
|
||||||
#endif /* __COLOR_SELECTOR_H__ */
|
#endif /* __COLOR_SELECTOR_H__ */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* LIBGIMP - The GIMP Library
|
/* LIBGIMP - The GIMP Library
|
||||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||||
*
|
*
|
||||||
* gimpmatrix.h
|
* gimpmatrix.h
|
||||||
|
|
|
@ -19,74 +19,62 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GIMPMODULE_H__
|
#ifndef __GIMPMODULE_H__
|
||||||
#define __GIMPMODULE_H__
|
#define __GIMPMODULE_H__
|
||||||
|
|
||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
|
|
||||||
|
/* For information look at the html documentation */
|
||||||
|
|
||||||
typedef enum {
|
typedef enum
|
||||||
|
{
|
||||||
GIMP_MODULE_OK,
|
GIMP_MODULE_OK,
|
||||||
GIMP_MODULE_UNLOAD
|
GIMP_MODULE_UNLOAD
|
||||||
} GimpModuleStatus;
|
} GimpModuleStatus;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _GimpModuleInfo GimpModuleInfo;
|
||||||
|
|
||||||
typedef struct {
|
struct _GimpModuleInfo
|
||||||
void *shutdown_data;
|
{
|
||||||
const char *purpose;
|
gpointer shutdown_data;
|
||||||
const char *author;
|
|
||||||
const char *version;
|
const gchar *purpose;
|
||||||
const char *copyright;
|
const gchar *author;
|
||||||
const char *date;
|
const gchar *version;
|
||||||
} GimpModuleInfo;
|
const gchar *copyright;
|
||||||
|
const gchar *date;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Module initialization */
|
||||||
|
|
||||||
/* GIMP modules should G_MODULE_EXPORT a function named "module_init"
|
typedef GimpModuleStatus (* GimpModuleInitFunc) (GimpModuleInfo **module_info);
|
||||||
* of the following type: */
|
|
||||||
typedef GimpModuleStatus (GimpModuleInitFunc) (GimpModuleInfo **);
|
|
||||||
|
|
||||||
#ifndef MODULE_COMPILATION /* On Win32 this declaration clashes with
|
#ifndef MODULE_COMPILATION
|
||||||
* the definition (which uses G_MODULE_EXPORT)
|
|
||||||
* and thus should be bypassed when compiling
|
|
||||||
* the module itself.
|
|
||||||
*/
|
|
||||||
GimpModuleInitFunc module_init;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This function is called by the GIMP at startup, and should return
|
/* On Win32 this declaration clashes with the definition
|
||||||
* either GIMP_MODULE_OK if it sucessfully initialised or
|
* (which uses G_MODULE_EXPORT) and thus should be bypassed
|
||||||
* GIMP_MODULE_UNLOAD if the module failed to hook whatever functions
|
* when compiling the module itself.
|
||||||
* it wanted. GIMP_MODULE_UNLOAD causes the module to be closed, so
|
|
||||||
* the module must not have registered any internal functions or given
|
|
||||||
* out pointers to its data to anyone.
|
|
||||||
*
|
|
||||||
* If the module returns GIMP_MODULE_OK, it should also return a
|
|
||||||
* GimpModuleInfo structure describing itself.
|
|
||||||
*/
|
*/
|
||||||
|
GimpModuleInitFunc module_init;
|
||||||
|
|
||||||
|
#endif /* ! MODULE_COMPILATION */
|
||||||
|
|
||||||
|
|
||||||
/* If GIMP modules want to allow themselves to be unloaded, they
|
/* Module unload */
|
||||||
* should G_MODULE_EXPORT a function named "module_unload" with the
|
|
||||||
* following type: */
|
|
||||||
typedef void (GimpModuleUnloadFunc) (void *shutdown_data,
|
|
||||||
void (*completed_cb)(void *),
|
|
||||||
void *completed_data);
|
|
||||||
|
|
||||||
#ifndef MODULE_COMPILATION /* The same as for module_init */
|
typedef void (* GimpModuleCompletedCB) (gpointer completed_data);
|
||||||
|
|
||||||
|
typedef void (* GimpModuleUnloadFunc) (gpointer shutdown_data,
|
||||||
|
GimpModuleCompletedCB completed_cb,
|
||||||
|
gpointer completed_data);
|
||||||
|
|
||||||
|
#ifndef MODULE_COMPILATION
|
||||||
|
|
||||||
|
/* The same as for module_init.
|
||||||
|
*/
|
||||||
GimpModuleUnloadFunc module_unload;
|
GimpModuleUnloadFunc module_unload;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* GIMP calls this unload request function to ask a module to
|
|
||||||
* prepare itself to be unloaded. It is called with the value of
|
|
||||||
* shutdown_data supplied in the GimpModuleInfo struct. The module
|
|
||||||
* should ensure that none of its code or data are being used, and
|
|
||||||
* then call the supplied "completed_cb" callback function with the
|
|
||||||
* data provided. Typically the shutdown request function will queue
|
|
||||||
* de-registration activities then return. Only when the
|
|
||||||
* de-registration has finished should the completed_cb be invoked. */
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ! MODULE_COMPILATION */
|
||||||
|
|
||||||
#endif /* __GIMPMODULE_H__ */
|
#endif /* __GIMPMODULE_H__ */
|
||||||
|
|
|
@ -96,8 +96,8 @@ gimp_unit_get_number_of_units (void)
|
||||||
* gimp_unit_get_number_of_built_in_units:
|
* gimp_unit_get_number_of_built_in_units:
|
||||||
*
|
*
|
||||||
* Returns the number of #GimpUnit's which are hardcoded in the unit system
|
* Returns the number of #GimpUnit's which are hardcoded in the unit system
|
||||||
* (UNIT_INCH, UNIT_MM, UNIT_POINT, UNIT_PICA and the two "pseudo units"
|
* (UNIT_INCH, UNIT_MM, UNIT_POINT, UNIT_PICA and the two "pseudo unit"
|
||||||
* UNIT_PIXEL and UNIT_PERCENT).
|
* UNIT_PIXEL).
|
||||||
*
|
*
|
||||||
* Returns: The number of built-in units.
|
* Returns: The number of built-in units.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue