gimp/app/dialogs/module-dialog.c

1170 lines
28 KiB
C
Raw Normal View History

/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* module_db.c (C) 1999 Austin Donnelly <austin@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib.h>
#include <stdio.h>
#include <string.h>
1999-04-30 23:04:38 +08:00
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <time.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
Makefile.am configure.in added the new library below. 2001-01-24 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool.in: added the new library below. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.[ch] * libgimpwidgets/gimpcolorbutton.[ch] * libgimpwidgets/gimpdialog.[ch] * libgimpwidgets/gimpfileselection.[ch] * libgimpwidgets/gimphelpui.[ch] * libgimpwidgets/gimppatheditor.[ch] * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpquerybox.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch] * libgimpwidgets/gimpwidgets.[ch] * libgimpwidgets/gimpwidgets.def * libgimpwidgets/gimpwidgetstypes.h: new shared library. Currently there are some ugly dependencies into libgimp. These will be removed and go to a "libgimpglue" library which will be a library for functions which share a common interface between plug-ins and the app but have different implementations. Include "libgimp/gimpunit.h" from "libgimpwidgets/gimpwidgetstypes.h" to simulate this upcoming separation. * libgimp/Makefile.am * libgimp/gimpchainbutton.[ch] * libgimp/gimpcolorarea.[ch] * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimpfileselection.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimppixmap.[ch] * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: removed from here. * libgimp/gimpui.h * libgimp/gimpuitypes.h * libgimp/makefile.mingw.in * libgimp/makefile.msc: changed accordingly. * app/[all ui files] * app/pdb/palette_cmds.c * app/pdb/tools_cmds.c * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/tools.pdb: #include "libgimpwidgets/gimpwidgets.h" and removed useless includes. * app/apptypes.h: #include "libgimpwidgets/gimpwidgetstypes.h" * app/Makefile.am * plug-ins/[all makefiles which link against libgimpui]: link against libgimpwidgets.la * po-libgimp/POTFILES.in: changed file locations.
2001-01-25 06:36:18 +08:00
#include "libgimpwidgets/gimpwidgets.h"
#include "core/core-types.h"
app/Makefile.am app/gimpunit.c removed... 2001-07-11 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimpunit.c * app/unitrc.h: removed... * app/core/Makefile.am * app/core/gimpunit.[ch]: ...re-added here. * app/core/gimp.[ch]: added the image and drawable hash tables, next_image_ID, next_guide_ID and next_drawable_ID, added a GimpCoreConfig pointer which is now initalized dynamically. * app/core/gimpcoreconfig.[ch]: don't provide a global core_config variable any more (need to access gimp->config now). * app/gdisplay.[ch] * app/core/gimpdrawable.[ch] * app/core/gimpimage.[ch]: removed all global variables from gimpimage.c and gimpdrawable.c, pass a Gimp* to all *_get_by_ID() functions. * tools/pdbgen/app.pl: pass Gimp* to all _get_by_ID() functions. * app/app_procs.c * app/file-open.c * app/file-save.c * app/gimprc.c * app/libgimp_glue.c * app/module_db.c * app/plug_in.c * app/undo.c * app/user_install.c * app/core/core-types.h * app/core/gimpcontext.c * app/core/gimpimage-crop.c * app/core/gimpimage-new.c * app/core/gimpparasite.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/info-window.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * app/widgets/gimpdnd.c * app/pdb/channel_cmds.c * app/pdb/color_cmds.c * app/pdb/convert_cmds.c * app/pdb/display_cmds.c * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * app/pdb/fileops_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/guides_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/parasite_cmds.c * app/pdb/paths_cmds.c * app/pdb/selection_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/tools_cmds.c * app/pdb/undo_cmds.c * app/pdb/unit_cmds.c * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/unit.pdb: changed accordingly.
2001-07-11 20:39:49 +08:00
#include "core/gimp.h"
app/Makefile.am removed. 2001-07-07 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/context_manager.[ch]: removed. * app/app_procs.c: call tool_mananger instead of context_manager functions, pass "the_gimp" to some more functions. * app/drawable.[ch]: pass a GimpContext to drawable_fill(). * app/errors.c: behave according to "stack_trace_mode" when using the debugging signal handler. * app/gimprc.[ch]: removed the core/ config variables. * app/selection.c: set the selection's state to INVISIBLE in selection_pause(). * app/core/Makefile.am * app/core/gimpcoreconfig.[ch]: new files (the configuration variables used by core/). * app/core/gimpcontext.[ch]: removed the global contexts (user, default, ...) and their functions. It's no longer possible to pass NULL to the context functions to manipulate the current context (gimpcontext.c doesn't know the current context any more). * app/core/gimp.[ch]: added them here. The functions are now called gimp_[set|get]_*_context(). Added gimp_create_context() which is the only function to create contexts now. * app/gui/dialogs.[ch] * app/gui/gui.[ch]: pass "gimp" to all functions. * app/tools/tool_manager.[ch] * app/tools/tools.[ch]: pass "gimp" to lots of functions. Added the "global_tool_context" logic and the global/non-global paint options switching from the context_manager. Pass "gimp" to all tools' "register" functions. * app/tools/*: changed accordingly. * app/devices.c * app/disp_callbacks.c * app/file-open.[ch] * app/file-save.c * app/gdisplay.c * app/gimage.c * app/libgimp_glue.c * app/module_db.c * app/nav_window.c * app/plug_in.c * app/qmask.c * app/undo.c * app/base/base-config.c * app/core/gimpbrushpipe.c * app/core/gimpdrawable-offset.c * app/core/gimpgradient.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimppalette.c * app/core/gimptoolinfo.[ch] * app/core/gimpundo.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/dialogs-constructors.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/gradient-editor.c * app/gui/gradient-select.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/menus.c * app/gui/palette-editor.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/paths-dialog.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.c * app/gui/test-commands.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/gui/tools-commands.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/widgets/gimpchannellistview.c * app/widgets/gimpdnd.c * app/widgets/gimpdrawablelistview.[ch] * app/widgets/gimpimagedock.c * app/widgets/gimplayerlistview.c * app/pdb/brushes_cmds.c * app/pdb/drawable_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/palette_cmds.c * app/pdb/patterns_cmds.c * app/pdb/procedural_db.c * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly: remove usage of gimp_context_[get|set]_*(NULL), create contexts with gimp_create_context(). Get the user/current context with gimp_get_[user|current]_context(). Added/removed access to the global "the_gimp" variable in some places. Get the core's config variables from "core_config".
2001-07-07 20:17:23 +08:00
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimplist.h"
app/Makefile.am app/gimpunit.c removed... 2001-07-11 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimpunit.c * app/unitrc.h: removed... * app/core/Makefile.am * app/core/gimpunit.[ch]: ...re-added here. * app/core/gimp.[ch]: added the image and drawable hash tables, next_image_ID, next_guide_ID and next_drawable_ID, added a GimpCoreConfig pointer which is now initalized dynamically. * app/core/gimpcoreconfig.[ch]: don't provide a global core_config variable any more (need to access gimp->config now). * app/gdisplay.[ch] * app/core/gimpdrawable.[ch] * app/core/gimpimage.[ch]: removed all global variables from gimpimage.c and gimpdrawable.c, pass a Gimp* to all *_get_by_ID() functions. * tools/pdbgen/app.pl: pass Gimp* to all _get_by_ID() functions. * app/app_procs.c * app/file-open.c * app/file-save.c * app/gimprc.c * app/libgimp_glue.c * app/module_db.c * app/plug_in.c * app/undo.c * app/user_install.c * app/core/core-types.h * app/core/gimpcontext.c * app/core/gimpimage-crop.c * app/core/gimpimage-new.c * app/core/gimpparasite.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/info-window.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * app/widgets/gimpdnd.c * app/pdb/channel_cmds.c * app/pdb/color_cmds.c * app/pdb/convert_cmds.c * app/pdb/display_cmds.c * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * app/pdb/fileops_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/guides_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/parasite_cmds.c * app/pdb/paths_cmds.c * app/pdb/selection_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/tools_cmds.c * app/pdb/undo_cmds.c * app/pdb/unit_cmds.c * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/unit.pdb: changed accordingly.
2001-07-11 20:39:49 +08:00
#include "app_procs.h"
#include "appenv.h"
#include "module_db.h"
app/Makefile.am removed. 2001-07-07 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/context_manager.[ch]: removed. * app/app_procs.c: call tool_mananger instead of context_manager functions, pass "the_gimp" to some more functions. * app/drawable.[ch]: pass a GimpContext to drawable_fill(). * app/errors.c: behave according to "stack_trace_mode" when using the debugging signal handler. * app/gimprc.[ch]: removed the core/ config variables. * app/selection.c: set the selection's state to INVISIBLE in selection_pause(). * app/core/Makefile.am * app/core/gimpcoreconfig.[ch]: new files (the configuration variables used by core/). * app/core/gimpcontext.[ch]: removed the global contexts (user, default, ...) and their functions. It's no longer possible to pass NULL to the context functions to manipulate the current context (gimpcontext.c doesn't know the current context any more). * app/core/gimp.[ch]: added them here. The functions are now called gimp_[set|get]_*_context(). Added gimp_create_context() which is the only function to create contexts now. * app/gui/dialogs.[ch] * app/gui/gui.[ch]: pass "gimp" to all functions. * app/tools/tool_manager.[ch] * app/tools/tools.[ch]: pass "gimp" to lots of functions. Added the "global_tool_context" logic and the global/non-global paint options switching from the context_manager. Pass "gimp" to all tools' "register" functions. * app/tools/*: changed accordingly. * app/devices.c * app/disp_callbacks.c * app/file-open.[ch] * app/file-save.c * app/gdisplay.c * app/gimage.c * app/libgimp_glue.c * app/module_db.c * app/nav_window.c * app/plug_in.c * app/qmask.c * app/undo.c * app/base/base-config.c * app/core/gimpbrushpipe.c * app/core/gimpdrawable-offset.c * app/core/gimpgradient.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimppalette.c * app/core/gimptoolinfo.[ch] * app/core/gimpundo.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/dialogs-constructors.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/gradient-editor.c * app/gui/gradient-select.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/menus.c * app/gui/palette-editor.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/paths-dialog.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.c * app/gui/test-commands.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/gui/tools-commands.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/widgets/gimpchannellistview.c * app/widgets/gimpdnd.c * app/widgets/gimpdrawablelistview.[ch] * app/widgets/gimpimagedock.c * app/widgets/gimplayerlistview.c * app/pdb/brushes_cmds.c * app/pdb/drawable_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/palette_cmds.c * app/pdb/patterns_cmds.c * app/pdb/procedural_db.c * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly: remove usage of gimp_context_[get|set]_*(NULL), create contexts with gimp_create_context(). Get the user/current context with gimp_get_[user|current]_context(). Added/removed access to the global "the_gimp" variable in some places. Get the core's config variables from "core_config".
2001-07-07 20:17:23 +08:00
#include "gimprc.h"
#include "libgimp/gimpmodule.h"
#include "libgimp/gimpintl.h"
typedef enum
{
ST_MODULE_ERROR, /* missing module_load function or other error */
ST_LOADED_OK, /* happy and running (normal state of affairs) */
ST_LOAD_FAILED, /* module_load returned GIMP_MODULE_UNLOAD */
ST_UNLOAD_REQUESTED, /* sent unload request, waiting for callback */
ST_UNLOADED_OK /* callback arrived, module not in memory anymore */
} module_state;
static const gchar * const statename[] =
{
N_("Module error"),
N_("Loaded OK"),
N_("Load failed"),
N_("Unload requested"),
N_("Unloaded OK")
};
1999-04-30 23:04:38 +08:00
#ifdef __EMX__
extern void gimp_color_selector_register ();
extern void gimp_color_selector_unregister ();
extern void dialog_register ();
extern void dialog_unregister ();
static struct main_funcs_struc
{
1999-04-30 23:04:38 +08:00
gchar *name;
void (*func) ();
}
gimp_main_funcs[] =
{
{ "gimp_color_selector_register", gimp_color_selector_register },
1999-04-30 23:04:38 +08:00
{ "gimp_color_selector_unregister", gimp_color_selector_unregister },
{ "dialog_register", dialog_register },
{ "dialog_unregister", dialog_unregister },
1999-04-30 23:04:38 +08:00
{ NULL, NULL }
};
#endif
/* one of these objects is kept per-module */
typedef struct
{
GtkObject parent_instance;
gchar *fullpath; /* path to the module */
module_state state; /* what's happened to the module */
gboolean ondisk; /* TRUE if file still exists */
gboolean load_inhibit; /* user requests not to load at boot time */
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 */
GimpModuleInfo *info; /* returned values from module_init */
GModule *module; /* handle on the module */
gchar *last_module_error;
GimpModuleInitFunc init;
GimpModuleUnloadFunc unload;
} ModuleInfo;
static guint module_info_get_type (void);
#define MODULE_INFO_TYPE (module_info_get_type ())
#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 NUM_INFO_LINES 7
typedef struct
{
GtkWidget *table;
GtkWidget *label[NUM_INFO_LINES];
GtkWidget *button_label;
ModuleInfo *last_update;
GtkWidget *button;
GtkWidget *list;
GtkWidget *load_inhibit_check;
} BrowserState;
/* global set of module_info pointers */
static GimpContainer *modules;
static GQuark modules_handler_id;
/* If the inhibit state of any modules changes, we might need to
* re-write the modulerc.
*/
static gboolean need_to_rewrite_modulerc = FALSE;
/* debug control: */
/*#define DUMP_DB*/
/*#define DEBUG*/
#ifdef DEBUG
#undef DUMP_DB
#define DUMP_DB
#define TRC(x) printf x
#else
#define TRC(x)
#endif
/* prototypes */
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
static void module_initialize (const gchar *filename,
gpointer loader_data);
static void mod_load (ModuleInfo *mod,
gboolean verbose);
static void mod_unload (ModuleInfo *mod,
gboolean verbose);
static gboolean mod_idle_unref (ModuleInfo *mod);
static ModuleInfo * module_find_by_path (const gchar *fullpath);
#ifdef DUMP_DB
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 (GimpContainer *container,
ModuleInfo *mod,
BrowserState *st);
static void browser_info_remove (GimpContainer *container,
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);
/**************************************************************/
/* Exported functions */
void
module_db_init (void)
{
gchar *filename;
/* load the modulerc file */
filename = gimp_personal_rc_file ("modulerc");
removed the gimp_busy boolean, check whether user_installation is needed 2001-07-10 Michael Natterer <mitch@gimp.org> * app/app_procs.[ch]: removed the gimp_busy boolean, check whether user_installation is needed here, not in user_install.c, parse gtkrc an friends only if(!no_interface), create the Gimp object before parsing gimp's rc files an pas it to the parse functions, many other cleanups. * app/appenums.h: added MessageHandlerType and StackTraceMode. * app/appenv.h: removed MessageHandlerType, declare all global variables from main.c (no more hidden global stuff please). * app/errors.[ch]: added the fatal message func here (from main.c), removed the StackTraceMode enum. * app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp pointer to some functions. * app/gimpunit.c * app/unitrc.h: ok, this is ugly: renamed all functions to _gimp_unit_*() and made them public. The unit list is part of the Gimp object now, so pass a Gimp* to all functions. * app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*() functions which are used by widgets. * app/main.c: cleaned up the global variables, removed the fatal message handler, call app_init() directly, not via the user_install stuff, misc. cleanups. * app/user_install.[ch]: removed the check if user_installation is needed (done by app_procs.c now). * app/core/gimp.[ch]: added the user_unit list and the "busy" boolean. Moved gimp_[set|unset]_busy() here. Added gimp_initialize() which is called after unitrc and gimprc are parsed. * app/batch.c * app/colormaps.c * app/devices.c * app/disp_callbacks.c * app/gdisplay_ops.c * app/gimphelp.c * app/module_db.c * app/nav_window.c * app/plug_in.c * app/core/gimpcontext.c * app/core/gimpdatafiles.c * app/core/gimpimage-convert.c * app/core/gimpimage-duplicate.c * app/core/gimpimage.c * app/core/gimpparasite.c * app/core/gimpparasitelist.h * app/gui/file-open-dialog.c * app/gui/gui.[ch] * app/gui/info-dialog.c * app/gui/info-window.c * app/gui/preferences-dialog.c * app/gui/session.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimptransformtool.c * app/tools/tool_manager.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcursor.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/Makefile.am * tools/pdbgen/app.pl * tools/pdbgen/enums.pl * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/unit.pdb * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
gimprc_parse_file (filename);
g_free (filename);
/* Load and initialize gimp modules */
modules = gimp_list_new (MODULE_INFO_TYPE, GIMP_CONTAINER_POLICY_WEAK);
if (g_module_supported ())
app/Makefile.am app/gimpunit.c removed... 2001-07-11 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimpunit.c * app/unitrc.h: removed... * app/core/Makefile.am * app/core/gimpunit.[ch]: ...re-added here. * app/core/gimp.[ch]: added the image and drawable hash tables, next_image_ID, next_guide_ID and next_drawable_ID, added a GimpCoreConfig pointer which is now initalized dynamically. * app/core/gimpcoreconfig.[ch]: don't provide a global core_config variable any more (need to access gimp->config now). * app/gdisplay.[ch] * app/core/gimpdrawable.[ch] * app/core/gimpimage.[ch]: removed all global variables from gimpimage.c and gimpdrawable.c, pass a Gimp* to all *_get_by_ID() functions. * tools/pdbgen/app.pl: pass Gimp* to all _get_by_ID() functions. * app/app_procs.c * app/file-open.c * app/file-save.c * app/gimprc.c * app/libgimp_glue.c * app/module_db.c * app/plug_in.c * app/undo.c * app/user_install.c * app/core/core-types.h * app/core/gimpcontext.c * app/core/gimpimage-crop.c * app/core/gimpimage-new.c * app/core/gimpparasite.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/info-window.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * app/widgets/gimpdnd.c * app/pdb/channel_cmds.c * app/pdb/color_cmds.c * app/pdb/convert_cmds.c * app/pdb/display_cmds.c * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * app/pdb/fileops_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/guides_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/parasite_cmds.c * app/pdb/paths_cmds.c * app/pdb/selection_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/tools_cmds.c * app/pdb/undo_cmds.c * app/pdb/unit_cmds.c * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/unit.pdb: changed accordingly.
2001-07-11 20:39:49 +08:00
gimp_datafiles_read_directories (the_gimp->config->module_path, 0 /* no flags */,
module_initialize, NULL);
#ifdef DUMP_DB
gimp_container_foreach (modules, print_module_info, NULL);
#endif
}
1999-04-15 03:51:49 +08:00
static void
free_a_single_module (gpointer data,
gpointer user_data)
1999-04-15 03:51:49 +08:00
{
ModuleInfo *mod = data;
1999-04-15 03:51:49 +08:00
if (mod->module && mod->unload && mod->state == ST_LOADED_OK)
{
mod_unload (mod, FALSE);
}
1999-04-15 03:51:49 +08:00
}
static void
add_to_inhibit_string (gpointer data,
gpointer user_data)
1999-04-15 03:51:49 +08:00
{
ModuleInfo *mod = data;
GString *str = user_data;
if (mod->load_inhibit)
1999-04-15 03:51:49 +08:00
{
str = g_string_append_c (str, G_SEARCHPATH_SEPARATOR);
str = g_string_append (str, mod->fullpath);
1999-04-15 03:51:49 +08:00
}
}
1999-11-13 00:34:37 +08:00
static gboolean
module_db_write_modulerc (void)
{
GString *str;
gchar *p;
gchar *filename;
FILE *fp;
gboolean saved = FALSE;
str = g_string_new (NULL);
gimp_container_foreach (modules, add_to_inhibit_string, str);
if (str->len > 0)
p = str->str + 1;
else
p = "";
filename = gimp_personal_rc_file ("modulerc");
1999-11-13 00:34:37 +08:00
fp = fopen (filename, "wt");
g_free (filename);
if (fp)
{
fprintf (fp, "(module-load-inhibit \"%s\")\n", p);
fclose (fp);
1999-11-13 00:34:37 +08:00
saved = TRUE;
}
g_string_free (str, TRUE);
1999-11-13 00:34:37 +08:00
return (saved);
}
1999-04-15 03:51:49 +08:00
void
module_db_free (void)
{
1999-11-13 00:34:37 +08:00
if (need_to_rewrite_modulerc)
{
1999-11-13 00:34:37 +08:00
if (module_db_write_modulerc ())
{
1999-11-13 00:34:37 +08:00
need_to_rewrite_modulerc = FALSE;
}
}
gimp_container_foreach (modules, free_a_single_module, NULL);
1999-04-15 03:51:49 +08:00
}
GtkWidget *
module_db_browser_new (void)
{
GtkWidget *shell;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *listbox;
GtkWidget *button;
BrowserState *st;
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
shell = gimp_dialog_new (_("Module DB"), "module_db_dialog",
gimp_standard_help_func,
The GIMP Help System part II: press "F1" while browsing a menu to show the 1999-10-03 Michael Natterer <mitch@gimp.org> The GIMP Help System part II: press "F1" while browsing a menu to show the help page for the menu entry you're currently over with the mouse. * app/color_notebook.c: all color selectors have to register with a help page now. * app/color_select.[ch]: register with a help string. Removed the dialog part of the files because it's use was deprecated anyway (use color notebooks instead). * app/colormap_dialog.i.c * app/colormap_dialog.p.h * app/palette.c * app/palette_select.c: use a color notebook instead of a color selector. * app/gimphelp.c * app/gimpui.c: minor changes. * app/gimprc.c: "use help" defaults to TRUE now. * app/lc_dialog.c * app/lc_dialogP.h: a special help function which shows the help for the currently selected notebook page. * app/menus.c: some weird code which catches "key_press_event" in all menu shells and pops up the corresp. help page for the selected item. Embedded the GtkItemFactoryEntry in a new GimpItemFactoryEntry to allow a help path to be stored. Will be partially exported and moved to gimphelp.[ch] later to catch key_press for plug-in menu items (don't try this now ;-) * app/app_procs.c * app/brush_edit.c * app/brush_select.c * app/channel_ops.c * app/channels_dialog.c * app/commands.c * app/convert.c * app/devices.c * app/file_new_dialog.c * app/fileops.c * app/gdisplay.c * app/gdisplay_color.c * app/gdisplay_color_ui.c * app/gdisplay_ops.c * app/global_edit.c * app/gradient.c * app/gradient_select.c * app/interface.c * app/layers_dialog.c * app/module_db.c * app/paths_dialog.c * app/pattern_select.c * app/preferences_dialog.c * app/qmask.c * app/resize.c * app/undo_history.c: changed all dialog constructors to point to the right place in the new help file structure. * configure.in * help/*: the basic new help file structure. * modules/colorsel_gtk.c * modules/colorsel_triangle.c * modules/colorsel_water.c: register a help page. * plug-ins/helpbrowser/helpbrowser.c: load the help files according to the new help file structure.
1999-10-03 21:50:19 +08:00
"dialogs/module_browser.html",
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
_("OK"), browser_popdown_callback,
NULL, NULL, NULL, TRUE, TRUE,
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
NULL);
vbox = gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (shell)->vbox), vbox);
gtk_widget_show (vbox);
listbox = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (listbox),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (vbox), listbox, TRUE, TRUE, 0);
gtk_widget_set_usize (listbox, 125, 100);
gtk_widget_show (listbox);
st = g_new0 (BrowserState, 1);
st->list = gtk_list_new ();
gtk_list_set_selection_mode (GTK_LIST (st->list), GTK_SELECTION_BROWSE);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (listbox),
st->list);
gimp_container_foreach (modules, make_list_item, st);
gtk_widget_show (st->list);
st->table = gtk_table_new (5, NUM_INFO_LINES + 1, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (st->table), 4);
gtk_box_pack_start (GTK_BOX (vbox), st->table, FALSE, FALSE, 0);
gtk_widget_show (st->table);
hbox = gtk_hbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, FALSE, 5);
button = gtk_button_new_with_label (_("Refresh"));
gtk_widget_show (button);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (browser_refresh_callback), st);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
st->button = gtk_button_new_with_label ("");
st->button_label = GTK_BIN (st->button)->child;
gtk_box_pack_start (GTK_BOX (hbox), st->button, TRUE, TRUE, 0);
gtk_widget_show (st->button);
gtk_signal_connect (GTK_OBJECT (st->button), "clicked",
GTK_SIGNAL_FUNC (browser_load_unload_callback), st);
browser_info_init (st, st->table);
browser_info_update (st->last_update, st);
g_object_set_data (G_OBJECT (st->list), "state", st);
g_signal_connect (G_OBJECT (st->list), "select_child",
G_CALLBACK (browser_select_callback), NULL);
/* hook the GimpContainer signals so we can refresh the display
* appropriately.
*/
modules_handler_id =
gimp_container_add_handler (modules, "modified",
G_CALLBACK (browser_info_update), st);
g_signal_connect (G_OBJECT (modules), "add",
G_CALLBACK (browser_info_add), st);
g_signal_connect (G_OBJECT (modules), "remove",
G_CALLBACK (browser_info_remove), st);
gtk_signal_connect (GTK_OBJECT (shell), "destroy",
GTK_SIGNAL_FUNC (browser_destroy_callback), st);
return shell;
}
/**************************/
/* ModuleInfo object glue */
enum
{
MODIFIED,
LAST_SIGNAL
};
typedef struct _ModuleInfoClass ModuleInfoClass;
struct _ModuleInfoClass
{
GimpObjectClass parent_class;
void (* modified) (ModuleInfo *module_info);
};
static guint module_info_signals[LAST_SIGNAL];
static GimpObjectClass *parent_class = NULL;
static void
module_info_destroy (GtkObject *object)
{
ModuleInfo *mod = MODULE_INFO (object);
/* if this trips, then we're onto some serious lossage in a moment */
g_return_if_fail (mod->refs == 0);
if (mod->last_module_error)
g_free (mod->last_module_error);
g_free (mod->fullpath);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
module_info_class_init (ModuleInfoClass *klass)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) 2001-07-24 Michael Natterer <mitch@gimp.org> Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) * configure.in: require glib/gtk+ >= 1.3.7, commented out the gtkxmhtml stuff. From now on, you will need glib, pango, atk and gtk+ HEAD from CVS to hack or use GIMP HEAD. Beware, it crashes randomly :) * app/core/Makefile.am * app/core/gimpmarshal.list: new file plus rules to generate gimpmarshal.[ch] from it. * app/core/* * app/tools/* * app/widgets/* * libgimpwidgets/*: started to use the glib object system. All core/ objects are still gtk objects however. All signals are created using g_signal_new(). There are many gtk+ artefacts left. Finally, we will _not_ use the gtk_signal_foo() wrappers and friends any more. * app/colormaps.c * app/devices.[ch] * app/disp_callbacks.c * app/errorconsole.c * app/file-save.[ch] * app/interface.c * app/module_db.c * app/nav_window.c * app/ops_buttons.c * app/scroll.c * app/user_install.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/brushes-commands.c * app/gui/color-notebook.c * app/gui/colormap-dialog.c * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/file-commands.c * app/gui/file-dialog-utils.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/gradients-commands.c * app/gui/image-commands.c * app/gui/info-dialog.[ch] * app/gui/layer-select.c * app/gui/layers-commands.c * app/gui/menus.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/patterns-commands.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.[ch] * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/gui/tools-commands.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimp/gimpui.c * libgimpbase/gimpenv.c: tons and tons of changes like "const gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete and currently disables), lots of s/gtk_signal/g_signal/, removal/replacement of deprecated stuff, s/GtkSignalFunc/GCallback/ and lots of small changes and fixes while I was on it, zillions of warnings left... * modules/Makefile.am: disabled the water color selector temporarily (XInput issues). * plug-ins/Makefile.am * plug-ins/common/.cvsignore * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl: simply excluded all plug-ins which did not build (including Script-Fu). They are trivial to fix.
2001-07-25 05:27:11 +08:00
parent_class = g_type_class_peek_parent (klass);
module_info_signals[MODIFIED] =
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) 2001-07-24 Michael Natterer <mitch@gimp.org> Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) * configure.in: require glib/gtk+ >= 1.3.7, commented out the gtkxmhtml stuff. From now on, you will need glib, pango, atk and gtk+ HEAD from CVS to hack or use GIMP HEAD. Beware, it crashes randomly :) * app/core/Makefile.am * app/core/gimpmarshal.list: new file plus rules to generate gimpmarshal.[ch] from it. * app/core/* * app/tools/* * app/widgets/* * libgimpwidgets/*: started to use the glib object system. All core/ objects are still gtk objects however. All signals are created using g_signal_new(). There are many gtk+ artefacts left. Finally, we will _not_ use the gtk_signal_foo() wrappers and friends any more. * app/colormaps.c * app/devices.[ch] * app/disp_callbacks.c * app/errorconsole.c * app/file-save.[ch] * app/interface.c * app/module_db.c * app/nav_window.c * app/ops_buttons.c * app/scroll.c * app/user_install.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/brushes-commands.c * app/gui/color-notebook.c * app/gui/colormap-dialog.c * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/file-commands.c * app/gui/file-dialog-utils.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/gradients-commands.c * app/gui/image-commands.c * app/gui/info-dialog.[ch] * app/gui/layer-select.c * app/gui/layers-commands.c * app/gui/menus.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/patterns-commands.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.[ch] * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/gui/tools-commands.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimp/gimpui.c * libgimpbase/gimpenv.c: tons and tons of changes like "const gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete and currently disables), lots of s/gtk_signal/g_signal/, removal/replacement of deprecated stuff, s/GtkSignalFunc/GCallback/ and lots of small changes and fixes while I was on it, zillions of warnings left... * modules/Makefile.am: disabled the water color selector temporarily (XInput issues). * plug-ins/Makefile.am * plug-ins/common/.cvsignore * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl: simply excluded all plug-ins which did not build (including Script-Fu). They are trivial to fix.
2001-07-25 05:27:11 +08:00
g_signal_new ("modified",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
GTK_SIGNAL_OFFSET (ModuleInfoClass, modified),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->destroy = module_info_destroy;
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) 2001-07-24 Michael Natterer <mitch@gimp.org> Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) * configure.in: require glib/gtk+ >= 1.3.7, commented out the gtkxmhtml stuff. From now on, you will need glib, pango, atk and gtk+ HEAD from CVS to hack or use GIMP HEAD. Beware, it crashes randomly :) * app/core/Makefile.am * app/core/gimpmarshal.list: new file plus rules to generate gimpmarshal.[ch] from it. * app/core/* * app/tools/* * app/widgets/* * libgimpwidgets/*: started to use the glib object system. All core/ objects are still gtk objects however. All signals are created using g_signal_new(). There are many gtk+ artefacts left. Finally, we will _not_ use the gtk_signal_foo() wrappers and friends any more. * app/colormaps.c * app/devices.[ch] * app/disp_callbacks.c * app/errorconsole.c * app/file-save.[ch] * app/interface.c * app/module_db.c * app/nav_window.c * app/ops_buttons.c * app/scroll.c * app/user_install.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/brushes-commands.c * app/gui/color-notebook.c * app/gui/colormap-dialog.c * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/file-commands.c * app/gui/file-dialog-utils.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/gradients-commands.c * app/gui/image-commands.c * app/gui/info-dialog.[ch] * app/gui/layer-select.c * app/gui/layers-commands.c * app/gui/menus.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/patterns-commands.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.[ch] * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/gui/tools-commands.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimp/gimpui.c * libgimpbase/gimpenv.c: tons and tons of changes like "const gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete and currently disables), lots of s/gtk_signal/g_signal/, removal/replacement of deprecated stuff, s/GtkSignalFunc/GCallback/ and lots of small changes and fixes while I was on it, zillions of warnings left... * modules/Makefile.am: disabled the water color selector temporarily (XInput issues). * plug-ins/Makefile.am * plug-ins/common/.cvsignore * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl: simply excluded all plug-ins which did not build (including Script-Fu). They are trivial to fix.
2001-07-25 05:27:11 +08:00
klass->modified = NULL;
}
static void
module_info_init (ModuleInfo *mod)
{
/* don't need to do anything */
}
static guint
module_info_get_type (void)
{
static guint module_info_type = 0;
if (!module_info_type)
{
static const GtkTypeInfo module_info_info =
{
"ModuleInfo",
sizeof (ModuleInfo),
sizeof (ModuleInfoClass),
(GtkClassInitFunc) module_info_class_init,
(GtkObjectInitFunc) module_info_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
module_info_type = gtk_type_unique (GIMP_TYPE_OBJECT, &module_info_info);
}
return module_info_type;
}
/* exported API: */
static void
module_info_modified (ModuleInfo *mod)
{
g_signal_emit (G_OBJECT (mod), module_info_signals[MODIFIED], 0);
}
static ModuleInfo *
module_info_new (void)
{
return MODULE_INFO (gtk_type_new (module_info_get_type ()));
}
static void
module_info_free (ModuleInfo *mod)
{
g_object_unref (G_OBJECT (mod));
}
/**************************************************************/
/* helper functions */
/* name must be of the form lib*.so (Unix) or *.dll (Win32) */
static gboolean
valid_module_name (const gchar *filename)
{
const gchar *basename;
gint len;
basename = g_basename (filename);
len = strlen (basename);
1999-10-07 05:27:18 +08:00
#if !defined(G_OS_WIN32) && !defined(G_WITH_CYGWIN) && !defined(__EMX__)
if (len < 3 + 1 + 3)
return FALSE;
if (strncmp (basename, "lib", 3))
return FALSE;
if (strcmp (basename + len - 3, ".so"))
return FALSE;
#else
if (len < 1 + 4)
return FALSE;
if (g_strcasecmp (basename + len - 4, ".dll"))
return FALSE;
#endif
return TRUE;
}
static gboolean
module_inhibited (const gchar *fullpath,
const gchar *inhibit_list)
{
gchar *p;
gint pathlen;
const gchar *start;
const gchar *end;
/* common case optimisation: the list is empty */
if (!inhibit_list || *inhibit_list == '\000')
return FALSE;
p = strstr (inhibit_list, fullpath);
if (!p)
return FALSE;
/* we have a substring, but check for colons either side */
start = p;
while (start != inhibit_list && *start != G_SEARCHPATH_SEPARATOR)
start--;
if (*start == G_SEARCHPATH_SEPARATOR)
start++;
end = strchr (p, G_SEARCHPATH_SEPARATOR);
if (!end)
end = inhibit_list + strlen (inhibit_list);
pathlen = strlen (fullpath);
if ((end - start) == pathlen)
return TRUE;
else
return FALSE;
}
static void
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
module_initialize (const gchar *filename,
gpointer loader_data)
{
ModuleInfo *mod;
if (!valid_module_name (filename))
return;
/* don't load if we already know about it */
if (module_find_by_path (filename))
return;
mod = module_info_new ();
mod->fullpath = g_strdup (filename);
mod->ondisk = TRUE;
mod->state = ST_MODULE_ERROR;
mod->info = NULL;
mod->module = NULL;
mod->last_module_error = NULL;
mod->init = NULL;
mod->unload = NULL;
/* Count of times main gimp is within the module. Normally, this
* will be 1, and we assume that the module won't call its
* unload callback until it is satisfied that it's not in use any
* more. refs can be 2 temporarily while we're running the module's
* unload function, to stop the module attempting to unload
* itself.
*/
mod->refs = 0;
mod->load_inhibit = module_inhibited (mod->fullpath,
app/Makefile.am app/gimpunit.c removed... 2001-07-11 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimpunit.c * app/unitrc.h: removed... * app/core/Makefile.am * app/core/gimpunit.[ch]: ...re-added here. * app/core/gimp.[ch]: added the image and drawable hash tables, next_image_ID, next_guide_ID and next_drawable_ID, added a GimpCoreConfig pointer which is now initalized dynamically. * app/core/gimpcoreconfig.[ch]: don't provide a global core_config variable any more (need to access gimp->config now). * app/gdisplay.[ch] * app/core/gimpdrawable.[ch] * app/core/gimpimage.[ch]: removed all global variables from gimpimage.c and gimpdrawable.c, pass a Gimp* to all *_get_by_ID() functions. * tools/pdbgen/app.pl: pass Gimp* to all _get_by_ID() functions. * app/app_procs.c * app/file-open.c * app/file-save.c * app/gimprc.c * app/libgimp_glue.c * app/module_db.c * app/plug_in.c * app/undo.c * app/user_install.c * app/core/core-types.h * app/core/gimpcontext.c * app/core/gimpimage-crop.c * app/core/gimpimage-new.c * app/core/gimpparasite.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/info-window.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * app/widgets/gimpdnd.c * app/pdb/channel_cmds.c * app/pdb/color_cmds.c * app/pdb/convert_cmds.c * app/pdb/display_cmds.c * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * app/pdb/fileops_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/guides_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/parasite_cmds.c * app/pdb/paths_cmds.c * app/pdb/selection_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/tools_cmds.c * app/pdb/undo_cmds.c * app/pdb/unit_cmds.c * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/unit.pdb: changed accordingly.
2001-07-11 20:39:49 +08:00
the_gimp->config->module_db_load_inhibit);
if (!mod->load_inhibit)
{
if (be_verbose)
g_print (_("load module: \"%s\"\n"), filename);
mod_load (mod, TRUE);
}
else
{
if (be_verbose)
g_print (_("skipping module: \"%s\"\n"), filename);
mod->state = ST_UNLOADED_OK;
}
gimp_container_add (modules, GIMP_OBJECT (mod));
}
static void
mod_load (ModuleInfo *mod,
gboolean verbose)
{
gpointer symbol;
g_return_if_fail (mod->module == NULL);
mod->module = g_module_open (mod->fullpath, G_MODULE_BIND_LAZY);
if (!mod->module)
{
mod->state = ST_MODULE_ERROR;
if (mod->last_module_error)
g_free (mod->last_module_error);
mod->last_module_error = g_strdup (g_module_error ());
if (verbose)
g_warning (_("module load error: %s: %s"),
mod->fullpath, mod->last_module_error);
return;
}
1999-04-30 23:04:38 +08:00
#ifdef __EMX__
if (g_module_symbol (mod->module, "gimp_main_funcs", &symbol))
{
*(struct main_funcs_struc **) symbol = gimp_main_funcs;
1999-04-30 23:04:38 +08:00
}
#endif
/* find the module_init symbol */
if (!g_module_symbol (mod->module, "module_init", &symbol))
{
mod->state = ST_MODULE_ERROR;
if (mod->last_module_error)
g_free (mod->last_module_error);
1999-11-23 06:38:02 +08:00
mod->last_module_error = g_strdup ("missing module_init() symbol");
if (verbose)
1999-11-23 06:38:02 +08:00
g_warning ("%s: module_init() symbol not found", mod->fullpath);
g_module_close (mod->module);
mod->module = NULL;
mod->info = NULL;
return;
}
/* run module's initialisation */
mod->init = symbol;
mod->info = NULL;
gimp_module_ref (mod); /* loaded modules are assumed to have a ref of 1 */
if (mod->init (&mod->info) == GIMP_MODULE_UNLOAD)
{
mod->state = ST_LOAD_FAILED;
gimp_module_unref (mod);
mod->info = NULL;
return;
}
/* module is now happy */
mod->state = ST_LOADED_OK;
TRC (("loaded module %s, state at %p\n", mod->fullpath, mod));
/* do we have an unload function? */
if (g_module_symbol (mod->module, "module_unload", &symbol))
mod->unload = symbol;
else
mod->unload = NULL;
}
static void
mod_unload_completed_callback (gpointer data)
{
ModuleInfo *mod = data;
g_return_if_fail (mod->state == ST_UNLOAD_REQUESTED);
/* lose the ref we gave this module when we loaded it,
* since the module's now happy to be unloaded. */
gimp_module_unref (mod);
mod->info = NULL;
mod->state = ST_UNLOADED_OK;
TRC (("module unload completed callback for %p\n", mod));
module_info_modified (mod);
}
static void
mod_unload (ModuleInfo *mod,
gboolean verbose)
{
g_return_if_fail (mod->module != NULL);
g_return_if_fail (mod->unload != NULL);
if (mod->state == ST_UNLOAD_REQUESTED)
return;
mod->state = ST_UNLOAD_REQUESTED;
TRC (("module unload requested for %p\n", mod));
/* Send the unload request. Need to ref the module so we don't
* accidentally unload it while this call is in progress (eg if the
* callback is called before the unload function returns). */
gimp_module_ref (mod);
mod->unload (mod->info->shutdown_data, mod_unload_completed_callback, mod);
gtk_idle_add ((GtkFunction) mod_idle_unref, (gpointer) mod);
}
static gboolean
mod_idle_unref (ModuleInfo *mod)
{
gimp_module_unref (mod);
return FALSE;
}
#ifdef DUMP_DB
static void
print_module_info (gpointer data,
gpointer user_data)
{
ModuleInfo *i = data;
g_print ("\n%s: %s\n",
i->fullpath, statename[i->state]);
g_print (" module:%p lasterr:%s init:%p unload:%p\n",
i->module, i->last_module_error? i->last_module_error : "NONE",
i->init, i->unload);
if (i->info)
{
g_print (" shutdown_data: %p\n"
" purpose: %s\n"
" author: %s\n"
" version: %s\n"
" copyright: %s\n"
" date: %s\n",
i->info->shutdown_data,
i->info->purpose, i->info->author, i->info->version,
i->info->copyright, i->info->date);
}
}
#endif
/**************************************************************/
/* UI functions */
static void
browser_popdown_callback (GtkWidget *widget,
gpointer data)
{
gtk_widget_destroy (GTK_WIDGET (data));
}
static void
browser_destroy_callback (GtkWidget *widget,
gpointer data)
{
g_signal_handlers_disconnect_by_data (G_OBJECT (modules), data);
gimp_container_remove_handler (modules, modules_handler_id);
g_free (data);
}
static void
browser_load_inhibit_callback (GtkWidget *widget,
gpointer data)
{
BrowserState *st = data;
gboolean new_value;
g_return_if_fail (st->last_update != NULL);
new_value = ! GTK_TOGGLE_BUTTON (widget)->active;
if (new_value == st->last_update->load_inhibit)
return;
st->last_update->load_inhibit = new_value;
module_info_modified (st->last_update);
need_to_rewrite_modulerc = TRUE;
}
static void
browser_info_update (ModuleInfo *mod,
BrowserState *st)
{
gint i;
const gchar *text[NUM_INFO_LINES - 1];
gchar *status;
/* only update the info if we're actually showing it */
if (mod != st->last_update)
return;
if (!mod)
{
for (i=0; i < NUM_INFO_LINES; i++)
gtk_label_set_text (GTK_LABEL (st->label[i]), "");
gtk_label_set_text (GTK_LABEL(st->button_label), _("<No modules>"));
gtk_widget_set_sensitive (GTK_WIDGET (st->button), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), FALSE);
return;
}
if (mod->info)
{
text[0] = mod->info->purpose;
text[1] = mod->info->author;
text[2] = mod->info->version;
text[3] = mod->info->copyright;
text[4] = mod->info->date;
text[5] = mod->ondisk? _("on disk") : _("only in memory");
}
else
{
text[0] = "--";
text[1] = "--";
text[2] = "--";
text[3] = "--";
text[4] = "--";
text[5] = mod->ondisk? _("on disk") : _("nowhere (click 'refresh')");
}
if (mod->state == ST_MODULE_ERROR && mod->last_module_error)
status = g_strdup_printf ("%s (%s)", gettext (statename[mod->state]),
mod->last_module_error);
else
{
status = g_strdup (gettext (statename[mod->state]));
}
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[NUM_INFO_LINES-1]), status);
g_free (status);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (st->load_inhibit_check),
!mod->load_inhibit);
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), TRUE);
/* work out what the button should do (if anything) */
switch (mod->state)
{
case ST_MODULE_ERROR:
case ST_LOAD_FAILED:
case ST_UNLOADED_OK:
gtk_label_set_text (GTK_LABEL(st->button_label), _("Load"));
gtk_widget_set_sensitive (GTK_WIDGET (st->button), mod->ondisk);
break;
case ST_UNLOAD_REQUESTED:
gtk_label_set_text (GTK_LABEL(st->button_label), _("Unload"));
gtk_widget_set_sensitive (GTK_WIDGET (st->button), FALSE);
break;
case ST_LOADED_OK:
gtk_label_set_text (GTK_LABEL(st->button_label), _("Unload"));
gtk_widget_set_sensitive (GTK_WIDGET (st->button),
mod->unload? TRUE : FALSE);
break;
}
}
static void
browser_info_init (BrowserState *st,
GtkWidget *table)
{
GtkWidget *label;
gint i;
gchar *text[] =
{
N_("Purpose:"),
N_("Author:"),
N_("Version:"),
N_("Copyright:"),
N_("Date:"),
N_("Location:"),
N_("State:")
};
for (i=0; i < sizeof(text) / sizeof(char *); i++)
{
label = gtk_label_new (gettext (text[i]));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, i, i+1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
gtk_widget_show (label);
st->label[i] = gtk_label_new ("");
gtk_misc_set_alignment (GTK_MISC (st->label[i]), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (st->table), st->label[i], 1, 2, i, i+1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
gtk_widget_show (st->label[i]);
}
st->load_inhibit_check =
gtk_check_button_new_with_label (_("Autoload during startup"));
gtk_widget_show (st->load_inhibit_check);
gtk_table_attach (GTK_TABLE (table), st->load_inhibit_check,
0, 2, i, i+1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
g_signal_connect (G_OBJECT (st->load_inhibit_check), "toggled",
G_CALLBACK (browser_load_inhibit_callback), st);
}
static void
browser_select_callback (GtkWidget *widget,
GtkWidget *child)
{
ModuleInfo *info;
BrowserState *st;
info = g_object_get_data (G_OBJECT (child), "module_info");
st = g_object_get_data (G_OBJECT (widget), "state");
if (st->last_update == info)
return;
st->last_update = info;
browser_info_update (st->last_update, st);
}
static void
browser_load_unload_callback (GtkWidget *widget,
gpointer data)
{
BrowserState *st = data;
if (st->last_update->state == ST_LOADED_OK)
mod_unload (st->last_update, FALSE);
else
mod_load (st->last_update, FALSE);
module_info_modified (st->last_update);
}
static void
make_list_item (gpointer data,
gpointer user_data)
{
ModuleInfo *info = data;
BrowserState *st = user_data;
GtkWidget *list_item;
if (!st->last_update)
st->last_update = info;
list_item = gtk_list_item_new_with_label (info->fullpath);
gtk_widget_show (list_item);
g_object_set_data (G_OBJECT (list_item), "module_info", info);
gtk_container_add (GTK_CONTAINER (st->list), list_item);
}
static void
browser_info_add (GimpContainer *container,
ModuleInfo *mod,
BrowserState *st)
{
make_list_item (mod, st);
}
static void
browser_info_remove (GimpContainer *container,
ModuleInfo *mod,
BrowserState *st)
{
GList *dlist;
GList *free_list;
GtkWidget *list_item;
ModuleInfo *info;
dlist = gtk_container_children (GTK_CONTAINER (st->list));
free_list = dlist;
while (dlist)
{
list_item = dlist->data;
info = g_object_get_data (G_OBJECT (list_item), "module_info");
g_return_if_fail (info != NULL);
if (info == mod)
{
gtk_container_remove (GTK_CONTAINER (st->list), list_item);
g_list_free (free_list);
return;
}
dlist = dlist->next;
}
g_warning ("tried to remove module that wasn't in brower's list");
g_list_free(free_list);
}
static void
module_db_module_ondisk (gpointer data,
gpointer user_data)
{
ModuleInfo *mod = data;
struct stat statbuf;
gint ret;
gint old_ondisk = mod->ondisk;
GSList **kill_list = user_data;
ret = stat (mod->fullpath, &statbuf);
if (ret != 0)
mod->ondisk = FALSE;
else
mod->ondisk = TRUE;
/* if it's not on the disk, and it isn't in memory, mark it to be
* removed later. */
if (!mod->ondisk && !mod->module)
{
*kill_list = g_slist_append (*kill_list, mod);
mod = NULL;
}
if (mod && mod->ondisk != old_ondisk)
module_info_modified (mod);
}
static void
module_db_module_remove (gpointer data,
gpointer user_data)
{
ModuleInfo *mod = data;
gimp_container_remove (modules, GIMP_OBJECT (mod));
module_info_free (mod);
}
typedef struct
{
const gchar *search_key;
ModuleInfo *found;
} find_by_path_closure;
static void
module_db_path_cmp (gpointer data,
gpointer user_data)
{
ModuleInfo *mod = data;
find_by_path_closure *cl = user_data;
if (!strcmp (mod->fullpath, cl->search_key))
cl->found = mod;
}
static ModuleInfo *
module_find_by_path (const char *fullpath)
{
find_by_path_closure cl;
cl.found = NULL;
cl.search_key = fullpath;
gimp_container_foreach (modules, module_db_path_cmp, &cl);
return cl.found;
}
static void
browser_refresh_callback (GtkWidget *widget,
gpointer data)
{
GSList *kill_list = NULL;
/* remove modules we don't have on disk anymore */
gimp_container_foreach (modules, module_db_module_ondisk, &kill_list);
g_slist_foreach (kill_list, module_db_module_remove, NULL);
g_slist_free (kill_list);
kill_list = NULL;
/* walk filesystem and add new things we find */
app/Makefile.am app/gimpunit.c removed... 2001-07-11 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimpunit.c * app/unitrc.h: removed... * app/core/Makefile.am * app/core/gimpunit.[ch]: ...re-added here. * app/core/gimp.[ch]: added the image and drawable hash tables, next_image_ID, next_guide_ID and next_drawable_ID, added a GimpCoreConfig pointer which is now initalized dynamically. * app/core/gimpcoreconfig.[ch]: don't provide a global core_config variable any more (need to access gimp->config now). * app/gdisplay.[ch] * app/core/gimpdrawable.[ch] * app/core/gimpimage.[ch]: removed all global variables from gimpimage.c and gimpdrawable.c, pass a Gimp* to all *_get_by_ID() functions. * tools/pdbgen/app.pl: pass Gimp* to all _get_by_ID() functions. * app/app_procs.c * app/file-open.c * app/file-save.c * app/gimprc.c * app/libgimp_glue.c * app/module_db.c * app/plug_in.c * app/undo.c * app/user_install.c * app/core/core-types.h * app/core/gimpcontext.c * app/core/gimpimage-crop.c * app/core/gimpimage-new.c * app/core/gimpparasite.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/info-window.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * app/widgets/gimpdnd.c * app/pdb/channel_cmds.c * app/pdb/color_cmds.c * app/pdb/convert_cmds.c * app/pdb/display_cmds.c * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * app/pdb/fileops_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/guides_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/parasite_cmds.c * app/pdb/paths_cmds.c * app/pdb/selection_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/tools_cmds.c * app/pdb/undo_cmds.c * app/pdb/unit_cmds.c * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/unit.pdb: changed accordingly.
2001-07-11 20:39:49 +08:00
gimp_datafiles_read_directories (the_gimp->config->module_path, 0 /* no flags */,
module_initialize, NULL);
}
static void
gimp_module_ref (ModuleInfo *mod)
{
g_return_if_fail (mod->refs >= 0);
g_return_if_fail (mod->module != NULL);
mod->refs++;
}
static void
gimp_module_unref (ModuleInfo *mod)
{
g_return_if_fail (mod->refs > 0);
g_return_if_fail (mod->module != NULL);
mod->refs--;
if (mod->refs == 0)
{
TRC (("module %p refs hit 0, g_module_closing it\n", mod));
g_module_close (mod->module);
mod->module = NULL;
}
}