make it handle aggregate object properties by calling itself recursively.

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

	* app/config/gimpconfig-utils.c (gimp_config_diff): make it handle
	aggregate object properties by calling itself recursively.
This commit is contained in:
Sven Neumann 2003-10-01 12:54:58 +00:00 committed by Sven Neumann
parent 74187d7d65
commit bb044204a0
3 changed files with 63 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2003-10-01 Sven Neumann <sven@gimp.org>
* app/config/gimpconfig-utils.c (gimp_config_diff): make it handle
aggregate object properties by calling itself recursively.
2003-10-01 Sven Neumann <sven@gimp.org>
* app/text/gimptextlayout.c: pango_font_description_set_size()

View File

@ -76,8 +76,35 @@ gimp_config_diff (GObject *a,
g_object_get_property (a, param_specs[i]->name, &a_value);
g_object_get_property (b, param_specs[i]->name, &b_value);
if (g_param_values_cmp (param_specs[i], &a_value, &b_value))
list = g_list_prepend (list, param_specs[i]);
if (G_IS_PARAM_SPEC_OBJECT (param_specs[i]) &&
(param_specs[i]->flags & GIMP_PARAM_AGGREGATE))
{
GObject *a_object = g_value_get_object (&a_value);
GObject *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);

View File

@ -76,8 +76,35 @@ gimp_config_diff (GObject *a,
g_object_get_property (a, param_specs[i]->name, &a_value);
g_object_get_property (b, param_specs[i]->name, &b_value);
if (g_param_values_cmp (param_specs[i], &a_value, &b_value))
list = g_list_prepend (list, param_specs[i]);
if (G_IS_PARAM_SPEC_OBJECT (param_specs[i]) &&
(param_specs[i]->flags & GIMP_PARAM_AGGREGATE))
{
GObject *a_object = g_value_get_object (&a_value);
GObject *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);