[gnome-software: 6/11] gs-cmd: Port ACTION_GET_ALTERNATES to use GsPluginJobListApps




commit e0f621c001c837cde50a44e77e5d9cb83b478b90
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Jul 6 15:23:35 2022 +0100

    gs-cmd: Port ACTION_GET_ALTERNATES to use GsPluginJobListApps
    
    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 f0e8c580d..9fb6203ae 100644
--- a/lib/gs-cmd.c
+++ b/lib/gs-cmd.c
@@ -474,15 +474,24 @@ main (int argc, char **argv)
                app = gs_app_new (argv[2]);
                gs_app_add_quirk (app, GS_APP_QUIRK_IS_WILDCARD);
                for (i = 0; i < repeat; i++) {
+                       g_autoptr(GsAppQuery) query = NULL;
                        g_autoptr(GsPluginJob) plugin_job = 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_ALTERNATES,
-                                                        "app", app,
-                                                        "refine-flags", self->refine_flags,
-                                                        "max-results", self->max_results,
-                                                        "interactive", self->interactive,
-                                                        NULL);
+
+                       query = gs_app_query_new ("alternate-of", app,
+                                                 "refine-flags", self->refine_flags,
+                                                 "max-results", self->max_results,
+                                                 "dedupe-flags", GS_PLUGIN_JOB_DEDUPE_FLAGS_DEFAULT,
+                                                 "sort-func", gs_utils_app_sort_priority,
+                                                 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]