[gnome-music/wip/mschraal/default-icon-cleanups] artistalbumswidget: Use Hdy.Clamp for content size
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/default-icon-cleanups] artistalbumswidget: Use Hdy.Clamp for content size
- Date: Wed, 25 Aug 2021 08:44:59 +0000 (UTC)
commit 0e943d7f7b5df8ba3c22b5a85862d606e273c05a
Author: Marinus Schraal <mschraal gnome org>
Date: Wed Aug 25 10:02:11 2021 +0200
artistalbumswidget: Use Hdy.Clamp for content size
Related: #464
data/ui/ArtistAlbumsWidget.ui | 16 +++++++++++-----
gnomemusic/widgets/artistalbumswidget.py | 12 +++++++-----
2 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/data/ui/ArtistAlbumsWidget.ui b/data/ui/ArtistAlbumsWidget.ui
index a553f7c15..6cc491c8d 100644
--- a/data/ui/ArtistAlbumsWidget.ui
+++ b/data/ui/ArtistAlbumsWidget.ui
@@ -1,11 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.18"/>
- <template class="ArtistAlbumsWidget" parent="GtkListBox">
- <property name="halign">center</property>
+ <template class="ArtistAlbumsWidget" parent="HdyClamp">
+ <property name="maximum-size">1000</property>
+ <property name="orientation">horizontal</property>
<property name="visible">True</property>
- <style>
- <class name="artist-album-widget"/>
- </style>
+ <child>
+ <object class="GtkListBox" id="_listbox">
+ <property name="visible">True</property>
+ <style>
+ <class name="artist-album-widget"/>
+ </style>
+ </object>
+ </child>
</template>
</interface>
diff --git a/gnomemusic/widgets/artistalbumswidget.py b/gnomemusic/widgets/artistalbumswidget.py
index eb6291a08..4f213157a 100644
--- a/gnomemusic/widgets/artistalbumswidget.py
+++ b/gnomemusic/widgets/artistalbumswidget.py
@@ -25,7 +25,7 @@
from __future__ import annotations
import typing
-from gi.repository import GObject, Gtk
+from gi.repository import GObject, Gtk, Handy
from gnomemusic.widgets.albumwidget import AlbumWidget
if typing.TYPE_CHECKING:
@@ -34,7 +34,7 @@ if typing.TYPE_CHECKING:
@Gtk.Template(resource_path="/org/gnome/Music/ui/ArtistAlbumsWidget.ui")
-class ArtistAlbumsWidget(Gtk.ListBox):
+class ArtistAlbumsWidget(Handy.Clamp):
"""Widget containing all albums by an artist
A vertical list of AlbumWidget, containing all the albums
@@ -44,6 +44,8 @@ class ArtistAlbumsWidget(Gtk.ListBox):
__gtype_name__ = 'ArtistAlbumsWidget'
+ _listbox = Gtk.Template.Child()
+
selection_mode = GObject.Property(type=bool, default=False)
def __init__(
@@ -60,7 +62,7 @@ class ArtistAlbumsWidget(Gtk.ListBox):
self._model = coreartist.props.model
self._player = self._application.props.player
- self.bind_model(self._model, self._add_album)
+ self._listbox.bind_model(self._model, self._add_album)
def _add_album(self, corealbum):
row = Gtk.ListBoxRow()
@@ -87,14 +89,14 @@ class ArtistAlbumsWidget(Gtk.ListBox):
def toggle_selection(row: Gtk.ListBoxRow) -> None:
row.get_child().select_all()
- self.foreach(toggle_selection)
+ self._listbox.foreach(toggle_selection)
def deselect_all(self) -> None:
"""Deselect all items"""
def toggle_selection(row: Gtk.ListBoxRow) -> None:
row.get_child().deselect_all()
- self.foreach(toggle_selection)
+ self._listbox.foreach(toggle_selection)
@GObject.Property(type=str, flags=GObject.ParamFlags.READABLE)
def artist(self) -> str:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]