summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessio Treglia <alessio@debian.org>2012-04-20 12:04:46 +0200
committerAlessio Treglia <alessio@debian.org>2012-04-20 12:04:46 +0200
commit81e2fef032931d0748d94c7d2625fe07499f77c3 (patch)
treeeebac3f3670b86e0a382952206ccd7282324450f
parent3423cc86f86a823a318ea72981dc8eb889fc7987 (diff)
Imported Upstream version 3.4.1upstream/3.4.1
-rw-r--r--NEWS8
-rwxr-xr-xcompile195
-rwxr-xr-xconfigure2
-rw-r--r--configure.ac2
-rwxr-xr-xdepcomp74
-rw-r--r--help/C/legal.xml9
-rw-r--r--help/Makefile.am2
-rw-r--r--help/Makefile.in2
-rw-r--r--help/de/legal.xml9
-rwxr-xr-xinstall-sh29
-rwxr-xr-xmissing53
-rw-r--r--src/book-view.c2
-rw-r--r--src/book.c10
-rw-r--r--src/book.vala4
-rw-r--r--src/page-view.c2
-rw-r--r--src/page.c2
-rw-r--r--src/scanner.c1998
-rw-r--r--src/scanner.vala448
-rw-r--r--src/simple-scan.c2
-rw-r--r--src/ui.c4
-rw-r--r--src/ui.vala2
21 files changed, 1600 insertions, 1259 deletions
diff --git a/NEWS b/NEWS
index df7abef..38c57d3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+Overview of changes in simple-scan 3.4.1
+
+ * Always set scanner options in the same order to avoid options resetting
+ options already set.
+ * Number multiple page documents from 1
+ * Commit help .pot file so can be translated from Launchpad
+ * Fix help not working
+
Overview of changes in simple-scan 3.4.0
* No change version bump
diff --git a/compile b/compile
index c0096a7..b1f4749 100755
--- a/compile
+++ b/compile
@@ -1,10 +1,10 @@
#! /bin/sh
-# Wrapper for compilers which do not understand `-c -o'.
+# Wrapper for compilers which do not understand '-c -o'.
-scriptversion=2009-10-06.20; # UTC
+scriptversion=2012-01-04.17; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software
-# Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free
+# Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
@@ -29,21 +29,186 @@ scriptversion=2009-10-06.20; # UTC
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
+nl='
+'
+
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" "" $nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+ file=$1
+ case $file in
+ / | /[!/]*) # absolute file, and not a UNC file
+ if test -z "$file_conv"; then
+ # lazily determine how to convert abs files
+ case `uname -s` in
+ MINGW*)
+ file_conv=mingw
+ ;;
+ CYGWIN*)
+ file_conv=cygwin
+ ;;
+ *)
+ file_conv=wine
+ ;;
+ esac
+ fi
+ case $file_conv/,$2, in
+ *,$file_conv,*)
+ ;;
+ mingw/*)
+ file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+ ;;
+ cygwin/*)
+ file=`cygpath -m "$file" || echo "$file"`
+ ;;
+ wine/*)
+ file=`winepath -w "$file" || echo "$file"`
+ ;;
+ esac
+ ;;
+ esac
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+ # Assume a capable shell
+ lib_path=
+ shared=:
+ linker_opts=
+ for arg
+ do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ eat=1
+ case $2 in
+ *.o | *.[oO][bB][jJ])
+ func_file_conv "$2"
+ set x "$@" -Fo"$file"
+ shift
+ ;;
+ *)
+ func_file_conv "$2"
+ set x "$@" -Fe"$file"
+ shift
+ ;;
+ esac
+ ;;
+ -I*)
+ func_file_conv "${1#-I}" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -l*)
+ lib=${1#-l}
+ found=no
+ save_IFS=$IFS
+ IFS=';'
+ for dir in $lib_path $LIB
+ do
+ IFS=$save_IFS
+ if $shared && test -f "$dir/$lib.dll.lib"; then
+ found=yes
+ set x "$@" "$dir/$lib.dll.lib"
+ break
+ fi
+ if test -f "$dir/$lib.lib"; then
+ found=yes
+ set x "$@" "$dir/$lib.lib"
+ break
+ fi
+ done
+ IFS=$save_IFS
+
+ test "$found" != yes && set x "$@" "$lib.lib"
+ shift
+ ;;
+ -L*)
+ func_file_conv "${1#-L}"
+ if test -z "$lib_path"; then
+ lib_path=$file
+ else
+ lib_path="$lib_path;$file"
+ fi
+ linker_opts="$linker_opts -LIBPATH:$file"
+ ;;
+ -static)
+ shared=false
+ ;;
+ -Wl,*)
+ arg=${1#-Wl,}
+ save_ifs="$IFS"; IFS=','
+ for flag in $arg; do
+ IFS="$save_ifs"
+ linker_opts="$linker_opts $flag"
+ done
+ IFS="$save_ifs"
+ ;;
+ -Xlinker)
+ eat=1
+ linker_opts="$linker_opts $2"
+ ;;
+ -*)
+ set x "$@" "$1"
+ shift
+ ;;
+ *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+ func_file_conv "$1"
+ set x "$@" -Tp"$file"
+ shift
+ ;;
+ *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+ func_file_conv "$1" mingw
+ set x "$@" "$file"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+ done
+ if test -n "$linker_opts"; then
+ linker_opts="-link$linker_opts"
+ fi
+ exec "$@" $linker_opts
+ exit 1
+}
+
+eat=
+
case $1 in
'')
- echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
-Wrapper for compilers which do not understand `-c -o'.
-Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
-right script to run: please start by reading the file `INSTALL'.
+right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
@@ -53,11 +218,13 @@ EOF
echo "compile $scriptversion"
exit $?
;;
+ cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+ func_cl_wrapper "$@" # Doesn't return...
+ ;;
esac
ofile=
cfile=
-eat=
for arg
do
@@ -66,8 +233,8 @@ do
else
case $1 in
-o)
- # configure might choose to run compile as `compile cc -o foo foo.c'.
- # So we strip `-o arg' only if arg is an object.
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ # So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
@@ -94,10 +261,10 @@ do
done
if test -z "$ofile" || test -z "$cfile"; then
- # If no `-o' option was seen then we might have been invoked from a
+ # If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
- # `.c' file was seen then we are probably linking. That is also
+ # '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
@@ -106,7 +273,7 @@ fi
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
-# Note: use `[/\\:.-]' here to ensure that we don't use the same name
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
diff --git a/configure b/configure
index b8b776f..e02abff 100755
--- a/configure
+++ b/configure
@@ -2735,7 +2735,7 @@ fi
# Define the identity of the package.
PACKAGE=simple-scan
- VERSION=3.4.0
+ VERSION=3.4.1
cat >>confdefs.h <<_ACEOF
diff --git a/configure.ac b/configure.ac
index efc7874..9a86ec4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(configure.ac)
-AM_INIT_AUTOMAKE(simple-scan, 3.4.0)
+AM_INIT_AUTOMAKE(simple-scan, 3.4.1)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
GNOME_MAINTAINER_MODE_DEFINES
diff --git a/depcomp b/depcomp
index df8eea7..bd0ac08 100755
--- a/depcomp
+++ b/depcomp
@@ -1,10 +1,10 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2011-12-04.11; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
-# Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
+# 2011 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ Environment variables:
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
- tmpdepfile Temporary file to use when outputing dependencies.
+ tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
@@ -90,10 +90,18 @@ if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
- cygpath_u="sed s,\\\\\\\\,/,g"
+ cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
+if test "$depmode" = msvc7msys; then
+ # This is just like msvc7 but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvc7
+fi
+
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
@@ -158,10 +166,12 @@ gcc)
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
-## well.
+## well. hp depmode also adds that space, but also prefixes the VPATH
+## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
- sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
@@ -405,6 +415,52 @@ tru64)
rm -f "$tmpdepfile"
;;
+msvc7)
+ if test "$libtool" = yes; then
+ showIncludes=-Wc,-showIncludes
+ else
+ showIncludes=-showIncludes
+ fi
+ "$@" $showIncludes > "$tmpdepfile"
+ stat=$?
+ grep -v '^Note: including file: ' "$tmpdepfile"
+ if test "$stat" = 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ # The first sed program below extracts the file names and escapes
+ # backslashes for cygpath. The second sed program outputs the file
+ # name when reading, but also accumulates all include files in the
+ # hold buffer in order to output them again at the end. This only
+ # works with sed implementations that can handle large buffers.
+ sed < "$tmpdepfile" -n '
+/^Note: including file: *\(.*\)/ {
+ s//\1/
+ s/\\/\\\\/g
+ p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/ \1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+ s/.*/ /
+ G
+ p
+}' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvc7msys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
@@ -503,7 +559,9 @@ makedepend)
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
- cat < "$tmpdepfile" > "$depfile"
+ # makedepend may prepend the VPATH from the source file name to the object.
+ # No need to regex-escape $object, excess matching of '.' is harmless.
+ sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
diff --git a/help/C/legal.xml b/help/C/legal.xml
new file mode 100644
index 0000000..86d6173
--- /dev/null
+++ b/help/C/legal.xml
@@ -0,0 +1,9 @@
+<license xmlns="http://projectmallard.org/1.0/"
+ href="http://creativecommons.org/licenses/by-sa/3.0/">
+<p>This work is licensed under a
+<link href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons
+Attribution-Share Alike 3.0 Unported License</link>.</p>
+<p>As a special exception, the copyright holders give you permission to copy,
+modify, and distribute the example code contained in this document under the
+terms of your choosing, without restriction.</p>
+</license>
diff --git a/help/Makefile.am b/help/Makefile.am
index 9cba84d..66bca3c 100644
--- a/help/Makefile.am
+++ b/help/Makefile.am
@@ -1,11 +1,13 @@
@YELP_HELP_RULES@
HELP_ID = simple-scan
+HELP_POT = simple-scan-help.pot
HELP_FILES = index.page \
adf.page \
crop.page \
dpi.page \
email.page \
+ legal.xml \
print.page \
reorder.page \
rotate.page \
diff --git a/help/Makefile.in b/help/Makefile.in
index 4371892..3ff9bbb 100644
--- a/help/Makefile.in
+++ b/help/Makefile.in
@@ -173,11 +173,13 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
HELP_ID = simple-scan
+HELP_POT = simple-scan-help.pot
HELP_FILES = index.page \
adf.page \
crop.page \
dpi.page \
email.page \
+ legal.xml \
print.page \
reorder.page \
rotate.page \
diff --git a/help/de/legal.xml b/help/de/legal.xml
new file mode 100644
index 0000000..46a7e88
--- /dev/null
+++ b/help/de/legal.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<license xmlns="http://projectmallard.org/1.0/" href="http://creativecommons.org/licenses/by-sa/3.0/">
+<p>This work is licensed under a
+<link href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons
+Attribution-Share Alike 3.0 Unported License</link>.</p>
+<p>As a special exception, the copyright holders give you permission to copy,
+modify, and distribute the example code contained in this document under the
+terms of your choosing, without restriction.</p>
+</license>
diff --git a/install-sh b/install-sh
index 6781b98..a9244eb 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2011-01-19.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -156,6 +156,10 @@ while test $# -ne 0; do
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
+ # Protect names problematic for `test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
shift;;
-T) no_target_directory=true;;
@@ -186,6 +190,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
fi
shift # arg
dst_arg=$arg
+ # Protect names problematic for `test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
done
fi
@@ -200,7 +208,11 @@ if test $# -eq 0; then
fi
if test -z "$dir_arg"; then
- trap '(exit $?); exit' 1 2 13 15
+ do_exit='(exit $ret); exit $ret'
+ trap "ret=129; $do_exit" 1
+ trap "ret=130; $do_exit" 2
+ trap "ret=141; $do_exit" 13
+ trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
@@ -228,9 +240,9 @@ fi
for src
do
- # Protect names starting with `-'.
+ # Protect names problematic for `test' and other utilities.
case $src in
- -*) src=./$src;;
+ -* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
@@ -252,12 +264,7 @@ do
echo "$0: no destination specified." >&2
exit 1
fi
-
dst=$dst_arg
- # Protect names starting with `-'.
- case $dst in
- -*) dst=./$dst;;
- esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
@@ -385,7 +392,7 @@ do
case $dstdir in
/*) prefix='/';;
- -*) prefix='./';;
+ [-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
@@ -403,7 +410,7 @@ do
for d
do
- test -z "$d" && continue
+ test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
diff --git a/missing b/missing
index 28055d2..86a8fc3 100755
--- a/missing
+++ b/missing
@@ -1,10 +1,10 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2012-01-06.13; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
+# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
@@ -84,7 +84,6 @@ Supported PROGRAM values:
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
- tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
@@ -122,15 +121,6 @@ case $1 in
# Not GNU programs, they don't have --version.
;;
- tar*)
- if test -n "$run"; then
- echo 1>&2 "ERROR: \`tar' requires --run"
- exit 1
- elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
- exit 1
- fi
- ;;
-
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
@@ -226,7 +216,7 @@ WARNING: \`$1' $msg. You should only need it if
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
- eval LASTARG="\${$#}"
+ eval LASTARG=\${$#}
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
@@ -256,7 +246,7 @@ WARNING: \`$1' is $msg. You should only need it if
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
- eval LASTARG="\${$#}"
+ eval LASTARG=\${$#}
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
@@ -318,41 +308,6 @@ WARNING: \`$1' is $msg. You should only need it if
touch $file
;;
- tar*)
- shift
-
- # We have already tried tar in the generic part.
- # Look for gnutar/gtar before invocation to avoid ugly error
- # messages.
- if (gnutar --version > /dev/null 2>&1); then
- gnutar "$@" && exit 0
- fi
- if (gtar --version > /dev/null 2>&1); then
- gtar "$@" && exit 0
- fi
- firstarg="$1"
- if shift; then
- case $firstarg in
- *o*)
- firstarg=`echo "$firstarg" | sed s/o//`
- tar "$firstarg" "$@" && exit 0
- ;;
- esac
- case $firstarg in
- *h*)
- firstarg=`echo "$firstarg" | sed s/h//`
- tar "$firstarg" "$@" && exit 0
- ;;
- esac
- fi
-
- echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
- You may want to install GNU tar or Free paxutils, or check the
- command line arguments."
- exit 1
- ;;
-
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
diff --git a/src/book-view.c b/src/book-view.c
index b2b33f9..3be88c2 100644
--- a/src/book-view.c
+++ b/src/book-view.c
@@ -1,4 +1,4 @@
-/* book-view.c generated by valac 0.15.2, the Vala compiler
+/* book-view.c generated by valac 0.16.0, the Vala compiler
* generated from book-view.vala, do not modify */
/*
diff --git a/src/book.c b/src/book.c
index 1ec2970..711aa1c 100644
--- a/src/book.c
+++ b/src/book.c
@@ -1,4 +1,4 @@
-/* book.c generated by valac 0.15.2, the Vala compiler
+/* book.c generated by valac 0.16.0, the Vala compiler
* generated from book.vala, do not modify */
/*
@@ -528,7 +528,7 @@ static gchar* string_slice (const gchar* self, glong start, glong end) {
static GFile* book_make_indexed_file (Book* self, const gchar* uri, gint i) {
GFile* result = NULL;
- gint _tmp0_;
+ guint _tmp0_ = 0U;
const gchar* _tmp3_;
gchar* _tmp4_ = NULL;
gchar* basename;
@@ -550,8 +550,8 @@ static GFile* book_make_indexed_file (Book* self, const gchar* uri, gint i) {
GFile* _tmp31_;
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (uri != NULL, NULL);
- _tmp0_ = i;
- if (_tmp0_ == 0) {
+ _tmp0_ = book_get_n_pages (self);
+ if (_tmp0_ == ((guint) 1)) {
const gchar* _tmp1_;
GFile* _tmp2_ = NULL;
_tmp1_ = uri;
@@ -608,7 +608,7 @@ static GFile* book_make_indexed_file (Book* self, const gchar* uri, gint i) {
_tmp25_ = prefix;
_tmp26_ = i;
_tmp27_ = suffix;
- _tmp28_ = g_strdup_printf ("%s-%d%s", _tmp25_, _tmp26_, _tmp27_);
+ _tmp28_ = g_strdup_printf ("%s-%d%s", _tmp25_, _tmp26_ + 1, _tmp27_);
_tmp29_ = _tmp28_;
_tmp30_ = g_file_new_for_uri (_tmp29_);
_tmp31_ = _tmp30_;
diff --git a/src/book.vala b/src/book.vala
index c931f41..76a1901 100644
--- a/src/book.vala
+++ b/src/book.vala
@@ -85,7 +85,7 @@ public class Book
private File make_indexed_file (string uri, int i)
{
- if (i == 0)
+ if (get_n_pages () == 1)
return File.new_for_uri (uri);
/* Insert index before extension */
@@ -98,7 +98,7 @@ public class Book
prefix = uri.slice (0, uri.length - suffix.length);
}
- return File.new_for_uri ("%s-%d%s".printf (prefix, i, suffix));
+ return File.new_for_uri ("%s-%d%s".printf (prefix, i+1, suffix));
}
private void save_multi_file (string type, File file) throws Error
diff --git a/src/page-view.c b/src/page-view.c
index a2f26ef..9f18c73 100644
--- a/src/page-view.c
+++ b/src/page-view.c
@@ -1,4 +1,4 @@
-/* page-view.c generated by valac 0.15.2, the Vala compiler
+/* page-view.c generated by valac 0.16.0, the Vala compiler
* generated from page-view.vala, do not modify */
/*
diff --git a/src/page.c b/src/page.c
index 424c2e9..3d56125 100644
--- a/src/page.c
+++ b/src/page.c
@@ -1,4 +1,4 @@
-/* page.c generated by valac 0.15.2, the Vala compiler
+/* page.c generated by valac 0.16.0, the Vala compiler
* generated from page.vala, do not modify */
/*
diff --git a/src/scanner.c b/src/scanner.c
index c91ff4c..e6d731a 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -1,4 +1,4 @@
-/* scanner.c generated by valac 0.15.2, the Vala compiler
+/* scanner.c generated by valac 0.16.0, the Vala compiler
* generated from scanner.vala, do not modify */
/*
@@ -287,6 +287,7 @@ typedef struct _NotifyGotLinePrivate NotifyGotLinePrivate;
typedef struct _ScannerPrivate ScannerPrivate;
#define _g_async_queue_unref0(var) ((var == NULL) ? NULL : (var = (g_async_queue_unref (var), NULL)))
#define __g_list_free__scan_job_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__scan_job_unref0_ (var), NULL)))
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _scanner_unref0(var) ((var == NULL) ? NULL : (var = (scanner_unref (var), NULL)))
#define _notify_unref0(var) ((var == NULL) ? NULL : (var = (notify_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
@@ -636,8 +637,7 @@ struct _ScannerPrivate {
gchar* current_device;
SANE_Parameters parameters;
SANE_Int option_index;
- SANE_Int br_x_option_index;
- SANE_Int br_y_option_index;
+ GHashTable* options;
guchar* buffer;
gint buffer_length1;
gint _buffer_size_;
@@ -925,7 +925,9 @@ static void scanner_close_device (Scanner* self);
static void scanner_fail_scan (Scanner* self, gint error_code, const gchar* error_string);
static gboolean scanner_handle_requests (Scanner* self);
static void scanner_do_open (Scanner* self);
+static void _g_free0_ (gpointer var);
static void scanner_do_get_option (Scanner* self);
+static SANE_Option_Descriptor* scanner_get_option_by_name (Scanner* self, SANE_Handle handle, const gchar* name, gint* index);
static void scanner_do_complete_document (Scanner* self);
static void scanner_do_start (Scanner* self);
static void scanner_do_get_parameters (Scanner* self);
@@ -3481,7 +3483,7 @@ static void scanner_do_redetect (Scanner* self) {
_tmp2_ = status;
_tmp3_ = sane_status_to_string (_tmp2_);
_tmp4_ = _tmp3_;
- g_debug ("scanner.vala:318: sane_get_devices () -> %s", _tmp4_);
+ g_debug ("scanner.vala:317: sane_get_devices () -> %s", _tmp4_);
_g_free0 (_tmp4_);
_tmp5_ = status;
if (_tmp5_ != SANE_STATUS_GOOD) {
@@ -3489,7 +3491,7 @@ static void scanner_do_redetect (Scanner* self) {
const gchar* _tmp7_ = NULL;
_tmp6_ = status;
_tmp7_ = sane_strstatus (_tmp6_);
- g_warning ("scanner.vala:321: Unable to get SANE devices: %s", _tmp7_);
+ g_warning ("scanner.vala:320: Unable to get SANE devices: %s", _tmp7_);
self->priv->need_redetect = FALSE;
self->priv->state = SCAN_STATE_IDLE;
return;
@@ -3592,7 +3594,7 @@ static void scanner_do_redetect (Scanner* self) {
_tmp27_ = i;
_tmp28_ = _tmp26_[_tmp27_];
_tmp29_ = _tmp28_->type;
- g_debug ("scanner.vala:330: Device: name=\"%s\" vendor=\"%s\" model=\"%s\" type=" \
+ g_debug ("scanner.vala:329: Device: name=\"%s\" vendor=\"%s\" model=\"%s\" type=" \
"\"%s\"", _tmp17_, _tmp21_, _tmp25_, _tmp29_);
_tmp30_ = scan_device_new ();
scan_device = _tmp30_;
@@ -3708,7 +3710,7 @@ static gboolean scanner_set_default_option (Scanner* self, SANE_Handle handle, S
_tmp6_ = status;
_tmp7_ = sane_status_to_string (_tmp6_);
_tmp8_ = _tmp7_;
- g_debug ("scanner.vala:372: sane_control_option (%d, SANE_ACTION_SET_AUTO) -> %s", (gint) _tmp5_, _tmp8_);
+ g_debug ("scanner.vala:371: sane_control_option (%d, SANE_ACTION_SET_AUTO) -> %s", (gint) _tmp5_, _tmp8_);
_g_free0 (_tmp8_);
_tmp9_ = status;
if (_tmp9_ != SANE_STATUS_GOOD) {
@@ -3720,7 +3722,7 @@ static gboolean scanner_set_default_option (Scanner* self, SANE_Handle handle, S
_tmp11_ = _tmp10_->name;
_tmp12_ = status;
_tmp13_ = sane_strstatus (_tmp12_);
- g_warning ("scanner.vala:374: Error setting default option %s: %s", _tmp11_, _tmp13_);
+ g_warning ("scanner.vala:373: Error setting default option %s: %s", _tmp11_, _tmp13_);
}
_tmp14_ = status;
result = _tmp14_ == SANE_STATUS_GOOD;
@@ -3780,7 +3782,7 @@ static void scanner_set_bool_option (Scanner* self, SANE_Handle handle, SANE_Opt
_tmp14_ = sane_status_to_string (_tmp13_);
_tmp15_ = _tmp14_;
_tmp16_ = _tmp9_;
- g_debug ("scanner.vala:386: sane_control_option (%d, SANE_ACTION_SET_VALUE, %s) " \
+ g_debug ("scanner.vala:385: sane_control_option (%d, SANE_ACTION_SET_VALUE, %s) " \
"-> (%s, %s)", (gint) _tmp11_, _tmp12_, _tmp15_, _tmp16_);
_g_free0 (_tmp15_);
if (_result_) {
@@ -3960,7 +3962,7 @@ static void scanner_set_int_option (Scanner* self, SANE_Handle handle, SANE_Opti
_tmp54_ = sane_status_to_string (status);
_tmp55_ = _tmp54_;
_tmp56_ = v;
- g_debug ("scanner.vala:423: sane_control_option (%d, SANE_ACTION_SET_VALUE, %d) " \
+ g_debug ("scanner.vala:422: sane_control_option (%d, SANE_ACTION_SET_VALUE, %d) " \
"-> (%s, %d)", (gint) _tmp52_, _tmp53_, _tmp55_, (gint) _tmp56_);
_g_free0 (_tmp55_);
_tmp57_ = v;
@@ -4134,7 +4136,7 @@ static void scanner_set_fixed_option (Scanner* self, SANE_Handle handle, SANE_Op
_tmp50_ = sane_status_to_string (status);
_tmp51_ = _tmp50_;
_tmp52_ = SANE_UNFIX (v_fixed);
- g_debug ("scanner.vala:463: sane_control_option (%d, SANE_ACTION_SET_VALUE, %f) " \
+ g_debug ("scanner.vala:462: sane_control_option (%d, SANE_ACTION_SET_VALUE, %f) " \
"-> (%s, %f)", (gint) _tmp48_, _tmp49_, _tmp51_, _tmp52_);
_g_free0 (_tmp51_);
_tmp53_ = SANE_UNFIX (v_fixed);
@@ -4277,7 +4279,7 @@ static gboolean scanner_set_string_option (Scanner* self, SANE_Handle handle, SA
_tmp34_ = sane_status_to_string (status);
_tmp35_ = _tmp34_;
_tmp36_ = _vala_result;
- g_debug ("scanner.vala:481: sane_control_option (%d, SANE_ACTION_SET_VALUE, \"%s" \
+ g_debug ("scanner.vala:480: sane_control_option (%d, SANE_ACTION_SET_VALUE, \"%s" \
"\") -> (%s, \"%s\")", (gint) _tmp32_, _tmp33_, _tmp35_, _tmp36_);
_g_free0 (_tmp35_);
result = status == SANE_STATUS_GOOD;
@@ -5154,7 +5156,7 @@ static void scanner_log_option (Scanner* self, SANE_Int index, SANE_Option_Descr
}
}
_tmp214_ = s;
- g_debug ("scanner.vala:669: %s", _tmp214_);
+ g_debug ("scanner.vala:668: %s", _tmp214_);
_tmp215_ = option;
_tmp216_ = _tmp215_->desc;
if (_tmp216_ != NULL) {
@@ -5162,7 +5164,7 @@ static void scanner_log_option (Scanner* self, SANE_Int index, SANE_Option_Descr
const gchar* _tmp218_;
_tmp217_ = option;
_tmp218_ = _tmp217_->desc;
- g_debug ("scanner.vala:672: Description: %s", _tmp218_);
+ g_debug ("scanner.vala:671: Description: %s", _tmp218_);
}
_g_free0 (s);
}
@@ -5351,11 +5353,13 @@ static void scanner_close_device (Scanner* self) {
SANE_Handle _tmp2_;
_tmp1_ = self->priv->handle;
sane_cancel (_tmp1_);
- g_debug ("scanner.vala:699: sane_cancel ()");
+ g_debug ("scanner.vala:698: sane_cancel ()");
_tmp2_ = self->priv->handle;
sane_close (_tmp2_);
- g_debug ("scanner.vala:702: sane_close ()");
+ g_debug ("scanner.vala:701: sane_close ()");
self->priv->have_handle = FALSE;
+ _g_hash_table_unref0 (self->priv->options);
+ self->priv->options = NULL;
}
self->priv->buffer = (g_free (self->priv->buffer), NULL);
self->priv->buffer = NULL;
@@ -5495,6 +5499,11 @@ static gboolean scanner_handle_requests (Scanner* self) {
}
+static void _g_free0_ (gpointer var) {
+ var = (g_free (var), NULL);
+}
+
+
static void scanner_do_open (Scanner* self) {
GList* _tmp0_;
gconstpointer _tmp1_;
@@ -5507,20 +5516,23 @@ static void scanner_do_open (Scanner* self) {
ScanJob* _tmp11_;
const gchar* _tmp12_;
gboolean _tmp14_;
- ScanJob* _tmp19_;
- const gchar* _tmp20_;
- SANE_Handle _tmp21_ = {0};
- SANE_Status _tmp22_ = 0;
+ GHashFunc _tmp19_;
+ GEqualFunc _tmp20_;
+ GHashTable* _tmp21_;
+ ScanJob* _tmp22_;
+ const gchar* _tmp23_;
+ SANE_Handle _tmp24_ = {0};
+ SANE_Status _tmp25_ = 0;
SANE_Status status;
- ScanJob* _tmp23_;
- const gchar* _tmp24_;
- SANE_Status _tmp25_;
- gchar* _tmp26_ = NULL;
- gchar* _tmp27_;
+ ScanJob* _tmp26_;
+ const gchar* _tmp27_;
SANE_Status _tmp28_;
- ScanJob* _tmp33_;
- const gchar* _tmp34_;
- gchar* _tmp35_;
+ gchar* _tmp29_ = NULL;
+ gchar* _tmp30_;
+ SANE_Status _tmp31_;
+ ScanJob* _tmp36_;
+ const gchar* _tmp37_;
+ gchar* _tmp38_;
g_return_if_fail (self != NULL);
_tmp0_ = self->priv->job_queue;
_tmp1_ = _tmp0_->data;
@@ -5531,8 +5543,6 @@ static void scanner_do_open (Scanner* self) {
self->priv->page_number = 0;
self->priv->notified_page = -1;
self->priv->option_index = (SANE_Int) 0;
- self->priv->br_x_option_index = (SANE_Int) 0;
- self->priv->br_y_option_index = (SANE_Int) 0;
_tmp4_ = job;
_tmp5_ = _tmp4_->device;
if (_tmp5_ == NULL) {
@@ -5557,7 +5567,7 @@ static void scanner_do_open (Scanner* self) {
_tmp12_ = _tmp11_->device;
if (_tmp12_ == NULL) {
const gchar* _tmp13_ = NULL;
- g_warning ("scanner.vala:773: No scan device available");
+ g_warning ("scanner.vala:771: No scan device available");
_tmp13_ = _ ("No scanners available. Please connect a scanner.");
scanner_fail_scan (self, 0, _tmp13_);
_scan_job_unref0 (job);
@@ -5579,45 +5589,50 @@ static void scanner_do_open (Scanner* self) {
}
_tmp18_ = self->priv->handle;
sane_close (_tmp18_);
- g_debug ("scanner.vala:790: sane_close ()");
+ g_debug ("scanner.vala:788: sane_close ()");
self->priv->have_handle = FALSE;
}
_g_free0 (self->priv->current_device);
self->priv->current_device = NULL;
self->priv->have_handle = FALSE;
- _tmp19_ = job;
- _tmp20_ = _tmp19_->device;
- _tmp22_ = sane_open (_tmp20_, &_tmp21_);
- self->priv->handle = _tmp21_;
- status = _tmp22_;
- _tmp23_ = job;
- _tmp24_ = _tmp23_->device;
- _tmp25_ = status;
- _tmp26_ = sane_status_to_string (_tmp25_);
- _tmp27_ = _tmp26_;
- g_debug ("scanner.vala:798: sane_open (\"%s\") -> %s", _tmp24_, _tmp27_);
- _g_free0 (_tmp27_);
+ _tmp19_ = g_str_hash;
+ _tmp20_ = g_str_equal;
+ _tmp21_ = g_hash_table_new_full (_tmp19_, _tmp20_, _g_free0_, NULL);
+ _g_hash_table_unref0 (self->priv->options);
+ self->priv->options = _tmp21_;
+ _tmp22_ = job;
+ _tmp23_ = _tmp22_->device;
+ _tmp25_ = sane_open (_tmp23_, &_tmp24_);
+ self->priv->handle = _tmp24_;
+ status = _tmp25_;
+ _tmp26_ = job;
+ _tmp27_ = _tmp26_->device;
_tmp28_ = status;
- if (_tmp28_ != SANE_STATUS_GOOD) {
- SANE_Status _tmp29_;
- const gchar* _tmp30_ = NULL;
- SANE_Status _tmp31_;
- const gchar* _tmp32_ = NULL;
- _tmp29_ = status;
- _tmp30_ = sane_strstatus (_tmp29_);
- g_warning ("scanner.vala:802: Unable to get open device: %s", _tmp30_);
- _tmp31_ = status;
- _tmp32_ = _ ("Unable to connect to scanner");
- scanner_fail_scan (self, (gint) _tmp31_, _tmp32_);
+ _tmp29_ = sane_status_to_string (_tmp28_);
+ _tmp30_ = _tmp29_;
+ g_debug ("scanner.vala:797: sane_open (\"%s\") -> %s", _tmp27_, _tmp30_);
+ _g_free0 (_tmp30_);
+ _tmp31_ = status;
+ if (_tmp31_ != SANE_STATUS_GOOD) {
+ SANE_Status _tmp32_;
+ const gchar* _tmp33_ = NULL;
+ SANE_Status _tmp34_;
+ const gchar* _tmp35_ = NULL;
+ _tmp32_ = status;
+ _tmp33_ = sane_strstatus (_tmp32_);
+ g_warning ("scanner.vala:801: Unable to get open device: %s", _tmp33_);
+ _tmp34_ = status;
+ _tmp35_ = _ ("Unable to connect to scanner");
+ scanner_fail_scan (self, (gint) _tmp34_, _tmp35_);
_scan_job_unref0 (job);
return;
}
self->priv->have_handle = TRUE;
- _tmp33_ = job;
- _tmp34_ = _tmp33_->device;
- _tmp35_ = g_strdup (_tmp34_);
+ _tmp36_ = job;
+ _tmp37_ = _tmp36_->device;
+ _tmp38_ = g_strdup (_tmp37_);
_g_free0 (self->priv->current_device);
- self->priv->current_device = _tmp35_;
+ self->priv->current_device = _tmp38_;
self->priv->state = SCAN_STATE_GET_OPTION;
_scan_job_unref0 (job);
}
@@ -5637,18 +5652,19 @@ static void scanner_do_get_option (Scanner* self) {
SANE_Int index;
SANE_Int _tmp8_;
SANE_Option_Descriptor* _tmp9_;
- SANE_Int _tmp54_;
- SANE_Option_Descriptor* _tmp55_;
- SANE_Option_Descriptor* _tmp56_;
- SANE_Value_Type _tmp57_;
- SANE_Option_Descriptor* _tmp58_;
- SANE_Int _tmp59_;
- SANE_Option_Descriptor* _tmp60_;
- const gchar* _tmp61_;
- SANE_Option_Descriptor* _tmp62_;
- const gchar* _tmp63_;
- const gchar* _tmp64_;
- const gchar* _tmp294_;
+ SANE_Int _tmp332_;
+ SANE_Option_Descriptor* _tmp333_;
+ SANE_Option_Descriptor* _tmp334_;
+ SANE_Value_Type _tmp335_;
+ SANE_Option_Descriptor* _tmp336_;
+ SANE_Int _tmp337_;
+ SANE_Option_Descriptor* _tmp338_;
+ const gchar* _tmp339_;
+ GHashTable* _tmp340_;
+ SANE_Option_Descriptor* _tmp341_;
+ const gchar* _tmp342_;
+ gchar* _tmp343_;
+ SANE_Int _tmp344_;
g_return_if_fail (self != NULL);
_tmp0_ = self->priv->job_queue;
_tmp1_ = _tmp0_->data;
@@ -5659,438 +5675,305 @@ static void scanner_do_get_option (Scanner* self) {
_tmp5_ = sane_get_option_descriptor (_tmp3_, _tmp4_);
option = _tmp5_;
_tmp6_ = self->priv->option_index;
- g_debug ("scanner.vala:819: sane_get_option_descriptor (%d)", (gint) _tmp6_);
+ g_debug ("scanner.vala:818: sane_get_option_descriptor (%d)", (gint) _tmp6_);
_tmp7_ = self->priv->option_index;
index = _tmp7_;
_tmp8_ = self->priv->option_index;
self->priv->option_index = _tmp8_ + 1;
_tmp9_ = option;
if (_tmp9_ == NULL) {
- SANE_Int _tmp10_;
- SANE_Int _tmp32_;
- _tmp10_ = self->priv->br_x_option_index;
- if (_tmp10_ != ((SANE_Int) 0)) {
- SANE_Handle _tmp11_;
- SANE_Int _tmp12_;
- SANE_Option_Descriptor* _tmp13_ = NULL;
- SANE_Int _tmp14_;
- SANE_Option_Descriptor* _tmp15_;
- SANE_Constraint_Type _tmp16_;
- _tmp11_ = self->priv->handle;
- _tmp12_ = self->priv->br_x_option_index;
- _tmp13_ = sane_get_option_descriptor (_tmp11_, _tmp12_);
- option = _tmp13_;
- _tmp14_ = self->priv->br_x_option_index;
- g_debug ("scanner.vala:829: sane_get_option_descriptor (%d)", (gint) _tmp14_);
- _tmp15_ = option;
- _tmp16_ = _tmp15_->constraint_type;
- if (_tmp16_ == SANE_CONSTRAINT_RANGE) {
- SANE_Option_Descriptor* _tmp17_;
- SANE_Value_Type _tmp18_;
- _tmp17_ = option;
- _tmp18_ = _tmp17_->type;
- if (_tmp18_ == SANE_TYPE_FIXED) {
- SANE_Handle _tmp19_;
- SANE_Option_Descriptor* _tmp20_;
- SANE_Int _tmp21_;
- SANE_Option_Descriptor* _tmp22_;
- SANE_Range* _tmp23_;
- SANE_Word _tmp24_;
- gdouble _tmp25_ = 0.0;
- _tmp19_ = self->priv->handle;
- _tmp20_ = option;
- _tmp21_ = self->priv->br_x_option_index;
- _tmp22_ = option;
- _tmp23_ = _tmp22_->constraint.range;
- _tmp24_ = _tmp23_->max;
- _tmp25_ = SANE_UNFIX ((SANE_Fixed) _tmp24_);
- scanner_set_fixed_option (self, _tmp19_, _tmp20_, _tmp21_, _tmp25_, NULL);
- } else {
- SANE_Handle _tmp26_;
- SANE_Option_Descriptor* _tmp27_;
- SANE_Int _tmp28_;
- SANE_Option_Descriptor* _tmp29_;
- SANE_Range* _tmp30_;
- SANE_Word _tmp31_;
- _tmp26_ = self->priv->handle;
- _tmp27_ = option;
- _tmp28_ = self->priv->br_x_option_index;
- _tmp29_ = option;
- _tmp30_ = _tmp29_->constraint.range;
- _tmp31_ = _tmp30_->max;
- scanner_set_int_option (self, _tmp26_, _tmp27_, _tmp28_, (gint) _tmp31_, NULL);
- }
- }
- }
- _tmp32_ = self->priv->br_y_option_index;
- if (_tmp32_ != ((SANE_Int) 0)) {
- SANE_Handle _tmp33_;
- SANE_Int _tmp34_;
- SANE_Option_Descriptor* _tmp35_ = NULL;
- SANE_Int _tmp36_;
- SANE_Option_Descriptor* _tmp37_;
- SANE_Constraint_Type _tmp38_;
- _tmp33_ = self->priv->handle;
- _tmp34_ = self->priv->br_y_option_index;
- _tmp35_ = sane_get_option_descriptor (_tmp33_, _tmp34_);
- option = _tmp35_;
- _tmp36_ = self->priv->br_y_option_index;
- g_debug ("scanner.vala:841: sane_get_option_descriptor (%d)", (gint) _tmp36_);
- _tmp37_ = option;
- _tmp38_ = _tmp37_->constraint_type;
- if (_tmp38_ == SANE_CONSTRAINT_RANGE) {
- SANE_Option_Descriptor* _tmp39_;
- SANE_Value_Type _tmp40_;
- _tmp39_ = option;
- _tmp40_ = _tmp39_->type;
- if (_tmp40_ == SANE_TYPE_FIXED) {
- SANE_Handle _tmp41_;
- SANE_Option_Descriptor* _tmp42_;
- SANE_Int _tmp43_;
- SANE_Option_Descriptor* _tmp44_;
- SANE_Range* _tmp45_;
- SANE_Word _tmp46_;
- gdouble _tmp47_ = 0.0;
- _tmp41_ = self->priv->handle;
- _tmp42_ = option;
- _tmp43_ = self->priv->br_y_option_index;
- _tmp44_ = option;
- _tmp45_ = _tmp44_->constraint.range;
- _tmp46_ = _tmp45_->max;
- _tmp47_ = SANE_UNFIX ((SANE_Fixed) _tmp46_);
- scanner_set_fixed_option (self, _tmp41_, _tmp42_, _tmp43_, _tmp47_, NULL);
- } else {
- SANE_Handle _tmp48_;
- SANE_Option_Descriptor* _tmp49_;
- SANE_Int _tmp50_;
- SANE_Option_Descriptor* _tmp51_;
- SANE_Range* _tmp52_;
- SANE_Word _tmp53_;
- _tmp48_ = self->priv->handle;
- _tmp49_ = option;
- _tmp50_ = self->priv->br_y_option_index;
- _tmp51_ = option;
- _tmp52_ = _tmp51_->constraint.range;
- _tmp53_ = _tmp52_->max;
- scanner_set_int_option (self, _tmp48_, _tmp49_, _tmp50_, (gint) _tmp53_, NULL);
- }
- }
- }
- self->priv->state = SCAN_STATE_START;
- _scan_job_unref0 (job);
- return;
- }
- _tmp54_ = index;
- _tmp55_ = option;
- scanner_log_option (self, _tmp54_, _tmp55_);
- _tmp56_ = option;
- _tmp57_ = _tmp56_->type;
- if (_tmp57_ == SANE_TYPE_GROUP) {
- _scan_job_unref0 (job);
- return;
- }
- _tmp58_ = option;
- _tmp59_ = _tmp58_->cap;
- if ((_tmp59_ & SANE_CAP_INACTIVE) != ((SANE_Int) 0)) {
- _scan_job_unref0 (job);
- return;
- }
- _tmp60_ = option;
- _tmp61_ = _tmp60_->name;
- if (_tmp61_ == NULL) {
- _scan_job_unref0 (job);
- return;
- }
- _tmp62_ = option;
- _tmp63_ = _tmp62_->name;
- _tmp64_ = SANE_NAME_SCAN_RESOLUTION;
- if (g_strcmp0 (_tmp63_, _tmp64_) == 0) {
- SANE_Option_Descriptor* _tmp65_;
- SANE_Value_Type _tmp66_;
- _tmp65_ = option;
- _tmp66_ = _tmp65_->type;
- if (_tmp66_ == SANE_TYPE_FIXED) {
- SANE_Handle _tmp67_;
- SANE_Option_Descriptor* _tmp68_;
- SANE_Int _tmp69_;
- ScanJob* _tmp70_;
- gdouble _tmp71_;
- ScanJob* _tmp72_;
- gdouble _tmp73_ = 0.0;
- _tmp67_ = self->priv->handle;
- _tmp68_ = option;
- _tmp69_ = index;
- _tmp70_ = job;
- _tmp71_ = _tmp70_->dpi;
- _tmp72_ = job;
- scanner_set_fixed_option (self, _tmp67_, _tmp68_, _tmp69_, _tmp71_, &_tmp73_);
- _tmp72_->dpi = _tmp73_;
- } else {
- gint dpi = 0;
- SANE_Handle _tmp74_;
- SANE_Option_Descriptor* _tmp75_;
- SANE_Int _tmp76_;
- ScanJob* _tmp77_;
- gdouble _tmp78_;
- gint _tmp79_ = 0;
- ScanJob* _tmp80_;
- gint _tmp81_;
- _tmp74_ = self->priv->handle;
- _tmp75_ = option;
- _tmp76_ = index;
- _tmp77_ = job;
- _tmp78_ = _tmp77_->dpi;
- scanner_set_int_option (self, _tmp74_, _tmp75_, _tmp76_, (gint) _tmp78_, &_tmp79_);
- dpi = _tmp79_;
- _tmp80_ = job;
- _tmp81_ = dpi;
- _tmp80_->dpi = (gdouble) _tmp81_;
- }
- } else {
- SANE_Option_Descriptor* _tmp82_;
- const gchar* _tmp83_;
- const gchar* _tmp84_;
- _tmp82_ = option;
- _tmp83_ = _tmp82_->name;
- _tmp84_ = SANE_NAME_SCAN_SOURCE;
- if (g_strcmp0 (_tmp83_, _tmp84_) == 0) {
- gchar* _tmp85_;
- const gchar* _tmp86_ = NULL;
- gchar* _tmp87_;
- gchar* _tmp88_;
- const gchar* _tmp89_ = NULL;
- gchar* _tmp90_;
- gchar* _tmp91_;
- gchar* _tmp92_;
- const gchar* _tmp93_ = NULL;
- gchar* _tmp94_;
- gchar** _tmp95_ = NULL;
+ SANE_Handle _tmp10_;
+ const gchar* _tmp11_;
+ gint _tmp12_ = 0;
+ SANE_Option_Descriptor* _tmp13_ = NULL;
+ SANE_Option_Descriptor* _tmp14_;
+ SANE_Handle _tmp86_;
+ const gchar* _tmp87_;
+ gint _tmp88_ = 0;
+ SANE_Option_Descriptor* _tmp89_ = NULL;
+ SANE_Option_Descriptor* _tmp90_;
+ SANE_Handle _tmp142_;
+ gint _tmp143_ = 0;
+ SANE_Option_Descriptor* _tmp144_ = NULL;
+ SANE_Option_Descriptor* _tmp145_;
+ SANE_Handle _tmp153_;
+ gint _tmp154_ = 0;
+ SANE_Option_Descriptor* _tmp155_ = NULL;
+ SANE_Option_Descriptor* _tmp156_;
+ SANE_Handle _tmp164_;
+ gint _tmp165_ = 0;
+ SANE_Option_Descriptor* _tmp166_ = NULL;
+ SANE_Option_Descriptor* _tmp167_;
+ SANE_Handle _tmp180_;
+ const gchar* _tmp181_;
+ gint _tmp182_ = 0;
+ SANE_Option_Descriptor* _tmp183_ = NULL;
+ SANE_Option_Descriptor* _tmp184_;
+ SANE_Handle _tmp214_;
+ const gchar* _tmp215_;
+ gint _tmp216_ = 0;
+ SANE_Option_Descriptor* _tmp217_ = NULL;
+ SANE_Option_Descriptor* _tmp218_;
+ SANE_Handle _tmp236_;
+ const gchar* _tmp237_;
+ gint _tmp238_ = 0;
+ SANE_Option_Descriptor* _tmp239_ = NULL;
+ SANE_Option_Descriptor* _tmp240_;
+ SANE_Handle _tmp258_;
+ const gchar* _tmp259_;
+ gint _tmp260_ = 0;
+ SANE_Option_Descriptor* _tmp261_ = NULL;
+ SANE_Option_Descriptor* _tmp262_;
+ SANE_Handle _tmp277_;
+ const gchar* _tmp278_;
+ gint _tmp279_ = 0;
+ SANE_Option_Descriptor* _tmp280_ = NULL;
+ SANE_Option_Descriptor* _tmp281_;
+ const gchar* _tmp296_;
+ _tmp10_ = self->priv->handle;
+ _tmp11_ = SANE_NAME_SCAN_SOURCE;
+ _tmp13_ = scanner_get_option_by_name (self, _tmp10_, _tmp11_, &_tmp12_);
+ index = (SANE_Int) _tmp12_;
+ option = _tmp13_;
+ _tmp14_ = option;
+ if (_tmp14_ != NULL) {
+ gchar* _tmp15_;
+ const gchar* _tmp16_ = NULL;
+ gchar* _tmp17_;
+ gchar* _tmp18_;
+ const gchar* _tmp19_ = NULL;
+ gchar* _tmp20_;
+ gchar* _tmp21_;
+ gchar* _tmp22_;
+ const gchar* _tmp23_ = NULL;
+ gchar* _tmp24_;
+ gchar** _tmp25_ = NULL;
gchar** flatbed_sources;
gint flatbed_sources_length1;
gint _flatbed_sources_size_;
- gchar* _tmp96_;
- const gchar* _tmp97_ = NULL;
- gchar* _tmp98_;
- gchar* _tmp99_;
- gchar* _tmp100_;
- gchar* _tmp101_;
- gchar** _tmp102_ = NULL;
+ gchar* _tmp26_;
+ const gchar* _tmp27_ = NULL;
+ gchar* _tmp28_;
+ gchar* _tmp29_;
+ gchar* _tmp30_;
+ gchar* _tmp31_;
+ gchar** _tmp32_ = NULL;
gchar** adf_sources;
gint adf_sources_length1;
gint _adf_sources_size_;
- gchar* _tmp103_;
- const gchar* _tmp104_ = NULL;
- gchar* _tmp105_;
- gchar** _tmp106_ = NULL;
+ gchar* _tmp33_;
+ const gchar* _tmp34_ = NULL;
+ gchar* _tmp35_;
+ gchar** _tmp36_ = NULL;
gchar** adf_front_sources;
gint adf_front_sources_length1;
gint _adf_front_sources_size_;
- gchar* _tmp107_;
- const gchar* _tmp108_ = NULL;
- gchar* _tmp109_;
- gchar** _tmp110_ = NULL;
+ gchar* _tmp37_;
+ const gchar* _tmp38_ = NULL;
+ gchar* _tmp39_;
+ gchar** _tmp40_ = NULL;
gchar** adf_back_sources;
gint adf_back_sources_length1;
gint _adf_back_sources_size_;
- gchar* _tmp111_;
- const gchar* _tmp112_ = NULL;
- gchar* _tmp113_;
- gchar** _tmp114_ = NULL;
+ gchar* _tmp41_;
+ const gchar* _tmp42_ = NULL;
+ gchar* _tmp43_;
+ gchar** _tmp44_ = NULL;
gchar** adf_duplex_sources;
gint adf_duplex_sources_length1;
gint _adf_duplex_sources_size_;
- ScanJob* _tmp115_;
- ScanType _tmp116_;
- _tmp85_ = g_strdup ("Auto");
- _tmp86_ = SANE_I18N ("Auto");
- _tmp87_ = g_strdup (_tmp86_);
- _tmp88_ = g_strdup ("Flatbed");
- _tmp89_ = SANE_I18N ("Flatbed");
- _tmp90_ = g_strdup (_tmp89_);
- _tmp91_ = g_strdup ("FlatBed");
- _tmp92_ = g_strdup ("Normal");
- _tmp93_ = SANE_I18N ("Normal");
- _tmp94_ = g_strdup (_tmp93_);
- _tmp95_ = g_new0 (gchar*, 7 + 1);
- _tmp95_[0] = _tmp85_;
- _tmp95_[1] = _tmp87_;
- _tmp95_[2] = _tmp88_;
- _tmp95_[3] = _tmp90_;
- _tmp95_[4] = _tmp91_;
- _tmp95_[5] = _tmp92_;
- _tmp95_[6] = _tmp94_;
- flatbed_sources = _tmp95_;
+ ScanJob* _tmp45_;
+ ScanType _tmp46_;
+ _tmp15_ = g_strdup ("Auto");
+ _tmp16_ = SANE_I18N ("Auto");
+ _tmp17_ = g_strdup (_tmp16_);
+ _tmp18_ = g_strdup ("Flatbed");
+ _tmp19_ = SANE_I18N ("Flatbed");
+ _tmp20_ = g_strdup (_tmp19_);
+ _tmp21_ = g_strdup ("FlatBed");
+ _tmp22_ = g_strdup ("Normal");
+ _tmp23_ = SANE_I18N ("Normal");
+ _tmp24_ = g_strdup (_tmp23_);
+ _tmp25_ = g_new0 (gchar*, 7 + 1);
+ _tmp25_[0] = _tmp15_;
+ _tmp25_[1] = _tmp17_;
+ _tmp25_[2] = _tmp18_;
+ _tmp25_[3] = _tmp20_;
+ _tmp25_[4] = _tmp21_;
+ _tmp25_[5] = _tmp22_;
+ _tmp25_[6] = _tmp24_;
+ flatbed_sources = _tmp25_;
flatbed_sources_length1 = 7;
_flatbed_sources_size_ = flatbed_sources_length1;
- _tmp96_ = g_strdup ("Automatic Document Feeder");
- _tmp97_ = SANE_I18N ("Automatic Document Feeder");
- _tmp98_ = g_strdup (_tmp97_);
- _tmp99_ = g_strdup ("ADF");
- _tmp100_ = g_strdup ("Automatic Document Feeder(left aligned)");
- _tmp101_ = g_strdup ("Automatic Document Feeder(centrally aligned)");
- _tmp102_ = g_new0 (gchar*, 5 + 1);
- _tmp102_[0] = _tmp96_;
- _tmp102_[1] = _tmp98_;
- _tmp102_[2] = _tmp99_;
- _tmp102_[3] = _tmp100_;
- _tmp102_[4] = _tmp101_;
- adf_sources = _tmp102_;
+ _tmp26_ = g_strdup ("Automatic Document Feeder");
+ _tmp27_ = SANE_I18N ("Automatic Document Feeder");
+ _tmp28_ = g_strdup (_tmp27_);
+ _tmp29_ = g_strdup ("ADF");
+ _tmp30_ = g_strdup ("Automatic Document Feeder(left aligned)");
+ _tmp31_ = g_strdup ("Automatic Document Feeder(centrally aligned)");
+ _tmp32_ = g_new0 (gchar*, 5 + 1);
+ _tmp32_[0] = _tmp26_;
+ _tmp32_[1] = _tmp28_;
+ _tmp32_[2] = _tmp29_;
+ _tmp32_[3] = _tmp30_;
+ _tmp32_[4] = _tmp31_;
+ adf_sources = _tmp32_;
adf_sources_length1 = 5;
_adf_sources_size_ = adf_sources_length1;
- _tmp103_ = g_strdup ("ADF Front");
- _tmp104_ = SANE_I18N ("ADF Front");
- _tmp105_ = g_strdup (_tmp104_);
- _tmp106_ = g_new0 (gchar*, 2 + 1);
- _tmp106_[0] = _tmp103_;
- _tmp106_[1] = _tmp105_;
- adf_front_sources = _tmp106_;
+ _tmp33_ = g_strdup ("ADF Front");
+ _tmp34_ = SANE_I18N ("ADF Front");
+ _tmp35_ = g_strdup (_tmp34_);
+ _tmp36_ = g_new0 (gchar*, 2 + 1);
+ _tmp36_[0] = _tmp33_;
+ _tmp36_[1] = _tmp35_;
+ adf_front_sources = _tmp36_;
adf_front_sources_length1 = 2;
_adf_front_sources_size_ = adf_front_sources_length1;
- _tmp107_ = g_strdup ("ADF Back");
- _tmp108_ = SANE_I18N ("ADF Back");
- _tmp109_ = g_strdup (_tmp108_);
- _tmp110_ = g_new0 (gchar*, 2 + 1);
- _tmp110_[0] = _tmp107_;
- _tmp110_[1] = _tmp109_;
- adf_back_sources = _tmp110_;
+ _tmp37_ = g_strdup ("ADF Back");
+ _tmp38_ = SANE_I18N ("ADF Back");
+ _tmp39_ = g_strdup (_tmp38_);
+ _tmp40_ = g_new0 (gchar*, 2 + 1);
+ _tmp40_[0] = _tmp37_;
+ _tmp40_[1] = _tmp39_;
+ adf_back_sources = _tmp40_;
adf_back_sources_length1 = 2;
_adf_back_sources_size_ = adf_back_sources_length1;
- _tmp111_ = g_strdup ("ADF Duplex");
- _tmp112_ = SANE_I18N ("ADF Duplex");
- _tmp113_ = g_strdup (_tmp112_);
- _tmp114_ = g_new0 (gchar*, 2 + 1);
- _tmp114_[0] = _tmp111_;
- _tmp114_[1] = _tmp113_;
- adf_duplex_sources = _tmp114_;
+ _tmp41_ = g_strdup ("ADF Duplex");
+ _tmp42_ = SANE_I18N ("ADF Duplex");
+ _tmp43_ = g_strdup (_tmp42_);
+ _tmp44_ = g_new0 (gchar*, 2 + 1);
+ _tmp44_[0] = _tmp41_;
+ _tmp44_[1] = _tmp43_;
+ adf_duplex_sources = _tmp44_;
adf_duplex_sources_length1 = 2;
_adf_duplex_sources_size_ = adf_duplex_sources_length1;
- _tmp115_ = job;
- _tmp116_ = _tmp115_->type;
- switch (_tmp116_) {
+ _tmp45_ = job;
+ _tmp46_ = _tmp45_->type;
+ switch (_tmp46_) {
case SCAN_TYPE_SINGLE:
{
- SANE_Handle _tmp117_;
- SANE_Option_Descriptor* _tmp118_;
- SANE_Int _tmp119_;
- gboolean _tmp120_ = FALSE;
- _tmp117_ = self->priv->handle;
- _tmp118_ = option;
- _tmp119_ = index;
- _tmp120_ = scanner_set_default_option (self, _tmp117_, _tmp118_, _tmp119_);
- if (!_tmp120_) {
- SANE_Handle _tmp121_;
- SANE_Option_Descriptor* _tmp122_;
- SANE_Int _tmp123_;
- gchar** _tmp124_;
- gint _tmp124__length1;
- gboolean _tmp125_ = FALSE;
- _tmp121_ = self->priv->handle;
- _tmp122_ = option;
- _tmp123_ = index;
- _tmp124_ = flatbed_sources;
- _tmp124__length1 = flatbed_sources_length1;
- _tmp125_ = scanner_set_constrained_string_option (self, _tmp121_, _tmp122_, _tmp123_, _tmp124_, _tmp124__length1, NULL);
- if (!_tmp125_) {
- g_warning ("scanner.vala:925: Unable to set single page source, please file a bug");
+ SANE_Handle _tmp47_;
+ SANE_Option_Descriptor* _tmp48_;
+ SANE_Int _tmp49_;
+ gboolean _tmp50_ = FALSE;
+ _tmp47_ = self->priv->handle;
+ _tmp48_ = option;
+ _tmp49_ = index;
+ _tmp50_ = scanner_set_default_option (self, _tmp47_, _tmp48_, _tmp49_);
+ if (!_tmp50_) {
+ SANE_Handle _tmp51_;
+ SANE_Option_Descriptor* _tmp52_;
+ SANE_Int _tmp53_;
+ gchar** _tmp54_;
+ gint _tmp54__length1;
+ gboolean _tmp55_ = FALSE;
+ _tmp51_ = self->priv->handle;
+ _tmp52_ = option;
+ _tmp53_ = index;
+ _tmp54_ = flatbed_sources;
+ _tmp54__length1 = flatbed_sources_length1;
+ _tmp55_ = scanner_set_constrained_string_option (self, _tmp51_, _tmp52_, _tmp53_, _tmp54_, _tmp54__length1, NULL);
+ if (!_tmp55_) {
+ g_warning ("scanner.vala:872: Unable to set single page source, please file a bug");
}
}
break;
}
case SCAN_TYPE_ADF_FRONT:
{
- SANE_Handle _tmp126_;
- SANE_Option_Descriptor* _tmp127_;
- SANE_Int _tmp128_;
- gchar** _tmp129_;
- gint _tmp129__length1;
- gboolean _tmp130_ = FALSE;
- _tmp126_ = self->priv->handle;
- _tmp127_ = option;
- _tmp128_ = index;
- _tmp129_ = adf_front_sources;
- _tmp129__length1 = adf_front_sources_length1;
- _tmp130_ = scanner_set_constrained_string_option (self, _tmp126_, _tmp127_, _tmp128_, _tmp129_, _tmp129__length1, NULL);
- if (!_tmp130_) {
- SANE_Handle _tmp131_;
- SANE_Option_Descriptor* _tmp132_;
- SANE_Int _tmp133_;
- gchar** _tmp134_;
- gint _tmp134__length1;
- gboolean _tmp135_ = FALSE;
- _tmp131_ = self->priv->handle;
- _tmp132_ = option;
- _tmp133_ = index;
- _tmp134_ = adf_sources;
- _tmp134__length1 = adf_sources_length1;
- _tmp135_ = scanner_set_constrained_string_option (self, _tmp131_, _tmp132_, _tmp133_, _tmp134_, _tmp134__length1, NULL);
- if (!(!_tmp135_)) {
- g_warning ("scanner.vala:930: Unable to set front ADF source, please file a bug");
+ SANE_Handle _tmp56_;
+ SANE_Option_Descriptor* _tmp57_;
+ SANE_Int _tmp58_;
+ gchar** _tmp59_;
+ gint _tmp59__length1;
+ gboolean _tmp60_ = FALSE;
+ _tmp56_ = self->priv->handle;
+ _tmp57_ = option;
+ _tmp58_ = index;
+ _tmp59_ = adf_front_sources;
+ _tmp59__length1 = adf_front_sources_length1;
+ _tmp60_ = scanner_set_constrained_string_option (self, _tmp56_, _tmp57_, _tmp58_, _tmp59_, _tmp59__length1, NULL);
+ if (!_tmp60_) {
+ SANE_Handle _tmp61_;
+ SANE_Option_Descriptor* _tmp62_;
+ SANE_Int _tmp63_;
+ gchar** _tmp64_;
+ gint _tmp64__length1;
+ gboolean _tmp65_ = FALSE;
+ _tmp61_ = self->priv->handle;
+ _tmp62_ = option;
+ _tmp63_ = index;
+ _tmp64_ = adf_sources;
+ _tmp64__length1 = adf_sources_length1;
+ _tmp65_ = scanner_set_constrained_string_option (self, _tmp61_, _tmp62_, _tmp63_, _tmp64_, _tmp64__length1, NULL);
+ if (!(!_tmp65_)) {
+ g_warning ("scanner.vala:877: Unable to set front ADF source, please file a bug");
}
}
break;
}
case SCAN_TYPE_ADF_BACK:
{
- SANE_Handle _tmp136_;
- SANE_Option_Descriptor* _tmp137_;
- SANE_Int _tmp138_;
- gchar** _tmp139_;
- gint _tmp139__length1;
- gboolean _tmp140_ = FALSE;
- _tmp136_ = self->priv->handle;
- _tmp137_ = option;
- _tmp138_ = index;
- _tmp139_ = adf_back_sources;
- _tmp139__length1 = adf_back_sources_length1;
- _tmp140_ = scanner_set_constrained_string_option (self, _tmp136_, _tmp137_, _tmp138_, _tmp139_, _tmp139__length1, NULL);
- if (!_tmp140_) {
- SANE_Handle _tmp141_;
- SANE_Option_Descriptor* _tmp142_;
- SANE_Int _tmp143_;
- gchar** _tmp144_;
- gint _tmp144__length1;
- gboolean _tmp145_ = FALSE;
- _tmp141_ = self->priv->handle;
- _tmp142_ = option;
- _tmp143_ = index;
- _tmp144_ = adf_sources;
- _tmp144__length1 = adf_sources_length1;
- _tmp145_ = scanner_set_constrained_string_option (self, _tmp141_, _tmp142_, _tmp143_, _tmp144_, _tmp144__length1, NULL);
- if (!_tmp145_) {
- g_warning ("scanner.vala:935: Unable to set back ADF source, please file a bug");
+ SANE_Handle _tmp66_;
+ SANE_Option_Descriptor* _tmp67_;
+ SANE_Int _tmp68_;
+ gchar** _tmp69_;
+ gint _tmp69__length1;
+ gboolean _tmp70_ = FALSE;
+ _tmp66_ = self->priv->handle;
+ _tmp67_ = option;
+ _tmp68_ = index;
+ _tmp69_ = adf_back_sources;
+ _tmp69__length1 = adf_back_sources_length1;
+ _tmp70_ = scanner_set_constrained_string_option (self, _tmp66_, _tmp67_, _tmp68_, _tmp69_, _tmp69__length1, NULL);
+ if (!_tmp70_) {
+ SANE_Handle _tmp71_;
+ SANE_Option_Descriptor* _tmp72_;
+ SANE_Int _tmp73_;
+ gchar** _tmp74_;
+ gint _tmp74__length1;
+ gboolean _tmp75_ = FALSE;
+ _tmp71_ = self->priv->handle;
+ _tmp72_ = option;
+ _tmp73_ = index;
+ _tmp74_ = adf_sources;
+ _tmp74__length1 = adf_sources_length1;
+ _tmp75_ = scanner_set_constrained_string_option (self, _tmp71_, _tmp72_, _tmp73_, _tmp74_, _tmp74__length1, NULL);
+ if (!_tmp75_) {
+ g_warning ("scanner.vala:882: Unable to set back ADF source, please file a bug");
}
}
break;
}
case SCAN_TYPE_ADF_BOTH:
{
- SANE_Handle _tmp146_;
- SANE_Option_Descriptor* _tmp147_;
- SANE_Int _tmp148_;
- gchar** _tmp149_;
- gint _tmp149__length1;
- gboolean _tmp150_ = FALSE;
- _tmp146_ = self->priv->handle;
- _tmp147_ = option;
- _tmp148_ = index;
- _tmp149_ = adf_duplex_sources;
- _tmp149__length1 = adf_duplex_sources_length1;
- _tmp150_ = scanner_set_constrained_string_option (self, _tmp146_, _tmp147_, _tmp148_, _tmp149_, _tmp149__length1, NULL);
- if (!_tmp150_) {
- SANE_Handle _tmp151_;
- SANE_Option_Descriptor* _tmp152_;
- SANE_Int _tmp153_;
- gchar** _tmp154_;
- gint _tmp154__length1;
- gboolean _tmp155_ = FALSE;
- _tmp151_ = self->priv->handle;
- _tmp152_ = option;
- _tmp153_ = index;
- _tmp154_ = adf_sources;
- _tmp154__length1 = adf_sources_length1;
- _tmp155_ = scanner_set_constrained_string_option (self, _tmp151_, _tmp152_, _tmp153_, _tmp154_, _tmp154__length1, NULL);
- if (!_tmp155_) {
- g_warning ("scanner.vala:940: Unable to set duplex ADF source, please file a bug");
+ SANE_Handle _tmp76_;
+ SANE_Option_Descriptor* _tmp77_;
+ SANE_Int _tmp78_;
+ gchar** _tmp79_;
+ gint _tmp79__length1;
+ gboolean _tmp80_ = FALSE;
+ _tmp76_ = self->priv->handle;
+ _tmp77_ = option;
+ _tmp78_ = index;
+ _tmp79_ = adf_duplex_sources;
+ _tmp79__length1 = adf_duplex_sources_length1;
+ _tmp80_ = scanner_set_constrained_string_option (self, _tmp76_, _tmp77_, _tmp78_, _tmp79_, _tmp79__length1, NULL);
+ if (!_tmp80_) {
+ SANE_Handle _tmp81_;
+ SANE_Option_Descriptor* _tmp82_;
+ SANE_Int _tmp83_;
+ gchar** _tmp84_;
+ gint _tmp84__length1;
+ gboolean _tmp85_ = FALSE;
+ _tmp81_ = self->priv->handle;
+ _tmp82_ = option;
+ _tmp83_ = index;
+ _tmp84_ = adf_sources;
+ _tmp84__length1 = adf_sources_length1;
+ _tmp85_ = scanner_set_constrained_string_option (self, _tmp81_, _tmp82_, _tmp83_, _tmp84_, _tmp84__length1, NULL);
+ if (!_tmp85_) {
+ g_warning ("scanner.vala:887: Unable to set duplex ADF source, please file a bug");
}
}
break;
@@ -6103,504 +5986,714 @@ static void scanner_do_get_option (Scanner* self) {
adf_front_sources = (_vala_array_free (adf_front_sources, adf_front_sources_length1, (GDestroyNotify) g_free), NULL);
adf_sources = (_vala_array_free (adf_sources, adf_sources_length1, (GDestroyNotify) g_free), NULL);
flatbed_sources = (_vala_array_free (flatbed_sources, flatbed_sources_length1, (GDestroyNotify) g_free), NULL);
- } else {
- SANE_Option_Descriptor* _tmp156_;
- const gchar* _tmp157_;
- _tmp156_ = option;
- _tmp157_ = _tmp156_->name;
- if (g_strcmp0 (_tmp157_, "duplex") == 0) {
- SANE_Option_Descriptor* _tmp158_;
- SANE_Value_Type _tmp159_;
- _tmp158_ = option;
- _tmp159_ = _tmp158_->type;
- if (_tmp159_ == SANE_TYPE_BOOL) {
- SANE_Handle _tmp160_;
- SANE_Option_Descriptor* _tmp161_;
- SANE_Int _tmp162_;
- ScanJob* _tmp163_;
- ScanType _tmp164_;
- _tmp160_ = self->priv->handle;
- _tmp161_ = option;
- _tmp162_ = index;
- _tmp163_ = job;
- _tmp164_ = _tmp163_->type;
- scanner_set_bool_option (self, _tmp160_, _tmp161_, _tmp162_, _tmp164_ == SCAN_TYPE_ADF_BOTH, NULL);
+ }
+ _tmp86_ = self->priv->handle;
+ _tmp87_ = SANE_NAME_SCAN_MODE;
+ _tmp89_ = scanner_get_option_by_name (self, _tmp86_, _tmp87_, &_tmp88_);
+ index = (SANE_Int) _tmp88_;
+ option = _tmp89_;
+ _tmp90_ = option;
+ if (_tmp90_ != NULL) {
+ const gchar* _tmp91_;
+ gchar* _tmp92_;
+ gchar* _tmp93_;
+ gchar* _tmp94_;
+ gchar** _tmp95_ = NULL;
+ gchar** color_scan_modes;
+ gint color_scan_modes_length1;
+ gint _color_scan_modes_size_;
+ const gchar* _tmp96_;
+ gchar* _tmp97_;
+ gchar* _tmp98_;
+ gchar* _tmp99_;
+ const gchar* _tmp100_ = NULL;
+ gchar* _tmp101_;
+ gchar* _tmp102_;
+ gchar** _tmp103_ = NULL;
+ gchar** gray_scan_modes;
+ gint gray_scan_modes_length1;
+ gint _gray_scan_modes_size_;
+ const gchar* _tmp104_;
+ gchar* _tmp105_;
+ gchar* _tmp106_;
+ gchar* _tmp107_;
+ const gchar* _tmp108_ = NULL;
+ gchar* _tmp109_;
+ gchar* _tmp110_;
+ const gchar* _tmp111_ = NULL;
+ gchar* _tmp112_;
+ gchar* _tmp113_;
+ const gchar* _tmp114_ = NULL;
+ gchar* _tmp115_;
+ gchar* _tmp116_;
+ const gchar* _tmp117_;
+ gchar* _tmp118_;
+ gchar* _tmp119_;
+ gchar* _tmp120_;
+ const gchar* _tmp121_ = NULL;
+ gchar* _tmp122_;
+ gchar* _tmp123_;
+ gchar** _tmp124_ = NULL;
+ gchar** lineart_scan_modes;
+ gint lineart_scan_modes_length1;
+ gint _lineart_scan_modes_size_;
+ ScanJob* _tmp125_;
+ ScanMode _tmp126_;
+ _tmp91_ = SANE_VALUE_SCAN_MODE_COLOR;
+ _tmp92_ = g_strdup (_tmp91_);
+ _tmp93_ = g_strdup ("Color");
+ _tmp94_ = g_strdup ("24bit Color");
+ _tmp95_ = g_new0 (gchar*, 3 + 1);
+ _tmp95_[0] = _tmp92_;
+ _tmp95_[1] = _tmp93_;
+ _tmp95_[2] = _tmp94_;
+ color_scan_modes = _tmp95_;
+ color_scan_modes_length1 = 3;
+ _color_scan_modes_size_ = color_scan_modes_length1;
+ _tmp96_ = SANE_VALUE_SCAN_MODE_GRAY;
+ _tmp97_ = g_strdup (_tmp96_);
+ _tmp98_ = g_strdup ("Gray");
+ _tmp99_ = g_strdup ("Grayscale");
+ _tmp100_ = SANE_I18N ("Grayscale");
+ _tmp101_ = g_strdup (_tmp100_);
+ _tmp102_ = g_strdup ("True Gray");
+ _tmp103_ = g_new0 (gchar*, 5 + 1);
+ _tmp103_[0] = _tmp97_;
+ _tmp103_[1] = _tmp98_;
+ _tmp103_[2] = _tmp99_;
+ _tmp103_[3] = _tmp101_;
+ _tmp103_[4] = _tmp102_;
+ gray_scan_modes = _tmp103_;
+ gray_scan_modes_length1 = 5;
+ _gray_scan_modes_size_ = gray_scan_modes_length1;
+ _tmp104_ = SANE_VALUE_SCAN_MODE_LINEART;
+ _tmp105_ = g_strdup (_tmp104_);
+ _tmp106_ = g_strdup ("Lineart");
+ _tmp107_ = g_strdup ("LineArt");
+ _tmp108_ = SANE_I18N ("LineArt");
+ _tmp109_ = g_strdup (_tmp108_);
+ _tmp110_ = g_strdup ("Black & White");
+ _tmp111_ = SANE_I18N ("Black & White");
+ _tmp112_ = g_strdup (_tmp111_);
+ _tmp113_ = g_strdup ("Binary");
+ _tmp114_ = SANE_I18N ("Binary");
+ _tmp115_ = g_strdup (_tmp114_);
+ _tmp116_ = g_strdup ("Thresholded");
+ _tmp117_ = SANE_VALUE_SCAN_MODE_GRAY;
+ _tmp118_ = g_strdup (_tmp117_);
+ _tmp119_ = g_strdup ("Gray");
+ _tmp120_ = g_strdup ("Grayscale");
+ _tmp121_ = SANE_I18N ("Grayscale");
+ _tmp122_ = g_strdup (_tmp121_);
+ _tmp123_ = g_strdup ("True Gray");
+ _tmp124_ = g_new0 (gchar*, 14 + 1);
+ _tmp124_[0] = _tmp105_;
+ _tmp124_[1] = _tmp106_;
+ _tmp124_[2] = _tmp107_;
+ _tmp124_[3] = _tmp109_;
+ _tmp124_[4] = _tmp110_;
+ _tmp124_[5] = _tmp112_;
+ _tmp124_[6] = _tmp113_;
+ _tmp124_[7] = _tmp115_;
+ _tmp124_[8] = _tmp116_;
+ _tmp124_[9] = _tmp118_;
+ _tmp124_[10] = _tmp119_;
+ _tmp124_[11] = _tmp120_;
+ _tmp124_[12] = _tmp122_;
+ _tmp124_[13] = _tmp123_;
+ lineart_scan_modes = _tmp124_;
+ lineart_scan_modes_length1 = 14;
+ _lineart_scan_modes_size_ = lineart_scan_modes_length1;
+ _tmp125_ = job;
+ _tmp126_ = _tmp125_->scan_mode;
+ switch (_tmp126_) {
+ case SCAN_MODE_COLOR:
+ {
+ SANE_Handle _tmp127_;
+ SANE_Option_Descriptor* _tmp128_;
+ SANE_Int _tmp129_;
+ gchar** _tmp130_;
+ gint _tmp130__length1;
+ gboolean _tmp131_ = FALSE;
+ _tmp127_ = self->priv->handle;
+ _tmp128_ = option;
+ _tmp129_ = index;
+ _tmp130_ = color_scan_modes;
+ _tmp130__length1 = color_scan_modes_length1;
+ _tmp131_ = scanner_set_constrained_string_option (self, _tmp127_, _tmp128_, _tmp129_, _tmp130_, _tmp130__length1, NULL);
+ if (!_tmp131_) {
+ g_warning ("scanner.vala:933: Unable to set Color mode, please file a bug");
+ }
+ break;
}
- } else {
- SANE_Option_Descriptor* _tmp165_;
- const gchar* _tmp166_;
- _tmp165_ = option;
- _tmp166_ = _tmp165_->name;
- if (g_strcmp0 (_tmp166_, "batch-scan") == 0) {
- SANE_Option_Descriptor* _tmp167_;
- SANE_Value_Type _tmp168_;
- _tmp167_ = option;
- _tmp168_ = _tmp167_->type;
- if (_tmp168_ == SANE_TYPE_BOOL) {
- SANE_Handle _tmp169_;
- SANE_Option_Descriptor* _tmp170_;
- SANE_Int _tmp171_;
- ScanJob* _tmp172_;
- ScanType _tmp173_;
- _tmp169_ = self->priv->handle;
- _tmp170_ = option;
- _tmp171_ = index;
- _tmp172_ = job;
- _tmp173_ = _tmp172_->type;
- scanner_set_bool_option (self, _tmp169_, _tmp170_, _tmp171_, _tmp173_ != SCAN_TYPE_SINGLE, NULL);
+ case SCAN_MODE_GRAY:
+ {
+ SANE_Handle _tmp132_;
+ SANE_Option_Descriptor* _tmp133_;
+ SANE_Int _tmp134_;
+ gchar** _tmp135_;
+ gint _tmp135__length1;
+ gboolean _tmp136_ = FALSE;
+ _tmp132_ = self->priv->handle;
+ _tmp133_ = option;
+ _tmp134_ = index;
+ _tmp135_ = gray_scan_modes;
+ _tmp135__length1 = gray_scan_modes_length1;
+ _tmp136_ = scanner_set_constrained_string_option (self, _tmp132_, _tmp133_, _tmp134_, _tmp135_, _tmp135__length1, NULL);
+ if (!_tmp136_) {
+ g_warning ("scanner.vala:937: Unable to set Gray mode, please file a bug");
}
- } else {
- SANE_Option_Descriptor* _tmp174_;
- const gchar* _tmp175_;
- const gchar* _tmp176_;
- _tmp174_ = option;
- _tmp175_ = _tmp174_->name;
- _tmp176_ = SANE_NAME_BIT_DEPTH;
- if (g_strcmp0 (_tmp175_, _tmp176_) == 0) {
- ScanJob* _tmp177_;
- gint _tmp178_;
- _tmp177_ = job;
- _tmp178_ = _tmp177_->depth;
- if (_tmp178_ > 0) {
- SANE_Handle _tmp179_;
- SANE_Option_Descriptor* _tmp180_;
- SANE_Int _tmp181_;
- ScanJob* _tmp182_;
- gint _tmp183_;
- _tmp179_ = self->priv->handle;
- _tmp180_ = option;
- _tmp181_ = index;
- _tmp182_ = job;
- _tmp183_ = _tmp182_->depth;
- scanner_set_int_option (self, _tmp179_, _tmp180_, _tmp181_, _tmp183_, NULL);
- }
- } else {
- SANE_Option_Descriptor* _tmp184_;
- const gchar* _tmp185_;
- const gchar* _tmp186_;
- _tmp184_ = option;
- _tmp185_ = _tmp184_->name;
- _tmp186_ = SANE_NAME_SCAN_MODE;
- if (g_strcmp0 (_tmp185_, _tmp186_) == 0) {
- const gchar* _tmp187_;
- gchar* _tmp188_;
- gchar* _tmp189_;
- gchar* _tmp190_;
- gchar** _tmp191_ = NULL;
- gchar** color_scan_modes;
- gint color_scan_modes_length1;
- gint _color_scan_modes_size_;
- const gchar* _tmp192_;
- gchar* _tmp193_;
- gchar* _tmp194_;
- gchar* _tmp195_;
- const gchar* _tmp196_ = NULL;
- gchar* _tmp197_;
- gchar* _tmp198_;
- gchar** _tmp199_ = NULL;
- gchar** gray_scan_modes;
- gint gray_scan_modes_length1;
- gint _gray_scan_modes_size_;
- const gchar* _tmp200_;
- gchar* _tmp201_;
- gchar* _tmp202_;
- gchar* _tmp203_;
- const gchar* _tmp204_ = NULL;
- gchar* _tmp205_;
- gchar* _tmp206_;
- const gchar* _tmp207_ = NULL;
- gchar* _tmp208_;
- gchar* _tmp209_;
- const gchar* _tmp210_ = NULL;
- gchar* _tmp211_;
- gchar* _tmp212_;
- const gchar* _tmp213_;
- gchar* _tmp214_;
- gchar* _tmp215_;
- gchar* _tmp216_;
- const gchar* _tmp217_ = NULL;
- gchar* _tmp218_;
- gchar* _tmp219_;
- gchar** _tmp220_ = NULL;
- gchar** lineart_scan_modes;
- gint lineart_scan_modes_length1;
- gint _lineart_scan_modes_size_;
- ScanJob* _tmp221_;
- ScanMode _tmp222_;
- _tmp187_ = SANE_VALUE_SCAN_MODE_COLOR;
- _tmp188_ = g_strdup (_tmp187_);
- _tmp189_ = g_strdup ("Color");
- _tmp190_ = g_strdup ("24bit Color");
- _tmp191_ = g_new0 (gchar*, 3 + 1);
- _tmp191_[0] = _tmp188_;
- _tmp191_[1] = _tmp189_;
- _tmp191_[2] = _tmp190_;
- color_scan_modes = _tmp191_;
- color_scan_modes_length1 = 3;
- _color_scan_modes_size_ = color_scan_modes_length1;
- _tmp192_ = SANE_VALUE_SCAN_MODE_GRAY;
- _tmp193_ = g_strdup (_tmp192_);
- _tmp194_ = g_strdup ("Gray");
- _tmp195_ = g_strdup ("Grayscale");
- _tmp196_ = SANE_I18N ("Grayscale");
- _tmp197_ = g_strdup (_tmp196_);
- _tmp198_ = g_strdup ("True Gray");
- _tmp199_ = g_new0 (gchar*, 5 + 1);
- _tmp199_[0] = _tmp193_;
- _tmp199_[1] = _tmp194_;
- _tmp199_[2] = _tmp195_;
- _tmp199_[3] = _tmp197_;
- _tmp199_[4] = _tmp198_;
- gray_scan_modes = _tmp199_;
- gray_scan_modes_length1 = 5;
- _gray_scan_modes_size_ = gray_scan_modes_length1;
- _tmp200_ = SANE_VALUE_SCAN_MODE_LINEART;
- _tmp201_ = g_strdup (_tmp200_);
- _tmp202_ = g_strdup ("Lineart");
- _tmp203_ = g_strdup ("LineArt");
- _tmp204_ = SANE_I18N ("LineArt");
- _tmp205_ = g_strdup (_tmp204_);
- _tmp206_ = g_strdup ("Black & White");
- _tmp207_ = SANE_I18N ("Black & White");
- _tmp208_ = g_strdup (_tmp207_);
- _tmp209_ = g_strdup ("Binary");
- _tmp210_ = SANE_I18N ("Binary");
- _tmp211_ = g_strdup (_tmp210_);
- _tmp212_ = g_strdup ("Thresholded");
- _tmp213_ = SANE_VALUE_SCAN_MODE_GRAY;
- _tmp214_ = g_strdup (_tmp213_);
- _tmp215_ = g_strdup ("Gray");
- _tmp216_ = g_strdup ("Grayscale");
- _tmp217_ = SANE_I18N ("Grayscale");
- _tmp218_ = g_strdup (_tmp217_);
- _tmp219_ = g_strdup ("True Gray");
- _tmp220_ = g_new0 (gchar*, 14 + 1);
- _tmp220_[0] = _tmp201_;
- _tmp220_[1] = _tmp202_;
- _tmp220_[2] = _tmp203_;
- _tmp220_[3] = _tmp205_;
- _tmp220_[4] = _tmp206_;
- _tmp220_[5] = _tmp208_;
- _tmp220_[6] = _tmp209_;
- _tmp220_[7] = _tmp211_;
- _tmp220_[8] = _tmp212_;
- _tmp220_[9] = _tmp214_;
- _tmp220_[10] = _tmp215_;
- _tmp220_[11] = _tmp216_;
- _tmp220_[12] = _tmp218_;
- _tmp220_[13] = _tmp219_;
- lineart_scan_modes = _tmp220_;
- lineart_scan_modes_length1 = 14;
- _lineart_scan_modes_size_ = lineart_scan_modes_length1;
- _tmp221_ = job;
- _tmp222_ = _tmp221_->scan_mode;
- switch (_tmp222_) {
- case SCAN_MODE_COLOR:
- {
- SANE_Handle _tmp223_;
- SANE_Option_Descriptor* _tmp224_;
- SANE_Int _tmp225_;
- gchar** _tmp226_;
- gint _tmp226__length1;
- gboolean _tmp227_ = FALSE;
- _tmp223_ = self->priv->handle;
- _tmp224_ = option;
- _tmp225_ = index;
- _tmp226_ = color_scan_modes;
- _tmp226__length1 = color_scan_modes_length1;
- _tmp227_ = scanner_set_constrained_string_option (self, _tmp223_, _tmp224_, _tmp225_, _tmp226_, _tmp226__length1, NULL);
- if (!_tmp227_) {
- g_warning ("scanner.vala:998: Unable to set Color mode, please file a bug");
- }
- break;
- }
- case SCAN_MODE_GRAY:
- {
- SANE_Handle _tmp228_;
- SANE_Option_Descriptor* _tmp229_;
- SANE_Int _tmp230_;
- gchar** _tmp231_;
- gint _tmp231__length1;
- gboolean _tmp232_ = FALSE;
- _tmp228_ = self->priv->handle;
- _tmp229_ = option;
- _tmp230_ = index;
- _tmp231_ = gray_scan_modes;
- _tmp231__length1 = gray_scan_modes_length1;
- _tmp232_ = scanner_set_constrained_string_option (self, _tmp228_, _tmp229_, _tmp230_, _tmp231_, _tmp231__length1, NULL);
- if (!_tmp232_) {
- g_warning ("scanner.vala:1002: Unable to set Gray mode, please file a bug");
- }
- break;
- }
- case SCAN_MODE_LINEART:
- {
- SANE_Handle _tmp233_;
- SANE_Option_Descriptor* _tmp234_;
- SANE_Int _tmp235_;
- gchar** _tmp236_;
- gint _tmp236__length1;
- gboolean _tmp237_ = FALSE;
- _tmp233_ = self->priv->handle;
- _tmp234_ = option;
- _tmp235_ = index;
- _tmp236_ = lineart_scan_modes;
- _tmp236__length1 = lineart_scan_modes_length1;
- _tmp237_ = scanner_set_constrained_string_option (self, _tmp233_, _tmp234_, _tmp235_, _tmp236_, _tmp236__length1, NULL);
- if (!_tmp237_) {
- g_warning ("scanner.vala:1006: Unable to set Lineart mode, please file a bug");
- }
- break;
- }
- default:
- {
- break;
- }
- }
- lineart_scan_modes = (_vala_array_free (lineart_scan_modes, lineart_scan_modes_length1, (GDestroyNotify) g_free), NULL);
- gray_scan_modes = (_vala_array_free (gray_scan_modes, gray_scan_modes_length1, (GDestroyNotify) g_free), NULL);
- color_scan_modes = (_vala_array_free (color_scan_modes, color_scan_modes_length1, (GDestroyNotify) g_free), NULL);
- } else {
- SANE_Option_Descriptor* _tmp238_;
- const gchar* _tmp239_;
- _tmp238_ = option;
- _tmp239_ = _tmp238_->name;
- if (g_strcmp0 (_tmp239_, "compression") == 0) {
- const gchar* _tmp240_ = NULL;
- gchar* _tmp241_;
- const gchar* _tmp242_ = NULL;
- gchar* _tmp243_;
- gchar* _tmp244_;
- gchar* _tmp245_;
- gchar** _tmp246_ = NULL;
- gchar** disable_compression_names;
- gint disable_compression_names_length1;
- gint _disable_compression_names_size_;
- SANE_Handle _tmp247_;
- SANE_Option_Descriptor* _tmp248_;
- SANE_Int _tmp249_;
- gchar** _tmp250_;
- gint _tmp250__length1;
- gboolean _tmp251_ = FALSE;
- _tmp240_ = SANE_I18N ("None");
- _tmp241_ = g_strdup (_tmp240_);
- _tmp242_ = SANE_I18N ("none");
- _tmp243_ = g_strdup (_tmp242_);
- _tmp244_ = g_strdup ("None");
- _tmp245_ = g_strdup ("none");
- _tmp246_ = g_new0 (gchar*, 4 + 1);
- _tmp246_[0] = _tmp241_;
- _tmp246_[1] = _tmp243_;
- _tmp246_[2] = _tmp244_;
- _tmp246_[3] = _tmp245_;
- disable_compression_names = _tmp246_;
- disable_compression_names_length1 = 4;
- _disable_compression_names_size_ = disable_compression_names_length1;
- _tmp247_ = self->priv->handle;
- _tmp248_ = option;
- _tmp249_ = index;
- _tmp250_ = disable_compression_names;
- _tmp250__length1 = disable_compression_names_length1;
- _tmp251_ = scanner_set_constrained_string_option (self, _tmp247_, _tmp248_, _tmp249_, _tmp250_, _tmp250__length1, NULL);
- if (!_tmp251_) {
- g_warning ("scanner.vala:1024: Unable to disable compression, please file a bug");
- }
- disable_compression_names = (_vala_array_free (disable_compression_names, disable_compression_names_length1, (GDestroyNotify) g_free), NULL);
- } else {
- SANE_Option_Descriptor* _tmp252_;
- const gchar* _tmp253_;
- const gchar* _tmp254_;
- _tmp252_ = option;
- _tmp253_ = _tmp252_->name;
- _tmp254_ = SANE_NAME_SCAN_BR_X;
- if (g_strcmp0 (_tmp253_, _tmp254_) == 0) {
- SANE_Int _tmp255_;
- _tmp255_ = index;
- self->priv->br_x_option_index = _tmp255_;
- } else {
- SANE_Option_Descriptor* _tmp256_;
- const gchar* _tmp257_;
- const gchar* _tmp258_;
- _tmp256_ = option;
- _tmp257_ = _tmp256_->name;
- _tmp258_ = SANE_NAME_SCAN_BR_Y;
- if (g_strcmp0 (_tmp257_, _tmp258_) == 0) {
- SANE_Int _tmp259_;
- _tmp259_ = index;
- self->priv->br_y_option_index = _tmp259_;
- } else {
- SANE_Option_Descriptor* _tmp260_;
- const gchar* _tmp261_;
- const gchar* _tmp262_;
- _tmp260_ = option;
- _tmp261_ = _tmp260_->name;
- _tmp262_ = SANE_NAME_PAGE_WIDTH;
- if (g_strcmp0 (_tmp261_, _tmp262_) == 0) {
- ScanJob* _tmp263_;
- gint _tmp264_;
- _tmp263_ = job;
- _tmp264_ = _tmp263_->page_width;
- if (((gdouble) _tmp264_) > 0.0) {
- SANE_Option_Descriptor* _tmp265_;
- SANE_Value_Type _tmp266_;
- _tmp265_ = option;
- _tmp266_ = _tmp265_->type;
- if (_tmp266_ == SANE_TYPE_FIXED) {
- SANE_Handle _tmp267_;
- SANE_Option_Descriptor* _tmp268_;
- SANE_Int _tmp269_;
- ScanJob* _tmp270_;
- gint _tmp271_;
- _tmp267_ = self->priv->handle;
- _tmp268_ = option;
- _tmp269_ = index;
- _tmp270_ = job;
- _tmp271_ = _tmp270_->page_width;
- scanner_set_fixed_option (self, _tmp267_, _tmp268_, _tmp269_, _tmp271_ / 10.0, NULL);
- } else {
- SANE_Handle _tmp272_;
- SANE_Option_Descriptor* _tmp273_;
- SANE_Int _tmp274_;
- ScanJob* _tmp275_;
- gint _tmp276_;
- _tmp272_ = self->priv->handle;
- _tmp273_ = option;
- _tmp274_ = index;
- _tmp275_ = job;
- _tmp276_ = _tmp275_->page_width;
- scanner_set_int_option (self, _tmp272_, _tmp273_, _tmp274_, _tmp276_ / 10, NULL);
- }
- }
- } else {
- SANE_Option_Descriptor* _tmp277_;
- const gchar* _tmp278_;
- const gchar* _tmp279_;
- _tmp277_ = option;
- _tmp278_ = _tmp277_->name;
- _tmp279_ = SANE_NAME_PAGE_HEIGHT;
- if (g_strcmp0 (_tmp278_, _tmp279_) == 0) {
- ScanJob* _tmp280_;
- gint _tmp281_;
- _tmp280_ = job;
- _tmp281_ = _tmp280_->page_height;
- if (((gdouble) _tmp281_) > 0.0) {
- SANE_Option_Descriptor* _tmp282_;
- SANE_Value_Type _tmp283_;
- _tmp282_ = option;
- _tmp283_ = _tmp282_->type;
- if (_tmp283_ == SANE_TYPE_FIXED) {
- SANE_Handle _tmp284_;
- SANE_Option_Descriptor* _tmp285_;
- SANE_Int _tmp286_;
- ScanJob* _tmp287_;
- gint _tmp288_;
- _tmp284_ = self->priv->handle;
- _tmp285_ = option;
- _tmp286_ = index;
- _tmp287_ = job;
- _tmp288_ = _tmp287_->page_height;
- scanner_set_fixed_option (self, _tmp284_, _tmp285_, _tmp286_, _tmp288_ / 10.0, NULL);
- } else {
- SANE_Handle _tmp289_;
- SANE_Option_Descriptor* _tmp290_;
- SANE_Int _tmp291_;
- ScanJob* _tmp292_;
- gint _tmp293_;
- _tmp289_ = self->priv->handle;
- _tmp290_ = option;
- _tmp291_ = index;
- _tmp292_ = job;
- _tmp293_ = _tmp292_->page_height;
- scanner_set_int_option (self, _tmp289_, _tmp290_, _tmp291_, _tmp293_ / 10, NULL);
- }
- }
- }
- }
- }
- }
- }
- }
+ break;
+ }
+ case SCAN_MODE_LINEART:
+ {
+ SANE_Handle _tmp137_;
+ SANE_Option_Descriptor* _tmp138_;
+ SANE_Int _tmp139_;
+ gchar** _tmp140_;
+ gint _tmp140__length1;
+ gboolean _tmp141_ = FALSE;
+ _tmp137_ = self->priv->handle;
+ _tmp138_ = option;
+ _tmp139_ = index;
+ _tmp140_ = lineart_scan_modes;
+ _tmp140__length1 = lineart_scan_modes_length1;
+ _tmp141_ = scanner_set_constrained_string_option (self, _tmp137_, _tmp138_, _tmp139_, _tmp140_, _tmp140__length1, NULL);
+ if (!_tmp141_) {
+ g_warning ("scanner.vala:941: Unable to set Lineart mode, please file a bug");
}
+ break;
+ }
+ default:
+ {
+ break;
}
}
+ lineart_scan_modes = (_vala_array_free (lineart_scan_modes, lineart_scan_modes_length1, (GDestroyNotify) g_free), NULL);
+ gray_scan_modes = (_vala_array_free (gray_scan_modes, gray_scan_modes_length1, (GDestroyNotify) g_free), NULL);
+ color_scan_modes = (_vala_array_free (color_scan_modes, color_scan_modes_length1, (GDestroyNotify) g_free), NULL);
}
- }
- _tmp294_ = self->priv->current_device;
- if (g_strcmp0 (_tmp294_, "test") == 0) {
- SANE_Option_Descriptor* _tmp295_;
- const gchar* _tmp296_;
- _tmp295_ = option;
- _tmp296_ = _tmp295_->name;
- if (g_strcmp0 (_tmp296_, "hand-scanner") == 0) {
- SANE_Handle _tmp297_;
- SANE_Option_Descriptor* _tmp298_;
- SANE_Int _tmp299_;
- _tmp297_ = self->priv->handle;
- _tmp298_ = option;
- _tmp299_ = index;
- scanner_set_bool_option (self, _tmp297_, _tmp298_, _tmp299_, FALSE, NULL);
- } else {
- SANE_Option_Descriptor* _tmp300_;
- const gchar* _tmp301_;
- _tmp300_ = option;
- _tmp301_ = _tmp300_->name;
- if (g_strcmp0 (_tmp301_, "three-pass") == 0) {
- SANE_Handle _tmp302_;
- SANE_Option_Descriptor* _tmp303_;
- SANE_Int _tmp304_;
- _tmp302_ = self->priv->handle;
- _tmp303_ = option;
- _tmp304_ = index;
- scanner_set_bool_option (self, _tmp302_, _tmp303_, _tmp304_, FALSE, NULL);
+ _tmp142_ = self->priv->handle;
+ _tmp144_ = scanner_get_option_by_name (self, _tmp142_, "duplex", &_tmp143_);
+ index = (SANE_Int) _tmp143_;
+ option = _tmp144_;
+ _tmp145_ = option;
+ if (_tmp145_ != NULL) {
+ SANE_Option_Descriptor* _tmp146_;
+ SANE_Value_Type _tmp147_;
+ _tmp146_ = option;
+ _tmp147_ = _tmp146_->type;
+ if (_tmp147_ == SANE_TYPE_BOOL) {
+ SANE_Handle _tmp148_;
+ SANE_Option_Descriptor* _tmp149_;
+ SANE_Int _tmp150_;
+ ScanJob* _tmp151_;
+ ScanType _tmp152_;
+ _tmp148_ = self->priv->handle;
+ _tmp149_ = option;
+ _tmp150_ = index;
+ _tmp151_ = job;
+ _tmp152_ = _tmp151_->type;
+ scanner_set_bool_option (self, _tmp148_, _tmp149_, _tmp150_, _tmp152_ == SCAN_TYPE_ADF_BOTH, NULL);
+ }
+ }
+ _tmp153_ = self->priv->handle;
+ _tmp155_ = scanner_get_option_by_name (self, _tmp153_, "batch-scan", &_tmp154_);
+ index = (SANE_Int) _tmp154_;
+ option = _tmp155_;
+ _tmp156_ = option;
+ if (_tmp156_ != NULL) {
+ SANE_Option_Descriptor* _tmp157_;
+ SANE_Value_Type _tmp158_;
+ _tmp157_ = option;
+ _tmp158_ = _tmp157_->type;
+ if (_tmp158_ == SANE_TYPE_BOOL) {
+ SANE_Handle _tmp159_;
+ SANE_Option_Descriptor* _tmp160_;
+ SANE_Int _tmp161_;
+ ScanJob* _tmp162_;
+ ScanType _tmp163_;
+ _tmp159_ = self->priv->handle;
+ _tmp160_ = option;
+ _tmp161_ = index;
+ _tmp162_ = job;
+ _tmp163_ = _tmp162_->type;
+ scanner_set_bool_option (self, _tmp159_, _tmp160_, _tmp161_, _tmp163_ != SCAN_TYPE_SINGLE, NULL);
+ }
+ }
+ _tmp164_ = self->priv->handle;
+ _tmp166_ = scanner_get_option_by_name (self, _tmp164_, "compression", &_tmp165_);
+ index = (SANE_Int) _tmp165_;
+ option = _tmp166_;
+ _tmp167_ = option;
+ if (_tmp167_ != NULL) {
+ const gchar* _tmp168_ = NULL;
+ gchar* _tmp169_;
+ const gchar* _tmp170_ = NULL;
+ gchar* _tmp171_;
+ gchar* _tmp172_;
+ gchar* _tmp173_;
+ gchar** _tmp174_ = NULL;
+ gchar** disable_compression_names;
+ gint disable_compression_names_length1;
+ gint _disable_compression_names_size_;
+ SANE_Handle _tmp175_;
+ SANE_Option_Descriptor* _tmp176_;
+ SANE_Int _tmp177_;
+ gchar** _tmp178_;
+ gint _tmp178__length1;
+ gboolean _tmp179_ = FALSE;
+ _tmp168_ = SANE_I18N ("None");
+ _tmp169_ = g_strdup (_tmp168_);
+ _tmp170_ = SANE_I18N ("none");
+ _tmp171_ = g_strdup (_tmp170_);
+ _tmp172_ = g_strdup ("None");
+ _tmp173_ = g_strdup ("none");
+ _tmp174_ = g_new0 (gchar*, 4 + 1);
+ _tmp174_[0] = _tmp169_;
+ _tmp174_[1] = _tmp171_;
+ _tmp174_[2] = _tmp172_;
+ _tmp174_[3] = _tmp173_;
+ disable_compression_names = _tmp174_;
+ disable_compression_names_length1 = 4;
+ _disable_compression_names_size_ = disable_compression_names_length1;
+ _tmp175_ = self->priv->handle;
+ _tmp176_ = option;
+ _tmp177_ = index;
+ _tmp178_ = disable_compression_names;
+ _tmp178__length1 = disable_compression_names_length1;
+ _tmp179_ = scanner_set_constrained_string_option (self, _tmp175_, _tmp176_, _tmp177_, _tmp178_, _tmp178__length1, NULL);
+ if (!_tmp179_) {
+ g_warning ("scanner.vala:977: Unable to disable compression, please file a bug");
+ }
+ disable_compression_names = (_vala_array_free (disable_compression_names, disable_compression_names_length1, (GDestroyNotify) g_free), NULL);
+ }
+ _tmp180_ = self->priv->handle;
+ _tmp181_ = SANE_NAME_SCAN_RESOLUTION;
+ _tmp183_ = scanner_get_option_by_name (self, _tmp180_, _tmp181_, &_tmp182_);
+ index = (SANE_Int) _tmp182_;
+ option = _tmp183_;
+ _tmp184_ = option;
+ if (_tmp184_ != NULL) {
+ SANE_Option_Descriptor* _tmp185_;
+ SANE_Value_Type _tmp186_;
+ SANE_Handle _tmp202_;
+ const gchar* _tmp203_;
+ gint _tmp204_ = 0;
+ SANE_Option_Descriptor* _tmp205_ = NULL;
+ SANE_Option_Descriptor* _tmp206_;
+ _tmp185_ = option;
+ _tmp186_ = _tmp185_->type;
+ if (_tmp186_ == SANE_TYPE_FIXED) {
+ SANE_Handle _tmp187_;
+ SANE_Option_Descriptor* _tmp188_;
+ SANE_Int _tmp189_;
+ ScanJob* _tmp190_;
+ gdouble _tmp191_;
+ ScanJob* _tmp192_;
+ gdouble _tmp193_ = 0.0;
+ _tmp187_ = self->priv->handle;
+ _tmp188_ = option;
+ _tmp189_ = index;
+ _tmp190_ = job;
+ _tmp191_ = _tmp190_->dpi;
+ _tmp192_ = job;
+ scanner_set_fixed_option (self, _tmp187_, _tmp188_, _tmp189_, _tmp191_, &_tmp193_);
+ _tmp192_->dpi = _tmp193_;
} else {
- SANE_Option_Descriptor* _tmp305_;
- const gchar* _tmp306_;
- _tmp305_ = option;
- _tmp306_ = _tmp305_->name;
- if (g_strcmp0 (_tmp306_, "test-picture") == 0) {
- SANE_Handle _tmp307_;
- SANE_Option_Descriptor* _tmp308_;
- SANE_Int _tmp309_;
- _tmp307_ = self->priv->handle;
- _tmp308_ = option;
- _tmp309_ = index;
- scanner_set_string_option (self, _tmp307_, _tmp308_, _tmp309_, "Color pattern", NULL);
+ gint dpi = 0;
+ SANE_Handle _tmp194_;
+ SANE_Option_Descriptor* _tmp195_;
+ SANE_Int _tmp196_;
+ ScanJob* _tmp197_;
+ gdouble _tmp198_;
+ gint _tmp199_ = 0;
+ ScanJob* _tmp200_;
+ gint _tmp201_;
+ _tmp194_ = self->priv->handle;
+ _tmp195_ = option;
+ _tmp196_ = index;
+ _tmp197_ = job;
+ _tmp198_ = _tmp197_->dpi;
+ scanner_set_int_option (self, _tmp194_, _tmp195_, _tmp196_, (gint) _tmp198_, &_tmp199_);
+ dpi = _tmp199_;
+ _tmp200_ = job;
+ _tmp201_ = dpi;
+ _tmp200_->dpi = (gdouble) _tmp201_;
+ }
+ _tmp202_ = self->priv->handle;
+ _tmp203_ = SANE_NAME_BIT_DEPTH;
+ _tmp205_ = scanner_get_option_by_name (self, _tmp202_, _tmp203_, &_tmp204_);
+ index = (SANE_Int) _tmp204_;
+ option = _tmp205_;
+ _tmp206_ = option;
+ if (_tmp206_ != NULL) {
+ ScanJob* _tmp207_;
+ gint _tmp208_;
+ _tmp207_ = job;
+ _tmp208_ = _tmp207_->depth;
+ if (_tmp208_ > 0) {
+ SANE_Handle _tmp209_;
+ SANE_Option_Descriptor* _tmp210_;
+ SANE_Int _tmp211_;
+ ScanJob* _tmp212_;
+ gint _tmp213_;
+ _tmp209_ = self->priv->handle;
+ _tmp210_ = option;
+ _tmp211_ = index;
+ _tmp212_ = job;
+ _tmp213_ = _tmp212_->depth;
+ scanner_set_int_option (self, _tmp209_, _tmp210_, _tmp211_, _tmp213_, NULL);
+ }
+ }
+ }
+ _tmp214_ = self->priv->handle;
+ _tmp215_ = SANE_NAME_SCAN_BR_X;
+ _tmp217_ = scanner_get_option_by_name (self, _tmp214_, _tmp215_, &_tmp216_);
+ index = (SANE_Int) _tmp216_;
+ option = _tmp217_;
+ _tmp218_ = option;
+ if (_tmp218_ != NULL) {
+ SANE_Option_Descriptor* _tmp219_;
+ SANE_Constraint_Type _tmp220_;
+ _tmp219_ = option;
+ _tmp220_ = _tmp219_->constraint_type;
+ if (_tmp220_ == SANE_CONSTRAINT_RANGE) {
+ SANE_Option_Descriptor* _tmp221_;
+ SANE_Value_Type _tmp222_;
+ _tmp221_ = option;
+ _tmp222_ = _tmp221_->type;
+ if (_tmp222_ == SANE_TYPE_FIXED) {
+ SANE_Handle _tmp223_;
+ SANE_Option_Descriptor* _tmp224_;
+ SANE_Int _tmp225_;
+ SANE_Option_Descriptor* _tmp226_;
+ SANE_Range* _tmp227_;
+ SANE_Word _tmp228_;
+ gdouble _tmp229_ = 0.0;
+ _tmp223_ = self->priv->handle;
+ _tmp224_ = option;
+ _tmp225_ = index;
+ _tmp226_ = option;
+ _tmp227_ = _tmp226_->constraint.range;
+ _tmp228_ = _tmp227_->max;
+ _tmp229_ = SANE_UNFIX ((SANE_Fixed) _tmp228_);
+ scanner_set_fixed_option (self, _tmp223_, _tmp224_, _tmp225_, _tmp229_, NULL);
} else {
- SANE_Option_Descriptor* _tmp310_;
- const gchar* _tmp311_;
- _tmp310_ = option;
- _tmp311_ = _tmp310_->name;
- if (g_strcmp0 (_tmp311_, "read-delay") == 0) {
- SANE_Handle _tmp312_;
- SANE_Option_Descriptor* _tmp313_;
- SANE_Int _tmp314_;
- _tmp312_ = self->priv->handle;
- _tmp313_ = option;
- _tmp314_ = index;
- scanner_set_bool_option (self, _tmp312_, _tmp313_, _tmp314_, TRUE, NULL);
- } else {
- SANE_Option_Descriptor* _tmp315_;
- const gchar* _tmp316_;
- _tmp315_ = option;
- _tmp316_ = _tmp315_->name;
- if (g_strcmp0 (_tmp316_, "read-delay-duration") == 0) {
- SANE_Handle _tmp317_;
- SANE_Option_Descriptor* _tmp318_;
- SANE_Int _tmp319_;
- _tmp317_ = self->priv->handle;
- _tmp318_ = option;
- _tmp319_ = index;
- scanner_set_int_option (self, _tmp317_, _tmp318_, _tmp319_, 200000, NULL);
- }
- }
+ SANE_Handle _tmp230_;
+ SANE_Option_Descriptor* _tmp231_;
+ SANE_Int _tmp232_;
+ SANE_Option_Descriptor* _tmp233_;
+ SANE_Range* _tmp234_;
+ SANE_Word _tmp235_;
+ _tmp230_ = self->priv->handle;
+ _tmp231_ = option;
+ _tmp232_ = index;
+ _tmp233_ = option;
+ _tmp234_ = _tmp233_->constraint.range;
+ _tmp235_ = _tmp234_->max;
+ scanner_set_int_option (self, _tmp230_, _tmp231_, _tmp232_, (gint) _tmp235_, NULL);
}
}
}
+ _tmp236_ = self->priv->handle;
+ _tmp237_ = SANE_NAME_SCAN_BR_Y;
+ _tmp239_ = scanner_get_option_by_name (self, _tmp236_, _tmp237_, &_tmp238_);
+ index = (SANE_Int) _tmp238_;
+ option = _tmp239_;
+ _tmp240_ = option;
+ if (_tmp240_ != NULL) {
+ SANE_Option_Descriptor* _tmp241_;
+ SANE_Constraint_Type _tmp242_;
+ _tmp241_ = option;
+ _tmp242_ = _tmp241_->constraint_type;
+ if (_tmp242_ == SANE_CONSTRAINT_RANGE) {
+ SANE_Option_Descriptor* _tmp243_;
+ SANE_Value_Type _tmp244_;
+ _tmp243_ = option;
+ _tmp244_ = _tmp243_->type;
+ if (_tmp244_ == SANE_TYPE_FIXED) {
+ SANE_Handle _tmp245_;
+ SANE_Option_Descriptor* _tmp246_;
+ SANE_Int _tmp247_;
+ SANE_Option_Descriptor* _tmp248_;
+ SANE_Range* _tmp249_;
+ SANE_Word _tmp250_;
+ gdouble _tmp251_ = 0.0;
+ _tmp245_ = self->priv->handle;
+ _tmp246_ = option;
+ _tmp247_ = index;
+ _tmp248_ = option;
+ _tmp249_ = _tmp248_->constraint.range;
+ _tmp250_ = _tmp249_->max;
+ _tmp251_ = SANE_UNFIX ((SANE_Fixed) _tmp250_);
+ scanner_set_fixed_option (self, _tmp245_, _tmp246_, _tmp247_, _tmp251_, NULL);
+ } else {
+ SANE_Handle _tmp252_;
+ SANE_Option_Descriptor* _tmp253_;
+ SANE_Int _tmp254_;
+ SANE_Option_Descriptor* _tmp255_;
+ SANE_Range* _tmp256_;
+ SANE_Word _tmp257_;
+ _tmp252_ = self->priv->handle;
+ _tmp253_ = option;
+ _tmp254_ = index;
+ _tmp255_ = option;
+ _tmp256_ = _tmp255_->constraint.range;
+ _tmp257_ = _tmp256_->max;
+ scanner_set_int_option (self, _tmp252_, _tmp253_, _tmp254_, (gint) _tmp257_, NULL);
+ }
+ }
+ }
+ _tmp258_ = self->priv->handle;
+ _tmp259_ = SANE_NAME_PAGE_WIDTH;
+ _tmp261_ = scanner_get_option_by_name (self, _tmp258_, _tmp259_, &_tmp260_);
+ index = (SANE_Int) _tmp260_;
+ option = _tmp261_;
+ _tmp262_ = option;
+ if (_tmp262_ != NULL) {
+ ScanJob* _tmp263_;
+ gint _tmp264_;
+ _tmp263_ = job;
+ _tmp264_ = _tmp263_->page_width;
+ if (((gdouble) _tmp264_) > 0.0) {
+ SANE_Option_Descriptor* _tmp265_;
+ SANE_Value_Type _tmp266_;
+ _tmp265_ = option;
+ _tmp266_ = _tmp265_->type;
+ if (_tmp266_ == SANE_TYPE_FIXED) {
+ SANE_Handle _tmp267_;
+ SANE_Option_Descriptor* _tmp268_;
+ SANE_Int _tmp269_;
+ ScanJob* _tmp270_;
+ gint _tmp271_;
+ _tmp267_ = self->priv->handle;
+ _tmp268_ = option;
+ _tmp269_ = index;
+ _tmp270_ = job;
+ _tmp271_ = _tmp270_->page_width;
+ scanner_set_fixed_option (self, _tmp267_, _tmp268_, _tmp269_, _tmp271_ / 10.0, NULL);
+ } else {
+ SANE_Handle _tmp272_;
+ SANE_Option_Descriptor* _tmp273_;
+ SANE_Int _tmp274_;
+ ScanJob* _tmp275_;
+ gint _tmp276_;
+ _tmp272_ = self->priv->handle;
+ _tmp273_ = option;
+ _tmp274_ = index;
+ _tmp275_ = job;
+ _tmp276_ = _tmp275_->page_width;
+ scanner_set_int_option (self, _tmp272_, _tmp273_, _tmp274_, _tmp276_ / 10, NULL);
+ }
+ }
+ }
+ _tmp277_ = self->priv->handle;
+ _tmp278_ = SANE_NAME_PAGE_HEIGHT;
+ _tmp280_ = scanner_get_option_by_name (self, _tmp277_, _tmp278_, &_tmp279_);
+ index = (SANE_Int) _tmp279_;
+ option = _tmp280_;
+ _tmp281_ = option;
+ if (_tmp281_ != NULL) {
+ ScanJob* _tmp282_;
+ gint _tmp283_;
+ _tmp282_ = job;
+ _tmp283_ = _tmp282_->page_height;
+ if (((gdouble) _tmp283_) > 0.0) {
+ SANE_Option_Descriptor* _tmp284_;
+ SANE_Value_Type _tmp285_;
+ _tmp284_ = option;
+ _tmp285_ = _tmp284_->type;
+ if (_tmp285_ == SANE_TYPE_FIXED) {
+ SANE_Handle _tmp286_;
+ SANE_Option_Descriptor* _tmp287_;
+ SANE_Int _tmp288_;
+ ScanJob* _tmp289_;
+ gint _tmp290_;
+ _tmp286_ = self->priv->handle;
+ _tmp287_ = option;
+ _tmp288_ = index;
+ _tmp289_ = job;
+ _tmp290_ = _tmp289_->page_height;
+ scanner_set_fixed_option (self, _tmp286_, _tmp287_, _tmp288_, _tmp290_ / 10.0, NULL);
+ } else {
+ SANE_Handle _tmp291_;
+ SANE_Option_Descriptor* _tmp292_;
+ SANE_Int _tmp293_;
+ ScanJob* _tmp294_;
+ gint _tmp295_;
+ _tmp291_ = self->priv->handle;
+ _tmp292_ = option;
+ _tmp293_ = index;
+ _tmp294_ = job;
+ _tmp295_ = _tmp294_->page_height;
+ scanner_set_int_option (self, _tmp291_, _tmp292_, _tmp293_, _tmp295_ / 10, NULL);
+ }
+ }
+ }
+ _tmp296_ = self->priv->current_device;
+ if (g_strcmp0 (_tmp296_, "test") == 0) {
+ SANE_Handle _tmp297_;
+ gint _tmp298_ = 0;
+ SANE_Option_Descriptor* _tmp299_ = NULL;
+ SANE_Option_Descriptor* _tmp300_;
+ SANE_Handle _tmp304_;
+ gint _tmp305_ = 0;
+ SANE_Option_Descriptor* _tmp306_ = NULL;
+ SANE_Option_Descriptor* _tmp307_;
+ SANE_Handle _tmp311_;
+ gint _tmp312_ = 0;
+ SANE_Option_Descriptor* _tmp313_ = NULL;
+ SANE_Option_Descriptor* _tmp314_;
+ SANE_Handle _tmp318_;
+ gint _tmp319_ = 0;
+ SANE_Option_Descriptor* _tmp320_ = NULL;
+ SANE_Option_Descriptor* _tmp321_;
+ SANE_Handle _tmp325_;
+ gint _tmp326_ = 0;
+ SANE_Option_Descriptor* _tmp327_ = NULL;
+ SANE_Option_Descriptor* _tmp328_;
+ _tmp297_ = self->priv->handle;
+ _tmp299_ = scanner_get_option_by_name (self, _tmp297_, "hand-scanner", &_tmp298_);
+ index = (SANE_Int) _tmp298_;
+ option = _tmp299_;
+ _tmp300_ = option;
+ if (_tmp300_ != NULL) {
+ SANE_Handle _tmp301_;
+ SANE_Option_Descriptor* _tmp302_;
+ SANE_Int _tmp303_;
+ _tmp301_ = self->priv->handle;
+ _tmp302_ = option;
+ _tmp303_ = index;
+ scanner_set_bool_option (self, _tmp301_, _tmp302_, _tmp303_, FALSE, NULL);
+ }
+ _tmp304_ = self->priv->handle;
+ _tmp306_ = scanner_get_option_by_name (self, _tmp304_, "three-pass", &_tmp305_);
+ index = (SANE_Int) _tmp305_;
+ option = _tmp306_;
+ _tmp307_ = option;
+ if (_tmp307_ != NULL) {
+ SANE_Handle _tmp308_;
+ SANE_Option_Descriptor* _tmp309_;
+ SANE_Int _tmp310_;
+ _tmp308_ = self->priv->handle;
+ _tmp309_ = option;
+ _tmp310_ = index;
+ scanner_set_bool_option (self, _tmp308_, _tmp309_, _tmp310_, FALSE, NULL);
+ }
+ _tmp311_ = self->priv->handle;
+ _tmp313_ = scanner_get_option_by_name (self, _tmp311_, "test-picture", &_tmp312_);
+ index = (SANE_Int) _tmp312_;
+ option = _tmp313_;
+ _tmp314_ = option;
+ if (_tmp314_ != NULL) {
+ SANE_Handle _tmp315_;
+ SANE_Option_Descriptor* _tmp316_;
+ SANE_Int _tmp317_;
+ _tmp315_ = self->priv->handle;
+ _tmp316_ = option;
+ _tmp317_ = index;
+ scanner_set_string_option (self, _tmp315_, _tmp316_, _tmp317_, "Color pattern", NULL);
+ }
+ _tmp318_ = self->priv->handle;
+ _tmp320_ = scanner_get_option_by_name (self, _tmp318_, "read-delay", &_tmp319_);
+ index = (SANE_Int) _tmp319_;
+ option = _tmp320_;
+ _tmp321_ = option;
+ if (_tmp321_ != NULL) {
+ SANE_Handle _tmp322_;
+ SANE_Option_Descriptor* _tmp323_;
+ SANE_Int _tmp324_;
+ _tmp322_ = self->priv->handle;
+ _tmp323_ = option;
+ _tmp324_ = index;
+ scanner_set_bool_option (self, _tmp322_, _tmp323_, _tmp324_, TRUE, NULL);
+ }
+ _tmp325_ = self->priv->handle;
+ _tmp327_ = scanner_get_option_by_name (self, _tmp325_, "read-delay-duration", &_tmp326_);
+ index = (SANE_Int) _tmp326_;
+ option = _tmp327_;
+ _tmp328_ = option;
+ if (_tmp328_ != NULL) {
+ SANE_Handle _tmp329_;
+ SANE_Option_Descriptor* _tmp330_;
+ SANE_Int _tmp331_;
+ _tmp329_ = self->priv->handle;
+ _tmp330_ = option;
+ _tmp331_ = index;
+ scanner_set_int_option (self, _tmp329_, _tmp330_, _tmp331_, 200000, NULL);
+ }
+ }
+ self->priv->state = SCAN_STATE_START;
+ _scan_job_unref0 (job);
+ return;
+ }
+ _tmp332_ = index;
+ _tmp333_ = option;
+ scanner_log_option (self, _tmp332_, _tmp333_);
+ _tmp334_ = option;
+ _tmp335_ = _tmp334_->type;
+ if (_tmp335_ == SANE_TYPE_GROUP) {
+ _scan_job_unref0 (job);
+ return;
}
+ _tmp336_ = option;
+ _tmp337_ = _tmp336_->cap;
+ if ((_tmp337_ & SANE_CAP_INACTIVE) != ((SANE_Int) 0)) {
+ _scan_job_unref0 (job);
+ return;
+ }
+ _tmp338_ = option;
+ _tmp339_ = _tmp338_->name;
+ if (_tmp339_ == NULL) {
+ _scan_job_unref0 (job);
+ return;
+ }
+ _tmp340_ = self->priv->options;
+ _tmp341_ = option;
+ _tmp342_ = _tmp341_->name;
+ _tmp343_ = g_strdup (_tmp342_);
+ _tmp344_ = index;
+ g_hash_table_insert (_tmp340_, _tmp343_, GINT_TO_POINTER ((gint) _tmp344_));
_scan_job_unref0 (job);
}
+static SANE_Option_Descriptor* scanner_get_option_by_name (Scanner* self, SANE_Handle handle, const gchar* name, gint* index) {
+ gint _vala_index = 0;
+ SANE_Option_Descriptor* result = NULL;
+ GHashTable* _tmp0_;
+ const gchar* _tmp1_;
+ gconstpointer _tmp2_ = NULL;
+ gint _tmp3_;
+ SANE_Handle _tmp4_;
+ gint _tmp5_;
+ SANE_Option_Descriptor* _tmp6_ = NULL;
+ g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail (name != NULL, NULL);
+ _tmp0_ = self->priv->options;
+ _tmp1_ = name;
+ _tmp2_ = g_hash_table_lookup (_tmp0_, _tmp1_);
+ _vala_index = GPOINTER_TO_INT (_tmp2_);
+ _tmp3_ = _vala_index;
+ if (_tmp3_ == 0) {
+ result = NULL;
+ if (index) {
+ *index = _vala_index;
+ }
+ return result;
+ }
+ _tmp4_ = handle;
+ _tmp5_ = _vala_index;
+ _tmp6_ = sane_get_option_descriptor (_tmp4_, (SANE_Int) _tmp5_);
+ result = _tmp6_;
+ if (index) {
+ *index = _vala_index;
+ }
+ return result;
+}
+
+
static void scanner_do_complete_document (Scanner* self) {
GList* _tmp0_;
GList* _tmp1_;
@@ -6648,7 +6741,7 @@ static void scanner_do_start (Scanner* self) {
_tmp6_ = status;
_tmp7_ = sane_status_to_string (_tmp6_);
_tmp8_ = _tmp7_;
- g_debug ("scanner.vala:1094: sane_start (page=%d, pass=%d) -> %s", _tmp4_, _tmp5_, _tmp8_);
+ g_debug ("scanner.vala:1124: sane_start (page=%d, pass=%d) -> %s", _tmp4_, _tmp5_, _tmp8_);
_g_free0 (_tmp8_);
_tmp9_ = status;
if (_tmp9_ == SANE_STATUS_GOOD) {
@@ -6665,7 +6758,7 @@ static void scanner_do_start (Scanner* self) {
const gchar* _tmp14_ = NULL;
_tmp11_ = status;
_tmp12_ = sane_strstatus (_tmp11_);
- g_warning ("scanner.vala:1101: Unable to start device: %s", _tmp12_);
+ g_warning ("scanner.vala:1131: Unable to start device: %s", _tmp12_);
_tmp13_ = status;
_tmp14_ = _ ("Unable to start scan");
scanner_fail_scan (self, (gint) _tmp13_, _tmp14_);
@@ -6801,7 +6894,7 @@ static void scanner_do_get_parameters (Scanner* self) {
_tmp3_ = status;
_tmp4_ = sane_status_to_string (_tmp3_);
_tmp5_ = _tmp4_;
- g_debug ("scanner.vala:1111: sane_get_parameters () -> %s", _tmp5_);
+ g_debug ("scanner.vala:1141: sane_get_parameters () -> %s", _tmp5_);
_g_free0 (_tmp5_);
_tmp6_ = status;
if (_tmp6_ != SANE_STATUS_GOOD) {
@@ -6811,7 +6904,7 @@ static void scanner_do_get_parameters (Scanner* self) {
const gchar* _tmp10_ = NULL;
_tmp7_ = status;
_tmp8_ = sane_strstatus (_tmp7_);
- g_warning ("scanner.vala:1114: Unable to get device parameters: %s", _tmp8_);
+ g_warning ("scanner.vala:1144: Unable to get device parameters: %s", _tmp8_);
_tmp9_ = status;
_tmp10_ = _ ("Error communicating with scanner");
scanner_fail_scan (self, (gint) _tmp9_, _tmp10_);
@@ -6841,7 +6934,7 @@ static void scanner_do_get_parameters (Scanner* self) {
_tmp27_ = _tmp26_.lines;
_tmp28_ = self->priv->parameters;
_tmp29_ = _tmp28_.depth;
- g_debug ("scanner.vala:1123: Parameters: format=%s last_frame=%s bytes_per_line=" \
+ g_debug ("scanner.vala:1153: Parameters: format=%s last_frame=%s bytes_per_line=" \
"%d pixels_per_line=%d lines=%d depth=%d", _tmp20_, _tmp21_, _tmp23_, _tmp25_, _tmp27_, _tmp29_);
_g_free0 (_tmp20_);
_tmp30_ = scan_page_info_new ();
@@ -7001,7 +7094,7 @@ static void scanner_do_complete_page (Scanner* self) {
}
_tmp13_ = self->priv->handle;
sane_cancel (_tmp13_);
- g_debug ("scanner.vala:1183: sane_cancel ()");
+ g_debug ("scanner.vala:1213: sane_cancel ()");
scanner_do_complete_document (self);
_scan_job_unref0 (job);
}
@@ -7067,7 +7160,7 @@ static void scanner_do_read (Scanner* self) {
_tmp14_ = sane_status_to_string (_tmp13_);
_tmp15_ = _tmp14_;
_tmp16_ = n_read;
- g_debug ("scanner.vala:1198: sane_read (%d) -> (%s, %d)", _tmp12_, _tmp15_, (gint) _tmp16_);
+ g_debug ("scanner.vala:1228: sane_read (%d) -> (%s, %d)", _tmp12_, _tmp15_, (gint) _tmp16_);
_g_free0 (_tmp15_);
_tmp17_ = status;
if (_tmp17_ == SANE_STATUS_EOF) {
@@ -7097,13 +7190,13 @@ static void scanner_do_read (Scanner* self) {
_tmp25_ = self->priv->line_count;
_tmp26_ = self->priv->parameters;
_tmp27_ = _tmp26_.lines;
- g_warning ("scanner.vala:1204: Scan completed with %d lines, expected %d lines", _tmp25_, _tmp27_);
+ g_warning ("scanner.vala:1234: Scan completed with %d lines, expected %d lines", _tmp25_, _tmp27_);
}
_tmp28_ = self->priv->n_used;
if (_tmp28_ > 0) {
gint _tmp29_;
_tmp29_ = self->priv->n_used;
- g_warning ("scanner.vala:1206: Scan complete with %d bytes of unused data", _tmp29_);
+ g_warning ("scanner.vala:1236: Scan complete with %d bytes of unused data", _tmp29_);
}
scanner_do_complete_page (self);
_scan_job_unref0 (job);
@@ -7117,7 +7210,7 @@ static void scanner_do_read (Scanner* self) {
const gchar* _tmp34_ = NULL;
_tmp31_ = status;
_tmp32_ = sane_strstatus (_tmp31_);
- g_warning ("scanner.vala:1214: Unable to read frame from device: %s", _tmp32_);
+ g_warning ("scanner.vala:1244: Unable to read frame from device: %s", _tmp32_);
_tmp33_ = status;
_tmp34_ = _ ("Error communicating with scanner");
scanner_fail_scan (self, (gint) _tmp33_, _tmp34_);
@@ -7589,7 +7682,7 @@ static void* scanner_scan_thread (Scanner* self) {
_tmp2_ = status;
_tmp3_ = sane_status_to_string (_tmp2_);
_tmp4_ = _tmp3_;
- g_debug ("scanner.vala:1331: sane_init () -> %s", _tmp4_);
+ g_debug ("scanner.vala:1361: sane_init () -> %s", _tmp4_);
_g_free0 (_tmp4_);
_tmp5_ = status;
if (_tmp5_ != SANE_STATUS_GOOD) {
@@ -7597,7 +7690,7 @@ static void* scanner_scan_thread (Scanner* self) {
const gchar* _tmp7_ = NULL;
_tmp6_ = status;
_tmp7_ = sane_strstatus (_tmp6_);
- g_warning ("scanner.vala:1334: Unable to initialize SANE backend: %s", _tmp7_);
+ g_warning ("scanner.vala:1364: Unable to initialize SANE backend: %s", _tmp7_);
result = NULL;
return result;
}
@@ -7607,7 +7700,7 @@ static void* scanner_scan_thread (Scanner* self) {
_tmp11_ = SANE_VERSION_MINOR (_tmp10_);
_tmp12_ = version_code;
_tmp13_ = SANE_VERSION_BUILD (_tmp12_);
- g_debug ("scanner.vala:1337: SANE version %d.%d.%d", _tmp9_, _tmp11_, _tmp13_);
+ g_debug ("scanner.vala:1367: SANE version %d.%d.%d", _tmp9_, _tmp11_, _tmp13_);
scanner_redetect (self);
while (TRUE) {
gboolean _tmp14_ = FALSE;
@@ -7697,7 +7790,7 @@ void scanner_start (Scanner* self) {
_inner_error_ = NULL;
_tmp2_ = e;
_tmp3_ = _tmp2_->message;
- g_critical ("scanner.vala:1388: Unable to create thread: %s", _tmp3_);
+ g_critical ("scanner.vala:1418: Unable to create thread: %s", _tmp3_);
_g_error_free0 (e);
}
__finally14:
@@ -7719,7 +7812,7 @@ void scanner_redetect (Scanner* self) {
return;
}
self->priv->need_redetect = TRUE;
- g_debug ("scanner.vala:1398: Requesting redetection of scan devices");
+ g_debug ("scanner.vala:1428: Requesting redetection of scan devices");
_tmp1_ = self->priv->request_queue;
_tmp2_ = request_redetect_new ();
g_async_queue_push (_tmp1_, (Request*) _tmp2_);
@@ -7903,7 +7996,7 @@ void scanner_scan (Scanner* self, const gchar* device, ScanOptions* options) {
_tmp17_ = _tmp16_->paper_width;
_tmp18_ = options;
_tmp19_ = _tmp18_->paper_height;
- g_debug ("scanner.vala:1444: Scanner.scan (\"%s\", dpi=%d, scan_mode=%s, depth=%" \
+ g_debug ("scanner.vala:1474: Scanner.scan (\"%s\", dpi=%d, scan_mode=%s, depth=%" \
"d, type=%s, paper_width=%d, paper_height=%d)", _tmp3_, _tmp5_, _tmp9_, _tmp11_, _tmp15_, _tmp17_, _tmp19_);
_g_free0 (_tmp15_);
_g_free0 (_tmp9_);
@@ -7963,7 +8056,7 @@ void scanner_free (Scanner* self) {
RequestQuit* _tmp1_;
GThread* _tmp2_;
g_return_if_fail (self != NULL);
- g_debug ("scanner.vala:1466: Stopping scan thread");
+ g_debug ("scanner.vala:1496: Stopping scan thread");
_tmp0_ = self->priv->request_queue;
_tmp1_ = request_quit_new ();
g_async_queue_push (_tmp0_, (Request*) _tmp1_);
@@ -7974,7 +8067,7 @@ void scanner_free (Scanner* self) {
g_thread_join (_tmp3_);
}
sane_exit ();
- g_debug ("scanner.vala:1474: sane_exit ()");
+ g_debug ("scanner.vala:1504: sane_exit ()");
}
@@ -8179,6 +8272,7 @@ static void scanner_finalize (Scanner* obj) {
_g_free0 (self->priv->default_device);
__g_list_free__scan_job_unref0_0 (self->priv->job_queue);
_g_free0 (self->priv->current_device);
+ _g_hash_table_unref0 (self->priv->options);
self->priv->buffer = (g_free (self->priv->buffer), NULL);
}
diff --git a/src/scanner.vala b/src/scanner.vala
index 8a8c6f6..158fa50 100644
--- a/src/scanner.vala
+++ b/src/scanner.vala
@@ -221,9 +221,8 @@ public class Scanner
/* Last option read */
private Sane.Int option_index;
- /* Option index for scan area */
- private Sane.Int br_x_option_index;
- private Sane.Int br_y_option_index;
+ /* Table of options */
+ private HashTable<string, int> options;
/* Buffer for received line */
private uchar[] buffer;
@@ -701,6 +700,7 @@ public class Scanner
Sane.close (handle);
debug ("sane_close ()");
have_handle = false;
+ options = null;
}
buffer = null;
@@ -762,8 +762,6 @@ public class Scanner
page_number = 0;
notified_page = -1;
option_index = 0;
- br_x_option_index = 0;
- br_y_option_index = 0;
if (job.device == null && default_device != null)
job.device = default_device;
@@ -794,6 +792,7 @@ public class Scanner
current_device = null;
have_handle = false;
+ options = new HashTable <string, int> (str_hash, str_equal);
var status = Sane.open (job.device, out handle);
debug ("sane_open (\"%s\") -> %s", job.device, Sane.status_to_string (status));
@@ -820,34 +819,251 @@ public class Scanner
var index = option_index;
option_index++;
+ /* Options complete, apply settings */
if (option == null)
{
+ /* Pick source */
+ option = get_option_by_name (handle, Sane.NAME_SCAN_SOURCE, out index);
+ if (option != null)
+ {
+ string[] flatbed_sources =
+ {
+ "Auto",
+ Sane.I18N ("Auto"),
+ "Flatbed",
+ Sane.I18N ("Flatbed"),
+ "FlatBed",
+ "Normal",
+ Sane.I18N ("Normal")
+ };
+
+ string[] adf_sources =
+ {
+ "Automatic Document Feeder",
+ Sane.I18N ("Automatic Document Feeder"),
+ "ADF",
+ "Automatic Document Feeder(left aligned)", /* Seen in the proprietary brother3 driver */
+ "Automatic Document Feeder(centrally aligned)" /* Seen in the proprietary brother3 driver */
+ };
+
+ string[] adf_front_sources =
+ {
+ "ADF Front",
+ Sane.I18N ("ADF Front")
+ };
+
+ string[] adf_back_sources =
+ {
+ "ADF Back",
+ Sane.I18N ("ADF Back")
+ };
+
+ string[] adf_duplex_sources =
+ {
+ "ADF Duplex",
+ Sane.I18N ("ADF Duplex")
+ };
+
+ switch (job.type)
+ {
+ case ScanType.SINGLE:
+ if (!set_default_option (handle, option, index))
+ if (!set_constrained_string_option (handle, option, index, flatbed_sources, null))
+ warning ("Unable to set single page source, please file a bug");
+ break;
+ case ScanType.ADF_FRONT:
+ if (!set_constrained_string_option (handle, option, index, adf_front_sources, null))
+ if (!!set_constrained_string_option (handle, option, index, adf_sources, null))
+ warning ("Unable to set front ADF source, please file a bug");
+ break;
+ case ScanType.ADF_BACK:
+ if (!set_constrained_string_option (handle, option, index, adf_back_sources, null))
+ if (!set_constrained_string_option (handle, option, index, adf_sources, null))
+ warning ("Unable to set back ADF source, please file a bug");
+ break;
+ case ScanType.ADF_BOTH:
+ if (!set_constrained_string_option (handle, option, index, adf_duplex_sources, null))
+ if (!set_constrained_string_option (handle, option, index, adf_sources, null))
+ warning ("Unable to set duplex ADF source, please file a bug");
+ break;
+ }
+ }
+
+ /* Scan mode (before resolution as it tends to affect that */
+ option = get_option_by_name (handle, Sane.NAME_SCAN_MODE, out index);
+ if (option != null)
+ {
+ /* The names of scan modes often used in drivers, as taken from the sane-backends source */
+ string[] color_scan_modes =
+ {
+ Sane.VALUE_SCAN_MODE_COLOR,
+ "Color",
+ "24bit Color" /* Seen in the proprietary brother3 driver */
+ };
+ string[] gray_scan_modes =
+ {
+ Sane.VALUE_SCAN_MODE_GRAY,
+ "Gray",
+ "Grayscale",
+ Sane.I18N ("Grayscale"),
+ "True Gray" /* Seen in the proprietary brother3 driver */
+ };
+ string[] lineart_scan_modes =
+ {
+ Sane.VALUE_SCAN_MODE_LINEART,
+ "Lineart",
+ "LineArt",
+ Sane.I18N ("LineArt"),
+ "Black & White",
+ Sane.I18N ("Black & White"),
+ "Binary",
+ Sane.I18N ("Binary"),
+ "Thresholded",
+ Sane.VALUE_SCAN_MODE_GRAY,
+ "Gray",
+ "Grayscale",
+ Sane.I18N ("Grayscale"),
+ "True Gray" /* Seen in the proprietary brother3 driver */
+ };
+
+ switch (job.scan_mode)
+ {
+ case ScanMode.COLOR:
+ if (!set_constrained_string_option (handle, option, index, color_scan_modes, null))
+ warning ("Unable to set Color mode, please file a bug");
+ break;
+ case ScanMode.GRAY:
+ if (!set_constrained_string_option (handle, option, index, gray_scan_modes, null))
+ warning ("Unable to set Gray mode, please file a bug");
+ break;
+ case ScanMode.LINEART:
+ if (!set_constrained_string_option (handle, option, index, lineart_scan_modes, null))
+ warning ("Unable to set Lineart mode, please file a bug");
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* Duplex */
+ option = get_option_by_name (handle, "duplex", out index);
+ if (option != null)
+ {
+ if (option.type == Sane.ValueType.BOOL)
+ set_bool_option (handle, option, index, job.type == ScanType.ADF_BOTH, null);
+ }
+
+ /* Multi-page options */
+ option = get_option_by_name (handle, "batch-scan", out index);
+ if (option != null)
+ {
+ if (option.type == Sane.ValueType.BOOL)
+ set_bool_option (handle, option, index, job.type != ScanType.SINGLE, null);
+ }
+
+ /* Disable compression, we will compress after scanning */
+ option = get_option_by_name (handle, "compression", out index);
+ if (option != null)
+ {
+ string[] disable_compression_names =
+ {
+ Sane.I18N ("None"),
+ Sane.I18N ("none"),
+ "None",
+ "none"
+ };
+
+ if (!set_constrained_string_option (handle, option, index, disable_compression_names, null))
+ warning ("Unable to disable compression, please file a bug");
+ }
+
+ /* Set resolution and bit depth */
+ option = get_option_by_name (handle, Sane.NAME_SCAN_RESOLUTION, out index);
+ if (option != null)
+ {
+ if (option.type == Sane.ValueType.FIXED)
+ set_fixed_option (handle, option, index, job.dpi, out job.dpi);
+ else
+ {
+ int dpi;
+ set_int_option (handle, option, index, (int) job.dpi, out dpi);
+ job.dpi = dpi;
+ }
+ option = get_option_by_name (handle, Sane.NAME_BIT_DEPTH, out index);
+ if (option != null)
+ {
+ if (job.depth > 0)
+ set_int_option (handle, option, index, job.depth, null);
+ }
+ }
+
/* Always use maximum scan area - some scanners default to using partial areas. This should be patched in sane-backends */
- if (br_x_option_index != 0)
+ option = get_option_by_name (handle, Sane.NAME_SCAN_BR_X, out index);
+ if (option != null)
{
- option = Sane.get_option_descriptor (handle, br_x_option_index);
- debug ("sane_get_option_descriptor (%d)", (int) br_x_option_index);
if (option.constraint_type == Sane.ConstraintType.RANGE)
{
if (option.type == Sane.ValueType.FIXED)
- set_fixed_option (handle, option, br_x_option_index, Sane.UNFIX (option.range.max), null);
+ set_fixed_option (handle, option, index, Sane.UNFIX (option.range.max), null);
else
- set_int_option (handle, option, br_x_option_index, (int) option.range.max, null);
+ set_int_option (handle, option, index, (int) option.range.max, null);
}
}
- if (br_y_option_index != 0)
+ option = get_option_by_name (handle, Sane.NAME_SCAN_BR_Y, out index);
+ if (option != null)
{
- option = Sane.get_option_descriptor (handle, br_y_option_index);
- debug ("sane_get_option_descriptor (%d)", (int) br_y_option_index);
if (option.constraint_type == Sane.ConstraintType.RANGE)
{
if (option.type == Sane.ValueType.FIXED)
- set_fixed_option (handle, option, br_y_option_index, Sane.UNFIX (option.range.max), null);
+ set_fixed_option (handle, option, index, Sane.UNFIX (option.range.max), null);
+ else
+ set_int_option (handle, option, index, (int) option.range.max, null);
+ }
+ }
+
+ option = get_option_by_name (handle, Sane.NAME_PAGE_WIDTH, out index);
+ if (option != null)
+ {
+ if (job.page_width > 0.0)
+ {
+ if (option.type == Sane.ValueType.FIXED)
+ set_fixed_option (handle, option, index, job.page_width / 10.0, null);
+ else
+ set_int_option (handle, option, index, job.page_width / 10, null);
+ }
+ }
+ option = get_option_by_name (handle, Sane.NAME_PAGE_HEIGHT, out index);
+ if (option != null)
+ {
+ if (job.page_height > 0.0)
+ {
+ if (option.type == Sane.ValueType.FIXED)
+ set_fixed_option (handle, option, index, job.page_height / 10.0, null);
else
- set_int_option (handle, option, br_y_option_index, (int) option.range.max, null);
+ set_int_option (handle, option, index, job.page_height / 10, null);
}
}
+ /* Test scanner options (hoping will not effect other scanners...) */
+ if (current_device == "test")
+ {
+ option = get_option_by_name (handle, "hand-scanner", out index);
+ if (option != null)
+ set_bool_option (handle, option, index, false, null);
+ option = get_option_by_name (handle, "three-pass", out index);
+ if (option != null)
+ set_bool_option (handle, option, index, false, null);
+ option = get_option_by_name (handle, "test-picture", out index);
+ if (option != null)
+ set_string_option (handle, option, index, "Color pattern", null);
+ option = get_option_by_name (handle, "read-delay", out index);
+ if (option != null)
+ set_bool_option (handle, option, index, true, null);
+ option = get_option_by_name (handle, "read-delay-duration", out index);
+ if (option != null)
+ set_int_option (handle, option, index, 200000, null);
+ }
+
state = ScanState.START;
return;
}
@@ -866,202 +1082,16 @@ public class Scanner
if (option.name == null)
return;
- if (option.name == Sane.NAME_SCAN_RESOLUTION)
- {
- if (option.type == Sane.ValueType.FIXED)
- set_fixed_option (handle, option, index, job.dpi, out job.dpi);
- else
- {
- int dpi;
- set_int_option (handle, option, index, (int) job.dpi, out dpi);
- job.dpi = dpi;
- }
- }
- else if (option.name == Sane.NAME_SCAN_SOURCE)
- {
- string[] flatbed_sources =
- {
- "Auto",
- Sane.I18N ("Auto"),
- "Flatbed",
- Sane.I18N ("Flatbed"),
- "FlatBed",
- "Normal",
- Sane.I18N ("Normal")
- };
-
- string[] adf_sources =
- {
- "Automatic Document Feeder",
- Sane.I18N ("Automatic Document Feeder"),
- "ADF",
- "Automatic Document Feeder(left aligned)", /* Seen in the proprietary brother3 driver */
- "Automatic Document Feeder(centrally aligned)" /* Seen in the proprietary brother3 driver */
- };
-
- string[] adf_front_sources =
- {
- "ADF Front",
- Sane.I18N ("ADF Front")
- };
-
- string[] adf_back_sources =
- {
- "ADF Back",
- Sane.I18N ("ADF Back")
- };
-
- string[] adf_duplex_sources =
- {
- "ADF Duplex",
- Sane.I18N ("ADF Duplex")
- };
+ options.insert (option.name, (int) index);
+ }
- switch (job.type)
- {
- case ScanType.SINGLE:
- if (!set_default_option (handle, option, index))
- if (!set_constrained_string_option (handle, option, index, flatbed_sources, null))
- warning ("Unable to set single page source, please file a bug");
- break;
- case ScanType.ADF_FRONT:
- if (!set_constrained_string_option (handle, option, index, adf_front_sources, null))
- if (!!set_constrained_string_option (handle, option, index, adf_sources, null))
- warning ("Unable to set front ADF source, please file a bug");
- break;
- case ScanType.ADF_BACK:
- if (!set_constrained_string_option (handle, option, index, adf_back_sources, null))
- if (!set_constrained_string_option (handle, option, index, adf_sources, null))
- warning ("Unable to set back ADF source, please file a bug");
- break;
- case ScanType.ADF_BOTH:
- if (!set_constrained_string_option (handle, option, index, adf_duplex_sources, null))
- if (!set_constrained_string_option (handle, option, index, adf_sources, null))
- warning ("Unable to set duplex ADF source, please file a bug");
- break;
- }
- }
- else if (option.name == "duplex")
- {
- if (option.type == Sane.ValueType.BOOL)
- set_bool_option (handle, option, index, job.type == ScanType.ADF_BOTH, null);
- }
- else if (option.name == "batch-scan")
- {
- if (option.type == Sane.ValueType.BOOL)
- set_bool_option (handle, option, index, job.type != ScanType.SINGLE, null);
- }
- else if (option.name == Sane.NAME_BIT_DEPTH)
- {
- if (job.depth > 0)
- set_int_option (handle, option, index, job.depth, null);
- }
- else if (option.name == Sane.NAME_SCAN_MODE)
- {
- /* The names of scan modes often used in drivers, as taken from the sane-backends source */
- string[] color_scan_modes =
- {
- Sane.VALUE_SCAN_MODE_COLOR,
- "Color",
- "24bit Color" /* Seen in the proprietary brother3 driver */
- };
- string[] gray_scan_modes =
- {
- Sane.VALUE_SCAN_MODE_GRAY,
- "Gray",
- "Grayscale",
- Sane.I18N ("Grayscale"),
- "True Gray" /* Seen in the proprietary brother3 driver */
- };
- string[] lineart_scan_modes =
- {
- Sane.VALUE_SCAN_MODE_LINEART,
- "Lineart",
- "LineArt",
- Sane.I18N ("LineArt"),
- "Black & White",
- Sane.I18N ("Black & White"),
- "Binary",
- Sane.I18N ("Binary"),
- "Thresholded",
- Sane.VALUE_SCAN_MODE_GRAY,
- "Gray",
- "Grayscale",
- Sane.I18N ("Grayscale"),
- "True Gray" /* Seen in the proprietary brother3 driver */
- };
-
- switch (job.scan_mode)
- {
- case ScanMode.COLOR:
- if (!set_constrained_string_option (handle, option, index, color_scan_modes, null))
- warning ("Unable to set Color mode, please file a bug");
- break;
- case ScanMode.GRAY:
- if (!set_constrained_string_option (handle, option, index, gray_scan_modes, null))
- warning ("Unable to set Gray mode, please file a bug");
- break;
- case ScanMode.LINEART:
- if (!set_constrained_string_option (handle, option, index, lineart_scan_modes, null))
- warning ("Unable to set Lineart mode, please file a bug");
- break;
- default:
- break;
- }
- }
- /* Disable compression, we will compress after scanning */
- else if (option.name == "compression")
- {
- string[] disable_compression_names =
- {
- Sane.I18N ("None"),
- Sane.I18N ("none"),
- "None",
- "none"
- };
-
- if (!set_constrained_string_option (handle, option, index, disable_compression_names, null))
- warning ("Unable to disable compression, please file a bug");
- }
- else if (option.name == Sane.NAME_SCAN_BR_X)
- br_x_option_index = index;
- else if (option.name == Sane.NAME_SCAN_BR_Y)
- br_y_option_index = index;
- else if (option.name == Sane.NAME_PAGE_WIDTH)
- {
- if (job.page_width > 0.0)
- {
- if (option.type == Sane.ValueType.FIXED)
- set_fixed_option (handle, option, index, job.page_width / 10.0, null);
- else
- set_int_option (handle, option, index, job.page_width / 10, null);
- }
- }
- else if (option.name == Sane.NAME_PAGE_HEIGHT)
- {
- if (job.page_height > 0.0)
- {
- if (option.type == Sane.ValueType.FIXED)
- set_fixed_option (handle, option, index, job.page_height / 10.0, null);
- else
- set_int_option (handle, option, index, job.page_height / 10, null);
- }
- }
+ private Sane.OptionDescriptor? get_option_by_name (Sane.Handle handle, string name, out int index)
+ {
+ index = options.lookup (name);
+ if (index == 0)
+ return null;
- /* Test scanner options (hoping will not effect other scanners...) */
- if (current_device == "test")
- {
- if (option.name == "hand-scanner")
- set_bool_option (handle, option, index, false, null);
- else if (option.name == "three-pass")
- set_bool_option (handle, option, index, false, null);
- else if (option.name == "test-picture")
- set_string_option (handle, option, index, "Color pattern", null);
- else if (option.name == "read-delay")
- set_bool_option (handle, option, index, true, null);
- else if (option.name == "read-delay-duration")
- set_int_option (handle, option, index, 200000, null);
- }
+ return Sane.get_option_descriptor (handle, index);
}
private void do_complete_document ()
diff --git a/src/simple-scan.c b/src/simple-scan.c
index d76395e..fb8b8f5 100644
--- a/src/simple-scan.c
+++ b/src/simple-scan.c
@@ -1,4 +1,4 @@
-/* simple-scan.c generated by valac 0.15.2, the Vala compiler
+/* simple-scan.c generated by valac 0.16.0, the Vala compiler
* generated from simple-scan.vala, do not modify */
/*
diff --git a/src/ui.c b/src/ui.c
index 10ae780..fd42d4e 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -1,4 +1,4 @@
-/* ui.c generated by valac 0.15.2, the Vala compiler
+/* ui.c generated by valac 0.16.0, the Vala compiler
* generated from ui.vala, do not modify */
/*
@@ -3174,7 +3174,7 @@ void G_MODULE_EXPORT help_contents_menuitem_activate_cb (GtkWidget* widget, Simp
_tmp0_ = self->priv->window;
_tmp1_ = gtk_window_get_screen (_tmp0_);
_tmp2_ = gtk_get_current_event_time ();
- gtk_show_uri (_tmp1_, "ghelp:simple-scan", _tmp2_, &_inner_error_);
+ gtk_show_uri (_tmp1_, "help:simple-scan", _tmp2_, &_inner_error_);
if (_inner_error_ != NULL) {
goto __catch20_g_error;
}
diff --git a/src/ui.vala b/src/ui.vala
index f8521d0..3056061 100644
--- a/src/ui.vala
+++ b/src/ui.vala
@@ -1051,7 +1051,7 @@ public class SimpleScan
{
try
{
- Gtk.show_uri (window.get_screen (), "ghelp:simple-scan", Gtk.get_current_event_time ());
+ Gtk.show_uri (window.get_screen (), "help:simple-scan", Gtk.get_current_event_time ());
}
catch (Error e)
{