[gnome-software: 3/6] Overview: constrain maximum width with HdyClamp




commit ec67d10616c244de2dd33f4f8b9fa5e28dddb89e
Author: Julian Sparber <julian sparber net>
Date:   Fri Jan 31 10:38:54 2020 +0100

    Overview: constrain maximum width with HdyClamp
    
    (Updated by Philip Withnall to call `hdy_init()` correctly for
    libhandy-1.)
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-software/issues/890

 src/gs-application.c    |   3 +
 src/gs-overview-page.c  |   1 +
 src/gs-overview-page.ui | 284 ++++++++++++++++++++++++------------------------
 3 files changed, 149 insertions(+), 139 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 95afc030..92dd3cd6 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -16,6 +16,7 @@
 #include <glib/gi18n.h>
 #include <gio/gio.h>
 #include <gio/gdesktopappinfo.h>
+#include <handy.h>
 #include <libsoup/soup.h>
 
 #ifdef GDK_WINDOWING_X11
@@ -974,6 +975,8 @@ gs_application_startup (GApplication *application)
        GsApplication *app = GS_APPLICATION (application);
        G_APPLICATION_CLASS (gs_application_parent_class)->startup (application);
 
+       hdy_init ();
+
        gs_application_add_wrapper_actions (application);
 
        g_action_map_add_action_entries (G_ACTION_MAP (application),
diff --git a/src/gs-overview-page.c b/src/gs-overview-page.c
index b9dee947..77f128c6 100644
--- a/src/gs-overview-page.c
+++ b/src/gs-overview-page.c
@@ -10,6 +10,7 @@
 #include "config.h"
 
 #include <glib/gi18n.h>
+#include <handy.h>
 #include <math.h>
 
 #include "gs-shell.h"
diff --git a/src/gs-overview-page.ui b/src/gs-overview-page.ui
index e83bc178..21abb37f 100644
--- a/src/gs-overview-page.ui
+++ b/src/gs-overview-page.ui
@@ -70,165 +70,171 @@
                     <property name="hexpand">True</property>
                     <property name="vexpand">True</property>
                     <child>
-                      <object class="GtkBox" id="box_overview">
+                      <object class="HdyClamp">
                         <property name="visible">True</property>
-                        <property name="halign">center</property>
-                        <property name="hexpand">False</property>
-                        <property name="border_width">12</property>
-                        <property name="orientation">vertical</property>
+                        <property name="maximum-size">1000</property>
                         <child>
-                          <object class="GtkOverlay" id="overlay">
+                          <object class="GtkBox" id="box_overview">
                             <property name="visible">True</property>
-                            <property name="halign">fill</property>
-                            <property name="valign">fill</property>
-                            <property name="height-request">150</property>
-                            <child type="overlay">
-                              <object class="GtkStack" id="stack_featured">
+                            <property name="halign">center</property>
+                            <property name="hexpand">False</property>
+                            <property name="border_width">12</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <object class="GtkOverlay" id="overlay">
                                 <property name="visible">True</property>
                                 <property name="halign">fill</property>
-                                <property name="transition-type">crossfade</property>
-                              </object>
-                            </child>
-                            <child type="overlay">
-                              <object class="GtkButton" id="button_featured_back">
-                                <property name="visible">True</property>
-                                <property name="use_underline">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="halign">start</property>
-                                <property name="valign">center</property>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject" id="button_featured_back_accessible">
-                                    <property name="accessible-name" translatable="yes">Previous</property>
+                                <property name="valign">fill</property>
+                                <property name="height-request">150</property>
+                                <child type="overlay">
+                                  <object class="GtkStack" id="stack_featured">
+                                    <property name="visible">True</property>
+                                    <property name="halign">fill</property>
+                                    <property name="transition-type">crossfade</property>
                                   </object>
                                 </child>
-                                <style>
-                                  <class name="osd"/>
-                                  <class name="featured-button-left"/>
-                                </style>
-                                <child>
-                                  <object class="GtkImage" id="back_image">
+                                <child type="overlay">
+                                  <object class="GtkButton" id="button_featured_back">
                                     <property name="visible">True</property>
-                                    <property name="icon_name">go-previous-symbolic</property>
-                                    <property name="icon_size">1</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="halign">start</property>
+                                    <property name="valign">center</property>
+                                    <child internal-child="accessible">
+                                      <object class="AtkObject" id="button_featured_back_accessible">
+                                        <property name="accessible-name" 
translatable="yes">Previous</property>
+                                      </object>
+                                    </child>
+                                    <style>
+                                      <class name="osd"/>
+                                      <class name="featured-button-left"/>
+                                    </style>
+                                    <child>
+                                      <object class="GtkImage" id="back_image">
+                                        <property name="visible">True</property>
+                                        <property name="icon_name">go-previous-symbolic</property>
+                                        <property name="icon_size">1</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                                <child type="overlay">
+                                  <object class="GtkButton" id="button_featured_forwards">
+                                    <property name="visible">True</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="halign">end</property>
+                                    <property name="valign">center</property>
+                                    <child internal-child="accessible">
+                                      <object class="AtkObject" id="button_featured_forwards_accessible">
+                                        <property name="accessible-name" translatable="yes">Next</property>
+                                      </object>
+                                    </child>
+                                    <style>
+                                      <class name="osd"/>
+                                      <class name="featured-button-right"/>
+                                    </style>
+                                    <child>
+                                      <object class="GtkImage" id="forwards_image">
+                                        <property name="visible">True</property>
+                                        <property name="icon_name">go-next-symbolic</property>
+                                        <property name="icon_size">1</property>
+                                      </object>
+                                    </child>
                                   </object>
                                 </child>
                               </object>
                             </child>
-                            <child type="overlay">
-                              <object class="GtkButton" id="button_featured_forwards">
+
+                            <child>
+                              <object class="GtkLabel" id="popular_heading">
                                 <property name="visible">True</property>
-                                <property name="use_underline">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="halign">end</property>
-                                <property name="valign">center</property>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject" id="button_featured_forwards_accessible">
-                                    <property name="accessible-name" translatable="yes">Next</property>
-                                  </object>
-                                </child>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes" comments="Translators: This is a 
heading for software which has been featured (&apos;picked&apos;) by the distribution.">Editor’s 
Picks</property>
+                                <property name="margin-top">21</property>
+                                <property name="margin-bottom">6</property>
+                                <accessibility>
+                                  <relation target="box_popular" type="label-for"/>
+                                </accessibility>
                                 <style>
-                                  <class name="osd"/>
-                                  <class name="featured-button-right"/>
+                                  <class name="index-title-alignment-software"/>
                                 </style>
-                                <child>
-                                  <object class="GtkImage" id="forwards_image">
-                                    <property name="visible">True</property>
-                                    <property name="icon_name">go-next-symbolic</property>
-                                    <property name="icon_size">1</property>
-                                  </object>
-                                </child>
                               </object>
                             </child>
-                          </object>
-                        </child>
-
-                        <child>
-                          <object class="GtkLabel" id="popular_heading">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes" comments="Translators: This is a 
heading for software which has been featured (&apos;picked&apos;) by the distribution.">Editor’s 
Picks</property>
-                            <property name="margin-top">21</property>
-                            <property name="margin-bottom">6</property>
-                            <accessibility>
-                              <relation target="box_popular" type="label-for"/>
-                            </accessibility>
-                            <style>
-                              <class name="index-title-alignment-software"/>
-                            </style>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GsHidingBox" id="box_popular">
-                            <property name="visible">True</property>
-                            <property name="spacing">14</property>
-                            <property name="valign">start</property>
-                            <accessibility>
-                              <relation target="popular_heading" type="labelled-by"/>
-                            </accessibility>
-                          </object>
-                        </child>
+                            <child>
+                              <object class="GsHidingBox" id="box_popular">
+                                <property name="visible">True</property>
+                                <property name="spacing">14</property>
+                                <property name="valign">start</property>
+                                <accessibility>
+                                  <relation target="popular_heading" type="labelled-by"/>
+                                </accessibility>
+                              </object>
+                            </child>
 
-                        <child>
-                          <object class="GtkLabel" id="recent_heading">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes" comments="Translators: This is a 
heading for software which has been recently released upstream.">Recent Releases</property>
-                            <property name="margin-top">21</property>
-                            <property name="margin-bottom">6</property>
-                            <accessibility>
-                              <relation target="box_recent" type="label-for"/>
-                            </accessibility>
-                            <style>
-                              <class name="index-title-alignment-software"/>
-                            </style>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GsHidingBox" id="box_recent">
-                            <property name="visible">True</property>
-                            <property name="spacing">14</property>
-                            <property name="valign">start</property>
-                            <accessibility>
-                              <relation target="recent_heading" type="labelled-by"/>
-                            </accessibility>
-                          </object>
-                        </child>
+                            <child>
+                              <object class="GtkLabel" id="recent_heading">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes" comments="Translators: This is a 
heading for software which has been recently released upstream.">Recent Releases</property>
+                                <property name="margin-top">21</property>
+                                <property name="margin-bottom">6</property>
+                                <accessibility>
+                                  <relation target="box_recent" type="label-for"/>
+                                </accessibility>
+                                <style>
+                                  <class name="index-title-alignment-software"/>
+                                </style>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GsHidingBox" id="box_recent">
+                                <property name="visible">True</property>
+                                <property name="spacing">14</property>
+                                <property name="valign">start</property>
+                                <accessibility>
+                                  <relation target="recent_heading" type="labelled-by"/>
+                                </accessibility>
+                              </object>
+                            </child>
 
-                        <child>
-                          <object class="GtkBox" id="box_popular_rotating">
-                            <property name="visible">True</property>
-                            <property name="orientation">vertical</property>
-                            <property name="valign">start</property>
-                          </object>
-                        </child>
+                            <child>
+                              <object class="GtkBox" id="box_popular_rotating">
+                                <property name="visible">True</property>
+                                <property name="orientation">vertical</property>
+                                <property name="valign">start</property>
+                              </object>
+                            </child>
 
-                        <child>
-                          <object class="GtkLabel" id="category_heading">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Categories</property>
-                            <property name="margin-top">24</property>
-                            <property name="margin-bottom">6</property>
-                            <accessibility>
-                              <relation target="flowbox_categories" type="label-for"/>
-                            </accessibility>
-                            <style>
-                              <class name="index-title-alignment-software"/>
-                            </style>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GtkFlowBox" id="flowbox_categories">
-                            <property name="visible">True</property>
-                            <property name="margin-bottom">6</property>
-                            <property name="row_spacing">14</property>
-                            <property name="column_spacing">14</property>
-                            <property name="homogeneous">True</property>
-                            <property name="max_children_per_line">3</property>
-                            <property name="selection_mode">none</property>
-                            <accessibility>
-                              <relation target="category_heading" type="labelled-by"/>
-                            </accessibility>
+                            <child>
+                              <object class="GtkLabel" id="category_heading">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Categories</property>
+                                <property name="margin-top">24</property>
+                                <property name="margin-bottom">6</property>
+                                <accessibility>
+                                  <relation target="flowbox_categories" type="label-for"/>
+                                </accessibility>
+                                <style>
+                                  <class name="index-title-alignment-software"/>
+                                </style>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkFlowBox" id="flowbox_categories">
+                                <property name="visible">True</property>
+                                <property name="margin-bottom">6</property>
+                                <property name="row_spacing">14</property>
+                                <property name="column_spacing">14</property>
+                                <property name="homogeneous">True</property>
+                                <property name="max_children_per_line">3</property>
+                                <property name="selection_mode">none</property>
+                                <accessibility>
+                                  <relation target="category_heading" type="labelled-by"/>
+                                </accessibility>
+                              </object>
+                            </child>
                           </object>
                         </child>
                       </object>


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