Ported module loading to GTypeModule, getting rid of all own module

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

	Ported module loading to GTypeModule, getting rid of all own
	module registering/bookkeeping stuff for color selectors and
	display filters. The modules now simply register GimpColorSelector
	and GimpColorDisplay subclasses, the list of registered subclasses
	can then be obtained calling g_type_children() on the abstract
	base classes.

	This is work in progress and just the first working state after I
	started breaking everything...

	* app/gui/color-select.[ch]
	* libgimp/gimpcolordisplay.h
	* libgimp/gimpcolorselector.h: removed.

	* app/gui/Makefile.am
	* libgimp/Makefile.am: changed accordingly.

	* libgimp/gimpmodule.h: massively simplified. All voodoo is gone.

	* libgimpwidgets/gimpcolordisplay.[ch]
	* libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes
	which need to be subclassed by modules.

	* libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector
	from app/gui/color-select.* ported to be a GimpColorSelector
	subclass.

	* libgimpwidgets/Makefile.am
	* libgimpwidgets/gimpwidgets.h
	* libgimpwidgets/gimpwidgetsmarshal.list
	* libgimpwidgets/gimpwidgetstypes.h: changed accordingly.

	* app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass

	* app/core/gimpmodules.c: changed accordingly.

	* app/core/gimpcontainer.c
	* app/core/gimplist.c: HACKED around to allow GimpLists of
	GObjects (not GimpObjects). This is EEKy, so I will either make
	gimp->modules a simple GList and revert this bit of change, or
	allow GObjects all over the place in GimpContainer land...

	* app/display/gimpdisplayshell-filter.[ch]
	* app/gui/color-notebook.c: removed all module stuff and use
	g_type_children() to get the list of available color_selectors
	and display_filters.

	* app/display/gimpdisplayshell-filter-dialog.c
	* app/display/gimpdisplayshell-render.c
	* app/gui/module-browser.c: changed accordingly.

	* app/gui/gui.c: ref the built-in color selector's class before
	the modules are queried so it appears first in the list of
	GimpColorSelector's children.

	* modules/Makefile.am: build the water color selector again.

	* modules/cdisplay_gamma.c
	* modules/cdisplay_highcontrast.c
	* modules/colorsel_triangle.c
	* modules/colorsel_water.c: ported them all to the new API.

	* modules/gimpmodregister.[ch]: removed the old EMX module hack.
This commit is contained in:
Michael Natterer
2002-10-20 10:14:17 +00:00
committed by Michael Natterer
parent 921d265270
commit d7055a3351
47 changed files with 2813 additions and 5410 deletions

View File

@ -20,138 +20,3 @@ color selector module.
#libgimp-gimpmodule
</para>
<!-- ##### USER_FUNCTION GimpColorSelectorCallback ##### -->
<para>
</para>
@data:
@hsv:
@rgb:
<!-- ##### USER_FUNCTION GimpColorSelectorNewFunc ##### -->
<para>
</para>
@hsv:
@rgb:
@show_alpha:
@cb:
@data:
@selector_data:
@Returns:
<!-- ##### USER_FUNCTION GimpColorSelectorFreeFunc ##### -->
<para>
</para>
@selector_data:
<!-- ##### USER_FUNCTION GimpColorSelectorSetColorFunc ##### -->
<para>
</para>
@selector_data:
@hsv:
@rgb:
<!-- ##### USER_FUNCTION GimpColorSelectorSetChannelFunc ##### -->
<para>
</para>
@selector_data:
@type:
<!-- ##### STRUCT GimpColorSelectorMethods ##### -->
<para>
</para>
@new:
@free:
@set_color:
@set_channel:
<!-- ##### TYPEDEF GimpColorSelectorID ##### -->
<para>
</para>
<!-- ##### ENUM GimpColorSelectorChannelType ##### -->
<para>
</para>
@GIMP_COLOR_SELECTOR_HUE:
@GIMP_COLOR_SELECTOR_SATURATION:
@GIMP_COLOR_SELECTOR_VALUE:
@GIMP_COLOR_SELECTOR_RED:
@GIMP_COLOR_SELECTOR_GREEN:
@GIMP_COLOR_SELECTOR_BLUE:
@GIMP_COLOR_SELECTOR_ALPHA:
<!-- ##### 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().
<!-- ##### MACRO GIMP_COLOR_SELECTOR_SIZE ##### -->
<para>
</para>
<!-- ##### MACRO GIMP_COLOR_SELECTOR_BAR_SIZE ##### -->
<para>
</para>
<!-- ##### FUNCTION gimp_color_selector_register ##### -->
<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>
@name: The color selector's name.
@help_page: The help page.
@methods: The color selector's methods.
@Returns: The #GimpColorSelectorID of the new color selector.
<!-- ##### FUNCTION gimp_color_selector_unregister ##### -->
<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>
@selector_id:
@finished_cb: Optional callback which will be called once all instances have finished.
@finished_data: The @finished_data which will be passed to @finished_cb.
@Returns: #TRUE on success, #FALSE if @id was not found.
<!-- # Unused Parameters # -->
@id: The @id as returned by gimp_color_selector_register().

View File

@ -15,77 +15,14 @@ Common definitions for creating a pluggable GIMP module.
#GModule
</para>
<!-- ##### ENUM GimpModuleStatus ##### -->
<para>
</para>
@GIMP_MODULE_OK:
@GIMP_MODULE_UNLOAD:
<!-- ##### STRUCT GimpModuleInfo ##### -->
<para>
</para>
@shutdown_data:
@purpose:
@author:
@version:
@copyright:
@date:
<!-- ##### 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: Must be the @completed_data pointer provided by the
"module_unload" function.
<!-- ##### 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.