Commit 737da424 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

removed gimp_config_copy_properties() and added the more intelligent

2003-10-14  Sven Neumann  <sven@gimp.org>

	* app/config/gimpconfig-utils.[ch]: removed
	gimp_config_copy_properties() and added the more intelligent
	gimp_config_sync() instead.

	* app/config/Makefile.am
	* app/config/config-types.h
	* app/config/gimpcoreconfig.[ch]
	* app/config/gimprc-blurbs.h: replaced default image properties
	with a single GimpTemplate object property. Changed the
	set_property function to not replace aggregate objects but call
	gimp_config_sync() instead.

	* app/tools/gimptextoptions.c (gimp_text_options_set_property):
	same change here.

	* app/config/gimpconfig.[ch]: changed return value of
	gimp_config_duplicate() to gpointer to avoid some casts that only
	made the code harder to read.

	* app/widgets/gimptemplateeditor.[ch]: don't keep an internal copy
	here but edit the GimpTemplate passed when the editor was
	constructed.

	* app/gui/preferences-dialog.c: use a GimpTemplateEditor to allow
	editing of the default image paramaters.

	* app/config/gimprc.c
	* app/core/core-types.h
	* app/core/gimp.c
	* app/core/gimpimage-duplicate.c
	* app/core/gimpimage-grid.c
	* app/core/gimpimage-new.c
	* app/core/gimpimage-undo-push.c
	* app/core/gimpimage.c
	* app/core/gimptemplate.[ch]
	* app/gui/file-new-dialog.c
	* app/gui/grid-dialog.c
	* app/gui/info-window.c
	* app/gui/resize-dialog.c
	* app/gui/templates-commands.[ch]
	* app/gui/tool-options-commands.c
	* app/text/gimptextlayer.c
	* app/text/gimptextlayer.c
	* app/tools/gimptexttool.c
	* app/widgets/gimptemplateview.c
	* app/xcf/xcf-load.c: changed accordingly.
