Commit 6bb3a858 authored by Robert Ancell's avatar Robert Ancell

Use *-featured sections to populate featured category snaps

parent 21c51f9f
Pipeline #38098 passed with stage
in 10 minutes and 44 seconds
......@@ -141,6 +141,10 @@ gs_plugin_add_categories (GsPlugin *plugin,
if (g_strcmp0 (section, "featured") == 0)
continue;
// skip the featured subsections
if (g_str_has_suffix (section, "-featured"))
continue;
// hard-coded metadata for each section
category = gs_category_new (section);
if (g_strcmp0 (section, "games") == 0) {
......@@ -636,17 +640,25 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
GError **error)
{
g_autoptr(GPtrArray) snaps = NULL;
const gchar *id;
const gchar *id, *sub_id;
g_autofree gchar *section = NULL;
guint i;
// we only populate the "all" subcategory
if (gs_category_get_parent (category) == NULL)
return TRUE;
if (g_strcmp0 (gs_category_get_id (category), "all") != 0)
return TRUE;
id = gs_category_get_id (gs_category_get_parent (category));
sub_id = gs_category_get_id (category);
// we only support the all and featured subcategories
if (g_strcmp0 (sub_id, "all") == 0)
section = g_strdup (id);
else if (g_strcmp0 (sub_id, "featured") == 0)
section = g_strdup_printf ("%s-featured", id);
else
return TRUE;
snaps = find_snaps (plugin, SNAPD_FIND_FLAGS_SCOPE_WIDE, id, NULL, cancellable, error);
snaps = find_snaps (plugin, SNAPD_FIND_FLAGS_SCOPE_WIDE, section, NULL, cancellable, error);
if (snaps == NULL)
return FALSE;
for (i = 0; i < snaps->len; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment