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




commit eadccb23e43618901be16d692411838f2c1d21af
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>

 panels/firmware-security/cc-firmware-security-dialog.c | 3 ++-
 panels/firmware-security/cc-firmware-security-panel.c  | 3 ++-
 panels/firmware-security/security-level.css            | 4 ++++
 3 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/panels/firmware-security/cc-firmware-security-dialog.c 
b/panels/firmware-security/cc-firmware-security-dialog.c
index 737bf7731..a5676a6a1 100644
--- a/panels/firmware-security/cc-firmware-security-dialog.c
+++ b/panels/firmware-security/cc-firmware-security-dialog.c
@@ -227,7 +227,7 @@ hsi_create_pg_row (const gchar *icon_name,
   GtkWidget *row;
   GtkWidget *status_icon;
   GtkWidget *status_label;
-  GtkWidget *actions_parent;
+  GtkWidget *actions_parent = NULL;
   const gchar *result_str = NULL;
 
   row = adw_expander_row_new ();
@@ -265,6 +265,7 @@ hsi_create_pg_row (const gchar *icon_name,
   else
     {
       adw_expander_row_set_enable_expansion (ADW_EXPANDER_ROW (row), FALSE);
+      gtk_widget_add_css_class (row, "hide-arrow");
     }
 
   return row;
diff --git a/panels/firmware-security/cc-firmware-security-panel.c 
b/panels/firmware-security/cc-firmware-security-panel.c
index 28e7912d0..dfedcb19b 100644
--- a/panels/firmware-security/cc-firmware-security-panel.c
+++ b/panels/firmware-security/cc-firmware-security-panel.c
@@ -190,7 +190,7 @@ parse_event_variant_iter (CcfirmwareSecurityPanel *self,
       gtk_widget_add_css_class (row, "error-icon");
     }
 
-  if (attr->description != NULL)
+  if (attr->description == NULL)
     {
       GtkWidget *subrow = adw_action_row_new ();
       g_autofree gchar *str = fu_security_attr_get_description_for_eventlog (attr);
@@ -201,6 +201,7 @@ parse_event_variant_iter (CcfirmwareSecurityPanel *self,
   else
     {
       adw_expander_row_set_enable_expansion (ADW_EXPANDER_ROW (row), FALSE);
+      gtk_widget_add_css_class (row, "hide-arrow");
     }
 
   adw_preferences_row_set_title (ADW_PREFERENCES_ROW (row), attr->title);
diff --git a/panels/firmware-security/security-level.css b/panels/firmware-security/security-level.css
index 1535b4544..64d724f60 100644
--- a/panels/firmware-security/security-level.css
+++ b/panels/firmware-security/security-level.css
@@ -113,3 +113,7 @@ row.error-title label.hsi_label {
 row.security-description-row label.subtitle {
   padding: 12px 0;
 }
+
+row.hide-arrow image.expander-row-arrow {
+  opacity: 0;
+}


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