diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2022-01-09 17:51:00 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2022-01-09 17:51:00 +0100 |
commit | 05315c3da6d3761ba95f1ae96b852768dd651c25 (patch) | |
tree | 5a9ee8c3257a421e1e836fc408c3dd5455817a18 /src | |
parent | 7261d6a7e5b557003de9309b2da13b9762346834 (diff) |
New upstream version 40.7upstream/40.7
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); } |