[gnome-music/wip/mschraal/grltracker-batch-initial-fill: 3/4] songliststore: Fix incorrect liststore addition



commit e06a33f06d22547071a585c42b82b1e4c670949c
Author: Marinus Schraal <mschraal gnome org>
Date:   Mon Nov 4 14:18:44 2019 +0100

    songliststore: Fix incorrect liststore addition
    
    Adding more than one item at a time resulted in the same item being
    added multiple times. This was not noticed because all the additions
    were single adds at a time. With batch additions however this becomes an
    obvious bug.
    
    Correct adding multiple items at a time to SongListStore.

 gnomemusic/songliststore.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/songliststore.py b/gnomemusic/songliststore.py
index df3c2587..05c310c8 100644
--- a/gnomemusic/songliststore.py
+++ b/gnomemusic/songliststore.py
@@ -61,10 +61,10 @@ class SongListStore(Gtk.ListStore):
 
         if added > 0:
             for i in list(range(added)):
-                coresong = model[position]
+                coresong = model[position + i]
                 time = utils.seconds_to_string(coresong.props.duration)
                 self.insert_with_valuesv(
-                    position, [2, 3, 4, 5, 6, 7],
+                    position + i, [2, 3, 4, 5, 6, 7],
                     [coresong.props.title, coresong.props.artist,
                      coresong.props.album, time,
                      int(coresong.props.favorite), coresong])


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