[gimp] Bug 746649 - Duplicate auto-saved presets for color tools
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 746649 - Duplicate auto-saved presets for color tools
- Date: Wed, 8 Apr 2015 23:14:55 +0000 (UTC)
commit 81fa953ccbb43c843ad752cc07620452554f7ea2
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.
app/operations/gimpbrightnesscontrastconfig.c | 46 +++++++++++++++++++-----
app/operations/gimpcolorizeconfig.c | 48 ++++++++++++++++++++-----
app/operations/gimpthresholdconfig.c | 46 +++++++++++++++++++-----
3 files changed, 113 insertions(+), 27 deletions(-)
---
diff --git a/app/operations/gimpbrightnesscontrastconfig.c b/app/operations/gimpbrightnesscontrastconfig.c
index e194bb2..2d42607 100644
--- a/app/operations/gimpbrightnesscontrastconfig.c
+++ b/app/operations/gimpbrightnesscontrastconfig.c
@@ -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
@@ -83,6 +89,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)
{
}
@@ -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 */
diff --git a/app/operations/gimpcolorizeconfig.c b/app/operations/gimpcolorizeconfig.c
index 30cd700..61d6872 100644
--- a/app/operations/gimpcolorizeconfig.c
+++ b/app/operations/gimpcolorizeconfig.c
@@ -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
@@ -102,6 +108,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)
{
}
@@ -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;
+}
+
diff --git a/app/operations/gimpthresholdconfig.c b/app/operations/gimpthresholdconfig.c
index d355836..4a01b7b 100644
--- a/app/operations/gimpthresholdconfig.c
+++ b/app/operations/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_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
@@ -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)
{
}
@@ -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;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]