gimp/app/config/gimpconfig-deserialize.c

772 lines
24 KiB
C
Raw Normal View History

/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Object properties deserialization routines
* Copyright (C) 2001-2002 Sven Neumann <sven@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 <stdio.h>
#include <string.h>
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
#include <sys/types.h>
#include <fcntl.h>
from now on use make.msc from $(TOP)/glib/build/win32; all occurences of 2001-02-17 Hans Breuer <hans@breuer.org> * */*/makefile.msc */makefile.msc : from now on use make.msc from $(TOP)/glib/build/win32; all occurences of DIRENT removed and general update * app/config/makefile.msc app/paint/makefile.msc app/plug-in/makefile.msc themes/Default/makefile.msc : new files * app/base/base.c : ported to GDir usage * app/config/gimpconfig-serialize.c : app/config/gimpconfig-deserialize.c : HAVE_UNISTD_H * app/config/gimpconfig.c : app/config/gimprc.c : HAVE_UNISTD_H, use <io.h> for open() prototype and merged pmode parameter (_S_IREAD | _S_IWRITE) * app/core/cpercep.c : msvc doesn't have cbrt(), provide it via pow(). Also include <glib.h> for painless 'inline' definition. * app/core/gimpdatafiles.c : ported to GDir usage * app/core/gimpimage-convert.c : work around a msvc compiler limitation (can't convert from uint64 to double) * app/file/file-open.c app/file/file-save.c : access() -> _access() for G_OS_WIN32 * app/plug-in/plug-in.c : HAVE_UNISTD_H and <io.h> * libgimpbase/gimpbase.def : updated externals * libgimpbase/gimpenv.c : define WIN32_LEAN_AND_MEAN to avoid clashes with incompatible DATADIR definitions * libgimpcolor/gimpcolor.def : updated externals * lingimpmath/gimpmath.def : updated externals * libgimpwidgets/gimpwidgets.def : updated externals * libgimpwidgets/libgimp-glue.c : adapt to const changes of some prototypes * plug-ins/makefile.msc : disabled gdyntext * plug-ins/gap/iter_ALT/*/*.inc : GimpRunModeType -> GimpRunMode * plug-ins/FractalExplorer/FractalExplorer.c : * plug-ins/gap/gap_lib.c : * plug-ins/gfig/gfig.c : * plug-ins/gflare/gflare.c : * plug-ins/gimpressionist/gimpressionist.c : replaced DIRENT usage with GDir * plug-ins/script-fu/script-fu-scripts.c : #include <windows.h> to get the Sleep() prototype
2002-02-17 23:55:54 +08:00
#ifdef HAVE_UNISTD_H
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
#include <unistd.h>
from now on use make.msc from $(TOP)/glib/build/win32; all occurences of 2001-02-17 Hans Breuer <hans@breuer.org> * */*/makefile.msc */makefile.msc : from now on use make.msc from $(TOP)/glib/build/win32; all occurences of DIRENT removed and general update * app/config/makefile.msc app/paint/makefile.msc app/plug-in/makefile.msc themes/Default/makefile.msc : new files * app/base/base.c : ported to GDir usage * app/config/gimpconfig-serialize.c : app/config/gimpconfig-deserialize.c : HAVE_UNISTD_H * app/config/gimpconfig.c : app/config/gimprc.c : HAVE_UNISTD_H, use <io.h> for open() prototype and merged pmode parameter (_S_IREAD | _S_IWRITE) * app/core/cpercep.c : msvc doesn't have cbrt(), provide it via pow(). Also include <glib.h> for painless 'inline' definition. * app/core/gimpdatafiles.c : ported to GDir usage * app/core/gimpimage-convert.c : work around a msvc compiler limitation (can't convert from uint64 to double) * app/file/file-open.c app/file/file-save.c : access() -> _access() for G_OS_WIN32 * app/plug-in/plug-in.c : HAVE_UNISTD_H and <io.h> * libgimpbase/gimpbase.def : updated externals * libgimpbase/gimpenv.c : define WIN32_LEAN_AND_MEAN to avoid clashes with incompatible DATADIR definitions * libgimpcolor/gimpcolor.def : updated externals * lingimpmath/gimpmath.def : updated externals * libgimpwidgets/gimpwidgets.def : updated externals * libgimpwidgets/libgimp-glue.c : adapt to const changes of some prototypes * plug-ins/makefile.msc : disabled gdyntext * plug-ins/gap/iter_ALT/*/*.inc : GimpRunModeType -> GimpRunMode * plug-ins/FractalExplorer/FractalExplorer.c : * plug-ins/gap/gap_lib.c : * plug-ins/gfig/gfig.c : * plug-ins/gflare/gflare.c : * plug-ins/gimpressionist/gimpressionist.c : replaced DIRENT usage with GDir * plug-ins/script-fu/script-fu-scripts.c : #include <windows.h> to get the Sleep() prototype
2002-02-17 23:55:54 +08:00
#endif
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h"
#include "config-types.h"
#include "gimpconfig.h"
#include "gimpconfig-deserialize.h"
#include "gimpconfig-params.h"
#include "gimpconfig-path.h"
#include "gimpconfig-types.h"
#include "gimpscanner.h"
#include "gimp-intl.h"
/*
* All functions return G_TOKEN_RIGHT_PAREN on success,
* the GTokenType they would have expected but didn't get
* or G_TOKEN_NONE if they got the expected token but
* couldn't parse it.
*/
static GTokenType gimp_config_deserialize_unknown (GimpConfig *config,
GScanner *scanner);
static GTokenType gimp_config_deserialize_property (GimpConfig *config,
GScanner *scanner,
gint nest_level);
static GTokenType gimp_config_deserialize_value (GValue *value,
GimpConfig *config,
GParamSpec *prop_spec,
GScanner *scanner);
static GTokenType gimp_config_deserialize_fundamental (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner);
static GTokenType gimp_config_deserialize_enum (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner);
static GTokenType gimp_config_deserialize_memsize (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner);
static GTokenType gimp_config_deserialize_path (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner);
static GTokenType gimp_config_deserialize_color (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner);
static GTokenType gimp_config_deserialize_matrix2 (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner);
static GTokenType gimp_config_deserialize_object (GValue *value,
GimpConfig *config,
GParamSpec *prop_spec,
GScanner *scanner,
gint nest_level);
static GTokenType gimp_config_deserialize_value_array (GValue *value,
GimpConfig *config,
GParamSpec *prop_spec,
GScanner *scanner);
static GTokenType gimp_config_deserialize_any (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner);
static inline gboolean scanner_string_utf8_valid (GScanner *scanner,
const gchar *token_name);
/**
* gimp_config_deserialize_properties:
* @config: a #GimpConfig.
* @scanner: a #GScanner.
* @nest_level:
* @store_unknown_tokens: %TRUE if you want to store unknown tokens.
*
* This function uses the @scanner to configure the properties of @config.
*
* The store_unknown_tokens parameter is a special feature for #GimpRc.
* If it set to %TRUE, unknown tokens (e.g. tokens that don't refer to
* a property of @config) with string values are attached to @config as
* unknown tokens. GimpConfig has a couple of functions to handle the
* attached key/value pairs.
*
* Return value:
**/
gboolean
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
gimp_config_deserialize_properties (GimpConfig *config,
GScanner *scanner,
gint nest_level,
gboolean store_unknown_tokens)
{
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
GObjectClass *klass;
GParamSpec **property_specs;
guint n_property_specs;
guint i;
guint scope_id;
guint old_scope_id;
GTokenType token;
GTokenType next;
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
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
klass = G_OBJECT_GET_CLASS (config);
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
property_specs = g_object_class_list_properties (klass, &n_property_specs);
if (!property_specs)
return TRUE;
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
scope_id = g_type_qname (G_TYPE_FROM_INSTANCE (config));
old_scope_id = g_scanner_set_scope (scanner, scope_id);
for (i = 0; i < n_property_specs; i++)
{
GParamSpec *prop_spec = property_specs[i];
if (prop_spec->flags & GIMP_PARAM_SERIALIZE)
{
g_scanner_scope_add_symbol (scanner, scope_id,
prop_spec->name, prop_spec);
}
}
g_free (property_specs);
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
g_object_freeze_notify (G_OBJECT (config));
token = G_TOKEN_LEFT_PAREN;
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
while (TRUE)
{
next = g_scanner_peek_next_token (scanner);
if (next != token &&
! (store_unknown_tokens &&
token == G_TOKEN_SYMBOL && next == G_TOKEN_IDENTIFIER))
{
break;
}
token = g_scanner_get_next_token (scanner);
switch (token)
{
case G_TOKEN_LEFT_PAREN:
token = G_TOKEN_SYMBOL;
break;
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
case G_TOKEN_IDENTIFIER:
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
token = gimp_config_deserialize_unknown (config, scanner);
break;
case G_TOKEN_SYMBOL:
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
token = gimp_config_deserialize_property (config,
scanner, nest_level);
break;
case G_TOKEN_RIGHT_PAREN:
token = G_TOKEN_LEFT_PAREN;
break;
default: /* do nothing */
break;
}
}
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
g_scanner_set_scope (scanner, old_scope_id);
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
g_object_thaw_notify (G_OBJECT (config));
if (token == G_TOKEN_NONE)
return FALSE;
/* If store_unknown_tokens is TRUE but the unknown token value couldn't
be parsed the default error message is rather confusing.
We try to produce something more meaningful here ... */
if ((store_unknown_tokens &&
token == G_TOKEN_STRING && next == G_TOKEN_IDENTIFIER))
{
g_scanner_unexp_token (scanner, G_TOKEN_SYMBOL, NULL, NULL, NULL,
_("fatal parse error"), TRUE);
return FALSE;
}
return gimp_config_deserialize_return (scanner, token, nest_level);
}
static GTokenType
gimp_config_deserialize_unknown (GimpConfig *config,
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
GScanner *scanner)
{
gchar *key;
guint old_scope_id;
old_scope_id = g_scanner_set_scope (scanner, 0);
if (g_scanner_peek_next_token (scanner) != G_TOKEN_STRING)
return G_TOKEN_STRING;
key = g_strdup (scanner->value.v_identifier);
g_scanner_get_next_token (scanner);
g_scanner_set_scope (scanner, old_scope_id);
if (!scanner_string_utf8_valid (scanner, key))
{
g_free (key);
return G_TOKEN_NONE;
}
gimp_config_add_unknown_token (config, key, scanner->value.v_string);
g_free (key);
return G_TOKEN_RIGHT_PAREN;
}
static GTokenType
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
gimp_config_deserialize_property (GimpConfig *config,
GScanner *scanner,
gint nest_level)
{
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
GTypeClass *owner_class;
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
GimpConfigInterface *config_iface;
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
GimpConfigInterface *parent_iface;
GParamSpec *prop_spec;
GTokenType token = G_TOKEN_RIGHT_PAREN;
GValue value = { 0, };
guint old_scope_id;
old_scope_id = g_scanner_set_scope (scanner, 0);
prop_spec = G_PARAM_SPEC (scanner->value.v_symbol);
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
g_value_init (&value, prop_spec->value_type);
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
owner_class = g_type_class_peek (prop_spec->owner_type);
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
config_iface = g_type_interface_peek (owner_class, GIMP_TYPE_CONFIG);
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
/* We must call deserialize_property() *only* if the *exact* class
* which implements it is param_spec->owner_type's class.
*
* Therefore, we ask param_spec->owner_type's immediate parent class
* for it's GimpConfigInterface and check if we get a different pointer.
*
* (if the pointers are the same, param_spec->owner_type's
* GimpConfigInterface is inherited from one of it's parent classes
* and thus not able to handle param_spec->owner_type's properties).
*/
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
if (config_iface)
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
{
GTypeClass *owner_parent_class;
owner_parent_class = g_type_class_peek_parent (owner_class),
parent_iface = g_type_interface_peek (owner_parent_class,
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
GIMP_TYPE_CONFIG);
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
}
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
if (config_iface &&
config_iface != parent_iface && /* see comment above */
config_iface->deserialize_property &&
config_iface->deserialize_property (config,
prop_spec->param_id,
&value,
prop_spec,
scanner,
&token))
{
/* nop */
}
else
{
if (G_VALUE_HOLDS_OBJECT (&value))
token = gimp_config_deserialize_object (&value,
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
config, prop_spec,
scanner, nest_level);
else
token = gimp_config_deserialize_value (&value,
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
config, prop_spec, scanner);
}
if (token == G_TOKEN_RIGHT_PAREN &&
g_scanner_peek_next_token (scanner) == token)
{
made object properties G_PARAM_READWRITE by default. Added flag 2003-04-12 Michael Natterer <mitch@gimp.org> * app/config/gimpconfig-params.h: made object properties G_PARAM_READWRITE by default. Added flag GIMP_PARAM_AGGREGATE which indicates that an object property is not a reference but a real part of its owner. * app/config/gimpconfig-deserialize.c: g_object_set_property() object properties only if they are not GIMP_PARAM_AGGREGATE. * app/config/gimpconfig-utils.c (gimp_config_copy_properties, gimp_config_reset_properties): copy and reset GIMP_PARAM_AGGREGATE object properties correctly. * app/config/gimpconfig-serialize.c: don't call gimp_config_writer_open/close() for properties which are handled by a GimpConfigIface::serialize_property() implementation. * app/core/gimpcontext.c: removed exlicit G_PARAM_WRITABLE from object properties since that's the default now. Call gimp_config_writer_open/close() when serializing properties. * app/core/gimpviewable.c (gimp_viewable_get_property): use gimp_viewable_get_stock_id(). (gimp_viewable_set_stock_id): set stock_id to NULL if the new stock_id is the same as viewable_class->default_stock_id. Added serialize_property() which skips stock_id serialization if it is NULL. * app/tools/gimptextoptions.c: made the "text" property GIMP_PARAM_AGGREGATE. Added gimp_text_options_set_property() (which does nothing). * app/widgets/gimptemplateeditor.[ch]: added an optional GimpViewableButton to change the template's icon. * app/gui/file-new-dialog.c: create it with the icon button so it gets some testing.
2003-04-13 03:06:25 +08:00
if (! (G_VALUE_HOLDS_OBJECT (&value) &&
(prop_spec->flags & GIMP_PARAM_AGGREGATE)))
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
g_object_set_property (G_OBJECT (config), prop_spec->name, &value);
}
#ifdef CONFIG_DEBUG
else
{
g_warning ("couldn't deserialize property %s::%s of type %s",
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
g_type_name (G_TYPE_FROM_INSTANCE (config)),
prop_spec->name,
g_type_name (prop_spec->value_type));
}
#endif
g_value_unset (&value);
g_scanner_set_scope (scanner, old_scope_id);
return token;
}
static GTokenType
gimp_config_deserialize_value (GValue *value,
GimpConfig *config,
GParamSpec *prop_spec,
GScanner *scanner)
{
if (G_TYPE_FUNDAMENTAL (prop_spec->value_type) == G_TYPE_ENUM)
{
return gimp_config_deserialize_enum (value, prop_spec, scanner);
}
else if (G_TYPE_IS_FUNDAMENTAL (prop_spec->value_type))
{
return gimp_config_deserialize_fundamental (value, prop_spec, scanner);
}
else if (prop_spec->value_type == GIMP_TYPE_MEMSIZE)
{
return gimp_config_deserialize_memsize (value, prop_spec, scanner);
}
else if (prop_spec->value_type == GIMP_TYPE_PATH)
{
return gimp_config_deserialize_path (value, prop_spec, scanner);
}
else if (prop_spec->value_type == GIMP_TYPE_COLOR)
{
return gimp_config_deserialize_color (value, prop_spec, scanner);
}
else if (prop_spec->value_type == GIMP_TYPE_MATRIX2)
{
return gimp_config_deserialize_matrix2 (value, prop_spec, scanner);
}
else if (prop_spec->value_type == G_TYPE_VALUE_ARRAY)
{
return gimp_config_deserialize_value_array (value,
config, prop_spec, scanner);
}
/* This fallback will only work for value_types that
* can be transformed from a string value.
*/
return gimp_config_deserialize_any (value, prop_spec, scanner);
}
static GTokenType
gimp_config_deserialize_fundamental (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner)
{
GTokenType token;
GType value_type;
gboolean negate = FALSE;
value_type = G_TYPE_FUNDAMENTAL (prop_spec->value_type);
switch (value_type)
{
case G_TYPE_STRING:
token = G_TOKEN_STRING;
break;
case G_TYPE_BOOLEAN:
token = G_TOKEN_IDENTIFIER;
break;
case G_TYPE_INT:
case G_TYPE_LONG:
case G_TYPE_INT64:
if (g_scanner_peek_next_token (scanner) == '-')
{
negate = TRUE;
g_scanner_get_next_token (scanner);
}
/* fallthrough */
case G_TYPE_UINT:
case G_TYPE_ULONG:
case G_TYPE_UINT64:
token = G_TOKEN_INT;
break;
case G_TYPE_FLOAT:
case G_TYPE_DOUBLE:
if (g_scanner_peek_next_token (scanner) == '-')
{
negate = TRUE;
g_scanner_get_next_token (scanner);
}
token = G_TOKEN_FLOAT;
break;
default:
token = G_TOKEN_NONE;
g_assert_not_reached ();
break;
}
if (g_scanner_peek_next_token (scanner) != token)
{
return token;
}
g_scanner_get_next_token (scanner);
switch (value_type)
{
case G_TYPE_STRING:
if (scanner_string_utf8_valid (scanner, prop_spec->name))
g_value_set_static_string (value, scanner->value.v_string);
else
return G_TOKEN_NONE;
break;
case G_TYPE_BOOLEAN:
if (! g_ascii_strcasecmp (scanner->value.v_identifier, "yes") ||
! g_ascii_strcasecmp (scanner->value.v_identifier, "true"))
g_value_set_boolean (value, TRUE);
else if (! g_ascii_strcasecmp (scanner->value.v_identifier, "no") ||
! g_ascii_strcasecmp (scanner->value.v_identifier, "false"))
g_value_set_boolean (value, FALSE);
else
{
g_scanner_error
(scanner,
/* please don't translate 'yes' and 'no' */
_("expected 'yes' or 'no' for boolean token %s, got '%s'"),
prop_spec->name, scanner->value.v_identifier);
return G_TOKEN_NONE;
}
break;
case G_TYPE_INT:
g_value_set_int (value, (negate ?
- scanner->value.v_int64 :
scanner->value.v_int64));
break;
case G_TYPE_UINT:
g_value_set_uint (value, scanner->value.v_int64);
break;
case G_TYPE_LONG:
g_value_set_long (value, (negate ?
- scanner->value.v_int64 :
scanner->value.v_int64));
break;
case G_TYPE_ULONG:
g_value_set_ulong (value, scanner->value.v_int64);
break;
case G_TYPE_INT64:
g_value_set_int64 (value, (negate ?
- scanner->value.v_int64 :
scanner->value.v_int64));
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
break;
case G_TYPE_UINT64:
g_value_set_uint64 (value, scanner->value.v_int64);
break;
case G_TYPE_FLOAT:
g_value_set_float (value, negate ?
- scanner->value.v_float : scanner->value.v_float);
break;
case G_TYPE_DOUBLE:
g_value_set_double (value, negate ?
- scanner->value.v_float: scanner->value.v_float);
break;
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
default:
g_assert_not_reached ();
break;
}
return G_TOKEN_RIGHT_PAREN;
}
static GTokenType
gimp_config_deserialize_enum (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner)
{
GEnumClass *enum_class;
GEnumValue *enum_value;
enum_class = g_type_class_peek (G_VALUE_TYPE (value));
switch (g_scanner_peek_next_token (scanner))
{
case G_TOKEN_IDENTIFIER:
g_scanner_get_next_token (scanner);
enum_value = g_enum_get_value_by_nick (G_ENUM_CLASS (enum_class),
scanner->value.v_identifier);
if (!enum_value)
enum_value = g_enum_get_value_by_name (G_ENUM_CLASS (enum_class),
scanner->value.v_identifier);
if (!enum_value)
{
g_scanner_error (scanner,
_("invalid value '%s' for token %s"),
scanner->value.v_identifier, prop_spec->name);
return G_TOKEN_NONE;
}
break;
case G_TOKEN_INT:
g_scanner_get_next_token (scanner);
enum_value = g_enum_get_value (enum_class,
(gint) scanner->value.v_int64);
if (!enum_value)
{
g_scanner_error (scanner,
_("invalid value '%ld' for token %s"),
(glong) scanner->value.v_int64, prop_spec->name);
return G_TOKEN_NONE;
}
break;
default:
return G_TOKEN_IDENTIFIER;
}
g_value_set_enum (value, enum_value->value);
return G_TOKEN_RIGHT_PAREN;
}
static GTokenType
gimp_config_deserialize_memsize (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner)
{
gchar *orig_cset_first = scanner->config->cset_identifier_first;
gchar *orig_cset_nth = scanner->config->cset_identifier_nth;
scanner->config->cset_identifier_first = G_CSET_DIGITS;
scanner->config->cset_identifier_nth = G_CSET_DIGITS "gGmMkKbB";
if (g_scanner_peek_next_token (scanner) != G_TOKEN_IDENTIFIER)
return G_TOKEN_IDENTIFIER;
g_scanner_get_next_token (scanner);
scanner->config->cset_identifier_first = orig_cset_first;
scanner->config->cset_identifier_nth = orig_cset_nth;
if (gimp_memsize_set_from_string (value, scanner->value.v_identifier))
return G_TOKEN_RIGHT_PAREN;
else
return G_TOKEN_NONE;
}
static GTokenType
gimp_config_deserialize_path (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner)
{
GError *error = NULL;
if (g_scanner_peek_next_token (scanner) != G_TOKEN_STRING)
return G_TOKEN_STRING;
g_scanner_get_next_token (scanner);
if (!scanner_string_utf8_valid (scanner, prop_spec->name))
return G_TOKEN_NONE;
if (scanner->value.v_string)
{
/* Check if the string can be expanded
* and converted to the filesystem encoding.
*/
gchar *expand = gimp_config_path_expand (scanner->value.v_string,
TRUE, &error);
if (!expand)
{
g_scanner_error (scanner,
_("while parsing token %s: %s"),
prop_spec->name, error->message);
g_error_free (error);
return G_TOKEN_NONE;
}
g_free (expand);
g_value_set_static_string (value, scanner->value.v_string);
}
return G_TOKEN_RIGHT_PAREN;
}
static GTokenType
gimp_config_deserialize_color (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner)
{
GimpRGB color;
if (! gimp_scanner_parse_color (scanner, &color))
return G_TOKEN_NONE;
g_value_set_boxed (value, &color);
return G_TOKEN_RIGHT_PAREN;
}
static GTokenType
gimp_config_deserialize_matrix2 (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner)
{
GimpMatrix2 matrix;
if (! gimp_scanner_parse_matrix2 (scanner, &matrix))
return G_TOKEN_NONE;
g_value_set_boxed (value, &matrix);
return G_TOKEN_RIGHT_PAREN;
}
static GTokenType
gimp_config_deserialize_object (GValue *value,
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
GimpConfig *config,
GParamSpec *prop_spec,
GScanner *scanner,
gint nest_level)
{
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
GimpConfigInterface *config_iface;
GimpConfig *prop_object;
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
g_object_get_property (G_OBJECT (config), prop_spec->name, value);
prop_object = g_value_get_object (value);
if (! prop_object)
return G_TOKEN_RIGHT_PAREN;
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
config_iface = GIMP_CONFIG_GET_INTERFACE (prop_object);
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
if (! config_iface)
return gimp_config_deserialize_any (value, prop_spec, scanner);
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
if (! config_iface->deserialize (prop_object, scanner, nest_level + 1, NULL))
return G_TOKEN_NONE;
return G_TOKEN_RIGHT_PAREN;
}
static GTokenType
gimp_config_deserialize_value_array (GValue *value,
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
GimpConfig *config,
GParamSpec *prop_spec,
GScanner *scanner)
{
GParamSpecValueArray *array_spec;
GValueArray *array;
GValue array_value = { 0, };
gint n_values;
GTokenType token;
gint i;
array_spec = G_PARAM_SPEC_VALUE_ARRAY (prop_spec);
if (! gimp_scanner_parse_int (scanner, &n_values))
return G_TOKEN_INT;
array = g_value_array_new (n_values);
for (i = 0; i < n_values; i++)
{
g_value_init (&array_value, array_spec->element_spec->value_type);
token = gimp_config_deserialize_value (&array_value,
app/widgets/gimpdocked.[ch] renamed GimpDockedIface to 2003-10-11 Sven Neumann <sven@gimp.org> * app/widgets/gimpdocked.[ch] * app/widgets/widgets-types.h: renamed GimpDockedIface to GimpDockedInterface. * app/display/gimpnavigationview.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerview.c * app/widgets/gimpeditor.c * app/widgets/gimpimageeditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimptooloptionseditor.c: changed accordingly. * app/config/config-types.h * app/config/gimpconfig.[ch] * app/config/gimpconfig-deserialize.[ch] * app/config/gimpconfig-serialize.[ch] * app/config/gimpconfig-utils.[ch]: added a GimpConfig typedef and changed the GimpConfig API to take GimpConfig instead of GObject pointers. * app/config/gimpconfig-dump.c * app/config/gimprc.c * app/config/test-config.c * app/core/gimp-documents.c * app/core/gimp-parasites.c * app/core/gimp-templates.c * app/core/gimp.[ch] * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdocumentlist.c * app/core/gimpgrid.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimpparasitelist.c * app/core/gimptemplate.c * app/core/gimptooloptions.c * app/core/gimpviewable.c * app/gui/grid-dialog.c * app/gui/preferences-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tool-options-commands.c * app/paint/gimppaintcore.c * app/pdb/gimprc_cmds.c * app/text/gimptext-parasite.c * app/text/gimptext.c * app/text/gimptextlayer.c * app/tools/gimp-tools.c * app/tools/gimptexttool.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * tools/pdbgen/pdb/gimprc.pdb: changed accordingly.
2003-10-11 22:30:18 +08:00
config,
array_spec->element_spec,
scanner);
if (token == G_TOKEN_RIGHT_PAREN)
g_value_array_append (array, &array_value);
g_value_unset (&array_value);
if (token != G_TOKEN_RIGHT_PAREN)
return token;
}
g_value_set_boxed_take_ownership (value, array);
return G_TOKEN_RIGHT_PAREN;
}
static GTokenType
gimp_config_deserialize_any (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner)
{
GValue src = { 0, };
if (!g_value_type_transformable (G_TYPE_STRING, prop_spec->value_type))
{
g_warning ("%s: %s can not be transformed from a string",
G_STRLOC, g_type_name (prop_spec->value_type));
return G_TOKEN_NONE;
}
if (g_scanner_peek_next_token (scanner) != G_TOKEN_IDENTIFIER)
return G_TOKEN_IDENTIFIER;
g_scanner_get_next_token (scanner);
g_value_init (&src, G_TYPE_STRING);
g_value_set_static_string (&src, scanner->value.v_identifier);
g_value_transform (&src, value);
g_value_unset (&src);
return G_TOKEN_RIGHT_PAREN;
}
static inline gboolean
scanner_string_utf8_valid (GScanner *scanner,
const gchar *token_name)
{
if (g_utf8_validate (scanner->value.v_string, -1, NULL))
return TRUE;
g_scanner_error (scanner,
_("value for token %s is not a valid UTF-8 string"),
token_name);
return FALSE;
}