[gtk+] GtkSpinButton: Prevent public API from unsetting the adjustment
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkSpinButton: Prevent public API from unsetting the adjustment
- Date: Thu, 14 Aug 2014 04:04:46 +0000 (UTC)
commit 137abd6f7083bcdb4c6df1102303f0e3ab905940
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Aug 12 17:45:53 2014 +0200
GtkSpinButton: Prevent public API from unsetting the adjustment
A spin button really needs an adjustment to work. So don't let the
user unset the adjustment by passing NULL to
gtk_spin_button_set_adjustment.
https://bugzilla.gnome.org/show_bug.cgi?id=734660
gtk/gtkspinbutton.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index f94b577..ddd4540 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -575,8 +575,6 @@ gtk_spin_button_set_property (GObject *object,
case PROP_ADJUSTMENT:
adjustment = GTK_ADJUSTMENT (g_value_get_object (value));
- if (!adjustment)
- adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
gtk_spin_button_set_adjustment (spin_button, adjustment);
break;
case PROP_CLIMB_RATE:
@@ -717,8 +715,7 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
priv->orientation = GTK_ORIENTATION_HORIZONTAL;
- gtk_spin_button_set_adjustment (spin_button,
- gtk_adjustment_new (0, 0, 0, 0, 0, 0));
+ gtk_spin_button_set_adjustment (spin_button, NULL);
context = gtk_widget_get_style_context (GTK_WIDGET (spin_button));
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SPINBUTTON);
@@ -2271,6 +2268,9 @@ gtk_spin_button_set_adjustment (GtkSpinButton *spin_button,
priv = spin_button->priv;
+ if (!adjustment)
+ adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+
gtk_spin_button_configure (spin_button,
adjustment,
priv->climb_rate,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]