diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2022-01-09 17:51:04 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2022-01-09 17:51:04 +0100 |
commit | ba45285a909eba797547ecb9b2b405d30266ad59 (patch) | |
tree | 7e5a555a3f296c30ce811c2fc0b980f38c695cf6 /src | |
parent | 630a965ad9727d36b8078d74f96b5ffa00c242d8 (diff) | |
parent | 05315c3da6d3761ba95f1ae96b852768dd651c25 (diff) |
Update upstream source from tag 'upstream/40.7'
Update to upstream version '40.7'
with Debian dir 039d723b4651a4494baf2d79aa055285570c9c44
Diffstat (limited to 'src')
-rw-r--r-- | src/app-window.vala | 1 | ||||
-rw-r--r-- | src/scanner.vala | 19 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/app-window.vala b/src/app-window.vala index c1d4ea3..e163047 100644 --- a/src/app-window.vala +++ b/src/app-window.vala @@ -802,6 +802,7 @@ public class AppWindow : Hdy.ApplicationWindow stop_scan (); clear_document (); + autosave_manager.cleanup (); }); } diff --git a/src/scanner.vala b/src/scanner.vala index d968aec..809ba6c 100644 --- a/src/scanner.vala +++ b/src/scanner.vala @@ -354,6 +354,16 @@ public class Scanner : Object return; } + /* Determine the number of each model to additionally display the name if the model names are the same. */ + var seen = new HashTable<string, int> (str_hash, str_equal); + for (var i = 0; device_list[i] != null; i++) + { + if (seen.contains(device_list[i].model)) + seen.set(device_list[i].model, seen.get(device_list[i].model) + 1); + else + seen.set(device_list[i].model, 1); + } + var devices = new List<ScanDevice> (); for (var i = 0; device_list[i] != null; i++) { @@ -373,9 +383,14 @@ public class Scanner : Object scan_device.label = device_list[i].model; else scan_device.label = "%s %s".printf (vendor, device_list[i].model); - + /* Replace underscores in name */ - scan_device.label.replace ("_", " "); + scan_device.label = scan_device.label.replace ("_", " "); + + /* Additionally add the device name to the label if there are several identical models. */ + if (seen.get(device_list[i].model) > 1) + scan_device.label = "%s on %s".printf (scan_device.label, device_list[i].name); + devices.append (scan_device); } |