[gnome-software: 5/20] flatpak: Port gs_plugin_add_search() vfunc to GsPluginJobListApps




commit 8982649cdb221705c6623cfd6842520f8d8eadb3
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Jul 1 16:35:57 2022 +0100

    flatpak: Port gs_plugin_add_search() vfunc to GsPluginJobListApps
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1472

 plugins/flatpak/gs-plugin-flatpak.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index ec20eaeb8..367002f2e 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -1770,16 +1770,6 @@ gs_plugin_flatpak_do_search (GsPlugin *plugin,
        return TRUE;
 }
 
-gboolean
-gs_plugin_add_search (GsPlugin *plugin,
-                     gchar **values,
-                     GsAppList *list,
-                     GCancellable *cancellable,
-                     GError **error)
-{
-       return gs_plugin_flatpak_do_search (plugin, values, list, cancellable, error);
-}
-
 gboolean
 gs_plugin_add_search_what_provides (GsPlugin *plugin,
                                    gchar **search,
@@ -1870,6 +1860,7 @@ list_apps_thread_cb (GTask        *task,
        guint64 age_secs = 0;
        const gchar * const *deployment_featured = NULL;
        const gchar *const *developers = NULL;
+       const gchar * const *keywords = NULL;
        g_autoptr(GError) local_error = NULL;
 
        assert_in_worker (self);
@@ -1882,6 +1873,7 @@ list_apps_thread_cb (GTask        *task,
                is_installed = gs_app_query_get_is_installed (data->query);
                deployment_featured = gs_app_query_get_deployment_featured (data->query);
                developers = gs_app_query_get_developers (data->query);
+               keywords = gs_app_query_get_keywords (data->query);
        }
 
        if (released_since != NULL) {
@@ -1897,7 +1889,8 @@ list_apps_thread_cb (GTask        *task,
             category == NULL &&
             is_installed == GS_APP_QUERY_TRISTATE_UNSET &&
             deployment_featured == NULL &&
-            developers == NULL) ||
+            developers == NULL &&
+            keywords == NULL) ||
            is_curated == GS_APP_QUERY_TRISTATE_FALSE ||
            is_featured == GS_APP_QUERY_TRISTATE_FALSE ||
            is_installed == GS_APP_QUERY_TRISTATE_FALSE ||
@@ -1951,6 +1944,12 @@ list_apps_thread_cb (GTask        *task,
                        g_task_return_error (task, g_steal_pointer (&local_error));
                        return;
                }
+
+               if (keywords != NULL &&
+                   !gs_flatpak_search (flatpak, keywords, list, interactive, cancellable, &local_error)) {
+                       g_task_return_error (task, g_steal_pointer (&local_error));
+                       return;
+               }
        }
 
        g_task_return_pointer (task, g_steal_pointer (&list), g_object_unref);


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