diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c index a455a9d8a0..6a77e8d866 100644 --- a/app/tools/gimpcurvestool.c +++ b/app/tools/gimpcurvestool.c @@ -785,12 +785,7 @@ gimp_curves_tool_config_notify (GObject *object, gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->yrange), config->channel); - gimp_curve_view_remove_background (GIMP_CURVE_VIEW (tool->graph), - config->curve[GIMP_HISTOGRAM_RED]); - gimp_curve_view_remove_background (GIMP_CURVE_VIEW (tool->graph), - config->curve[GIMP_HISTOGRAM_GREEN]); - gimp_curve_view_remove_background (GIMP_CURVE_VIEW (tool->graph), - config->curve[GIMP_HISTOGRAM_BLUE]); + gimp_curve_view_remove_all_backgrounds (GIMP_CURVE_VIEW (tool->graph)); gimp_rgb_set (&red, 1.0, 0.0, 0.0); gimp_rgb_set (&green, 0.0, 1.0, 0.0); diff --git a/app/widgets/gimpcurveview.c b/app/widgets/gimpcurveview.c index 97706c3cc5..2e31dc1ad7 100644 --- a/app/widgets/gimpcurveview.c +++ b/app/widgets/gimpcurveview.c @@ -1188,6 +1188,27 @@ gimp_curve_view_remove_background (GimpCurveView *view, } } +void +gimp_curve_view_remove_all_backgrounds (GimpCurveView *view) +{ + GList *list; + + g_return_if_fail (GIMP_IS_CURVE_VIEW (view)); + + for (list = view->bg_curves; list; list = g_list_next (list)) + { + BGCurve *bg = list->data; + + g_object_unref (bg->curve); + + view->bg_curves = g_list_remove (view->bg_curves, bg); + + g_slice_free (BGCurve, bg); + } + + gtk_widget_queue_draw (GTK_WIDGET (view)); +} + void gimp_curve_view_set_selected (GimpCurveView *view, gint selected) diff --git a/app/widgets/gimpcurveview.h b/app/widgets/gimpcurveview.h index 1fe6a4a51f..58a3de0362 100644 --- a/app/widgets/gimpcurveview.h +++ b/app/widgets/gimpcurveview.h @@ -93,6 +93,8 @@ void gimp_curve_view_add_background (GimpCurveView *view, void gimp_curve_view_remove_background (GimpCurveView *view, GimpCurve *curve); +void gimp_curve_view_remove_all_backgrounds (GimpCurveView *view); + void gimp_curve_view_set_selected (GimpCurveView *view, gint selected); void gimp_curve_view_set_range_x (GimpCurveView *view,