gimp r25811 - trunk/app/widgets



Author: neo
Date: Mon May 26 16:41:34 2008
New Revision: 25811
URL: http://svn.gnome.org/viewvc/gimp?rev=25811&view=rev

Log:
some more fiddling to simplify the API


Modified:
   trunk/app/widgets/gimppropwidgets.c
   trunk/app/widgets/gimpscalebutton.c
   trunk/app/widgets/gimpscalebutton.h

Modified: trunk/app/widgets/gimppropwidgets.c
==============================================================================
--- trunk/app/widgets/gimppropwidgets.c	(original)
+++ trunk/app/widgets/gimppropwidgets.c	Mon May 26 16:41:34 2008
@@ -366,8 +366,6 @@
   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 @@
                 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);
 

Modified: trunk/app/widgets/gimpscalebutton.c
==============================================================================
--- trunk/app/widgets/gimpscalebutton.c	(original)
+++ trunk/app/widgets/gimpscalebutton.c	Mon May 26 16:41:34 2008
@@ -111,11 +111,17 @@
 }
 
 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,

Modified: trunk/app/widgets/gimpscalebutton.h
==============================================================================
--- trunk/app/widgets/gimpscalebutton.h	(original)
+++ trunk/app/widgets/gimpscalebutton.h	Mon May 26 16:41:34 2008
@@ -46,9 +46,9 @@
 
 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__ */



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