[gnome-software: 10/16] gs-cmd: Port from GsPluginJobListInstalledApps to GsPluginJobListApps




commit fe41ed19a304a7bbc108bec396156b7968b59865
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon May 9 11:29:29 2022 +0100

    gs-cmd: Port from GsPluginJobListInstalledApps to GsPluginJobListApps
    
    This will allow simplifying the code which implements the plugin jobs.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1472

 lib/gs-cmd.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/lib/gs-cmd.c b/lib/gs-cmd.c
index b15317b4d..be3474471 100644
--- a/lib/gs-cmd.c
+++ b/lib/gs-cmd.c
@@ -419,16 +419,23 @@ main (int argc, char **argv)
        /* do action */
        if (argc == 2 && g_strcmp0 (argv[1], "installed") == 0) {
                for (i = 0; i < repeat; i++) {
+                       g_autoptr(GsAppQuery) query = NULL;
                        g_autoptr(GsPluginJob) plugin_job = NULL;
-                       GsPluginListInstalledAppsFlags installed_flags = 
GS_PLUGIN_LIST_INSTALLED_APPS_FLAGS_NONE;
+                       GsPluginListAppsFlags flags = GS_PLUGIN_LIST_APPS_FLAGS_NONE;
 
                        if (list != NULL)
                                g_object_unref (list);
 
+                       query = gs_app_query_new ("is-installed", GS_APP_QUERY_TRISTATE_TRUE,
+                                                 "refine-flags", self->refine_flags,
+                                                 "max-results", self->max_results,
+                                                 "dedupe-flags", GS_PLUGIN_JOB_DEDUPE_FLAGS_DEFAULT,
+                                                 NULL);
+
                        if (self->interactive)
-                               installed_flags |= GS_PLUGIN_LIST_INSTALLED_APPS_FLAGS_INTERACTIVE;
+                               flags |= GS_PLUGIN_LIST_APPS_FLAGS_INTERACTIVE;
 
-                       plugin_job = gs_plugin_job_list_installed_apps_new (self->refine_flags, 
self->max_results, GS_PLUGIN_JOB_DEDUPE_FLAGS_DEFAULT, installed_flags);
+                       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]