[gnome-software: 8/15] gs-cmd: Use GsPluginJobListApps rather than ACTION_GET_POPULAR




commit c890dea223cbe3317a36f61737db56a63da1cc4b
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue May 3 16:51:09 2022 +0100

    gs-cmd: Use GsPluginJobListApps rather than ACTION_GET_POPULAR
    
    This is another step towards removing `ACTION_GET_POPULAR` and allowing
    plugins to consolidate their vfuncs which list apps.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 lib/gs-cmd.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/lib/gs-cmd.c b/lib/gs-cmd.c
index 039e2b646..e0b8ff62c 100644
--- a/lib/gs-cmd.c
+++ b/lib/gs-cmd.c
@@ -596,13 +596,22 @@ main (int argc, char **argv)
        } else if (argc == 2 && g_strcmp0 (argv[1], "popular") == 0) {
                for (i = 0; i < repeat; i++) {
                        g_autoptr(GsPluginJob) plugin_job = NULL;
+                       g_autoptr(GsAppQuery) query = NULL;
+                       GsPluginListAppsFlags flags = GS_PLUGIN_LIST_APPS_FLAGS_NONE;
+
                        if (list != NULL)
                                g_object_unref (list);
-                       plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_GET_POPULAR,
-                                                        "refine-flags", self->refine_flags,
-                                                        "max-results", self->max_results,
-                                                        "interactive", self->interactive,
-                                                        NULL);
+
+                       query = gs_app_query_new ("is-curated", GS_APP_QUERY_TRISTATE_TRUE,
+                                                 "refine-flags", self->refine_flags,
+                                                 "max-results", self->max_results,
+                                                 "sort-func", app_sort_kind_cb,
+                                                 NULL);
+
+                       if (self->interactive)
+                               flags |= GS_PLUGIN_LIST_APPS_FLAGS_INTERACTIVE;
+
+                       plugin_job = gs_plugin_job_list_apps_new (query, flags);
                        list = gs_plugin_loader_job_process (self->plugin_loader, plugin_job,
                                                             NULL, &error);
                        if (list == NULL) {


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