[gnome-software: 5/11] gs-cmd: Port ACTION_GET_CATEGORIES to use GsPluginJobListCategories
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 5/11] gs-cmd: Port ACTION_GET_CATEGORIES to use GsPluginJobListCategories
- Date: Mon, 18 Jul 2022 09:57:06 +0000 (UTC)
commit 4e0b9eefd8ddee462c59ee43cb4530fd8f775d92
Author: Philip Withnall <pwithnall endlessos org>
Date: Thu Jul 14 17:13:45 2022 +0100
gs-cmd: Port ACTION_GET_CATEGORIES to use GsPluginJobListCategories
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Helps: #1472
lib/gs-cmd.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/lib/gs-cmd.c b/lib/gs-cmd.c
index 9fb6203ae..7070bf032 100644
--- a/lib/gs-cmd.c
+++ b/lib/gs-cmd.c
@@ -742,20 +742,21 @@ main (int argc, char **argv)
} else if (argc == 2 && g_strcmp0 (argv[1], "get-categories") == 0) {
for (i = 0; i < repeat; i++) {
g_autoptr(GsPluginJob) plugin_job = NULL;
+ GsPluginRefineCategoriesFlags flags = GS_PLUGIN_REFINE_CATEGORIES_FLAGS_NONE;
+
if (categories != NULL)
g_ptr_array_unref (categories);
- plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_GET_CATEGORIES,
- "refine-flags", self->refine_flags,
- "max-results", self->max_results,
- "interactive", self->interactive,
- NULL);
- categories = gs_plugin_loader_job_get_categories (self->plugin_loader,
- plugin_job,
- NULL, &error);
- if (categories == NULL) {
+
+ if (self->interactive)
+ flags |= GS_PLUGIN_REFINE_CATEGORIES_FLAGS_INTERACTIVE;
+
+ plugin_job = gs_plugin_job_list_categories_new (flags);
+ if (!gs_plugin_loader_job_action (self->plugin_loader, plugin_job, NULL, &error)) {
ret = FALSE;
break;
}
+
+ categories = g_ptr_array_ref (gs_plugin_job_list_categories_get_result_list
(GS_PLUGIN_JOB_LIST_CATEGORIES (plugin_job)));
}
} else if (argc == 3 && g_strcmp0 (argv[1], "get-category-apps") == 0) {
g_autoptr(GsCategory) category_owned = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]