summaryrefslogtreecommitdiff
path: root/src/scanner.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-01-09 17:51:04 +0100
committerJörg Frings-Fürst <debian@jff.email>2022-01-09 17:51:04 +0100
commitba45285a909eba797547ecb9b2b405d30266ad59 (patch)
tree7e5a555a3f296c30ce811c2fc0b980f38c695cf6 /src/scanner.vala
parent630a965ad9727d36b8078d74f96b5ffa00c242d8 (diff)
parent05315c3da6d3761ba95f1ae96b852768dd651c25 (diff)
Update upstream source from tag 'upstream/40.7'
Update to upstream version '40.7' with Debian dir 039d723b4651a4494baf2d79aa055285570c9c44
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);
}