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
This commit is contained in:
committed by
Matthias Clasen
parent
1e304e6deb
commit
137abd6f70
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user