[gnome-music/wip/mschraal/core: 168/190] disclistboxwidget: Remove transitionary hack



commit 048403db845593082b605e0a5ff74abbbbbb5683
Author: Marinus Schraal <mschraal gnome org>
Date:   Mon Jul 1 23:55:26 2019 +0200

    disclistboxwidget: Remove transitionary hack

 gnomemusic/widgets/albumwidget.py       |  4 +---
 gnomemusic/widgets/artistalbumwidget.py |  2 +-
 gnomemusic/widgets/disclistboxwidget.py | 29 ++++-------------------------
 3 files changed, 6 insertions(+), 29 deletions(-)
---
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index 7960d44c..226a05bf 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -98,10 +98,8 @@ class AlbumWidget(Gtk.EventBox):
         return disc_box
 
     def _create_disc_box(self, disc_nr, album_model):
-        disc_box = DiscBox(None, album_model)
-        # disc_box.set_songs(disc_songs)
+        disc_box = DiscBox(album_model)
         disc_box.set_disc_number(disc_nr)
-        # disc_box.props.columns = 2
         disc_box.props.show_durations = False
         disc_box.props.show_favorites = False
         disc_box.props.show_song_numbers = True
diff --git a/gnomemusic/widgets/artistalbumwidget.py b/gnomemusic/widgets/artistalbumwidget.py
index fc239461..52c70b13 100644
--- a/gnomemusic/widgets/artistalbumwidget.py
+++ b/gnomemusic/widgets/artistalbumwidget.py
@@ -99,7 +99,7 @@ class ArtistAlbumWidget(Gtk.Box):
         return disc_box
 
     def _create_disc_box(self, disc_nr, album_model):
-        disc_box = DiscBox(None, album_model)
+        disc_box = DiscBox(album_model)
         disc_box.set_disc_number(disc_nr)
         disc_box.props.show_durations = False
         disc_box.props.show_favorites = False
diff --git a/gnomemusic/widgets/disclistboxwidget.py b/gnomemusic/widgets/disclistboxwidget.py
index 2254ee5a..02c3c1a6 100644
--- a/gnomemusic/widgets/disclistboxwidget.py
+++ b/gnomemusic/widgets/disclistboxwidget.py
@@ -76,16 +76,14 @@ class DiscBox(Gtk.Box):
         return '<DiscBox>'
 
     @log
-    def __init__(self, model=None, listmodel=None):
+    def __init__(self, model):
         """Initialize
 
-        :param model: The TreeStore to use
+        :param model: The Gio.ListStore to use
         """
         super().__init__()
 
         self._model = model
-        if self._model is not None:
-            self._model.connect('row-changed', self._model_row_changed)
 
         self.bind_property(
             'show-disc-label', self._disc_label, 'visible',
@@ -95,10 +93,7 @@ class DiscBox(Gtk.Box):
         self._selected_items = []
         self._songs = []
 
-        if listmodel is not None:
-            self._listmodel = listmodel
-            self._list_box.bind_model(
-                self._listmodel, self._create_widget)
+        self._list_box.bind_model(self._model, self._create_widget)
 
     @log
     def set_disc_number(self, disc_number):
@@ -109,29 +104,14 @@ class DiscBox(Gtk.Box):
         self._disc_label.props.label = _("Disc {}").format(disc_number)
         self._disc_label.props.visible = True
 
-    @log
     def get_selected_items(self):
         """Return all selected items
 
         :returns: The selected items:
         :rtype: A list if Grilo media items
         """
-        self._selected_items = []
-        self._disc_songs_flowbox.foreach(self._get_selected)
-
-        return self._selected_items
-
-    @log
-    def _get_selected(self, child):
-        song_widget = child.get_child()
-
-        if song_widget.selected:
-            itr = song_widget.itr
-            self._selected_items.append(self._model[itr][5])
+        return []
 
-    # FIXME: select all/none slow probably b/c of the row changes
-    # invocations, maybe workaround?
-    @log
     def select_all(self):
         """Select all songs"""
         def child_select_all(child):
@@ -140,7 +120,6 @@ class DiscBox(Gtk.Box):
 
         self._list_box.foreach(child_select_all)
 
-    @log
     def select_none(self):
         """Deselect all songs"""
         def child_select_none(child):


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