[gnome-software/wip/kalev/fonts-missing] appstream: Don't assume the first subcategory is always called "all"



commit fbe0b9a891276b6fd0877047c1e21f2a95847f93
Author: Kalev Lember <klember redhat com>
Date:   Mon May 13 16:49:53 2019 +0200

    appstream: Don't assume the first subcategory is always called "all"
    
    Instead of always leaving out the first subcategory, be a bit more
    careful and do an ID comparison to skip the correct category we want to
    skip.
    
    This fixes Addon::Font to correctly show up again in the category view
    (regression from commit d364825).
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-software/issues/133#note_509825

 plugins/core/gs-appstream.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
index 86e283b6..de54a20d 100644
--- a/plugins/core/gs-appstream.c
+++ b/plugins/core/gs-appstream.c
@@ -1174,9 +1174,11 @@ gs_appstream_add_categories (GsPlugin *plugin,
                GsCategory *parent = GS_CATEGORY (g_ptr_array_index (list, j));
                GPtrArray *children = gs_category_get_children (parent);
 
-               for (guint i = 1; i < children->len; i++) { /* 1 to ignore all */
+               for (guint i = 0; i < children->len; i++) {
                        GsCategory *cat = g_ptr_array_index (children, i);
                        GPtrArray *groups = gs_category_get_desktop_groups (cat);
+                       if (g_strcmp0 (gs_category_get_id (cat), "all") == 0)
+                               continue;
                        for (guint k = 0; k < groups->len; k++) {
                                const gchar *group = g_ptr_array_index (groups, k);
                                guint cnt = gs_appstream_count_component_for_groups (plugin, silo, group);


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