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.
This commit is contained in:
Sven Neumann 2003-10-11 14:30:18 +00:00 committed by Sven Neumann
parent 99746e1d6c
commit a88e11afb3
70 changed files with 1092 additions and 1084 deletions

View File

@ -1,3 +1,61 @@
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-10 Michael Natterer <mitch@gimp.org> 2003-10-10 Michael Natterer <mitch@gimp.org>
* app/widgets/Makefile.am * app/widgets/Makefile.am

View File

@ -24,6 +24,7 @@
#include "gui-types.h" #include "gui-types.h"
#include "config/gimpconfig.h"
#include "config/gimpconfig-utils.h" #include "config/gimpconfig-utils.h"
#include "core/gimp.h" #include "core/gimp.h"
@ -103,8 +104,8 @@ templates_new_template_ok_callback (GtkWidget *widget,
template = g_object_get_data (G_OBJECT (dialog), "gimp-template"); template = g_object_get_data (G_OBJECT (dialog), "gimp-template");
gimp = g_object_get_data (G_OBJECT (dialog), "gimp"); gimp = g_object_get_data (G_OBJECT (dialog), "gimp");
gimp_config_copy_properties (G_OBJECT (editor->template), gimp_config_copy_properties (GIMP_CONFIG (editor->template),
G_OBJECT (template)); GIMP_CONFIG (template));
gimp_list_uniquefy_name (GIMP_LIST (gimp->templates), gimp_list_uniquefy_name (GIMP_LIST (gimp->templates),
GIMP_OBJECT (template), TRUE); GIMP_OBJECT (template), TRUE);
@ -181,8 +182,8 @@ templates_edit_template_ok_callback (GtkWidget *widget,
template = g_object_get_data (G_OBJECT (dialog), "gimp-template"); template = g_object_get_data (G_OBJECT (dialog), "gimp-template");
gimp = g_object_get_data (G_OBJECT (dialog), "gimp"); gimp = g_object_get_data (G_OBJECT (dialog), "gimp");
gimp_config_copy_properties (G_OBJECT (editor->template), gimp_config_copy_properties (GIMP_CONFIG (editor->template),
G_OBJECT (template)); GIMP_CONFIG (template));
gimp_list_uniquefy_name (GIMP_LIST (gimp->templates), gimp_list_uniquefy_name (GIMP_LIST (gimp->templates),
GIMP_OBJECT (template), TRUE); GIMP_OBJECT (template), TRUE);

View File

@ -66,8 +66,8 @@ tool_options_save_to_cmd_callback (GtkWidget *widget,
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (options))); name = g_strdup (gimp_object_get_name (GIMP_OBJECT (options)));
gimp_config_copy_properties (G_OBJECT (options->tool_info->tool_options), gimp_config_copy_properties (GIMP_CONFIG (options->tool_info->tool_options),
G_OBJECT (options)); GIMP_CONFIG (options));
gimp_object_set_name (GIMP_OBJECT (options), name); gimp_object_set_name (GIMP_OBJECT (options), name);
g_free (name); g_free (name);
@ -105,8 +105,8 @@ tool_options_restore_from_cmd_callback (GtkWidget *widget,
{ {
GimpToolOptions *options = GIMP_TOOL_OPTIONS (data); GimpToolOptions *options = GIMP_TOOL_OPTIONS (data);
gimp_config_copy_properties (G_OBJECT (options), gimp_config_copy_properties (GIMP_CONFIG (options),
G_OBJECT (options->tool_info->tool_options)); GIMP_CONFIG (options->tool_info->tool_options));
} }
void void
@ -170,12 +170,12 @@ tool_options_save_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
GimpToolInfo *tool_info = GIMP_TOOL_INFO (data); GimpToolInfo *tool_info = GIMP_TOOL_INFO (data);
GObject *copy; GimpConfig *copy;
if (! name || ! strlen (name)) if (! name || ! strlen (name))
name = _("Saved Options"); name = _("Saved Options");
copy = gimp_config_duplicate (G_OBJECT (tool_info->tool_options)); copy = gimp_config_duplicate (GIMP_CONFIG (tool_info->tool_options));
gimp_object_set_name (GIMP_OBJECT (copy), name); gimp_object_set_name (GIMP_OBJECT (copy), name);
gimp_list_uniquefy_name (GIMP_LIST (tool_info->options_presets), gimp_list_uniquefy_name (GIMP_LIST (tool_info->options_presets),

View File

@ -23,6 +23,9 @@
#define __CONFIG_TYPES_H__ #define __CONFIG_TYPES_H__
typedef struct _GimpConfig GimpConfig; /* dummy typedef */
typedef struct _GimpConfigInterface GimpConfigInterface;
typedef struct _GimpBaseConfig GimpBaseConfig; typedef struct _GimpBaseConfig GimpBaseConfig;
typedef struct _GimpCoreConfig GimpCoreConfig; typedef struct _GimpCoreConfig GimpCoreConfig;
typedef struct _GimpDisplayConfig GimpDisplayConfig; typedef struct _GimpDisplayConfig GimpDisplayConfig;

View File

@ -54,13 +54,13 @@
* couldn't parse it. * couldn't parse it.
*/ */
static GTokenType gimp_config_deserialize_unknown (GObject *object, static GTokenType gimp_config_deserialize_unknown (GimpConfig *object,
GScanner *scanner); GScanner *scanner);
static GTokenType gimp_config_deserialize_property (GObject *object, static GTokenType gimp_config_deserialize_property (GimpConfig *object,
GScanner *scanner, GScanner *scanner,
gint nest_level); gint nest_level);
static GTokenType gimp_config_deserialize_value (GValue *value, static GTokenType gimp_config_deserialize_value (GValue *value,
GObject *object, GimpConfig *object,
GParamSpec *prop_spec, GParamSpec *prop_spec,
GScanner *scanner); GScanner *scanner);
static GTokenType gimp_config_deserialize_fundamental (GValue *value, static GTokenType gimp_config_deserialize_fundamental (GValue *value,
@ -82,12 +82,12 @@ static GTokenType gimp_config_deserialize_matrix2 (GValue *value,
GParamSpec *prop_spec, GParamSpec *prop_spec,
GScanner *scanner); GScanner *scanner);
static GTokenType gimp_config_deserialize_object (GValue *value, static GTokenType gimp_config_deserialize_object (GValue *value,
GObject *object, GimpConfig *object,
GParamSpec *prop_spec, GParamSpec *prop_spec,
GScanner *scanner, GScanner *scanner,
gint nest_level); gint nest_level);
static GTokenType gimp_config_deserialize_value_array (GValue *value, static GTokenType gimp_config_deserialize_value_array (GValue *value,
GObject *object, GimpConfig *object,
GParamSpec *prop_spec, GParamSpec *prop_spec,
GScanner *scanner); GScanner *scanner);
static GTokenType gimp_config_deserialize_any (GValue *value, static GTokenType gimp_config_deserialize_any (GValue *value,
@ -100,7 +100,7 @@ static inline gboolean scanner_string_utf8_valid (GScanner *scanner,
/** /**
* gimp_config_deserialize_properties: * gimp_config_deserialize_properties:
* @object: a #GObject. * @object: a #GimpConfig.
* @scanner: a #GScanner. * @scanner: a #GScanner.
* @nest_level: * @nest_level:
* @store_unknown_tokens: %TRUE if you want to store unknown tokens. * @store_unknown_tokens: %TRUE if you want to store unknown tokens.
@ -116,10 +116,10 @@ static inline gboolean scanner_string_utf8_valid (GScanner *scanner,
* Return value: * Return value:
**/ **/
gboolean gboolean
gimp_config_deserialize_properties (GObject *object, gimp_config_deserialize_properties (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gboolean store_unknown_tokens) gboolean store_unknown_tokens)
{ {
GObjectClass *klass; GObjectClass *klass;
GParamSpec **property_specs; GParamSpec **property_specs;
@ -130,15 +130,15 @@ gimp_config_deserialize_properties (GObject *object,
GTokenType token; GTokenType token;
GTokenType next; GTokenType next;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
klass = G_OBJECT_GET_CLASS (object); klass = G_OBJECT_GET_CLASS (config);
property_specs = g_object_class_list_properties (klass, &n_property_specs); property_specs = g_object_class_list_properties (klass, &n_property_specs);
if (!property_specs) if (!property_specs)
return TRUE; return TRUE;
scope_id = g_type_qname (G_TYPE_FROM_INSTANCE (object)); scope_id = g_type_qname (G_TYPE_FROM_INSTANCE (config));
old_scope_id = g_scanner_set_scope (scanner, scope_id); old_scope_id = g_scanner_set_scope (scanner, scope_id);
for (i = 0; i < n_property_specs; i++) for (i = 0; i < n_property_specs; i++)
@ -154,7 +154,7 @@ gimp_config_deserialize_properties (GObject *object,
g_free (property_specs); g_free (property_specs);
g_object_freeze_notify (object); g_object_freeze_notify (G_OBJECT (config));
token = G_TOKEN_LEFT_PAREN; token = G_TOKEN_LEFT_PAREN;
@ -178,11 +178,11 @@ gimp_config_deserialize_properties (GObject *object,
break; break;
case G_TOKEN_IDENTIFIER: case G_TOKEN_IDENTIFIER:
token = gimp_config_deserialize_unknown (object, scanner); token = gimp_config_deserialize_unknown (config, scanner);
break; break;
case G_TOKEN_SYMBOL: case G_TOKEN_SYMBOL:
token = gimp_config_deserialize_property (object, token = gimp_config_deserialize_property (config,
scanner, nest_level); scanner, nest_level);
break; break;
@ -197,7 +197,7 @@ gimp_config_deserialize_properties (GObject *object,
g_scanner_set_scope (scanner, old_scope_id); g_scanner_set_scope (scanner, old_scope_id);
g_object_thaw_notify (object); g_object_thaw_notify (G_OBJECT (config));
/* If store_unknown_tokens is TRUE but the unknown token value couldn't /* If store_unknown_tokens is TRUE but the unknown token value couldn't
be parsed the default error message is rather confusing. be parsed the default error message is rather confusing.
@ -214,8 +214,8 @@ gimp_config_deserialize_properties (GObject *object,
} }
static GTokenType static GTokenType
gimp_config_deserialize_unknown (GObject *object, gimp_config_deserialize_unknown (GimpConfig *object,
GScanner *scanner) GScanner *scanner)
{ {
gchar *key; gchar *key;
@ -239,12 +239,12 @@ gimp_config_deserialize_unknown (GObject *object,
} }
static GTokenType static GTokenType
gimp_config_deserialize_property (GObject *object, gimp_config_deserialize_property (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level) gint nest_level)
{ {
GTypeClass *owner_class; GTypeClass *owner_class;
GimpConfigInterface *gimp_config_iface; GimpConfigInterface *config_iface;
GimpConfigInterface *parent_iface; GimpConfigInterface *parent_iface;
GParamSpec *prop_spec; GParamSpec *prop_spec;
GTokenType token = G_TOKEN_RIGHT_PAREN; GTokenType token = G_TOKEN_RIGHT_PAREN;
@ -256,8 +256,7 @@ gimp_config_deserialize_property (GObject *object,
owner_class = g_type_class_peek (prop_spec->owner_type); owner_class = g_type_class_peek (prop_spec->owner_type);
gimp_config_iface = g_type_interface_peek (owner_class, config_iface = g_type_interface_peek (owner_class, GIMP_TYPE_CONFIG);
GIMP_TYPE_CONFIG_INTERFACE);
/* We must call deserialize_property() *only* if the *exact* class /* We must call deserialize_property() *only* if the *exact* class
* which implements it is param_spec->owner_type's class. * which implements it is param_spec->owner_type's class.
@ -269,25 +268,25 @@ gimp_config_deserialize_property (GObject *object,
* GimpConfigInterface is inherited from one of it's parent classes * GimpConfigInterface is inherited from one of it's parent classes
* and thus not able to handle param_spec->owner_type's properties). * and thus not able to handle param_spec->owner_type's properties).
*/ */
if (gimp_config_iface) if (config_iface)
{ {
GTypeClass *owner_parent_class; GTypeClass *owner_parent_class;
owner_parent_class = g_type_class_peek_parent (owner_class), owner_parent_class = g_type_class_peek_parent (owner_class),
parent_iface = g_type_interface_peek (owner_parent_class, parent_iface = g_type_interface_peek (owner_parent_class,
GIMP_TYPE_CONFIG_INTERFACE); GIMP_TYPE_CONFIG);
} }
if (gimp_config_iface && if (config_iface &&
gimp_config_iface != parent_iface && /* see comment above */ config_iface != parent_iface && /* see comment above */
gimp_config_iface->deserialize_property && config_iface->deserialize_property &&
gimp_config_iface->deserialize_property (object, config_iface->deserialize_property (config,
prop_spec->param_id, prop_spec->param_id,
&value, &value,
prop_spec, prop_spec,
scanner, scanner,
&token)) &token))
{ {
/* nop */ /* nop */
} }
@ -295,11 +294,11 @@ gimp_config_deserialize_property (GObject *object,
{ {
if (G_VALUE_HOLDS_OBJECT (&value)) if (G_VALUE_HOLDS_OBJECT (&value))
token = gimp_config_deserialize_object (&value, token = gimp_config_deserialize_object (&value,
object, prop_spec, config, prop_spec,
scanner, nest_level); scanner, nest_level);
else else
token = gimp_config_deserialize_value (&value, token = gimp_config_deserialize_value (&value,
object, prop_spec, scanner); config, prop_spec, scanner);
} }
if (token == G_TOKEN_RIGHT_PAREN && if (token == G_TOKEN_RIGHT_PAREN &&
@ -307,13 +306,13 @@ gimp_config_deserialize_property (GObject *object,
{ {
if (! (G_VALUE_HOLDS_OBJECT (&value) && if (! (G_VALUE_HOLDS_OBJECT (&value) &&
(prop_spec->flags & GIMP_PARAM_AGGREGATE))) (prop_spec->flags & GIMP_PARAM_AGGREGATE)))
g_object_set_property (object, prop_spec->name, &value); g_object_set_property (G_OBJECT (config), prop_spec->name, &value);
} }
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
else else
{ {
g_warning ("couldn't deserialize property %s::%s of type %s", g_warning ("couldn't deserialize property %s::%s of type %s",
g_type_name (G_TYPE_FROM_INSTANCE (object)), g_type_name (G_TYPE_FROM_INSTANCE (config)),
prop_spec->name, prop_spec->name,
g_type_name (prop_spec->value_type)); g_type_name (prop_spec->value_type));
} }
@ -326,7 +325,7 @@ gimp_config_deserialize_property (GObject *object,
static GTokenType static GTokenType
gimp_config_deserialize_value (GValue *value, gimp_config_deserialize_value (GValue *value,
GObject *object, GimpConfig *object,
GParamSpec *prop_spec, GParamSpec *prop_spec,
GScanner *scanner) GScanner *scanner)
{ {
@ -625,28 +624,27 @@ gimp_config_deserialize_matrix2 (GValue *value,
static GTokenType static GTokenType
gimp_config_deserialize_object (GValue *value, gimp_config_deserialize_object (GValue *value,
GObject *object, GimpConfig *config,
GParamSpec *prop_spec, GParamSpec *prop_spec,
GScanner *scanner, GScanner *scanner,
gint nest_level) gint nest_level)
{ {
GimpConfigInterface *gimp_config_iface; GimpConfigInterface *config_iface;
GObject *prop_object; GimpConfig *prop_object;
g_object_get_property (object, prop_spec->name, value); g_object_get_property (G_OBJECT (config), prop_spec->name, value);
prop_object = g_value_get_object (value); prop_object = g_value_get_object (value);
if (! prop_object) if (! prop_object)
return G_TOKEN_RIGHT_PAREN; return G_TOKEN_RIGHT_PAREN;
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (prop_object); config_iface = GIMP_CONFIG_GET_INTERFACE (prop_object);
if (! gimp_config_iface) if (! config_iface)
return gimp_config_deserialize_any (value, prop_spec, scanner); return gimp_config_deserialize_any (value, prop_spec, scanner);
if (! gimp_config_iface->deserialize (prop_object, if (! config_iface->deserialize (prop_object, scanner, nest_level + 1, NULL))
scanner, nest_level + 1, NULL))
return G_TOKEN_NONE; return G_TOKEN_NONE;
return G_TOKEN_RIGHT_PAREN; return G_TOKEN_RIGHT_PAREN;
@ -654,7 +652,7 @@ gimp_config_deserialize_object (GValue *value,
static GTokenType static GTokenType
gimp_config_deserialize_value_array (GValue *value, gimp_config_deserialize_value_array (GValue *value,
GObject *object, GimpConfig *config,
GParamSpec *prop_spec, GParamSpec *prop_spec,
GScanner *scanner) GScanner *scanner)
{ {
@ -677,7 +675,7 @@ gimp_config_deserialize_value_array (GValue *value,
g_value_init (&array_value, array_spec->element_spec->value_type); g_value_init (&array_value, array_spec->element_spec->value_type);
token = gimp_config_deserialize_value (&array_value, token = gimp_config_deserialize_value (&array_value,
object, config,
array_spec->element_spec, array_spec->element_spec,
scanner); scanner);

View File

@ -23,10 +23,10 @@
#define __GIMP_CONFIG_DESERIALIZE_H__ #define __GIMP_CONFIG_DESERIALIZE_H__
gboolean gimp_config_deserialize_properties (GObject *object, gboolean gimp_config_deserialize_properties (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gboolean store_unknown_tokens); gboolean store_unknown_tokens);
#endif /* __GIMP_CONFIG_DESERIALIZE_H__ */ #endif /* __GIMP_CONFIG_DESERIALIZE_H__ */

View File

@ -1,9 +1,9 @@
/* The GIMP -- an image manipulation program /* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis * Copyright (C) 1995 Spencer Kimball and Peter Mattis
* *
* GimpConfig object property dumper. * GimpConfig object property dumper.
* Copyright (C) 2001-2003 Sven Neumann <sven@gimp.org> * Copyright (C) 2001-2003 Sven Neumann <sven@gimp.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
@ -54,10 +54,10 @@ typedef enum
static gint dump_gimprc (DumpFormat format); static gint dump_gimprc (DumpFormat format);
static void dump_gimprc_system (GObject *rc, static void dump_gimprc_system (GimpConfig *rc,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gint fd); gint fd);
static void dump_gimprc_manpage (GObject *rc, static void dump_gimprc_manpage (GimpConfig *rc,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gint fd); gint fd);
static gchar * dump_describe_param (GParamSpec *param_spec); static gchar * dump_describe_param (GParamSpec *param_spec);
@ -70,7 +70,7 @@ main (int argc,
char *argv[]) char *argv[])
{ {
DumpFormat format = DUMP_DEFAULT; DumpFormat format = DUMP_DEFAULT;
if (argc > 1) if (argc > 1)
{ {
if (strcmp (argv[1], "--system-gimprc") == 0) if (strcmp (argv[1], "--system-gimprc") == 0)
@ -111,7 +111,7 @@ static gint
dump_gimprc (DumpFormat format) dump_gimprc (DumpFormat format)
{ {
GimpConfigWriter *writer; GimpConfigWriter *writer;
GObject *rc; GimpConfig *rc;
gint fd = 1; gint fd = 1;
if (format == DUMP_NONE) if (format == DUMP_NONE)
@ -159,7 +159,7 @@ static const gchar *system_gimprc_header =
"Lines that start with a '#' are comments. Blank lines are ignored.\n" "Lines that start with a '#' are comments. Blank lines are ignored.\n"
"\n" "\n"
"By default everything in this file is commented out. The file then " "By default everything in this file is commented out. The file then "
"documents the default values and shows what changes are possible.\n" "documents the default values and shows what changes are possible.\n"
"\n" "\n"
"The variable ${gimp_dir} is set to the value of the environment " "The variable ${gimp_dir} is set to the value of the environment "
"variable GIMP2_DIRECTORY or, if that is not set, the compiled-in " "variable GIMP2_DIRECTORY or, if that is not set, the compiled-in "
@ -167,7 +167,7 @@ static const gchar *system_gimprc_header =
"it is interpreted relative to your home directory."; "it is interpreted relative to your home directory.";
static void static void
dump_gimprc_system (GObject *rc, dump_gimprc_system (GimpConfig *rc,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gint fd) gint fd)
{ {
@ -296,7 +296,7 @@ static const gchar *man_page_footer =
static void static void
dump_gimprc_manpage (GObject *rc, dump_gimprc_manpage (GimpConfig *rc,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gint fd) gint fd)
{ {
@ -340,7 +340,7 @@ dump_gimprc_manpage (GObject *rc,
} }
static const gchar * display_format_description = static const gchar * display_format_description =
"This is a format string; certain % character sequences are recognised and " "This is a format string; certain % character sequences are recognised and "
"expanded as follows:\n" "expanded as follows:\n"
"\n" "\n"
@ -425,7 +425,7 @@ dump_describe_param (GParamSpec *param_spec)
case GIMP_PARAM_PATH_DIR: case GIMP_PARAM_PATH_DIR:
values = "This is a single folder."; values = "This is a single folder.";
break; break;
case GIMP_PARAM_PATH_DIR_LIST: case GIMP_PARAM_PATH_DIR_LIST:
switch (G_SEARCHPATH_SEPARATOR) switch (G_SEARCHPATH_SEPARATOR)
{ {
@ -484,9 +484,9 @@ dump_describe_param (GParamSpec *param_spec)
GEnumValue *enum_value; GEnumValue *enum_value;
GString *str; GString *str;
gint i; gint i;
enum_class = g_type_class_peek (type); enum_class = g_type_class_peek (type);
str = g_string_new (blurb); str = g_string_new (blurb);
g_string_append (str, " Possible values are "); g_string_append (str, " Possible values are ");

View File

@ -54,7 +54,7 @@ static void serialize_unknown_token (const gchar *key,
/** /**
* gimp_config_serialize_properties: * gimp_config_serialize_properties:
* @object: a #GObject. * @config: a #GimpConfig.
* @writer: a #GimpConfigWriter. * @writer: a #GimpConfigWriter.
* *
* This function writes all object properties to the @writer. * This function writes all object properties to the @writer.
@ -62,7 +62,7 @@ static void serialize_unknown_token (const gchar *key,
* Returns: %TRUE if serialization succeeded, %FALSE otherwise * Returns: %TRUE if serialization succeeded, %FALSE otherwise
**/ **/
gboolean gboolean
gimp_config_serialize_properties (GObject *object, gimp_config_serialize_properties (GimpConfig *config,
GimpConfigWriter *writer) GimpConfigWriter *writer)
{ {
GObjectClass *klass; GObjectClass *klass;
@ -70,9 +70,9 @@ gimp_config_serialize_properties (GObject *object,
guint n_property_specs; guint n_property_specs;
guint i; guint i;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (G_IS_OBJECT (config), FALSE);
klass = G_OBJECT_GET_CLASS (object); klass = G_OBJECT_GET_CLASS (config);
property_specs = g_object_class_list_properties (klass, &n_property_specs); property_specs = g_object_class_list_properties (klass, &n_property_specs);
@ -86,7 +86,7 @@ gimp_config_serialize_properties (GObject *object,
if (! (prop_spec->flags & GIMP_PARAM_SERIALIZE)) if (! (prop_spec->flags & GIMP_PARAM_SERIALIZE))
continue; continue;
if (! gimp_config_serialize_property (object, prop_spec, writer)) if (! gimp_config_serialize_property (config, prop_spec, writer))
return FALSE; return FALSE;
} }
@ -97,7 +97,7 @@ gimp_config_serialize_properties (GObject *object,
/** /**
* gimp_config_serialize_changed_properties: * gimp_config_serialize_changed_properties:
* @object: a #GObject. * @config: a #GimpConfig.
* @writer: a #GimpConfigWriter. * @writer: a #GimpConfigWriter.
* *
* This function writes all object properties that have been changed from * This function writes all object properties that have been changed from
@ -106,7 +106,7 @@ gimp_config_serialize_properties (GObject *object,
* Returns: %TRUE if serialization succeeded, %FALSE otherwise * Returns: %TRUE if serialization succeeded, %FALSE otherwise
**/ **/
gboolean gboolean
gimp_config_serialize_changed_properties (GObject *object, gimp_config_serialize_changed_properties (GimpConfig *config,
GimpConfigWriter *writer) GimpConfigWriter *writer)
{ {
GObjectClass *klass; GObjectClass *klass;
@ -115,9 +115,9 @@ gimp_config_serialize_changed_properties (GObject *object,
guint i; guint i;
GValue value = { 0, }; GValue value = { 0, };
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (G_IS_OBJECT (config), FALSE);
klass = G_OBJECT_GET_CLASS (object); klass = G_OBJECT_GET_CLASS (config);
property_specs = g_object_class_list_properties (klass, &n_property_specs); property_specs = g_object_class_list_properties (klass, &n_property_specs);
@ -132,11 +132,11 @@ gimp_config_serialize_changed_properties (GObject *object,
continue; continue;
g_value_init (&value, prop_spec->value_type); g_value_init (&value, prop_spec->value_type);
g_object_get_property (object, prop_spec->name, &value); g_object_get_property (G_OBJECT (config), prop_spec->name, &value);
if (! g_param_value_defaults (prop_spec, &value)) if (! g_param_value_defaults (prop_spec, &value))
{ {
if (! gimp_config_serialize_property (object, prop_spec, writer)) if (! gimp_config_serialize_property (config, prop_spec, writer))
return FALSE; return FALSE;
} }
@ -150,33 +150,33 @@ gimp_config_serialize_changed_properties (GObject *object,
/** /**
* gimp_config_serialize_properties_diff: * gimp_config_serialize_properties_diff:
* @object: a #GObject. * @config: a #GimpConfig.
* @compare: a #GObject of the same type as @object. * @compare: a #GimpConfig of the same type as @config.
* @writer: a #GimpConfigWriter. * @writer: a #GimpConfigWriter.
* *
* This function compares @object and @compare and writes all * This function compares @config and @compare and writes all
* properties of @object that have different values than @compare to * properties of @config that have different values than @compare to
* the @writer. * the @writer.
* *
* Returns: %TRUE if serialization succeeded, %FALSE otherwise * Returns: %TRUE if serialization succeeded, %FALSE otherwise
**/ **/
gboolean gboolean
gimp_config_serialize_properties_diff (GObject *object, gimp_config_serialize_properties_diff (GimpConfig *config,
GObject *compare, GimpConfig *compare,
GimpConfigWriter *writer) GimpConfigWriter *writer)
{ {
GObjectClass *klass; GObjectClass *klass;
GList *diff; GList *diff;
GList *list; GList *list;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (G_IS_OBJECT (config), FALSE);
g_return_val_if_fail (G_IS_OBJECT (compare), FALSE); g_return_val_if_fail (G_IS_OBJECT (compare), FALSE);
g_return_val_if_fail (G_TYPE_FROM_INSTANCE (object) == g_return_val_if_fail (G_TYPE_FROM_INSTANCE (config) ==
G_TYPE_FROM_INSTANCE (compare), FALSE); G_TYPE_FROM_INSTANCE (compare), FALSE);
klass = G_OBJECT_GET_CLASS (object); klass = G_OBJECT_GET_CLASS (config);
diff = gimp_config_diff (object, compare, GIMP_PARAM_SERIALIZE); diff = gimp_config_diff (config, compare, GIMP_PARAM_SERIALIZE);
if (! diff) if (! diff)
return TRUE; return TRUE;
@ -188,7 +188,7 @@ gimp_config_serialize_properties_diff (GObject *object,
if (! (prop_spec->flags & GIMP_PARAM_SERIALIZE)) if (! (prop_spec->flags & GIMP_PARAM_SERIALIZE))
continue; continue;
if (! gimp_config_serialize_property (object, prop_spec, writer)) if (! gimp_config_serialize_property (config, prop_spec, writer))
return FALSE; return FALSE;
} }
@ -199,7 +199,7 @@ gimp_config_serialize_properties_diff (GObject *object,
gboolean gboolean
gimp_config_serialize_property (GObject *object, gimp_config_serialize_property (GimpConfig *config,
GParamSpec *param_spec, GParamSpec *param_spec,
GimpConfigWriter *writer) GimpConfigWriter *writer)
{ {
@ -213,12 +213,11 @@ gimp_config_serialize_property (GObject *object,
return FALSE; return FALSE;
g_value_init (&value, param_spec->value_type); g_value_init (&value, param_spec->value_type);
g_object_get_property (object, param_spec->name, &value); g_object_get_property (G_OBJECT (config), param_spec->name, &value);
owner_class = g_type_class_peek (param_spec->owner_type); owner_class = g_type_class_peek (param_spec->owner_type);
config_iface = g_type_interface_peek (owner_class, config_iface = g_type_interface_peek (owner_class, GIMP_TYPE_CONFIG);
GIMP_TYPE_CONFIG_INTERFACE);
/* We must call deserialize_property() *only* if the *exact* class /* We must call deserialize_property() *only* if the *exact* class
* which implements it is param_spec->owner_type's class. * which implements it is param_spec->owner_type's class.
@ -237,13 +236,13 @@ gimp_config_serialize_property (GObject *object,
owner_parent_class = g_type_class_peek_parent (owner_class), owner_parent_class = g_type_class_peek_parent (owner_class),
parent_iface = g_type_interface_peek (owner_parent_class, parent_iface = g_type_interface_peek (owner_parent_class,
GIMP_TYPE_CONFIG_INTERFACE); GIMP_TYPE_CONFIG);
} }
if (config_iface && if (config_iface &&
config_iface != parent_iface && /* see comment above */ config_iface != parent_iface && /* see comment above */
config_iface->serialize_property && config_iface->serialize_property &&
config_iface->serialize_property (object, config_iface->serialize_property (config,
param_spec->param_id, param_spec->param_id,
(const GValue *) &value, (const GValue *) &value,
param_spec, param_spec,
@ -261,22 +260,21 @@ gimp_config_serialize_property (GObject *object,
if (G_VALUE_HOLDS_OBJECT (&value) && if (G_VALUE_HOLDS_OBJECT (&value) &&
(param_spec->flags & GIMP_PARAM_AGGREGATE)) (param_spec->flags & GIMP_PARAM_AGGREGATE))
{ {
GimpConfigInterface *gimp_config_iface = NULL; GimpConfigInterface *config_iface = NULL;
GObject *prop_object; GimpConfig *prop_object;
prop_object = g_value_get_object (&value); prop_object = g_value_get_object (&value);
if (prop_object) if (prop_object)
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (prop_object); config_iface = GIMP_CONFIG_GET_INTERFACE (prop_object);
else else
success = TRUE; success = TRUE;
if (gimp_config_iface) if (config_iface)
{ {
gimp_config_writer_open (writer, param_spec->name); gimp_config_writer_open (writer, param_spec->name);
success = gimp_config_iface->serialize (prop_object, writer, success = config_iface->serialize (prop_object, writer, NULL);
NULL);
if (success) if (success)
gimp_config_writer_close (writer); gimp_config_writer_close (writer);
@ -310,7 +308,7 @@ gimp_config_serialize_property (GObject *object,
else else
{ {
g_warning ("couldn't serialize property %s::%s of type %s", g_warning ("couldn't serialize property %s::%s of type %s",
g_type_name (G_TYPE_FROM_INSTANCE (object)), g_type_name (G_TYPE_FROM_INSTANCE (config)),
param_spec->name, param_spec->name,
g_type_name (param_spec->value_type)); g_type_name (param_spec->value_type));
} }
@ -482,22 +480,22 @@ gimp_config_serialize_value (const GValue *value,
/** /**
* gimp_config_serialize_unknown_tokens: * gimp_config_serialize_unknown_tokens:
* @object: a #GObject. * @config: a #GimpConfig.
* @writer: a #GimpConfigWriter. * @writer: a #GimpConfigWriter.
* *
* Writes all unknown tokens attached to #object to the @writer. See * Writes all unknown tokens attached to @config to the @writer. See
* gimp_config_add_unknown_token(). * gimp_config_add_unknown_token().
* *
* Returns: %TRUE if serialization succeeded, %FALSE otherwise * Returns: %TRUE if serialization succeeded, %FALSE otherwise
**/ **/
gboolean gboolean
gimp_config_serialize_unknown_tokens (GObject *object, gimp_config_serialize_unknown_tokens (GimpConfig *config,
GimpConfigWriter *writer) GimpConfigWriter *writer)
{ {
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (G_IS_OBJECT (config), FALSE);
gimp_config_writer_linefeed (writer); gimp_config_writer_linefeed (writer);
gimp_config_foreach_unknown_token (object, serialize_unknown_token, writer); gimp_config_foreach_unknown_token (config, serialize_unknown_token, writer);
return TRUE; return TRUE;
} }

View File

@ -23,17 +23,17 @@
#define __GIMP_CONFIG_SERIALIZE_H__ #define __GIMP_CONFIG_SERIALIZE_H__
gboolean gimp_config_serialize_properties (GObject *object, gboolean gimp_config_serialize_properties (GimpConfig *config,
GimpConfigWriter *writer); GimpConfigWriter *writer);
gboolean gimp_config_serialize_changed_properties (GObject *object, gboolean gimp_config_serialize_changed_properties (GimpConfig *config,
GimpConfigWriter *writer); GimpConfigWriter *writer);
gboolean gimp_config_serialize_properties_diff (GObject *object, gboolean gimp_config_serialize_properties_diff (GimpConfig *config,
GObject *compare, GimpConfig *compare,
GimpConfigWriter *writer); GimpConfigWriter *writer);
gboolean gimp_config_serialize_unknown_tokens (GObject *object, gboolean gimp_config_serialize_unknown_tokens (GimpConfig *config,
GimpConfigWriter *writer); GimpConfigWriter *writer);
gboolean gimp_config_serialize_property (GObject *object, gboolean gimp_config_serialize_property (GimpConfig *config,
GParamSpec *param_spec, GParamSpec *param_spec,
GimpConfigWriter *writer); GimpConfigWriter *writer);

View File

@ -36,8 +36,8 @@
/** /**
* gimp_config_diff: * gimp_config_diff:
* @a: a #GObject * @a: a #GimpConfig
* @b: another #GObject of the same type as @a * @b: another #GimpConfig of the same type as @a
* @flags: a mask of GParamFlags * @flags: a mask of GParamFlags
* *
* Compares all properties of @a and @b that have all @flags set. If * Compares all properties of @a and @b that have all @flags set. If
@ -46,8 +46,8 @@
* Return value: a GList of differing GParamSpecs. * Return value: a GList of differing GParamSpecs.
**/ **/
GList * GList *
gimp_config_diff (GObject *a, gimp_config_diff (GimpConfig *a,
GObject *b, GimpConfig *b,
GParamFlags flags) GParamFlags flags)
{ {
GParamSpec **param_specs; GParamSpec **param_specs;
@ -73,14 +73,14 @@ gimp_config_diff (GObject *a,
g_value_init (&a_value, param_specs[i]->value_type); g_value_init (&a_value, param_specs[i]->value_type);
g_value_init (&b_value, param_specs[i]->value_type); g_value_init (&b_value, param_specs[i]->value_type);
g_object_get_property (a, param_specs[i]->name, &a_value); g_object_get_property (G_OBJECT (a), param_specs[i]->name, &a_value);
g_object_get_property (b, param_specs[i]->name, &b_value); g_object_get_property (G_OBJECT (b), param_specs[i]->name, &b_value);
if (G_IS_PARAM_SPEC_OBJECT (param_specs[i]) && if (G_IS_PARAM_SPEC_OBJECT (param_specs[i]) &&
(param_specs[i]->flags & GIMP_PARAM_AGGREGATE)) (param_specs[i]->flags & GIMP_PARAM_AGGREGATE))
{ {
GObject *a_object = g_value_get_object (&a_value); GimpConfig *a_object = g_value_get_object (&a_value);
GObject *b_object = g_value_get_object (&b_value); GimpConfig *b_object = g_value_get_object (&b_value);
if (a_object && b_object && if (a_object && b_object &&
G_TYPE_FROM_INSTANCE (a_object) == G_TYPE_FROM_INSTANCE (a_object) ==
@ -180,23 +180,23 @@ gimp_config_disconnect (GObject *src,
/** /**
* gimp_config_copy_properties: * gimp_config_copy_properties:
* @src: a #GObject * @src: a #GimpConfig
* @dest: another #GObject of the same type as @src * @dest: another #GimpConfig of the same type as @src
* *
* Retrieves all read and writeable property settings from @src and * Retrieves all read and writeable property settings from @src and
* applies the values to @dest. * applies the values to @dest.
**/ **/
void void
gimp_config_copy_properties (GObject *src, gimp_config_copy_properties (GimpConfig *src,
GObject *dest) GimpConfig *dest)
{ {
GObjectClass *klass; GObjectClass *klass;
GParamSpec **property_specs; GParamSpec **property_specs;
guint n_property_specs; guint n_property_specs;
guint i; guint i;
g_return_if_fail (G_IS_OBJECT (src)); g_return_if_fail (GIMP_IS_CONFIG (src));
g_return_if_fail (G_IS_OBJECT (dest)); g_return_if_fail (GIMP_IS_CONFIG (dest));
g_return_if_fail (G_TYPE_FROM_INSTANCE (src) == G_TYPE_FROM_INSTANCE (dest)); g_return_if_fail (G_TYPE_FROM_INSTANCE (src) == G_TYPE_FROM_INSTANCE (dest));
klass = G_OBJECT_GET_CLASS (src); klass = G_OBJECT_GET_CLASS (src);
@ -206,7 +206,7 @@ gimp_config_copy_properties (GObject *src,
if (!property_specs) if (!property_specs)
return; return;
g_object_freeze_notify (dest); g_object_freeze_notify (G_OBJECT (dest));
for (i = 0; i < n_property_specs; i++) for (i = 0; i < n_property_specs; i++)
{ {
@ -221,16 +221,18 @@ gimp_config_copy_properties (GObject *src,
if (G_IS_PARAM_SPEC_OBJECT (prop_spec) && if (G_IS_PARAM_SPEC_OBJECT (prop_spec) &&
(prop_spec->flags & GIMP_PARAM_AGGREGATE)) (prop_spec->flags & GIMP_PARAM_AGGREGATE))
{ {
GValue src_value = { 0, }; GValue src_value = { 0, };
GValue dest_value = { 0, }; GValue dest_value = { 0, };
GObject *src_object; GimpConfig *src_object;
GObject *dest_object; GimpConfig *dest_object;
g_value_init (&src_value, prop_spec->value_type); g_value_init (&src_value, prop_spec->value_type);
g_value_init (&dest_value, prop_spec->value_type); g_value_init (&dest_value, prop_spec->value_type);
g_object_get_property (src, prop_spec->name, &src_value); g_object_get_property (G_OBJECT (src),
g_object_get_property (dest, prop_spec->name, &dest_value); prop_spec->name, &src_value);
g_object_get_property (G_OBJECT (dest),
prop_spec->name, &dest_value);
src_object = g_value_get_object (&src_value); src_object = g_value_get_object (&src_value);
dest_object = g_value_get_object (&dest_value); dest_object = g_value_get_object (&dest_value);
@ -251,8 +253,8 @@ gimp_config_copy_properties (GObject *src,
g_value_init (&value, prop_spec->value_type); g_value_init (&value, prop_spec->value_type);
g_object_get_property (src, prop_spec->name, &value); g_object_get_property (G_OBJECT (src), prop_spec->name, &value);
g_object_set_property (dest, prop_spec->name, &value); g_object_set_property (G_OBJECT (dest), prop_spec->name, &value);
g_value_unset (&value); g_value_unset (&value);
} }
@ -261,34 +263,37 @@ gimp_config_copy_properties (GObject *src,
g_free (property_specs); g_free (property_specs);
g_object_thaw_notify (dest); g_object_thaw_notify (G_OBJECT (dest));
} }
/** /**
* gimp_config_reset_properties: * gimp_config_reset_properties:
* @object: a #GObject * @config: a #GimpConfig
* *
* Resets all writable properties of @object to the default values as * Resets all writable properties of @object to the default values as
* defined in their #GParamSpec. * defined in their #GParamSpec.
**/ **/
void void
gimp_config_reset_properties (GObject *object) gimp_config_reset_properties (GimpConfig *config)
{ {
GObject *object;
GObjectClass *klass; GObjectClass *klass;
GParamSpec **property_specs; GParamSpec **property_specs;
GValue value = { 0, }; GValue value = { 0, };
guint n_property_specs; guint n_property_specs;
guint i; guint i;
g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (GIMP_IS_CONFIG (config));
klass = G_OBJECT_GET_CLASS (object); klass = G_OBJECT_GET_CLASS (config);
property_specs = g_object_class_list_properties (klass, &n_property_specs); property_specs = g_object_class_list_properties (klass, &n_property_specs);
if (!property_specs) if (!property_specs)
return; return;
object = G_OBJECT (config);
g_object_freeze_notify (object); g_object_freeze_notify (object);
for (i = 0; i < n_property_specs; i++) for (i = 0; i < n_property_specs; i++)
@ -305,13 +310,13 @@ gimp_config_reset_properties (GObject *object)
if ((prop_spec->flags & GIMP_PARAM_SERIALIZE) && if ((prop_spec->flags & GIMP_PARAM_SERIALIZE) &&
(prop_spec->flags & GIMP_PARAM_AGGREGATE) && (prop_spec->flags & GIMP_PARAM_AGGREGATE) &&
g_type_interface_peek (g_type_class_peek (prop_spec->value_type), g_type_interface_peek (g_type_class_peek (prop_spec->value_type),
GIMP_TYPE_CONFIG_INTERFACE)) GIMP_TYPE_CONFIG))
{ {
g_value_init (&value, prop_spec->value_type); g_value_init (&value, prop_spec->value_type);
g_object_get_property (object, prop_spec->name, &value); g_object_get_property (object, prop_spec->name, &value);
gimp_config_reset (g_value_get_object (&value)); gimp_config_reset (GIMP_CONFIG (g_value_get_object (&value)));
g_value_unset (&value); g_value_unset (&value);
} }
@ -319,8 +324,8 @@ gimp_config_reset_properties (GObject *object)
else else
{ {
g_value_init (&value, prop_spec->value_type); g_value_init (&value, prop_spec->value_type);
g_param_value_set_default (prop_spec, &value); g_param_value_set_default (prop_spec, &value);
g_object_set_property (object, prop_spec->name, &value); g_object_set_property (object, prop_spec->name, &value);
g_value_unset (&value); g_value_unset (&value);

View File

@ -23,16 +23,19 @@
#define __GIMP_CONFIG_UTILS_H__ #define __GIMP_CONFIG_UTILS_H__
GList * gimp_config_diff (GObject *a,
GObject *b,
GParamFlags flags);
void gimp_config_connect (GObject *src, void gimp_config_connect (GObject *src,
GObject *dest); GObject *dest);
void gimp_config_disconnect (GObject *src, void gimp_config_disconnect (GObject *src,
GObject *dest); GObject *dest);
void gimp_config_copy_properties (GObject *src,
GObject *dest); GList * gimp_config_diff (GimpConfig *a,
void gimp_config_reset_properties (GObject *object); GimpConfig *b,
GParamFlags flags);
void gimp_config_copy_properties (GimpConfig *src,
GimpConfig *dest);
void gimp_config_reset_properties (GimpConfig *config);
void gimp_config_string_append_escaped (GString *string, void gimp_config_string_append_escaped (GString *string,
const gchar *val); const gchar *val);

View File

@ -43,19 +43,19 @@
* The GimpConfig serialization and deserialization interface. * The GimpConfig serialization and deserialization interface.
*/ */
static void gimp_config_iface_init (GimpConfigInterface *gimp_config_iface); static void gimp_config_iface_init (GimpConfigInterface *gimp_config_iface);
static gboolean gimp_config_iface_serialize (GObject *object, static gboolean gimp_config_iface_serialize (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data); gpointer data);
static gboolean gimp_config_iface_deserialize (GObject *object, static gboolean gimp_config_iface_deserialize (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data); gpointer data);
static GObject *gimp_config_iface_duplicate (GObject *object); static GimpConfig * gimp_config_iface_duplicate (GimpConfig *config);
static gboolean gimp_config_iface_equal (GObject *a, static gboolean gimp_config_iface_equal (GimpConfig *a,
GObject *b); GimpConfig *b);
static void gimp_config_iface_reset (GObject *object); static void gimp_config_iface_reset (GimpConfig *config);
GType GType
@ -96,25 +96,25 @@ gimp_config_iface_init (GimpConfigInterface *gimp_config_iface)
} }
static gboolean static gboolean
gimp_config_iface_serialize (GObject *object, gimp_config_iface_serialize (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data) gpointer data)
{ {
return gimp_config_serialize_properties (object, writer); return gimp_config_serialize_properties (config, writer);
} }
static gboolean static gboolean
gimp_config_iface_deserialize (GObject *object, gimp_config_iface_deserialize (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data) gpointer data)
{ {
return gimp_config_deserialize_properties (object, return gimp_config_deserialize_properties (config,
scanner, nest_level, FALSE); scanner, nest_level, FALSE);
} }
static GObject * static GimpConfig *
gimp_config_iface_duplicate (GObject *object) gimp_config_iface_duplicate (GimpConfig *config)
{ {
GObjectClass *klass; GObjectClass *klass;
GParamSpec **property_specs; GParamSpec **property_specs;
@ -122,9 +122,9 @@ gimp_config_iface_duplicate (GObject *object)
GParameter *construct_params = NULL; GParameter *construct_params = NULL;
gint n_construct_params = 0; gint n_construct_params = 0;
guint i; guint i;
GObject *dup; GimpConfig *dup;
klass = G_OBJECT_GET_CLASS (object); klass = G_OBJECT_GET_CLASS (config);
property_specs = g_object_class_list_properties (klass, &n_property_specs); property_specs = g_object_class_list_properties (klass, &n_property_specs);
@ -145,14 +145,14 @@ gimp_config_iface_duplicate (GObject *object)
construct_params->name = prop_spec->name; construct_params->name = prop_spec->name;
g_value_init (&construct_params->value, prop_spec->value_type); g_value_init (&construct_params->value, prop_spec->value_type);
g_object_get_property (object, prop_spec->name, g_object_get_property (G_OBJECT (config), prop_spec->name,
&construct_param->value); &construct_param->value);
} }
} }
g_free (property_specs); g_free (property_specs);
dup = g_object_newv (G_TYPE_FROM_INSTANCE (object), dup = g_object_newv (G_TYPE_FROM_INSTANCE (config),
n_construct_params, construct_params); n_construct_params, construct_params);
for (i = 0; i < n_construct_params; i++) for (i = 0; i < n_construct_params; i++)
@ -160,14 +160,14 @@ gimp_config_iface_duplicate (GObject *object)
g_free (construct_params); g_free (construct_params);
gimp_config_copy_properties (object, dup); gimp_config_copy_properties (config, dup);
return dup; return dup;
} }
static gboolean static gboolean
gimp_config_iface_equal (GObject *a, gimp_config_iface_equal (GimpConfig *a,
GObject *b) GimpConfig *b)
{ {
GObjectClass *klass; GObjectClass *klass;
GParamSpec **property_specs; GParamSpec **property_specs;
@ -192,8 +192,8 @@ gimp_config_iface_equal (GObject *a,
g_value_init (&a_value, prop_spec->value_type); g_value_init (&a_value, prop_spec->value_type);
g_value_init (&b_value, prop_spec->value_type); g_value_init (&b_value, prop_spec->value_type);
g_object_get_property (a, prop_spec->name, &a_value); g_object_get_property (G_OBJECT (a), prop_spec->name, &a_value);
g_object_get_property (b, prop_spec->name, &b_value); g_object_get_property (G_OBJECT (b), prop_spec->name, &b_value);
equal = (g_param_values_cmp (prop_spec, &a_value, &b_value) == 0); equal = (g_param_values_cmp (prop_spec, &a_value, &b_value) == 0);
@ -207,103 +207,91 @@ gimp_config_iface_equal (GObject *a,
} }
static void static void
gimp_config_iface_reset (GObject *object) gimp_config_iface_reset (GimpConfig *config)
{ {
gimp_config_reset_properties (object); gimp_config_reset_properties (config);
} }
/** /**
* gimp_config_serialize_to_file: * gimp_config_serialize_to_file:
* @object: a #GObject that implements the #GimpConfigInterface. * @config: a #GObject that implements the #GimpConfigInterface.
* @filename: the name of the file to write the configuration to. * @filename: the name of the file to write the configuration to.
* @header: optional file header (must be ASCII only) * @header: optional file header (must be ASCII only)
* @footer: optional file footer (must be ASCII only) * @footer: optional file footer (must be ASCII only)
* @data: user data passed to the serialize implementation. * @data: user data passed to the serialize implementation.
* @error: * @error:
* *
* Serializes the object properties of @object to the file specified * Serializes the object properties of @config to the file specified
* by @filename. If a file with that name already exists, it is * by @filename. If a file with that name already exists, it is
* overwritten. Basically this function opens @filename for you and * overwritten. Basically this function opens @filename for you and
* calls the serialize function of the @object's #GimpConfigInterface. * calls the serialize function of the @config's #GimpConfigInterface.
* *
* Return value: %TRUE if serialization succeeded, %FALSE otherwise. * Return value: %TRUE if serialization succeeded, %FALSE otherwise.
**/ **/
gboolean gboolean
gimp_config_serialize_to_file (GObject *object, gimp_config_serialize_to_file (GimpConfig *config,
const gchar *filename, const gchar *filename,
const gchar *header, const gchar *header,
const gchar *footer, const gchar *footer,
gpointer data, gpointer data,
GError **error) GError **error)
{ {
GimpConfigInterface *gimp_config_iface; GimpConfigWriter *writer;
GimpConfigWriter *writer;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
g_return_val_if_fail (filename != NULL, FALSE); g_return_val_if_fail (filename != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (object);
g_return_val_if_fail (gimp_config_iface != NULL, FALSE);
writer = gimp_config_writer_new_file (filename, TRUE, header, error); writer = gimp_config_writer_new_file (filename, TRUE, header, error);
if (!writer) if (!writer)
return FALSE; return FALSE;
gimp_config_iface->serialize (object, writer, data); GIMP_CONFIG_GET_INTERFACE (config)->serialize (config, writer, data);
return gimp_config_writer_finish (writer, footer, error); return gimp_config_writer_finish (writer, footer, error);
} }
gboolean gboolean
gimp_config_serialize_to_fd (GObject *object, gimp_config_serialize_to_fd (GimpConfig *config,
gint fd, gint fd,
gpointer data) gpointer data)
{ {
GimpConfigInterface *gimp_config_iface; GimpConfigWriter *writer;
GimpConfigWriter *writer;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
g_return_val_if_fail (fd > 0, FALSE); g_return_val_if_fail (fd > 0, FALSE);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (object);
g_return_val_if_fail (gimp_config_iface != NULL, FALSE);
writer = gimp_config_writer_new_fd (fd); writer = gimp_config_writer_new_fd (fd);
if (!writer) if (!writer)
return FALSE; return FALSE;
gimp_config_iface->serialize (object, writer, data); GIMP_CONFIG_GET_INTERFACE (config)->serialize (config, writer, data);
return gimp_config_writer_finish (writer, NULL, NULL); return gimp_config_writer_finish (writer, NULL, NULL);
} }
/** /**
* gimp_config_serialize_to_string: * gimp_config_serialize_to_string:
* @object: a #GObject that implements the #GimpConfigInterface. * @config: a #GObject that implements the #GimpConfigInterface.
* @data: user data passed to the serialize implementation. * @data: user data passed to the serialize implementation.
* *
* Serializes the object properties of @object to a string. * Serializes the object properties of @config to a string.
* *
* Return value: a newly allocated %NUL-terminated string. * Return value: a newly allocated %NUL-terminated string.
**/ **/
gchar * gchar *
gimp_config_serialize_to_string (GObject *object, gimp_config_serialize_to_string (GimpConfig *config,
gpointer data) gpointer data)
{ {
GimpConfigInterface *gimp_config_iface; GimpConfigWriter *writer;
GimpConfigWriter *writer; GString *str;
GString *str;
g_return_val_if_fail (G_IS_OBJECT (object), NULL); g_return_val_if_fail (GIMP_IS_CONFIG (config), NULL);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (object);
g_return_val_if_fail (gimp_config_iface != NULL, FALSE);
str = g_string_new (NULL); str = g_string_new (NULL);
writer = gimp_config_writer_new_string (str); writer = gimp_config_writer_new_string (str);
gimp_config_iface->serialize (object, writer, data); GIMP_CONFIG_GET_INTERFACE (config)->serialize (config, writer, data);
gimp_config_writer_finish (writer, NULL, NULL); gimp_config_writer_finish (writer, NULL, NULL);
@ -312,40 +300,37 @@ gimp_config_serialize_to_string (GObject *object,
/** /**
* gimp_config_deserialize: * gimp_config_deserialize:
* @object: a #GObject that implements the #GimpConfigInterface. * @config: a #GObject that implements the #GimpConfigInterface.
* @filename: the name of the file to read configuration from. * @filename: the name of the file to read configuration from.
* @data: user data passed to the deserialize implementation. * @data: user data passed to the deserialize implementation.
* @error: * @error:
* *
* Opens the file specified by @filename, reads configuration data * Opens the file specified by @filename, reads configuration data
* from it and configures @object accordingly. Basically this function * from it and configures @config accordingly. Basically this function
* creates a properly configured #GScanner for you and calls the * creates a properly configured #GScanner for you and calls the
* deserialize function of the @object's #GimpConfigInterface. * deserialize function of the @config's #GimpConfigInterface.
* *
* Return value: %TRUE if deserialization succeeded, %FALSE otherwise. * Return value: %TRUE if deserialization succeeded, %FALSE otherwise.
**/ **/
gboolean gboolean
gimp_config_deserialize_file (GObject *object, gimp_config_deserialize_file (GimpConfig *config,
const gchar *filename, const gchar *filename,
gpointer data, gpointer data,
GError **error) GError **error)
{ {
GimpConfigInterface *gimp_config_iface; GScanner *scanner;
GScanner *scanner; gboolean success;
gboolean success;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
g_return_val_if_fail (filename != NULL, FALSE); g_return_val_if_fail (filename != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (object);
g_return_val_if_fail (gimp_config_iface != NULL, FALSE);
scanner = gimp_scanner_new_file (filename, error); scanner = gimp_scanner_new_file (filename, error);
if (! scanner) if (! scanner)
return FALSE; return FALSE;
success = gimp_config_iface->deserialize (object, scanner, 0, data); success = GIMP_CONFIG_GET_INTERFACE (config)->deserialize (config,
scanner, 0, data);
gimp_scanner_destroy (scanner); gimp_scanner_destroy (scanner);
@ -357,39 +342,36 @@ gimp_config_deserialize_file (GObject *object,
/** /**
* gimp_config_deserialize_string: * gimp_config_deserialize_string:
* @object: a #GObject that implements the #GimpConfigInterface. * @config: a #GObject that implements the #GimpConfigInterface.
* @text: string to deserialize (in UTF-8 encoding) * @text: string to deserialize (in UTF-8 encoding)
* @text_len: length of @text in bytes or -1 * @text_len: length of @text in bytes or -1
* @data: * @data:
* @error: * @error:
* *
* Configures @object from @text. Basically this function creates a * Configures @config from @text. Basically this function creates a
* properly configured #GScanner for you and calls the deserialize * properly configured #GScanner for you and calls the deserialize
* function of the @object's #GimpConfigInterface. * function of the @config's #GimpConfigInterface.
* *
* Returns: %TRUE if deserialization succeeded, %FALSE otherwise. * Returns: %TRUE if deserialization succeeded, %FALSE otherwise.
**/ **/
gboolean gboolean
gimp_config_deserialize_string (GObject *object, gimp_config_deserialize_string (GimpConfig *config,
const gchar *text, const gchar *text,
gint text_len, gint text_len,
gpointer data, gpointer data,
GError **error) GError **error)
{ {
GimpConfigInterface *gimp_config_iface; GScanner *scanner;
GScanner *scanner; gboolean success;
gboolean success;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
g_return_val_if_fail (text != NULL || text_len == 0, FALSE); g_return_val_if_fail (text != NULL || text_len == 0, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (object);
g_return_val_if_fail (gimp_config_iface != NULL, FALSE);
scanner = gimp_scanner_new_string (text, text_len, error); scanner = gimp_scanner_new_string (text, text_len, error);
success = gimp_config_iface->deserialize (object, scanner, 0, data); success = GIMP_CONFIG_GET_INTERFACE (config)->deserialize (config,
scanner, 0, data);
gimp_scanner_destroy (scanner); gimp_scanner_destroy (scanner);
@ -438,7 +420,7 @@ gimp_config_deserialize_return (GScanner *scanner,
/** /**
* gimp_config_duplicate: * gimp_config_duplicate:
* @object: a #GObject that implements the #GimpConfigInterface. * @config: a #GObject that implements the #GimpConfigInterface.
* *
* Creates a copy of the passed object by copying all object * Creates a copy of the passed object by copying all object
* properties. The default implementation of the #GimpConfigInterface * properties. The default implementation of the #GimpConfigInterface
@ -447,18 +429,12 @@ gimp_config_deserialize_return (GScanner *scanner,
* *
* Return value: the duplicated #GObject. * Return value: the duplicated #GObject.
**/ **/
GObject * GimpConfig *
gimp_config_duplicate (GObject *object) gimp_config_duplicate (GimpConfig *config)
{ {
GimpConfigInterface *gimp_config_iface; g_return_val_if_fail (GIMP_IS_CONFIG (config), NULL);
g_return_val_if_fail (G_IS_OBJECT (object), NULL); return GIMP_CONFIG_GET_INTERFACE (config)->duplicate (config);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (object);
g_return_val_if_fail (gimp_config_iface != NULL, FALSE);
return gimp_config_iface->duplicate (object);
} }
/** /**
@ -474,43 +450,31 @@ gimp_config_duplicate (GObject *object)
* Return value: %TRUE if the two objects are equal. * Return value: %TRUE if the two objects are equal.
**/ **/
gboolean gboolean
gimp_config_is_equal_to (GObject *a, gimp_config_is_equal_to (GimpConfig *a,
GObject *b) GimpConfig *b)
{ {
GimpConfigInterface *gimp_config_iface; g_return_val_if_fail (GIMP_IS_CONFIG (a), FALSE);
g_return_val_if_fail (GIMP_IS_CONFIG (b), FALSE);
g_return_val_if_fail (G_IS_OBJECT (a), FALSE);
g_return_val_if_fail (G_IS_OBJECT (b), FALSE);
g_return_val_if_fail (G_TYPE_FROM_INSTANCE (a) == G_TYPE_FROM_INSTANCE (b), g_return_val_if_fail (G_TYPE_FROM_INSTANCE (a) == G_TYPE_FROM_INSTANCE (b),
FALSE); FALSE);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (a); return GIMP_CONFIG_GET_INTERFACE (a)->equal (a, b);
g_return_val_if_fail (gimp_config_iface != NULL, FALSE);
return gimp_config_iface->equal (a, b);
} }
/** /**
* gimp_config_reset: * gimp_config_reset:
* @object: a #GObject that implements the #GimpConfigInterface. * @config: a #GObject that implements the #GimpConfigInterface.
* *
* Resets the object to its default state. The default implementation of the * Resets the object to its default state. The default implementation of the
* #GimpConfigInterface only works for objects that are completely defined by * #GimpConfigInterface only works for objects that are completely defined by
* their properties. * their properties.
**/ **/
void void
gimp_config_reset (GObject *object) gimp_config_reset (GimpConfig *config)
{ {
GimpConfigInterface *gimp_config_iface; g_return_if_fail (GIMP_IS_CONFIG (config));
g_return_if_fail (G_IS_OBJECT (object)); GIMP_CONFIG_GET_INTERFACE (config)->reset (config);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (object);
g_return_if_fail (gimp_config_iface != NULL);
gimp_config_iface->reset (object);
} }
@ -531,7 +495,7 @@ static void gimp_config_destroy_unknown_tokens (GSList *unknown_tokens);
/** /**
* gimp_config_add_unknown_token: * gimp_config_add_unknown_token:
* @object: a #GObject. * @config: a #GObject.
* @key: a nul-terminated string to identify the value. * @key: a nul-terminated string to identify the value.
* @value: a nul-terminated string representing the value. * @value: a nul-terminated string representing the value.
* *
@ -546,7 +510,7 @@ static void gimp_config_destroy_unknown_tokens (GSList *unknown_tokens);
* function with a %NULL @value. * function with a %NULL @value.
**/ **/
void void
gimp_config_add_unknown_token (GObject *object, gimp_config_add_unknown_token (GimpConfig *config,
const gchar *key, const gchar *key,
const gchar *value) const gchar *value)
{ {
@ -555,10 +519,10 @@ gimp_config_add_unknown_token (GObject *object,
GSList *last; GSList *last;
GSList *list; GSList *list;
g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (GIMP_IS_CONFIG (config));
g_return_if_fail (key != NULL); g_return_if_fail (key != NULL);
unknown_tokens = (GSList *) g_object_get_data (object, unknown_tokens = (GSList *) g_object_get_data (G_OBJECT (config),
GIMP_CONFIG_UNKNOWN_TOKENS); GIMP_CONFIG_UNKNOWN_TOKENS);
for (last = NULL, list = unknown_tokens; for (last = NULL, list = unknown_tokens;
@ -580,7 +544,8 @@ gimp_config_add_unknown_token (GObject *object,
g_free (token->key); g_free (token->key);
unknown_tokens = g_slist_remove (unknown_tokens, token); unknown_tokens = g_slist_remove (unknown_tokens, token);
g_object_set_data_full (object, GIMP_CONFIG_UNKNOWN_TOKENS, g_object_set_data_full (G_OBJECT (config),
GIMP_CONFIG_UNKNOWN_TOKENS,
unknown_tokens, unknown_tokens,
(GDestroyNotify) gimp_config_destroy_unknown_tokens); (GDestroyNotify) gimp_config_destroy_unknown_tokens);
} }
@ -604,7 +569,8 @@ gimp_config_add_unknown_token (GObject *object,
{ {
unknown_tokens = g_slist_append (NULL, token); unknown_tokens = g_slist_append (NULL, token);
g_object_set_data_full (object, GIMP_CONFIG_UNKNOWN_TOKENS, g_object_set_data_full (G_OBJECT (config),
GIMP_CONFIG_UNKNOWN_TOKENS,
unknown_tokens, unknown_tokens,
(GDestroyNotify) gimp_config_destroy_unknown_tokens); (GDestroyNotify) gimp_config_destroy_unknown_tokens);
} }
@ -612,7 +578,7 @@ gimp_config_add_unknown_token (GObject *object,
/** /**
* gimp_config_lookup_unknown_token: * gimp_config_lookup_unknown_token:
* @object: a #GObject. * @config: a #GObject.
* @key: a nul-terminated string to identify the value. * @key: a nul-terminated string to identify the value.
* *
* This function retrieves data that was previously attached using * This function retrieves data that was previously attached using
@ -622,17 +588,17 @@ gimp_config_add_unknown_token (GObject *object,
* Returns: a pointer to a constant string. * Returns: a pointer to a constant string.
**/ **/
const gchar * const gchar *
gimp_config_lookup_unknown_token (GObject *object, gimp_config_lookup_unknown_token (GimpConfig *config,
const gchar *key) const gchar *key)
{ {
GimpConfigToken *token; GimpConfigToken *token;
GSList *unknown_tokens; GSList *unknown_tokens;
GSList *list; GSList *list;
g_return_val_if_fail (G_IS_OBJECT (object), NULL); g_return_val_if_fail (GIMP_IS_CONFIG (config), NULL);
g_return_val_if_fail (key != NULL, NULL); g_return_val_if_fail (key != NULL, NULL);
unknown_tokens = (GSList *) g_object_get_data (object, unknown_tokens = (GSList *) g_object_get_data (G_OBJECT (config),
GIMP_CONFIG_UNKNOWN_TOKENS); GIMP_CONFIG_UNKNOWN_TOKENS);
for (list = unknown_tokens; list; list = g_slist_next (list)) for (list = unknown_tokens; list; list = g_slist_next (list))
@ -648,15 +614,15 @@ gimp_config_lookup_unknown_token (GObject *object,
/** /**
* gimp_config_foreach_unknown_token: * gimp_config_foreach_unknown_token:
* @object: a #GObject. * @config: a #GObject.
* @func: a function to call for each key/value pair. * @func: a function to call for each key/value pair.
* @user_data: data to pass to @func. * @user_data: data to pass to @func.
* *
* Calls @func for each key/value stored with the @object using * Calls @func for each key/value stored with the @config using
* gimp_config_add_unknown_token(). * gimp_config_add_unknown_token().
**/ **/
void void
gimp_config_foreach_unknown_token (GObject *object, gimp_config_foreach_unknown_token (GimpConfig *config,
GimpConfigForeachFunc func, GimpConfigForeachFunc func,
gpointer user_data) gpointer user_data)
{ {
@ -664,10 +630,10 @@ gimp_config_foreach_unknown_token (GObject *object,
GSList *unknown_tokens; GSList *unknown_tokens;
GSList *list; GSList *list;
g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (GIMP_IS_CONFIG (config));
g_return_if_fail (func != NULL); g_return_if_fail (func != NULL);
unknown_tokens = (GSList *) g_object_get_data (object, unknown_tokens = (GSList *) g_object_get_data (G_OBJECT (config),
GIMP_CONFIG_UNKNOWN_TOKENS); GIMP_CONFIG_UNKNOWN_TOKENS);
for (list = unknown_tokens; list; list = g_slist_next (list)) for (list = unknown_tokens; list; list = g_slist_next (list))

View File

@ -23,37 +23,38 @@
#define __GIMP_CONFIG_H__ #define __GIMP_CONFIG_H__
#define GIMP_TYPE_CONFIG_INTERFACE (gimp_config_interface_get_type ()) #define GIMP_TYPE_CONFIG (gimp_config_interface_get_type ())
#define GIMP_GET_CONFIG_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_CONFIG_INTERFACE, GimpConfigInterface)) #define GIMP_IS_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CONFIG))
#define GIMP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CONFIG, GimpConfig))
#define GIMP_CONFIG_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_CONFIG, GimpConfigInterface))
typedef struct _GimpConfigInterface GimpConfigInterface;
struct _GimpConfigInterface struct _GimpConfigInterface
{ {
GTypeInterface base_iface; GTypeInterface base_iface;
gboolean (* serialize) (GObject *object, gboolean (* serialize) (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data); gpointer data);
gboolean (* deserialize) (GObject *object, gboolean (* deserialize) (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data); gpointer data);
gboolean (* serialize_property) (GObject *object, gboolean (* serialize_property) (GimpConfig *config,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec, GParamSpec *pspec,
GimpConfigWriter *writer); GimpConfigWriter *writer);
gboolean (* deserialize_property) (GObject *object, gboolean (* deserialize_property) (GimpConfig *config,
guint property_id, guint property_id,
GValue *value, GValue *value,
GParamSpec *pspec, GParamSpec *pspec,
GScanner *scanner, GScanner *scanner,
GTokenType *expected); GTokenType *expected);
GObject * (* duplicate) (GObject *object); GimpConfig * (* duplicate) (GimpConfig *config);
gboolean (* equal) (GObject *a, gboolean (* equal) (GimpConfig *a,
GObject *b); GimpConfig *b);
void (* reset) (GObject *object); void (* reset) (GimpConfig *config);
}; };
typedef void (* GimpConfigForeachFunc) (const gchar *key, typedef void (* GimpConfigForeachFunc) (const gchar *key,
@ -63,22 +64,22 @@ typedef void (* GimpConfigForeachFunc) (const gchar *key,
GType gimp_config_interface_get_type (void) G_GNUC_CONST; GType gimp_config_interface_get_type (void) G_GNUC_CONST;
gboolean gimp_config_serialize_to_file (GObject *object, gboolean gimp_config_serialize_to_file (GimpConfig *config,
const gchar *filename, const gchar *filename,
const gchar *header, const gchar *header,
const gchar *footer, const gchar *footer,
gpointer data, gpointer data,
GError **error); GError **error);
gboolean gimp_config_serialize_to_fd (GObject *object, gboolean gimp_config_serialize_to_fd (GimpConfig *config,
gint fd, gint fd,
gpointer data); gpointer data);
gchar * gimp_config_serialize_to_string (GObject *object, gchar * gimp_config_serialize_to_string (GimpConfig *config,
gpointer data); gpointer data);
gboolean gimp_config_deserialize_file (GObject *object, gboolean gimp_config_deserialize_file (GimpConfig *config,
const gchar *filename, const gchar *filename,
gpointer data, gpointer data,
GError **error); GError **error);
gboolean gimp_config_deserialize_string (GObject *object, gboolean gimp_config_deserialize_string (GimpConfig *config,
const gchar *text, const gchar *text,
gint text_len, gint text_len,
gpointer data, gpointer data,
@ -87,17 +88,17 @@ gboolean gimp_config_deserialize_return (GScanner *scanner,
GTokenType expected_token, GTokenType expected_token,
gint nest_level); gint nest_level);
GObject * gimp_config_duplicate (GObject *object); GimpConfig * gimp_config_duplicate (GimpConfig *config);
gboolean gimp_config_is_equal_to (GObject *a, gboolean gimp_config_is_equal_to (GimpConfig *a,
GObject *b); GimpConfig *b);
void gimp_config_reset (GObject *object); void gimp_config_reset (GimpConfig *config);
void gimp_config_add_unknown_token (GObject *object, void gimp_config_add_unknown_token (GimpConfig *config,
const gchar *key, const gchar *key,
const gchar *value); const gchar *value);
const gchar * gimp_config_lookup_unknown_token (GObject *object, const gchar * gimp_config_lookup_unknown_token (GimpConfig *config,
const gchar *key); const gchar *key);
void gimp_config_foreach_unknown_token (GObject *object, void gimp_config_foreach_unknown_token (GimpConfig *config,
GimpConfigForeachFunc func, GimpConfigForeachFunc func,
gpointer user_data); gpointer user_data);

View File

@ -58,39 +58,39 @@ enum
}; };
static void gimp_rc_class_init (GimpRcClass *klass); static void gimp_rc_class_init (GimpRcClass *klass);
static void gimp_rc_config_iface_init (gpointer iface, static void gimp_rc_config_iface_init (gpointer iface,
gpointer iface_data); gpointer iface_data);
static void gimp_rc_init (GimpRc *rc); static void gimp_rc_init (GimpRc *rc);
static void gimp_rc_dispose (GObject *object); static void gimp_rc_dispose (GObject *object);
static void gimp_rc_finalize (GObject *object); static void gimp_rc_finalize (GObject *object);
static void gimp_rc_set_property (GObject *object, static void gimp_rc_set_property (GObject *object,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gimp_rc_get_property (GObject *object, static void gimp_rc_get_property (GObject *object,
guint property_id, guint property_id,
GValue *value, GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static gboolean gimp_rc_serialize (GObject *object, static gboolean gimp_rc_serialize (GimpConfig *object,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data); gpointer data);
static gboolean gimp_rc_deserialize (GObject *object, static gboolean gimp_rc_deserialize (GimpConfig *object,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data); gpointer data);
static GObject * gimp_rc_duplicate (GObject *object); static GimpConfig * gimp_rc_duplicate (GimpConfig *object);
static void gimp_rc_load (GimpRc *rc); static void gimp_rc_load (GimpRc *rc);
static gboolean gimp_rc_idle_save (GimpRc *rc); static gboolean gimp_rc_idle_save (GimpRc *rc);
static void gimp_rc_notify (GimpRc *rc, static void gimp_rc_notify (GimpRc *rc,
GParamSpec *param, GParamSpec *param,
gpointer data); gpointer data);
static GObjectClass *parent_class = NULL; static GObjectClass *parent_class = NULL;
GType GType
gimp_rc_get_type (void) gimp_rc_get_type (void)
{ {
static GType rc_type = 0; static GType rc_type = 0;
@ -109,19 +109,17 @@ gimp_rc_get_type (void)
0, /* n_preallocs */ 0, /* n_preallocs */
(GInstanceInitFunc) gimp_rc_init (GInstanceInitFunc) gimp_rc_init
}; };
static const GInterfaceInfo rc_iface_info = static const GInterfaceInfo rc_iface_info =
{ {
gimp_rc_config_iface_init, gimp_rc_config_iface_init,
NULL, /* iface_finalize */ NULL, /* iface_finalize */
NULL /* iface_data */ NULL /* iface_data */
}; };
rc_type = g_type_register_static (GIMP_TYPE_PLUGIN_CONFIG, rc_type = g_type_register_static (GIMP_TYPE_PLUGIN_CONFIG,
"GimpRc", &rc_info, 0); "GimpRc", &rc_info, 0);
g_type_add_interface_static (rc_type, g_type_add_interface_static (rc_type, GIMP_TYPE_CONFIG, &rc_iface_info);
GIMP_TYPE_CONFIG_INTERFACE,
&rc_iface_info);
} }
return rc_type; return rc_type;
@ -192,7 +190,7 @@ gimp_rc_finalize (GObject *object)
g_free (rc->user_gimprc); g_free (rc->user_gimprc);
rc->user_gimprc = NULL; rc->user_gimprc = NULL;
} }
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
@ -223,7 +221,7 @@ gimp_rc_set_property (GObject *object,
case PROP_SYSTEM_GIMPRC: case PROP_SYSTEM_GIMPRC:
g_free (rc->system_gimprc); g_free (rc->system_gimprc);
if (filename) if (filename)
rc->system_gimprc = g_strdup (filename); rc->system_gimprc = g_strdup (filename);
else else
@ -252,7 +250,7 @@ gimp_rc_get_property (GObject *object,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GimpRc *rc = GIMP_RC (object); GimpRc *rc = GIMP_RC (object);
switch (property_id) switch (property_id)
{ {
case PROP_VERBOSE: case PROP_VERBOSE:
@ -282,32 +280,32 @@ gimp_rc_config_iface_init (gpointer iface,
} }
static gboolean static gboolean
gimp_rc_serialize (GObject *object, gimp_rc_serialize (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data) gpointer data)
{ {
if (data && GIMP_IS_RC (data)) if (data && GIMP_IS_RC (data))
{ {
if (! gimp_config_serialize_properties_diff (object, if (! gimp_config_serialize_properties_diff (config, GIMP_CONFIG (data),
G_OBJECT (data), writer)) writer))
return FALSE; return FALSE;
} }
else else
{ {
if (! gimp_config_serialize_properties (object, writer)) if (! gimp_config_serialize_properties (config, writer))
return FALSE; return FALSE;
} }
return gimp_config_serialize_unknown_tokens (object, writer); return gimp_config_serialize_unknown_tokens (config, writer);
} }
static gboolean static gboolean
gimp_rc_deserialize (GObject *object, gimp_rc_deserialize (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data) gpointer data)
{ {
return gimp_config_deserialize_properties (object, return gimp_config_deserialize_properties (config,
scanner, nest_level, TRUE); scanner, nest_level, TRUE);
} }
@ -316,17 +314,17 @@ gimp_rc_duplicate_unknown_token (const gchar *key,
const gchar *value, const gchar *value,
gpointer user_data) gpointer user_data)
{ {
gimp_config_add_unknown_token (G_OBJECT (user_data), key, value); gimp_config_add_unknown_token (GIMP_CONFIG (user_data), key, value);
} }
static GObject * static GimpConfig *
gimp_rc_duplicate (GObject *object) gimp_rc_duplicate (GimpConfig *config)
{ {
GObject *dup = g_object_new (GIMP_TYPE_RC, NULL); GimpConfig *dup = g_object_new (GIMP_TYPE_RC, NULL);
gimp_config_copy_properties (object, dup); gimp_config_copy_properties (config, dup);
gimp_config_foreach_unknown_token (object, gimp_config_foreach_unknown_token (config,
gimp_rc_duplicate_unknown_token, dup); gimp_rc_duplicate_unknown_token, dup);
return dup; return dup;
@ -342,24 +340,24 @@ gimp_rc_load (GimpRc *rc)
if (rc->verbose) if (rc->verbose)
g_print (_("Parsing '%s'\n"), rc->system_gimprc); g_print (_("Parsing '%s'\n"), rc->system_gimprc);
if (! gimp_config_deserialize_file (G_OBJECT (rc), if (! gimp_config_deserialize_file (GIMP_CONFIG (rc),
rc->system_gimprc, NULL, &error)) rc->system_gimprc, NULL, &error))
{ {
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT) if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
g_message (error->message); g_message (error->message);
g_clear_error (&error); g_clear_error (&error);
} }
if (rc->verbose) if (rc->verbose)
g_print (_("Parsing '%s'\n"), rc->user_gimprc); g_print (_("Parsing '%s'\n"), rc->user_gimprc);
if (! gimp_config_deserialize_file (G_OBJECT (rc), if (! gimp_config_deserialize_file (GIMP_CONFIG (rc),
rc->user_gimprc, NULL, &error)) rc->user_gimprc, NULL, &error))
{ {
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT) if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
g_message (error->message); g_message (error->message);
g_clear_error (&error); g_clear_error (&error);
} }
} }
@ -445,12 +443,12 @@ gimp_rc_set_autosave (GimpRc *rc,
* gimp_rc_query: * gimp_rc_query:
* @rc: a #GimpRc object. * @rc: a #GimpRc object.
* @key: a string used as a key for the lookup. * @key: a string used as a key for the lookup.
* *
* This function looks up @key in the object properties of @rc. If * This function looks up @key in the object properties of @rc. If
* there's a matching property, a string representation of its value * there's a matching property, a string representation of its value
* is returned. If no property is found, the list of unknown tokens * is returned. If no property is found, the list of unknown tokens
* attached to the @rc object is searched. * attached to the @rc object is searched.
* *
* Return value: a newly allocated string representing the value or %NULL * Return value: a newly allocated string representing the value or %NULL
* if the key couldn't be found. * if the key couldn't be found.
**/ **/
@ -504,7 +502,8 @@ gimp_rc_query (GimpRc *rc,
} }
else else
{ {
retval = g_strdup (gimp_config_lookup_unknown_token (rc_object, key)); retval = g_strdup (gimp_config_lookup_unknown_token (GIMP_CONFIG (rc),
key));
} }
g_free (property_specs); g_free (property_specs);
@ -542,7 +541,7 @@ gimp_rc_query (GimpRc *rc,
/** /**
* gimp_rc_save: * gimp_rc_save:
* @gimprc: a #GimpRc object. * @gimprc: a #GimpRc object.
* *
* Saves any settings that differ from the system-wide defined * Saves any settings that differ from the system-wide defined
* defaults to the users personal gimprc file. * defaults to the users personal gimprc file.
**/ **/
@ -553,7 +552,7 @@ gimp_rc_save (GimpRc *rc)
gchar *header; gchar *header;
GError *error = NULL; GError *error = NULL;
const gchar *top = const gchar *top =
"GIMP gimprc\n" "GIMP gimprc\n"
"\n" "\n"
"This is your personal gimprc file. Any variable defined in this file " "This is your personal gimprc file. Any variable defined in this file "
@ -566,18 +565,18 @@ gimp_rc_save (GimpRc *rc)
"end of gimprc"; "end of gimprc";
g_return_if_fail (GIMP_IS_RC (rc)); g_return_if_fail (GIMP_IS_RC (rc));
global = g_object_new (GIMP_TYPE_RC, NULL); global = g_object_new (GIMP_TYPE_RC, NULL);
gimp_config_deserialize_file (G_OBJECT (global), gimp_config_deserialize_file (GIMP_CONFIG (global),
rc->system_gimprc, NULL, NULL); rc->system_gimprc, NULL, NULL);
header = g_strconcat (top, rc->system_gimprc, bottom, NULL); header = g_strconcat (top, rc->system_gimprc, bottom, NULL);
if (rc->verbose) if (rc->verbose)
g_print (_("Saving '%s'\n"), rc->user_gimprc); g_print (_("Saving '%s'\n"), rc->user_gimprc);
if (! gimp_config_serialize_to_file (G_OBJECT (rc), if (! gimp_config_serialize_to_file (GIMP_CONFIG (rc),
rc->user_gimprc, rc->user_gimprc,
header, footer, global, header, footer, global,
&error)) &error))

View File

@ -3,7 +3,7 @@
* *
* Test suite for GimpConfig. * Test suite for GimpConfig.
* Copyright (C) 2001-2002 Sven Neumann <sven@gimp.org> * Copyright (C) 2001-2002 Sven Neumann <sven@gimp.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
@ -48,8 +48,8 @@ int
main (int argc, main (int argc,
char *argv[]) char *argv[])
{ {
GObject *gimprc; GimpConfig *gimprc;
GObject *gimprc2; GimpConfig *gimprc2;
const gchar *filename = "foorc"; const gchar *filename = "foorc";
gchar *header; gchar *header;
gchar *result; gchar *result;
@ -61,7 +61,7 @@ main (int argc,
if (strcmp (argv[i], "--g-fatal-warnings") == 0) if (strcmp (argv[i], "--g-fatal-warnings") == 0)
{ {
GLogLevelFlags fatal_mask; GLogLevelFlags fatal_mask;
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK); fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL; fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
g_log_set_always_fatal (fatal_mask); g_log_set_always_fatal (fatal_mask);
@ -75,12 +75,12 @@ main (int argc,
g_print (" Creating a new GimpRc object ..."); g_print (" Creating a new GimpRc object ...");
gimprc = g_object_new (GIMP_TYPE_RC, NULL); gimprc = g_object_new (GIMP_TYPE_RC, NULL);
g_print (" done.\n\n"); g_print (" done.\n\n");
g_print (" Adding the unknown token (foobar \"hadjaha\") ..."); g_print (" Adding the unknown token (foobar \"hadjaha\") ...");
gimp_config_add_unknown_token (gimprc, "foobar", "hadjaha"); gimp_config_add_unknown_token (gimprc, "foobar", "hadjaha");
g_print (" done.\n\n"); g_print (" done.\n\n");
g_print (" Serializing %s to '%s' ...", g_print (" Serializing %s to '%s' ...",
g_type_name (G_TYPE_FROM_INSTANCE (gimprc)), filename); g_type_name (G_TYPE_FROM_INSTANCE (gimprc)), filename);
if (! gimp_config_serialize_to_file (gimprc, if (! gimp_config_serialize_to_file (gimprc,
@ -122,7 +122,7 @@ main (int argc,
g_object_set (gimprc2, "show-tips", FALSE, NULL); g_object_set (gimprc2, "show-tips", FALSE, NULL);
g_print ("\n Querying for \"default-comment\" ... "); g_print ("\n Querying for \"default-comment\" ... ");
result = gimp_rc_query (GIMP_RC (gimprc2), "default-comment"); result = gimp_rc_query (GIMP_RC (gimprc2), "default-comment");
if (result) if (result)
{ {
@ -136,7 +136,7 @@ main (int argc,
g_free (result); g_free (result);
g_print (" Querying for \"foobar\" ... "); g_print (" Querying for \"foobar\" ... ");
result = gimp_rc_query (GIMP_RC (gimprc2), "foobar"); result = gimp_rc_query (GIMP_RC (gimprc2), "foobar");
if (result && strcmp (result, "hadjaha") == 0) if (result && strcmp (result, "hadjaha") == 0)
{ {
@ -200,7 +200,7 @@ main (int argc,
g_free (result); g_free (result);
g_object_unref (gimprc2); g_object_unref (gimprc2);
g_object_unref (gimprc); g_object_unref (gimprc);
g_print ("\nFinished test of GimpConfig.\n\n"); g_print ("\nFinished test of GimpConfig.\n\n");
return EXIT_SUCCESS; return EXIT_SUCCESS;
@ -227,7 +227,7 @@ notify_callback (GObject *object,
} }
else else
{ {
g_print (" %s changed but we failed to serialize its value!\n", g_print (" %s changed but we failed to serialize its value!\n",
pspec->name); pspec->name);
} }

View File

@ -46,7 +46,7 @@ gimp_documents_load (Gimp *gimp)
filename = gimp_personal_rc_file ("documents"); filename = gimp_personal_rc_file ("documents");
if (! gimp_config_deserialize_file (G_OBJECT (gimp->documents), if (! gimp_config_deserialize_file (GIMP_CONFIG (gimp->documents),
filename, filename,
GINT_TO_POINTER (gimp->config->thumbnail_size), GINT_TO_POINTER (gimp->config->thumbnail_size),
&error)) &error))
@ -77,7 +77,7 @@ gimp_documents_save (Gimp *gimp)
filename = gimp_personal_rc_file ("documents"); filename = gimp_personal_rc_file ("documents");
if (! gimp_config_serialize_to_file (G_OBJECT (gimp->documents), if (! gimp_config_serialize_to_file (GIMP_CONFIG (gimp->documents),
filename, filename,
header, footer, NULL, header, footer, NULL,
&error)) &error))

View File

@ -1,4 +1,4 @@
/* gimpparasite.c: Copyright 1998 Jay Cox <jaycox@earthlink.net> /* gimpparasite.c: Copyright 1998 Jay Cox <jaycox@earthlink.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -52,7 +52,7 @@ gimp_parasite_find (Gimp *gimp,
return gimp_parasite_list_find (gimp->parasites, name); return gimp_parasite_list_find (gimp->parasites, name);
} }
static void static void
list_func (const gchar *key, list_func (const gchar *key,
GimpParasite *parasite, GimpParasite *parasite,
gchar ***current) gchar ***current)
@ -101,7 +101,7 @@ gimp_parasiterc_load (Gimp *gimp)
filename = gimp_personal_rc_file ("parasiterc"); filename = gimp_personal_rc_file ("parasiterc");
if (! gimp_config_deserialize_file (G_OBJECT (gimp->parasites), if (! gimp_config_deserialize_file (GIMP_CONFIG (gimp->parasites),
filename, NULL, &error)) filename, NULL, &error))
{ {
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT) if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
@ -130,7 +130,7 @@ gimp_parasiterc_save (Gimp *gimp)
filename = gimp_personal_rc_file ("parasiterc"); filename = gimp_personal_rc_file ("parasiterc");
if (! gimp_config_serialize_to_file (G_OBJECT (gimp->parasites), if (! gimp_config_serialize_to_file (GIMP_CONFIG (gimp->parasites),
filename, filename,
header, footer, NULL, header, footer, NULL,
&error)) &error))

View File

@ -46,7 +46,7 @@ gimp_templates_load (Gimp *gimp)
filename = gimp_personal_rc_file ("templaterc"); filename = gimp_personal_rc_file ("templaterc");
if (!gimp_config_deserialize_file (G_OBJECT (gimp->templates), if (!gimp_config_deserialize_file (GIMP_CONFIG (gimp->templates),
filename, filename,
NULL, NULL,
&error)) &error))
@ -79,7 +79,7 @@ gimp_templates_save (Gimp *gimp)
filename = gimp_personal_rc_file ("templaterc"); filename = gimp_personal_rc_file ("templaterc");
if (! gimp_config_serialize_to_file (G_OBJECT (gimp->templates), if (! gimp_config_serialize_to_file (GIMP_CONFIG (gimp->templates),
filename, filename,
header, footer, NULL, header, footer, NULL,
&error)) &error))

View File

@ -836,7 +836,7 @@ gimp_load_config (Gimp *gimp,
gimp->config = GIMP_CORE_CONFIG (gimprc); gimp->config = GIMP_CORE_CONFIG (gimprc);
gimp->edit_config = gimp->edit_config =
GIMP_CORE_CONFIG (gimp_config_duplicate (G_OBJECT (gimp->config))); GIMP_CORE_CONFIG (gimp_config_duplicate (GIMP_CONFIG (gimp->config)));
g_signal_connect_object (gimp->config, "notify", g_signal_connect_object (gimp->config, "notify",
G_CALLBACK (gimp_global_config_notify), G_CALLBACK (gimp_global_config_notify),

View File

@ -74,8 +74,8 @@ struct _Gimp
GimpCoreConfig *config; GimpCoreConfig *config;
GimpCoreConfig *edit_config; /* don't use this one, it's just GimpCoreConfig *edit_config; /* don't use this one, it's just
* for the preferences dialog * for the preferences dialog
*/ */
gboolean be_verbose; gboolean be_verbose;
gboolean no_data; gboolean no_data;

View File

@ -101,10 +101,10 @@ static void gimp_container_get_property (GObject *object,
static gsize gimp_container_get_memsize (GimpObject *object, static gsize gimp_container_get_memsize (GimpObject *object,
gsize *gui_size); gsize *gui_size);
static gboolean gimp_container_serialize (GObject *object, static gboolean gimp_container_serialize (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data); gpointer data);
static gboolean gimp_container_deserialize (GObject *object, static gboolean gimp_container_deserialize (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data); gpointer data);
@ -148,8 +148,7 @@ gimp_container_get_type (void)
"GimpContainer", "GimpContainer",
&container_info, 0); &container_info, 0);
g_type_add_interface_static (container_type, g_type_add_interface_static (container_type, GIMP_TYPE_CONFIG,
GIMP_TYPE_CONFIG_INTERFACE,
&config_iface_info); &config_iface_info);
} }
@ -375,7 +374,7 @@ gimp_container_serialize_foreach (GObject *object,
GimpConfigInterface *config_iface; GimpConfigInterface *config_iface;
const gchar *name; const gchar *name;
config_iface = GIMP_GET_CONFIG_INTERFACE (object); config_iface = GIMP_CONFIG_GET_INTERFACE (object);
if (! config_iface) if (! config_iface)
serialize_data->success = FALSE; serialize_data->success = FALSE;
@ -393,21 +392,21 @@ gimp_container_serialize_foreach (GObject *object,
else else
gimp_config_writer_print (serialize_data->writer, "NULL", 4); gimp_config_writer_print (serialize_data->writer, "NULL", 4);
serialize_data->success = config_iface->serialize (object, serialize_data->success = config_iface->serialize (GIMP_CONFIG (object),
serialize_data->writer, serialize_data->writer,
serialize_data->data); serialize_data->data);
gimp_config_writer_close (serialize_data->writer); gimp_config_writer_close (serialize_data->writer);
} }
static gboolean static gboolean
gimp_container_serialize (GObject *object, gimp_container_serialize (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data) gpointer data)
{ {
GimpContainer *container; GimpContainer *container;
SerializeData serialize_data; SerializeData serialize_data;
container = GIMP_CONTAINER (object); container = GIMP_CONTAINER (config);
serialize_data.writer = writer; serialize_data.writer = writer;
serialize_data.data = data; serialize_data.data = data;
@ -421,15 +420,15 @@ gimp_container_serialize (GObject *object,
} }
static gboolean static gboolean
gimp_container_deserialize (GObject *object, gimp_container_deserialize (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data) gpointer data)
{ {
GimpContainer *container; GimpContainer *container;
GTokenType token; GTokenType token;
container = GIMP_CONTAINER (object); container = GIMP_CONTAINER (config);
token = G_TOKEN_LEFT_PAREN; token = G_TOKEN_LEFT_PAREN;
@ -468,7 +467,7 @@ gimp_container_deserialize (GObject *object,
return FALSE; return FALSE;
} }
if (! g_type_is_a (type, GIMP_TYPE_CONFIG_INTERFACE)) if (! g_type_is_a (type, GIMP_TYPE_CONFIG))
{ {
g_scanner_error (scanner, g_scanner_error (scanner,
"'%s' does not implement GimpConfigInterface", "'%s' does not implement GimpConfigInterface",
@ -509,20 +508,14 @@ gimp_container_deserialize (GObject *object,
g_free (name); g_free (name);
{ if (! GIMP_CONFIG_GET_INTERFACE (config)->deserialize (GIMP_CONFIG (child),
GimpConfigInterface *config_iface; scanner,
nest_level + 1,
config_iface = GIMP_GET_CONFIG_INTERFACE (child); FALSE))
{
if (! config_iface->deserialize (G_OBJECT (child), /* warning should be already set by child */
scanner, return FALSE;
nest_level + 1, }
FALSE))
{
/* warning should be already set by child */
return FALSE;
}
}
} }
token = G_TOKEN_RIGHT_PAREN; token = G_TOKEN_RIGHT_PAREN;
break; break;

View File

@ -90,15 +90,15 @@ static void gimp_context_get_property (GObject *object,
static gsize gimp_context_get_memsize (GimpObject *object, static gsize gimp_context_get_memsize (GimpObject *object,
gsize *gui_size); gsize *gui_size);
static gboolean gimp_context_serialize (GObject *object, static gboolean gimp_context_serialize (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data); gpointer data);
static gboolean gimp_context_serialize_property (GObject *object, static gboolean gimp_context_serialize_property (GimpConfig *config,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec, GParamSpec *pspec,
GimpConfigWriter *writer); GimpConfigWriter *writer);
static gboolean gimp_context_deserialize_property (GObject *object, static gboolean gimp_context_deserialize_property (GimpConfig *config,
guint property_id, guint property_id,
GValue *value, GValue *value,
GParamSpec *pspec, GParamSpec *pspec,
@ -352,8 +352,7 @@ gimp_context_get_type (void)
"GimpContext", "GimpContext",
&context_info, 0); &context_info, 0);
g_type_add_interface_static (context_type, g_type_add_interface_static (context_type, GIMP_TYPE_CONFIG,
GIMP_TYPE_CONFIG_INTERFACE,
&config_iface_info); &config_iface_info);
} }
@ -1102,15 +1101,15 @@ gimp_context_get_memsize (GimpObject *object,
} }
static gboolean static gboolean
gimp_context_serialize (GObject *object, gimp_context_serialize (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data) gpointer data)
{ {
return gimp_config_serialize_changed_properties (object, writer); return gimp_config_serialize_changed_properties (config, writer);
} }
static gboolean static gboolean
gimp_context_serialize_property (GObject *object, gimp_context_serialize_property (GimpConfig *config,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec, GParamSpec *pspec,
@ -1119,7 +1118,7 @@ gimp_context_serialize_property (GObject *object,
GimpContext *context; GimpContext *context;
GimpObject *serialize_obj; GimpObject *serialize_obj;
context = GIMP_CONTEXT (object); context = GIMP_CONTEXT (config);
#if 0 #if 0
/* serialize nothing if the property is not defined */ /* serialize nothing if the property is not defined */
@ -1155,7 +1154,7 @@ gimp_context_serialize_property (GObject *object,
} }
static gboolean static gboolean
gimp_context_deserialize_property (GObject *object, gimp_context_deserialize_property (GimpConfig *object,
guint property_id, guint property_id,
GValue *value, GValue *value,
GParamSpec *pspec, GParamSpec *pspec,

View File

@ -42,10 +42,10 @@
static void gimp_document_list_config_iface_init (gpointer iface, static void gimp_document_list_config_iface_init (gpointer iface,
gpointer iface_data); gpointer iface_data);
static gboolean gimp_document_list_serialize (GObject *object, static gboolean gimp_document_list_serialize (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data); gpointer data);
static gboolean gimp_document_list_deserialize (GObject *object, static gboolean gimp_document_list_deserialize (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data); gpointer data);
@ -54,7 +54,7 @@ static gboolean gimp_document_list_deserialize (GObject *object,
static const gchar *document_symbol = "document"; static const gchar *document_symbol = "document";
GType GType
gimp_document_list_get_type (void) gimp_document_list_get_type (void)
{ {
static GType document_list_type = 0; static GType document_list_type = 0;
@ -73,19 +73,18 @@ gimp_document_list_get_type (void)
0, /* n_preallocs */ 0, /* n_preallocs */
NULL /* instance_init */ NULL /* instance_init */
}; };
static const GInterfaceInfo document_list_iface_info = static const GInterfaceInfo document_list_iface_info =
{ {
gimp_document_list_config_iface_init, gimp_document_list_config_iface_init,
NULL, /* iface_finalize */ NULL, /* iface_finalize */
NULL /* iface_data */ NULL /* iface_data */
}; };
document_list_type = g_type_register_static (GIMP_TYPE_LIST, document_list_type = g_type_register_static (GIMP_TYPE_LIST,
"GimpDocumentList", "GimpDocumentList",
&document_list_info, 0); &document_list_info, 0);
g_type_add_interface_static (document_list_type, g_type_add_interface_static (document_list_type, GIMP_TYPE_CONFIG,
GIMP_TYPE_CONFIG_INTERFACE,
&document_list_iface_info); &document_list_iface_info);
} }
@ -103,16 +102,16 @@ gimp_document_list_config_iface_init (gpointer iface,
} }
static gboolean static gboolean
gimp_document_list_serialize (GObject *object, gimp_document_list_serialize (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data) gpointer data)
{ {
GList *list; GList *list;
for (list = GIMP_LIST (object)->list; list; list = list->next) for (list = GIMP_LIST (config)->list; list; list = list->next)
{ {
gimp_config_writer_open (writer, document_symbol); gimp_config_writer_open (writer, document_symbol);
gimp_config_writer_string (writer, GIMP_OBJECT (list->data)->name); gimp_config_writer_string (writer, GIMP_OBJECT (list->data)->name);
gimp_config_writer_close (writer); gimp_config_writer_close (writer);
} }
@ -120,17 +119,15 @@ gimp_document_list_serialize (GObject *object,
} }
static gboolean static gboolean
gimp_document_list_deserialize (GObject *object, gimp_document_list_deserialize (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data) gpointer data)
{ {
GimpDocumentList *document_list; GimpDocumentList *document_list = GIMP_DOCUMENT_LIST (config);
GTokenType token; GTokenType token;
gint size; gint size;
document_list = GIMP_DOCUMENT_LIST (object);
size = GPOINTER_TO_INT (data); size = GPOINTER_TO_INT (data);
g_scanner_scope_add_symbol (scanner, 0, g_scanner_scope_add_symbol (scanner, 0,

View File

@ -98,8 +98,7 @@ gimp_grid_get_type (void)
grid_type = g_type_register_static (GIMP_TYPE_OBJECT, grid_type = g_type_register_static (GIMP_TYPE_OBJECT,
"GimpGrid", &grid_info, 0); "GimpGrid", &grid_info, 0);
g_type_add_interface_static (grid_type, g_type_add_interface_static (grid_type, GIMP_TYPE_CONFIG,
GIMP_TYPE_CONFIG_INTERFACE,
&grid_iface_info); &grid_iface_info);
} }
@ -285,7 +284,7 @@ gimp_grid_to_parasite (const GimpGrid *grid)
g_return_val_if_fail (GIMP_IS_GRID (grid), NULL); g_return_val_if_fail (GIMP_IS_GRID (grid), NULL);
str = gimp_config_serialize_to_string (G_OBJECT (grid), NULL); str = gimp_config_serialize_to_string (GIMP_CONFIG (grid), NULL);
g_return_val_if_fail (str != NULL, NULL); g_return_val_if_fail (str != NULL, NULL);
parasite = gimp_parasite_new (gimp_grid_parasite_name (), parasite = gimp_parasite_new (gimp_grid_parasite_name (),
@ -312,7 +311,7 @@ gimp_grid_from_parasite (const GimpParasite *parasite)
grid = g_object_new (GIMP_TYPE_GRID, NULL); grid = g_object_new (GIMP_TYPE_GRID, NULL);
if (! gimp_config_deserialize_string (G_OBJECT (grid), if (! gimp_config_deserialize_string (GIMP_CONFIG (grid),
str, str,
gimp_parasite_data_size (parasite), gimp_parasite_data_size (parasite),
NULL, NULL,

View File

@ -243,7 +243,7 @@ gimp_image_duplicate (GimpImage *gimage)
if (gimage->grid) if (gimage->grid)
{ {
new_gimage->grid = new_gimage->grid =
GIMP_GRID (gimp_config_duplicate (G_OBJECT (gimage->grid))); GIMP_GRID (gimp_config_duplicate (GIMP_CONFIG (gimage->grid)));
} }
/* Copy the qmask info */ /* Copy the qmask info */

View File

@ -1,6 +1,6 @@
/* The GIMP -- an image manipulation program /* The GIMP -- an image manipulation program
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis * Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
@ -48,8 +48,8 @@ gimp_image_new_get_last_template (Gimp *gimp,
if (gimage) if (gimage)
gimp_template_set_from_image (template, gimage); gimp_template_set_from_image (template, gimage);
else else
gimp_config_copy_properties (G_OBJECT (gimp->image_new_last_template), gimp_config_copy_properties (GIMP_CONFIG (gimp->image_new_last_template),
G_OBJECT (template)); GIMP_CONFIG (template));
if (gimp->global_buffer && gimp->have_current_cut_buffer) if (gimp->global_buffer && gimp->have_current_cut_buffer)
{ {
@ -69,7 +69,7 @@ gimp_image_new_set_last_template (Gimp *gimp,
g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_TEMPLATE (template)); g_return_if_fail (GIMP_IS_TEMPLATE (template));
gimp_config_copy_properties (G_OBJECT (template), gimp_config_copy_properties (GIMP_CONFIG (template),
G_OBJECT (gimp->image_new_last_template)); GIMP_CONFIG (gimp->image_new_last_template));
gimp->have_current_cut_buffer = FALSE; gimp->have_current_cut_buffer = FALSE;
} }

View File

@ -31,8 +31,9 @@
#include "base/temp-buf.h" #include "base/temp-buf.h"
#include "base/tile-manager.h" #include "base/tile-manager.h"
#include "config/gimpcoreconfig.h" #include "config/gimpconfig.h"
#include "config/gimpconfig-utils.h" #include "config/gimpconfig-utils.h"
#include "config/gimpcoreconfig.h"
#include "gimp.h" #include "gimp.h"
#include "gimp-parasites.h" #include "gimp-parasites.h"
@ -949,8 +950,8 @@ gimp_image_new (Gimp *gimp,
gimage->unit = gimp->config->default_unit; gimage->unit = gimp->config->default_unit;
gimage->grid = g_object_new (GIMP_TYPE_GRID, NULL); gimage->grid = g_object_new (GIMP_TYPE_GRID, NULL);
gimp_config_copy_properties (G_OBJECT (gimp->config->default_grid), gimp_config_copy_properties (GIMP_CONFIG (gimp->config->default_grid),
G_OBJECT (gimage->grid)); GIMP_CONFIG (gimage->grid));
switch (base_type) switch (base_type)
{ {

View File

@ -56,10 +56,10 @@ static gsize gimp_parasite_list_get_memsize (GimpObject *object,
static void gimp_parasite_list_config_iface_init (gpointer iface, static void gimp_parasite_list_config_iface_init (gpointer iface,
gpointer iface_data); gpointer iface_data);
static gboolean gimp_parasite_list_serialize (GObject *list, static gboolean gimp_parasite_list_serialize (GimpConfig *list,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data); gpointer data);
static gboolean gimp_parasite_list_deserialize (GObject *list, static gboolean gimp_parasite_list_deserialize (GimpConfig *list,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data); gpointer data);
@ -114,8 +114,7 @@ gimp_parasite_list_get_type (void)
list_type = g_type_register_static (GIMP_TYPE_OBJECT, list_type = g_type_register_static (GIMP_TYPE_OBJECT,
"GimpParasiteList", "GimpParasiteList",
&list_info, 0); &list_info, 0);
g_type_add_interface_static (list_type, g_type_add_interface_static (list_type, GIMP_TYPE_CONFIG,
GIMP_TYPE_CONFIG_INTERFACE,
&list_iface_info); &list_iface_info);
} }
@ -232,7 +231,7 @@ gimp_parasite_list_get_memsize (GimpObject *object,
} }
static gboolean static gboolean
gimp_parasite_list_serialize (GObject *list, gimp_parasite_list_serialize (GimpConfig *list,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data) gpointer data)
{ {
@ -245,10 +244,10 @@ gimp_parasite_list_serialize (GObject *list,
} }
static gboolean static gboolean
gimp_parasite_list_deserialize (GObject *list, gimp_parasite_list_deserialize (GimpConfig *list,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data) gpointer data)
{ {
GTokenType token; GTokenType token;

View File

@ -74,10 +74,10 @@ static void gimp_template_get_property (GObject *object,
static void gimp_template_notify (GObject *object, static void gimp_template_notify (GObject *object,
GParamSpec *pspec); GParamSpec *pspec);
static gboolean gimp_template_serialize (GObject *object, static gboolean gimp_template_serialize (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data); gpointer data);
static gboolean gimp_template_deserialize (GObject *object, static gboolean gimp_template_deserialize (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data); gpointer data);
@ -105,7 +105,7 @@ gimp_template_get_type (void)
0, /* n_preallocs */ 0, /* n_preallocs */
(GInstanceInitFunc) gimp_template_init, (GInstanceInitFunc) gimp_template_init,
}; };
static const GInterfaceInfo config_iface_info = static const GInterfaceInfo config_iface_info =
{ {
(GInterfaceInitFunc) gimp_template_config_iface_init, (GInterfaceInitFunc) gimp_template_config_iface_init,
NULL, /* iface_finalize */ NULL, /* iface_finalize */
@ -113,11 +113,10 @@ gimp_template_get_type (void)
}; };
template_type = g_type_register_static (GIMP_TYPE_VIEWABLE, template_type = g_type_register_static (GIMP_TYPE_VIEWABLE,
"GimpTemplate", "GimpTemplate",
&template_info, 0); &template_info, 0);
g_type_add_interface_static (template_type, g_type_add_interface_static (template_type, GIMP_TYPE_CONFIG,
GIMP_TYPE_CONFIG_INTERFACE,
&config_iface_info); &config_iface_info);
} }
@ -344,20 +343,21 @@ gimp_template_notify (GObject *object,
} }
static gboolean static gboolean
gimp_template_serialize (GObject *object, gimp_template_serialize (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data) gpointer data)
{ {
return gimp_config_serialize_properties (object, writer); return gimp_config_serialize_properties (config, writer);
} }
static gboolean static gboolean
gimp_template_deserialize (GObject *object, gimp_template_deserialize (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data) gpointer data)
{ {
return gimp_config_deserialize_properties (object, scanner, nest_level, FALSE); return gimp_config_deserialize_properties (config,
scanner, nest_level, FALSE);
} }

View File

@ -166,7 +166,7 @@ gimp_tool_options_get_property (GObject *object,
static void static void
gimp_tool_options_real_reset (GimpToolOptions *tool_options) gimp_tool_options_real_reset (GimpToolOptions *tool_options)
{ {
gimp_config_reset (G_OBJECT (tool_options)); gimp_config_reset (GIMP_CONFIG (tool_options));
} }
void void
@ -229,7 +229,7 @@ gimp_tool_options_serialize (GimpToolOptions *tool_options,
footer = g_strdup_printf ("end of %s options", footer = g_strdup_printf ("end of %s options",
GIMP_OBJECT (tool_options->tool_info)->name); GIMP_OBJECT (tool_options->tool_info)->name);
retval = gimp_config_serialize_to_file (G_OBJECT (tool_options), retval = gimp_config_serialize_to_file (GIMP_CONFIG (tool_options),
filename, filename,
header, footer, header, footer,
NULL, NULL,
@ -255,7 +255,7 @@ gimp_tool_options_deserialize (GimpToolOptions *tool_options,
filename = gimp_tool_options_build_filename (tool_options, extension); filename = gimp_tool_options_build_filename (tool_options, extension);
retval = gimp_config_deserialize_file (G_OBJECT (tool_options), retval = gimp_config_deserialize_file (GIMP_CONFIG (tool_options),
filename, filename,
NULL, NULL,
error); error);

View File

@ -78,7 +78,7 @@ static void gimp_viewable_real_get_preview_size (GimpViewable *viewable,
gint *height); gint *height);
static gchar * gimp_viewable_real_get_description (GimpViewable *viewable, static gchar * gimp_viewable_real_get_description (GimpViewable *viewable,
gchar **tooltip); gchar **tooltip);
static gboolean gimp_viewable_serialize_property (GObject *object, static gboolean gimp_viewable_serialize_property (GimpConfig *config,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec, GParamSpec *pspec,
@ -123,8 +123,7 @@ gimp_viewable_get_type (void)
"GimpViewable", "GimpViewable",
&viewable_info, 0); &viewable_info, 0);
g_type_add_interface_static (viewable_type, g_type_add_interface_static (viewable_type, GIMP_TYPE_CONFIG,
GIMP_TYPE_CONFIG_INTERFACE,
&config_iface_info); &config_iface_info);
} }
@ -315,13 +314,13 @@ gimp_viewable_real_get_description (GimpViewable *viewable,
} }
static gboolean static gboolean
gimp_viewable_serialize_property (GObject *object, gimp_viewable_serialize_property (GimpConfig *config,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec, GParamSpec *pspec,
GimpConfigWriter *writer) GimpConfigWriter *writer)
{ {
GimpViewable *viewable = GIMP_VIEWABLE (object); GimpViewable *viewable = GIMP_VIEWABLE (config);
switch (property_id) switch (property_id)
{ {

View File

@ -80,8 +80,8 @@ grid_dialog_new (GimpImage *gimage)
grid = gimp_image_get_grid (GIMP_IMAGE (gimage)); grid = gimp_image_get_grid (GIMP_IMAGE (gimage));
grid_backup = g_object_new (GIMP_TYPE_GRID, NULL); grid_backup = g_object_new (GIMP_TYPE_GRID, NULL);
gimp_config_copy_properties (G_OBJECT (grid), gimp_config_copy_properties (GIMP_CONFIG (grid),
G_OBJECT (grid_backup)); GIMP_CONFIG (grid_backup));
/* dialog */ /* dialog */
dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage), dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
@ -148,8 +148,8 @@ reset_callback (GtkWidget *widget,
grid = g_object_get_data (G_OBJECT (dialog), "grid"); grid = g_object_get_data (G_OBJECT (dialog), "grid");
grid_backup = g_object_get_data (G_OBJECT (dialog), "grid-backup"); grid_backup = g_object_get_data (G_OBJECT (dialog), "grid-backup");
gimp_config_copy_properties (G_OBJECT (grid_backup), gimp_config_copy_properties (GIMP_CONFIG (grid_backup),
G_OBJECT (grid)); GIMP_CONFIG (grid));
gimp_image_grid_changed (GIMP_IMAGE (gimage)); gimp_image_grid_changed (GIMP_IMAGE (gimage));
} }
@ -180,7 +180,8 @@ ok_callback (GtkWidget *widget,
grid = g_object_get_data (G_OBJECT (dialog), "grid"); grid = g_object_get_data (G_OBJECT (dialog), "grid");
grid_backup = g_object_get_data (G_OBJECT (dialog), "grid-backup"); grid_backup = g_object_get_data (G_OBJECT (dialog), "grid-backup");
if (! gimp_config_is_equal_to (G_OBJECT (grid_backup), G_OBJECT (grid))) if (! gimp_config_is_equal_to (GIMP_CONFIG (grid_backup),
GIMP_CONFIG (grid)))
gimp_image_undo_push_image_grid (gimage, _("Grid"), grid_backup); gimp_image_undo_push_image_grid (gimage, _("Grid"), grid_backup);
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);

View File

@ -60,7 +60,7 @@
/* preferences local functions */ /* preferences local functions */
static GtkWidget * prefs_dialog_new (Gimp *gimp, static GtkWidget * prefs_dialog_new (Gimp *gimp,
GObject *config); GimpConfig *config);
static void prefs_config_notify (GObject *config, static void prefs_config_notify (GObject *config,
GParamSpec *param_spec, GParamSpec *param_spec,
GObject *config_copy); GObject *config_copy);
@ -94,9 +94,9 @@ static GtkWidget *prefs_dialog = NULL;
GtkWidget * GtkWidget *
preferences_dialog_create (Gimp *gimp) preferences_dialog_create (Gimp *gimp)
{ {
GObject *config; GimpConfig *config;
GObject *config_copy; GimpConfig *config_copy;
GObject *config_orig; GimpConfig *config_orig;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
@ -106,7 +106,7 @@ preferences_dialog_create (Gimp *gimp)
/* turn of autosaving while the prefs dialog is open */ /* turn of autosaving while the prefs dialog is open */
gimp_rc_set_autosave (GIMP_RC (gimp->edit_config), FALSE); gimp_rc_set_autosave (GIMP_RC (gimp->edit_config), FALSE);
config = G_OBJECT (gimp->edit_config); config = GIMP_CONFIG (gimp->edit_config);
config_copy = gimp_config_duplicate (config); config_copy = gimp_config_duplicate (config);
config_orig = gimp_config_duplicate (config); config_orig = gimp_config_duplicate (config);
@ -216,10 +216,10 @@ static void
prefs_cancel_callback (GtkWidget *widget, prefs_cancel_callback (GtkWidget *widget,
GtkWidget *dialog) GtkWidget *dialog)
{ {
Gimp *gimp; Gimp *gimp;
GObject *config_orig; GimpConfig *config_orig;
GList *diff; GList *diff;
GList *list; GList *list;
gimp = g_object_get_data (G_OBJECT (dialog), "gimp"); gimp = g_object_get_data (G_OBJECT (dialog), "gimp");
config_orig = g_object_get_data (G_OBJECT (dialog), "config-orig"); config_orig = g_object_get_data (G_OBJECT (dialog), "config-orig");
@ -228,7 +228,7 @@ prefs_cancel_callback (GtkWidget *widget,
gtk_widget_destroy (dialog); /* destroys config_copy */ gtk_widget_destroy (dialog); /* destroys config_copy */
diff = gimp_config_diff (G_OBJECT (gimp->edit_config), config_orig, diff = gimp_config_diff (GIMP_CONFIG (gimp->edit_config), config_orig,
GIMP_PARAM_SERIALIZE); GIMP_PARAM_SERIALIZE);
g_object_freeze_notify (G_OBJECT (gimp->edit_config)); g_object_freeze_notify (G_OBJECT (gimp->edit_config));
@ -242,7 +242,7 @@ prefs_cancel_callback (GtkWidget *widget,
g_value_init (&value, param_spec->value_type); g_value_init (&value, param_spec->value_type);
g_object_get_property (config_orig, g_object_get_property (G_OBJECT (config_orig),
param_spec->name, param_spec->name,
&value); &value);
g_object_set_property (G_OBJECT (gimp->edit_config), g_object_set_property (G_OBJECT (gimp->edit_config),
@ -265,11 +265,11 @@ static void
prefs_ok_callback (GtkWidget *widget, prefs_ok_callback (GtkWidget *widget,
GtkWidget *dialog) GtkWidget *dialog)
{ {
Gimp *gimp; Gimp *gimp;
GObject *config_copy; GimpConfig *config_copy;
GList *restart_diff; GList *restart_diff;
GList *confirm_diff; GList *confirm_diff;
GList *list; GList *list;
gimp = g_object_get_data (G_OBJECT (dialog), "gimp"); gimp = g_object_get_data (G_OBJECT (dialog), "gimp");
config_copy = g_object_get_data (G_OBJECT (dialog), "config-copy"); config_copy = g_object_get_data (G_OBJECT (dialog), "config-copy");
@ -278,7 +278,8 @@ prefs_ok_callback (GtkWidget *widget,
gtk_widget_destroy (dialog); /* destroys config_orig */ gtk_widget_destroy (dialog); /* destroys config_orig */
confirm_diff = gimp_config_diff (G_OBJECT (gimp->edit_config), config_copy, confirm_diff = gimp_config_diff (GIMP_CONFIG (gimp->edit_config),
config_copy,
GIMP_PARAM_CONFIRM); GIMP_PARAM_CONFIRM);
g_object_freeze_notify (G_OBJECT (gimp->edit_config)); g_object_freeze_notify (G_OBJECT (gimp->edit_config));
@ -292,12 +293,10 @@ prefs_ok_callback (GtkWidget *widget,
g_value_init (&value, param_spec->value_type); g_value_init (&value, param_spec->value_type);
g_object_get_property (config_copy, g_object_get_property (G_OBJECT (config_copy),
param_spec->name, param_spec->name, &value);
&value);
g_object_set_property (G_OBJECT (gimp->edit_config), g_object_set_property (G_OBJECT (gimp->edit_config),
param_spec->name, param_spec->name, &value);
&value);
g_value_unset (&value); g_value_unset (&value);
} }
@ -315,8 +314,8 @@ prefs_ok_callback (GtkWidget *widget,
/* spit out a solely informational warning about changed values /* spit out a solely informational warning about changed values
* which need restart * which need restart
*/ */
restart_diff = gimp_config_diff (G_OBJECT (gimp->edit_config), restart_diff = gimp_config_diff (GIMP_CONFIG (gimp->edit_config),
G_OBJECT (gimp->config), GIMP_CONFIG (gimp->config),
GIMP_PARAM_RESTART); GIMP_PARAM_RESTART);
if (restart_diff) if (restart_diff)
@ -839,8 +838,8 @@ prefs_help_func (const gchar *help_id,
} }
static GtkWidget * static GtkWidget *
prefs_dialog_new (Gimp *gimp, prefs_dialog_new (Gimp *gimp,
GObject *config) GimpConfig *config)
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *tv; GtkWidget *tv;
@ -881,12 +880,14 @@ prefs_dialog_new (Gimp *gimp,
gint i; gint i;
gchar *pixels_per_unit; gchar *pixels_per_unit;
GObject *object;
GimpCoreConfig *core_config; GimpCoreConfig *core_config;
GimpDisplayConfig *display_config; GimpDisplayConfig *display_config;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (G_IS_OBJECT (config), NULL); g_return_val_if_fail (GIMP_IS_CONFIG (config), NULL);
object = G_OBJECT (config);
core_config = GIMP_CORE_CONFIG (config); core_config = GIMP_CORE_CONFIG (config);
display_config = GIMP_DISPLAY_CONFIG (config); display_config = GIMP_DISPLAY_CONFIG (config);
@ -1030,7 +1031,7 @@ prefs_dialog_new (Gimp *gimp,
gtk_container_add (GTK_CONTAINER (vbox2), hbox); gtk_container_add (GTK_CONTAINER (vbox2), hbox);
gtk_widget_show (hbox); gtk_widget_show (hbox);
sizeentry = gimp_prop_coordinates_new (config, sizeentry = gimp_prop_coordinates_new (object,
"default-image-width", "default-image-width",
"default-image-height", "default-image-height",
"default-unit", "default-unit",
@ -1062,7 +1063,7 @@ prefs_dialog_new (Gimp *gimp,
pixels_per_unit = g_strconcat (_("Pixels"), "/%s", NULL); pixels_per_unit = g_strconcat (_("Pixels"), "/%s", NULL);
sizeentry2 = gimp_prop_coordinates_new (config, sizeentry2 = gimp_prop_coordinates_new (object,
"default-xresolution", "default-xresolution",
"default-yresolution", "default-yresolution",
"default-resolution_unit", "default-resolution_unit",
@ -1093,11 +1094,11 @@ prefs_dialog_new (Gimp *gimp,
table = prefs_table_new (2, GTK_CONTAINER (vbox), TRUE); table = prefs_table_new (2, GTK_CONTAINER (vbox), TRUE);
prefs_enum_option_menu_add (config, "default-image-type", prefs_enum_option_menu_add (object, "default-image-type",
GIMP_RGB, GIMP_GRAY, GIMP_RGB, GIMP_GRAY,
_("Default Image _Type:"), _("Default Image _Type:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
prefs_memsize_entry_add (config, "max-new-image-size", prefs_memsize_entry_add (object, "max-new-image-size",
_("Maximum Image Size:"), _("Maximum Image Size:"),
GTK_TABLE (table), 1); GTK_TABLE (table), 1);
@ -1130,7 +1131,7 @@ prefs_dialog_new (Gimp *gimp,
gtk_container_add (GTK_CONTAINER (vbox2), scrolled_window); gtk_container_add (GTK_CONTAINER (vbox2), scrolled_window);
gtk_widget_show (scrolled_window); gtk_widget_show (scrolled_window);
text_buffer = gimp_prop_text_buffer_new (config, "default-comment", text_buffer = gimp_prop_text_buffer_new (object, "default-comment",
MAX_COMMENT_LENGTH); MAX_COMMENT_LENGTH);
text_view = gtk_text_view_new_with_buffer (text_buffer); text_view = gtk_text_view_new_with_buffer (text_buffer);
@ -1181,49 +1182,49 @@ prefs_dialog_new (Gimp *gimp,
/* Previews */ /* Previews */
vbox2 = prefs_frame_new (_("Previews"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Previews"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "layer-previews", prefs_check_button_add (object, "layer-previews",
_("_Enable Layer & Channel Previews"), _("_Enable Layer & Channel Previews"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE);
prefs_enum_option_menu_add (config, "layer-preview-size", 0, 0, prefs_enum_option_menu_add (object, "layer-preview-size", 0, 0,
_("_Layer & Channel Preview Size:"), _("_Layer & Channel Preview Size:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
prefs_enum_option_menu_add (config, "navigation-preview-size", 0, 0, prefs_enum_option_menu_add (object, "navigation-preview-size", 0, 0,
_("_Navigation Preview Size:"), _("_Navigation Preview Size:"),
GTK_TABLE (table), 1); GTK_TABLE (table), 1);
/* Dialog Bahavior */ /* Dialog Bahavior */
vbox2 = prefs_frame_new (_("Dialog Behavior"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Dialog Behavior"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "info-window-per-display", prefs_check_button_add (object, "info-window-per-display",
_("_Info Window Per Display"), _("_Info Window Per Display"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
/* Menus */ /* Menus */
vbox2 = prefs_frame_new (_("Menus"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Menus"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "tearoff-menus", prefs_check_button_add (object, "tearoff-menus",
_("Enable _Tearoff Menus"), _("Enable _Tearoff Menus"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_spin_button_add (config, "last-opened-size", 1.0, 5.0, 0, prefs_spin_button_add (object, "last-opened-size", 1.0, 5.0, 0,
_("Open _Recent Menu Size:"), _("Open _Recent Menu Size:"),
GTK_TABLE (table), 3); GTK_TABLE (table), 3);
/* Keyboard Shortcuts */ /* Keyboard Shortcuts */
vbox2 = prefs_frame_new (_("Keyboard Shortcuts"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Keyboard Shortcuts"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "can-change-accels", prefs_check_button_add (object, "can-change-accels",
_("Dynamic _Keyboard Shortcuts"), _("Dynamic _Keyboard Shortcuts"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "save-accels", prefs_check_button_add (object, "save-accels",
_("Save Keyboard Shortcuts on Exit"), _("Save Keyboard Shortcuts on Exit"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "restore-accels", prefs_check_button_add (object, "restore-accels",
_("Restore Saved Keyboard Shortcuts on Start-up"), _("Restore Saved Keyboard Shortcuts on Start-up"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
@ -1253,10 +1254,10 @@ prefs_dialog_new (Gimp *gimp,
/* Window Positions */ /* Window Positions */
vbox2 = prefs_frame_new (_("Window Positions"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Window Positions"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "save-session-info", prefs_check_button_add (object, "save-session-info",
_("_Save Window Positions on Exit"), _("_Save Window Positions on Exit"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "restore-session", prefs_check_button_add (object, "restore-session",
_("R_estore Saved Window Positions on Start-up"), _("R_estore Saved Window Positions on Start-up"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
@ -1301,13 +1302,13 @@ prefs_dialog_new (Gimp *gimp,
/* General */ /* General */
vbox2 = prefs_frame_new (_("General"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("General"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "show-tool-tips", prefs_check_button_add (object, "show-tool-tips",
_("Show Tool _Tips"), _("Show Tool _Tips"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "use-help", prefs_check_button_add (object, "use-help",
_("Context Sensitive _Help with \"F1\""), _("Context Sensitive _Help with \"F1\""),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "show-tips", prefs_check_button_add (object, "show-tips",
_("Show Tips on _Startup"), _("Show Tips on _Startup"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
@ -1315,7 +1316,7 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Help Browser"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Help Browser"), GTK_CONTAINER (vbox), FALSE);
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_enum_option_menu_add (config, "help-browser", 0, 0, prefs_enum_option_menu_add (object, "help-browser", 0, 0,
_("Help _Browser to Use:"), _("Help _Browser to Use:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
@ -1339,7 +1340,7 @@ prefs_dialog_new (Gimp *gimp,
GTK_CONTAINER (vbox), FALSE); GTK_CONTAINER (vbox), FALSE);
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_spin_button_add (config, "default-threshold", 1.0, 5.0, 0, prefs_spin_button_add (object, "default-threshold", 1.0, 5.0, 0,
_("Default _Threshold:"), _("Default _Threshold:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
@ -1347,7 +1348,7 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Scaling"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Scaling"), GTK_CONTAINER (vbox), FALSE);
table = prefs_table_new (1, GTK_CONTAINER (vbox2), TRUE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), TRUE);
prefs_enum_option_menu_add (config, "interpolation-type", 0, 0, prefs_enum_option_menu_add (object, "interpolation-type", 0, 0,
_("Default _Interpolation:"), _("Default _Interpolation:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
@ -1381,7 +1382,7 @@ prefs_dialog_new (Gimp *gimp,
G_CALLBACK (prefs_input_devices_dialog), G_CALLBACK (prefs_input_devices_dialog),
NULL); NULL);
prefs_check_button_add (config, "save-device-status", prefs_check_button_add (object, "save-device-status",
_("Save Input Device Settings on Exit"), _("Save Input Device Settings on Exit"),
GTK_BOX (vbox)); GTK_BOX (vbox));
@ -1417,13 +1418,13 @@ prefs_dialog_new (Gimp *gimp,
/* General */ /* General */
vbox2 = prefs_frame_new (_("General"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("General"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "default-dot-for-dot", prefs_check_button_add (object, "default-dot-for-dot",
_("Use \"_Dot for Dot\" by default"), _("Use \"_Dot for Dot\" by default"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_spin_button_add (config, "marching-ants-speed", 10.0, 100.0, 0, prefs_spin_button_add (object, "marching-ants-speed", 10.0, 100.0, 0,
_("Marching _Ants Speed:"), _("Marching _Ants Speed:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
@ -1431,16 +1432,16 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Zoom & Resize Behavior"), vbox2 = prefs_frame_new (_("Zoom & Resize Behavior"),
GTK_CONTAINER (vbox), FALSE); GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "resize-windows-on-zoom", prefs_check_button_add (object, "resize-windows-on-zoom",
_("Resize Window on _Zoom"), _("Resize Window on _Zoom"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "resize-windows-on-resize", prefs_check_button_add (object, "resize-windows-on-resize",
_("Resize Window on Image _Size Change"), _("Resize Window on Image _Size Change"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_boolean_option_menu_add (config, "initial-zoom-to-fit", prefs_boolean_option_menu_add (object, "initial-zoom-to-fit",
_("Fit to Window"), _("Fit to Window"),
"1:1", "1:1",
_("Inital Zoom Ratio:"), _("Inital Zoom Ratio:"),
@ -1450,19 +1451,19 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Pointer Movement Feedback"), vbox2 = prefs_frame_new (_("Pointer Movement Feedback"),
GTK_CONTAINER (vbox), FALSE); GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "show-brush-outline", prefs_check_button_add (object, "show-brush-outline",
_("Show _Brush Outline"), _("Show _Brush Outline"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "perfect-mouse", prefs_check_button_add (object, "perfect-mouse",
_("Perfect-but-Slow _Pointer Tracking"), _("Perfect-but-Slow _Pointer Tracking"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "cursor-updating", prefs_check_button_add (object, "cursor-updating",
_("Enable Cursor _Updating"), _("Enable Cursor _Updating"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_enum_option_menu_add (config, "cursor-mode", 0, 0, prefs_enum_option_menu_add (object, "cursor-mode", 0, 0,
_("Cursor M_ode:"), _("Cursor M_ode:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
@ -1485,25 +1486,25 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Default Appearance in Normal Mode"), vbox2 = prefs_frame_new (_("Default Appearance in Normal Mode"),
GTK_CONTAINER (vbox), FALSE); GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "show-menubar", prefs_check_button_add (object, "show-menubar",
_("Show Menubar"), _("Show Menubar"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "show-rulers", prefs_check_button_add (object, "show-rulers",
_("Show _Rulers"), _("Show _Rulers"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "show-scrollbars", prefs_check_button_add (object, "show-scrollbars",
_("Show Scrollbars"), _("Show Scrollbars"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "show-statusbar", prefs_check_button_add (object, "show-statusbar",
_("Show S_tatusbar"), _("Show S_tatusbar"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE);
prefs_enum_option_menu_add (config, "canvas-padding-mode", 0, 0, prefs_enum_option_menu_add (object, "canvas-padding-mode", 0, 0,
_("Canvas Padding Mode:"), _("Canvas Padding Mode:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
button = prefs_color_button_add (config, "canvas-padding-color", button = prefs_color_button_add (object, "canvas-padding-color",
_("Custom Padding Color:"), _("Custom Padding Color:"),
_("Select Custom Canvas Padding Color"), _("Select Custom Canvas Padding Color"),
GTK_TABLE (table), 1); GTK_TABLE (table), 1);
@ -1514,25 +1515,25 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Default Appearance in Fullscreen Mode"), vbox2 = prefs_frame_new (_("Default Appearance in Fullscreen Mode"),
GTK_CONTAINER (vbox), FALSE); GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "fullscreen-show-menubar", prefs_check_button_add (object, "fullscreen-show-menubar",
_("Show Menubar"), _("Show Menubar"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "fullscreen-show-rulers", prefs_check_button_add (object, "fullscreen-show-rulers",
_("Show _Rulers"), _("Show _Rulers"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "fullscreen-show-scrollbars", prefs_check_button_add (object, "fullscreen-show-scrollbars",
_("Show Scrollbars"), _("Show Scrollbars"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "fullscreen-show-statusbar", prefs_check_button_add (object, "fullscreen-show-statusbar",
_("Show S_tatusbar"), _("Show S_tatusbar"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE);
prefs_enum_option_menu_add (config, "fullscreen-canvas-padding-mode", 0, 0, prefs_enum_option_menu_add (object, "fullscreen-canvas-padding-mode", 0, 0,
_("Canvas Padding Mode:"), _("Canvas Padding Mode:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
button = prefs_color_button_add (config, "fullscreen-canvas-padding-color", button = prefs_color_button_add (object, "fullscreen-canvas-padding-color",
_("Custom Padding Color:"), _("Custom Padding Color:"),
_("Select Custom Canvas Padding Color"), _("Select Custom Canvas Padding Color"),
GTK_TABLE (table), 1); GTK_TABLE (table), 1);
@ -1611,7 +1612,7 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (gettext (formats[format].title), vbox2 = prefs_frame_new (gettext (formats[format].title),
GTK_CONTAINER (vbox), TRUE); GTK_CONTAINER (vbox), TRUE);
entry = gimp_prop_entry_new (config, formats[format].property_name, 0); entry = gimp_prop_entry_new (object, formats[format].property_name, 0);
gtk_box_pack_start (GTK_BOX (vbox2), entry, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox2), entry, FALSE, FALSE, 0);
gtk_widget_show (entry); gtk_widget_show (entry);
@ -1683,10 +1684,10 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Transparency"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Transparency"), GTK_CONTAINER (vbox), FALSE);
table = prefs_table_new (2, GTK_CONTAINER (vbox2), TRUE); table = prefs_table_new (2, GTK_CONTAINER (vbox2), TRUE);
prefs_enum_option_menu_add (config, "transparency-type", 0, 0, prefs_enum_option_menu_add (object, "transparency-type", 0, 0,
_("Transparency _Type:"), _("Transparency _Type:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
prefs_enum_option_menu_add (config, "transparency-size", 0, 0, prefs_enum_option_menu_add (object, "transparency-size", 0, 0,
_("Check _Size:"), _("Check _Size:"),
GTK_TABLE (table), 1); GTK_TABLE (table), 1);
@ -1698,13 +1699,13 @@ prefs_dialog_new (Gimp *gimp,
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_spin_button_add (config, "min-colors", 1.0, 8.0, 0, prefs_spin_button_add (object, "min-colors", 1.0, 8.0, 0,
_("Minimum Number of Colors:"), _("Minimum Number of Colors:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
prefs_check_button_add (config, "install-colormap", prefs_check_button_add (object, "install-colormap",
_("Install Colormap"), _("Install Colormap"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "colormap-cycling", prefs_check_button_add (object, "colormap-cycling",
_("Colormap Cycling"), _("Colormap Cycling"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
@ -1740,7 +1741,7 @@ prefs_dialog_new (Gimp *gimp,
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
sizeentry = gimp_prop_coordinates_new (config, sizeentry = gimp_prop_coordinates_new (object,
"monitor-xresolution", "monitor-xresolution",
"monitor-yresolution", "monitor-yresolution",
NULL, NULL,
@ -1841,7 +1842,7 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Resource Consumption"), vbox2 = prefs_frame_new (_("Resource Consumption"),
GTK_CONTAINER (vbox), FALSE); GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "stingy-memory-use", prefs_check_button_add (object, "stingy-memory-use",
_("Conservative Memory Usage"), _("Conservative Memory Usage"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
@ -1851,18 +1852,18 @@ prefs_dialog_new (Gimp *gimp,
table = prefs_table_new (3, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (3, GTK_CONTAINER (vbox2), FALSE);
#endif /* ENABLE_MP */ #endif /* ENABLE_MP */
prefs_spin_button_add (config, "undo-levels", 1.0, 5.0, 0, prefs_spin_button_add (object, "undo-levels", 1.0, 5.0, 0,
_("Minimal Number of Undo Levels:"), _("Minimal Number of Undo Levels:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
prefs_memsize_entry_add (config, "undo-size", prefs_memsize_entry_add (object, "undo-size",
_("Maximum Undo Memory:"), _("Maximum Undo Memory:"),
GTK_TABLE (table), 1); GTK_TABLE (table), 1);
prefs_memsize_entry_add (config, "tile-cache-size", prefs_memsize_entry_add (object, "tile-cache-size",
_("Tile Cache Size:"), _("Tile Cache Size:"),
GTK_TABLE (table), 2); GTK_TABLE (table), 2);
#ifdef ENABLE_MP #ifdef ENABLE_MP
prefs_spin_button_add (config, "num-processors", 1.0, 4.0, 0, prefs_spin_button_add (object, "num-processors", 1.0, 4.0, 0,
_("Number of Processors to Use:"), _("Number of Processors to Use:"),
GTK_TABLE (table), 3); GTK_TABLE (table), 3);
#endif /* ENABLE_MP */ #endif /* ENABLE_MP */
@ -1871,12 +1872,12 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("File Saving"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("File Saving"), GTK_CONTAINER (vbox), FALSE);
table = prefs_table_new (2, GTK_CONTAINER (vbox2), TRUE); table = prefs_table_new (2, GTK_CONTAINER (vbox2), TRUE);
prefs_boolean_option_menu_add (config, "trust-dirty-flag", prefs_boolean_option_menu_add (object, "trust-dirty-flag",
_("Only when Modified"), _("Only when Modified"),
_("Always"), _("Always"),
_("\"File -> Save\" Saves the Image:"), _("\"File -> Save\" Saves the Image:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
prefs_enum_option_menu_add (config, "thumbnail-size", 0, 0, prefs_enum_option_menu_add (object, "thumbnail-size", 0, 0,
_("Size of Thumbnail Files:"), _("Size of Thumbnail Files:"),
GTK_TABLE (table), 1); GTK_TABLE (table), 1);
@ -1884,7 +1885,7 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Web Browser"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Web Browser"), GTK_CONTAINER (vbox), FALSE);
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
fileselection = gimp_prop_file_entry_new (config, "web-browser", fileselection = gimp_prop_file_entry_new (object, "web-browser",
_("Select Web Browser"), _("Select Web Browser"),
FALSE, FALSE); FALSE, FALSE);
@ -1942,7 +1943,7 @@ prefs_dialog_new (Gimp *gimp,
for (i = 0; i < G_N_ELEMENTS (dirs); i++) for (i = 0; i < G_N_ELEMENTS (dirs); i++)
{ {
fileselection = gimp_prop_file_entry_new (config, dirs[i].property_name, fileselection = gimp_prop_file_entry_new (object, dirs[i].property_name,
gettext (dirs[i].fs_label), gettext (dirs[i].fs_label),
TRUE, TRUE); TRUE, TRUE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, i, gimp_table_attach_aligned (GTK_TABLE (table), 0, i,
@ -2022,7 +2023,7 @@ prefs_dialog_new (Gimp *gimp,
&child_iter, &child_iter,
page_index++); page_index++);
patheditor = gimp_prop_path_editor_new (config, paths[i].property_name, patheditor = gimp_prop_path_editor_new (object, paths[i].property_name,
gettext (paths[i].fs_label)); gettext (paths[i].fs_label));
gtk_container_add (GTK_CONTAINER (vbox), patheditor); gtk_container_add (GTK_CONTAINER (vbox), patheditor);
gtk_widget_show (patheditor); gtk_widget_show (patheditor);

View File

@ -235,7 +235,8 @@ stroke_dialog_reset_callback (GtkWidget *widget,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gimp_container_menu_select_item (GIMP_CONTAINER_MENU (menu), gimp_container_menu_select_item (GIMP_CONTAINER_MENU (menu),
GIMP_VIEWABLE (tool_info->paint_info)); GIMP_VIEWABLE (tool_info->paint_info));
gimp_config_reset (options);
gimp_config_reset (GIMP_CONFIG (options));
} }
static void static void

View File

@ -56,7 +56,7 @@
static void gimp_navigation_view_class_init (GimpNavigationViewClass *klass); static void gimp_navigation_view_class_init (GimpNavigationViewClass *klass);
static void gimp_navigation_view_init (GimpNavigationView *view); static void gimp_navigation_view_init (GimpNavigationView *view);
static void gimp_navigation_view_docked_iface_init (GimpDockedIface *docked_iface); static void gimp_navigation_view_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_navigation_view_set_docked_context (GimpDocked *docked, static void gimp_navigation_view_set_docked_context (GimpDocked *docked,
GimpContext *context, GimpContext *context,
GimpContext *prev_context); GimpContext *prev_context);
@ -190,7 +190,7 @@ gimp_navigation_view_init (GimpNavigationView *view)
} }
static void static void
gimp_navigation_view_docked_iface_init (GimpDockedIface *docked_iface) gimp_navigation_view_docked_iface_init (GimpDockedInterface *docked_iface)
{ {
docked_iface->set_context = gimp_navigation_view_set_docked_context; docked_iface->set_context = gimp_navigation_view_set_docked_context;
} }

View File

@ -56,7 +56,7 @@
static void gimp_navigation_view_class_init (GimpNavigationViewClass *klass); static void gimp_navigation_view_class_init (GimpNavigationViewClass *klass);
static void gimp_navigation_view_init (GimpNavigationView *view); static void gimp_navigation_view_init (GimpNavigationView *view);
static void gimp_navigation_view_docked_iface_init (GimpDockedIface *docked_iface); static void gimp_navigation_view_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_navigation_view_set_docked_context (GimpDocked *docked, static void gimp_navigation_view_set_docked_context (GimpDocked *docked,
GimpContext *context, GimpContext *context,
GimpContext *prev_context); GimpContext *prev_context);
@ -190,7 +190,7 @@ gimp_navigation_view_init (GimpNavigationView *view)
} }
static void static void
gimp_navigation_view_docked_iface_init (GimpDockedIface *docked_iface) gimp_navigation_view_docked_iface_init (GimpDockedInterface *docked_iface)
{ {
docked_iface->set_context = gimp_navigation_view_set_docked_context; docked_iface->set_context = gimp_navigation_view_set_docked_context;
} }

View File

@ -80,8 +80,8 @@ grid_dialog_new (GimpImage *gimage)
grid = gimp_image_get_grid (GIMP_IMAGE (gimage)); grid = gimp_image_get_grid (GIMP_IMAGE (gimage));
grid_backup = g_object_new (GIMP_TYPE_GRID, NULL); grid_backup = g_object_new (GIMP_TYPE_GRID, NULL);
gimp_config_copy_properties (G_OBJECT (grid), gimp_config_copy_properties (GIMP_CONFIG (grid),
G_OBJECT (grid_backup)); GIMP_CONFIG (grid_backup));
/* dialog */ /* dialog */
dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage), dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
@ -148,8 +148,8 @@ reset_callback (GtkWidget *widget,
grid = g_object_get_data (G_OBJECT (dialog), "grid"); grid = g_object_get_data (G_OBJECT (dialog), "grid");
grid_backup = g_object_get_data (G_OBJECT (dialog), "grid-backup"); grid_backup = g_object_get_data (G_OBJECT (dialog), "grid-backup");
gimp_config_copy_properties (G_OBJECT (grid_backup), gimp_config_copy_properties (GIMP_CONFIG (grid_backup),
G_OBJECT (grid)); GIMP_CONFIG (grid));
gimp_image_grid_changed (GIMP_IMAGE (gimage)); gimp_image_grid_changed (GIMP_IMAGE (gimage));
} }
@ -180,7 +180,8 @@ ok_callback (GtkWidget *widget,
grid = g_object_get_data (G_OBJECT (dialog), "grid"); grid = g_object_get_data (G_OBJECT (dialog), "grid");
grid_backup = g_object_get_data (G_OBJECT (dialog), "grid-backup"); grid_backup = g_object_get_data (G_OBJECT (dialog), "grid-backup");
if (! gimp_config_is_equal_to (G_OBJECT (grid_backup), G_OBJECT (grid))) if (! gimp_config_is_equal_to (GIMP_CONFIG (grid_backup),
GIMP_CONFIG (grid)))
gimp_image_undo_push_image_grid (gimage, _("Grid"), grid_backup); gimp_image_undo_push_image_grid (gimage, _("Grid"), grid_backup);
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);

View File

@ -60,7 +60,7 @@
/* preferences local functions */ /* preferences local functions */
static GtkWidget * prefs_dialog_new (Gimp *gimp, static GtkWidget * prefs_dialog_new (Gimp *gimp,
GObject *config); GimpConfig *config);
static void prefs_config_notify (GObject *config, static void prefs_config_notify (GObject *config,
GParamSpec *param_spec, GParamSpec *param_spec,
GObject *config_copy); GObject *config_copy);
@ -94,9 +94,9 @@ static GtkWidget *prefs_dialog = NULL;
GtkWidget * GtkWidget *
preferences_dialog_create (Gimp *gimp) preferences_dialog_create (Gimp *gimp)
{ {
GObject *config; GimpConfig *config;
GObject *config_copy; GimpConfig *config_copy;
GObject *config_orig; GimpConfig *config_orig;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
@ -106,7 +106,7 @@ preferences_dialog_create (Gimp *gimp)
/* turn of autosaving while the prefs dialog is open */ /* turn of autosaving while the prefs dialog is open */
gimp_rc_set_autosave (GIMP_RC (gimp->edit_config), FALSE); gimp_rc_set_autosave (GIMP_RC (gimp->edit_config), FALSE);
config = G_OBJECT (gimp->edit_config); config = GIMP_CONFIG (gimp->edit_config);
config_copy = gimp_config_duplicate (config); config_copy = gimp_config_duplicate (config);
config_orig = gimp_config_duplicate (config); config_orig = gimp_config_duplicate (config);
@ -216,10 +216,10 @@ static void
prefs_cancel_callback (GtkWidget *widget, prefs_cancel_callback (GtkWidget *widget,
GtkWidget *dialog) GtkWidget *dialog)
{ {
Gimp *gimp; Gimp *gimp;
GObject *config_orig; GimpConfig *config_orig;
GList *diff; GList *diff;
GList *list; GList *list;
gimp = g_object_get_data (G_OBJECT (dialog), "gimp"); gimp = g_object_get_data (G_OBJECT (dialog), "gimp");
config_orig = g_object_get_data (G_OBJECT (dialog), "config-orig"); config_orig = g_object_get_data (G_OBJECT (dialog), "config-orig");
@ -228,7 +228,7 @@ prefs_cancel_callback (GtkWidget *widget,
gtk_widget_destroy (dialog); /* destroys config_copy */ gtk_widget_destroy (dialog); /* destroys config_copy */
diff = gimp_config_diff (G_OBJECT (gimp->edit_config), config_orig, diff = gimp_config_diff (GIMP_CONFIG (gimp->edit_config), config_orig,
GIMP_PARAM_SERIALIZE); GIMP_PARAM_SERIALIZE);
g_object_freeze_notify (G_OBJECT (gimp->edit_config)); g_object_freeze_notify (G_OBJECT (gimp->edit_config));
@ -242,7 +242,7 @@ prefs_cancel_callback (GtkWidget *widget,
g_value_init (&value, param_spec->value_type); g_value_init (&value, param_spec->value_type);
g_object_get_property (config_orig, g_object_get_property (G_OBJECT (config_orig),
param_spec->name, param_spec->name,
&value); &value);
g_object_set_property (G_OBJECT (gimp->edit_config), g_object_set_property (G_OBJECT (gimp->edit_config),
@ -265,11 +265,11 @@ static void
prefs_ok_callback (GtkWidget *widget, prefs_ok_callback (GtkWidget *widget,
GtkWidget *dialog) GtkWidget *dialog)
{ {
Gimp *gimp; Gimp *gimp;
GObject *config_copy; GimpConfig *config_copy;
GList *restart_diff; GList *restart_diff;
GList *confirm_diff; GList *confirm_diff;
GList *list; GList *list;
gimp = g_object_get_data (G_OBJECT (dialog), "gimp"); gimp = g_object_get_data (G_OBJECT (dialog), "gimp");
config_copy = g_object_get_data (G_OBJECT (dialog), "config-copy"); config_copy = g_object_get_data (G_OBJECT (dialog), "config-copy");
@ -278,7 +278,8 @@ prefs_ok_callback (GtkWidget *widget,
gtk_widget_destroy (dialog); /* destroys config_orig */ gtk_widget_destroy (dialog); /* destroys config_orig */
confirm_diff = gimp_config_diff (G_OBJECT (gimp->edit_config), config_copy, confirm_diff = gimp_config_diff (GIMP_CONFIG (gimp->edit_config),
config_copy,
GIMP_PARAM_CONFIRM); GIMP_PARAM_CONFIRM);
g_object_freeze_notify (G_OBJECT (gimp->edit_config)); g_object_freeze_notify (G_OBJECT (gimp->edit_config));
@ -292,12 +293,10 @@ prefs_ok_callback (GtkWidget *widget,
g_value_init (&value, param_spec->value_type); g_value_init (&value, param_spec->value_type);
g_object_get_property (config_copy, g_object_get_property (G_OBJECT (config_copy),
param_spec->name, param_spec->name, &value);
&value);
g_object_set_property (G_OBJECT (gimp->edit_config), g_object_set_property (G_OBJECT (gimp->edit_config),
param_spec->name, param_spec->name, &value);
&value);
g_value_unset (&value); g_value_unset (&value);
} }
@ -315,8 +314,8 @@ prefs_ok_callback (GtkWidget *widget,
/* spit out a solely informational warning about changed values /* spit out a solely informational warning about changed values
* which need restart * which need restart
*/ */
restart_diff = gimp_config_diff (G_OBJECT (gimp->edit_config), restart_diff = gimp_config_diff (GIMP_CONFIG (gimp->edit_config),
G_OBJECT (gimp->config), GIMP_CONFIG (gimp->config),
GIMP_PARAM_RESTART); GIMP_PARAM_RESTART);
if (restart_diff) if (restart_diff)
@ -839,8 +838,8 @@ prefs_help_func (const gchar *help_id,
} }
static GtkWidget * static GtkWidget *
prefs_dialog_new (Gimp *gimp, prefs_dialog_new (Gimp *gimp,
GObject *config) GimpConfig *config)
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *tv; GtkWidget *tv;
@ -881,12 +880,14 @@ prefs_dialog_new (Gimp *gimp,
gint i; gint i;
gchar *pixels_per_unit; gchar *pixels_per_unit;
GObject *object;
GimpCoreConfig *core_config; GimpCoreConfig *core_config;
GimpDisplayConfig *display_config; GimpDisplayConfig *display_config;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (G_IS_OBJECT (config), NULL); g_return_val_if_fail (GIMP_IS_CONFIG (config), NULL);
object = G_OBJECT (config);
core_config = GIMP_CORE_CONFIG (config); core_config = GIMP_CORE_CONFIG (config);
display_config = GIMP_DISPLAY_CONFIG (config); display_config = GIMP_DISPLAY_CONFIG (config);
@ -1030,7 +1031,7 @@ prefs_dialog_new (Gimp *gimp,
gtk_container_add (GTK_CONTAINER (vbox2), hbox); gtk_container_add (GTK_CONTAINER (vbox2), hbox);
gtk_widget_show (hbox); gtk_widget_show (hbox);
sizeentry = gimp_prop_coordinates_new (config, sizeentry = gimp_prop_coordinates_new (object,
"default-image-width", "default-image-width",
"default-image-height", "default-image-height",
"default-unit", "default-unit",
@ -1062,7 +1063,7 @@ prefs_dialog_new (Gimp *gimp,
pixels_per_unit = g_strconcat (_("Pixels"), "/%s", NULL); pixels_per_unit = g_strconcat (_("Pixels"), "/%s", NULL);
sizeentry2 = gimp_prop_coordinates_new (config, sizeentry2 = gimp_prop_coordinates_new (object,
"default-xresolution", "default-xresolution",
"default-yresolution", "default-yresolution",
"default-resolution_unit", "default-resolution_unit",
@ -1093,11 +1094,11 @@ prefs_dialog_new (Gimp *gimp,
table = prefs_table_new (2, GTK_CONTAINER (vbox), TRUE); table = prefs_table_new (2, GTK_CONTAINER (vbox), TRUE);
prefs_enum_option_menu_add (config, "default-image-type", prefs_enum_option_menu_add (object, "default-image-type",
GIMP_RGB, GIMP_GRAY, GIMP_RGB, GIMP_GRAY,
_("Default Image _Type:"), _("Default Image _Type:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
prefs_memsize_entry_add (config, "max-new-image-size", prefs_memsize_entry_add (object, "max-new-image-size",
_("Maximum Image Size:"), _("Maximum Image Size:"),
GTK_TABLE (table), 1); GTK_TABLE (table), 1);
@ -1130,7 +1131,7 @@ prefs_dialog_new (Gimp *gimp,
gtk_container_add (GTK_CONTAINER (vbox2), scrolled_window); gtk_container_add (GTK_CONTAINER (vbox2), scrolled_window);
gtk_widget_show (scrolled_window); gtk_widget_show (scrolled_window);
text_buffer = gimp_prop_text_buffer_new (config, "default-comment", text_buffer = gimp_prop_text_buffer_new (object, "default-comment",
MAX_COMMENT_LENGTH); MAX_COMMENT_LENGTH);
text_view = gtk_text_view_new_with_buffer (text_buffer); text_view = gtk_text_view_new_with_buffer (text_buffer);
@ -1181,49 +1182,49 @@ prefs_dialog_new (Gimp *gimp,
/* Previews */ /* Previews */
vbox2 = prefs_frame_new (_("Previews"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Previews"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "layer-previews", prefs_check_button_add (object, "layer-previews",
_("_Enable Layer & Channel Previews"), _("_Enable Layer & Channel Previews"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE);
prefs_enum_option_menu_add (config, "layer-preview-size", 0, 0, prefs_enum_option_menu_add (object, "layer-preview-size", 0, 0,
_("_Layer & Channel Preview Size:"), _("_Layer & Channel Preview Size:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
prefs_enum_option_menu_add (config, "navigation-preview-size", 0, 0, prefs_enum_option_menu_add (object, "navigation-preview-size", 0, 0,
_("_Navigation Preview Size:"), _("_Navigation Preview Size:"),
GTK_TABLE (table), 1); GTK_TABLE (table), 1);
/* Dialog Bahavior */ /* Dialog Bahavior */
vbox2 = prefs_frame_new (_("Dialog Behavior"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Dialog Behavior"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "info-window-per-display", prefs_check_button_add (object, "info-window-per-display",
_("_Info Window Per Display"), _("_Info Window Per Display"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
/* Menus */ /* Menus */
vbox2 = prefs_frame_new (_("Menus"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Menus"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "tearoff-menus", prefs_check_button_add (object, "tearoff-menus",
_("Enable _Tearoff Menus"), _("Enable _Tearoff Menus"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_spin_button_add (config, "last-opened-size", 1.0, 5.0, 0, prefs_spin_button_add (object, "last-opened-size", 1.0, 5.0, 0,
_("Open _Recent Menu Size:"), _("Open _Recent Menu Size:"),
GTK_TABLE (table), 3); GTK_TABLE (table), 3);
/* Keyboard Shortcuts */ /* Keyboard Shortcuts */
vbox2 = prefs_frame_new (_("Keyboard Shortcuts"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Keyboard Shortcuts"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "can-change-accels", prefs_check_button_add (object, "can-change-accels",
_("Dynamic _Keyboard Shortcuts"), _("Dynamic _Keyboard Shortcuts"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "save-accels", prefs_check_button_add (object, "save-accels",
_("Save Keyboard Shortcuts on Exit"), _("Save Keyboard Shortcuts on Exit"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "restore-accels", prefs_check_button_add (object, "restore-accels",
_("Restore Saved Keyboard Shortcuts on Start-up"), _("Restore Saved Keyboard Shortcuts on Start-up"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
@ -1253,10 +1254,10 @@ prefs_dialog_new (Gimp *gimp,
/* Window Positions */ /* Window Positions */
vbox2 = prefs_frame_new (_("Window Positions"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Window Positions"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "save-session-info", prefs_check_button_add (object, "save-session-info",
_("_Save Window Positions on Exit"), _("_Save Window Positions on Exit"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "restore-session", prefs_check_button_add (object, "restore-session",
_("R_estore Saved Window Positions on Start-up"), _("R_estore Saved Window Positions on Start-up"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
@ -1301,13 +1302,13 @@ prefs_dialog_new (Gimp *gimp,
/* General */ /* General */
vbox2 = prefs_frame_new (_("General"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("General"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "show-tool-tips", prefs_check_button_add (object, "show-tool-tips",
_("Show Tool _Tips"), _("Show Tool _Tips"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "use-help", prefs_check_button_add (object, "use-help",
_("Context Sensitive _Help with \"F1\""), _("Context Sensitive _Help with \"F1\""),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "show-tips", prefs_check_button_add (object, "show-tips",
_("Show Tips on _Startup"), _("Show Tips on _Startup"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
@ -1315,7 +1316,7 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Help Browser"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Help Browser"), GTK_CONTAINER (vbox), FALSE);
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_enum_option_menu_add (config, "help-browser", 0, 0, prefs_enum_option_menu_add (object, "help-browser", 0, 0,
_("Help _Browser to Use:"), _("Help _Browser to Use:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
@ -1339,7 +1340,7 @@ prefs_dialog_new (Gimp *gimp,
GTK_CONTAINER (vbox), FALSE); GTK_CONTAINER (vbox), FALSE);
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_spin_button_add (config, "default-threshold", 1.0, 5.0, 0, prefs_spin_button_add (object, "default-threshold", 1.0, 5.0, 0,
_("Default _Threshold:"), _("Default _Threshold:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
@ -1347,7 +1348,7 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Scaling"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Scaling"), GTK_CONTAINER (vbox), FALSE);
table = prefs_table_new (1, GTK_CONTAINER (vbox2), TRUE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), TRUE);
prefs_enum_option_menu_add (config, "interpolation-type", 0, 0, prefs_enum_option_menu_add (object, "interpolation-type", 0, 0,
_("Default _Interpolation:"), _("Default _Interpolation:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
@ -1381,7 +1382,7 @@ prefs_dialog_new (Gimp *gimp,
G_CALLBACK (prefs_input_devices_dialog), G_CALLBACK (prefs_input_devices_dialog),
NULL); NULL);
prefs_check_button_add (config, "save-device-status", prefs_check_button_add (object, "save-device-status",
_("Save Input Device Settings on Exit"), _("Save Input Device Settings on Exit"),
GTK_BOX (vbox)); GTK_BOX (vbox));
@ -1417,13 +1418,13 @@ prefs_dialog_new (Gimp *gimp,
/* General */ /* General */
vbox2 = prefs_frame_new (_("General"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("General"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "default-dot-for-dot", prefs_check_button_add (object, "default-dot-for-dot",
_("Use \"_Dot for Dot\" by default"), _("Use \"_Dot for Dot\" by default"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_spin_button_add (config, "marching-ants-speed", 10.0, 100.0, 0, prefs_spin_button_add (object, "marching-ants-speed", 10.0, 100.0, 0,
_("Marching _Ants Speed:"), _("Marching _Ants Speed:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
@ -1431,16 +1432,16 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Zoom & Resize Behavior"), vbox2 = prefs_frame_new (_("Zoom & Resize Behavior"),
GTK_CONTAINER (vbox), FALSE); GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "resize-windows-on-zoom", prefs_check_button_add (object, "resize-windows-on-zoom",
_("Resize Window on _Zoom"), _("Resize Window on _Zoom"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "resize-windows-on-resize", prefs_check_button_add (object, "resize-windows-on-resize",
_("Resize Window on Image _Size Change"), _("Resize Window on Image _Size Change"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_boolean_option_menu_add (config, "initial-zoom-to-fit", prefs_boolean_option_menu_add (object, "initial-zoom-to-fit",
_("Fit to Window"), _("Fit to Window"),
"1:1", "1:1",
_("Inital Zoom Ratio:"), _("Inital Zoom Ratio:"),
@ -1450,19 +1451,19 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Pointer Movement Feedback"), vbox2 = prefs_frame_new (_("Pointer Movement Feedback"),
GTK_CONTAINER (vbox), FALSE); GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "show-brush-outline", prefs_check_button_add (object, "show-brush-outline",
_("Show _Brush Outline"), _("Show _Brush Outline"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "perfect-mouse", prefs_check_button_add (object, "perfect-mouse",
_("Perfect-but-Slow _Pointer Tracking"), _("Perfect-but-Slow _Pointer Tracking"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "cursor-updating", prefs_check_button_add (object, "cursor-updating",
_("Enable Cursor _Updating"), _("Enable Cursor _Updating"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_enum_option_menu_add (config, "cursor-mode", 0, 0, prefs_enum_option_menu_add (object, "cursor-mode", 0, 0,
_("Cursor M_ode:"), _("Cursor M_ode:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
@ -1485,25 +1486,25 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Default Appearance in Normal Mode"), vbox2 = prefs_frame_new (_("Default Appearance in Normal Mode"),
GTK_CONTAINER (vbox), FALSE); GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "show-menubar", prefs_check_button_add (object, "show-menubar",
_("Show Menubar"), _("Show Menubar"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "show-rulers", prefs_check_button_add (object, "show-rulers",
_("Show _Rulers"), _("Show _Rulers"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "show-scrollbars", prefs_check_button_add (object, "show-scrollbars",
_("Show Scrollbars"), _("Show Scrollbars"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "show-statusbar", prefs_check_button_add (object, "show-statusbar",
_("Show S_tatusbar"), _("Show S_tatusbar"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE);
prefs_enum_option_menu_add (config, "canvas-padding-mode", 0, 0, prefs_enum_option_menu_add (object, "canvas-padding-mode", 0, 0,
_("Canvas Padding Mode:"), _("Canvas Padding Mode:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
button = prefs_color_button_add (config, "canvas-padding-color", button = prefs_color_button_add (object, "canvas-padding-color",
_("Custom Padding Color:"), _("Custom Padding Color:"),
_("Select Custom Canvas Padding Color"), _("Select Custom Canvas Padding Color"),
GTK_TABLE (table), 1); GTK_TABLE (table), 1);
@ -1514,25 +1515,25 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Default Appearance in Fullscreen Mode"), vbox2 = prefs_frame_new (_("Default Appearance in Fullscreen Mode"),
GTK_CONTAINER (vbox), FALSE); GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "fullscreen-show-menubar", prefs_check_button_add (object, "fullscreen-show-menubar",
_("Show Menubar"), _("Show Menubar"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "fullscreen-show-rulers", prefs_check_button_add (object, "fullscreen-show-rulers",
_("Show _Rulers"), _("Show _Rulers"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "fullscreen-show-scrollbars", prefs_check_button_add (object, "fullscreen-show-scrollbars",
_("Show Scrollbars"), _("Show Scrollbars"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "fullscreen-show-statusbar", prefs_check_button_add (object, "fullscreen-show-statusbar",
_("Show S_tatusbar"), _("Show S_tatusbar"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE);
prefs_enum_option_menu_add (config, "fullscreen-canvas-padding-mode", 0, 0, prefs_enum_option_menu_add (object, "fullscreen-canvas-padding-mode", 0, 0,
_("Canvas Padding Mode:"), _("Canvas Padding Mode:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
button = prefs_color_button_add (config, "fullscreen-canvas-padding-color", button = prefs_color_button_add (object, "fullscreen-canvas-padding-color",
_("Custom Padding Color:"), _("Custom Padding Color:"),
_("Select Custom Canvas Padding Color"), _("Select Custom Canvas Padding Color"),
GTK_TABLE (table), 1); GTK_TABLE (table), 1);
@ -1611,7 +1612,7 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (gettext (formats[format].title), vbox2 = prefs_frame_new (gettext (formats[format].title),
GTK_CONTAINER (vbox), TRUE); GTK_CONTAINER (vbox), TRUE);
entry = gimp_prop_entry_new (config, formats[format].property_name, 0); entry = gimp_prop_entry_new (object, formats[format].property_name, 0);
gtk_box_pack_start (GTK_BOX (vbox2), entry, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox2), entry, FALSE, FALSE, 0);
gtk_widget_show (entry); gtk_widget_show (entry);
@ -1683,10 +1684,10 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Transparency"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Transparency"), GTK_CONTAINER (vbox), FALSE);
table = prefs_table_new (2, GTK_CONTAINER (vbox2), TRUE); table = prefs_table_new (2, GTK_CONTAINER (vbox2), TRUE);
prefs_enum_option_menu_add (config, "transparency-type", 0, 0, prefs_enum_option_menu_add (object, "transparency-type", 0, 0,
_("Transparency _Type:"), _("Transparency _Type:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
prefs_enum_option_menu_add (config, "transparency-size", 0, 0, prefs_enum_option_menu_add (object, "transparency-size", 0, 0,
_("Check _Size:"), _("Check _Size:"),
GTK_TABLE (table), 1); GTK_TABLE (table), 1);
@ -1698,13 +1699,13 @@ prefs_dialog_new (Gimp *gimp,
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
prefs_spin_button_add (config, "min-colors", 1.0, 8.0, 0, prefs_spin_button_add (object, "min-colors", 1.0, 8.0, 0,
_("Minimum Number of Colors:"), _("Minimum Number of Colors:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
prefs_check_button_add (config, "install-colormap", prefs_check_button_add (object, "install-colormap",
_("Install Colormap"), _("Install Colormap"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (config, "colormap-cycling", prefs_check_button_add (object, "colormap-cycling",
_("Colormap Cycling"), _("Colormap Cycling"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
@ -1740,7 +1741,7 @@ prefs_dialog_new (Gimp *gimp,
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
sizeentry = gimp_prop_coordinates_new (config, sizeentry = gimp_prop_coordinates_new (object,
"monitor-xresolution", "monitor-xresolution",
"monitor-yresolution", "monitor-yresolution",
NULL, NULL,
@ -1841,7 +1842,7 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Resource Consumption"), vbox2 = prefs_frame_new (_("Resource Consumption"),
GTK_CONTAINER (vbox), FALSE); GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (config, "stingy-memory-use", prefs_check_button_add (object, "stingy-memory-use",
_("Conservative Memory Usage"), _("Conservative Memory Usage"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
@ -1851,18 +1852,18 @@ prefs_dialog_new (Gimp *gimp,
table = prefs_table_new (3, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (3, GTK_CONTAINER (vbox2), FALSE);
#endif /* ENABLE_MP */ #endif /* ENABLE_MP */
prefs_spin_button_add (config, "undo-levels", 1.0, 5.0, 0, prefs_spin_button_add (object, "undo-levels", 1.0, 5.0, 0,
_("Minimal Number of Undo Levels:"), _("Minimal Number of Undo Levels:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
prefs_memsize_entry_add (config, "undo-size", prefs_memsize_entry_add (object, "undo-size",
_("Maximum Undo Memory:"), _("Maximum Undo Memory:"),
GTK_TABLE (table), 1); GTK_TABLE (table), 1);
prefs_memsize_entry_add (config, "tile-cache-size", prefs_memsize_entry_add (object, "tile-cache-size",
_("Tile Cache Size:"), _("Tile Cache Size:"),
GTK_TABLE (table), 2); GTK_TABLE (table), 2);
#ifdef ENABLE_MP #ifdef ENABLE_MP
prefs_spin_button_add (config, "num-processors", 1.0, 4.0, 0, prefs_spin_button_add (object, "num-processors", 1.0, 4.0, 0,
_("Number of Processors to Use:"), _("Number of Processors to Use:"),
GTK_TABLE (table), 3); GTK_TABLE (table), 3);
#endif /* ENABLE_MP */ #endif /* ENABLE_MP */
@ -1871,12 +1872,12 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("File Saving"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("File Saving"), GTK_CONTAINER (vbox), FALSE);
table = prefs_table_new (2, GTK_CONTAINER (vbox2), TRUE); table = prefs_table_new (2, GTK_CONTAINER (vbox2), TRUE);
prefs_boolean_option_menu_add (config, "trust-dirty-flag", prefs_boolean_option_menu_add (object, "trust-dirty-flag",
_("Only when Modified"), _("Only when Modified"),
_("Always"), _("Always"),
_("\"File -> Save\" Saves the Image:"), _("\"File -> Save\" Saves the Image:"),
GTK_TABLE (table), 0); GTK_TABLE (table), 0);
prefs_enum_option_menu_add (config, "thumbnail-size", 0, 0, prefs_enum_option_menu_add (object, "thumbnail-size", 0, 0,
_("Size of Thumbnail Files:"), _("Size of Thumbnail Files:"),
GTK_TABLE (table), 1); GTK_TABLE (table), 1);
@ -1884,7 +1885,7 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Web Browser"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("Web Browser"), GTK_CONTAINER (vbox), FALSE);
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE); table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
fileselection = gimp_prop_file_entry_new (config, "web-browser", fileselection = gimp_prop_file_entry_new (object, "web-browser",
_("Select Web Browser"), _("Select Web Browser"),
FALSE, FALSE); FALSE, FALSE);
@ -1942,7 +1943,7 @@ prefs_dialog_new (Gimp *gimp,
for (i = 0; i < G_N_ELEMENTS (dirs); i++) for (i = 0; i < G_N_ELEMENTS (dirs); i++)
{ {
fileselection = gimp_prop_file_entry_new (config, dirs[i].property_name, fileselection = gimp_prop_file_entry_new (object, dirs[i].property_name,
gettext (dirs[i].fs_label), gettext (dirs[i].fs_label),
TRUE, TRUE); TRUE, TRUE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, i, gimp_table_attach_aligned (GTK_TABLE (table), 0, i,
@ -2022,7 +2023,7 @@ prefs_dialog_new (Gimp *gimp,
&child_iter, &child_iter,
page_index++); page_index++);
patheditor = gimp_prop_path_editor_new (config, paths[i].property_name, patheditor = gimp_prop_path_editor_new (object, paths[i].property_name,
gettext (paths[i].fs_label)); gettext (paths[i].fs_label));
gtk_container_add (GTK_CONTAINER (vbox), patheditor); gtk_container_add (GTK_CONTAINER (vbox), patheditor);
gtk_widget_show (patheditor); gtk_widget_show (patheditor);

View File

@ -235,7 +235,8 @@ stroke_dialog_reset_callback (GtkWidget *widget,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gimp_container_menu_select_item (GIMP_CONTAINER_MENU (menu), gimp_container_menu_select_item (GIMP_CONTAINER_MENU (menu),
GIMP_VIEWABLE (tool_info->paint_info)); GIMP_VIEWABLE (tool_info->paint_info));
gimp_config_reset (options);
gimp_config_reset (GIMP_CONFIG (options));
} }
static void static void

View File

@ -24,6 +24,7 @@
#include "gui-types.h" #include "gui-types.h"
#include "config/gimpconfig.h"
#include "config/gimpconfig-utils.h" #include "config/gimpconfig-utils.h"
#include "core/gimp.h" #include "core/gimp.h"
@ -103,8 +104,8 @@ templates_new_template_ok_callback (GtkWidget *widget,
template = g_object_get_data (G_OBJECT (dialog), "gimp-template"); template = g_object_get_data (G_OBJECT (dialog), "gimp-template");
gimp = g_object_get_data (G_OBJECT (dialog), "gimp"); gimp = g_object_get_data (G_OBJECT (dialog), "gimp");
gimp_config_copy_properties (G_OBJECT (editor->template), gimp_config_copy_properties (GIMP_CONFIG (editor->template),
G_OBJECT (template)); GIMP_CONFIG (template));
gimp_list_uniquefy_name (GIMP_LIST (gimp->templates), gimp_list_uniquefy_name (GIMP_LIST (gimp->templates),
GIMP_OBJECT (template), TRUE); GIMP_OBJECT (template), TRUE);
@ -181,8 +182,8 @@ templates_edit_template_ok_callback (GtkWidget *widget,
template = g_object_get_data (G_OBJECT (dialog), "gimp-template"); template = g_object_get_data (G_OBJECT (dialog), "gimp-template");
gimp = g_object_get_data (G_OBJECT (dialog), "gimp"); gimp = g_object_get_data (G_OBJECT (dialog), "gimp");
gimp_config_copy_properties (G_OBJECT (editor->template), gimp_config_copy_properties (GIMP_CONFIG (editor->template),
G_OBJECT (template)); GIMP_CONFIG (template));
gimp_list_uniquefy_name (GIMP_LIST (gimp->templates), gimp_list_uniquefy_name (GIMP_LIST (gimp->templates),
GIMP_OBJECT (template), TRUE); GIMP_OBJECT (template), TRUE);

View File

@ -66,8 +66,8 @@ tool_options_save_to_cmd_callback (GtkWidget *widget,
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (options))); name = g_strdup (gimp_object_get_name (GIMP_OBJECT (options)));
gimp_config_copy_properties (G_OBJECT (options->tool_info->tool_options), gimp_config_copy_properties (GIMP_CONFIG (options->tool_info->tool_options),
G_OBJECT (options)); GIMP_CONFIG (options));
gimp_object_set_name (GIMP_OBJECT (options), name); gimp_object_set_name (GIMP_OBJECT (options), name);
g_free (name); g_free (name);
@ -105,8 +105,8 @@ tool_options_restore_from_cmd_callback (GtkWidget *widget,
{ {
GimpToolOptions *options = GIMP_TOOL_OPTIONS (data); GimpToolOptions *options = GIMP_TOOL_OPTIONS (data);
gimp_config_copy_properties (G_OBJECT (options), gimp_config_copy_properties (GIMP_CONFIG (options),
G_OBJECT (options->tool_info->tool_options)); GIMP_CONFIG (options->tool_info->tool_options));
} }
void void
@ -170,12 +170,12 @@ tool_options_save_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
GimpToolInfo *tool_info = GIMP_TOOL_INFO (data); GimpToolInfo *tool_info = GIMP_TOOL_INFO (data);
GObject *copy; GimpConfig *copy;
if (! name || ! strlen (name)) if (! name || ! strlen (name))
name = _("Saved Options"); name = _("Saved Options");
copy = gimp_config_duplicate (G_OBJECT (tool_info->tool_options)); copy = gimp_config_duplicate (GIMP_CONFIG (tool_info->tool_options));
gimp_object_set_name (GIMP_OBJECT (copy), name); gimp_object_set_name (GIMP_OBJECT (copy), name);
gimp_list_uniquefy_name (GIMP_LIST (tool_info->options_presets), gimp_list_uniquefy_name (GIMP_LIST (tool_info->options_presets),

View File

@ -1224,10 +1224,19 @@ gimp_paint_core_subsample_mask (GimpPaintCore *core,
if (mask == core->last_brush_mask && ! core->cache_invalid) if (mask == core->last_brush_mask && ! core->cache_invalid)
{ {
if (core->kernel_brushes[index2][index1]) if (core->kernel_brushes[index2][index1])
return core->kernel_brushes[index2][index1]; {
g_printerr (".");
return core->kernel_brushes[index2][index1];
}
else
{
g_printerr ("o");
}
} }
else else
{ {
g_printerr ("*");
for (i = 0; i < KERNEL_SUBSAMPLE + 1; i++) for (i = 0; i < KERNEL_SUBSAMPLE + 1; i++)
for (j = 0; j < KERNEL_SUBSAMPLE + 1; j++) for (j = 0; j < KERNEL_SUBSAMPLE + 1; j++)
if (core->kernel_brushes[i][j]) if (core->kernel_brushes[i][j])

View File

@ -132,7 +132,8 @@ gimprc_set_invoker (Gimp *gimp,
/* set the value in edit_config so we don't accidentially set /* set the value in edit_config so we don't accidentially set
* GIMP_PARAM_RESTART values via the PDB * GIMP_PARAM_RESTART values via the PDB
*/ */
gimp_config_add_unknown_token (G_OBJECT (gimp->edit_config), token, value); gimp_config_add_unknown_token (GIMP_CONFIG (gimp->edit_config),
token, value);
success = TRUE; success = TRUE;
} }

View File

@ -58,7 +58,7 @@ gimp_text_to_parasite (const GimpText *text)
g_return_val_if_fail (GIMP_IS_TEXT (text), NULL); g_return_val_if_fail (GIMP_IS_TEXT (text), NULL);
str = gimp_config_serialize_to_string (G_OBJECT (text), NULL); str = gimp_config_serialize_to_string (GIMP_CONFIG (text), NULL);
g_return_val_if_fail (str != NULL, NULL); g_return_val_if_fail (str != NULL, NULL);
parasite = gimp_parasite_new (gimp_text_parasite_name (), parasite = gimp_parasite_new (gimp_text_parasite_name (),
@ -82,10 +82,10 @@ gimp_text_from_parasite (const GimpParasite *parasite)
str = gimp_parasite_data (parasite); str = gimp_parasite_data (parasite);
g_return_val_if_fail (str != NULL, NULL); g_return_val_if_fail (str != NULL, NULL);
text = g_object_new (GIMP_TYPE_TEXT, NULL); text = g_object_new (GIMP_TYPE_TEXT, NULL);
if (! gimp_config_deserialize_string (G_OBJECT (text), if (! gimp_config_deserialize_string (GIMP_CONFIG (text),
str, str,
gimp_parasite_data_size (parasite), gimp_parasite_data_size (parasite),
NULL, NULL,
@ -120,7 +120,7 @@ enum
COLOR = 5, COLOR = 5,
LAYER_ALIGNMENT = 6, LAYER_ALIGNMENT = 6,
XLFD = 7, XLFD = 7,
NUM_PARAMS NUM_PARAMS
}; };
GimpText * GimpText *

View File

@ -103,18 +103,17 @@ gimp_text_get_type (void)
0, /* n_preallocs */ 0, /* n_preallocs */
NULL /* instance_init */ NULL /* instance_init */
}; };
static const GInterfaceInfo text_iface_info = static const GInterfaceInfo text_iface_info =
{ {
NULL, /* iface_init */ NULL, /* iface_init */
NULL, /* iface_finalize */ NULL, /* iface_finalize */
NULL /* iface_data */ NULL /* iface_data */
}; };
text_type = g_type_register_static (GIMP_TYPE_OBJECT, text_type = g_type_register_static (GIMP_TYPE_OBJECT,
"GimpText", &text_info, 0); "GimpText", &text_info, 0);
g_type_add_interface_static (text_type, g_type_add_interface_static (text_type, GIMP_TYPE_CONFIG,
GIMP_TYPE_CONFIG_INTERFACE,
&text_iface_info); &text_iface_info);
} }
@ -441,7 +440,7 @@ gimp_text_get_memsize (GimpObject *object,
} }
/* /*
* basically copied from gtk_get_default_language() * basically copied from gtk_get_default_language()
*/ */
static gchar * static gchar *
@ -449,7 +448,7 @@ gimp_text_get_default_language (void)
{ {
gchar *lang; gchar *lang;
gchar *p; gchar *p;
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
p = getenv ("LC_ALL"); p = getenv ("LC_ALL");
if (p != NULL) if (p != NULL)

View File

@ -215,7 +215,7 @@ gimp_text_layer_duplicate (GimpItem *item,
new_text_layer = GIMP_TEXT_LAYER (new_item); new_text_layer = GIMP_TEXT_LAYER (new_item);
new_text_layer->text = new_text_layer->text =
GIMP_TEXT (gimp_config_duplicate (G_OBJECT (text_layer->text))); GIMP_TEXT (gimp_config_duplicate (GIMP_CONFIG (text_layer->text)));
g_signal_connect_object (new_text_layer->text, "notify", g_signal_connect_object (new_text_layer->text, "notify",
G_CALLBACK (gimp_text_layer_notify_text), G_CALLBACK (gimp_text_layer_notify_text),

View File

@ -228,7 +228,7 @@ gimp_tools_restore (Gimp *gimp)
filename = gimp_tool_options_build_filename (tool_info->tool_options, filename = gimp_tool_options_build_filename (tool_info->tool_options,
"presets"); "presets");
gimp_config_deserialize_file (G_OBJECT (tool_info->options_presets), gimp_config_deserialize_file (GIMP_CONFIG (tool_info->options_presets),
filename, filename,
gimp, NULL); gimp, NULL);
g_free (filename); g_free (filename);
@ -274,7 +274,7 @@ gimp_tools_save (Gimp *gimp)
footer = g_strdup_printf ("end of %s options presets", footer = g_strdup_printf ("end of %s options presets",
GIMP_OBJECT (tool_info)->name); GIMP_OBJECT (tool_info)->name);
gimp_config_serialize_to_file (G_OBJECT (tool_info->options_presets), gimp_config_serialize_to_file (GIMP_CONFIG (tool_info->options_presets),
filename, header, footer, filename, header, footer,
NULL, NULL); NULL, NULL);

View File

@ -316,7 +316,7 @@ gimp_text_tool_create_layer (GimpTextTool *text_tool)
gimage = text_tool->gdisp->gimage; gimage = text_tool->gdisp->gimage;
text = GIMP_TEXT (gimp_config_duplicate (G_OBJECT (options->text))); text = GIMP_TEXT (gimp_config_duplicate (GIMP_CONFIG (options->text)));
layer = gimp_text_layer_new (gimage, text); layer = gimp_text_layer_new (gimage, text);
@ -381,8 +381,8 @@ gimp_text_tool_connect (GimpTextTool *tool,
{ {
tool->text = g_object_ref (text); tool->text = g_object_ref (text);
gimp_config_copy_properties (G_OBJECT (tool->text), gimp_config_copy_properties (GIMP_CONFIG (tool->text),
G_OBJECT (options->text)); GIMP_CONFIG (options->text));
gimp_config_connect (G_OBJECT (options->text), G_OBJECT (tool->text)); gimp_config_connect (G_OBJECT (options->text), G_OBJECT (tool->text));

View File

@ -39,7 +39,7 @@
static void gimp_color_editor_class_init (GimpColorEditorClass *klass); static void gimp_color_editor_class_init (GimpColorEditorClass *klass);
static void gimp_color_editor_init (GimpColorEditor *editor); static void gimp_color_editor_init (GimpColorEditor *editor);
static void gimp_color_editor_docked_iface_init (GimpDockedIface *docked_iface); static void gimp_color_editor_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_color_editor_destroy (GtkObject *object); static void gimp_color_editor_destroy (GtkObject *object);
@ -286,7 +286,7 @@ gimp_color_editor_init (GimpColorEditor *editor)
} }
static void static void
gimp_color_editor_docked_iface_init (GimpDockedIface *docked_iface) gimp_color_editor_docked_iface_init (GimpDockedInterface *docked_iface)
{ {
docked_iface->set_context = gimp_color_editor_set_docked_context; docked_iface->set_context = gimp_color_editor_set_docked_context;
} }

View File

@ -42,7 +42,7 @@
static void gimp_container_editor_class_init (GimpContainerEditorClass *klass); static void gimp_container_editor_class_init (GimpContainerEditorClass *klass);
static void gimp_container_editor_init (GimpContainerEditor *view); static void gimp_container_editor_init (GimpContainerEditor *view);
static void gimp_container_editor_docked_iface_init (GimpDockedIface *docked_iface); static void gimp_container_editor_docked_iface_init (GimpDockedInterface *docked_iface);
static gboolean gimp_container_editor_select_item (GtkWidget *widget, static gboolean gimp_container_editor_select_item (GtkWidget *widget,
GimpViewable *viewable, GimpViewable *viewable,
@ -126,7 +126,7 @@ gimp_container_editor_init (GimpContainerEditor *view)
} }
static void static void
gimp_container_editor_docked_iface_init (GimpDockedIface *docked_iface) gimp_container_editor_docked_iface_init (GimpDockedInterface *docked_iface)
{ {
docked_iface->get_preview = gimp_container_editor_get_preview; docked_iface->get_preview = gimp_container_editor_get_preview;
docked_iface->set_context = gimp_container_editor_set_context; docked_iface->set_context = gimp_container_editor_set_context;

View File

@ -54,9 +54,9 @@ enum
static void gimp_container_view_class_init (GimpContainerViewClass *klass); static void gimp_container_view_class_init (GimpContainerViewClass *klass);
static void gimp_container_view_init (GimpContainerView *view, static void gimp_container_view_init (GimpContainerView *view,
GimpContainerViewClass *klass); GimpContainerViewClass *klass);
static void gimp_container_view_docked_iface_init (GimpDockedIface *docked_iface); static void gimp_container_view_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_container_view_destroy (GtkObject *object); static void gimp_container_view_destroy (GtkObject *object);
static void gimp_container_view_real_set_container (GimpContainerView *view, static void gimp_container_view_real_set_container (GimpContainerView *view,
GimpContainer *container); GimpContainer *container);
@ -242,7 +242,7 @@ gimp_container_view_destroy (GtkObject *object)
} }
static void static void
gimp_container_view_docked_iface_init (GimpDockedIface *docked_iface) gimp_container_view_docked_iface_init (GimpDockedInterface *docked_iface)
{ {
docked_iface->get_preview = gimp_container_view_get_preview; docked_iface->get_preview = gimp_container_view_get_preview;
docked_iface->set_context = gimp_container_view_set_docked_context; docked_iface->set_context = gimp_container_view_set_docked_context;

View File

@ -129,7 +129,7 @@ gimp_devices_restore (Gimp *gimp)
filename = gimp_personal_rc_file ("devicerc"); filename = gimp_personal_rc_file ("devicerc");
if (! gimp_config_deserialize_file (G_OBJECT (manager->device_info_list), if (! gimp_config_deserialize_file (GIMP_CONFIG (manager->device_info_list),
filename, filename,
gimp, gimp,
&error)) &error))
@ -171,7 +171,7 @@ gimp_devices_save (Gimp *gimp)
filename = gimp_personal_rc_file ("devicerc"); filename = gimp_personal_rc_file ("devicerc");
if (! gimp_config_serialize_to_file (G_OBJECT (manager->device_info_list), if (! gimp_config_serialize_to_file (GIMP_CONFIG (manager->device_info_list),
filename, filename,
"GIMP devicerc", "GIMP devicerc",
"end of devicerc", "end of devicerc",

View File

@ -30,7 +30,7 @@
#include "gimpdocked.h" #include "gimpdocked.h"
static void gimp_docked_iface_init (GimpDockedIface *docked_iface); static void gimp_docked_iface_init (GimpDockedInterface *docked_iface);
GType GType
@ -42,7 +42,7 @@ gimp_docked_interface_get_type (void)
{ {
static const GTypeInfo docked_iface_info = static const GTypeInfo docked_iface_info =
{ {
sizeof (GimpDockedIface), sizeof (GimpDockedInterface),
(GBaseInitFunc) gimp_docked_iface_init, (GBaseInitFunc) gimp_docked_iface_init,
(GBaseFinalizeFunc) NULL, (GBaseFinalizeFunc) NULL,
}; };
@ -59,7 +59,7 @@ gimp_docked_interface_get_type (void)
} }
static void static void
gimp_docked_iface_init (GimpDockedIface *docked_iface) gimp_docked_iface_init (GimpDockedInterface *docked_iface)
{ {
docked_iface->set_aux_info = NULL; docked_iface->set_aux_info = NULL;
docked_iface->get_aux_info = NULL; docked_iface->get_aux_info = NULL;
@ -72,7 +72,7 @@ void
gimp_docked_set_aux_info (GimpDocked *docked, gimp_docked_set_aux_info (GimpDocked *docked,
GList *aux_info) GList *aux_info)
{ {
GimpDockedIface *docked_iface; GimpDockedInterface *docked_iface;
g_return_if_fail (GIMP_IS_DOCKED (docked)); g_return_if_fail (GIMP_IS_DOCKED (docked));
@ -85,7 +85,7 @@ gimp_docked_set_aux_info (GimpDocked *docked,
GList * GList *
gimp_docked_get_aux_info (GimpDocked *docked) gimp_docked_get_aux_info (GimpDocked *docked)
{ {
GimpDockedIface *docked_iface; GimpDockedInterface *docked_iface;
g_return_val_if_fail (GIMP_IS_DOCKED (docked), NULL); g_return_val_if_fail (GIMP_IS_DOCKED (docked), NULL);
@ -102,7 +102,7 @@ gimp_docked_get_preview (GimpDocked *docked,
GimpContext *context, GimpContext *context,
GtkIconSize size) GtkIconSize size)
{ {
GimpDockedIface *docked_iface; GimpDockedInterface *docked_iface;
g_return_val_if_fail (GIMP_IS_DOCKED (docked), NULL); g_return_val_if_fail (GIMP_IS_DOCKED (docked), NULL);
@ -119,7 +119,7 @@ gimp_docked_set_context (GimpDocked *docked,
GimpContext *context, GimpContext *context,
GimpContext *prev_context) GimpContext *prev_context)
{ {
GimpDockedIface *docked_iface; GimpDockedInterface *docked_iface;
g_return_if_fail (GIMP_IS_DOCKED (docked)); g_return_if_fail (GIMP_IS_DOCKED (docked));
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context)); g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
@ -135,7 +135,7 @@ GimpItemFactory *
gimp_docked_get_menu (GimpDocked *docked, gimp_docked_get_menu (GimpDocked *docked,
gpointer *item_factory_data) gpointer *item_factory_data)
{ {
GimpDockedIface *docked_iface; GimpDockedInterface *docked_iface;
g_return_val_if_fail (GIMP_IS_DOCKED (docked), NULL); g_return_val_if_fail (GIMP_IS_DOCKED (docked), NULL);
g_return_val_if_fail (item_factory_data != NULL, NULL); g_return_val_if_fail (item_factory_data != NULL, NULL);

View File

@ -26,10 +26,10 @@
#define GIMP_TYPE_DOCKED (gimp_docked_interface_get_type ()) #define GIMP_TYPE_DOCKED (gimp_docked_interface_get_type ())
#define GIMP_IS_DOCKED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DOCKED)) #define GIMP_IS_DOCKED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DOCKED))
#define GIMP_DOCKED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DOCKED, GimpDocked)) #define GIMP_DOCKED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DOCKED, GimpDocked))
#define GIMP_DOCKED_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_DOCKED, GimpDockedIface)) #define GIMP_DOCKED_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_DOCKED, GimpDockedInterface))
struct _GimpDockedIface struct _GimpDockedInterface
{ {
GTypeInterface base_iface; GTypeInterface base_iface;

View File

@ -41,7 +41,7 @@
static void gimp_editor_class_init (GimpEditorClass *klass); static void gimp_editor_class_init (GimpEditorClass *klass);
static void gimp_editor_init (GimpEditor *editor); static void gimp_editor_init (GimpEditor *editor);
static void gimp_editor_docked_iface_init (GimpDockedIface *docked_iface); static void gimp_editor_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_editor_destroy (GtkObject *object); static void gimp_editor_destroy (GtkObject *object);
static void gimp_editor_style_set (GtkWidget *widget, static void gimp_editor_style_set (GtkWidget *widget,
@ -142,7 +142,7 @@ gimp_editor_init (GimpEditor *editor)
} }
static void static void
gimp_editor_docked_iface_init (GimpDockedIface *docked_iface) gimp_editor_docked_iface_init (GimpDockedInterface *docked_iface)
{ {
docked_iface->get_menu = gimp_editor_get_menu; docked_iface->get_menu = gimp_editor_get_menu;
} }

View File

@ -32,7 +32,7 @@
static void gimp_image_editor_class_init (GimpImageEditorClass *klass); static void gimp_image_editor_class_init (GimpImageEditorClass *klass);
static void gimp_image_editor_init (GimpImageEditor *editor); static void gimp_image_editor_init (GimpImageEditor *editor);
static void gimp_image_editor_docked_iface_init (GimpDockedIface *docked_iface); static void gimp_image_editor_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_image_editor_set_docked_context (GimpDocked *docked, static void gimp_image_editor_set_docked_context (GimpDocked *docked,
GimpContext *context, GimpContext *context,
GimpContext *prev_context); GimpContext *prev_context);
@ -106,7 +106,7 @@ gimp_image_editor_init (GimpImageEditor *editor)
} }
static void static void
gimp_image_editor_docked_iface_init (GimpDockedIface *docked_iface) gimp_image_editor_docked_iface_init (GimpDockedInterface *docked_iface)
{ {
docked_iface->set_context = gimp_image_editor_set_docked_context; docked_iface->set_context = gimp_image_editor_set_docked_context;
} }

View File

@ -64,7 +64,7 @@ static void gimp_item_tree_view_class_init (GimpItemTreeViewClass *klass);
static void gimp_item_tree_view_init (GimpItemTreeView *view, static void gimp_item_tree_view_init (GimpItemTreeView *view,
GimpItemTreeViewClass *view_class); GimpItemTreeViewClass *view_class);
static void gimp_item_tree_view_docked_iface_init (GimpDockedIface *docked_iface); static void gimp_item_tree_view_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_item_tree_view_set_docked_context (GimpDocked *docked, static void gimp_item_tree_view_set_docked_context (GimpDocked *docked,
GimpContext *context, GimpContext *context,
GimpContext *prev_context); GimpContext *prev_context);
@ -354,7 +354,7 @@ gimp_item_tree_view_init (GimpItemTreeView *view,
} }
static void static void
gimp_item_tree_view_docked_iface_init (GimpDockedIface *docked_iface) gimp_item_tree_view_docked_iface_init (GimpDockedInterface *docked_iface)
{ {
docked_iface->set_context = gimp_item_tree_view_set_docked_context; docked_iface->set_context = gimp_item_tree_view_set_docked_context;
} }

View File

@ -494,8 +494,8 @@ gimp_template_editor_set_template (GimpTemplateEditor *editor,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (editor->size_se), 1, gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (editor->size_se), 1,
template->yresolution, FALSE); template->yresolution, FALSE);
gimp_config_copy_properties (G_OBJECT (template), gimp_config_copy_properties (GIMP_CONFIG (template),
G_OBJECT (editor->template)); GIMP_CONFIG (editor->template));
g_signal_connect (editor->template, "notify", g_signal_connect (editor->template, "notify",
G_CALLBACK (gimp_template_editor_template_notify), G_CALLBACK (gimp_template_editor_template_notify),
@ -508,7 +508,7 @@ gimp_template_editor_get_template (GimpTemplateEditor *editor)
{ {
g_return_val_if_fail (GIMP_IS_TEMPLATE_EDITOR (editor), NULL); g_return_val_if_fail (GIMP_IS_TEMPLATE_EDITOR (editor), NULL);
return GIMP_TEMPLATE (gimp_config_duplicate (G_OBJECT (editor->template))); return GIMP_TEMPLATE (gimp_config_duplicate (GIMP_CONFIG (editor->template)));
} }

View File

@ -294,7 +294,8 @@ gimp_template_view_duplicate_clicked (GtkWidget *widget,
{ {
GimpTemplate *new_template; GimpTemplate *new_template;
new_template = GIMP_TEMPLATE (gimp_config_duplicate (G_OBJECT (template))); new_template =
GIMP_TEMPLATE (gimp_config_duplicate (GIMP_CONFIG (template)));
gimp_list_uniquefy_name (GIMP_LIST (editor->view->container), gimp_list_uniquefy_name (GIMP_LIST (editor->view->container),
GIMP_OBJECT (new_template), TRUE); GIMP_OBJECT (new_template), TRUE);

View File

@ -46,7 +46,7 @@
static void gimp_tool_options_editor_class_init (GimpToolOptionsEditorClass *klass); static void gimp_tool_options_editor_class_init (GimpToolOptionsEditorClass *klass);
static void gimp_tool_options_editor_init (GimpToolOptionsEditor *editor); static void gimp_tool_options_editor_init (GimpToolOptionsEditor *editor);
static void gimp_tool_options_editor_docked_iface_init (GimpDockedIface *docked_iface); static void gimp_tool_options_editor_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_tool_options_editor_destroy (GtkObject *object); static void gimp_tool_options_editor_destroy (GtkObject *object);
@ -200,7 +200,7 @@ gimp_tool_options_editor_init (GimpToolOptionsEditor *editor)
} }
static void static void
gimp_tool_options_editor_docked_iface_init (GimpDockedIface *docked_iface) gimp_tool_options_editor_docked_iface_init (GimpDockedInterface *docked_iface)
{ {
docked_iface->get_preview = gimp_tool_options_editor_get_preview; docked_iface->get_preview = gimp_tool_options_editor_get_preview;
} }

View File

@ -99,7 +99,7 @@ typedef struct _GimpImageDock GimpImageDock;
typedef struct _GimpDockable GimpDockable; typedef struct _GimpDockable GimpDockable;
typedef struct _GimpDockbook GimpDockbook; typedef struct _GimpDockbook GimpDockbook;
typedef struct _GimpDocked GimpDocked; /* dummy typedef */ typedef struct _GimpDocked GimpDocked; /* dummy typedef */
typedef struct _GimpDockedIface GimpDockedIface; typedef struct _GimpDockedInterface GimpDockedInterface;
typedef struct _GimpContainerPopup GimpContainerPopup; typedef struct _GimpContainerPopup GimpContainerPopup;
typedef struct _GimpViewableButton GimpViewableButton; typedef struct _GimpViewableButton GimpViewableButton;

View File

@ -54,13 +54,13 @@
* couldn't parse it. * couldn't parse it.
*/ */
static GTokenType gimp_config_deserialize_unknown (GObject *object, static GTokenType gimp_config_deserialize_unknown (GimpConfig *object,
GScanner *scanner); GScanner *scanner);
static GTokenType gimp_config_deserialize_property (GObject *object, static GTokenType gimp_config_deserialize_property (GimpConfig *object,
GScanner *scanner, GScanner *scanner,
gint nest_level); gint nest_level);
static GTokenType gimp_config_deserialize_value (GValue *value, static GTokenType gimp_config_deserialize_value (GValue *value,
GObject *object, GimpConfig *object,
GParamSpec *prop_spec, GParamSpec *prop_spec,
GScanner *scanner); GScanner *scanner);
static GTokenType gimp_config_deserialize_fundamental (GValue *value, static GTokenType gimp_config_deserialize_fundamental (GValue *value,
@ -82,12 +82,12 @@ static GTokenType gimp_config_deserialize_matrix2 (GValue *value,
GParamSpec *prop_spec, GParamSpec *prop_spec,
GScanner *scanner); GScanner *scanner);
static GTokenType gimp_config_deserialize_object (GValue *value, static GTokenType gimp_config_deserialize_object (GValue *value,
GObject *object, GimpConfig *object,
GParamSpec *prop_spec, GParamSpec *prop_spec,
GScanner *scanner, GScanner *scanner,
gint nest_level); gint nest_level);
static GTokenType gimp_config_deserialize_value_array (GValue *value, static GTokenType gimp_config_deserialize_value_array (GValue *value,
GObject *object, GimpConfig *object,
GParamSpec *prop_spec, GParamSpec *prop_spec,
GScanner *scanner); GScanner *scanner);
static GTokenType gimp_config_deserialize_any (GValue *value, static GTokenType gimp_config_deserialize_any (GValue *value,
@ -100,7 +100,7 @@ static inline gboolean scanner_string_utf8_valid (GScanner *scanner,
/** /**
* gimp_config_deserialize_properties: * gimp_config_deserialize_properties:
* @object: a #GObject. * @object: a #GimpConfig.
* @scanner: a #GScanner. * @scanner: a #GScanner.
* @nest_level: * @nest_level:
* @store_unknown_tokens: %TRUE if you want to store unknown tokens. * @store_unknown_tokens: %TRUE if you want to store unknown tokens.
@ -116,10 +116,10 @@ static inline gboolean scanner_string_utf8_valid (GScanner *scanner,
* Return value: * Return value:
**/ **/
gboolean gboolean
gimp_config_deserialize_properties (GObject *object, gimp_config_deserialize_properties (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gboolean store_unknown_tokens) gboolean store_unknown_tokens)
{ {
GObjectClass *klass; GObjectClass *klass;
GParamSpec **property_specs; GParamSpec **property_specs;
@ -130,15 +130,15 @@ gimp_config_deserialize_properties (GObject *object,
GTokenType token; GTokenType token;
GTokenType next; GTokenType next;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
klass = G_OBJECT_GET_CLASS (object); klass = G_OBJECT_GET_CLASS (config);
property_specs = g_object_class_list_properties (klass, &n_property_specs); property_specs = g_object_class_list_properties (klass, &n_property_specs);
if (!property_specs) if (!property_specs)
return TRUE; return TRUE;
scope_id = g_type_qname (G_TYPE_FROM_INSTANCE (object)); scope_id = g_type_qname (G_TYPE_FROM_INSTANCE (config));
old_scope_id = g_scanner_set_scope (scanner, scope_id); old_scope_id = g_scanner_set_scope (scanner, scope_id);
for (i = 0; i < n_property_specs; i++) for (i = 0; i < n_property_specs; i++)
@ -154,7 +154,7 @@ gimp_config_deserialize_properties (GObject *object,
g_free (property_specs); g_free (property_specs);
g_object_freeze_notify (object); g_object_freeze_notify (G_OBJECT (config));
token = G_TOKEN_LEFT_PAREN; token = G_TOKEN_LEFT_PAREN;
@ -178,11 +178,11 @@ gimp_config_deserialize_properties (GObject *object,
break; break;
case G_TOKEN_IDENTIFIER: case G_TOKEN_IDENTIFIER:
token = gimp_config_deserialize_unknown (object, scanner); token = gimp_config_deserialize_unknown (config, scanner);
break; break;
case G_TOKEN_SYMBOL: case G_TOKEN_SYMBOL:
token = gimp_config_deserialize_property (object, token = gimp_config_deserialize_property (config,
scanner, nest_level); scanner, nest_level);
break; break;
@ -197,7 +197,7 @@ gimp_config_deserialize_properties (GObject *object,
g_scanner_set_scope (scanner, old_scope_id); g_scanner_set_scope (scanner, old_scope_id);
g_object_thaw_notify (object); g_object_thaw_notify (G_OBJECT (config));
/* If store_unknown_tokens is TRUE but the unknown token value couldn't /* If store_unknown_tokens is TRUE but the unknown token value couldn't
be parsed the default error message is rather confusing. be parsed the default error message is rather confusing.
@ -214,8 +214,8 @@ gimp_config_deserialize_properties (GObject *object,
} }
static GTokenType static GTokenType
gimp_config_deserialize_unknown (GObject *object, gimp_config_deserialize_unknown (GimpConfig *object,
GScanner *scanner) GScanner *scanner)
{ {
gchar *key; gchar *key;
@ -239,12 +239,12 @@ gimp_config_deserialize_unknown (GObject *object,
} }
static GTokenType static GTokenType
gimp_config_deserialize_property (GObject *object, gimp_config_deserialize_property (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level) gint nest_level)
{ {
GTypeClass *owner_class; GTypeClass *owner_class;
GimpConfigInterface *gimp_config_iface; GimpConfigInterface *config_iface;
GimpConfigInterface *parent_iface; GimpConfigInterface *parent_iface;
GParamSpec *prop_spec; GParamSpec *prop_spec;
GTokenType token = G_TOKEN_RIGHT_PAREN; GTokenType token = G_TOKEN_RIGHT_PAREN;
@ -256,8 +256,7 @@ gimp_config_deserialize_property (GObject *object,
owner_class = g_type_class_peek (prop_spec->owner_type); owner_class = g_type_class_peek (prop_spec->owner_type);
gimp_config_iface = g_type_interface_peek (owner_class, config_iface = g_type_interface_peek (owner_class, GIMP_TYPE_CONFIG);
GIMP_TYPE_CONFIG_INTERFACE);
/* We must call deserialize_property() *only* if the *exact* class /* We must call deserialize_property() *only* if the *exact* class
* which implements it is param_spec->owner_type's class. * which implements it is param_spec->owner_type's class.
@ -269,25 +268,25 @@ gimp_config_deserialize_property (GObject *object,
* GimpConfigInterface is inherited from one of it's parent classes * GimpConfigInterface is inherited from one of it's parent classes
* and thus not able to handle param_spec->owner_type's properties). * and thus not able to handle param_spec->owner_type's properties).
*/ */
if (gimp_config_iface) if (config_iface)
{ {
GTypeClass *owner_parent_class; GTypeClass *owner_parent_class;
owner_parent_class = g_type_class_peek_parent (owner_class), owner_parent_class = g_type_class_peek_parent (owner_class),
parent_iface = g_type_interface_peek (owner_parent_class, parent_iface = g_type_interface_peek (owner_parent_class,
GIMP_TYPE_CONFIG_INTERFACE); GIMP_TYPE_CONFIG);
} }
if (gimp_config_iface && if (config_iface &&
gimp_config_iface != parent_iface && /* see comment above */ config_iface != parent_iface && /* see comment above */
gimp_config_iface->deserialize_property && config_iface->deserialize_property &&
gimp_config_iface->deserialize_property (object, config_iface->deserialize_property (config,
prop_spec->param_id, prop_spec->param_id,
&value, &value,
prop_spec, prop_spec,
scanner, scanner,
&token)) &token))
{ {
/* nop */ /* nop */
} }
@ -295,11 +294,11 @@ gimp_config_deserialize_property (GObject *object,
{ {
if (G_VALUE_HOLDS_OBJECT (&value)) if (G_VALUE_HOLDS_OBJECT (&value))
token = gimp_config_deserialize_object (&value, token = gimp_config_deserialize_object (&value,
object, prop_spec, config, prop_spec,
scanner, nest_level); scanner, nest_level);
else else
token = gimp_config_deserialize_value (&value, token = gimp_config_deserialize_value (&value,
object, prop_spec, scanner); config, prop_spec, scanner);
} }
if (token == G_TOKEN_RIGHT_PAREN && if (token == G_TOKEN_RIGHT_PAREN &&
@ -307,13 +306,13 @@ gimp_config_deserialize_property (GObject *object,
{ {
if (! (G_VALUE_HOLDS_OBJECT (&value) && if (! (G_VALUE_HOLDS_OBJECT (&value) &&
(prop_spec->flags & GIMP_PARAM_AGGREGATE))) (prop_spec->flags & GIMP_PARAM_AGGREGATE)))
g_object_set_property (object, prop_spec->name, &value); g_object_set_property (G_OBJECT (config), prop_spec->name, &value);
} }
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
else else
{ {
g_warning ("couldn't deserialize property %s::%s of type %s", g_warning ("couldn't deserialize property %s::%s of type %s",
g_type_name (G_TYPE_FROM_INSTANCE (object)), g_type_name (G_TYPE_FROM_INSTANCE (config)),
prop_spec->name, prop_spec->name,
g_type_name (prop_spec->value_type)); g_type_name (prop_spec->value_type));
} }
@ -326,7 +325,7 @@ gimp_config_deserialize_property (GObject *object,
static GTokenType static GTokenType
gimp_config_deserialize_value (GValue *value, gimp_config_deserialize_value (GValue *value,
GObject *object, GimpConfig *object,
GParamSpec *prop_spec, GParamSpec *prop_spec,
GScanner *scanner) GScanner *scanner)
{ {
@ -625,28 +624,27 @@ gimp_config_deserialize_matrix2 (GValue *value,
static GTokenType static GTokenType
gimp_config_deserialize_object (GValue *value, gimp_config_deserialize_object (GValue *value,
GObject *object, GimpConfig *config,
GParamSpec *prop_spec, GParamSpec *prop_spec,
GScanner *scanner, GScanner *scanner,
gint nest_level) gint nest_level)
{ {
GimpConfigInterface *gimp_config_iface; GimpConfigInterface *config_iface;
GObject *prop_object; GimpConfig *prop_object;
g_object_get_property (object, prop_spec->name, value); g_object_get_property (G_OBJECT (config), prop_spec->name, value);
prop_object = g_value_get_object (value); prop_object = g_value_get_object (value);
if (! prop_object) if (! prop_object)
return G_TOKEN_RIGHT_PAREN; return G_TOKEN_RIGHT_PAREN;
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (prop_object); config_iface = GIMP_CONFIG_GET_INTERFACE (prop_object);
if (! gimp_config_iface) if (! config_iface)
return gimp_config_deserialize_any (value, prop_spec, scanner); return gimp_config_deserialize_any (value, prop_spec, scanner);
if (! gimp_config_iface->deserialize (prop_object, if (! config_iface->deserialize (prop_object, scanner, nest_level + 1, NULL))
scanner, nest_level + 1, NULL))
return G_TOKEN_NONE; return G_TOKEN_NONE;
return G_TOKEN_RIGHT_PAREN; return G_TOKEN_RIGHT_PAREN;
@ -654,7 +652,7 @@ gimp_config_deserialize_object (GValue *value,
static GTokenType static GTokenType
gimp_config_deserialize_value_array (GValue *value, gimp_config_deserialize_value_array (GValue *value,
GObject *object, GimpConfig *config,
GParamSpec *prop_spec, GParamSpec *prop_spec,
GScanner *scanner) GScanner *scanner)
{ {
@ -677,7 +675,7 @@ gimp_config_deserialize_value_array (GValue *value,
g_value_init (&array_value, array_spec->element_spec->value_type); g_value_init (&array_value, array_spec->element_spec->value_type);
token = gimp_config_deserialize_value (&array_value, token = gimp_config_deserialize_value (&array_value,
object, config,
array_spec->element_spec, array_spec->element_spec,
scanner); scanner);

View File

@ -23,10 +23,10 @@
#define __GIMP_CONFIG_DESERIALIZE_H__ #define __GIMP_CONFIG_DESERIALIZE_H__
gboolean gimp_config_deserialize_properties (GObject *object, gboolean gimp_config_deserialize_properties (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gboolean store_unknown_tokens); gboolean store_unknown_tokens);
#endif /* __GIMP_CONFIG_DESERIALIZE_H__ */ #endif /* __GIMP_CONFIG_DESERIALIZE_H__ */

View File

@ -43,19 +43,19 @@
* The GimpConfig serialization and deserialization interface. * The GimpConfig serialization and deserialization interface.
*/ */
static void gimp_config_iface_init (GimpConfigInterface *gimp_config_iface); static void gimp_config_iface_init (GimpConfigInterface *gimp_config_iface);
static gboolean gimp_config_iface_serialize (GObject *object, static gboolean gimp_config_iface_serialize (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data); gpointer data);
static gboolean gimp_config_iface_deserialize (GObject *object, static gboolean gimp_config_iface_deserialize (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data); gpointer data);
static GObject *gimp_config_iface_duplicate (GObject *object); static GimpConfig * gimp_config_iface_duplicate (GimpConfig *config);
static gboolean gimp_config_iface_equal (GObject *a, static gboolean gimp_config_iface_equal (GimpConfig *a,
GObject *b); GimpConfig *b);
static void gimp_config_iface_reset (GObject *object); static void gimp_config_iface_reset (GimpConfig *config);
GType GType
@ -96,25 +96,25 @@ gimp_config_iface_init (GimpConfigInterface *gimp_config_iface)
} }
static gboolean static gboolean
gimp_config_iface_serialize (GObject *object, gimp_config_iface_serialize (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data) gpointer data)
{ {
return gimp_config_serialize_properties (object, writer); return gimp_config_serialize_properties (config, writer);
} }
static gboolean static gboolean
gimp_config_iface_deserialize (GObject *object, gimp_config_iface_deserialize (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data) gpointer data)
{ {
return gimp_config_deserialize_properties (object, return gimp_config_deserialize_properties (config,
scanner, nest_level, FALSE); scanner, nest_level, FALSE);
} }
static GObject * static GimpConfig *
gimp_config_iface_duplicate (GObject *object) gimp_config_iface_duplicate (GimpConfig *config)
{ {
GObjectClass *klass; GObjectClass *klass;
GParamSpec **property_specs; GParamSpec **property_specs;
@ -122,9 +122,9 @@ gimp_config_iface_duplicate (GObject *object)
GParameter *construct_params = NULL; GParameter *construct_params = NULL;
gint n_construct_params = 0; gint n_construct_params = 0;
guint i; guint i;
GObject *dup; GimpConfig *dup;
klass = G_OBJECT_GET_CLASS (object); klass = G_OBJECT_GET_CLASS (config);
property_specs = g_object_class_list_properties (klass, &n_property_specs); property_specs = g_object_class_list_properties (klass, &n_property_specs);
@ -145,14 +145,14 @@ gimp_config_iface_duplicate (GObject *object)
construct_params->name = prop_spec->name; construct_params->name = prop_spec->name;
g_value_init (&construct_params->value, prop_spec->value_type); g_value_init (&construct_params->value, prop_spec->value_type);
g_object_get_property (object, prop_spec->name, g_object_get_property (G_OBJECT (config), prop_spec->name,
&construct_param->value); &construct_param->value);
} }
} }
g_free (property_specs); g_free (property_specs);
dup = g_object_newv (G_TYPE_FROM_INSTANCE (object), dup = g_object_newv (G_TYPE_FROM_INSTANCE (config),
n_construct_params, construct_params); n_construct_params, construct_params);
for (i = 0; i < n_construct_params; i++) for (i = 0; i < n_construct_params; i++)
@ -160,14 +160,14 @@ gimp_config_iface_duplicate (GObject *object)
g_free (construct_params); g_free (construct_params);
gimp_config_copy_properties (object, dup); gimp_config_copy_properties (config, dup);
return dup; return dup;
} }
static gboolean static gboolean
gimp_config_iface_equal (GObject *a, gimp_config_iface_equal (GimpConfig *a,
GObject *b) GimpConfig *b)
{ {
GObjectClass *klass; GObjectClass *klass;
GParamSpec **property_specs; GParamSpec **property_specs;
@ -192,8 +192,8 @@ gimp_config_iface_equal (GObject *a,
g_value_init (&a_value, prop_spec->value_type); g_value_init (&a_value, prop_spec->value_type);
g_value_init (&b_value, prop_spec->value_type); g_value_init (&b_value, prop_spec->value_type);
g_object_get_property (a, prop_spec->name, &a_value); g_object_get_property (G_OBJECT (a), prop_spec->name, &a_value);
g_object_get_property (b, prop_spec->name, &b_value); g_object_get_property (G_OBJECT (b), prop_spec->name, &b_value);
equal = (g_param_values_cmp (prop_spec, &a_value, &b_value) == 0); equal = (g_param_values_cmp (prop_spec, &a_value, &b_value) == 0);
@ -207,103 +207,91 @@ gimp_config_iface_equal (GObject *a,
} }
static void static void
gimp_config_iface_reset (GObject *object) gimp_config_iface_reset (GimpConfig *config)
{ {
gimp_config_reset_properties (object); gimp_config_reset_properties (config);
} }
/** /**
* gimp_config_serialize_to_file: * gimp_config_serialize_to_file:
* @object: a #GObject that implements the #GimpConfigInterface. * @config: a #GObject that implements the #GimpConfigInterface.
* @filename: the name of the file to write the configuration to. * @filename: the name of the file to write the configuration to.
* @header: optional file header (must be ASCII only) * @header: optional file header (must be ASCII only)
* @footer: optional file footer (must be ASCII only) * @footer: optional file footer (must be ASCII only)
* @data: user data passed to the serialize implementation. * @data: user data passed to the serialize implementation.
* @error: * @error:
* *
* Serializes the object properties of @object to the file specified * Serializes the object properties of @config to the file specified
* by @filename. If a file with that name already exists, it is * by @filename. If a file with that name already exists, it is
* overwritten. Basically this function opens @filename for you and * overwritten. Basically this function opens @filename for you and
* calls the serialize function of the @object's #GimpConfigInterface. * calls the serialize function of the @config's #GimpConfigInterface.
* *
* Return value: %TRUE if serialization succeeded, %FALSE otherwise. * Return value: %TRUE if serialization succeeded, %FALSE otherwise.
**/ **/
gboolean gboolean
gimp_config_serialize_to_file (GObject *object, gimp_config_serialize_to_file (GimpConfig *config,
const gchar *filename, const gchar *filename,
const gchar *header, const gchar *header,
const gchar *footer, const gchar *footer,
gpointer data, gpointer data,
GError **error) GError **error)
{ {
GimpConfigInterface *gimp_config_iface; GimpConfigWriter *writer;
GimpConfigWriter *writer;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
g_return_val_if_fail (filename != NULL, FALSE); g_return_val_if_fail (filename != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (object);
g_return_val_if_fail (gimp_config_iface != NULL, FALSE);
writer = gimp_config_writer_new_file (filename, TRUE, header, error); writer = gimp_config_writer_new_file (filename, TRUE, header, error);
if (!writer) if (!writer)
return FALSE; return FALSE;
gimp_config_iface->serialize (object, writer, data); GIMP_CONFIG_GET_INTERFACE (config)->serialize (config, writer, data);
return gimp_config_writer_finish (writer, footer, error); return gimp_config_writer_finish (writer, footer, error);
} }
gboolean gboolean
gimp_config_serialize_to_fd (GObject *object, gimp_config_serialize_to_fd (GimpConfig *config,
gint fd, gint fd,
gpointer data) gpointer data)
{ {
GimpConfigInterface *gimp_config_iface; GimpConfigWriter *writer;
GimpConfigWriter *writer;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
g_return_val_if_fail (fd > 0, FALSE); g_return_val_if_fail (fd > 0, FALSE);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (object);
g_return_val_if_fail (gimp_config_iface != NULL, FALSE);
writer = gimp_config_writer_new_fd (fd); writer = gimp_config_writer_new_fd (fd);
if (!writer) if (!writer)
return FALSE; return FALSE;
gimp_config_iface->serialize (object, writer, data); GIMP_CONFIG_GET_INTERFACE (config)->serialize (config, writer, data);
return gimp_config_writer_finish (writer, NULL, NULL); return gimp_config_writer_finish (writer, NULL, NULL);
} }
/** /**
* gimp_config_serialize_to_string: * gimp_config_serialize_to_string:
* @object: a #GObject that implements the #GimpConfigInterface. * @config: a #GObject that implements the #GimpConfigInterface.
* @data: user data passed to the serialize implementation. * @data: user data passed to the serialize implementation.
* *
* Serializes the object properties of @object to a string. * Serializes the object properties of @config to a string.
* *
* Return value: a newly allocated %NUL-terminated string. * Return value: a newly allocated %NUL-terminated string.
**/ **/
gchar * gchar *
gimp_config_serialize_to_string (GObject *object, gimp_config_serialize_to_string (GimpConfig *config,
gpointer data) gpointer data)
{ {
GimpConfigInterface *gimp_config_iface; GimpConfigWriter *writer;
GimpConfigWriter *writer; GString *str;
GString *str;
g_return_val_if_fail (G_IS_OBJECT (object), NULL); g_return_val_if_fail (GIMP_IS_CONFIG (config), NULL);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (object);
g_return_val_if_fail (gimp_config_iface != NULL, FALSE);
str = g_string_new (NULL); str = g_string_new (NULL);
writer = gimp_config_writer_new_string (str); writer = gimp_config_writer_new_string (str);
gimp_config_iface->serialize (object, writer, data); GIMP_CONFIG_GET_INTERFACE (config)->serialize (config, writer, data);
gimp_config_writer_finish (writer, NULL, NULL); gimp_config_writer_finish (writer, NULL, NULL);
@ -312,40 +300,37 @@ gimp_config_serialize_to_string (GObject *object,
/** /**
* gimp_config_deserialize: * gimp_config_deserialize:
* @object: a #GObject that implements the #GimpConfigInterface. * @config: a #GObject that implements the #GimpConfigInterface.
* @filename: the name of the file to read configuration from. * @filename: the name of the file to read configuration from.
* @data: user data passed to the deserialize implementation. * @data: user data passed to the deserialize implementation.
* @error: * @error:
* *
* Opens the file specified by @filename, reads configuration data * Opens the file specified by @filename, reads configuration data
* from it and configures @object accordingly. Basically this function * from it and configures @config accordingly. Basically this function
* creates a properly configured #GScanner for you and calls the * creates a properly configured #GScanner for you and calls the
* deserialize function of the @object's #GimpConfigInterface. * deserialize function of the @config's #GimpConfigInterface.
* *
* Return value: %TRUE if deserialization succeeded, %FALSE otherwise. * Return value: %TRUE if deserialization succeeded, %FALSE otherwise.
**/ **/
gboolean gboolean
gimp_config_deserialize_file (GObject *object, gimp_config_deserialize_file (GimpConfig *config,
const gchar *filename, const gchar *filename,
gpointer data, gpointer data,
GError **error) GError **error)
{ {
GimpConfigInterface *gimp_config_iface; GScanner *scanner;
GScanner *scanner; gboolean success;
gboolean success;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
g_return_val_if_fail (filename != NULL, FALSE); g_return_val_if_fail (filename != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (object);
g_return_val_if_fail (gimp_config_iface != NULL, FALSE);
scanner = gimp_scanner_new_file (filename, error); scanner = gimp_scanner_new_file (filename, error);
if (! scanner) if (! scanner)
return FALSE; return FALSE;
success = gimp_config_iface->deserialize (object, scanner, 0, data); success = GIMP_CONFIG_GET_INTERFACE (config)->deserialize (config,
scanner, 0, data);
gimp_scanner_destroy (scanner); gimp_scanner_destroy (scanner);
@ -357,39 +342,36 @@ gimp_config_deserialize_file (GObject *object,
/** /**
* gimp_config_deserialize_string: * gimp_config_deserialize_string:
* @object: a #GObject that implements the #GimpConfigInterface. * @config: a #GObject that implements the #GimpConfigInterface.
* @text: string to deserialize (in UTF-8 encoding) * @text: string to deserialize (in UTF-8 encoding)
* @text_len: length of @text in bytes or -1 * @text_len: length of @text in bytes or -1
* @data: * @data:
* @error: * @error:
* *
* Configures @object from @text. Basically this function creates a * Configures @config from @text. Basically this function creates a
* properly configured #GScanner for you and calls the deserialize * properly configured #GScanner for you and calls the deserialize
* function of the @object's #GimpConfigInterface. * function of the @config's #GimpConfigInterface.
* *
* Returns: %TRUE if deserialization succeeded, %FALSE otherwise. * Returns: %TRUE if deserialization succeeded, %FALSE otherwise.
**/ **/
gboolean gboolean
gimp_config_deserialize_string (GObject *object, gimp_config_deserialize_string (GimpConfig *config,
const gchar *text, const gchar *text,
gint text_len, gint text_len,
gpointer data, gpointer data,
GError **error) GError **error)
{ {
GimpConfigInterface *gimp_config_iface; GScanner *scanner;
GScanner *scanner; gboolean success;
gboolean success;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
g_return_val_if_fail (text != NULL || text_len == 0, FALSE); g_return_val_if_fail (text != NULL || text_len == 0, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (object);
g_return_val_if_fail (gimp_config_iface != NULL, FALSE);
scanner = gimp_scanner_new_string (text, text_len, error); scanner = gimp_scanner_new_string (text, text_len, error);
success = gimp_config_iface->deserialize (object, scanner, 0, data); success = GIMP_CONFIG_GET_INTERFACE (config)->deserialize (config,
scanner, 0, data);
gimp_scanner_destroy (scanner); gimp_scanner_destroy (scanner);
@ -438,7 +420,7 @@ gimp_config_deserialize_return (GScanner *scanner,
/** /**
* gimp_config_duplicate: * gimp_config_duplicate:
* @object: a #GObject that implements the #GimpConfigInterface. * @config: a #GObject that implements the #GimpConfigInterface.
* *
* Creates a copy of the passed object by copying all object * Creates a copy of the passed object by copying all object
* properties. The default implementation of the #GimpConfigInterface * properties. The default implementation of the #GimpConfigInterface
@ -447,18 +429,12 @@ gimp_config_deserialize_return (GScanner *scanner,
* *
* Return value: the duplicated #GObject. * Return value: the duplicated #GObject.
**/ **/
GObject * GimpConfig *
gimp_config_duplicate (GObject *object) gimp_config_duplicate (GimpConfig *config)
{ {
GimpConfigInterface *gimp_config_iface; g_return_val_if_fail (GIMP_IS_CONFIG (config), NULL);
g_return_val_if_fail (G_IS_OBJECT (object), NULL); return GIMP_CONFIG_GET_INTERFACE (config)->duplicate (config);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (object);
g_return_val_if_fail (gimp_config_iface != NULL, FALSE);
return gimp_config_iface->duplicate (object);
} }
/** /**
@ -474,43 +450,31 @@ gimp_config_duplicate (GObject *object)
* Return value: %TRUE if the two objects are equal. * Return value: %TRUE if the two objects are equal.
**/ **/
gboolean gboolean
gimp_config_is_equal_to (GObject *a, gimp_config_is_equal_to (GimpConfig *a,
GObject *b) GimpConfig *b)
{ {
GimpConfigInterface *gimp_config_iface; g_return_val_if_fail (GIMP_IS_CONFIG (a), FALSE);
g_return_val_if_fail (GIMP_IS_CONFIG (b), FALSE);
g_return_val_if_fail (G_IS_OBJECT (a), FALSE);
g_return_val_if_fail (G_IS_OBJECT (b), FALSE);
g_return_val_if_fail (G_TYPE_FROM_INSTANCE (a) == G_TYPE_FROM_INSTANCE (b), g_return_val_if_fail (G_TYPE_FROM_INSTANCE (a) == G_TYPE_FROM_INSTANCE (b),
FALSE); FALSE);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (a); return GIMP_CONFIG_GET_INTERFACE (a)->equal (a, b);
g_return_val_if_fail (gimp_config_iface != NULL, FALSE);
return gimp_config_iface->equal (a, b);
} }
/** /**
* gimp_config_reset: * gimp_config_reset:
* @object: a #GObject that implements the #GimpConfigInterface. * @config: a #GObject that implements the #GimpConfigInterface.
* *
* Resets the object to its default state. The default implementation of the * Resets the object to its default state. The default implementation of the
* #GimpConfigInterface only works for objects that are completely defined by * #GimpConfigInterface only works for objects that are completely defined by
* their properties. * their properties.
**/ **/
void void
gimp_config_reset (GObject *object) gimp_config_reset (GimpConfig *config)
{ {
GimpConfigInterface *gimp_config_iface; g_return_if_fail (GIMP_IS_CONFIG (config));
g_return_if_fail (G_IS_OBJECT (object)); GIMP_CONFIG_GET_INTERFACE (config)->reset (config);
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (object);
g_return_if_fail (gimp_config_iface != NULL);
gimp_config_iface->reset (object);
} }
@ -531,7 +495,7 @@ static void gimp_config_destroy_unknown_tokens (GSList *unknown_tokens);
/** /**
* gimp_config_add_unknown_token: * gimp_config_add_unknown_token:
* @object: a #GObject. * @config: a #GObject.
* @key: a nul-terminated string to identify the value. * @key: a nul-terminated string to identify the value.
* @value: a nul-terminated string representing the value. * @value: a nul-terminated string representing the value.
* *
@ -546,7 +510,7 @@ static void gimp_config_destroy_unknown_tokens (GSList *unknown_tokens);
* function with a %NULL @value. * function with a %NULL @value.
**/ **/
void void
gimp_config_add_unknown_token (GObject *object, gimp_config_add_unknown_token (GimpConfig *config,
const gchar *key, const gchar *key,
const gchar *value) const gchar *value)
{ {
@ -555,10 +519,10 @@ gimp_config_add_unknown_token (GObject *object,
GSList *last; GSList *last;
GSList *list; GSList *list;
g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (GIMP_IS_CONFIG (config));
g_return_if_fail (key != NULL); g_return_if_fail (key != NULL);
unknown_tokens = (GSList *) g_object_get_data (object, unknown_tokens = (GSList *) g_object_get_data (G_OBJECT (config),
GIMP_CONFIG_UNKNOWN_TOKENS); GIMP_CONFIG_UNKNOWN_TOKENS);
for (last = NULL, list = unknown_tokens; for (last = NULL, list = unknown_tokens;
@ -580,7 +544,8 @@ gimp_config_add_unknown_token (GObject *object,
g_free (token->key); g_free (token->key);
unknown_tokens = g_slist_remove (unknown_tokens, token); unknown_tokens = g_slist_remove (unknown_tokens, token);
g_object_set_data_full (object, GIMP_CONFIG_UNKNOWN_TOKENS, g_object_set_data_full (G_OBJECT (config),
GIMP_CONFIG_UNKNOWN_TOKENS,
unknown_tokens, unknown_tokens,
(GDestroyNotify) gimp_config_destroy_unknown_tokens); (GDestroyNotify) gimp_config_destroy_unknown_tokens);
} }
@ -604,7 +569,8 @@ gimp_config_add_unknown_token (GObject *object,
{ {
unknown_tokens = g_slist_append (NULL, token); unknown_tokens = g_slist_append (NULL, token);
g_object_set_data_full (object, GIMP_CONFIG_UNKNOWN_TOKENS, g_object_set_data_full (G_OBJECT (config),
GIMP_CONFIG_UNKNOWN_TOKENS,
unknown_tokens, unknown_tokens,
(GDestroyNotify) gimp_config_destroy_unknown_tokens); (GDestroyNotify) gimp_config_destroy_unknown_tokens);
} }
@ -612,7 +578,7 @@ gimp_config_add_unknown_token (GObject *object,
/** /**
* gimp_config_lookup_unknown_token: * gimp_config_lookup_unknown_token:
* @object: a #GObject. * @config: a #GObject.
* @key: a nul-terminated string to identify the value. * @key: a nul-terminated string to identify the value.
* *
* This function retrieves data that was previously attached using * This function retrieves data that was previously attached using
@ -622,17 +588,17 @@ gimp_config_add_unknown_token (GObject *object,
* Returns: a pointer to a constant string. * Returns: a pointer to a constant string.
**/ **/
const gchar * const gchar *
gimp_config_lookup_unknown_token (GObject *object, gimp_config_lookup_unknown_token (GimpConfig *config,
const gchar *key) const gchar *key)
{ {
GimpConfigToken *token; GimpConfigToken *token;
GSList *unknown_tokens; GSList *unknown_tokens;
GSList *list; GSList *list;
g_return_val_if_fail (G_IS_OBJECT (object), NULL); g_return_val_if_fail (GIMP_IS_CONFIG (config), NULL);
g_return_val_if_fail (key != NULL, NULL); g_return_val_if_fail (key != NULL, NULL);
unknown_tokens = (GSList *) g_object_get_data (object, unknown_tokens = (GSList *) g_object_get_data (G_OBJECT (config),
GIMP_CONFIG_UNKNOWN_TOKENS); GIMP_CONFIG_UNKNOWN_TOKENS);
for (list = unknown_tokens; list; list = g_slist_next (list)) for (list = unknown_tokens; list; list = g_slist_next (list))
@ -648,15 +614,15 @@ gimp_config_lookup_unknown_token (GObject *object,
/** /**
* gimp_config_foreach_unknown_token: * gimp_config_foreach_unknown_token:
* @object: a #GObject. * @config: a #GObject.
* @func: a function to call for each key/value pair. * @func: a function to call for each key/value pair.
* @user_data: data to pass to @func. * @user_data: data to pass to @func.
* *
* Calls @func for each key/value stored with the @object using * Calls @func for each key/value stored with the @config using
* gimp_config_add_unknown_token(). * gimp_config_add_unknown_token().
**/ **/
void void
gimp_config_foreach_unknown_token (GObject *object, gimp_config_foreach_unknown_token (GimpConfig *config,
GimpConfigForeachFunc func, GimpConfigForeachFunc func,
gpointer user_data) gpointer user_data)
{ {
@ -664,10 +630,10 @@ gimp_config_foreach_unknown_token (GObject *object,
GSList *unknown_tokens; GSList *unknown_tokens;
GSList *list; GSList *list;
g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (GIMP_IS_CONFIG (config));
g_return_if_fail (func != NULL); g_return_if_fail (func != NULL);
unknown_tokens = (GSList *) g_object_get_data (object, unknown_tokens = (GSList *) g_object_get_data (G_OBJECT (config),
GIMP_CONFIG_UNKNOWN_TOKENS); GIMP_CONFIG_UNKNOWN_TOKENS);
for (list = unknown_tokens; list; list = g_slist_next (list)) for (list = unknown_tokens; list; list = g_slist_next (list))

View File

@ -23,37 +23,38 @@
#define __GIMP_CONFIG_H__ #define __GIMP_CONFIG_H__
#define GIMP_TYPE_CONFIG_INTERFACE (gimp_config_interface_get_type ()) #define GIMP_TYPE_CONFIG (gimp_config_interface_get_type ())
#define GIMP_GET_CONFIG_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_CONFIG_INTERFACE, GimpConfigInterface)) #define GIMP_IS_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CONFIG))
#define GIMP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CONFIG, GimpConfig))
#define GIMP_CONFIG_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_CONFIG, GimpConfigInterface))
typedef struct _GimpConfigInterface GimpConfigInterface;
struct _GimpConfigInterface struct _GimpConfigInterface
{ {
GTypeInterface base_iface; GTypeInterface base_iface;
gboolean (* serialize) (GObject *object, gboolean (* serialize) (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data); gpointer data);
gboolean (* deserialize) (GObject *object, gboolean (* deserialize) (GimpConfig *config,
GScanner *scanner, GScanner *scanner,
gint nest_level, gint nest_level,
gpointer data); gpointer data);
gboolean (* serialize_property) (GObject *object, gboolean (* serialize_property) (GimpConfig *config,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec, GParamSpec *pspec,
GimpConfigWriter *writer); GimpConfigWriter *writer);
gboolean (* deserialize_property) (GObject *object, gboolean (* deserialize_property) (GimpConfig *config,
guint property_id, guint property_id,
GValue *value, GValue *value,
GParamSpec *pspec, GParamSpec *pspec,
GScanner *scanner, GScanner *scanner,
GTokenType *expected); GTokenType *expected);
GObject * (* duplicate) (GObject *object); GimpConfig * (* duplicate) (GimpConfig *config);
gboolean (* equal) (GObject *a, gboolean (* equal) (GimpConfig *a,
GObject *b); GimpConfig *b);
void (* reset) (GObject *object); void (* reset) (GimpConfig *config);
}; };
typedef void (* GimpConfigForeachFunc) (const gchar *key, typedef void (* GimpConfigForeachFunc) (const gchar *key,
@ -63,22 +64,22 @@ typedef void (* GimpConfigForeachFunc) (const gchar *key,
GType gimp_config_interface_get_type (void) G_GNUC_CONST; GType gimp_config_interface_get_type (void) G_GNUC_CONST;
gboolean gimp_config_serialize_to_file (GObject *object, gboolean gimp_config_serialize_to_file (GimpConfig *config,
const gchar *filename, const gchar *filename,
const gchar *header, const gchar *header,
const gchar *footer, const gchar *footer,
gpointer data, gpointer data,
GError **error); GError **error);
gboolean gimp_config_serialize_to_fd (GObject *object, gboolean gimp_config_serialize_to_fd (GimpConfig *config,
gint fd, gint fd,
gpointer data); gpointer data);
gchar * gimp_config_serialize_to_string (GObject *object, gchar * gimp_config_serialize_to_string (GimpConfig *config,
gpointer data); gpointer data);
gboolean gimp_config_deserialize_file (GObject *object, gboolean gimp_config_deserialize_file (GimpConfig *config,
const gchar *filename, const gchar *filename,
gpointer data, gpointer data,
GError **error); GError **error);
gboolean gimp_config_deserialize_string (GObject *object, gboolean gimp_config_deserialize_string (GimpConfig *config,
const gchar *text, const gchar *text,
gint text_len, gint text_len,
gpointer data, gpointer data,
@ -87,17 +88,17 @@ gboolean gimp_config_deserialize_return (GScanner *scanner,
GTokenType expected_token, GTokenType expected_token,
gint nest_level); gint nest_level);
GObject * gimp_config_duplicate (GObject *object); GimpConfig * gimp_config_duplicate (GimpConfig *config);
gboolean gimp_config_is_equal_to (GObject *a, gboolean gimp_config_is_equal_to (GimpConfig *a,
GObject *b); GimpConfig *b);
void gimp_config_reset (GObject *object); void gimp_config_reset (GimpConfig *config);
void gimp_config_add_unknown_token (GObject *object, void gimp_config_add_unknown_token (GimpConfig *config,
const gchar *key, const gchar *key,
const gchar *value); const gchar *value);
const gchar * gimp_config_lookup_unknown_token (GObject *object, const gchar * gimp_config_lookup_unknown_token (GimpConfig *config,
const gchar *key); const gchar *key);
void gimp_config_foreach_unknown_token (GObject *object, void gimp_config_foreach_unknown_token (GimpConfig *config,
GimpConfigForeachFunc func, GimpConfigForeachFunc func,
gpointer user_data); gpointer user_data);

View File

@ -54,7 +54,7 @@ static void serialize_unknown_token (const gchar *key,
/** /**
* gimp_config_serialize_properties: * gimp_config_serialize_properties:
* @object: a #GObject. * @config: a #GimpConfig.
* @writer: a #GimpConfigWriter. * @writer: a #GimpConfigWriter.
* *
* This function writes all object properties to the @writer. * This function writes all object properties to the @writer.
@ -62,7 +62,7 @@ static void serialize_unknown_token (const gchar *key,
* Returns: %TRUE if serialization succeeded, %FALSE otherwise * Returns: %TRUE if serialization succeeded, %FALSE otherwise
**/ **/
gboolean gboolean
gimp_config_serialize_properties (GObject *object, gimp_config_serialize_properties (GimpConfig *config,
GimpConfigWriter *writer) GimpConfigWriter *writer)
{ {
GObjectClass *klass; GObjectClass *klass;
@ -70,9 +70,9 @@ gimp_config_serialize_properties (GObject *object,
guint n_property_specs; guint n_property_specs;
guint i; guint i;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (G_IS_OBJECT (config), FALSE);
klass = G_OBJECT_GET_CLASS (object); klass = G_OBJECT_GET_CLASS (config);
property_specs = g_object_class_list_properties (klass, &n_property_specs); property_specs = g_object_class_list_properties (klass, &n_property_specs);
@ -86,7 +86,7 @@ gimp_config_serialize_properties (GObject *object,
if (! (prop_spec->flags & GIMP_PARAM_SERIALIZE)) if (! (prop_spec->flags & GIMP_PARAM_SERIALIZE))
continue; continue;
if (! gimp_config_serialize_property (object, prop_spec, writer)) if (! gimp_config_serialize_property (config, prop_spec, writer))
return FALSE; return FALSE;
} }
@ -97,7 +97,7 @@ gimp_config_serialize_properties (GObject *object,
/** /**
* gimp_config_serialize_changed_properties: * gimp_config_serialize_changed_properties:
* @object: a #GObject. * @config: a #GimpConfig.
* @writer: a #GimpConfigWriter. * @writer: a #GimpConfigWriter.
* *
* This function writes all object properties that have been changed from * This function writes all object properties that have been changed from
@ -106,7 +106,7 @@ gimp_config_serialize_properties (GObject *object,
* Returns: %TRUE if serialization succeeded, %FALSE otherwise * Returns: %TRUE if serialization succeeded, %FALSE otherwise
**/ **/
gboolean gboolean
gimp_config_serialize_changed_properties (GObject *object, gimp_config_serialize_changed_properties (GimpConfig *config,
GimpConfigWriter *writer) GimpConfigWriter *writer)
{ {
GObjectClass *klass; GObjectClass *klass;
@ -115,9 +115,9 @@ gimp_config_serialize_changed_properties (GObject *object,
guint i; guint i;
GValue value = { 0, }; GValue value = { 0, };
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (G_IS_OBJECT (config), FALSE);
klass = G_OBJECT_GET_CLASS (object); klass = G_OBJECT_GET_CLASS (config);
property_specs = g_object_class_list_properties (klass, &n_property_specs); property_specs = g_object_class_list_properties (klass, &n_property_specs);
@ -132,11 +132,11 @@ gimp_config_serialize_changed_properties (GObject *object,
continue; continue;
g_value_init (&value, prop_spec->value_type); g_value_init (&value, prop_spec->value_type);
g_object_get_property (object, prop_spec->name, &value); g_object_get_property (G_OBJECT (config), prop_spec->name, &value);
if (! g_param_value_defaults (prop_spec, &value)) if (! g_param_value_defaults (prop_spec, &value))
{ {
if (! gimp_config_serialize_property (object, prop_spec, writer)) if (! gimp_config_serialize_property (config, prop_spec, writer))
return FALSE; return FALSE;
} }
@ -150,33 +150,33 @@ gimp_config_serialize_changed_properties (GObject *object,
/** /**
* gimp_config_serialize_properties_diff: * gimp_config_serialize_properties_diff:
* @object: a #GObject. * @config: a #GimpConfig.
* @compare: a #GObject of the same type as @object. * @compare: a #GimpConfig of the same type as @config.
* @writer: a #GimpConfigWriter. * @writer: a #GimpConfigWriter.
* *
* This function compares @object and @compare and writes all * This function compares @config and @compare and writes all
* properties of @object that have different values than @compare to * properties of @config that have different values than @compare to
* the @writer. * the @writer.
* *
* Returns: %TRUE if serialization succeeded, %FALSE otherwise * Returns: %TRUE if serialization succeeded, %FALSE otherwise
**/ **/
gboolean gboolean
gimp_config_serialize_properties_diff (GObject *object, gimp_config_serialize_properties_diff (GimpConfig *config,
GObject *compare, GimpConfig *compare,
GimpConfigWriter *writer) GimpConfigWriter *writer)
{ {
GObjectClass *klass; GObjectClass *klass;
GList *diff; GList *diff;
GList *list; GList *list;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (G_IS_OBJECT (config), FALSE);
g_return_val_if_fail (G_IS_OBJECT (compare), FALSE); g_return_val_if_fail (G_IS_OBJECT (compare), FALSE);
g_return_val_if_fail (G_TYPE_FROM_INSTANCE (object) == g_return_val_if_fail (G_TYPE_FROM_INSTANCE (config) ==
G_TYPE_FROM_INSTANCE (compare), FALSE); G_TYPE_FROM_INSTANCE (compare), FALSE);
klass = G_OBJECT_GET_CLASS (object); klass = G_OBJECT_GET_CLASS (config);
diff = gimp_config_diff (object, compare, GIMP_PARAM_SERIALIZE); diff = gimp_config_diff (config, compare, GIMP_PARAM_SERIALIZE);
if (! diff) if (! diff)
return TRUE; return TRUE;
@ -188,7 +188,7 @@ gimp_config_serialize_properties_diff (GObject *object,
if (! (prop_spec->flags & GIMP_PARAM_SERIALIZE)) if (! (prop_spec->flags & GIMP_PARAM_SERIALIZE))
continue; continue;
if (! gimp_config_serialize_property (object, prop_spec, writer)) if (! gimp_config_serialize_property (config, prop_spec, writer))
return FALSE; return FALSE;
} }
@ -199,7 +199,7 @@ gimp_config_serialize_properties_diff (GObject *object,
gboolean gboolean
gimp_config_serialize_property (GObject *object, gimp_config_serialize_property (GimpConfig *config,
GParamSpec *param_spec, GParamSpec *param_spec,
GimpConfigWriter *writer) GimpConfigWriter *writer)
{ {
@ -213,12 +213,11 @@ gimp_config_serialize_property (GObject *object,
return FALSE; return FALSE;
g_value_init (&value, param_spec->value_type); g_value_init (&value, param_spec->value_type);
g_object_get_property (object, param_spec->name, &value); g_object_get_property (G_OBJECT (config), param_spec->name, &value);
owner_class = g_type_class_peek (param_spec->owner_type); owner_class = g_type_class_peek (param_spec->owner_type);
config_iface = g_type_interface_peek (owner_class, config_iface = g_type_interface_peek (owner_class, GIMP_TYPE_CONFIG);
GIMP_TYPE_CONFIG_INTERFACE);
/* We must call deserialize_property() *only* if the *exact* class /* We must call deserialize_property() *only* if the *exact* class
* which implements it is param_spec->owner_type's class. * which implements it is param_spec->owner_type's class.
@ -237,13 +236,13 @@ gimp_config_serialize_property (GObject *object,
owner_parent_class = g_type_class_peek_parent (owner_class), owner_parent_class = g_type_class_peek_parent (owner_class),
parent_iface = g_type_interface_peek (owner_parent_class, parent_iface = g_type_interface_peek (owner_parent_class,
GIMP_TYPE_CONFIG_INTERFACE); GIMP_TYPE_CONFIG);
} }
if (config_iface && if (config_iface &&
config_iface != parent_iface && /* see comment above */ config_iface != parent_iface && /* see comment above */
config_iface->serialize_property && config_iface->serialize_property &&
config_iface->serialize_property (object, config_iface->serialize_property (config,
param_spec->param_id, param_spec->param_id,
(const GValue *) &value, (const GValue *) &value,
param_spec, param_spec,
@ -261,22 +260,21 @@ gimp_config_serialize_property (GObject *object,
if (G_VALUE_HOLDS_OBJECT (&value) && if (G_VALUE_HOLDS_OBJECT (&value) &&
(param_spec->flags & GIMP_PARAM_AGGREGATE)) (param_spec->flags & GIMP_PARAM_AGGREGATE))
{ {
GimpConfigInterface *gimp_config_iface = NULL; GimpConfigInterface *config_iface = NULL;
GObject *prop_object; GimpConfig *prop_object;
prop_object = g_value_get_object (&value); prop_object = g_value_get_object (&value);
if (prop_object) if (prop_object)
gimp_config_iface = GIMP_GET_CONFIG_INTERFACE (prop_object); config_iface = GIMP_CONFIG_GET_INTERFACE (prop_object);
else else
success = TRUE; success = TRUE;
if (gimp_config_iface) if (config_iface)
{ {
gimp_config_writer_open (writer, param_spec->name); gimp_config_writer_open (writer, param_spec->name);
success = gimp_config_iface->serialize (prop_object, writer, success = config_iface->serialize (prop_object, writer, NULL);
NULL);
if (success) if (success)
gimp_config_writer_close (writer); gimp_config_writer_close (writer);
@ -310,7 +308,7 @@ gimp_config_serialize_property (GObject *object,
else else
{ {
g_warning ("couldn't serialize property %s::%s of type %s", g_warning ("couldn't serialize property %s::%s of type %s",
g_type_name (G_TYPE_FROM_INSTANCE (object)), g_type_name (G_TYPE_FROM_INSTANCE (config)),
param_spec->name, param_spec->name,
g_type_name (param_spec->value_type)); g_type_name (param_spec->value_type));
} }
@ -482,22 +480,22 @@ gimp_config_serialize_value (const GValue *value,
/** /**
* gimp_config_serialize_unknown_tokens: * gimp_config_serialize_unknown_tokens:
* @object: a #GObject. * @config: a #GimpConfig.
* @writer: a #GimpConfigWriter. * @writer: a #GimpConfigWriter.
* *
* Writes all unknown tokens attached to #object to the @writer. See * Writes all unknown tokens attached to @config to the @writer. See
* gimp_config_add_unknown_token(). * gimp_config_add_unknown_token().
* *
* Returns: %TRUE if serialization succeeded, %FALSE otherwise * Returns: %TRUE if serialization succeeded, %FALSE otherwise
**/ **/
gboolean gboolean
gimp_config_serialize_unknown_tokens (GObject *object, gimp_config_serialize_unknown_tokens (GimpConfig *config,
GimpConfigWriter *writer) GimpConfigWriter *writer)
{ {
g_return_val_if_fail (G_IS_OBJECT (object), FALSE); g_return_val_if_fail (G_IS_OBJECT (config), FALSE);
gimp_config_writer_linefeed (writer); gimp_config_writer_linefeed (writer);
gimp_config_foreach_unknown_token (object, serialize_unknown_token, writer); gimp_config_foreach_unknown_token (config, serialize_unknown_token, writer);
return TRUE; return TRUE;
} }

View File

@ -23,17 +23,17 @@
#define __GIMP_CONFIG_SERIALIZE_H__ #define __GIMP_CONFIG_SERIALIZE_H__
gboolean gimp_config_serialize_properties (GObject *object, gboolean gimp_config_serialize_properties (GimpConfig *config,
GimpConfigWriter *writer); GimpConfigWriter *writer);
gboolean gimp_config_serialize_changed_properties (GObject *object, gboolean gimp_config_serialize_changed_properties (GimpConfig *config,
GimpConfigWriter *writer); GimpConfigWriter *writer);
gboolean gimp_config_serialize_properties_diff (GObject *object, gboolean gimp_config_serialize_properties_diff (GimpConfig *config,
GObject *compare, GimpConfig *compare,
GimpConfigWriter *writer); GimpConfigWriter *writer);
gboolean gimp_config_serialize_unknown_tokens (GObject *object, gboolean gimp_config_serialize_unknown_tokens (GimpConfig *config,
GimpConfigWriter *writer); GimpConfigWriter *writer);
gboolean gimp_config_serialize_property (GObject *object, gboolean gimp_config_serialize_property (GimpConfig *config,
GParamSpec *param_spec, GParamSpec *param_spec,
GimpConfigWriter *writer); GimpConfigWriter *writer);

View File

@ -36,8 +36,8 @@
/** /**
* gimp_config_diff: * gimp_config_diff:
* @a: a #GObject * @a: a #GimpConfig
* @b: another #GObject of the same type as @a * @b: another #GimpConfig of the same type as @a
* @flags: a mask of GParamFlags * @flags: a mask of GParamFlags
* *
* Compares all properties of @a and @b that have all @flags set. If * Compares all properties of @a and @b that have all @flags set. If
@ -46,8 +46,8 @@
* Return value: a GList of differing GParamSpecs. * Return value: a GList of differing GParamSpecs.
**/ **/
GList * GList *
gimp_config_diff (GObject *a, gimp_config_diff (GimpConfig *a,
GObject *b, GimpConfig *b,
GParamFlags flags) GParamFlags flags)
{ {
GParamSpec **param_specs; GParamSpec **param_specs;
@ -73,14 +73,14 @@ gimp_config_diff (GObject *a,
g_value_init (&a_value, param_specs[i]->value_type); g_value_init (&a_value, param_specs[i]->value_type);
g_value_init (&b_value, param_specs[i]->value_type); g_value_init (&b_value, param_specs[i]->value_type);
g_object_get_property (a, param_specs[i]->name, &a_value); g_object_get_property (G_OBJECT (a), param_specs[i]->name, &a_value);
g_object_get_property (b, param_specs[i]->name, &b_value); g_object_get_property (G_OBJECT (b), param_specs[i]->name, &b_value);
if (G_IS_PARAM_SPEC_OBJECT (param_specs[i]) && if (G_IS_PARAM_SPEC_OBJECT (param_specs[i]) &&
(param_specs[i]->flags & GIMP_PARAM_AGGREGATE)) (param_specs[i]->flags & GIMP_PARAM_AGGREGATE))
{ {
GObject *a_object = g_value_get_object (&a_value); GimpConfig *a_object = g_value_get_object (&a_value);
GObject *b_object = g_value_get_object (&b_value); GimpConfig *b_object = g_value_get_object (&b_value);
if (a_object && b_object && if (a_object && b_object &&
G_TYPE_FROM_INSTANCE (a_object) == G_TYPE_FROM_INSTANCE (a_object) ==
@ -180,23 +180,23 @@ gimp_config_disconnect (GObject *src,
/** /**
* gimp_config_copy_properties: * gimp_config_copy_properties:
* @src: a #GObject * @src: a #GimpConfig
* @dest: another #GObject of the same type as @src * @dest: another #GimpConfig of the same type as @src
* *
* Retrieves all read and writeable property settings from @src and * Retrieves all read and writeable property settings from @src and
* applies the values to @dest. * applies the values to @dest.
**/ **/
void void
gimp_config_copy_properties (GObject *src, gimp_config_copy_properties (GimpConfig *src,
GObject *dest) GimpConfig *dest)
{ {
GObjectClass *klass; GObjectClass *klass;
GParamSpec **property_specs; GParamSpec **property_specs;
guint n_property_specs; guint n_property_specs;
guint i; guint i;
g_return_if_fail (G_IS_OBJECT (src)); g_return_if_fail (GIMP_IS_CONFIG (src));
g_return_if_fail (G_IS_OBJECT (dest)); g_return_if_fail (GIMP_IS_CONFIG (dest));
g_return_if_fail (G_TYPE_FROM_INSTANCE (src) == G_TYPE_FROM_INSTANCE (dest)); g_return_if_fail (G_TYPE_FROM_INSTANCE (src) == G_TYPE_FROM_INSTANCE (dest));
klass = G_OBJECT_GET_CLASS (src); klass = G_OBJECT_GET_CLASS (src);
@ -206,7 +206,7 @@ gimp_config_copy_properties (GObject *src,
if (!property_specs) if (!property_specs)
return; return;
g_object_freeze_notify (dest); g_object_freeze_notify (G_OBJECT (dest));
for (i = 0; i < n_property_specs; i++) for (i = 0; i < n_property_specs; i++)
{ {
@ -221,16 +221,18 @@ gimp_config_copy_properties (GObject *src,
if (G_IS_PARAM_SPEC_OBJECT (prop_spec) && if (G_IS_PARAM_SPEC_OBJECT (prop_spec) &&
(prop_spec->flags & GIMP_PARAM_AGGREGATE)) (prop_spec->flags & GIMP_PARAM_AGGREGATE))
{ {
GValue src_value = { 0, }; GValue src_value = { 0, };
GValue dest_value = { 0, }; GValue dest_value = { 0, };
GObject *src_object; GimpConfig *src_object;
GObject *dest_object; GimpConfig *dest_object;
g_value_init (&src_value, prop_spec->value_type); g_value_init (&src_value, prop_spec->value_type);
g_value_init (&dest_value, prop_spec->value_type); g_value_init (&dest_value, prop_spec->value_type);
g_object_get_property (src, prop_spec->name, &src_value); g_object_get_property (G_OBJECT (src),
g_object_get_property (dest, prop_spec->name, &dest_value); prop_spec->name, &src_value);
g_object_get_property (G_OBJECT (dest),
prop_spec->name, &dest_value);
src_object = g_value_get_object (&src_value); src_object = g_value_get_object (&src_value);
dest_object = g_value_get_object (&dest_value); dest_object = g_value_get_object (&dest_value);
@ -251,8 +253,8 @@ gimp_config_copy_properties (GObject *src,
g_value_init (&value, prop_spec->value_type); g_value_init (&value, prop_spec->value_type);
g_object_get_property (src, prop_spec->name, &value); g_object_get_property (G_OBJECT (src), prop_spec->name, &value);
g_object_set_property (dest, prop_spec->name, &value); g_object_set_property (G_OBJECT (dest), prop_spec->name, &value);
g_value_unset (&value); g_value_unset (&value);
} }
@ -261,34 +263,37 @@ gimp_config_copy_properties (GObject *src,
g_free (property_specs); g_free (property_specs);
g_object_thaw_notify (dest); g_object_thaw_notify (G_OBJECT (dest));
} }
/** /**
* gimp_config_reset_properties: * gimp_config_reset_properties:
* @object: a #GObject * @config: a #GimpConfig
* *
* Resets all writable properties of @object to the default values as * Resets all writable properties of @object to the default values as
* defined in their #GParamSpec. * defined in their #GParamSpec.
**/ **/
void void
gimp_config_reset_properties (GObject *object) gimp_config_reset_properties (GimpConfig *config)
{ {
GObject *object;
GObjectClass *klass; GObjectClass *klass;
GParamSpec **property_specs; GParamSpec **property_specs;
GValue value = { 0, }; GValue value = { 0, };
guint n_property_specs; guint n_property_specs;
guint i; guint i;
g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (GIMP_IS_CONFIG (config));
klass = G_OBJECT_GET_CLASS (object); klass = G_OBJECT_GET_CLASS (config);
property_specs = g_object_class_list_properties (klass, &n_property_specs); property_specs = g_object_class_list_properties (klass, &n_property_specs);
if (!property_specs) if (!property_specs)
return; return;
object = G_OBJECT (config);
g_object_freeze_notify (object); g_object_freeze_notify (object);
for (i = 0; i < n_property_specs; i++) for (i = 0; i < n_property_specs; i++)
@ -305,13 +310,13 @@ gimp_config_reset_properties (GObject *object)
if ((prop_spec->flags & GIMP_PARAM_SERIALIZE) && if ((prop_spec->flags & GIMP_PARAM_SERIALIZE) &&
(prop_spec->flags & GIMP_PARAM_AGGREGATE) && (prop_spec->flags & GIMP_PARAM_AGGREGATE) &&
g_type_interface_peek (g_type_class_peek (prop_spec->value_type), g_type_interface_peek (g_type_class_peek (prop_spec->value_type),
GIMP_TYPE_CONFIG_INTERFACE)) GIMP_TYPE_CONFIG))
{ {
g_value_init (&value, prop_spec->value_type); g_value_init (&value, prop_spec->value_type);
g_object_get_property (object, prop_spec->name, &value); g_object_get_property (object, prop_spec->name, &value);
gimp_config_reset (g_value_get_object (&value)); gimp_config_reset (GIMP_CONFIG (g_value_get_object (&value)));
g_value_unset (&value); g_value_unset (&value);
} }
@ -319,8 +324,8 @@ gimp_config_reset_properties (GObject *object)
else else
{ {
g_value_init (&value, prop_spec->value_type); g_value_init (&value, prop_spec->value_type);
g_param_value_set_default (prop_spec, &value); g_param_value_set_default (prop_spec, &value);
g_object_set_property (object, prop_spec->name, &value); g_object_set_property (object, prop_spec->name, &value);
g_value_unset (&value); g_value_unset (&value);

View File

@ -23,16 +23,19 @@
#define __GIMP_CONFIG_UTILS_H__ #define __GIMP_CONFIG_UTILS_H__
GList * gimp_config_diff (GObject *a,
GObject *b,
GParamFlags flags);
void gimp_config_connect (GObject *src, void gimp_config_connect (GObject *src,
GObject *dest); GObject *dest);
void gimp_config_disconnect (GObject *src, void gimp_config_disconnect (GObject *src,
GObject *dest); GObject *dest);
void gimp_config_copy_properties (GObject *src,
GObject *dest); GList * gimp_config_diff (GimpConfig *a,
void gimp_config_reset_properties (GObject *object); GimpConfig *b,
GParamFlags flags);
void gimp_config_copy_properties (GimpConfig *src,
GimpConfig *dest);
void gimp_config_reset_properties (GimpConfig *config);
void gimp_config_string_append_escaped (GString *string, void gimp_config_string_append_escaped (GString *string,
const gchar *val); const gchar *val);

View File

@ -93,7 +93,8 @@ HELP
/* set the value in edit_config so we don't accidentially set /* set the value in edit_config so we don't accidentially set
* GIMP_PARAM_RESTART values via the PDB * GIMP_PARAM_RESTART values via the PDB
*/ */
gimp_config_add_unknown_token (G_OBJECT (gimp->edit_config), token, value); gimp_config_add_unknown_token (GIMP_CONFIG (gimp->edit_config),
token, value);
success = TRUE; success = TRUE;
} }
CODE CODE