app: apply "trc" setting when repeating curves and levels

In gimp_operation_config_sync_node(), when the operation has a
property of the config object's type, don't skip the other
properties.  This makes sure to set the "trc" property of
GimpOperation{Curves,Levels} according to the config object.  We'd
previously done it manually in GimpFilterTool, but the setting was
not applied when repeating the filter.
This commit is contained in:
Ell 2020-04-13 01:51:40 +03:00
parent 202012ba73
commit 0096e563f6
3 changed files with 11 additions and 35 deletions

View File

@ -340,31 +340,23 @@ gimp_operation_config_sync_node (GObject *config,
pspecs = gegl_operation_list_properties (operation, &n_pspecs);
g_free (operation);
for (i = 0; i < n_pspecs; i++)
{
GParamSpec *pspec = pspecs[i];
/* if the operation has an object property of the config's
* type, set it and done
*/
if (G_IS_PARAM_SPEC_OBJECT (pspec) &&
pspec->value_type == G_TYPE_FROM_INSTANCE (config))
{
gegl_node_set (node,
pspec->name, config,
NULL);
g_free (pspecs);
return;
}
}
for (i = 0; i < n_pspecs; i++)
{
GParamSpec *gegl_pspec = pspecs[i];
GParamSpec *gimp_pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config),
gegl_pspec->name);
if (gimp_pspec)
/* if the operation has an object property of the config's
* type, use the config object directly
*/
if (G_IS_PARAM_SPEC_OBJECT (gegl_pspec) &&
gegl_pspec->value_type == G_TYPE_FROM_INSTANCE (config))
{
gegl_node_set (node,
gegl_pspec->name, config,
NULL);
}
else if (gimp_pspec)
{
GValue value = G_VALUE_INIT;

View File

@ -211,10 +211,6 @@ gimp_curves_tool_initialize (GimpTool *tool,
config = GIMP_CURVES_CONFIG (filter_tool->config);
gegl_node_set (filter_tool->operation,
"trc", config->trc,
NULL);
histogram = gimp_histogram_new (config->trc);
g_object_unref (gimp_drawable_calculate_histogram_async (drawable, histogram,
FALSE));
@ -744,10 +740,6 @@ gimp_curves_tool_config_notify (GimpFilterTool *filter_tool,
{
GimpHistogram *histogram;
gegl_node_set (filter_tool->operation,
"trc", curves_config->trc,
NULL);
histogram = gimp_histogram_new (curves_config->trc);
g_object_unref (gimp_drawable_calculate_histogram_async
(GIMP_TOOL (filter_tool)->drawable, histogram, FALSE));

View File

@ -201,10 +201,6 @@ gimp_levels_tool_initialize (GimpTool *tool,
config = GIMP_LEVELS_CONFIG (filter_tool->config);
gegl_node_set (filter_tool->operation,
"trc", config->trc,
NULL);
g_clear_object (&l_tool->histogram);
g_clear_object (&l_tool->histogram_async);
l_tool->histogram = gimp_histogram_new (config->trc);
@ -678,10 +674,6 @@ gimp_levels_tool_config_notify (GimpFilterTool *filter_tool,
if (! strcmp (pspec->name, "trc"))
{
gegl_node_set (filter_tool->operation,
"trc", levels_config->trc,
NULL);
g_clear_object (&levels_tool->histogram);
g_clear_object (&levels_tool->histogram_async);
levels_tool->histogram = gimp_histogram_new (levels_config->trc);