[gnome-software] flatpak: Ensure apps can be found using the 'flatpak' keyword



commit 051402e49a8846c6d4b03344a97673ee55e7591a
Author: Richard Hughes <richard hughsie com>
Date:   Tue May 23 11:45:24 2017 +0100

    flatpak: Ensure apps can be found using the 'flatpak' keyword

 plugins/flatpak/gs-flatpak.c   |    7 ++++---
 plugins/flatpak/gs-self-test.c |   12 ++++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 688e386..383f483 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -257,9 +257,6 @@ gs_flatpak_add_apps_from_xremote (GsFlatpak *self,
                as_app_set_origin (app, flatpak_remote_get_name (xremote));
        }
 
-       /* ensure the token cache */
-       as_store_load_search_cache (store);
-
        /* only add the specific app for noenumerate=true */
        if (flatpak_remote_get_noenumerate (xremote)) {
                g_autofree gchar *tmp = NULL;
@@ -306,6 +303,10 @@ gs_flatpak_add_apps_from_xremote (GsFlatpak *self,
 
        /* add them to the main store */
        as_store_add_apps (self->store, app_filtered);
+
+       /* ensure the token cache for all apps */
+       as_store_load_search_cache (store);
+
        return TRUE;
 }
 
diff --git a/plugins/flatpak/gs-self-test.c b/plugins/flatpak/gs-self-test.c
index 8746fe2..e9d65d8 100644
--- a/plugins/flatpak/gs-self-test.c
+++ b/plugins/flatpak/gs-self-test.c
@@ -165,6 +165,7 @@ gs_plugins_flatpak_app_with_runtime_func (GsPluginLoader *plugin_loader)
        g_autoptr(GKeyFile) kf1 = g_key_file_new ();
        g_autoptr(GKeyFile) kf2 = g_key_file_new ();
        g_autoptr(GsApp) app_source = NULL;
+       g_autoptr(GsAppList) list_all = NULL;
        g_autoptr(GsAppList) list = NULL;
        g_autoptr(GsAppList) sources = NULL;
        g_autoptr(GsPluginJob) plugin_job = NULL;
@@ -246,6 +247,17 @@ gs_plugins_flatpak_app_with_runtime_func (GsPluginLoader *plugin_loader)
        g_assert_no_error (error);
        g_assert (ret);
 
+       /* all the apps should have the flatpak keyword */
+       g_object_unref (plugin_job);
+       plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_SEARCH,
+                                        "search", "flatpak",
+                                        "refine-flags", GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+                                        NULL);
+       list_all = gs_plugin_loader_job_process (plugin_loader, plugin_job, NULL, &error);
+       g_assert_no_error (error);
+       g_assert (list_all != NULL);
+       g_assert_cmpint (gs_app_list_length (list_all), ==, 2);
+
        /* find available application */
        g_object_unref (plugin_job);
        plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_SEARCH,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]