[gimp] app: use the new GIMP_CONFIG_PROP_FOO()



commit 18316c41a5c926ce4f2397f017222f83182cb791
Author: Michael Natterer <mitch gimp org>
Date:   Tue Feb 9 23:37:29 2016 +0100

    app: use the new GIMP_CONFIG_PROP_FOO()
    
    instead of manual g_object_class_install_property().

 app/core/gimpsymmetry-mandala.c          |   32 +++++------
 app/core/gimpsymmetry-mirror.c           |   66 +++++++++++-------------
 app/core/gimpsymmetry-tiling.c           |   83 ++++++++++++++----------------
 app/operations/gimpoperationdesaturate.c |   14 +++---
 app/operations/gimpoperationposterize.c  |   12 ++--
 app/operations/gimpoperationthreshold.c  |   26 +++++-----
 6 files changed, 111 insertions(+), 122 deletions(-)
---
diff --git a/app/core/gimpsymmetry-mandala.c b/app/core/gimpsymmetry-mandala.c
index de221f2..0d99c64 100644
--- a/app/core/gimpsymmetry-mandala.c
+++ b/app/core/gimpsymmetry-mandala.c
@@ -124,23 +124,21 @@ gimp_mandala_class_init (GimpMandalaClass *klass)
                                    0.0, 10000.0, 0.0,
                                    GIMP_PARAM_STATIC_STRINGS);
 
-  g_object_class_install_property (object_class, PROP_SIZE,
-                                   g_param_spec_int ("size",
-                                                     _("Number of points"),
-                                                     _("Number of points"),
-                                                     1, 100, 6.0,
-                                                     GIMP_CONFIG_PARAM_FLAGS |
-                                                     GIMP_PARAM_STATIC_STRINGS |
-                                                     GIMP_SYMMETRY_PARAM_GUI));
-
-  g_object_class_install_property (object_class, PROP_DISABLE_TRANSFORMATION,
-                                   g_param_spec_boolean ("disable-transformation",
-                                                         _("Disable brush transform"),
-                                                         _("Disable brush transformation (faster)"),
-                                                         FALSE,
-                                                         GIMP_CONFIG_PARAM_FLAGS |
-                                                         GIMP_PARAM_STATIC_STRINGS |
-                                                         GIMP_SYMMETRY_PARAM_GUI));
+  GIMP_CONFIG_PROP_INT (object_class, PROP_SIZE,
+                        "size",
+                        _("Number of points"),
+                        _("Number of points"),
+                        1, 100, 6.0,
+                        GIMP_PARAM_STATIC_STRINGS |
+                        GIMP_SYMMETRY_PARAM_GUI);
+
+  GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_DISABLE_TRANSFORMATION,
+                            "disable-transformation",
+                            _("Disable brush transform"),
+                            _("Disable brush transformation (faster)"),
+                            FALSE,
+                            GIMP_PARAM_STATIC_STRINGS |
+                            GIMP_SYMMETRY_PARAM_GUI);
 }
 
 static void
diff --git a/app/core/gimpsymmetry-mirror.c b/app/core/gimpsymmetry-mirror.c
index 11954b7..1401a00 100644
--- a/app/core/gimpsymmetry-mirror.c
+++ b/app/core/gimpsymmetry-mirror.c
@@ -117,41 +117,37 @@ gimp_mirror_class_init (GimpMirrorClass *klass)
   symmetry_class->active_changed    = gimp_mirror_active_changed;
 
   /* Properties for user settings */
