gimp/libgimpconfig/gimpconfig-iface.h

113 lines
5.2 KiB
C
Raw Normal View History

/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
removed from CVS, they are generated. 2001-12-07 Sven Neumann <sven@gimp.org> * app/core/gimpmarshal.[ch]: removed from CVS, they are generated. * app/base/Makefile.am * app/base/base-enums.h: new file defining enums that are to be registered. Used to build app/base/base-enums.c. * app/base/base-types.h: include base-enums.h. * tools/pdbgen/Makefile.am * tools/pdbgen/enumcode.pl * tools/pdbgen/enums.pl: parse the new base-enums.h file and modified the perl voodoo so it doesn't prefix enums with GIMP_ that are already properly namespaced. * app/core/core-types.h: don't need to chop GIMP from enum. * app/pdb/color_cmds.c * app/pdb/tools_cmds.c * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig.[ch]: made GimpConfig an interface including a reasonable default implementation that works on object properties. * app/config/Makefile.am * app/config/gimpbaseconfig.[ch]: new GimpBaseConfig using the GimpConfig interface. Yet only used for testing from app/main.c. * app/main.c: test the new GimpBaseConfig object. * app/gimprc.c * app/base/base-config.h * app/base/*.c * app/core/gimpdatafiles.c * app/core/gimpdrawable-transform.c * app/core/gimppreviewcache.c * app/gui/preferences-dialog.c * app/paint-funcs/paint-funcs.c * app/xcf/xcf-seek.c: need to include glib-object.h since base-config contains registered enums now. Follow name change of InterpolationType to GimpInterpolationType.
2001-12-08 00:10:53 +08:00
* Config file serialization and deserialization interface
* Copyright (C) 2001-2002 Sven Neumann <sven@gimp.org>
removed from CVS, they are generated. 2001-12-07 Sven Neumann <sven@gimp.org> * app/core/gimpmarshal.[ch]: removed from CVS, they are generated. * app/base/Makefile.am * app/base/base-enums.h: new file defining enums that are to be registered. Used to build app/base/base-enums.c. * app/base/base-types.h: include base-enums.h. * tools/pdbgen/Makefile.am * tools/pdbgen/enumcode.pl * tools/pdbgen/enums.pl: parse the new base-enums.h file and modified the perl voodoo so it doesn't prefix enums with GIMP_ that are already properly namespaced. * app/core/core-types.h: don't need to chop GIMP from enum. * app/pdb/color_cmds.c * app/pdb/tools_cmds.c * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig.[ch]: made GimpConfig an interface including a reasonable default implementation that works on object properties. * app/config/Makefile.am * app/config/gimpbaseconfig.[ch]: new GimpBaseConfig using the GimpConfig interface. Yet only used for testing from app/main.c. * app/main.c: test the new GimpBaseConfig object. * app/gimprc.c * app/base/base-config.h * app/base/*.c * app/core/gimpdatafiles.c * app/core/gimpdrawable-transform.c * app/core/gimppreviewcache.c * app/gui/preferences-dialog.c * app/paint-funcs/paint-funcs.c * app/xcf/xcf-seek.c: need to include glib-object.h since base-config contains registered enums now. Follow name change of InterpolationType to GimpInterpolationType.
2001-12-08 00:10:53 +08:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_CONFIG_H__
#define __GIMP_CONFIG_H__
typedef enum
{
GIMP_CONFIG_ERROR_OPEN, /* open failed */
GIMP_CONFIG_ERROR_OPEN_ENOENT, /* file does not exist */
GIMP_CONFIG_ERROR_WRITE, /* write failed */
GIMP_CONFIG_ERROR_PARSE /* parser error */
} GimpConfigError;
removed from CVS, they are generated. 2001-12-07 Sven Neumann <sven@gimp.org> * app/core/gimpmarshal.[ch]: removed from CVS, they are generated. * app/base/Makefile.am * app/base/base-enums.h: new file defining enums that are to be registered. Used to build app/base/base-enums.c. * app/base/base-types.h: include base-enums.h. * tools/pdbgen/Makefile.am * tools/pdbgen/enumcode.pl * tools/pdbgen/enums.pl: parse the new base-enums.h file and modified the perl voodoo so it doesn't prefix enums with GIMP_ that are already properly namespaced. * app/core/core-types.h: don't need to chop GIMP from enum. * app/pdb/color_cmds.c * app/pdb/tools_cmds.c * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig.[ch]: made GimpConfig an interface including a reasonable default implementation that works on object properties. * app/config/Makefile.am * app/config/gimpbaseconfig.[ch]: new GimpBaseConfig using the GimpConfig interface. Yet only used for testing from app/main.c. * app/main.c: test the new GimpBaseConfig object. * app/gimprc.c * app/base/base-config.h * app/base/*.c * app/core/gimpdatafiles.c * app/core/gimpdrawable-transform.c * app/core/gimppreviewcache.c * app/gui/preferences-dialog.c * app/paint-funcs/paint-funcs.c * app/xcf/xcf-seek.c: need to include glib-object.h since base-config contains registered enums now. Follow name change of InterpolationType to GimpInterpolationType.
2001-12-08 00:10:53 +08:00
#define GIMP_TYPE_CONFIG_INTERFACE (gimp_config_interface_get_type ())
#define GIMP_GET_CONFIG_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_CONFIG_INTERFACE, GimpConfigInterface))
removed from CVS, they are generated. 2001-12-07 Sven Neumann <sven@gimp.org> * app/core/gimpmarshal.[ch]: removed from CVS, they are generated. * app/base/Makefile.am * app/base/base-enums.h: new file defining enums that are to be registered. Used to build app/base/base-enums.c. * app/base/base-types.h: include base-enums.h. * tools/pdbgen/Makefile.am * tools/pdbgen/enumcode.pl * tools/pdbgen/enums.pl: parse the new base-enums.h file and modified the perl voodoo so it doesn't prefix enums with GIMP_ that are already properly namespaced. * app/core/core-types.h: don't need to chop GIMP from enum. * app/pdb/color_cmds.c * app/pdb/tools_cmds.c * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig.[ch]: made GimpConfig an interface including a reasonable default implementation that works on object properties. * app/config/Makefile.am * app/config/gimpbaseconfig.[ch]: new GimpBaseConfig using the GimpConfig interface. Yet only used for testing from app/main.c. * app/main.c: test the new GimpBaseConfig object. * app/gimprc.c * app/base/base-config.h * app/base/*.c * app/core/gimpdatafiles.c * app/core/gimpdrawable-transform.c * app/core/gimppreviewcache.c * app/gui/preferences-dialog.c * app/paint-funcs/paint-funcs.c * app/xcf/xcf-seek.c: need to include glib-object.h since base-config contains registered enums now. Follow name change of InterpolationType to GimpInterpolationType.
2001-12-08 00:10:53 +08:00
typedef struct _GimpConfigInterface GimpConfigInterface;
removed from CVS, they are generated. 2001-12-07 Sven Neumann <sven@gimp.org> * app/core/gimpmarshal.[ch]: removed from CVS, they are generated. * app/base/Makefile.am * app/base/base-enums.h: new file defining enums that are to be registered. Used to build app/base/base-enums.c. * app/base/base-types.h: include base-enums.h. * tools/pdbgen/Makefile.am * tools/pdbgen/enumcode.pl * tools/pdbgen/enums.pl: parse the new base-enums.h file and modified the perl voodoo so it doesn't prefix enums with GIMP_ that are already properly namespaced. * app/core/core-types.h: don't need to chop GIMP from enum. * app/pdb/color_cmds.c * app/pdb/tools_cmds.c * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig.[ch]: made GimpConfig an interface including a reasonable default implementation that works on object properties. * app/config/Makefile.am * app/config/gimpbaseconfig.[ch]: new GimpBaseConfig using the GimpConfig interface. Yet only used for testing from app/main.c. * app/main.c: test the new GimpBaseConfig object. * app/gimprc.c * app/base/base-config.h * app/base/*.c * app/core/gimpdatafiles.c * app/core/gimpdrawable-transform.c * app/core/gimppreviewcache.c * app/gui/preferences-dialog.c * app/paint-funcs/paint-funcs.c * app/xcf/xcf-seek.c: need to include glib-object.h since base-config contains registered enums now. Follow name change of InterpolationType to GimpInterpolationType.
2001-12-08 00:10:53 +08:00
struct _GimpConfigInterface
{
removed from CVS, they are generated. 2001-12-07 Sven Neumann <sven@gimp.org> * app/core/gimpmarshal.[ch]: removed from CVS, they are generated. * app/base/Makefile.am * app/base/base-enums.h: new file defining enums that are to be registered. Used to build app/base/base-enums.c. * app/base/base-types.h: include base-enums.h. * tools/pdbgen/Makefile.am * tools/pdbgen/enumcode.pl * tools/pdbgen/enums.pl: parse the new base-enums.h file and modified the perl voodoo so it doesn't prefix enums with GIMP_ that are already properly namespaced. * app/core/core-types.h: don't need to chop GIMP from enum. * app/pdb/color_cmds.c * app/pdb/tools_cmds.c * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig.[ch]: made GimpConfig an interface including a reasonable default implementation that works on object properties. * app/config/Makefile.am * app/config/gimpbaseconfig.[ch]: new GimpBaseConfig using the GimpConfig interface. Yet only used for testing from app/main.c. * app/main.c: test the new GimpBaseConfig object. * app/gimprc.c * app/base/base-config.h * app/base/*.c * app/core/gimpdatafiles.c * app/core/gimpdrawable-transform.c * app/core/gimppreviewcache.c * app/gui/preferences-dialog.c * app/paint-funcs/paint-funcs.c * app/xcf/xcf-seek.c: need to include glib-object.h since base-config contains registered enums now. Follow name change of InterpolationType to GimpInterpolationType.
2001-12-08 00:10:53 +08:00
GTypeInterface base_iface;
gboolean (* serialize) (GObject *object,
gint fd,
gint indent_level,
gpointer data);
gboolean (* deserialize) (GObject *object,
GScanner *scanner,
added "gint nest_level" to the deserialization functions, so nested calls 2002-05-27 Michael Natterer <mitch@gimp.org> * app/config/gimpconfig.[ch]: added "gint nest_level" to the deserialization functions, so nested calls to deserialize() don't error on the trailing ')'. Made the scanner config parse one-character identifiers and allow G_CSET_A_2_Z for all identifiers. Added gimp_config_deserialize_return() because returning the correct return value from a deserialize() function is not trivial any more with nested calls. * app/config/gimpconfig-deserialize.[ch] * app/config/gimprc.c * app/core/gimpdocumentlist.c * app/core/gimpparasitelist.c: use the new return value utility function and made the main parsing loops simpler. * app/core/gimpunits.c: made the main parsing loops consistent with the stuff that uses GimpConfig. * app/config/gimpconfig-deserialize.c * app/config/gimpconfig-serialize.c: call the (de)serialize_property() functions only if the property's class implements the method itself (does *not* inherit it from one of it's parents). * app/core/gimpcontainer.c: implemented deserialization of containers. For each child entry encountered in the input, check if it's already contained in the container and create it if not. If a "gimp" pointer is passed as user_data pass it as construct property to g_object_new() when creating the object. * app/core/gimpcontext.c: changed deserialization of brush, pattern etc. to honor "no_data". * app/widgets/gimpdeviceinfo.c: added a "gimp" construct_only property which overrides GimpContext's "gimp" property. Moved all initialisation code from gimp_device_info_new() to gimp_device_info_set_property(PROP_GIMP) so it is properly performed if the object is created by GimpContainer's deserialize() implementation. * app/widgets/gimpdevices.c: made gimp_devices_restore_test() work.
2002-05-27 22:04:21 +08:00
gint nest_level,
gpointer data);
gboolean (* serialize_property) (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec,
GString *string);
gboolean (* deserialize_property) (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec,
GScanner *scanner,
GTokenType *expected);
GObject * (* duplicate) (GObject *object);
gboolean (* equal) (GObject *a,
GObject *b);
};
typedef void (* GimpConfigForeachFunc) (const gchar *key,
const gchar *value,
gpointer user_data);
GType gimp_config_interface_get_type (void) G_GNUC_CONST;
gboolean gimp_config_serialize (GObject *object,
const gchar *filename,
const gchar *header,
const gchar *footer,
gpointer data,
GError **error);
gboolean gimp_config_deserialize (GObject *object,
const gchar *filename,
gpointer data,
GError **error);
added "gint nest_level" to the deserialization functions, so nested calls 2002-05-27 Michael Natterer <mitch@gimp.org> * app/config/gimpconfig.[ch]: added "gint nest_level" to the deserialization functions, so nested calls to deserialize() don't error on the trailing ')'. Made the scanner config parse one-character identifiers and allow G_CSET_A_2_Z for all identifiers. Added gimp_config_deserialize_return() because returning the correct return value from a deserialize() function is not trivial any more with nested calls. * app/config/gimpconfig-deserialize.[ch] * app/config/gimprc.c * app/core/gimpdocumentlist.c * app/core/gimpparasitelist.c: use the new return value utility function and made the main parsing loops simpler. * app/core/gimpunits.c: made the main parsing loops consistent with the stuff that uses GimpConfig. * app/config/gimpconfig-deserialize.c * app/config/gimpconfig-serialize.c: call the (de)serialize_property() functions only if the property's class implements the method itself (does *not* inherit it from one of it's parents). * app/core/gimpcontainer.c: implemented deserialization of containers. For each child entry encountered in the input, check if it's already contained in the container and create it if not. If a "gimp" pointer is passed as user_data pass it as construct property to g_object_new() when creating the object. * app/core/gimpcontext.c: changed deserialization of brush, pattern etc. to honor "no_data". * app/widgets/gimpdeviceinfo.c: added a "gimp" construct_only property which overrides GimpContext's "gimp" property. Moved all initialisation code from gimp_device_info_new() to gimp_device_info_set_property(PROP_GIMP) so it is properly performed if the object is created by GimpContainer's deserialize() implementation. * app/widgets/gimpdevices.c: made gimp_devices_restore_test() work.
2002-05-27 22:04:21 +08:00
gboolean gimp_config_deserialize_return (GScanner *scanner,
GTokenType expected_token,
gint nest_level,
const gchar *symbol_name);
GObject * gimp_config_duplicate (GObject *object);
gboolean gimp_config_equal (GObject *a,
GObject *b);
void gimp_config_add_unknown_token (GObject *object,
const gchar *key,
const gchar *value);
const gchar * gimp_config_lookup_unknown_token (GObject *object,
const gchar *key);
void gimp_config_foreach_unknown_token (GObject *object,
GimpConfigForeachFunc func,
gpointer user_data);
#define GIMP_CONFIG_ERROR (gimp_config_error_quark ())
GQuark gimp_config_error_quark (void) G_GNUC_CONST;
void gimp_config_string_indent (GString *string,
gint indent_level);
#endif /* __GIMP_CONFIG_H__ */