summaryrefslogtreecommitdiff
path: root/src/scanner.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-02-06 19:47:02 +0100
committerJörg Frings-Fürst <debian@jff.email>2022-02-06 19:47:02 +0100
commit055f6f3e01bb718bfdd61331e1b13b0cdba6d718 (patch)
tree2ca6334d6cc4a21e36eaf26289e2b7de41614b48 /src/scanner.vala
parentabcd042fc0ee8698096f21b056574426a991dbd2 (diff)
parent9f26dc8a2172b29a1d50a47a060ae3b9d0bee21e (diff)
Merge branch 'release/debian/40.7-1'debian/40.7-1
Diffstat (limited to 'src/scanner.vala')
-rw-r--r--src/scanner.vala19
1 files changed, 17 insertions, 2 deletions
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);
}