[gnome-software/1409-add-available-for-fedora-section-to-the-explore-page: 41/44] gs-plugin-appstream: Implement search for deployment-featured apps




commit a497adaf119083a0c158e2db370adeab76850051
Author: Milan Crha <mcrha redhat com>
Date:   Fri May 6 12:02:29 2022 +0200

    gs-plugin-appstream: Implement search for deployment-featured apps

 plugins/core/gs-plugin-appstream.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index 5923dfa1e..3167d91c1 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -1520,6 +1520,7 @@ list_apps_thread_cb (GTask        *task,
        GsAppQueryTristate is_curated = GS_APP_QUERY_TRISTATE_UNSET;
        GsCategory *category = NULL;
        guint64 age_secs = 0;
+       const gchar * const *deployment_featured = NULL;
        g_autoptr(GError) local_error = NULL;
 
        assert_in_worker (self);
@@ -1528,8 +1529,8 @@ list_apps_thread_cb (GTask        *task,
                released_since = gs_app_query_get_released_since (data->query);
                is_curated = gs_app_query_get_is_curated (data->query);
                category = gs_app_query_get_category (data->query);
+               deployment_featured = gs_app_query_get_deployment_featured (data->query);
        }
-
        if (released_since != NULL) {
                g_autoptr(GDateTime) now = g_date_time_new_now_utc ();
                age_secs = g_date_time_difference (now, released_since) / G_TIME_SPAN_SECOND;
@@ -1537,7 +1538,7 @@ list_apps_thread_cb (GTask        *task,
 
        /* Currently only support released-since, is-curated and category queries (but only one at once).
         * Also don’t currently support is-curated==GS_APP_QUERY_TRISTATE_FALSE. */
-       if ((released_since == NULL && is_curated == GS_APP_QUERY_TRISTATE_UNSET && category == NULL) ||
+       if ((released_since == NULL && is_curated == GS_APP_QUERY_TRISTATE_UNSET && category == NULL && 
deployment_featured == NULL) ||
            gs_app_query_get_n_properties_set (data->query) != 1 ||
            is_curated == GS_APP_QUERY_TRISTATE_FALSE) {
                g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
@@ -1572,6 +1573,13 @@ list_apps_thread_cb (GTask        *task,
                return;
        }
 
+       if (deployment_featured != NULL &&
+           !gs_appstream_add_deployment_featured (self->silo, deployment_featured, list,
+                                                  cancellable, &local_error)) {
+               g_task_return_error (task, g_steal_pointer (&local_error));
+               return;
+       }
+
        g_task_return_pointer (task, g_steal_pointer (&list), g_object_unref);
 }
 


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