[gnome-music/wip/mschraal/default-icon-cleanups: 1/17] albumwidget: Use Hdy.Clamp for content size




commit b5c4648b611c984875854350c8f0c8ff5d7b81fc
Author: Marinus Schraal <mschraal gnome org>
Date:   Wed Aug 25 01:15:41 2021 +0200

    albumwidget: Use Hdy.Clamp for content size
    
    Related: #464

 data/ui/AlbumWidget.ui            | 204 ++++++++++++++++++++------------------
 gnomemusic/widgets/albumwidget.py |   4 +-
 2 files changed, 107 insertions(+), 101 deletions(-)
---
diff --git a/data/ui/AlbumWidget.ui b/data/ui/AlbumWidget.ui
index 3d3d4cc4c..cbce13a69 100644
--- a/data/ui/AlbumWidget.ui
+++ b/data/ui/AlbumWidget.ui
@@ -2,137 +2,143 @@
 <!-- Generated with glade 3.20.0 -->
 <interface>
   <requires lib="gtk+" version="3.12"/>
-  <template class="AlbumWidget" parent="GtkBox">
-    <property name="orientation">vertical</property>
-    <property name="visible">True</property>
+  <template class="AlbumWidget" parent="HdyClamp">
     <property name="margin-bottom">48</property>
-    <property name="margin-end">160</property>
-    <property name="margin-start">160</property>
     <property name="margin-top">48</property>
+    <property name="maximum-size">1000</property>
+    <property name="orientation">horizontal</property>
+    <property name="visible">True</property>
     <child>
-      <object class="GtkBox" id="albumInfo">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
+      <object class="GtkBox">
         <property name="halign">fill</property>
-        <property name="hexpand">True</property>
-        <property name="spacing">32</property>
-        <child>
-          <object class="ArtStack" id="_art_stack">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="halign">center</property>
-            <property name="valign">start</property>
-            <property name="hhomogeneous">False</property>
-            <property name="vhomogeneous">False</property>
-          </object>
-        </child>
+        <property name="orientation">vertical</property>
+        <property name="visible">True</property>
         <child>
-          <object class="GtkBox" id="albumDetails">
+          <object class="GtkBox" id="albumInfo">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="halign">center</property>
-            <property name="valign">start</property>
-            <property name="orientation">vertical</property>
-            <property name="margin-top">18</property>
-            <child>
-              <object class="GtkLabel" id="_title_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="halign">start</property>
-                <property name="ellipsize">middle</property>
-                <property name="margin-bottom">18</property>
-                <style>
-                  <class name="title-1"/>
-                </style>
-              </object>
-            </child>
+            <property name="halign">fill</property>
+            <property name="hexpand">True</property>
+            <property name="spacing">32</property>
             <child>
-              <object class="GtkLabel" id="_artist_label">
+              <object class="ArtStack" id="_art_stack">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="halign">start</property>
-                <property name="ellipsize">middle</property>
-                <property name="margin-bottom">12</property>
-                <style>
-                  <class name="title-3"/>
-                </style>
+                <property name="halign">center</property>
+                <property name="valign">start</property>
+                <property name="hhomogeneous">False</property>
+                <property name="vhomogeneous">False</property>
               </object>
             </child>
             <child>
-              <object class="GtkLabel" id="_released_label">
+              <object class="GtkBox" id="albumDetails">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="halign">start</property>
-                <property name="use_markup">True</property>
-                <property name="margin-bottom">12</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-            </child>
-            <child>
-              <object class="GtkLabel" id="_composer_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="halign">start</property>
-                <property name="ellipsize">end</property>
-                <property name="margin-bottom">12</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-            </child>
-            <child>
-              <object class="GtkBox">
-                <property name="orientation">horizontal</property>
-                <property name="visible">True</property>
-                <property name="spacing">12</property>
-                <property name="margin-top">6</property>
+                <property name="halign">center</property>
+                <property name="valign">start</property>
+                <property name="orientation">vertical</property>
+                <property name="margin-top">18</property>
                 <child>
-                  <object class="GtkButton" id="_play_button">
+                  <object class="GtkLabel" id="_title_label">
                     <property name="visible">True</property>
