[gnome-software] category page: Give the show and filter drop downs "Show" and "Sort" labels



commit 8ef1c5daa925f49fa25676c722d2bacb571bb85c
Author: Kalev Lember <klember redhat com>
Date:   Mon Feb 19 23:42:34 2018 +0100

    category page: Give the show and filter drop downs "Show" and "Sort" labels
    
    ... and move the drop downs so they are next to each other.
    
    https://gitlab.gnome.org/GNOME/gnome-software/issues/303

 src/gs-category-page.c  |  8 ++++++++
 src/gs-category-page.ui | 37 +++++++++++++++++++++++++++++++++++--
 2 files changed, 43 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-category-page.c b/src/gs-category-page.c
index d394a037..480e1c6a 100644
--- a/src/gs-category-page.c
+++ b/src/gs-category-page.c
@@ -54,9 +54,11 @@ struct _GsCategoryPage
        GtkWidget       *button_category_shell_extensions;
        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       *subcats_sort_label;
        GtkWidget       *subcats_sort_button;
        GtkWidget       *subcats_sort_button_label;
        GtkWidget       *sort_rating_button;
@@ -328,14 +330,17 @@ gs_category_page_reload (GsPage *page)
                if (g_strcmp0 (gs_category_get_id (self->subcategory), "shell-extensions") != 0) {
                        /* we don't want to show the sort button on the addons that
                         * cannot be rated */
+                       gtk_widget_set_visible (self->subcats_sort_label, FALSE);
                        gtk_widget_set_visible (self->subcats_sort_button, FALSE);
                } else {
                        /* show the shell extensions header and the sort button */
                        gtk_widget_set_visible (self->infobar_category_shell_extensions, TRUE);
+                       gtk_widget_set_visible (self->subcats_sort_label, TRUE);
                        gtk_widget_set_visible (self->subcats_sort_button, TRUE);
                }
        } else {
                gtk_widget_set_visible (self->infobar_category_shell_extensions, FALSE);
+               gtk_widget_set_visible (self->subcats_sort_label, TRUE);
                gtk_widget_set_visible (self->subcats_sort_button, TRUE);
        }
 
@@ -467,6 +472,7 @@ gs_category_page_create_filter (GsCategoryPage *self,
                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);
 
@@ -598,9 +604,11 @@ gs_category_page_class_init (GsCategoryPageClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, 
infobar_category_shell_extensions);
        gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, button_category_shell_extensions);
        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, subcats_sort_label);
        gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, subcats_sort_button);
        gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, subcats_sort_button_label);
        gtk_widget_class_bind_template_child (widget_class, GsCategoryPage, sort_rating_button);
diff --git a/src/gs-category-page.ui b/src/gs-category-page.ui
index 4435d91c..f60eeb37 100644
--- a/src/gs-category-page.ui
+++ b/src/gs-category-page.ui
@@ -189,7 +189,23 @@
                                 <property name="margin_start">24</property>
                                 <property name="margin_end">24</property>
                                 <property name="margin_top">24</property>
-
+                                <property name="spacing">9</property>
+                                <child>
+                                  <object class="GtkLabel" id="subcats_filter_label">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label" translatable="yes">Show</property>
+                                    <property name="margin_start">2</property>
+                                    <accessibility>
+                                      <relation target="subcats_filter_button" type="label-for"/>
+                                    </accessibility>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="pack-type">start</property>
+                                  </packing>
+                                </child>
                                 <child>
                                   <object class="GtkMenuButton" id="subcats_filter_button">
                                     <property name="visible">True</property>
@@ -197,6 +213,7 @@
                                     <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>
@@ -243,6 +260,22 @@
                                     <property name="pack-type">start</property>
                                   </packing>
                                 </child>
+                                <child>
+                                  <object class="GtkLabel" id="subcats_sort_label">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label" translatable="yes">Sort</property>
+                                    <property name="margin_start">2</property>
+                                    <accessibility>
+                                      <relation target="subcats_sort_button" type="label-for"/>
+                                    </accessibility>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="pack-type">start</property>
+                                  </packing>
+                                </child>
                                 <child>
                                   <object class="GtkMenuButton" id="subcats_sort_button">
                                     <property name="visible">True</property>
@@ -294,7 +327,7 @@
                                   <packing>
                                     <property name="expand">False</property>
                                     <property name="fill">False</property>
-                                    <property name="pack-type">end</property>
+                                    <property name="pack-type">start</property>
                                   </packing>
                                 </child>
                               </object>


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