libgimpwidgets, modules: improve set_color_config() functions a bit
Don't do anything if the config doesn't change.
This commit is contained in:
@ -268,28 +268,28 @@ colorsel_cmyk_set_config (GimpColorSelector *selector,
|
||||
{
|
||||
ColorselCmyk *module = COLORSEL_CMYK (selector);
|
||||
|
||||
if (config == module->config)
|
||||
return;
|
||||
|
||||
if (module->config)
|
||||
if (config != module->config)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (module->config,
|
||||
G_CALLBACK (colorsel_cmyk_config_changed),
|
||||
module);
|
||||
g_object_unref (module->config);
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user