parent f0e8517e
2003-10-14 Sven Neumann <sven@gimp.org>
* app/config/gimpconfig-utils.[ch]: removed
gimp_config_copy_properties() and added the more intelligent
gimp_config_sync() instead.
* app/config/Makefile.am
* app/config/config-types.h
* app/config/gimpcoreconfig.[ch]
* app/config/gimprc-blurbs.h: replaced default image properties
with a single GimpTemplate object property. Changed the
set_property function to not replace aggregate objects but call
gimp_config_sync() instead.
* app/tools/gimptextoptions.c (gimp_text_options_set_property):
same change here.
* app/config/gimpconfig.[ch]: changed return value of
gimp_config_duplicate() to gpointer to avoid some casts that only
made the code harder to read.
* app/widgets/gimptemplateeditor.[ch]: don't keep an internal copy
here but edit the GimpTemplate passed when the editor was
constructed.
* app/gui/preferences-dialog.c: use a GimpTemplateEditor to allow
editing of the default image paramaters.
* app/config/gimprc.c
* app/core/core-types.h
* app/core/gimp.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-grid.c
* app/core/gimpimage-new.c
* app/core/gimpimage-undo-push.c
* app/core/gimpimage.c
* app/core/gimptemplate.[ch]
* app/gui/file-new-dialog.c
* app/gui/grid-dialog.c
* app/gui/info-window.c
* app/gui/resize-dialog.c
* app/gui/templates-commands.[ch]
* app/gui/tool-options-commands.c
* app/text/gimptextlayer.c
* app/text/gimptextlayer.c
* app/tools/gimptexttool.c
* app/widgets/gimptemplateview.c
* app/xcf/xcf-load.c: changed accordingly.
2003-10-14 Sven Neumann <sven@gimp.org>
* app/widgets/gimpgrideditor.[ch]: removed "grid_changed" signal.
......@@ -26,6 +26,7 @@
#include "config/gimpconfig.h"
#include "config/gimpconfig-utils.h"
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
......@@ -96,20 +97,12 @@ static void
templates_new_template_ok_callback (GtkWidget *widget,
GtkWidget *dialog)
{
GimpTemplateEditor *editor;
GimpTemplate *template;
Gimp *gimp;
GimpTemplate *template;
Gimp *gimp;
editor = g_object_get_data (G_OBJECT (dialog), "gimp-template-editor");
template = g_object_get_data (G_OBJECT (dialog), "gimp-template");
gimp = g_object_get_data (G_OBJECT (dialog), "gimp");
gimp_config_copy_properties (GIMP_CONFIG (editor->template),
GIMP_CONFIG (template));
gimp_list_uniquefy_name (GIMP_LIST (gimp->templates),
GIMP_OBJECT (template), TRUE);
gimp_container_add (gimp->templates, GIMP_OBJECT (template));
gimp_context_set_template (gimp_get_user_context (gimp), template);
......@@ -117,18 +110,13 @@ templates_new_template_ok_callback (GtkWidget *widget,
}
void
templates_new_template_dialog (Gimp *gimp,
GimpTemplate *template_template)
templates_new_template_dialog (Gimp *gimp)
{
GimpTemplate *template;
GtkWidget *dialog;
GtkWidget *main_vbox;
GtkWidget *editor;
template = gimp_template_new (_("Unnamed"));
gimp_template_set_from_config (template, gimp->config);
dialog =
gimp_viewable_dialog_new (NULL,
_("New Template"), "new_template",
......@@ -154,18 +142,18 @@ templates_new_template_dialog (Gimp *gimp,
TRUE, TRUE, 0);
gtk_widget_show (main_vbox);
editor = gimp_template_editor_new (gimp, TRUE);
gtk_box_pack_start (GTK_BOX (main_vbox), editor, FALSE, FALSE, 0);
gtk_widget_show (editor);
template = gimp_config_duplicate (GIMP_CONFIG (gimp->config->default_image));
gimp_object_set_name (GIMP_OBJECT (template), _("Unnamed"));
gimp_template_editor_set_template (GIMP_TEMPLATE_EDITOR (editor),
template);
editor = gimp_template_editor_new (template, gimp, TRUE);
g_object_set_data (G_OBJECT (dialog), "gimp-template-editor", editor);
g_object_set_data (G_OBJECT (dialog), "gimp", gimp);
g_object_unref (template);
g_object_set_data (G_OBJECT (dialog), "gimp", gimp);
g_object_set_data (G_OBJECT (dialog), "gimp-template", template);
g_object_set_data_full (G_OBJECT (dialog), "gimp-template", template,
(GDestroyNotify) g_object_unref);
gtk_box_pack_start (GTK_BOX (main_vbox), editor, FALSE, FALSE, 0);
gtk_widget_show (editor);
gtk_widget_show (dialog);
}
......@@ -182,8 +170,8 @@ templates_edit_template_ok_callback (GtkWidget *widget,
template = g_object_get_data (G_OBJECT (dialog), "gimp-template");
gimp = g_object_get_data (G_OBJECT (dialog), "gimp");
gimp_config_copy_properties (GIMP_CONFIG (editor->template),
GIMP_CONFIG (template));
gimp_config_sync (GIMP_CONFIG (editor->template), GIMP_CONFIG (template), 0);
gimp_list_uniquefy_name (GIMP_LIST (gimp->templates),
GIMP_OBJECT (template), TRUE);
......@@ -221,16 +209,19 @@ templates_edit_template_dialog (Gimp *gimp,
TRUE, TRUE, 0);
gtk_widget_show (main_vbox);
editor = gimp_template_editor_new (gimp, TRUE);
g_object_set_data (G_OBJECT (dialog), "gimp", gimp);
g_object_set_data (G_OBJECT (dialog), "gimp-template", template);
template = gimp_config_duplicate (GIMP_CONFIG (template));
editor = gimp_template_editor_new (template, gimp, TRUE);
g_object_unref (template);
gtk_box_pack_start (GTK_BOX (main_vbox), editor, FALSE, FALSE, 0);
gtk_widget_show (editor);
gimp_template_editor_set_template (GIMP_TEMPLATE_EDITOR (editor),
template);
g_object_set_data (G_OBJECT (dialog), "gimp-template-editor", editor);
g_object_set_data (G_OBJECT (dialog), "gimp-template", template);
g_object_set_data (G_OBJECT (dialog), "gimp", gimp);
gtk_widget_show (dialog);
}
......
......@@ -31,8 +31,7 @@ void templates_create_image_cmd_callback (GtkWidget *widget,
void templates_delete_template_cmd_callback (GtkWidget *widget,
gpointer data);
void templates_new_template_dialog (Gimp *gimp,
GimpTemplate *template);
void templates_new_template_dialog (Gimp *gimp);
void templates_edit_template_dialog (Gimp *gimp,
GimpTemplate *template);
void templates_file_new_dialog (Gimp *gimp,
......
......@@ -66,8 +66,8 @@ tool_options_save_to_cmd_callback (GtkWidget *widget,
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (options)));
gimp_config_copy_properties (GIMP_CONFIG (options->tool_info->tool_options),
GIMP_CONFIG (options));
gimp_config_sync (GIMP_CONFIG (options->tool_info->tool_options),
GIMP_CONFIG (options), 0);
gimp_object_set_name (GIMP_OBJECT (options), name);
g_free (name);
......@@ -105,8 +105,8 @@ tool_options_restore_from_cmd_callback (GtkWidget *widget,
{
GimpToolOptions *options = GIMP_TOOL_OPTIONS (data);
gimp_config_copy_properties (GIMP_CONFIG (options),
GIMP_CONFIG (options->tool_info->tool_options));
gimp_config_sync (GIMP_CONFIG (options),
GIMP_CONFIG (options->tool_info->tool_options), 0);
}
void
......
......@@ -52,6 +52,7 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/app \
$(GLIB_CFLAGS) \
$(GDK_PIXBUF_CFLAGS) \
-I$(includedir)
......
......@@ -37,6 +37,7 @@ typedef struct _GimpConfigWriter GimpConfigWriter;
typedef struct _GimpXmlParser GimpXmlParser;
typedef struct _GimpGrid GimpGrid;
typedef struct _GimpTemplate GimpTemplate;
#endif /* __CONFIG_TYPES_H__ */
......@@ -34,89 +34,6 @@
#include "gimpconfig-utils.h"
/**
* gimp_config_diff:
* @a: a #GimpConfig
* @b: another #GimpConfig of the same type as @a
* @flags: a mask of GParamFlags
*
* Compares all properties of @a and @b that have all @flags set. If
* @flags is 0, all properties are compared.
*
* Return value: a GList of differing GParamSpecs.
**/
GList *
gimp_config_diff (GimpConfig *a,
GimpConfig *b,
GParamFlags flags)
{
GParamSpec **param_specs;
guint n_param_specs;
gint i;
GList *list = NULL;
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),
FALSE);
param_specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (a),
&n_param_specs);
for (i = 0; i < n_param_specs; i++)
{
if (! flags || ((param_specs[i]->flags & flags) == flags))
{
GValue a_value = { 0, };
GValue b_value = { 0, };
g_value_init (&a_value, param_specs[i]->value_type);
g_value_init (&b_value, param_specs[i]->value_type);
g_object_get_property (G_OBJECT (a), param_specs[i]->name, &a_value);
g_object_get_property (G_OBJECT (b), param_specs[i]->name, &b_value);
if (G_IS_PARAM_SPEC_OBJECT (param_specs[i]) &&
(param_specs[i]->flags & GIMP_PARAM_AGGREGATE))
{
GimpConfig *a_object = g_value_get_object (&a_value);
GimpConfig *b_object = g_value_get_object (&b_value);
if (a_object && b_object &&
G_TYPE_FROM_INSTANCE (a_object) ==
G_TYPE_FROM_INSTANCE (b_object))
{
GList *diff = gimp_config_diff (a_object, b_object, flags);
if (diff)
{
g_list_free (diff);
list = g_list_prepend (list, param_specs[i]);
}
}
else
{
list = g_list_prepend (list, param_specs[i]);
}
}
else
{
if (g_param_values_cmp (param_specs[i], &a_value, &b_value))
list = g_list_prepend (list, param_specs[i]);
}
g_value_unset (&a_value);
g_value_unset (&b_value);
}
}
g_free (param_specs);
return g_list_reverse (list);
}
static void
gimp_config_connect_notify (GObject *src,
GParamSpec *param_spec,
......@@ -137,6 +54,7 @@ gimp_config_connect_notify (GObject *src,
}
}
/**
* gimp_config_connect:
* @src: a #GObject
......@@ -179,91 +97,107 @@ gimp_config_disconnect (GObject *src,
}
/**
* gimp_config_copy_properties:
* @src: a #GimpConfig
* @dest: another #GimpConfig of the same type as @src
* gimp_config_diff:
* @a: a #GimpConfig
* @b: another #GimpConfig of the same type as @a
* @flags: a mask of GParamFlags
*
* Retrieves all read and writeable property settings from @src and
* applies the values to @dest.
* Compares all properties of @a and @b that have all @flags set. If
* @flags is 0, all properties are compared.
*
* Return value: a GList of differing GParamSpecs.
**/
void
gimp_config_copy_properties (GimpConfig *src,
GimpConfig *dest)
GList *
gimp_config_diff (GimpConfig *a,
GimpConfig *b,
GParamFlags flags)
{
GObjectClass *klass;
GParamSpec **property_specs;
guint n_property_specs;
guint i;
GParamSpec **param_specs;
guint n_param_specs;
gint i;
GList *list = NULL;
g_return_if_fail (GIMP_IS_CONFIG (src));
g_return_if_fail (GIMP_IS_CONFIG (dest));
g_return_if_fail (G_TYPE_FROM_INSTANCE (src) == G_TYPE_FROM_INSTANCE (dest));
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_TYPE_FROM_INSTANCE (a) == G_TYPE_FROM_INSTANCE (b),
FALSE);
klass = G_OBJECT_GET_CLASS (src);
param_specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (a),
&n_param_specs);
property_specs = g_object_class_list_properties (klass, &n_property_specs);
for (i = 0; i < n_param_specs; i++)
{
if (! flags || ((param_specs[i]->flags & flags) == flags))
{
GValue a_value = { 0, };
GValue b_value = { 0, };
if (!property_specs)
return;
g_value_init (&a_value, param_specs[i]->value_type);
g_value_init (&b_value, param_specs[i]->value_type);
g_object_get_property (G_OBJECT (a), param_specs[i]->name, &a_value);
g_object_get_property (G_OBJECT (b), param_specs[i]->name, &b_value);
g_object_freeze_notify (G_OBJECT (dest));
if (g_param_values_cmp (param_specs[i], &a_value, &b_value))
list = g_list_prepend (list, param_specs[i]);
for (i = 0; i < n_property_specs; i++)
{
GParamSpec *prop_spec;
g_value_unset (&a_value);
g_value_unset (&b_value);
}
}
prop_spec = property_specs[i];
g_free (param_specs);
if ((prop_spec->flags & G_PARAM_READABLE) &&
(prop_spec->flags & G_PARAM_WRITABLE) &&
! (prop_spec->flags & G_PARAM_CONSTRUCT_ONLY))
{
if (G_IS_PARAM_SPEC_OBJECT (prop_spec) &&
(prop_spec->flags & GIMP_PARAM_AGGREGATE))
{
GValue src_value = { 0, };
GValue dest_value = { 0, };
GimpConfig *src_object;
GimpConfig *dest_object;
return g_list_reverse (list);
}
g_value_init (&src_value, prop_spec->value_type);
g_value_init (&dest_value, prop_spec->value_type);
/**
* gimp_config_sync:
* @src: a #GimpConfig
* @dest: another #GimpConfig of the same type as @src
* @flags: a mask of GParamFlags
*
* Compares all read and writeable property settings from @src and @dest
* that have all @flags set. Differing values are then copied from @src
* to @dest. If @flags is 0, all read/write properties are synced.
**/
gboolean
gimp_config_sync (GimpConfig *src,
GimpConfig *dest,
GParamFlags flags)
{
GList *diff;
GList *list;
g_object_get_property (G_OBJECT (src),
prop_spec->name, &src_value);
g_object_get_property (G_OBJECT (dest),
prop_spec->name, &dest_value);
g_return_val_if_fail (GIMP_IS_CONFIG (src), FALSE);
g_return_val_if_fail (GIMP_IS_CONFIG (dest), FALSE);
g_return_val_if_fail (G_TYPE_FROM_INSTANCE (src) == G_TYPE_FROM_INSTANCE (dest),
FALSE);
src_object = g_value_get_object (&src_value);
dest_object = g_value_get_object (&dest_value);
diff = gimp_config_diff (src, dest, (flags | G_PARAM_READWRITE));
if (!diff)
return FALSE;
if (src_object && dest_object &&
G_TYPE_FROM_INSTANCE (src_object) ==
G_TYPE_FROM_INSTANCE (dest_object))
{
gimp_config_copy_properties (src_object, dest_object);
}
for (list = diff; list; list = list->next)
{
GParamSpec *prop_spec = list->data;
g_value_unset (&src_value);
g_value_unset (&dest_value);
}
else
{
GValue value = { 0, };
if (! (prop_spec->flags & G_PARAM_CONSTRUCT_ONLY))
{
GValue value = { 0, };
g_value_init (&value, prop_spec->value_type);
g_value_init (&value, prop_spec->value_type);
g_object_get_property (G_OBJECT (src), prop_spec->name, &value);
g_object_set_property (G_OBJECT (dest), prop_spec->name, &value);
g_object_get_property (G_OBJECT (src), prop_spec->name, &value);
g_object_set_property (G_OBJECT (dest), prop_spec->name, &value);
g_value_unset (&value);
}
g_value_unset (&value);
}
}
g_free (property_specs);
g_list_free (diff);
g_object_thaw_notify (G_OBJECT (dest));
return TRUE;
}
/**
......
......@@ -31,8 +31,10 @@ void gimp_config_disconnect (GObject *src,
GList * gimp_config_diff (GimpConfig *a,
GimpConfig *b,
GParamFlags flags);
void gimp_config_copy_properties (GimpConfig *src,
GimpConfig *dest);
gboolean gimp_config_sync (GimpConfig *src,
GimpConfig *dest,
GParamFlags flags);
void gimp_config_reset_properties (GimpConfig *config);
void gimp_config_string_append_escaped (GString *string,
......
......@@ -160,7 +160,7 @@ gimp_config_iface_duplicate (GimpConfig *config)
g_free (construct_params);
gimp_config_copy_properties (config, dup);
gimp_config_sync (config, dup, 0);
return dup;
}
......@@ -427,9 +427,9 @@ gimp_config_deserialize_return (GScanner *scanner,
* only works for objects that are completely defined by their
* properties.
*
* Return value: the duplicated #GObject.
* Return value: the duplicated #GimpConfig object
**/
GimpConfig *
gpointer
gimp_config_duplicate (GimpConfig *config)
{
g_return_val_if_fail (GIMP_IS_CONFIG (config), NULL);
......
......@@ -88,7 +88,7 @@ gboolean gimp_config_deserialize_return (GScanner *scanner,
GTokenType expected_token,
gint nest_level);
GimpConfig * gimp_config_duplicate (GimpConfig *config);
gpointer gimp_config_duplicate (GimpConfig *config);
gboolean gimp_config_is_equal_to (GimpConfig *a,
GimpConfig *b);
void gimp_config_reset (GimpConfig *config);
......
......@@ -27,12 +27,11 @@
#include "config-types.h"
#ifdef __GNUC__
#warning FIXME #include "core/core-types.h"
#endif
#include "core/core-types.h"
#include "core/gimpgrid.h"
#include "core/gimptemplate.h"
#include "gimpconfig.h"
#include "gimpconfig-params.h"
#include "gimpconfig-types.h"
#include "gimpconfig-utils.h"
......@@ -43,20 +42,24 @@
#include "gimp-intl.h"
static void gimp_core_config_class_init (GimpCoreConfigClass *klass);
static void gimp_core_config_init (GObject *object);
static void gimp_core_config_finalize (GObject *object);
static void gimp_core_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_core_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_core_config_default_grid_changed (GObject *object,
GParamSpec *pspec,
gpointer data);
static void gimp_core_config_class_init (GimpCoreConfigClass *klass);
static void gimp_core_config_init (GimpCoreConfig *config);
static void gimp_core_config_finalize (GObject *object);
static void gimp_core_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_core_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_core_config_default_image_changed (GObject *object,
GParamSpec *pspec,
gpointer data);
static void gimp_core_config_default_grid_changed (GObject *object,
GParamSpec *pspec,
gpointer data);
#define DEFAULT_BRUSH "Circle (11)"
#define DEFAULT_PATTERN "Pine"
......@@ -81,16 +84,10 @@ enum
PROP_DEFAULT_PATTERN,
PROP_DEFAULT_PALETTE,
PROP_DEFAULT_GRADIENT,
PROP_DEFAULT_GRID,
PROP_DEFAULT_FONT,
PROP_DEFAULT_IMAGE,
PROP_DEFAULT_COMMENT,
PROP_DEFAULT_IMAGE_TYPE,
PROP_DEFAULT_IMAGE_WIDTH,
PROP_DEFAULT_IMAGE_HEIGHT,
PROP_DEFAULT_UNIT,
PROP_DEFAULT_XRESOLUTION,
PROP_DEFAULT_YRESOLUTION,
PROP_DEFAULT_RESOLUTION_UNIT,
PROP_DEFAULT_GRID,
PROP_UNDO_LEVELS,
PROP_UNDO_SIZE,
PROP_PLUGINRC_PATH,
......@@ -208,54 +205,22 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
"default-gradient", DEFAULT_GRADIENT_BLURB,
DEFAULT_GRADIENT,
0);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_DEFAULT_GRID,
"default-grid", DEFAULT_GRID_BLURB,
GIMP_TYPE_GRID,
GIMP_PARAM_AGGREGATE);
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_DEFAULT_FONT,
"default-font", DEFAULT_FONT_BLURB,
DEFAULT_FONT,
0);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_DEFAULT_IMAGE,
"default-image", DEFAULT_IMAGE_BLURB,
GIMP_TYPE_TEMPLATE,
GIMP_PARAM_AGGREGATE);
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_DEFAULT_COMMENT,
"default-comment", DEFAULT_COMMENT_BLURB,
DEFAULT_COMMENT,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_DEFAULT_IMAGE_TYPE,
"default-image-type",
DEFAULT_IMAGE_TYPE_BLURB,
GIMP_TYPE_IMAGE_BASE_TYPE, GIMP_RGB,
0);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_DEFAULT_IMAGE_WIDTH,
"default-image-width",
DEFAULT_IMAGE_WIDTH_BLURB,
1, 0x8000, 256,
0);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_DEFAULT_IMAGE_HEIGHT,
"default-image-height",
DEFAULT_IMAGE_HEIGHT_BLURB,
1, 0x8000, 256,
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_DEFAULT_UNIT,
"default-unit", DEFAULT_UNIT_BLURB,
FALSE, FALSE, GIMP_UNIT_INCH,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_DEFAULT_XRESOLUTION,
"default-xresolution",
DEFAULT_XRESOLUTION_BLURB,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION,
72.0,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_DEFAULT_YRESOLUTION,
"default-yresolution",
DEFAULT_YRESOLUTION_BLURB,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION,
72.0,
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_DEFAULT_RESOLUTION_UNIT,
"default-resolution-unit",
DEFAULT_RESOLUTION_UNIT_BLURB,
FALSE, FALSE, GIMP_UNIT_INCH,
0);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_DEFAULT_GRID,
"default-grid", DEFAULT_GRID_BLURB,
GIMP_TYPE_GRID,
GIMP_PARAM_AGGREGATE);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_UNDO_LEVELS,
"undo-levels", UNDO_LEVELS_BLURB,
0, G_MAXINT, 5,
......@@ -300,16 +265,17 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
}
static void
gimp_core_config_init (GObject *object)
gimp_core_config_init (GimpCoreConfig *config)
{
GimpCoreConfig *core_config;
config->default_image = g_object_new (GIMP_TYPE_TEMPLATE, NULL);
g_signal_connect (config->default_image, "notify",
G_CALLBACK (gimp_core_config_default_image_changed),
config);
core_config = GIMP_CORE_CONFIG (object);
core_config->default_grid = g_object_new (GIMP_TYPE_GRID, NULL);
g_signal_connect (core_config->default_grid, "notify",
config->default_grid = g_object_new (GIMP_TYPE_GRID, NULL);
g_signal_connect (config->default_grid, "notify",
G_CALLBACK (gimp_core_config_default_grid_changed),
core_config);
config);
}
static void
......@@ -335,11 +301,11 @@ gimp_core_config_finalize (GObject *object)
g_free (core_config->default_comment);
g_free (core_config->plug_in_rc_path);
if (core_config->default_image)
g_object_unref (core_config->default_image);
if (core_config->default_grid)
{
g_object_unref (core_config->default_grid);
core_config->default_grid = NULL;
}
g_object_unref (core_config->default_grid);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......@@ -407,38 +373,23 @@ gimp_core_config_set_property (GObject *object,
g_free (core_config->default_gradient);
core_config->default_gradient = g_value_dup_string (value);
break;
case PROP_DEFAULT_GRID:
g_object_unref (core_config->default_grid);
core_config->default_grid = GIMP_GRID (g_value_dup_object (value));
break;
case PROP_DEFAULT_FONT:
g_free (core_config->default_font);
core_config->default_font = g_value_dup_string (value);
break;