summaryrefslogtreecommitdiff
path: root/gtk/gtkspinbutton.c
diff options
context:
space:
mode:
authorTim Janik <timj@src.gnome.org>1998-03-09 07:18:33 +0000
committerTim Janik <timj@src.gnome.org>1998-03-09 07:18:33 +0000
commitc9f7f2a0f80ad277b55f346609b4127445ae2042 (patch)
tree3004c9dcef9565876ad6b0a446e9b37e09c377cc /gtk/gtkspinbutton.c
parentd894d2dc0c86734920528c7c35d49c0dfb0bf6e5 (diff)
downloadgdk-pixbuf-c9f7f2a0f80ad277b55f346609b4127445ae2042.tar.gz
patch from lars for construct behaviour.
-timj
Diffstat (limited to 'gtk/gtkspinbutton.c')
-rw-r--r--gtk/gtkspinbutton.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 532db4725..c779c0920 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -162,26 +162,40 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
spin_button->digits = 0;
}
-GtkWidget*
+void
+gtk_spin_button_construct (GtkSpinButton *spin_button,
+ GtkAdjustment *adjustment,
+ gfloat climb_rate,
+ gint digits)
+{
+ char buf[MAX_TEXT_LENGTH];
+
+ g_return_if_fail (spin_button != NULL);
+ g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
+ g_return_if_fail (digits >= 0 && digits < 128);
+
+ if (!adjustment)
+ adjustment = (GtkAdjustment*) gtk_adjustment_new (0, 0, 0, 0, 0, 0);
+
+ gtk_spin_button_set_adjustment (spin_button, adjustment);
+ spin_button->digits = digits;
+ sprintf (buf, "%0.*f", digits, adjustment->value);
+ gtk_entry_set_text (GTK_ENTRY (spin_button), buf);
+ spin_button->climb_rate = climb_rate;
+}
+
+GtkWidget *
gtk_spin_button_new (GtkAdjustment *adjustment,
gfloat climb_rate,
gint digits)
{
GtkSpinButton *spin;
- char buf[MAX_TEXT_LENGTH];
g_return_val_if_fail (digits >= 0 && digits < 128, NULL);
spin = gtk_type_new (gtk_spin_button_get_type ());
- if (!adjustment)
- adjustment = (GtkAdjustment*) gtk_adjustment_new (0, 0, 0, 0, 0, 0);
-
- gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (spin), adjustment);
- spin->digits = digits;
- sprintf (buf, "%0.*f", digits, adjustment->value);
- gtk_entry_set_text (GTK_ENTRY (spin), buf);
- spin->climb_rate = climb_rate;
+ gtk_spin_button_construct (spin, adjustment, climb_rate, digits);
return GTK_WIDGET (spin);
}