[gnome-control-center/wip/hughsie/hsi-events: 2/2] firmware-security: Only show events that have changed value




commit 5dba9324c2d97e94008ec5c80cc4865e1b376af6
Author: Richard Hughes <richard hughsie com>
Date:   Wed Aug 24 12:39:44 2022 +0100

    firmware-security: Only show events that have changed value

 panels/firmware-security/cc-firmware-security-panel.c | 5 +++++
 panels/firmware-security/cc-firmware-security-utils.c | 2 ++
 panels/firmware-security/cc-firmware-security-utils.h | 1 +
 3 files changed, 8 insertions(+)
---
diff --git a/panels/firmware-security/cc-firmware-security-panel.c 
b/panels/firmware-security/cc-firmware-security-panel.c
index 28e7912d0..d7d660ee8 100644
--- a/panels/firmware-security/cc-firmware-security-panel.c
+++ b/panels/firmware-security/cc-firmware-security-panel.c
@@ -174,6 +174,11 @@ parse_event_variant_iter (CcfirmwareSecurityPanel *self,
   if (attr->appstream_id == NULL || attr->title == NULL)
     return;
 
+  /* skip events that have either been added or removed with no prior value */
+  if (attr->result == FWUPD_SECURITY_ATTR_RESULT_UNKNOWN ||
+      attr->result_fallback == FWUPD_SECURITY_ATTR_RESULT_UNKNOWN)
+    return;
+
   /* build new row */
   date = g_date_time_new_from_unix_local (attr->timestamp);
   date_string = g_date_time_format (date, "\%F \%H:\%m:\%S");
diff --git a/panels/firmware-security/cc-firmware-security-utils.c 
b/panels/firmware-security/cc-firmware-security-utils.c
index 224567b19..fa715cbac 100644
--- a/panels/firmware-security/cc-firmware-security-utils.c
+++ b/panels/firmware-security/cc-firmware-security-utils.c
@@ -323,6 +323,8 @@ fu_security_attr_new_from_variant (GVariantIter *iter)
         attr->hsi_level = g_variant_get_uint32 (value);
       else if (g_strcmp0 (key, "HsiResult") == 0)
         attr->result = g_variant_get_uint32 (value);
+      else if (g_strcmp0 (key, "HsiResultFallback") == 0)
+        attr->result_fallback = g_variant_get_uint32 (value);
       else if (g_strcmp0 (key, "Created") == 0)
         attr->timestamp = g_variant_get_uint64 (value);
       else if (g_strcmp0 (key, "Description") == 0)
diff --git a/panels/firmware-security/cc-firmware-security-utils.h 
b/panels/firmware-security/cc-firmware-security-utils.h
index 6c895da87..08343f561 100644
--- a/panels/firmware-security/cc-firmware-security-utils.h
+++ b/panels/firmware-security/cc-firmware-security-utils.h
@@ -110,6 +110,7 @@ typedef enum {
 
 typedef struct {
   FwupdSecurityAttrResult  result;
+  FwupdSecurityAttrResult  result_fallback;
   FwupdSecurityAttrFlags   flags;
   guint32                  hsi_level;
   guint64                  timestamp;


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