diff options
author | Kate Hsuan <hpa@redhat.com> | 2022-07-25 23:25:42 +0800 |
---|---|---|
committer | Kate Hsuan <hpa@redhat.com> | 2022-07-25 23:46:48 +0800 |
commit | 26421d4be9545a1f61aa21d13a4f138e4074d9e9 (patch) | |
tree | 890efa2c5760c59c25dd9b6481f8f821f3a70b68 | |
parent | 6ea23d553a66f6785d2461bcf5d66f1a7a9e2f97 (diff) | |
download | gnome-control-center-Kate/WIP/event-description.tar.gz |
Three fixes.Kate/WIP/event-description
1. "Summary" will be the event title.
2. fwupd_event_to_log() was removed.
3. description was moved to subtitle.
-rw-r--r-- | panels/firmware-security/cc-firmware-security-panel.c | 11 | ||||
-rw-r--r-- | panels/firmware-security/cc-firmware-security-utils.c | 128 | ||||
-rw-r--r-- | panels/firmware-security/cc-firmware-security-utils.h | 2 |
3 files changed, 3 insertions, 138 deletions
diff --git a/panels/firmware-security/cc-firmware-security-panel.c b/panels/firmware-security/cc-firmware-security-panel.c index 1c4c746dd..dd6b9f43a 100644 --- a/panels/firmware-security/cc-firmware-security-panel.c +++ b/panels/firmware-security/cc-firmware-security-panel.c @@ -124,13 +124,11 @@ static void parse_event_variant_iter (CcfirmwareSecurityPanel *self, GVariantIter *iter) { - FwupdSecurityAttrResult result = 0; FwupdSecurityAttrFlags flags = 0; g_autofree gchar *date_string = NULL; g_autoptr (GDateTime) date = NULL; const gchar *appstream_id = NULL; const gchar *key; - const gchar *event_msg; const gchar *description = NULL; const gchar *summary = NULL; guint64 timestamp = 0; @@ -144,8 +142,6 @@ parse_event_variant_iter (CcfirmwareSecurityPanel *self, appstream_id = g_variant_get_string (value, NULL); else if (g_strcmp0 (key, "Flags") == 0) flags = g_variant_get_uint64(value); - else if (g_strcmp0 (key, "HsiResult") == 0) - result = g_variant_get_uint32 (value); else if (g_strcmp0 (key, "Created") == 0) timestamp = g_variant_get_uint64 (value); else if (g_strcmp0 (key, "Description") == 0) @@ -159,8 +155,7 @@ parse_event_variant_iter (CcfirmwareSecurityPanel *self, if (appstream_id == NULL) return; - event_msg = fwupd_event_to_log (appstream_id, result); - if (event_msg == NULL) + if (summary == NULL) return; /* build new row */ @@ -182,7 +177,7 @@ parse_event_variant_iter (CcfirmwareSecurityPanel *self, if (description) { subrow = adw_action_row_new (); - adw_preferences_row_set_title (ADW_PREFERENCES_ROW (subrow), dgettext ("fwupd", description)); + adw_action_row_set_subtitle (ADW_ACTION_ROW (subrow), dgettext ("fwupd", description)); adw_expander_row_add_row (ADW_EXPANDER_ROW (row), subrow); } else @@ -190,7 +185,7 @@ parse_event_variant_iter (CcfirmwareSecurityPanel *self, adw_expander_row_set_enable_expansion (ADW_EXPANDER_ROW (row), false); } - adw_preferences_row_set_title (ADW_PREFERENCES_ROW (row), event_msg); + adw_preferences_row_set_title (ADW_PREFERENCES_ROW (row), dgettext ("fwupd", summary)); adw_expander_row_set_subtitle (ADW_EXPANDER_ROW (row), date_string); adw_preferences_group_add (ADW_PREFERENCES_GROUP (self->firmware_security_log_pgroup), GTK_WIDGET (row)); diff --git a/panels/firmware-security/cc-firmware-security-utils.c b/panels/firmware-security/cc-firmware-security-utils.c index b3298a131..5127cb1f0 100644 --- a/panels/firmware-security/cc-firmware-security-utils.c +++ b/panels/firmware-security/cc-firmware-security-utils.c @@ -132,134 +132,6 @@ firmware_security_attr_has_flag (guint64 flags, return (flags & flag) > 0; } -const char * -fwupd_event_to_log (const char *appstream_id, - FwupdSecurityAttrResult result) -{ - struct - { - const gchar *appstream_id; - FwupdSecurityAttrResult result; - const gchar *text; - } event_log_items[] = - { - { - "org.fwupd.hsi.Iommu", - FWUPD_SECURITY_ATTR_RESULT_ENABLED, - /* TRANSLATORS: HSI event title */ - N_("IOMMU device protection enabled") - }, - { - "org.fwupd.hsi.Iommu", - FWUPD_SECURITY_ATTR_RESULT_NOT_FOUND, - /* TRANSLATORS: HSI event title */ - N_("IOMMU device protection disabled")}, - { - "org.fwupd.hsi.Fwupd.Plugins", - FWUPD_SECURITY_ATTR_RESULT_NOT_TAINTED, - NULL - }, - { - "org.fwupd.hsi.Fwupd.Plugins", - FWUPD_SECURITY_ATTR_RESULT_TAINTED, - NULL - }, - { - "org.fwupd.hsi.Fwupd.Plugins", - FWUPD_SECURITY_ATTR_RESULT_NOT_ENABLED, - NULL - }, - { - "org.fwupd.hsi.Kernel.Tainted", - FWUPD_SECURITY_ATTR_RESULT_NOT_TAINTED, - /* TRANSLATORS: HSI event title */ - N_("Kernel is no longer tainted") - }, - { - "org.fwupd.hsi.Kernel.Tainted", - FWUPD_SECURITY_ATTR_RESULT_TAINTED, - /* TRANSLATORS: HSI event title */ - N_("Kernel is tainted") - }, - { - "org.fwupd.hsi.Kernel.Lockdown", - FWUPD_SECURITY_ATTR_RESULT_NOT_ENABLED, - /* TRANSLATORS: HSI event title */ - N_("Kernel lockdown disabled") - }, - { - "org.fwupd.hsi.Kernel.Lockdown", - FWUPD_SECURITY_ATTR_RESULT_ENABLED, - /* TRANSLATORS: HSI event title */ - N_("Kernel lockdown enabled") - }, - { - "org.fwupd.hsi.AcpiDmar", - FWUPD_SECURITY_ATTR_RESULT_NOT_ENABLED, - /* TRANSLATORS: HSI event title */ - N_("Pre-boot DMA protection is disabled") - }, - { - "org.fwupd.hsi.AcpiDmar", - FWUPD_SECURITY_ATTR_RESULT_ENABLED, - /* TRANSLATORS: HSI event title */ - N_("Pre-boot DMA protection is enabled") - }, - { - "org.fwupd.hsi.Uefi.SecureBoot", - FWUPD_SECURITY_ATTR_RESULT_NOT_ENABLED, - /* TRANSLATORS: HSI event title */ - N_("Secure Boot disabled") - }, - { - "org.fwupd.hsi.Uefi.SecureBoot", - FWUPD_SECURITY_ATTR_RESULT_ENABLED, - /* TRANSLATORS: HSI event title */ - N_("Secure Boot enabled") - }, - { - "org.fwupd.hsi.Tpm.EmptyPcr", - FWUPD_SECURITY_ATTR_RESULT_VALID, - /* TRANSLATORS: HSI event title */ - N_("All TPM PCRs are valid") - }, - { - "org.fwupd.hsi.Tpm.EmptyPcr", - FWUPD_SECURITY_ATTR_RESULT_NOT_VALID, - /* TRANSLATORS: HSI event title */ - N_("All TPM PCRs are now valid") - }, - { - "org.fwupd.hsi.Uefi.SecureBoot", - FWUPD_SECURITY_ATTR_RESULT_VALID, - /* TRANSLATORS: HSI event title */ - N_("A TPM PCR is now an invalid value") - }, - { - "org.fwupd.hsi.Tpm.ReconstructionPcr0", - FWUPD_SECURITY_ATTR_RESULT_NOT_VALID, - /* TRANSLATORS: HSI event title */ - N_("TPM PCR0 reconstruction is invalid") - }, - { - NULL, - 0, - NULL - } - }; - - for (int i = 0; event_log_items[i].appstream_id != NULL; i++) - { - if (g_strcmp0 (appstream_id, event_log_items[i].appstream_id) == 0 && - result == event_log_items[i].result) - { - return _(event_log_items[i].text); - } - } - - return NULL; -} - void load_custom_css (const char *path) { diff --git a/panels/firmware-security/cc-firmware-security-utils.h b/panels/firmware-security/cc-firmware-security-utils.h index 38bfc5070..402c805e7 100644 --- a/panels/firmware-security/cc-firmware-security-utils.h +++ b/panels/firmware-security/cc-firmware-security-utils.h @@ -102,8 +102,6 @@ const gchar *fu_security_attr_get_name (const gchar *appstream gboolean firmware_security_attr_has_flag (guint64 flags, FwupdSecurityAttrFlags flag); void load_custom_css (const char *path); -const char *fwupd_event_to_log (const char *appstream_id, - FwupdSecurityAttrResult result); G_END_DECLS |