Commit 4ad24932 authored by Michael Natterer's avatar Michael Natterer 😴

libgimpwidgets, modules: improve set_color_config() functions a bit

Don't do anything if the config doesn't change.
parent 77aedefc
......@@ -614,29 +614,32 @@ gimp_color_area_set_color_config (GimpColorArea *area,
priv = GET_PRIVATE (area);
if (priv->config)
if (config != priv->config)
{
g_signal_handlers_disconnect_by_func (priv->config,
gimp_color_area_config_notify,
area);
g_object_unref (priv->config);
if (priv->transform)
if (priv->config)
{
g_object_unref (priv->transform);
priv->transform = NULL;
g_signal_handlers_disconnect_by_func (priv->config,
gimp_color_area_config_notify,
area);
g_object_unref (priv->config);
if (priv->transform)
{
g_object_unref (priv->transform);
priv->transform = NULL;
}
}
}
priv->config = config;
priv->config = config;
if (priv->config)
{
g_object_ref (priv->config);
if (priv->config)
{
g_object_ref (priv->config);
g_signal_connect (priv->config, "notify",
G_CALLBACK (gimp_color_area_config_notify),
area);
g_signal_connect (priv->config, "notify",
G_CALLBACK (gimp_color_area_config_notify),
area);
}
}
}
......
......@@ -660,29 +660,32 @@ gimp_color_scale_set_color_config (GimpColorScale *scale,
priv = GET_PRIVATE (scale);
if (priv->config)
if (config != priv->config)
{
g_signal_handlers_disconnect_by_func (priv->config,
gimp_color_scale_config_notify,
scale);
g_object_unref (priv->config);
if (priv->transform)
if (priv->config)
{
g_object_unref (priv->transform);
priv->transform = NULL;
g_signal_handlers_disconnect_by_func (priv->config,
gimp_color_scale_config_notify,
scale);
g_object_unref (priv->config);
if (priv->transform)
{
g_object_unref (priv->transform);
priv->transform = NULL;
}
}
}
priv->config = config;
priv->config = config;
if (priv->config)
{
g_object_ref (priv->config);
if (priv->config)
{
g_object_ref (priv->config);
g_signal_connect (priv->config, "notify",
G_CALLBACK (gimp_color_scale_config_notify),
scale);
g_signal_connect (priv->config, "notify",
G_CALLBACK (gimp_color_scale_config_notify),
scale);
}
}
}
......
......@@ -1799,29 +1799,32 @@ gimp_preview_area_set_color_config (GimpPreviewArea *area,
priv = GET_PRIVATE (area);
if (priv->config)
if (config != priv->config)
{
g_signal_handlers_disconnect_by_func (priv->config,
gimp_preview_area_config_notify,
area);
g_object_unref (priv->config);
if (priv->transform)
if (priv->config)
{
g_object_unref (priv->transform);
priv->transform = NULL;
g_signal_handlers_disconnect_by_func (priv->config,
gimp_preview_area_config_notify,
area);
g_object_unref (priv->config);
if (priv->transform)
{
g_object_unref (priv->transform);
priv->transform = NULL;
}
}
}
priv->config = config;
priv->config = config;
if (priv->config)
{
g_object_ref (priv->config);
if (priv->config)
{
g_object_ref (priv->config);
g_signal_connect (priv->config, "notify",
G_CALLBACK (gimp_preview_area_config_notify),
area);
g_signal_connect (priv->config, "notify",
G_CALLBACK (gimp_preview_area_config_notify),
area);
}
}
}
......
......@@ -268,28 +268,28 @@ colorsel_cmyk_set_config (GimpColorSelector *selector,
{
ColorselCmyk *module = COLORSEL_CMYK (selector);
if (config == module->config)
return;
if (module->config)
{
g_signal_handlers_disconnect_by_func (module->config,
G_CALLBACK (colorsel_cmyk_config_changed),
module);
g_object_unref (module->config);
}
module->config = config;
if (module->config)
if (config != module->config)
{
g_object_ref (module->config);
g_signal_connect_swapped (module->config, "notify",
G_CALLBACK (colorsel_cmyk_config_changed),
module);
if (module->config)
{
g_signal_handlers_disconnect_by_func (module->config,
colorsel_cmyk_config_changed,
module);
g_object_unref (module->config);
}
module->config = config;
if (module->config)
{
g_object_ref (module->config);
g_signal_connect_swapped (module->config, "notify",
G_CALLBACK (colorsel_cmyk_config_changed),
module);
}
colorsel_cmyk_config_changed (module);
}
colorsel_cmyk_config_changed (module);
}
static void
......
......@@ -230,29 +230,32 @@ colorsel_water_set_config (GimpColorSelector *selector,
{
ColorselWater *water = COLORSEL_WATER (selector);
if (water->config)
if (config != water->config)
{
g_signal_handlers_disconnect_by_func (water->config,
colorsel_water_config_notify,
water);
g_object_unref (water->config);
if (water->transform)
if (water->config)
{
g_object_unref (water->transform);
water->transform = NULL;
g_signal_handlers_disconnect_by_func (water->config,
colorsel_water_config_notify,
water);
g_object_unref (water->config);
if (water->transform)
{
g_object_unref (water->transform);
water->transform = NULL;
}
}
}
water->config = config;
water->config = config;
if (water->config)
{
g_object_ref (water->config);
if (water->config)
{
g_object_ref (water->config);
g_signal_connect (water->config, "notify",
G_CALLBACK (colorsel_water_config_notify),
water);
g_signal_connect (water->config, "notify",
G_CALLBACK (colorsel_water_config_notify),
water);
}
}
}
......
......@@ -1462,29 +1462,32 @@ gimp_color_wheel_set_color_config (GimpColorWheel *wheel,
priv = wheel->priv;
if (priv->config)
if (config != priv->config)
{
g_signal_handlers_disconnect_by_func (priv->config,
gimp_color_wheel_config_notify,
wheel);
g_object_unref (priv->config);
if (priv->transform)
if (priv->config)
{
g_object_unref (priv->transform);
priv->transform = NULL;
g_signal_handlers_disconnect_by_func (priv->config,
gimp_color_wheel_config_notify,
wheel);
g_object_unref (priv->config);
if (priv->transform)
{
g_object_unref (priv->transform);
priv->transform = NULL;
}
}
}
priv->config = config;
priv->config = config;
if (priv->config)
{
g_object_ref (priv->config);
if (priv->config)
{
g_object_ref (priv->config);
g_signal_connect (priv->config, "notify",
G_CALLBACK (gimp_color_wheel_config_notify),
wheel);
g_signal_connect (priv->config, "notify",
G_CALLBACK (gimp_color_wheel_config_notify),
wheel);
}
}
}
......
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