[gnome-software: 2/4] gs-details-page: Coalesce certain age ratings groups to clarify popover




commit 38ea2767bdfd12dbac36f7ca37e7a7f93ab74fcf
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu Oct 29 13:08:04 2020 +0000

    gs-details-page: Coalesce certain age ratings groups to clarify popover
    
    There’s no point distinguishing between ‘app was rated as age X because
    of sex-themes’ and ‘app was rated as age X because of sex-homosexuality’
    when the two are identical in most jurisdictions. (Indeed,
    discriminating by sexual orientation is illegal in many jurisdictions.)
    
    Quite apart from legality, listing the two separately was confusing.
    
    Instead, just mention `sex-themes` in the popover message, unless in a
    jurisdiction where the rating for the two is different.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 src/gs-details-page.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 736c978f..babd554b 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -2378,6 +2378,11 @@ gs_details_page_content_rating_button_cb (GtkWidget *widget, GsDetailsPage *self
                "social-info",
                NULL
        };
+       const gchar *coalesce_groups[] = {
+               "sex-themes",
+               "sex-homosexuality",
+               NULL
+       };
 
        cr = gs_app_get_content_rating (self->app);
        if (cr == NULL)
@@ -2411,7 +2416,8 @@ gs_details_page_content_rating_button_cb (GtkWidget *widget, GsDetailsPage *self
        }
 
        /* get the content rating description for the worst things about the app;
-        * handle the groups separately*/
+        * handle the groups separately. intentionally coalesce some categories
+        * if they have the same values, to avoid confusion */
        for (gsize i = 0; ids[i] != NULL; i++) {
                if (!g_strv_contains (violence_group, ids[i]) &&
                    !g_strv_contains (social_group, ids[i])) {
@@ -2419,6 +2425,14 @@ gs_details_page_content_rating_button_cb (GtkWidget *widget, GsDetailsPage *self
                        value = as_content_rating_get_value (cr, ids[i]);
                        if (value < value_bad)
                                continue;
+
+                       /* coalesce down to the first element in @coalesce_groups,
+                        * unless this group’s value differs. currently only one
+                        * coalesce group is supported */
+                       if (g_strv_contains (coalesce_groups + 1, ids[i]) &&
+                           as_content_rating_get_value (cr, coalesce_groups[0]) == value)
+                               continue;
+
                        tmp = gs_content_rating_key_value_to_str (ids[i], value);
                        g_string_append_printf (str, "• %s\n", tmp);
                }


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