[gnome-software] packagekit common: Use plugin cache
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] packagekit common: Use plugin cache
- Date: Tue, 27 Mar 2018 09:43:11 +0000 (UTC)
commit d134bf5710c84fbd6bd31b492d8c467b2c3b79bc
Author: Kalev Lember <klember redhat com>
Date: Tue Mar 27 11:03:04 2018 +0200
packagekit common: Use plugin cache
This avoids getting duplicate results for various package search
functions that don't set up unique id (we normally use unique id for
duplicate filtering).
plugins/packagekit/packagekit-common.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/plugins/packagekit/packagekit-common.c b/plugins/packagekit/packagekit-common.c
index f20497af..bc9f9366 100644
--- a/plugins/packagekit/packagekit-common.c
+++ b/plugins/packagekit/packagekit-common.c
@@ -253,9 +253,13 @@ gs_plugin_packagekit_add_results (GsPlugin *plugin,
g_autoptr(GsApp) app = NULL;
package = g_ptr_array_index (array_filtered, i);
- app = gs_app_new (NULL);
- gs_app_add_source (app, pk_package_get_name (package));
- gs_app_add_source_id (app, pk_package_get_id (package));
+ app = gs_plugin_cache_lookup (plugin, pk_package_get_id (package));
+ if (app == NULL) {
+ app = gs_app_new (NULL);
+ gs_app_add_source (app, pk_package_get_name (package));
+ gs_app_add_source_id (app, pk_package_get_id (package));
+ gs_plugin_cache_add (plugin, pk_package_get_id (package), app);
+ }
gs_app_set_name (app,
GS_APP_QUALITY_LOWEST,
pk_package_get_name (package));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]