[simple-scan] Don't exclude INACTIVE descriptor from list of options
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [simple-scan] Don't exclude INACTIVE descriptor from list of options
- Date: Tue, 3 Dec 2019 22:08:20 +0000 (UTC)
commit cb9840a8186a7a3d0939ba904da9e39b69187e32
Author: Bartosz Kosiorek <gang65 poczta onet pl>
Date: Tue Dec 3 15:17:22 2019 +0100
Don't exclude INACTIVE descriptor from list of options
The Sane.Capability.INACTIVE capability indicates that
the option is not currently active (e.g., because it's meaningful
only if another option is set to some other value).
With some proprietary backends (example: esci, Epson WF-7710),
the 'duplex' option is INACTIVE at the start.
To activate it, the 'source' option need to be set to 'ADF' value.
With this patch, check if option is INACTIVE is made only during
value set, and not during creation of list of available options.
Fixes: #106
src/scanner.vala | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/scanner.vala b/src/scanner.vala
index c2205f7..4ab76ce 100644
--- a/src/scanner.vala
+++ b/src/scanner.vala
@@ -1175,10 +1175,6 @@ public class Scanner : Object
if (option.type == Sane.ValueType.GROUP)
return;
- /* Option disabled */
- if ((option.cap & Sane.Capability.INACTIVE) != 0)
- return;
-
/* Some options are unnamed (e.g. Option 0) */
if (option.name == null)
return;
@@ -1205,7 +1201,18 @@ public class Scanner : Object
if (index == 0)
return null;
- return Sane.get_option_descriptor (handle, index);
+ var option_descriptor = Sane.get_option_descriptor (handle, index);
+ /*
+ The Sane.Capability.INACTIVE capability indicates that
+ the option is not currently active (e.g., because it's meaningful
+ only if another option is set to some other value).
+ */
+ if ((option_descriptor.cap & Sane.Capability.INACTIVE) != 0)
+ {
+ warning ("The option %s (%d) is inactive and can't be set, please file a bug", name, index);
+ return null;
+ }
+ return option_descriptor;
}
private void do_complete_document ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]