[gnome-scan/gnome-scan-0-6: 10/23] Use minimal step equal to 1.



commit e6b9f8398fd468eebac0c8dfd52c514b8dcfb00f
Author: Philipp Sadleder <phsadleder src gnome org>
Date:   Tue Jan 13 09:56:07 2009 +0000

    Use minimal step equal to 1.
    
    svn path=/branches/GNOME_SCAN_0_6/; revision=763
---
 ChangeLog               |    6 ++++++
 modules/gsane-scanner.c |    4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 221e6fc..7d0a9a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-13  Philipp Sadleder <philipp sadleder de>
+
+	* modules/gsane-scanner.c (gss_option_get_param_spec):
+	Use minimal step equal to 1 to work around SANE backends returning
+	step equal to 0. Thanks to Ã?tienne Bersac.
+
 2009-01-09  Philipp Sadleder <philipp sadleder de>
 
 	* Backport fix for crash on module unload from gnome-scan trunk. 
diff --git a/modules/gsane-scanner.c b/modules/gsane-scanner.c
index 631b0bf..edc5fcd 100644
--- a/modules/gsane-scanner.c
+++ b/modules/gsane-scanner.c
@@ -930,12 +930,12 @@ gss_option_get_param_spec (GSaneScanner *gss, SANE_Int n)
 		case G_TYPE_INT:
 			g_value_set_int (vmin, desc->constraint.range->min);
 			g_value_set_int (vmax, desc->constraint.range->max);
-			g_value_set_int (vstep, desc->constraint.range->quant);
+			g_value_set_int (vstep, MAX(1, desc->constraint.range->quant));
 			break;
 		case G_TYPE_DOUBLE:
 			g_value_set_double (vmin, SANE_UNFIX (desc->constraint.range->min));
 			g_value_set_double (vmax, SANE_UNFIX (desc->constraint.range->max));
-			g_value_set_double (vstep, SANE_UNFIX (desc->constraint.range->quant));
+			g_value_set_double (vstep, MAX(1., SANE_UNFIX (desc->constraint.range->quant)));
 			break;
 		}
 		



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