[gimp/gimp-2-8] Bug 746649 - Duplicate auto-saved presets for color tools
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 746649 - Duplicate auto-saved presets for color tools
- Date: Wed, 8 Apr 2015 23:24:32 +0000 (UTC)
commit 009a7b10cee9a851b2272e6cda7783fe2c29d211
Author: Michael Natterer <mitch gimp org>
Date: Thu Apr 9 01:12:43 2015 +0200
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.
(cherry picked from commit 81fa953ccbb43c843ad752cc07620452554f7ea2)
app/gegl/gimpbrightnesscontrastconfig.c | 46 +++++++++++++++++++++++------
app/gegl/gimpcolorizeconfig.c | 48 +++++++++++++++++++++++++------
app/gegl/gimpthresholdconfig.c | 46 +++++++++++++++++++++++------
3 files changed, 113 insertions(+), 27 deletions(-)
---
diff --git a/app/gegl/gimpbrightnesscontrastconfig.c b/app/gegl/gimpbrightnesscontrastconfig.c
index 7354420..5a266d4 100644
--- a/app/gegl/gimpbrightnesscontrastconfig.c
+++ b/app/gegl/gimpbrightnesscontrastconfig.c
@@ -39,20 +39,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_IMAGE_MAP_CONFIG,
- 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
@@ -80,6 +86,12 @@ gimp_brightness_contrast_config_class_init (GimpBrightnessContrastConfigClass *k
}
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)
{
}
@@ -132,6 +144,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 */
diff --git a/app/gegl/gimpcolorizeconfig.c b/app/gegl/gimpcolorizeconfig.c
index 5d31bfe..2dd10ec 100644
--- a/app/gegl/gimpcolorizeconfig.c
+++ b/app/gegl/gimpcolorizeconfig.c
@@ -41,19 +41,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_IMAGE_MAP_CONFIG,
- 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
@@ -86,6 +92,12 @@ gimp_colorize_config_class_init (GimpColorizeConfigClass *klass)
}
static void
+gimp_colorize_config_iface_init (GimpConfigInterface *iface)
+{
+ iface->equal = gimp_colorize_config_equal;
+}
+
+static void
gimp_colorize_config_init (GimpColorizeConfig *self)
{
}
@@ -162,3 +174,21 @@ gimp_colorize_config_to_cruft (GimpColorizeConfig *config,
colorize_calculate (cruft);
}
+
+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;
+}
+
diff --git a/app/gegl/gimpthresholdconfig.c b/app/gegl/gimpthresholdconfig.c
index 8892f8d..db28d6c 100644
--- a/app/gegl/gimpthresholdconfig.c
+++ b/app/gegl/gimpthresholdconfig.c
@@ -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_IMAGE_MAP_CONFIG,
- 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
@@ -80,6 +86,12 @@ gimp_threshold_config_class_init (GimpThresholdConfigClass *klass)
}
static void
+gimp_threshold_config_iface_init (GimpConfigInterface *iface)
+{
+ iface->equal = gimp_threshold_config_equal;
+}
+
+static void
gimp_threshold_config_init (GimpThresholdConfig *self)
{
}
@@ -132,6 +144,22 @@ gimp_threshold_config_set_property (GObject *object,
}
}
+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;
+}
+
/* temp cruft */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]