[gimp] libgimpwidgets, plug-ins: rename gimp_scale_entry_set_range() to…



commit 0d98969a47beed58521b7610f14ac2e7255afbfa
Author: Jehan <jehan girinstud io>
Date:   Sun Nov 1 02:54:02 2020 +0100

    libgimpwidgets, plug-ins: rename gimp_scale_entry_set_range() to…
    
    … gimp_scale_entry_set_bounds().
    I realized that this function may look like the set() opposite for
    gimp_scale_entry_get_range(), which it is not at all. The get_range() is
    for getting back the GtkRange widget packed in the GimpScaleEntry,
    whereas the set_range() is to change the minimum and maximum allowed
    values.
    
    I had recently renamed the former, and could just rename it back into
    gimp_scale_entry_get_scale() as it was, but since the class we rely on
    is actually called GtkRange (GtkScale is a subclass), I think it could
    be misleading. So in the end, let's rather rename the function setting
    the widget minimum and maximum as gimp_scale_entry_set_bounds() instead.
    Hopefully this is even more understandable. Naming is hard!

 libgimpwidgets/gimpcolorscales.c         |  8 ++++----
 libgimpwidgets/gimppropwidgets.c         |  6 +++---
 libgimpwidgets/gimpscaleentry.c          | 14 +++++++-------
 libgimpwidgets/gimpscaleentry.h          |  2 +-
 libgimpwidgets/gimpwidgets.def           |  2 +-
 plug-ins/gradient-flare/gradient-flare.c | 14 +++++++-------
 6 files changed, 23 insertions(+), 23 deletions(-)
---
diff --git a/libgimpwidgets/gimpcolorscales.c b/libgimpwidgets/gimpcolorscales.c
index 305d8e6ab8..b03d67c8b1 100644
--- a/libgimpwidgets/gimpcolorscales.c
+++ b/libgimpwidgets/gimpcolorscales.c
@@ -321,10 +321,10 @@ create_group (GimpColorScales           *scales,
                                NULL);
       gtk_widget_show (scales->scales[i]);
 
-      gimp_scale_entry_set_range (GIMP_SCALE_ENTRY (scales->scales[i]),
-                                  scale_defs[i].scale_min_value,
-                                  scale_defs[i].scale_max_value,
-                                  TRUE);
+      gimp_scale_entry_set_bounds (GIMP_SCALE_ENTRY (scales->scales[i]),
+                                   scale_defs[i].scale_min_value,
+                                   scale_defs[i].scale_max_value,
+                                   TRUE);
 
       g_object_add_weak_pointer (G_OBJECT (scales->scales[i]),
                                  (gpointer) &scales->scales[i]);
diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c
index cb65eec2ec..2290d44677 100644
--- a/libgimpwidgets/gimppropwidgets.c
+++ b/libgimpwidgets/gimppropwidgets.c
@@ -1516,9 +1516,9 @@ gimp_prop_scale_entry_new (GObject     *config,
   widget = gimp_scale_entry_new (label, value, lower, upper, digits);
   if (limit_scale)
     {
-      gimp_scale_entry_set_range (GIMP_SCALE_ENTRY (widget),
-                                  lower_limit, upper_limit,
-                                  FALSE);
+      gimp_scale_entry_set_bounds (GIMP_SCALE_ENTRY (widget),
+                                   lower_limit, upper_limit,
+                                   FALSE);
     }
 
   tooltip = g_param_spec_get_blurb (param_spec);
diff --git a/libgimpwidgets/gimpscaleentry.c b/libgimpwidgets/gimpscaleentry.c
index 5c337d12d1..45436f9b55 100644
--- a/libgimpwidgets/gimpscaleentry.c
+++ b/libgimpwidgets/gimpscaleentry.c
@@ -148,7 +148,7 @@ gimp_scale_entry_class_init (GimpScaleEntryClass *klass)
    * GimpScaleEntry:lower:
    *
    * The lower bound of the widget. If the spin button and the scale
-   * widgets have different limits (see gimp_scale_entry_set_range()),
+   * widgets have different limits (see gimp_scale_entry_set_bounds()),
    * this corresponds to the spin button lower value.
    *
    * Since: 3.0
@@ -164,7 +164,7 @@ gimp_scale_entry_class_init (GimpScaleEntryClass *klass)
    * GimpScaleEntry:upper:
    *
    * The upper bound of the widget. If the spin button and the scale
-   * widgets have different limits (see gimp_scale_entry_set_range()),
+   * widgets have different limits (see gimp_scale_entry_set_bounds()),
    * this corresponds to the spin button upper value.
    *
    * Since: 3.0
@@ -686,7 +686,7 @@ gimp_scale_entry_get_range (GimpScaleEntry *entry)
 }
 
 /**
- * gimp_scale_entry_set_range:
+ * gimp_scale_entry_set_bounds:
  * @entry:       The #GtkScaleEntry.
  * @lower:       the lower value for the whole widget if @limit_scale is
  *               %FALSE, or only for the #GtkScale if %TRUE.
@@ -717,10 +717,10 @@ gimp_scale_entry_get_range (GimpScaleEntry *entry)
  * increments yourself, you may call gimp_scale_entry_set_increments()
  **/
 void
