[gnome-software: 2/24] gs-category-page: Remove UI for filtering
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 2/24] gs-category-page: Remove UI for filtering
- Date: Mon, 3 May 2021 15:24:12 +0000 (UTC)
commit 669cb19c5a474f30a2d19bf778d050bf70518898
Author: Philip Withnall <pwithnall endlessos org>
Date: Wed Apr 21 15:51:57 2021 +0100
gs-category-page: Remove UI for filtering
It’s not present in the new design:
https://gitlab.gnome.org/Teams/Design/software-mockups/-/blob/master/adaptive/category-page-mvp.png
This makes #795 outdated.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Helps: #1111
Closes: #795
src/gs-category-page.c | 75 +++---------------------------------------
src/gs-category-page.ui | 87 -------------------------------------------------
2 files changed, 5 insertions(+), 157 deletions(-)
---
diff --git a/src/gs-category-page.c b/src/gs-category-page.c
index 0c4b3766f..011706d14 100644
--- a/src/gs-category-page.c
+++ b/src/gs-category-page.c
@@ -31,13 +31,8 @@ struct _GsCategoryPage
GtkWidget *category_detail_box;
GtkWidget *scrolledwindow_category;
- GtkWidget *subcats_filter_label;
- GtkWidget *subcats_filter_button_label;
- GtkWidget *subcats_filter_button;
- GtkWidget *popover_filter_box;
GtkWidget *featured_grid;
GtkWidget *featured_heading;
- GtkWidget *header_filter_box;
};
G_DEFINE_TYPE (GsCategoryPage, gs_category_page, GS_TYPE_PAGE)
@@ -242,48 +237,16 @@ gs_category_page_reload (GsPage *page)
self);
}
-static void
-gs_category_page_populate_filtered (GsCategoryPage *self, GsCategory *subcategory)
-{
- g_assert (subcategory != NULL);
- g_set_object (&self->subcategory, subcategory);
- gs_category_page_reload (GS_PAGE (self));
-}
-
-static void
-filter_button_activated (GtkWidget *button, gpointer data)
-{
- GsCategoryPage *self = GS_CATEGORY_PAGE (data);
- GsCategory *category;
-
- category = g_object_get_data (G_OBJECT (button), "category");
-
- gtk_label_set_text (GTK_LABEL (self->subcats_filter_button_label),
- gs_category_get_name (category));
- gs_category_page_populate_filtered (self, category);
-}
-
-static gboolean
-gs_category_page_should_use_header_filter (GsCategory *category)
-{
- return g_strcmp0 (gs_category_get_id (category), "addons") == 0;
-}
-
static void
gs_category_page_create_filter (GsCategoryPage *self,
GsCategory *category)
{
- GtkWidget *button = NULL;
- GsCategory *s;
+ GsCategory *s, *first_subcat = NULL;
guint i;
GPtrArray *children;
- GtkWidget *first_subcat = NULL;
gboolean featured_category_found = FALSE;
- gboolean use_header_filter = gs_category_page_should_use_header_filter (category);
gs_container_remove_all (GTK_CONTAINER (self->category_detail_box));
- gs_container_remove_all (GTK_CONTAINER (self->header_filter_box));
- gs_container_remove_all (GTK_CONTAINER (self->popover_filter_box));
children = gs_category_get_children (category);
for (i = 0; i < children->len; i++) {
@@ -300,36 +263,13 @@ gs_category_page_create_filter (GsCategoryPage *self,
continue;
}
- /* create the right button type depending on where it will be used */
- if (use_header_filter) {
- if (button == NULL)
- button = gtk_radio_button_new (NULL);
- else
- button = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (button));
- g_object_set (button, "xalign", 0.5, "label", gs_category_get_name (s),
- "draw-indicator", FALSE, "relief", GTK_RELIEF_NONE, NULL);
- gtk_container_add (GTK_CONTAINER (self->header_filter_box), button);
- } else {
- button = gtk_model_button_new ();
- g_object_set (button, "xalign", 0.0, "text", gs_category_get_name (s), NULL);
- gtk_container_add (GTK_CONTAINER (self->popover_filter_box), button);
- }
-
- g_object_set_data_full (G_OBJECT (button), "category", g_object_ref (s), g_object_unref);
- gtk_widget_show (button);
- g_signal_connect (button, "clicked", G_CALLBACK (filter_button_activated), self);
-
- /* make sure the first subcategory gets selected */
if (first_subcat == NULL)
- first_subcat = button;
+ first_subcat = s;
}
- if (first_subcat != NULL)
- filter_button_activated (first_subcat, self);
- /* show only the adequate filter */
- gtk_widget_set_visible (self->subcats_filter_label, !use_header_filter);
- gtk_widget_set_visible (self->subcats_filter_button, !use_header_filter);
- gtk_widget_set_visible (self->header_filter_box, use_header_filter);
+ g_set_object (&self->subcategory, first_subcat);
+ if (first_subcat != NULL)
+ gs_category_page_reload (GS_PAGE (self));
if (featured_category_found) {
g_autofree gchar *featured_heading = NULL;
@@ -457,13 +397,8 @@ 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, subcats_filter_label);
- gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, subcats_filter_button_label);
- gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, subcats_filter_button);
- gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, popover_filter_box);
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);
}
GsCategoryPage *
diff --git a/src/gs-category-page.ui b/src/gs-category-page.ui
index e3a6f76cb..fd163c44d 100644
--- a/src/gs-category-page.ui
+++ b/src/gs-category-page.ui
@@ -1,17 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.10"/>
- <object class="GtkPopover" id="categories_popover">
- <property name="visible">False</property>
- <property name="position">bottom</property>
- <child>
- <object class="GtkBox" id="popover_filter_box">
- <property name="visible">True</property>
- <property name="margin">10</property>
- <property name="orientation">vertical</property>
- </object>
- </child>
- </object>
<template class="GsCategoryPage" parent="GsPage">
<child>
@@ -42,16 +31,6 @@
<property name="orientation">vertical</property>
<property name="spacing">9</property>
<property name="valign">start</property>
- <child>
- <object class="GtkBox" id="header_filter_box">
- <property name="visible">True</property>
- <property name="orientation">horizontal</property>
- <property name="homogeneous">True</property>
- <style>
- <class name="category_page_header_filter_box"/>
- </style>
- </object>
- </child>
<child>
<object class="GtkLabel" id="featured_heading">
<property name="visible">True</property>
@@ -75,64 +54,6 @@
<property name="margin_end">24</property>
</object>
</child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="orientation">horizontal</property>
- <property name="margin_start">24</property>
- <property name="margin_end">24</property>
- <property name="margin_top">36</property>
- <property name="spacing">9</property>
- <child>
- <object class="GtkLabel" id="subcats_filter_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="TRANSLATORS: This is
a label for the category filter drop down, which all together can read e.g. 'Show Vector
Graphics'.">Show</property>
- <property name="margin_start">2</property>
- <accessibility>
- <relation target="subcats_filter_button" type="label-for"/>
- </accessibility>
- </object>
- </child>
- <child>
- <object class="GtkMenuButton" id="subcats_filter_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="relief">normal</property>
- <property name="popover">categories_popover</property>
- <property name="margin_end">24</property>
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Subcategories
filter menu</property>
- </object>
- </child>
- <child>
- <object class="GtkBox" id="grid1">
- <property name="visible">True</property>
- <property name="valign">center</property>
- <property name="spacing">6</property>
- <property name="orientation">horizontal</property>
- <child>
- <object class="GtkLabel" id="subcats_filter_button_label">
- <property name="visible">True</property>
- <property name="xalign">0.0</property>
- </object>
- </child>
- <child>
- <object class="GtkArrow" id="arrow1">
- <property name="visible">True</property>
- <property name="arrow_type">down</property>
- </object>
- </child>
- </object>
- </child>
- <style>
- <class name="text-button"/>
- </style>
- </object>
- </child>
- </object>
- </child>
<child>
<object class="GtkFlowBox" id="category_detail_box">
@@ -165,12 +86,4 @@
</object>
</child>
</template>
- <object class="GtkSizeGroup">
- <property name="ignore-hidden">False</property>
- <property name="mode">horizontal</property>
- <widgets>
- <widget name="subcats_filter_button_label"/>
- <widget name="popover_filter_box"/>
- </widgets>
- </object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]