diff --git a/app/widgets/gimppropwidgets.c b/app/widgets/gimppropwidgets.c index d065bd30e9..bee56e02fb 100644 --- a/app/widgets/gimppropwidgets.c +++ b/app/widgets/gimppropwidgets.c @@ -366,8 +366,6 @@ gimp_prop_scale_button_new (GObject *config, GParamSpec *param_spec; GtkWidget *button; gdouble value; - gdouble min; - gdouble max; param_spec = check_param_spec_w (config, property_name, G_TYPE_PARAM_DOUBLE, G_STRFUNC); @@ -379,12 +377,9 @@ gimp_prop_scale_button_new (GObject *config, param_spec->name, &value, NULL); - min = G_PARAM_SPEC_DOUBLE (param_spec)->minimum; - max = G_PARAM_SPEC_DOUBLE (param_spec)->maximum; - - button = gimp_scale_button_new (min, max, (max - min) / 10.0); - - gtk_scale_button_set_value (GTK_SCALE_BUTTON (button), value); + button = gimp_scale_button_new (value, + G_PARAM_SPEC_DOUBLE (param_spec)->minimum, + G_PARAM_SPEC_DOUBLE (param_spec)->maximum); set_param_spec (G_OBJECT (button), button, param_spec); diff --git a/app/widgets/gimpscalebutton.c b/app/widgets/gimpscalebutton.c index 301328acf5..701aa806b7 100644 --- a/app/widgets/gimpscalebutton.c +++ b/app/widgets/gimpscalebutton.c @@ -111,11 +111,17 @@ gimp_scale_button_image_expose (GtkWidget *widget, } GtkWidget * -gimp_scale_button_new (gdouble min, - gdouble max, - gdouble step) +gimp_scale_button_new (gdouble value, + gdouble min, + gdouble max) { - GtkObject *adj = gtk_adjustment_new (min, min, max, step, step, 0); + GtkObject *adj; + gdouble step; + + g_return_val_if_fail (value >= min && value <= max, NULL); + + step = (max - min) / 10.0; + adj = gtk_adjustment_new (value, min, max, step, step, 0); return g_object_new (GIMP_TYPE_SCALE_BUTTON, "adjustment", adj, diff --git a/app/widgets/gimpscalebutton.h b/app/widgets/gimpscalebutton.h index 47540ac6b8..bdc4eccf8b 100644 --- a/app/widgets/gimpscalebutton.h +++ b/app/widgets/gimpscalebutton.h @@ -46,9 +46,9 @@ struct _GimpScaleButtonClass GType gimp_scale_button_get_type (void) G_GNUC_CONST; -GtkWidget * gimp_scale_button_new (gdouble min, - gdouble max, - gdouble step); +GtkWidget * gimp_scale_button_new (gdouble value, + gdouble min, + gdouble max); #endif /* __GIMP_SCALE_BUTTON_H__ */