[goffice] io context: allow setting progress backwards.



commit 9d54aec865bb82d6f77affcd8f8e45cbf31eb6c6
Author: Morten Welinder <terra gnome org>
Date:   Thu Feb 23 16:44:44 2012 -0500

    io context: allow setting progress backwards.

 goffice/app/io-context.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/goffice/app/io-context.c b/goffice/app/io-context.c
index 88a74bd..5e84225 100644
--- a/goffice/app/io-context.c
+++ b/goffice/app/io-context.c
@@ -269,7 +269,8 @@ go_io_progress_update (GOIOContext *ioc, gdouble f)
 
 	at_end = (f - ioc->last_progress > PROGRESS_UPDATE_STEP_END &&
 		  f + PROGRESS_UPDATE_STEP > 1);
-	if (at_end || f - ioc->last_progress >= PROGRESS_UPDATE_STEP) {
+	/* The use of fabs here means we can set progress back if we need to. */
+	if (at_end || fabs (f - ioc->last_progress) >= PROGRESS_UPDATE_STEP) {
 		GTimeVal tv;
 		double t;
 



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