gtk+ r21620 - in trunk: . gtk



Author: cdywan
Date: Thu Oct  9 16:19:06 2008
New Revision: 21620
URL: http://svn.gnome.org/viewvc/gtk+?rev=21620&view=rev

Log:
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

Modified:
   trunk/ChangeLog
   trunk/gtk/gtkscalebutton.c

Modified: trunk/gtk/gtkscalebutton.c
==============================================================================
--- trunk/gtk/gtkscalebutton.c	(original)
+++ trunk/gtk/gtkscalebutton.c	Thu Oct  9 16:19:06 2008
@@ -678,16 +678,22 @@
 				 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");
+    }
 }
 
 /**



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