[gnome-music/wip/jfelder/fix-disclistbox-warning] disclistboxwidget: max-children-per-line property cannot be 0



commit 3cc01f0839723a2b494e60d0cbf96ab6ab9e6dce
Author: Jean Felder <jfelder src gnome org>
Date:   Sun Apr 14 23:50:03 2019 +0200

    disclistboxwidget: max-children-per-line property cannot be 0
    
    Since Gtk 4.24.8, the max-children-per-line property of a Gtk.FlowBox
    cannot be equal to 0.
    
    Fix the issue by setting an initial value of 1.

 data/ui/DiscBox.ui                      | 2 +-
 gnomemusic/widgets/disclistboxwidget.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/DiscBox.ui b/data/ui/DiscBox.ui
index c949d24b..9f4e6a00 100644
--- a/data/ui/DiscBox.ui
+++ b/data/ui/DiscBox.ui
@@ -30,7 +30,7 @@
           <property name="valign">start</property>
           <property name="orientation">vertical</property>
           <property name="homogeneous">True</property>
-          <property name="max_children_per_line">0</property>
+          <property name="max_children_per_line">1</property>
           <property name="selection_mode">none</property>
         </object>
         <packing>
diff --git a/gnomemusic/widgets/disclistboxwidget.py b/gnomemusic/widgets/disclistboxwidget.py
index b6a8ff46..3faa32c7 100644
--- a/gnomemusic/widgets/disclistboxwidget.py
+++ b/gnomemusic/widgets/disclistboxwidget.py
@@ -71,7 +71,7 @@ class DiscSongsFlowBox(Gtk.FlowBox):
         """
         self._columns = columns
 
-        children_n = len(self.get_children())
+        children_n = max(len(self.get_children()), 1)
 
         if children_n % self._columns == 0:
             max_per_line = children_n / self._columns


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