Return 0 if lower == upper. (#109155)

2003-04-02  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkprogress.c (gtk_progress_get_percentage_from_value):
	Return 0 if lower == upper.  (#109155)
	(gtk_progress_get_current_percentage): Use
	gtk_progress_get_percentage_from_value().
This commit is contained in:
Matthias Clasen 2003-04-02 21:00:41 +00:00 committed by Matthias Clasen
parent 4a50e7a17a
commit 8653097b33
6 changed files with 38 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2003-04-02 Matthias Clasen <maclas@gmx.de>
* gtk/gtkprogress.c (gtk_progress_get_percentage_from_value):
Return 0 if lower == upper. (#109155)
(gtk_progress_get_current_percentage): Use
gtk_progress_get_percentage_from_value().
2003-04-01 Matthias Clasen <maclas@gmx.de>
* gtk/gtkimcontext.c (gtk_im_context_focus_in): Fix docs.

View File

@ -1,3 +1,10 @@
2003-04-02 Matthias Clasen <maclas@gmx.de>
* gtk/gtkprogress.c (gtk_progress_get_percentage_from_value):
Return 0 if lower == upper. (#109155)
(gtk_progress_get_current_percentage): Use
gtk_progress_get_percentage_from_value().
2003-04-01 Matthias Clasen <maclas@gmx.de>
* gtk/gtkimcontext.c (gtk_im_context_focus_in): Fix docs.

View File

@ -1,3 +1,10 @@
2003-04-02 Matthias Clasen <maclas@gmx.de>
* gtk/gtkprogress.c (gtk_progress_get_percentage_from_value):
Return 0 if lower == upper. (#109155)
(gtk_progress_get_current_percentage): Use
gtk_progress_get_percentage_from_value().
2003-04-01 Matthias Clasen <maclas@gmx.de>
* gtk/gtkimcontext.c (gtk_im_context_focus_in): Fix docs.

View File

@ -1,3 +1,10 @@
2003-04-02 Matthias Clasen <maclas@gmx.de>
* gtk/gtkprogress.c (gtk_progress_get_percentage_from_value):
Return 0 if lower == upper. (#109155)
(gtk_progress_get_current_percentage): Use
gtk_progress_get_percentage_from_value().
2003-04-01 Matthias Clasen <maclas@gmx.de>
* gtk/gtkimcontext.c (gtk_im_context_focus_in): Fix docs.

View File

@ -1,3 +1,10 @@
2003-04-02 Matthias Clasen <maclas@gmx.de>
* gtk/gtkprogress.c (gtk_progress_get_percentage_from_value):
Return 0 if lower == upper. (#109155)
(gtk_progress_get_current_percentage): Use
gtk_progress_get_percentage_from_value().
2003-04-01 Matthias Clasen <maclas@gmx.de>
* gtk/gtkimcontext.c (gtk_im_context_focus_in): Fix docs.

View File

@ -570,8 +570,7 @@ gtk_progress_get_current_percentage (GtkProgress *progress)
if (!progress->adjustment)
gtk_progress_set_adjustment (progress, NULL);
return ((progress->adjustment->value - progress->adjustment->lower) /
(progress->adjustment->upper - progress->adjustment->lower));
return gtk_progress_get_percentage_from_value (progress, progress->adjustment->value);
}
gdouble
@ -583,7 +582,8 @@ gtk_progress_get_percentage_from_value (GtkProgress *progress,
if (!progress->adjustment)
gtk_progress_set_adjustment (progress, NULL);
if (value >= progress->adjustment->lower &&
if (progress->adjustment->lower < progress->adjustment->upper &&
value >= progress->adjustment->lower &&
value <= progress->adjustment->upper)
return (value - progress->adjustment->lower) /
(progress->adjustment->upper - progress->adjustment->lower);