[gnome-software: 12/24] gs-plugin-job-list-apps: Support caller-specified filtering




commit 5f3f2016d6387a71d11cf0251399da8c0f6e3d88
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Apr 13 23:46:06 2022 +0100

    gs-plugin-job-list-apps: Support caller-specified filtering
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1472

 lib/gs-plugin-job-list-apps.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/lib/gs-plugin-job-list-apps.c b/lib/gs-plugin-job-list-apps.c
index d9276e938..811c7c08f 100644
--- a/lib/gs-plugin-job-list-apps.c
+++ b/lib/gs-plugin-job-list-apps.c
@@ -337,6 +337,8 @@ finish_task (GTask     *task,
        GsAppListFilterFlags dedupe_flags = GS_APP_LIST_FILTER_FLAG_NONE;
        GsAppListSortFunc sort_func = NULL;
        gpointer sort_func_data = NULL;
+       GsAppListFilterFunc filter_func = NULL;
+       gpointer filter_func_data = NULL;
        guint max_results = 0;
        g_autofree gchar *job_debug = NULL;
 
@@ -345,6 +347,13 @@ finish_task (GTask     *task,
         * FIXME: It feels like this filter should be done in a different layer. */
        gs_app_list_filter (merged_list, app_filter_qt_for_gtk_and_compatible, plugin_loader);
 
+       /* Caller-specified filtering. */
+       if (self->query != NULL)
+               filter_func = gs_app_query_get_filter_func (self->query, &filter_func_data);
+
+       if (filter_func != NULL)
+               gs_app_list_filter (merged_list, filter_func, filter_func_data);
+
        /* Filter duplicates with priority, taking into account the source name
         * & version, so we combine available updates with the installed app */
        if (self->query != NULL)


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