[gnome-software] Add keywords to match web apps and input methods
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add keywords to match web apps and input methods
- Date: Thu, 29 Sep 2016 07:00:52 +0000 (UTC)
commit 0f5bb99702cf06ab9524b20b33f43833b386d086
Author: Richard Hughes <richard hughsie com>
Date: Thu Sep 29 08:00:38 2016 +0100
Add keywords to match web apps and input methods
src/plugins/gs-plugin-appstream.c | 30 +++++++++++++++++++++++-------
1 files changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 1e620b6..2711ad2 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -213,7 +213,7 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
AsApp *app;
GPtrArray *items;
gboolean ret;
- const gchar *origin;
+ const gchar *tmp;
const gchar *test_xml;
const gchar *test_icon_root;
guint *perc;
@@ -271,14 +271,30 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
origins = gs_plugin_appstream_get_origins_hash (items);
for (i = 0; i < items->len; i++) {
app = g_ptr_array_index (items, i);
- origin = as_app_get_origin (app);
- if (origin == NULL || origin[0] == '\0')
+ tmp = as_app_get_origin (app);
+ if (tmp == NULL || tmp[0] == '\0')
continue;
- perc = g_hash_table_lookup (origins, origin);
+ perc = g_hash_table_lookup (origins, tmp);
if (*perc < 10) {
- g_debug ("Adding keyword '%s' to %s",
- origin, as_app_get_id (app));
- as_app_add_keyword (app, NULL, origin);
+ g_debug ("adding keyword '%s' to %s",
+ tmp, as_app_get_id (app));
+ as_app_add_keyword (app, NULL, tmp);
+ }
+ }
+
+ /* add more search terms */
+ for (i = 0; i < items->len; i++) {
+ app = g_ptr_array_index (items, i);
+ switch (as_app_get_kind (app)) {
+ case AS_APP_KIND_WEB_APP:
+ case AS_APP_KIND_INPUT_METHOD:
+ tmp = as_app_kind_to_string (as_app_get_kind (app));
+ g_debug ("adding keyword '%s' to %s",
+ tmp, as_app_get_unique_id (app));
+ as_app_add_keyword (app, NULL, tmp);
+ break;
+ default:
+ break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]