[gnome-software: 11/14] gs-cmd: Use GsPluginJobListApps rather than ACTION_GET_CATEGORY_APPS




commit 0c7ddae8063bf3804bfbf02805e269d26e803e50
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed May 4 14:55:31 2022 +0100

    gs-cmd: Use GsPluginJobListApps rather than ACTION_GET_CATEGORY_APPS
    
    This is another step towards removing `ACTION_GET_CATEGORY_APPS` 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, 14 insertions(+), 7 deletions(-)
---
diff --git a/lib/gs-cmd.c b/lib/gs-cmd.c
index 4fe87b924..b15317b4d 100644
--- a/lib/gs-cmd.c
+++ b/lib/gs-cmd.c
@@ -718,15 +718,22 @@ main (int argc, char **argv)
 
                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_CATEGORY_APPS,
-                                                        "category", category,
-                                                        "refine-flags", self->refine_flags,
-                                                        "max-results", self->max_results,
-                                                        "interactive", self->interactive,
-                                                        NULL);
-                       gs_plugin_job_set_sort_func (plugin_job, app_sort_name_cb, NULL);
+
+                       query = gs_app_query_new ("category", category,
+                                                 "refine-flags", self->refine_flags,
+                                                 "max-results", self->max_results,
+                                                 "sort-func", app_sort_name_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) {
                                ret = FALSE;


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