Commit 1cee9b72 authored by William Skaggs's avatar William Skaggs

continuing commit after broken pipe

parent 0d9284b2
## Process this file with automake to produce Makefile.in
libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la
libgimpmodule = $(top_builddir)/libgimpmodule/libgimpmodule-$(GIMP_API_VERSION).la
......@@ -114,6 +115,7 @@ gimp_2_3_LDADD = \
$(libgimpthumb) \
$(libgimpmath) \
$(libgimpbase) \
$(libgimpconfig) \
$(REGEXREPL) \
$(GTK_LIBS) \
$(LIBART_LIBS) \
......@@ -158,6 +160,7 @@ gimp_console_2_3_LDADD = \
$(libgimpthumb) \
$(libgimpmath) \
$(libgimpbase) \
$(libgimpconfig) \
$(REGEXREPL) \
$(GDK_PIXBUF_LIBS) \
$(LIBART_LIBS) \
......
......@@ -20,12 +20,11 @@
#include <gtk/gtk.h>
#include "libgimpconfig/gimpconfig.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "config/gimpconfig.h"
#include "config/gimpconfig-utils.h"
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
......
......@@ -22,13 +22,11 @@
#include <gtk/gtk.h>
#include "libgimpconfig/gimpconfig.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "config/gimpconfig.h"
#include "config/gimpconfig-utils.h"
#include "core/gimp.h"
#include "core/gimplist.h"
#include "core/gimptoolinfo.h"
......
......@@ -33,10 +33,11 @@
#include <io.h> /* for _unlink() */
#endif
#include "libgimpconfig/gimpconfig.h"
#include "base-types.h"
#include "config/gimpbaseconfig.h"
#include "config/gimpconfig-path.h"
#include "paint-funcs/paint-funcs.h"
#include "composite/gimp-composite.h"
......
......@@ -35,11 +35,11 @@
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "libgimpconfig/gimpconfig.h"
#include "base-types.h"
#include "config/gimpbaseconfig.h"
#include "config/gimpconfig-path.h"
#include "pixel-region.h"
#include "temp-buf.h"
......
......@@ -8,26 +8,12 @@ noinst_LIBRARIES = libappconfig.a
libappconfig_a_SOURCES = \
config-types.h \
gimpconfig.c \
gimpconfig.h \
gimpconfig-deserialize.c \
gimpconfig-deserialize.h \
gimpconfig-dump.c \
gimpconfig-dump.h \
gimpconfig-error.c \
gimpconfig-error.h \
gimpconfig-file.c \
gimpconfig-file.h \
gimpconfig-params.h \
gimpconfig-path.c \
gimpconfig-path.h \
gimpconfig-serialize.c \
gimpconfig-serialize.h \
gimpconfig-serialize.h \
gimpconfig-utils.c \
gimpconfig-utils.h \
gimpconfigwriter.c \
gimpconfigwriter.h \
gimpbaseconfig.c \
gimpbaseconfig.h \
gimpcoreconfig.c \
......@@ -49,8 +35,6 @@ libappconfig_a_SOURCES = \
gimprc-unknown.h \
gimprc-utils.c \
gimprc-utils.h \
gimpscanner.c \
gimpscanner.h \
gimpxmlparser.c \
gimpxmlparser.h
......@@ -86,6 +70,7 @@ test_config_LDADD = \
$(libgimpcolor) \
$(libgimpmath) \
$(libgimpbase) \
$(libgimpconfig) \
$(GLIB_LIBS)
......
......@@ -23,8 +23,6 @@
#define __CONFIG_TYPES_H__
typedef struct _GimpConfig GimpConfig; /* dummy typedef */
typedef struct _GimpBaseConfig GimpBaseConfig;
typedef struct _GimpCoreConfig GimpCoreConfig;
typedef struct _GimpDisplayConfig GimpDisplayConfig;
......@@ -32,7 +30,6 @@ typedef struct _GimpGuiConfig GimpGuiConfig;
typedef struct _GimpPluginConfig GimpPluginConfig;
typedef struct _GimpRc GimpRc;
typedef struct _GimpConfigWriter GimpConfigWriter;
typedef struct _GimpXmlParser GimpXmlParser;
/* should be in display/display-types.h */
......
......@@ -24,11 +24,10 @@
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpconfig/gimpconfig.h"
#include "config-types.h"
#include "gimpconfig-params.h"
#include "gimprc-blurbs.h"
#include "gimpbaseconfig.h"
......
This diff is collapsed.
/* 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.
*/
#ifndef __GIMP_CONFIG_DESERIALIZE_H__
#define __GIMP_CONFIG_DESERIALIZE_H__
gboolean gimp_config_deserialize_properties (GimpConfig *config,
GScanner *scanner,
gint nest_level);
GTokenType gimp_config_deserialize_property (GimpConfig *config,
GScanner *scanner,
gint nest_level);
#endif /* __GIMP_CONFIG_DESERIALIZE_H__ */
......@@ -31,6 +31,7 @@
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "libgimpconfig/gimpconfig.h"
#ifdef G_OS_WIN32
#include "libgimpbase/gimpwin32-io.h"
......@@ -38,11 +39,7 @@
#include "config-types.h"
#include "gimpconfig.h"
#include "gimpconfig-dump.h"
#include "gimpconfig-params.h"
#include "gimpconfig-serialize.h"
#include "gimpconfigwriter.h"
#include "gimprc.h"
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Config file serialization and deserialization interface
* 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 <glib.h>
#include "gimpconfig-error.h"
GQuark
gimp_config_error_quark (void)
{
static GQuark q = 0;
if (q == 0)
q = g_quark_from_static_string ("gimp-config-error-quark");
return q;
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* Copyright (C) 2003 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.
*/
#ifndef __GIMP_CONFIG_ERROR_H__
#define __GIMP_CONFIG_ERROR_H__
typedef enum
{
GIMP_CONFIG_ERROR_OPEN, /* open failed */
GIMP_CONFIG_ERROR_OPEN_ENOENT, /* file does not exist */
GIMP_CONFIG_ERROR_WRITE, /* write failed */
GIMP_CONFIG_ERROR_PARSE, /* parser error */
GIMP_CONFIG_ERROR_VERSION /* parser failed due to version mismatch */
} GimpConfigError;
#define GIMP_CONFIG_ERROR (gimp_config_error_quark ())
GQuark gimp_config_error_quark (void) G_GNUC_CONST;
#endif /* __GIMP_CONFIG_ERROR_H__ */
......@@ -29,6 +29,7 @@
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpconfig/gimpconfig.h"
#ifdef G_OS_WIN32
#include "libgimpbase/gimpwin32-io.h"
......@@ -36,8 +37,6 @@
#include "config-types.h"
#include "gimpconfig-file.h"
#include "gimp-intl.h"
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* ParamSpecs for config objects
* Copyright (C) 2001 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.
*/
#ifndef __GIMP_CONFIG_PARAMS_H__
#define __GIMP_CONFIG_PARAMS_H__
/*
* GIMP_PARAM_SERIALIZE - A property that can and should be
* serialized and deserialized.
* GIMP_PARAM_AGGREGATE - The object property is to be treated as
* part of the parent object.
* GIMP_PARAM_RESTART - Changes to this property take effect only
* after a restart.
* GIMP_PARAM_CONFIRM - Changes to this property should be
* confirmed by the user before being applied.
* GIMP_PARAM_DEFAULTS - Don't serialize this property if it has the
* default value.
* GIMP_PARAM_IGNORE - This property exists for obscure reasons
* and is needed for backward compatibility.
* Ignore the value read and don't serialize it.
*/
#define GIMP_PARAM_SERIALIZE (1 << (0 + G_PARAM_USER_SHIFT))
#define GIMP_PARAM_AGGREGATE (1 << (1 + G_PARAM_USER_SHIFT))
#define GIMP_PARAM_RESTART (1 << (2 + G_PARAM_USER_SHIFT))
#define GIMP_PARAM_CONFIRM (1 << (3 + G_PARAM_USER_SHIFT))
#define GIMP_PARAM_DEFAULTS (1 << (4 + G_PARAM_USER_SHIFT))
#define GIMP_PARAM_IGNORE (1 << (5 + G_PARAM_USER_SHIFT))
#define GIMP_CONFIG_PARAM_FLAGS (G_PARAM_READWRITE | \
G_PARAM_CONSTRUCT | \
GIMP_PARAM_SERIALIZE)
/* some convenience macros to install object properties */
#define GIMP_CONFIG_INSTALL_PROP_BOOLEAN(class, id,\
name, blurb, default, flags)\
g_object_class_install_property (class, id,\
g_param_spec_boolean (name, NULL, blurb,\
default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_RGB(class, id,\
name, blurb, default, flags)\
g_object_class_install_property (class, id,\
gimp_param_spec_rgb (name, NULL, blurb,\
default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_DOUBLE(class, id,\
name, blurb, min, max, default, flags)\
g_object_class_install_property (class, id,\
g_param_spec_double (name, NULL, blurb,\
min, max, default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_RESOLUTION(class, id,\
name, blurb, default, flags)\
g_object_class_install_property (class, id,\
g_param_spec_double (name, NULL, blurb,\
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION, \
default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_ENUM(class, id,\
name, blurb, enum_type, default, flags)\
g_object_class_install_property (class, id,\
g_param_spec_enum (name, NULL, blurb,\
enum_type, default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_INT(class, id,\
name, blurb, min, max, default, flags)\
g_object_class_install_property (class, id,\
g_param_spec_int (name, NULL, blurb,\
min, max, default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_MATRIX2(class, id,\
name, blurb, default, flags)\
g_object_class_install_property (class, id,\
gimp_param_spec_matrix2 (name, NULL, blurb,\
default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_MEMSIZE(class, id,\
name, blurb, min, max, default, flags)\
g_object_class_install_property (class, id,\
gimp_param_spec_memsize (name, NULL, blurb,\
min, max, default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_PATH(class, id,\
name, blurb, type, default, flags)\
g_object_class_install_property (class, id,\
gimp_param_spec_path (name, NULL, blurb,\
type, default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_STRING(class, id,\
name, blurb, default, flags)\
g_object_class_install_property (class, id,\
g_param_spec_string (name, NULL, blurb,\
default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_UINT(class, id,\
name, blurb, min, max, default, flags)\
g_object_class_install_property (class, id,\
g_param_spec_uint (name, NULL, blurb,\
min, max, default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_UNIT(class, id,\
name, blurb, pixels, percent, default, flags)\
g_object_class_install_property (class, id,\
gimp_param_spec_unit (name, NULL, blurb,\
pixels, percent, default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
/* object and pointer properties are _not_ G_PARAM_CONSTRUCT */
#define GIMP_CONFIG_INSTALL_PROP_OBJECT(class, id,\
name, blurb, object_type, flags)\
g_object_class_install_property (class, id,\
g_param_spec_object (name, NULL, blurb,\
object_type,\
flags |\
G_PARAM_READWRITE | GIMP_PARAM_SERIALIZE))
#define GIMP_CONFIG_INSTALL_PROP_POINTER(class, id,\
name, blurb, flags)\
g_object_class_install_property (class, id,\
g_param_spec_pointer (name, NULL, blurb,\
flags |\
G_PARAM_READWRITE | GIMP_PARAM_SERIALIZE))
#endif /* __GIMP_CONFIG_PARAMS_H__ */
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* String substitution utilities for config files
* Copyright (C) 2001 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>
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "gimpconfig-path.h"
#include "gimp-intl.h"
static gchar * gimp_config_path_expand_only (const gchar *path,
GError **error);
static inline gchar * extract_token (const gchar **str);
/*
* GimpConfig path utilities
*/
gchar *
gimp_config_build_data_path (const gchar *name)
{
return g_strconcat ("${gimp_dir}", G_DIR_SEPARATOR_S, name,
G_SEARCHPATH_SEPARATOR_S,
"${gimp_data_dir}", G_DIR_SEPARATOR_S, name,
NULL);
}
gchar *
gimp_config_build_writable_path (const gchar *name)
{
return g_strconcat ("${gimp_dir}", G_DIR_SEPARATOR_S, name, NULL);
}
gchar *
gimp_config_build_plug_in_path (const gchar *name)
{
return g_strconcat ("${gimp_dir}", G_DIR_SEPARATOR_S, name,
G_SEARCHPATH_SEPARATOR_S,
"${gimp_plug_in_dir}", G_DIR_SEPARATOR_S, name,
NULL);
}
/**
* gimp_config_path_expand:
* @path: a %NUL-terminated string in UTF-8 encoding
* @recode: whether to convert to the filesystem's encoding
* @error: return location for errors
*
* Paths as stored in the gimprc have to be treated special. The
* string may contain special identifiers such as for example
* ${gimp_dir} that have to be substituted before use. Also the user's
* filesystem may be in a different encoding than UTF-8 (which is what
* is used for the gimprc). This function does the variable
* substitution for you and can also attempt to convert to the
* filesystem encoding.
*
* Return value: a newly allocated %NUL-terminated string
**/
gchar *
gimp_config_path_expand (const gchar *path,
gboolean recode,
GError **error)
{
g_return_val_if_fail (path != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (recode)
{
gchar *retval;
gchar *expanded = gimp_config_path_expand_only (path, error);
if (! expanded)
return NULL;
retval = g_filename_from_utf8 (expanded, -1, NULL, NULL, error);
g_free (expanded);
return retval;
}
return gimp_config_path_expand_only (path, error);
}
#define SUBSTS_ALLOC 4
static gchar *
gimp_config_path_expand_only (const gchar *path,
GError **error)
{
const gchar *p;
const gchar *s;
gchar *n;
gchar *token;
gchar *filename = NULL;
gchar *expanded = NULL;
gchar **substs = NULL;
guint n_substs = 0;
gint length = 0;
gint i;
p = path;
while (*p)
{
#ifndef G_OS_WIN32
if (*p == '~')
{
length += strlen (gimp_filename_to_utf8 (g_get_home_dir ()));
p += 1;
}
else
#endif /* G_OS_WIN32 */
if ((token = extract_token (&p)) != NULL)
{
for (i = 0; i < n_substs; i++)
if (strcmp (substs[2*i], token) == 0)
break;
if (i < n_substs)
{
s = substs[2*i+1];
}
else
{
s = NULL;
if (strcmp (token, "gimp_dir") == 0)
s = gimp_directory ();
else if (strcmp (token, "gimp_data_dir") == 0)
s = gimp_data_directory ();
else if (strcmp (token, "gimp_plug_in_dir") == 0 ||
strcmp (token, "gimp_plugin_dir") == 0)
s = gimp_plug_in_directory ();
else if (strcmp (token, "gimp_sysconf_dir") == 0)
s = gimp_sysconf_directory ();
if (!s)
s = g_getenv (token);
#ifdef G_OS_WIN32
/* The default user gimprc on Windows references
* ${TEMP}, but not all Windows installations have that
* environment variable, even if it should be kinda
* standard. So special-case it.
*/
if (!s && strcmp (token, "TEMP") == 0)
s = g_get_tmp_dir ();
#endif /* G_OS_WIN32 */
}
if (!s)
{
g_set_error (error, 0, 0, _("Cannot expand ${%s}"), token);
g_free (token);
goto cleanup;
}
if (n_substs % SUBSTS_ALLOC == 0)
substs = g_renew (gchar *, substs, 2 * (n_substs + SUBSTS_ALLOC));
substs[2*n_substs] = token;
substs[2*n_substs + 1] = (gchar *) gimp_filename_to_utf8 (s);
length += strlen (substs[2*n_substs + 1]);
n_substs++;
}
else
{
length += g_utf8_skip[(const guchar) *p];
p = g_utf8_next_char (p);
}
}
if (n_substs == 0)
return g_strdup (path);
expanded = g_new (gchar, length + 1);
p = path;
n = expanded;
while (*p)
{
#ifndef G_OS_WIN32
if (*p == '~')
{
*n = '\0';
strcat (n, gimp_filename_to_utf8 (g_get_home_dir ()));
n += strlen (gimp_filename_to_utf8 (g_get_home_dir ()));
p += 1;
}
else
#endif /* G_OS_WIN32 */
if ((token = extract_token (&p)) != NULL)
{
for (i = 0; i < n_substs; i++)
{
if (strcmp (substs[2*i], token) == 0)
{
s = substs[2*i+1];
*n = '\0';
strcat (n, s);
n += strlen (s);
break;
}