[gnome-software: 6/25] gs-overview-page: Use GsCategoryManager to get featured subcategories




commit 90c03ae294b00e66c9dfb0846611a314a40ec5a5
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Feb 1 22:51:35 2021 +0000

    gs-overview-page: Use GsCategoryManager to get featured subcategories
    
    This ensures the `GsCategory` objects are shared with the rest of the
    shell.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 src/gs-overview-page.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-overview-page.c b/src/gs-overview-page.c
index 77f128c6a..561559104 100644
--- a/src/gs-overview-page.c
+++ b/src/gs-overview-page.c
@@ -785,7 +785,7 @@ gs_overview_page_load (GsOverviewPage *self)
                        LoadData *load_data;
                        const gchar *cat_id;
                        g_autoptr(GsCategory) category = NULL;
-                       g_autoptr(GsCategory) featured_category = NULL;
+                       GsCategory *featured_category = NULL;
                        g_autoptr(GsPluginJob) plugin_job = NULL;
 
                        cat_id = g_ptr_array_index (cats_random, i);
@@ -793,12 +793,11 @@ gs_overview_page_load (GsOverviewPage *self)
                                g_free (priv->category_of_day);
                                priv->category_of_day = g_strdup (cat_id);
                        }
-                       category = gs_category_new (cat_id);
-                       featured_category = gs_category_new ("featured");
-                       gs_category_add_child (category, featured_category);
+                       category = gs_category_manager_lookup (gs_plugin_loader_get_category_manager 
(priv->plugin_loader), cat_id);
+                       featured_category = gs_category_find_child (category, "featured");
 
                        load_data = g_slice_new0 (LoadData);
-                       load_data->category = g_object_ref (category);
+                       load_data->category = g_steal_pointer (&category);
                        load_data->self = g_object_ref (self);
                        load_data->title = gs_overview_page_get_category_label (cat_id);
                        plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_GET_CATEGORY_APPS,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]