[gnome-software/1381-category-page-loading-state-doesn-t-match-final-layout] gs-category-page: Initialize featured carousel with empty content



commit debf3c781346ada15addff0328d09cbfb6d28bef
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jan 20 12:43:54 2022 +0100

    gs-category-page: Initialize featured carousel with empty content
    
    It looks as "being loaded" this way. Also allocate more space for the carousel,
    to not flash with the size that much once the content is loaded.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1381

 src/gs-category-page.c  | 7 ++++++-
 src/gs-category-page.ui | 3 +--
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-category-page.c b/src/gs-category-page.c
index 729fa5f00..53ac275a4 100644
--- a/src/gs-category-page.c
+++ b/src/gs-category-page.c
@@ -377,7 +377,8 @@ gs_category_page_load_category (GsCategoryPage *self)
                 gs_category_get_id (self->category),
                 gs_category_get_id (self->subcategory));
 
-       gtk_widget_hide (self->top_carousel);
+       gs_featured_carousel_set_apps (GS_FEATURED_CAROUSEL (self->top_carousel), NULL);
+       gtk_widget_show (self->top_carousel);
        gs_category_page_add_placeholders (self, GTK_FLOW_BOX (self->category_detail_box),
                                           MIN (30, gs_category_get_size (self->subcategory)));
        gs_category_page_add_placeholders (self, GTK_FLOW_BOX (self->recently_updated_flow_box), 8);
@@ -386,9 +387,11 @@ gs_category_page_load_category (GsCategoryPage *self)
                /* set up the placeholders as having the featured category is a good
                 * indicator that there will be featured apps */
                gs_category_page_add_placeholders (self, GTK_FLOW_BOX (self->featured_flow_box), 4);
+               gtk_widget_show (self->top_carousel);
        } else {
                gs_widget_remove_all (self->featured_flow_box, (GsRemoveFunc) gtk_flow_box_remove);
                gtk_widget_hide (self->featured_flow_box);
+               gtk_widget_hide (self->top_carousel);
        }
 
        /* Load the list of apps in the category, and also the list of all
@@ -530,6 +533,8 @@ gs_category_page_init (GsCategoryPage *self)
                                    recently_updated_sort_cb,
                                    NULL,
                                    NULL);
+
+       gs_featured_carousel_set_apps (GS_FEATURED_CAROUSEL (self->top_carousel), NULL);
 }
 
 static void
diff --git a/src/gs-category-page.ui b/src/gs-category-page.ui
index 4cca308b2..5ab50b4da 100644
--- a/src/gs-category-page.ui
+++ b/src/gs-category-page.ui
@@ -27,8 +27,7 @@
 
                     <child>
                       <object class="GsFeaturedCarousel" id="top_carousel">
-                        <property name="visible">False</property>
-                        <property name="height-request">150</property>
+                        <property name="height-request">318</property>
                         <property name="margin_top">24</property>
                         <signal name="app-clicked" handler="top_carousel_app_clicked_cb"/>
                       </object>


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