mirror of https://github.com/GNOME/gimp.git
Bug 746649 - Duplicate auto-saved presets for color tools
Implement GimpConfigInterface::equal() for the brightness-contrast, colorize, and threshold config objects, to prevent the parent class' timestamp being compared by the generic default implementation.
This commit is contained in:
parent
c2998cf7ec
commit
81fa953ccb
|
@ -42,20 +42,26 @@ enum
|
|||
};
|
||||
|
||||
|
||||
static void gimp_brightness_contrast_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_brightness_contrast_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_brightness_contrast_config_iface_init (GimpConfigInterface *iface);
|
||||
|
||||
static void gimp_brightness_contrast_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_brightness_contrast_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gboolean gimp_brightness_contrast_config_equal (GimpConfig *a,
|
||||
GimpConfig *b);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GimpBrightnessContrastConfig,
|
||||
gimp_brightness_contrast_config,
|
||||
GIMP_TYPE_SETTINGS,
|
||||
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
|
||||
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
|
||||
gimp_brightness_contrast_config_iface_init))
|
||||
|
||||
#define parent_class gimp_brightness_contrast_config_parent_class
|
||||
|
||||
|
@ -82,6 +88,12 @@ gimp_brightness_contrast_config_class_init (GimpBrightnessContrastConfigClass *k
|
|||
-1.0, 1.0, 0.0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_brightness_contrast_config_iface_init (GimpConfigInterface *iface)
|
||||
{
|
||||
iface->equal = gimp_brightness_contrast_config_equal;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_brightness_contrast_config_init (GimpBrightnessContrastConfig *self)
|
||||
{
|
||||
|
@ -135,6 +147,22 @@ gimp_brightness_contrast_config_set_property (GObject *object,
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_brightness_contrast_config_equal (GimpConfig *a,
|
||||
GimpConfig *b)
|
||||
{
|
||||
GimpBrightnessContrastConfig *config_a = GIMP_BRIGHTNESS_CONTRAST_CONFIG (a);
|
||||
GimpBrightnessContrastConfig *config_b = GIMP_BRIGHTNESS_CONTRAST_CONFIG (b);
|
||||
|
||||
if (config_a->brightness != config_b->brightness ||
|
||||
config_a->contrast != config_b->contrast)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
|
|
|
@ -44,19 +44,25 @@ enum
|
|||
};
|
||||
|
||||
|
||||
static void gimp_colorize_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_colorize_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_colorize_config_iface_init (GimpConfigInterface *iface);
|
||||
|
||||
static void gimp_colorize_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_colorize_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gboolean gimp_colorize_config_equal (GimpConfig *a,
|
||||
GimpConfig *b);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GimpColorizeConfig, gimp_colorize_config,
|
||||
GIMP_TYPE_SETTINGS,
|
||||
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
|
||||
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
|
||||
gimp_colorize_config_iface_init))
|
||||
|
||||
#define parent_class gimp_colorize_config_parent_class
|
||||
|
||||
|
@ -101,6 +107,12 @@ gimp_colorize_config_class_init (GimpColorizeConfigClass *klass)
|
|||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_colorize_config_iface_init (GimpConfigInterface *iface)
|
||||
{
|
||||
iface->equal = gimp_colorize_config_equal;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_colorize_config_init (GimpColorizeConfig *self)
|
||||
{
|
||||
|
@ -201,3 +213,21 @@ gimp_colorize_config_set_property (GObject *object,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_colorize_config_equal (GimpConfig *a,
|
||||
GimpConfig *b)
|
||||
{
|
||||
GimpColorizeConfig *config_a = GIMP_COLORIZE_CONFIG (a);
|
||||
GimpColorizeConfig *config_b = GIMP_COLORIZE_CONFIG (b);
|
||||
|
||||
if (config_a->hue != config_b->hue ||
|
||||
config_a->saturation != config_b->saturation ||
|
||||
config_a->lightness != config_b->lightness)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,19 +40,25 @@ enum
|
|||
};
|
||||
|
||||
|
||||
static void gimp_threshold_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_threshold_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_threshold_config_iface_init (GimpConfigInterface *iface);
|
||||
|
||||
static void gimp_threshold_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_threshold_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gboolean gimp_threshold_config_equal (GimpConfig *a,
|
||||
GimpConfig *b);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GimpThresholdConfig, gimp_threshold_config,
|
||||
GIMP_TYPE_SETTINGS,
|
||||
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
|
||||
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
|
||||
gimp_threshold_config_iface_init))
|
||||
|
||||
#define parent_class gimp_threshold_config_parent_class
|
||||
|
||||
|
@ -79,6 +85,12 @@ gimp_threshold_config_class_init (GimpThresholdConfigClass *klass)
|
|||
0.0, 1.0, 1.0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_threshold_config_iface_init (GimpConfigInterface *iface)
|
||||
{
|
||||
iface->equal = gimp_threshold_config_equal;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_threshold_config_init (GimpThresholdConfig *self)
|
||||
{
|
||||
|
@ -131,3 +143,19 @@ gimp_threshold_config_set_property (GObject *object,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_threshold_config_equal (GimpConfig *a,
|
||||
GimpConfig *b)
|
||||
{
|
||||
GimpThresholdConfig *config_a = GIMP_THRESHOLD_CONFIG (a);
|
||||
GimpThresholdConfig *config_b = GIMP_THRESHOLD_CONFIG (b);
|
||||
|
||||
if (config_a->low != config_b->low ||
|
||||
config_a->high != config_b->high)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue