[gnome-control-center/wip/kate/non-functional-arrows] firmware-security: hide expander arrow when event description is unavailable




commit 23748a6f5e6ffdaacdb18740b77ceb048cdba380
Author: Kate Hsuan <hpa redhat com>
Date:   Fri Aug 26 13:24:00 2022 +0800

    firmware-security: hide expander arrow when event description is unavailable
    
    Showing an arrow for an empty expander row for the event confuses the user.
    The user may misunderstand there is the information behind the arrow and then
    the user will click it but will not get any response from the panel.
    Therefore, to prevent confusing the user, the expander will be hidden for a
    event with an empty description.
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2031
    
    Signed-off-by: Kate Hsuan <hpa redhat com>

 .../firmware-security/cc-firmware-security-panel.c | 23 ++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/panels/firmware-security/cc-firmware-security-panel.c 
b/panels/firmware-security/cc-firmware-security-panel.c
index 28e7912d0..cb768a483 100644
--- a/panels/firmware-security/cc-firmware-security-panel.c
+++ b/panels/firmware-security/cc-firmware-security-panel.c
@@ -192,19 +192,38 @@ parse_event_variant_iter (CcfirmwareSecurityPanel *self,
 
   if (attr->description != NULL)
     {
+      row = adw_expander_row_new ();
       GtkWidget *subrow = adw_action_row_new ();
       g_autofree gchar *str = fu_security_attr_get_description_for_eventlog (attr);
       gtk_widget_add_css_class (subrow, "view");
       adw_action_row_set_subtitle (ADW_ACTION_ROW (subrow), str);
       adw_expander_row_add_row (ADW_EXPANDER_ROW (row), subrow);
+      adw_expander_row_set_subtitle (ADW_EXPANDER_ROW (row), date_string);
     }
   else
     {
-      adw_expander_row_set_enable_expansion (ADW_EXPANDER_ROW (row), FALSE);
+      row = adw_action_row_new ();
+      adw_action_row_set_subtitle (ADW_ACTION_ROW (row), date_string);
     }
 
+    if (attr->flags & FWUPD_SECURITY_ATTR_FLAG_SUCCESS)
+      {
+        if (ADW_IS_EXPANDER_ROW (row))
+          adw_expander_row_set_icon_name (ADW_EXPANDER_ROW (row), "emblem-ok");
+        else if (ADW_IS_ACTION_ROW (row))
+          adw_action_row_set_icon_name (ADW_ACTION_ROW (row), "emblem-ok");
+        gtk_widget_add_css_class (row, "success-icon");
+      }
+    else
+      {
+        if (ADW_IS_EXPANDER_ROW (row))
+          adw_expander_row_set_icon_name (ADW_EXPANDER_ROW (row), "process-stop");
+        else if (ADW_IS_ACTION_ROW (row))
+          adw_action_row_set_icon_name (ADW_ACTION_ROW (row), "process-stop");
+        gtk_widget_add_css_class (row, "error-icon");
+      }
+
   adw_preferences_row_set_title (ADW_PREFERENCES_ROW (row), attr->title);
-  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));
 
   adw_view_stack_set_visible_child_name (ADW_VIEW_STACK (self->firmware_security_log_stack), "page2");


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