[gnome-software/wip/hughsie/fwupd: 21/21] Show a more recognisable version string if there are no dots



commit cfb2c72768352147fd81858badc541ba9cdd3ad9
Author: Richard Hughes <richard hughsie com>
Date:   Wed Mar 11 19:49:26 2015 +0000

    Show a more recognisable version string if there are no dots
    
    UEFI firmware is usually just one integer.

 src/plugins/gs-plugin-fwupd.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 7bcde5b..4d4d549 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -241,7 +241,19 @@ gs_plugin_fwupd_add_device (GsPlugin *plugin,
 
                /* get the update text, if it exists */
                if (update_version == NULL) {
-                       update_version = g_strdup (as_release_get_version (rel));
+                       tmp = as_release_get_version (rel);
+                       if (g_strstr_len (tmp, -1, ".") != NULL) {
+                               update_version = g_strdup (tmp);
+                       } else {
+                               GDateTime *dt;
+                               dt = g_date_time_new_from_unix_utc (as_release_get_timestamp (rel));
+                               update_version = g_strdup_printf ("Version %s (%i-%i-%i)",
+                                                                 tmp,
+                                                                 g_date_time_get_year (dt),
+                                                                 g_date_time_get_month (dt),
+                                                                 g_date_time_get_day_of_month (dt));
+                               g_date_time_unref (dt);
+                       }
                        update_location = g_strdup (as_release_get_location_default (rel));
                }
                tmp = as_release_get_description (rel, NULL);


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