[gnome-software/1364-implement-other-apps-by-author-section-in-app-details-page: 150/156] gs-plugin-appstream: Implement search for other apps




commit bdc4ff637e39f188352e4e1235bdf99321f69ff5
Author: Milan Crha <mcrha redhat com>
Date:   Fri May 6 10:36:04 2022 +0200

    gs-plugin-appstream: Implement search for other apps

 plugins/core/gs-plugin-appstream.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index fa7779bb1..6096cf043 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -1557,18 +1557,21 @@ list_apps_thread_cb (GTask        *task,
        GDateTime *released_since = NULL;
        guint64 age_secs = 0;
        g_autoptr(GError) local_error = NULL;
+       const gchar * const *other_apps = NULL;
 
        assert_in_worker (self);
 
-       if (data->query != NULL)
+       if (data->query != NULL) {
                released_since = gs_app_query_get_released_since (data->query);
+               other_apps = gs_app_query_get_other_apps (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 && other_apps == NULL) {
                g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
                                         "Unsupported query");
                return;
@@ -1582,12 +1585,19 @@ 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 (other_apps != NULL &&
+           !gs_appstream_search_other_apps (GS_PLUGIN (self), self->silo, other_apps, 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]