[simple-scan/gnome-3-38] Don't repeat vendor name in the device name



commit c2f76dd2ebd4504edf0e9b62d15700aa39d1f1c9
Author: Bartosz Kosiorek <gang65 poczta onet pl>
Date:   Wed Feb 24 11:43:04 2021 +0100

    Don't repeat vendor name in the device name

 .gitlab-ci.yml   | 1 -
 src/scanner.vala | 7 ++++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 72d7ad58..ef5a41ec 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,4 @@
 build:snap:
-  stage: build
   image: ubuntudesktop/gnome-3-28-1804
   before_script:
     - apt-get update
diff --git a/src/scanner.vala b/src/scanner.vala
index 237e1eb9..8f19e6e7 100644
--- a/src/scanner.vala
+++ b/src/scanner.vala
@@ -361,7 +361,12 @@ public class Scanner : Object
             if (vendor == "Hewlett-Packard")
                 vendor = "HP";
 
-            scan_device.label = "%s %s".printf (vendor, device_list[i].model);
+            /* Don't repeat vendor name */
+            if (device_list[i].model.down().has_prefix (vendor.down()))
+                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 ("_", " ");
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]