Bug 555523 – gtk_scale_button_set_adjustment should accept NULL

* gtk/gtkscalebutton.c (gtk_scale_button_set_adjustment):
Create a new adjustment if NULL is passed, like other widgets

svn path=/trunk/; revision=21620
This commit is contained in:
Christian Dywan 2008-10-09 16:19:06 +00:00
parent 78be7a0a34
commit ba5fbdb32b
2 changed files with 20 additions and 7 deletions

View File

@ -1,3 +1,10 @@
2008-10-09 Christian Dywan <christian@imendio.com>
Bug 555523 gtk_scale_button_set_adjustment should accept NULL
* gtk/gtkscalebutton.c (gtk_scale_button_set_adjustment):
Create a new adjustment if NULL is passed, like other widgets
2008-10-09 Christian Dywan <christian@imendio.com>
Bug 555578 GtkTable propertiy maxima are wrong

View File

@ -678,16 +678,22 @@ gtk_scale_button_set_adjustment (GtkScaleButton *button,
GtkAdjustment *adjustment)
{
g_return_if_fail (GTK_IS_SCALE_BUTTON (button));
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
if (!adjustment)
adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
else
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
if (button->priv->adjustment)
g_object_unref (button->priv->adjustment);
button->priv->adjustment = g_object_ref_sink (adjustment);
if (button->priv->adjustment != adjustment)
{
if (button->priv->adjustment)
g_object_unref (button->priv->adjustment);
button->priv->adjustment = g_object_ref_sink (adjustment);
if (button->priv->scale)
gtk_range_set_adjustment (GTK_RANGE (button->priv->scale), adjustment);
if (button->priv->scale)
gtk_range_set_adjustment (GTK_RANGE (button->priv->scale), adjustment);
g_object_notify (G_OBJECT (button), "adjustment");
g_object_notify (G_OBJECT (button), "adjustment");
}
}
/**