-  g_object_class_install_property (object_class, PROP_HORIZONTAL_SYMMETRY,
-                                   g_param_spec_boolean ("horizontal-symmetry",
-                                                         _("Horizontal Mirror"),
-                                                         NULL,
-                                                         FALSE,
-                                                         GIMP_CONFIG_PARAM_FLAGS |
-                                                         GIMP_PARAM_STATIC_STRINGS |
-                                                         GIMP_SYMMETRY_PARAM_GUI));
-
-  g_object_class_install_property (object_class, PROP_VERTICAL_SYMMETRY,
-                                   g_param_spec_boolean ("vertical-symmetry",
-                                                         _("Vertical Mirror"),
-                                                         NULL,
-                                                         FALSE,
-                                                         GIMP_CONFIG_PARAM_FLAGS |
-                                                         GIMP_PARAM_STATIC_STRINGS |
-                                                         GIMP_SYMMETRY_PARAM_GUI));
-
-  g_object_class_install_property (object_class, PROP_POINT_SYMMETRY,
-                                   g_param_spec_boolean ("point-symmetry",
-                                                         _("Central Symmetry"),
-                                                         NULL,
-                                                         FALSE,
-                                                         GIMP_CONFIG_PARAM_FLAGS |
-                                                         GIMP_PARAM_STATIC_STRINGS |
-                                                         GIMP_SYMMETRY_PARAM_GUI));
-
-  g_object_class_install_property (object_class, PROP_DISABLE_TRANSFORMATION,
-                                   g_param_spec_boolean ("disable-transformation",
-                                                         _("Disable brush transform"),
-                                                         _("Disable brush transformation (faster)"),
-                                                         FALSE,
-                                                         GIMP_CONFIG_PARAM_FLAGS |
-                                                         GIMP_PARAM_STATIC_STRINGS |
-                                                         GIMP_SYMMETRY_PARAM_GUI));
+  GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_HORIZONTAL_SYMMETRY,
+                            "horizontal-symmetry",
+                            _("Horizontal Mirror"),
+                            NULL,
+                            FALSE,
+                            GIMP_PARAM_STATIC_STRINGS |
+                            GIMP_SYMMETRY_PARAM_GUI);
+
+  GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_VERTICAL_SYMMETRY,
+                            "vertical-symmetry",
+                            _("Vertical Mirror"),
+                            NULL,
+                            FALSE,
+                            GIMP_PARAM_STATIC_STRINGS |
+                            GIMP_SYMMETRY_PARAM_GUI);
+
+  GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_POINT_SYMMETRY,
+                            "point-symmetry",
+                            _("Central Symmetry"),
+                            NULL,
+                            FALSE,
+                            GIMP_PARAM_STATIC_STRINGS |
+                            GIMP_SYMMETRY_PARAM_GUI);
+
+  GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_DISABLE_TRANSFORMATION,
+                            "disable-transformation",
+                            _("Disable brush transform"),
+                            _("Disable brush transformation (faster)"),
+                            FALSE,
+                            GIMP_PARAM_STATIC_STRINGS |
+                            GIMP_SYMMETRY_PARAM_GUI);
 
   /* Properties for XCF serialization only */
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HORIZONTAL_POSITION,
diff --git a/app/core/gimpsymmetry-tiling.c b/app/core/gimpsymmetry-tiling.c
index f936f43..e7d9762 100644
--- a/app/core/gimpsymmetry-tiling.c
+++ b/app/core/gimpsymmetry-tiling.c
@@ -101,50 +101,45 @@ gimp_tiling_class_init (GimpTilingClass *klass)
   symmetry_class->update_strokes  = gimp_tiling_update_strokes;
   symmetry_class->get_operation   = gimp_tiling_get_operation;
 
-  g_object_class_install_property (object_class, PROP_X_INTERVAL,
-                                   g_param_spec_double ("x-interval",
-                                                        _("Interval X"),
-                                                        _("Interval on the X axis (pixels)"),
-                                                        0.0, 10000.0, 0.0,
-                                                        GIMP_CONFIG_PARAM_FLAGS |
-                                                        GIMP_PARAM_STATIC_STRINGS |
-                                                        GIMP_SYMMETRY_PARAM_GUI));
-
-  g_object_class_install_property (object_class, PROP_Y_INTERVAL,
-                                   g_param_spec_double ("y-interval",
-                                                        _("Interval Y"),
-                                                        _("Interval on the Y axis (pixels)"),
-                                                        0.0, 10000.0, 0.0,
-                                                        GIMP_CONFIG_PARAM_FLAGS |
-                                                        GIMP_PARAM_STATIC_STRINGS |
-                                                        GIMP_SYMMETRY_PARAM_GUI));
-
-  g_object_class_install_property (object_class, PROP_SHIFT,
-                                   g_param_spec_double ("shift",
-                                                        _("Shift"),
-                                                        _("X-shift between lines (pixels)"),
-                                                        0.0, 10000.0, 0.0,
-                                                        GIMP_CONFIG_PARAM_FLAGS |
-                                                        GIMP_PARAM_STATIC_STRINGS |
-                                                        GIMP_SYMMETRY_PARAM_GUI));
-
-  g_object_class_install_property (object_class, PROP_X_MAX,
-                                   g_param_spec_int ("x-max",
-                                                     _("Max strokes X"),
-                                                     _("Maximum number of strokes on the X axis"),
-                                                     0, 100, 0,
-                                                     GIMP_CONFIG_PARAM_FLAGS |
-                                                     GIMP_PARAM_STATIC_STRINGS |
-                                                     GIMP_SYMMETRY_PARAM_GUI));
-
-  g_object_class_install_property (object_class, PROP_Y_MAX,
-                                   g_param_spec_int ("y-max",
-                                                     _("Max strokes Y"),
-                                                     _("Maximum number of strokes on the Y axis"),
-                                                     0, 100, 0,
-                                                     GIMP_CONFIG_PARAM_FLAGS |
-                                                     GIMP_PARAM_STATIC_STRINGS |
-                                                     GIMP_SYMMETRY_PARAM_GUI));
+  GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_X_INTERVAL,
+                           "x-interval",
+                           _("Interval X"),
+                           _("Interval on the X axis (pixels)"),
+                           0.0, 10000.0, 0.0,
+                           GIMP_PARAM_STATIC_STRINGS |
+                           GIMP_SYMMETRY_PARAM_GUI);
+
+  GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_Y_INTERVAL,
+                           "y-interval",
+                           _("Interval Y"),
+                           _("Interval on the Y axis (pixels)"),
+                           0.0, 10000.0, 0.0,
+                           GIMP_PARAM_STATIC_STRINGS |
+                           GIMP_SYMMETRY_PARAM_GUI);
+
+  GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_SHIFT,
+                           "shift",
+                           _("Shift"),
+                           _("X-shift between lines (pixels)"),
+                           0.0, 10000.0, 0.0,
+                           GIMP_PARAM_STATIC_STRINGS |
+                           GIMP_SYMMETRY_PARAM_GUI);
+
+  GIMP_CONFIG_PROP_INT (object_class, PROP_X_MAX,
+                        "x-max",
+                        _("Max strokes X"),
+                        _("Maximum number of strokes on the X axis"),
+                        0, 100, 0,
+                        GIMP_PARAM_STATIC_STRINGS |
+                        GIMP_SYMMETRY_PARAM_GUI);
+
+  GIMP_CONFIG_PROP_INT (object_class, PROP_Y_MAX,
+                        "y-max",
+                        _("Max strokes Y"),
+                        _("Maximum number of strokes on the Y axis"),
+                        0, 100, 0,
+                        GIMP_PARAM_STATIC_STRINGS |
+                        GIMP_SYMMETRY_PARAM_GUI);
 }
 
 static void