-                    <property name="can-focus">True</property>
-                    <property name="receives-default">True</property>
-                    <property name="image">_play_image</property>
-                    <property name="always_show_image">True</property>
-                    <property name="tooltip-text" translatable="yes">Play</property>
-                    <property name="valign">center</property>
-                    <signal name="clicked" handler="_on_play_button_clicked" swapped="no"/>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="ellipsize">middle</property>
+                    <property name="margin-bottom">18</property>
                     <style>
-                      <class name="circular"/>
+                      <class name="title-1"/>
                     </style>
                   </object>
                 </child>
                 <child>
-                  <object class="GtkMenuButton" id="_menu_button">
+                  <object class="GtkLabel" id="_artist_label">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
+                    <property name="can_focus">False</property>
                     <property name="halign">start</property>
-                    <property name="valign">center</property>
-                    <property name="focus_on_click">False</property>
-                    <property name="menu-model">album_menu</property>
-                    <property name="direction">none</property>
-                    <property name="use_popover">True</property>
-                    <property name="image">_view_more_image</property>
+                    <property name="ellipsize">middle</property>
+                    <property name="margin-bottom">12</property>
                     <style>
-                      <class name="image-button"/>
-                      <class name="circular"/>
+                      <class name="title-3"/>
                     </style>
                   </object>
                 </child>
+                <child>
+                  <object class="GtkLabel" id="_released_label">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="use_markup">True</property>
+                    <property name="margin-bottom">12</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="_composer_label">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="ellipsize">end</property>
+                    <property name="margin-bottom">12</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkBox">
+                    <property name="orientation">horizontal</property>
+                    <property name="visible">True</property>
+                    <property name="spacing">12</property>
+                    <property name="margin-top">6</property>
+                    <child>
+                      <object class="GtkButton" id="_play_button">
+                        <property name="visible">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">True</property>
+                        <property name="image">_play_image</property>
+                        <property name="always_show_image">True</property>
+                        <property name="tooltip-text" translatable="yes">Play</property>
+                        <property name="valign">center</property>
+                        <signal name="clicked" handler="_on_play_button_clicked" swapped="no"/>
+                        <style>
+                          <class name="circular"/>
+                        </style>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkMenuButton" id="_menu_button">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="halign">start</property>
+                        <property name="valign">center</property>
+                        <property name="focus_on_click">False</property>
+                        <property name="menu-model">album_menu</property>
+                        <property name="direction">none</property>
+                        <property name="use_popover">True</property>
+                        <property name="image">_view_more_image</property>
+                        <style>
+                          <class name="image-button"/>
+                          <class name="circular"/>
+                        </style>
+                      </object>
+                    </child>
+                  </object>
+                </child>
               </object>
             </child>
           </object>
         </child>
-      </object>
-    </child>
-    <child>
-      <object class="DiscListBox" id="_disc_list_box">
-        <property name="can_focus">False</property>
-        <property name="margin-top">48</property>
-        <property name="selection_mode">0</property>
-        <property name="visible">True</property>
+        <child>
+          <object class="DiscListBox" id="_disc_list_box">
+            <property name="can_focus">False</property>
+            <property name="margin-top">48</property>
+            <property name="selection_mode">0</property>
+            <property name="visible">True</property>
+          </object>
+        </child>
       </object>
     </child>
   </template>
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index 1e657e884..4391fae2c 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -27,7 +27,7 @@ from gettext import ngettext
 from typing import Optional, Union
 import typing
 
-from gi.repository import Gfm, Gio, GLib, GObject, Gtk
+from gi.repository import Gfm, Gio, GLib, GObject, Gtk, Handy
 
 from gnomemusic.corealbum import CoreAlbum
 from gnomemusic.defaulticon import DefaultIcon
@@ -44,7 +44,7 @@ if typing.TYPE_CHECKING:
 
 
 @Gtk.Template(resource_path='/org/gnome/Music/ui/AlbumWidget.ui')
-class AlbumWidget(Gtk.Box):
+class AlbumWidget(Handy.Clamp):
     """Album widget.
 
     The album widget consists of an image with the album art


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