[gtk+/gtk-3-2] GtkProgressbar: respect the range of 'fraction'



commit b763e2cdaa6f3d878674789475a8b2bd07b4acee
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Nov 11 10:26:31 2011 -0500

    GtkProgressbar: respect the range of 'fraction'
    
    The setter should not set the property to values outside the allowed
    range.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=663825

 gtk/gtkprogressbar.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index bbf5509..48ead04 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -1060,7 +1060,7 @@ gtk_progress_bar_set_activity_mode (GtkProgressBar *pbar,
  * of the bar. The fraction should be between 0.0 and 1.0,
  * inclusive.
  *
- **/
+ */
 void
 gtk_progress_bar_set_fraction (GtkProgressBar *pbar,
                                gdouble         fraction)
@@ -1071,7 +1071,7 @@ gtk_progress_bar_set_fraction (GtkProgressBar *pbar,
 
   priv = pbar->priv;
 
-  priv->fraction = fraction;
+  priv->fraction = CLAMP(fraction, 0.0, 1.0);
   gtk_progress_bar_set_activity_mode (pbar, FALSE);
   gtk_progress_bar_real_update (pbar);
 



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