From 05315c3da6d3761ba95f1ae96b852768dd651c25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 9 Jan 2022 17:51:00 +0100 Subject: New upstream version 40.7 --- src/app-window.vala | 1 + src/scanner.vala | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src') 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 (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 (); 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); } -- cgit v1.2.3