[gnome-software/1409-add-available-for-fedora-section-to-the-explore-page] gs-appstream: Add gs_appstream_add_distro_featured()
- 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] gs-appstream: Add gs_appstream_add_distro_featured()
- Date: Wed, 8 Sep 2021 14:25:15 +0000 (UTC)
commit 097a2011999575080edfbbb4041243f12bb5c163
Author: Milan Crha <mcrha redhat com>
Date: Wed Sep 8 15:54:09 2021 +0200
gs-appstream: Add gs_appstream_add_distro_featured()
To be used by the implementations of the gs_plugin_add_distro_featured().
lib/gs-appstream.c | 37 ++++++++++++++++++++++++++++---------
lib/gs-appstream.h | 4 ++++
2 files changed, 32 insertions(+), 9 deletions(-)
---
diff --git a/lib/gs-appstream.c b/lib/gs-appstream.c
index 756106078..da66688a9 100644
--- a/lib/gs-appstream.c
+++ b/lib/gs-appstream.c
@@ -1603,20 +1603,18 @@ gs_appstream_add_alternates (XbSilo *silo,
return TRUE;
}
-gboolean
-gs_appstream_add_featured (XbSilo *silo,
- GsAppList *list,
- GCancellable *cancellable,
- GError **error)
+static gboolean
+gs_appstream_add_featured_with_query (XbSilo *silo,
+ const gchar *query,
+ GsAppList *list,
+ GCancellable *cancellable,
+ GError **error)
{
g_autoptr(GError) error_local = NULL;
g_autoptr(GPtrArray) array = NULL;
/* find out how many packages are in each category */
- array = xb_silo_query (silo,
- "components/component/custom/value[@key='GnomeSoftware::FeatureTile']/../..|"
-
"components/component/custom/value[@key='GnomeSoftware::FeatureTile-css']/../..",
- 0, &error_local);
+ array = xb_silo_query (silo, query, 0, &error_local);
if (array == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
@@ -1640,6 +1638,27 @@ gs_appstream_add_featured (XbSilo *silo,
return TRUE;
}
+gboolean
+gs_appstream_add_featured (XbSilo *silo,
+ GsAppList *list,
+ GCancellable *cancellable,
+ GError **error)
+{
+ const gchar *query = "components/component/custom/value[@key='GnomeSoftware::FeatureTile']/../..|"
+ "components/component/custom/value[@key='GnomeSoftware::FeatureTile-css']/../..";
+ return gs_appstream_add_featured_with_query (silo, query, list, cancellable, error);
+}
+
+gboolean
+gs_appstream_add_distro_featured (XbSilo *silo,
+ GsAppList *list,
+ GCancellable *cancellable,
+ GError **error)
+{
+ const gchar *query = "components/component/custom/value[@key='GnomeSoftware::DistroFeatured']/../..";
+ return gs_appstream_add_featured_with_query (silo, query, list, cancellable, error);
+}
+
gboolean
gs_appstream_url_to_app (GsPlugin *plugin,
XbSilo *silo,
diff --git a/lib/gs-appstream.h b/lib/gs-appstream.h
index 5bddf9136..f7086627d 100644
--- a/lib/gs-appstream.h
+++ b/lib/gs-appstream.h
@@ -46,6 +46,10 @@ gboolean gs_appstream_add_featured (XbSilo *silo,
GsAppList *list,
GCancellable *cancellable,
GError **error);
+gboolean gs_appstream_add_distro_featured (XbSilo *silo,
+ GsAppList *list,
+ GCancellable *cancellable,
+ GError **error);
gboolean gs_appstream_add_alternates (XbSilo *silo,
GsApp *app,
GsAppList *list,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]