[gnome-software: 4/24] gs-category-page: Change featured heading label text and simplify




commit 8bf20ed4493c68a5f969a687445e8aa4c8d27db6
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Apr 21 16:04:40 2021 +0100

    gs-category-page: Change featured heading label text and simplify
    
    Change the text of the heading for the featured apps section from
    ‘Featured ${category name}’ to ‘Editor’s Picks’ and bind its visibility
    to that of `featured_grid`, allowing the code to be simplified.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 src/gs-category-page.c  | 13 -------------
 src/gs-category-page.ui |  3 ++-
 2 files changed, 2 insertions(+), 14 deletions(-)
---
diff --git a/src/gs-category-page.c b/src/gs-category-page.c
index 011706d14..ea6cfbfb2 100644
--- a/src/gs-category-page.c
+++ b/src/gs-category-page.c
@@ -32,7 +32,6 @@ struct _GsCategoryPage
        GtkWidget       *category_detail_box;
        GtkWidget       *scrolledwindow_category;
        GtkWidget       *featured_grid;
-       GtkWidget       *featured_heading;
 };
 
 G_DEFINE_TYPE (GsCategoryPage, gs_category_page, GS_TYPE_PAGE)
@@ -126,7 +125,6 @@ gs_category_page_get_featured_apps_cb (GObject *source_object,
 
        gs_container_remove_all (GTK_CONTAINER (self->featured_grid));
        gtk_widget_hide (self->featured_grid);
-       gtk_widget_hide (self->featured_heading);
 
        list = gs_plugin_loader_job_process_finish (plugin_loader,
                                                    res,
@@ -155,7 +153,6 @@ gs_category_page_get_featured_apps_cb (GObject *source_object,
        }
 
        gtk_widget_show (self->featured_grid);
-       gtk_widget_show (self->featured_heading);
 }
 
 static void
@@ -272,21 +269,12 @@ gs_category_page_create_filter (GsCategoryPage *self,
                gs_category_page_reload (GS_PAGE (self));
 
        if (featured_category_found) {
-               g_autofree gchar *featured_heading = NULL;
-
                /* set up the placeholders as having the featured category is a good
                 * indicator that there will be featured apps */
                gs_category_page_set_featured_placeholders (self);
-
-               /* TRANSLATORS: This is a heading on the categories page. %s gets
-                  replaced by the category name, e.g. 'Graphics & Photography' */
-               featured_heading = g_strdup_printf (_("Featured %s"), gs_category_get_name (self->category));
-               gtk_label_set_label (GTK_LABEL (self->featured_heading), featured_heading);
-               gtk_widget_show (self->featured_heading);
        } else {
                gs_container_remove_all (GTK_CONTAINER (self->featured_grid));
                gtk_widget_hide (self->featured_grid);
-               gtk_widget_hide (self->featured_heading);
        }
 }
 
@@ -398,7 +386,6 @@ gs_category_page_class_init (GsCategoryPageClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, category_detail_box);
        gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, scrolledwindow_category);
        gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, featured_grid);
-       gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, featured_heading);
 }
 
 GsCategoryPage *
diff --git a/src/gs-category-page.ui b/src/gs-category-page.ui
index 41432104f..67a395f61 100644
--- a/src/gs-category-page.ui
+++ b/src/gs-category-page.ui
@@ -25,11 +25,12 @@
                     <property name="valign">start</property>
                     <child>
                       <object class="GtkLabel" id="featured_heading">
-                        <property name="visible">True</property>
+                        <property name="visible" bind-source="featured_grid" bind-property="visible" 
bind-flags="sync-create|bidirectional" />
                         <property name="xalign">0</property>
                         <property name="margin_start">24</property>
                         <property name="margin_top">24</property>
                         <property name="margin_end">24</property>
+                        <property name="label" translatable="yes" comments="Heading for featured apps on a 
category page">Editor’s Picks</property>
                         <accessibility>
                           <relation target="featured_grid" type="label-for"/>
                         </accessibility>


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