diff --git a/app/operations/gimpoperationdesaturate.c b/app/operations/gimpoperationdesaturate.c
index 08c04fc..612a93a 100644
--- a/app/operations/gimpoperationdesaturate.c
+++ b/app/operations/gimpoperationdesaturate.c
@@ -85,13 +85,13 @@ gimp_operation_desaturate_class_init (GimpOperationDesaturateClass *klass)
                                  "description", _("Turn colors into shades of gray"),
                                  NULL);
 
-  g_object_class_install_property (object_class, PROP_MODE,
-                                   g_param_spec_enum ("mode",
-                                                      _("Mode"),
-                                                      _("Choose shade of gray based on"),
-                                                      GIMP_TYPE_DESATURATE_MODE,
-                                                      GIMP_DESATURATE_LIGHTNESS,
-                                                      GIMP_CONFIG_PARAM_FLAGS));
+  GIMP_CONFIG_PROP_ENUM (object_class, PROP_MODE,
+                         "mode",
+                         _("Mode"),
+                         _("Choose shade of gray based on"),
+                         GIMP_TYPE_DESATURATE_MODE,
+                         GIMP_DESATURATE_LIGHTNESS,
+                         GIMP_PARAM_STATIC_STRINGS);
 }
 
 static void
diff --git a/app/operations/gimpoperationposterize.c b/app/operations/gimpoperationposterize.c
index 4f2a6a7..d647bc6 100644
--- a/app/operations/gimpoperationposterize.c
+++ b/app/operations/gimpoperationposterize.c
@@ -82,12 +82,12 @@ gimp_operation_posterize_class_init (GimpOperationPosterizeClass *klass)
                                  "description", _("Reduce to a limited set of colors"),
                                  NULL);
 
-  g_object_class_install_property (object_class, PROP_LEVELS,
-                                   g_param_spec_int ("levels",
-                                                     _("Posterize levels"),
-                                                     NULL,
-                                                     2, 256, 3,
-                                                     GIMP_CONFIG_PARAM_FLAGS));
+  GIMP_CONFIG_PROP_INT (object_class, PROP_LEVELS,
+                        "levels",
+                        _("Posterize levels"),
+                        NULL,
+                        2, 256, 3,
+                        GIMP_PARAM_STATIC_STRINGS);
 }
 
 static void
diff --git a/app/operations/gimpoperationthreshold.c b/app/operations/gimpoperationthreshold.c
index c71d196..0282af8 100644
--- a/app/operations/gimpoperationthreshold.c
+++ b/app/operations/gimpoperationthreshold.c
@@ -82,19 +82,19 @@ gimp_operation_threshold_class_init (GimpOperationThresholdClass *klass)
                                  "description", "GIMP Threshold operation",
                                  NULL);
 
-  g_object_class_install_property (object_class, PROP_LOW,
-                                   g_param_spec_double ("low",
-                                                        _("Low threshold"),
-                                                        NULL,
-                                                        0.0, 1.0, 0.5,
-                                                        GIMP_CONFIG_PARAM_FLAGS));
-
-  g_object_class_install_property (object_class, PROP_HIGH,
-                                   g_param_spec_double ("high",
-                                                        _("High threshold"),
-                                                        NULL,
-                                                        0.0, 1.0, 1.0,
-                                                        GIMP_CONFIG_PARAM_FLAGS));
+  GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_LOW,
+                           "low",
+                           _("Low threshold"),
+                           NULL,
+                           0.0, 1.0, 0.5,
+                           GIMP_PARAM_STATIC_STRINGS);
+
+  GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_HIGH,
+                           "high",
+                           _("High threshold"),
+                           NULL,
+                           0.0, 1.0, 1.0,
+                           GIMP_PARAM_STATIC_STRINGS);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]