[gnome-software/wip/hughsie/unique_id: 8/10] Add a bundle type keyword to non-package components



commit 51634a2ccec7ce70be7922926ea618515ef56af3
Author: Richard Hughes <richard hughsie com>
Date:   Wed Aug 3 15:15:07 2016 +0100

    Add a bundle type keyword to non-package components
    
    This allows you to search for 'flatpak' or 'snap'.

 src/plugins/gs-plugin-appstream.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 9ea9691..09dac5e 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -274,6 +274,21 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
                }
        }
 
+       /* add keyword for non-package sources */
+       for (i = 0; i < items->len; i++) {
+               g_auto(GStrv) split = NULL;
+               app = g_ptr_array_index (items, i);
+               split = g_strsplit (as_app_get_unique_id (app), "/", -1);
+               if (g_strv_length (split) != 8)
+                       continue;
+               if (g_strcmp0 (split[1], "package") == 0)
+                       continue;
+               if (g_strcmp0 (split[1], "*") == 0)
+                       continue;
+               g_debug ("Adding keyword '%s' to %s", split[1], as_app_get_id (app));
+               as_app_add_keyword (app, NULL, split[1]);
+       }
+
        /* fix up these */
        for (i = 0; i < items->len; i++) {
                app = g_ptr_array_index (items, i);


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