[gnome-software/gnome-3-26] fwupd: Prepend the vendor name to the device name if not included



commit 9cb3fd9d2e7ea54e1136d41d971bd22bc6ca29e2
Author: Richard Hughes <richard hughsie com>
Date:   Mon Dec 11 14:21:42 2017 +0000

    fwupd: Prepend the vendor name to the device name if not included
    
    This makes it show a sensible thing in the GsAppRow

 plugins/fwupd/gs-fwupd-app.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/plugins/fwupd/gs-fwupd-app.c b/plugins/fwupd/gs-fwupd-app.c
index 43d4a99..1efead4 100644
--- a/plugins/fwupd/gs-fwupd-app.c
+++ b/plugins/fwupd/gs-fwupd-app.c
@@ -95,8 +95,16 @@ gs_fwupd_app_set_from_device (GsApp *app, FwupdDevice *dev)
                gs_app_set_metadata (app, "fwupd::Guid", guid_str);
        }
        if (fwupd_device_get_name (dev) != NULL) {
-               gs_app_set_name (app, GS_APP_QUALITY_NORMAL,
-                                fwupd_device_get_name (dev));
+               g_autofree gchar *vendor_name = NULL;
+               if (g_str_has_prefix (fwupd_device_get_name (dev),
+                                     fwupd_device_get_vendor (dev))) {
+                       vendor_name = g_strdup (fwupd_device_get_name (dev));
+               } else {
+                       vendor_name = g_strdup_printf ("%s %s",
+                                                      fwupd_device_get_vendor (dev),
+                                                      fwupd_device_get_name (dev));
+               }
+               gs_app_set_name (app, GS_APP_QUALITY_NORMAL, vendor_name);
        }
        if (fwupd_device_get_summary (dev) != NULL) {
                gs_app_set_summary (app, GS_APP_QUALITY_NORMAL,


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