[gnome-software] trivial: Use the child category when using gs_plugin_loader_get_category_apps()



commit 74f5a366895dd998672832613421509677e8a167
Author: Richard Hughes <richard hughsie com>
Date:   Thu Jun 2 11:39:36 2016 +0100

    trivial: Use the child category when using gs_plugin_loader_get_category_apps()
    
    This looks at the category and the parent, not the parent and sole child.

 src/gs-cmd.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index 8c5d1a1..60244a8 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -433,13 +433,15 @@ main (int argc, char **argv)
                }
        } else if (argc == 3 && g_strcmp0 (argv[1], "get-category-apps") == 0) {
                g_autoptr(GsCategory) category = NULL;
+               g_autoptr(GsCategory) parent = NULL;
                g_auto(GStrv) split = NULL;
                split = g_strsplit (argv[2], "/", 2);
-               category = gs_category_new (split[0]);
-               if (g_strv_length (split) == 2) {
-                       g_autoptr(GsCategory) child = NULL;
-                       child = gs_category_new (split[1]);
-                       gs_category_add_child (category, child);
+               if (g_strv_length (split) == 1) {
+                       category = gs_category_new (split[0]);
+               } else {
+                       parent = gs_category_new (split[0]);
+                       category = gs_category_new (split[1]);
+                       gs_category_add_child (parent, category);
                }
                for (i = 0; i < repeat; i++) {
                        if (list != NULL)


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