[gnome-software/gnome-3-24] Only return valid results from url_to_app()
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-24] Only return valid results from url_to_app()
- Date: Mon, 10 Apr 2017 13:56:07 +0000 (UTC)
commit 3f8bb8039a75cc0eb5a2979f5c06eaaa5d5e1585
Author: Richard Hughes <richard hughsie com>
Date: Tue Apr 4 10:54:22 2017 +0100
Only return valid results from url_to_app()
The auto-adding icon code was erroneously copied and pasted from the
file_to_app() function (where we do need the icon auto-add code, and the
relaxation of validity) and it was causing blank 'apps' to show up for
requests like apt://powertop.
lib/gs-plugin-loader.c | 24 +-----------------------
plugins/dummy/gs-plugin-dummy.c | 3 +++
2 files changed, 4 insertions(+), 23 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 319fbe6..ee222fe 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -4525,32 +4525,10 @@ gs_plugin_loader_url_to_app_thread_cb (GTask *task,
}
/* filter package list */
+ gs_app_list_filter (job->list, gs_plugin_loader_app_is_valid, job);
gs_app_list_filter (job->list, gs_plugin_loader_app_set_prio, plugin_loader);
gs_app_list_filter_duplicates (job->list, GS_APP_LIST_FILTER_FLAG_PRIORITY);
- /* check the apps have an icon set */
- for (guint j = 0; j < gs_app_list_length (job->list); j++) {
- GsApp *app = gs_app_list_index (job->list, j);
- if (_gs_app_get_icon_by_kind (app, AS_ICON_KIND_STOCK) == NULL &&
- _gs_app_get_icon_by_kind (app, AS_ICON_KIND_LOCAL) == NULL &&
- _gs_app_get_icon_by_kind (app, AS_ICON_KIND_CACHED) == NULL) {
- g_autoptr(AsIcon) ic = as_icon_new ();
- as_icon_set_kind (ic, AS_ICON_KIND_STOCK);
- if (gs_app_get_kind (app) == AS_APP_KIND_SOURCE)
- as_icon_set_name (ic, "x-package-repository");
- else
- as_icon_set_name (ic, "application-x-executable");
- gs_app_add_icon (app, ic);
- }
- }
-
- /* run refine() on each one again to pick up any icons */
- job->refine_flags = GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON;
- if (!gs_plugin_loader_run_refine (job, job->list, cancellable, &error)) {
- g_task_return_error (task, error);
- return;
- }
-
/* success */
if (gs_app_list_length (job->list) != 1) {
g_task_return_new_error (task,
diff --git a/plugins/dummy/gs-plugin-dummy.c b/plugins/dummy/gs-plugin-dummy.c
index 73f5929..e26dd0b 100644
--- a/plugins/dummy/gs-plugin-dummy.c
+++ b/plugins/dummy/gs-plugin-dummy.c
@@ -92,6 +92,9 @@ gs_plugin_initialize (GsPlugin *plugin)
priv->installed_apps = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
priv->available_apps = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
g_hash_table_insert (priv->available_apps,
+ g_strdup ("chiron.desktop"),
+ GUINT_TO_POINTER (1));
+ g_hash_table_insert (priv->available_apps,
g_strdup ("zeus.desktop"),
GUINT_TO_POINTER (1));
g_hash_table_insert (priv->available_apps,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]