[gnome-software] Fix multiple bugs that caused the menu path not to be shown



commit 4c034a951317a6fe3022b1f3999eb7d2b0994791
Author: Richard Hughes <richard hughsie com>
Date:   Fri Feb 28 17:34:05 2014 +0000

    Fix multiple bugs that caused the menu path not to be shown
    
    Resolves: https://bugzilla.gnome.org/show_bug.cgi?id=725269

 src/gs-app.c                      |   12 +++++++++---
 src/plugins/appstream-cache.c     |    4 +++-
 src/plugins/gs-plugin-appstream.c |    3 ++-
 3 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index f1ffab9..b4915a2 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -318,6 +318,10 @@ gs_app_to_string (GsApp *app)
                g_string_append_printf (str, "\trelated:\t%i\n", priv->related->len);
        if (priv->history->len > 0)
                g_string_append_printf (str, "\thistory:\t%i\n", priv->history->len);
+       for (i = 0; i < priv->categories->len; i++) {
+               tmp = g_ptr_array_index (priv->categories, i);
+               g_string_append_printf (str, "\tcategory:\t%s\n", tmp);
+       }
        keys = g_hash_table_get_keys (priv->metadata);
        for (l = keys; l != NULL; l = l->next) {
                tmp = g_hash_table_lookup (priv->metadata, l->data);
@@ -1685,9 +1689,11 @@ gs_app_subsume (GsApp *app, GsApp *other)
                gs_app_set_update_version_internal (app, priv2->update_version);
        if (priv2->pixbuf != NULL)
                gs_app_set_pixbuf (app, priv2->pixbuf);
-       for (i = 0; i < priv2->categories->len; i++) {
-               tmp = g_ptr_array_index (priv2->categories, i);
-               gs_app_add_category (app, tmp);
+       if (priv->categories != priv2->categories) {
+               for (i = 0; i < priv2->categories->len; i++) {
+                       tmp = g_ptr_array_index (priv2->categories, i);
+                       gs_app_add_category (app, tmp);
+               }
        }
        for (i = 0; i < priv2->related->len; i++) {
                app_tmp = g_ptr_array_index (priv2->related, i);
diff --git a/src/plugins/appstream-cache.c b/src/plugins/appstream-cache.c
index 6a8b9a2..c3a8653 100644
--- a/src/plugins/appstream-cache.c
+++ b/src/plugins/appstream-cache.c
@@ -593,7 +593,6 @@ appstream_cache_end_element_cb (GMarkupParseContext *context,
        section_new = appstream_tag_from_string (element_name);
        switch (section_new) {
        case APPSTREAM_TAG_APPLICATIONS:
-       case APPSTREAM_TAG_APPCATEGORY:
        case APPSTREAM_TAG_KEYWORD:
        case APPSTREAM_TAG_MIMETYPE:
                /* ignore */
@@ -604,6 +603,9 @@ appstream_cache_end_element_cb (GMarkupParseContext *context,
                helper->item_temp = NULL;
                helper->tag = APPSTREAM_TAG_APPLICATIONS;
                break;
+       case APPSTREAM_TAG_APPCATEGORY:
+               helper->tag = APPSTREAM_TAG_APPCATEGORIES;
+               break;
        case APPSTREAM_TAG_IMAGE:
                appstream_screenshot_add_image (helper->screenshot,
                                                helper->image);
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index f06a243..4f37496 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -598,7 +598,8 @@ gs_plugin_refine_item (GsPlugin *plugin,
                gs_plugin_refine_item_pixbuf (plugin, app, item);
 
        /* set categories */
-       if (appstream_app_get_categories (item) != NULL && gs_app_get_categories (app) == NULL)
+       if (appstream_app_get_categories (item) != NULL &&
+           gs_app_get_categories (app)->len == 0)
                gs_app_set_categories (app, appstream_app_get_categories (item));
 
        /* set project group */


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