[gnome-software] category page: Add a Featured heading at the top
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] category page: Add a Featured heading at the top
- Date: Fri, 16 Feb 2018 11:46:02 +0000 (UTC)
commit 649b422b0514b21f714c1f320a73382c14663d0c
Author: Kalev Lember <klember redhat com>
Date: Thu Feb 15 20:38:44 2018 +0100
category page: Add a Featured heading at the top
https://gitlab.gnome.org/GNOME/gnome-software/issues/303
src/gs-category-page.c | 17 +++++++++++++++--
src/gs-category-page.ui | 22 +++++++++++++++++++++-
2 files changed, 36 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-category-page.c b/src/gs-category-page.c
index 1a01bf2f..d394a037 100644
--- a/src/gs-category-page.c
+++ b/src/gs-category-page.c
@@ -62,6 +62,7 @@ struct _GsCategoryPage
GtkWidget *sort_rating_button;
GtkWidget *sort_name_button;
GtkWidget *featured_grid;
+ GtkWidget *featured_heading;
GtkWidget *header_filter_box;
};
@@ -239,6 +240,7 @@ 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,
@@ -267,6 +269,7 @@ gs_category_page_get_featured_apps_cb (GObject *source_object,
}
gtk_widget_show (self->featured_grid);
+ gtk_widget_show (self->featured_heading);
}
static void
@@ -467,13 +470,22 @@ gs_category_page_create_filter (GsCategoryPage *self,
gtk_widget_set_visible (self->subcats_filter_button, !use_header_filter);
gtk_widget_set_visible (self->header_filter_box, use_header_filter);
- /* set up the placeholders as having the featured category is a good
- * indicator that there will be featured apps */
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);
}
}
@@ -594,6 +606,7 @@ gs_category_page_class_init (GsCategoryPageClass *klass)
gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, sort_rating_button);
gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, sort_name_button);
gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, featured_grid);
+ gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, featured_heading);
gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, header_filter_box);
}
diff --git a/src/gs-category-page.ui b/src/gs-category-page.ui
index 00e9cbf0..4435d91c 100644
--- a/src/gs-category-page.ui
+++ b/src/gs-category-page.ui
@@ -79,13 +79,33 @@
<property name="pack-type">start</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="featured_heading">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="margin_start">24</property>
+ <property name="margin_top">24</property>
+ <property name="margin_end">24</property>
+ <accessibility>
+ <relation target="featured_grid" type="label-for"/>
+ </accessibility>
+ <style>
+ <class name="index-title-alignment-software"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack-type">start</property>
+ </packing>
+ </child>
<child>
<object class="GtkGrid" id="featured_grid">
<property name="visible">False</property>
<property name="can_focus">False</property>
<property name="column_spacing">14</property>
<property name="margin_start">24</property>
- <property name="margin_top">24</property>
<property name="margin_end">24</property>
</object>
<packing>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]