[gnome-software] menu spec plugin: Fall back to showing the top level category



commit 69ac2a3c9f1480c896b0fea54fe1bf833fbbe990
Author: Kalev Lember <kalevlember gmail com>
Date:   Sun Mar 15 17:09:49 2015 +0100

    menu spec plugin: Fall back to showing the top level category
    
    Try harder to find something to show as an app category. If we've failed
    to find a matching sub-level category, return the top level instead.
    
    This ensures that apps such as gnome-boxes that have only "System" as
    their category don't show up as "Category: None" in the details page.

 src/plugins/gs-plugin-menu-spec-refine.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/gs-plugin-menu-spec-refine.c b/src/plugins/gs-plugin-menu-spec-refine.c
index d7c6521..02d477b 100644
--- a/src/plugins/gs-plugin-menu-spec-refine.c
+++ b/src/plugins/gs-plugin-menu-spec-refine.c
@@ -52,7 +52,7 @@ gs_plugin_get_deps (GsPlugin *plugin)
 /**
  * gs_plugin_refine_app_category:
  */
-static gboolean
+static void
 gs_plugin_refine_app_category (GsPlugin *plugin,
                               GsApp *app,
                               const MenuSpecData *cat)
@@ -80,7 +80,10 @@ gs_plugin_refine_app_category (GsPlugin *plugin,
                        break;
                }
        }
-       return ret;
+
+       /* if we've failed to find a matching sub-level category, just show the top-level */
+       if (!ret)
+               gs_app_set_menu_path (app, gettext (cat->text));
 }
 
 /**
@@ -102,8 +105,8 @@ gs_plugin_refine_app (GsPlugin *plugin, GsApp *app)
                        continue;
                ret = gs_app_has_category (app, msdata[i].path);
                if (ret) {
-                       ret = gs_plugin_refine_app_category (plugin, app,
-                                                            &msdata[i]);
+                       gs_plugin_refine_app_category (plugin, app,
+                                                      &msdata[i]);
                        break;
                }
        }


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