[gnome-software: 4/8] gs-cmd: Use GsPluginJobListApps rather than ACTION_GET_FEATURED




commit bbc1a272fa231ff1d1323e022d03488c8db62603
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon May 23 14:32:00 2022 +0100

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

 lib/gs-cmd.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/lib/gs-cmd.c b/lib/gs-cmd.c
index be3474471..298e82ccd 100644
--- a/lib/gs-cmd.c
+++ b/lib/gs-cmd.c
@@ -637,15 +637,24 @@ main (int argc, char **argv)
        } else if (argc == 2 && g_strcmp0 (argv[1], "featured") == 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_FEATURED,
-                                                        "refine-flags", self->refine_flags,
-                                                        "max-results", self->max_results,
-                                                        "interactive", self->interactive,
-                                                        NULL);
+
+                       query = gs_app_query_new ("is-featured", GS_APP_QUERY_TRISTATE_TRUE,
+                                                 "refine-flags", self->refine_flags,
+                                                 "max-results", self->max_results,
+                                                 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);
+                                                            NULL, &error);
+
                        if (list == NULL) {
                                ret = FALSE;
                                break;


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