[gnome-software/1409-add-available-for-fedora-section-to-the-explore-page: 1238/1241] gs-plugin-appstream: Implement search for deployment-featured apps
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1409-add-available-for-fedora-section-to-the-explore-page: 1238/1241] gs-plugin-appstream: Implement search for deployment-featured apps
- Date: Fri, 6 May 2022 11:39:57 +0000 (UTC)
commit 85f0083bd2139346ea94a063608696c2efd47a78
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 | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index fa7779bb1..240e75059 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -1556,19 +1556,22 @@ list_apps_thread_cb (GTask *task,
GsPluginListAppsData *data = task_data;
GDateTime *released_since = NULL;
guint64 age_secs = 0;
+ const gchar * const *deployment_featured = NULL;
g_autoptr(GError) local_error = NULL;
assert_in_worker (self);
- if (data->query != NULL)
+ if (data->query != NULL) {
released_since = gs_app_query_get_released_since (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;
}
/* Currently only support released-since queries. */
- if (released_since == NULL) {
+ if (released_since == NULL && deployment_featured == NULL) {
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
"Unsupported query");
return;
@@ -1582,12 +1585,20 @@ list_apps_thread_cb (GTask *task,
locker = g_rw_lock_reader_locker_new (&self->silo_lock);
- if (!gs_appstream_add_recent (GS_PLUGIN (self), self->silo, list, age_secs,
+ if (released_since != NULL &&
+ !gs_appstream_add_recent (GS_PLUGIN (self), self->silo, list, age_secs,
cancellable, &local_error)) {
g_task_return_error (task, g_steal_pointer (&local_error));
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]