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




commit d0047e22403ec60575a5ab040fbc0f1fa3480dd8
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 501ce8dcb..e255f45fa 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -1846,6 +1846,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);
@@ -1856,6 +1857,7 @@ list_apps_thread_cb (GTask        *task,
                is_featured = gs_app_query_get_is_featured (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) {
@@ -1869,7 +1871,8 @@ list_apps_thread_cb (GTask        *task,
             is_curated == GS_APP_QUERY_TRISTATE_UNSET &&
             is_featured == 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_featured == GS_APP_QUERY_TRISTATE_FALSE ||
            is_installed == GS_APP_QUERY_TRISTATE_FALSE ||
@@ -1911,6 +1914,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]