[gnome-software] Use the new origin search match flag
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Use the new origin search match flag
- Date: Sat, 15 Apr 2017 17:42:17 +0000 (UTC)
commit d886265327cd37394983f0ac60fd9498f10cc082
Author: Richard Hughes <richard hughsie com>
Date: Sat Apr 15 18:40:49 2017 +0100
Use the new origin search match flag
Abusing keywords didn't really work as the origin should be a much lower search
match result, and also the origin is unlocalized and requires splitting.
The new code requires appstream-glib from master to work properly.
plugins/core/gs-plugin-appstream.c | 6 ++++++
plugins/flatpak/gs-flatpak.c | 13 ++++++++++++-
2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index c884e4a..40afaea 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -314,7 +314,13 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
if (*perc < 10 || all_origin_keywords) {
g_debug ("adding keyword '%s' to %s",
tmp, as_app_get_id (app));
+#if AS_CHECK_VERSION(0,6,13)
+ as_app_set_search_match (app,
+ as_store_get_search_match (priv->store) |
+ AS_APP_SEARCH_MATCH_ORIGIN);
+#else
as_app_add_keyword (app, NULL, tmp);
+#endif
}
}
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index aa7c562..ebdd135 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -242,12 +242,23 @@ gs_flatpak_add_apps_from_xremote (GsFlatpak *self,
AS_APP_SEARCH_MATCH_COMMENT |
AS_APP_SEARCH_MATCH_NAME |
AS_APP_SEARCH_MATCH_KEYWORD |
+#if AS_CHECK_VERSION(0,6,13)
+ AS_APP_SEARCH_MATCH_ORIGIN |
+#endif
AS_APP_SEARCH_MATCH_ID);
if (!as_store_from_file (store, file, NULL, cancellable, error)) {
gs_utils_error_convert_appstream (error);
return FALSE;
}
+ /* override the *AppStream* origin */
+ apps = as_store_get_apps (store);
+ for (i = 0; i < apps->len; i++) {
+ AsApp *app = g_ptr_array_index (apps, i);
+ as_app_set_origin (app, flatpak_remote_get_name (xremote));
+ }
+
+#if !AS_CHECK_VERSION(0,6,13)
/* add the origin as a keyword */
for (i = 0; i < apps->len; i++) {
AsApp *app = g_ptr_array_index (apps, i);
@@ -256,6 +267,7 @@ gs_flatpak_add_apps_from_xremote (GsFlatpak *self,
as_app_get_id (app));
as_app_add_keyword (app, NULL, flatpak_remote_get_name (xremote));
}
+#endif
/* ensure the token cache */
as_store_load_search_cache (store);
@@ -274,7 +286,6 @@ gs_flatpak_add_apps_from_xremote (GsFlatpak *self,
default_branch = flatpak_remote_get_default_branch (xremote);
/* get all the apps and fix them up */
- apps = as_store_get_apps (store);
app_filtered = g_ptr_array_new ();
for (i = 0; i < apps->len; i++) {
AsApp *app = g_ptr_array_index (apps, i);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]