-gimp_scale_entry_set_range (GimpScaleEntry *entry,
-                            gdouble         lower,
-                            gdouble         upper,
-                            gboolean        limit_scale)
+gimp_scale_entry_set_bounds (GimpScaleEntry *entry,
+                             gdouble         lower,
+                             gdouble         upper,
+                             gboolean        limit_scale)
 {
   GimpScaleEntryPrivate *priv;
   GtkSpinButton         *spinbutton;
diff --git a/libgimpwidgets/gimpscaleentry.h b/libgimpwidgets/gimpscaleentry.h
index c668bcd97b..b9f1a1edb9 100644
--- a/libgimpwidgets/gimpscaleentry.h
+++ b/libgimpwidgets/gimpscaleentry.h
@@ -68,7 +68,7 @@ GtkWidget     * gimp_scale_entry_get_label       (GimpScaleEntry *entry);
 GtkWidget     * gimp_scale_entry_get_spin_button (GimpScaleEntry *entry);
 GtkWidget     * gimp_scale_entry_get_range       (GimpScaleEntry *entry);
 
-void            gimp_scale_entry_set_range       (GimpScaleEntry *entry,
+void            gimp_scale_entry_set_bounds      (GimpScaleEntry *entry,
                                                   gdouble         lower,
                                                   gdouble         upper,
                                                   gboolean        limit_scale);
diff --git a/libgimpwidgets/gimpwidgets.def b/libgimpwidgets/gimpwidgets.def
index dbf52c8d73..6e85833897 100644
--- a/libgimpwidgets/gimpwidgets.def
+++ b/libgimpwidgets/gimpwidgets.def
@@ -371,9 +371,9 @@ EXPORTS
        gimp_scale_entry_get_type
        gimp_scale_entry_get_value
        gimp_scale_entry_new
+       gimp_scale_entry_set_bounds
        gimp_scale_entry_set_increments
        gimp_scale_entry_set_logarithmic
-       gimp_scale_entry_set_range
        gimp_scale_entry_set_value
        gimp_scroll_adjustment_values
        gimp_scrolled_preview_freeze
diff --git a/plug-ins/gradient-flare/gradient-flare.c b/plug-ins/gradient-flare/gradient-flare.c
index 0046d9e087..568ca52931 100644
--- a/plug-ins/gradient-flare/gradient-flare.c
+++ b/plug-ins/gradient-flare/gradient-flare.c
@@ -2899,7 +2899,7 @@ dlg_make_page_settings (GFlareDialog *dlg,
   row = 0;
 
   scale = gimp_scale_entry_new (_("_Radius:"), pvals.radius, 0.0, GIMP_MAX_IMAGE_SIZE, 1);
-  gimp_scale_entry_set_range (GIMP_SCALE_ENTRY (scale), 0.0, gimp_drawable_width (drawable) / 2, TRUE);
+  gimp_scale_entry_set_bounds (GIMP_SCALE_ENTRY (scale), 0.0, gimp_drawable_width (drawable) / 2, TRUE);
   g_signal_connect (scale, "value-changed",
                     G_CALLBACK (gradient_scale_entry_update_double),
                     &pvals.radius);
@@ -2943,7 +2943,7 @@ dlg_make_page_settings (GFlareDialog *dlg,
   gtk_widget_show (scale);
 
   scale = gimp_scale_entry_new (_("Vector _length:"), pvals.vlength, 1, GIMP_MAX_IMAGE_SIZE, 1);
-  gimp_scale_entry_set_range (GIMP_SCALE_ENTRY (scale), 1, 1000, TRUE);
+  gimp_scale_entry_set_bounds (GIMP_SCALE_ENTRY (scale), 1, 1000, TRUE);
   g_signal_connect (scale, "value-changed",
                     G_CALLBACK (gradient_scale_entry_update_double),
                     &pvals.vlength);
@@ -3718,7 +3718,7 @@ ed_make_page_glow (GFlareEditor *ed,
   row = 0;
 
   scale = gimp_scale_entry_new (_("Size (%):"), gflare->glow_size, 0.0, G_MAXINT, 1);
-  gimp_scale_entry_set_range (GIMP_SCALE_ENTRY (scale), 0.0, 200.0, TRUE);
+  gimp_scale_entry_set_bounds (GIMP_SCALE_ENTRY (scale), 0.0, 200.0, TRUE);
   g_signal_connect (scale, "value-changed",
                     G_CALLBACK (gradient_scale_entry_update_double),
                     &gflare->glow_size);
@@ -3820,7 +3820,7 @@ ed_make_page_rays (GFlareEditor *ed,
   row = 0;
 
   scale = gimp_scale_entry_new (_("Size (%):"), gflare->rays_size, 0.0, G_MAXINT, 1);
-  gimp_scale_entry_set_range (GIMP_SCALE_ENTRY (scale), 0.0, 200.0, TRUE);
+  gimp_scale_entry_set_bounds (GIMP_SCALE_ENTRY (scale), 0.0, 200.0, TRUE);
   g_signal_connect (scale, "value-changed",
                     G_CALLBACK (gradient_scale_entry_update_double),
                     &gflare->rays_size);
@@ -3853,7 +3853,7 @@ ed_make_page_rays (GFlareEditor *ed,
   gtk_widget_show (scale);
 
   scale = gimp_scale_entry_new (_("# of Spikes:"), gflare->rays_nspikes, 1, G_MAXINT, 0);
-  gimp_scale_entry_set_range (GIMP_SCALE_ENTRY (scale), 1.0, 300.0, TRUE);
+  gimp_scale_entry_set_bounds (GIMP_SCALE_ENTRY (scale), 1.0, 300.0, TRUE);
   g_signal_connect (scale, "value-changed",
                     G_CALLBACK (gradient_scale_entry_update_int),
                     &gflare->rays_nspikes);
@@ -3864,7 +3864,7 @@ ed_make_page_rays (GFlareEditor *ed,
   gtk_widget_show (scale);
 
   scale = gimp_scale_entry_new (_("Spike thickness:"), gflare->rays_thickness, 1.0, GIMP_MAX_IMAGE_SIZE, 1);
-  gimp_scale_entry_set_range (GIMP_SCALE_ENTRY (scale), 1.0, 100.0, TRUE);
+  gimp_scale_entry_set_bounds (GIMP_SCALE_ENTRY (scale), 1.0, 100.0, TRUE);
   g_signal_connect (scale, "value-changed",
                     G_CALLBACK (gradient_scale_entry_update_double),
                     &gflare->rays_thickness);
@@ -3951,7 +3951,7 @@ ed_make_page_sflare (GFlareEditor *ed,
   row = 0;
 
   scale = gimp_scale_entry_new (_("Size (%):"), gflare->sflare_size, 0.0, G_MAXINT, 1);
-  gimp_scale_entry_set_range (GIMP_SCALE_ENTRY (scale), 1.0, 200.0, TRUE);
+  gimp_scale_entry_set_bounds (GIMP_SCALE_ENTRY (scale), 1.0, 200.0, TRUE);
   g_signal_connect (scale, "value-changed",
                     G_CALLBACK (gradient_scale_entry_update_double),
                     &gflare->sflare_size);


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