[gnome-software/1409-add-available-for-fedora-section-to-the-explore-page: 113/115] flatpak: Implement search for deployment-featured apps




commit 2ab10b97ee8ad365454b2c147b2424329d9da8a2
Author: Milan Crha <mcrha redhat com>
Date:   Fri May 6 12:08:52 2022 +0200

    flatpak: Implement search for deployment-featured apps

 plugins/flatpak/gs-flatpak.c        | 17 +++++++++++++++++
 plugins/flatpak/gs-flatpak.h        |  7 +++++++
 plugins/flatpak/gs-plugin-flatpak.c | 11 ++++++++++-
 3 files changed, 34 insertions(+), 1 deletion(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 715a3f92e..ca30ad535 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -4090,6 +4090,23 @@ gs_flatpak_add_featured (GsFlatpak *self,
        return TRUE;
 }
 
+gboolean
+gs_flatpak_add_deployment_featured (GsFlatpak *self,
+                                   GsAppList *list,
+                                   gboolean interactive,
+                                   const gchar *const *deployments,
+                                   GCancellable *cancellable,
+                                   GError **error)
+{
+       g_autoptr(GRWLockReaderLocker) locker = NULL;
+
+       if (!gs_flatpak_rescan_app_data (self, interactive, cancellable, error))
+               return FALSE;
+
+       locker = g_rw_lock_reader_locker_new (&self->silo_lock);
+       return gs_appstream_add_deployment_featured (self->silo, deployments, list, cancellable, error);
+}
+
 gboolean
 gs_flatpak_add_alternates (GsFlatpak *self,
                           GsApp *app,
diff --git a/plugins/flatpak/gs-flatpak.h b/plugins/flatpak/gs-flatpak.h
index 3c4724897..a704e3b40 100644
--- a/plugins/flatpak/gs-flatpak.h
+++ b/plugins/flatpak/gs-flatpak.h
@@ -146,6 +146,13 @@ gboolean   gs_flatpak_add_featured         (GsFlatpak              *self,
                                                 gboolean                interactive,
                                                 GCancellable           *cancellable,
                                                 GError                 **error);
+gboolean       gs_flatpak_add_deployment_featured
+                                               (GsFlatpak              *self,
+                                                GsAppList              *list,
+                                                gboolean                interactive,
+                                                const gchar *const     *deployments,
+                                                GCancellable           *cancellable,
+                                                GError                 **error);
 gboolean       gs_flatpak_add_alternates       (GsFlatpak              *self,
                                                 GsApp                  *app,
                                                 GsAppList              *list,
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index 44d654096..bc6ea2676 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -1862,6 +1862,7 @@ list_apps_thread_cb (GTask        *task,
        GsCategory *category = NULL;
        GsAppQueryTristate is_installed = GS_APP_QUERY_TRISTATE_UNSET;
        guint64 age_secs = 0;
+       const gchar * const *deployment_featured = NULL;
        g_autoptr(GError) local_error = NULL;
 
        assert_in_worker (self);
@@ -1871,6 +1872,7 @@ list_apps_thread_cb (GTask        *task,
                is_curated = gs_app_query_get_is_curated (data->query);
                category = gs_app_query_get_category (data->query);
                is_installed = gs_app_query_get_is_installed (data->query);
+               deployment_featured = gs_app_query_get_deployment_featured (data->query);
        }
 
        if (released_since != NULL) {
@@ -1883,7 +1885,8 @@ list_apps_thread_cb (GTask        *task,
        if ((released_since == NULL &&
             is_curated == GS_APP_QUERY_TRISTATE_UNSET &&
             category == NULL &&
-            is_installed == GS_APP_QUERY_TRISTATE_UNSET) ||
+            is_installed == GS_APP_QUERY_TRISTATE_UNSET &&
+            deployment_featured == NULL) ||
            is_curated == GS_APP_QUERY_TRISTATE_FALSE ||
            is_installed == GS_APP_QUERY_TRISTATE_FALSE ||
            gs_app_query_get_n_properties_set (data->query) != 1) {
@@ -1918,6 +1921,12 @@ list_apps_thread_cb (GTask        *task,
                        g_task_return_error (task, g_steal_pointer (&local_error));
                        return;
                }
+
+               if (deployment_featured != NULL &&
+                   !gs_flatpak_add_deployment_featured (flatpak, list, interactive, deployment_featured, 
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]