[gnome-software/1454-allow-searching-for-extensions] gs-appstream: Extend search to provide parent apps for the addon-s
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1454-allow-searching-for-extensions] gs-appstream: Extend search to provide parent apps for the addon-s
- Date: Mon, 27 Sep 2021 15:54:17 +0000 (UTC)
commit de338c9b2b5ecd81b0c7dfdfbd18efa238ca1348
Author: Milan Crha <mcrha redhat com>
Date: Mon Sep 27 17:51:24 2021 +0200
gs-appstream: Extend search to provide parent apps for the addon-s
The addon-s are skipped in the search result, but if they match the user query,
the parent apps can be shown for the users instead, thus they can install
the app and the addon with it.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1454
lib/gs-appstream.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
---
diff --git a/lib/gs-appstream.c b/lib/gs-appstream.c
index b049e7fb8..68b8485bc 100644
--- a/lib/gs-appstream.c
+++ b/lib/gs-appstream.c
@@ -1341,6 +1341,24 @@ gs_appstream_search (GsPlugin *plugin,
g_debug ("add %s", gs_app_get_unique_id (app));
gs_app_set_match_value (app, match_value);
gs_app_list_add (list, app);
+
+ if (gs_app_get_kind (app) == AS_COMPONENT_KIND_ADDON) {
+ g_autoptr(GPtrArray) extends = NULL;
+
+ /* add the parent app as a wildcard, to be refined later */
+ extends = xb_node_query (component, "extends", 0, NULL);
+ for (guint jj = 0; extends && jj < extends->len; jj++) {
+ XbNode *extend = g_ptr_array_index (extends, jj);
+ g_autoptr(GsApp) app2 = NULL;
+ const gchar *tmp;
+ app2 = gs_app_new (xb_node_get_text (extend));
+ gs_app_add_quirk (app2, GS_APP_QUIRK_IS_WILDCARD);
+ tmp = xb_node_query_attr (extend, "../..", "origin", NULL);
+ if (gs_appstream_origin_valid (tmp))
+ gs_app_set_origin_appstream (app2, tmp);
+ gs_app_list_add (list, app2);
+ }
+ }
}
}
g_debug ("search took %fms", g_timer_elapsed (timer, NULL) * 1000);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]