[simple-scan] Don't repeat vendor name in the device name



commit 076fc27fd1b74c66c9615c2083b8509b7f743a4a
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   | 2 +-
 src/scanner.vala | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f3d2a883..2d6beb59 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
@@ -33,6 +32,7 @@ build-arch:
   script:
     - meson _build
     - ninja -C _build install
+  allow_failure: true
 
 include: 'https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml'
 
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]