Commit 7111eadf authored by Michael Natterer's avatar Michael Natterer 😴
Browse files

libgimpconfig: gimp_config_reset_properties(): reset only changed properties

This avoids a lot of useless notifications when resetting an object,
and fixes e.g. the "reset tool options" behavior of GimpTransformTool,
which did completely reset itself instead of just behaving like all
non-default options had changed.

And probably breaks some things that were relying on these redundant
notifications.
parent b7d3c4b7
......@@ -266,7 +266,6 @@ gimp_config_reset_properties (GObject *object)
{
GObjectClass *klass;
GParamSpec **property_specs;
GValue value = G_VALUE_INIT;
guint n_property_specs;
guint i;
......@@ -283,6 +282,7 @@ gimp_config_reset_properties (GObject *object)
for (i = 0; i < n_property_specs; i++)
{
GParamSpec *prop_spec;
GValue value = G_VALUE_INIT;
prop_spec = property_specs[i];
......@@ -307,12 +307,22 @@ gimp_config_reset_properties (GObject *object)
}
else
{
g_value_init (&value, prop_spec->value_type);
g_param_value_set_default (prop_spec, &value);
GValue default_value = G_VALUE_INIT;
g_value_init (&default_value, prop_spec->value_type);
g_value_init (&value, prop_spec->value_type);
g_param_value_set_default (prop_spec, &default_value);
g_object_get_property (object, prop_spec->name, &value);
g_object_set_property (object, prop_spec->name, &value);
if (g_param_values_cmp (prop_spec, &default_value, &value))
{
g_object_set_property (object, prop_spec->name,
&default_value);
}
g_value_unset (&value);
g_value_unset (&default_value);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment