libgimpwidgets: improve gimp_label_spin_set_increments().

The assert tests were not taking well into account the case where upper == lower
or where it's an integer spin which is just separated by 1 (both cases seem
silly, but it makes sense in the case of generic — or even dynamic! — spin
widgets where we want to adjust the min and max, e.g. depending on the property
of the image, or on other settings.
This commit is contained in:
Jehan 2023-07-22 03:11:59 +02:00
parent 92e77a4541
commit 272bc69540
1 changed files with 3 additions and 2 deletions

View File

@ -461,13 +461,14 @@ gimp_label_spin_set_increments (GimpLabelSpin *spin,
gdouble upper;
g_return_if_fail (GIMP_IS_LABEL_SPIN (spin));
g_return_if_fail (step < page);
g_return_if_fail (step <= page);
spinbutton = GTK_SPIN_BUTTON (priv->spinbutton);
gtk_spin_button_get_range (spinbutton, &lower, &upper);
g_return_if_fail (upper >= lower);
g_return_if_fail (step < upper - lower && page < upper - lower);
g_return_if_fail ((upper == lower || step <= upper - lower) &&
(upper == lower || page <= upper - lower));
g_object_freeze_notify (G_OBJECT (spinbutton));
gtk_adjustment_set_step_increment (gtk_spin_button_get_adjustment (spinbutton), step);