[gnome-software: 3/8] flatpak: Make listing featured apps asynchronous
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 3/8] flatpak: Make listing featured apps asynchronous
- Date: Mon, 23 May 2022 15:55:35 +0000 (UTC)
commit ed680cb548a099c8d423225c8047a58693fb7a30
Author: Philip Withnall <pwithnall endlessos org>
Date: Mon May 23 14:09:49 2022 +0100
flatpak: Make listing featured apps asynchronous
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Helps: #1472
plugins/flatpak/gs-plugin-flatpak.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
---
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index 44d654096..501ce8dcb 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -1803,23 +1803,6 @@ gs_plugin_add_alternates (GsPlugin *plugin,
return TRUE;
}
-gboolean
-gs_plugin_add_featured (GsPlugin *plugin,
- GsAppList *list,
- GCancellable *cancellable,
- GError **error)
-{
- GsPluginFlatpak *self = GS_PLUGIN_FLATPAK (plugin);
- gboolean interactive = gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE);
-
- for (guint i = 0; i < self->installations->len; i++) {
- GsFlatpak *flatpak = g_ptr_array_index (self->installations, i);
- if (!gs_flatpak_add_featured (flatpak, list, interactive, cancellable, error))
- return FALSE;
- }
- return TRUE;
-}
-
static void list_apps_thread_cb (GTask *task,
gpointer source_object,
gpointer task_data,
@@ -1859,6 +1842,7 @@ list_apps_thread_cb (GTask *task,
gboolean interactive = (data->flags & GS_PLUGIN_LIST_APPS_FLAGS_INTERACTIVE);
GDateTime *released_since = NULL;
GsAppQueryTristate is_curated = GS_APP_QUERY_TRISTATE_UNSET;
+ GsAppQueryTristate is_featured = GS_APP_QUERY_TRISTATE_UNSET;
GsCategory *category = NULL;
GsAppQueryTristate is_installed = GS_APP_QUERY_TRISTATE_UNSET;
guint64 age_secs = 0;
@@ -1869,6 +1853,7 @@ list_apps_thread_cb (GTask *task,
if (data->query != NULL) {
released_since = gs_app_query_get_released_since (data->query);
is_curated = gs_app_query_get_is_curated (data->query);
+ 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);
}
@@ -1882,9 +1867,11 @@ list_apps_thread_cb (GTask *task,
* Also don’t currently support GS_APP_QUERY_TRISTATE_FALSE. */
if ((released_since == NULL &&
is_curated == GS_APP_QUERY_TRISTATE_UNSET &&
+ is_featured == GS_APP_QUERY_TRISTATE_UNSET &&
category == NULL &&
is_installed == GS_APP_QUERY_TRISTATE_UNSET) ||
is_curated == GS_APP_QUERY_TRISTATE_FALSE ||
+ is_featured == GS_APP_QUERY_TRISTATE_FALSE ||
is_installed == GS_APP_QUERY_TRISTATE_FALSE ||
gs_app_query_get_n_properties_set (data->query) != 1) {
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
@@ -1907,6 +1894,12 @@ list_apps_thread_cb (GTask *task,
return;
}
+ if (is_featured != GS_APP_QUERY_TRISTATE_UNSET &&
+ !gs_flatpak_add_featured (flatpak, list, interactive, cancellable, &local_error)) {
+ g_task_return_error (task, g_steal_pointer (&local_error));
+ return;
+ }
+
if (category != NULL &&
!gs_flatpak_add_category_apps (flatpak, category, list, interactive, cancellable,
&local_error)) {
g_task_return_error (task, g_steal_pointer (&local_error));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]