[gnome-software: 1/2] gs-app-context-bar: Don’t duplicate a line in the safety context tile




commit f80497faf0b4976e534fdef107a4a033bf987b37
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Sep 7 16:25:07 2021 +0100

    gs-app-context-bar: Don’t duplicate a line in the safety context tile
    
    If an app had both `GS_APP_PERMISSIONS_HOME_FULL` and
    `GS_APP_PERMISSIONS_FILESYSTEM_FULL` set (or the same with the `READ`
    permissions), the relevant string would be shown twice.
    
    Change the code so it’s only shown at most once.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Fixes: #1438

 src/gs-app-context-bar.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/gs-app-context-bar.c b/src/gs-app-context-bar.c
index d1f34efd8..620b2ed0c 100644
--- a/src/gs-app-context-bar.c
+++ b/src/gs-app-context-bar.c
@@ -290,6 +290,10 @@ update_safety_tile (GsAppContextBar *self)
                        break;
                case GS_APP_PERMISSIONS_HOME_FULL:
                case GS_APP_PERMISSIONS_FILESYSTEM_FULL:
+                       /* Don’t add twice. */
+                       if (i == GS_APP_PERMISSIONS_HOME_FULL && (permissions & 
GS_APP_PERMISSIONS_FILESYSTEM_FULL))
+                               break;
+
                        add_to_safety_rating (&chosen_rating, descriptions,
                                              SAFETY_UNSAFE,
                                              /* Translators: This indicates an app can read/write to the 
user’s home or the entire filesystem.
@@ -298,6 +302,10 @@ update_safety_tile (GsAppContextBar *self)
                        break;
                case GS_APP_PERMISSIONS_HOME_READ:
                case GS_APP_PERMISSIONS_FILESYSTEM_READ:
+                       /* Don’t add twice. */
+                       if (i == GS_APP_PERMISSIONS_HOME_READ && (permissions & 
GS_APP_PERMISSIONS_FILESYSTEM_READ))
+                               break;
+
                        add_to_safety_rating (&chosen_rating, descriptions,
                                              SAFETY_UNSAFE,
                                              /* Translators: This indicates an app can read (but not write) 
from the user’s home or the entire filesystem.


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