[gnome-music/wip/mschraal/core: 39/93] artistview: Fill sidebar



commit 5a95348254e54410e6d4acf5af51ffaf34b50c76
Author: Marinus Schraal <mschraal gnome org>
Date:   Fri May 31 13:08:15 2019 +0200

    artistview: Fill sidebar

 gnomemusic/coremodel.py         |  3 +++
 gnomemusic/views/artistsview.py | 16 ++++++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index fd491c18..f617d7c9 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -76,6 +76,9 @@ class CoreModel(GObject.GObject):
     def get_albums_model(self):
         return self._album_model
 
+    def get_artists_model(self):
+        return self._artist_model
+
     @log
     def _on_media_removed(self, klass, media):
         try:
diff --git a/gnomemusic/views/artistsview.py b/gnomemusic/views/artistsview.py
index 1eb93a01..e74d6d15 100644
--- a/gnomemusic/views/artistsview.py
+++ b/gnomemusic/views/artistsview.py
@@ -63,6 +63,9 @@ class ArtistsView(BaseView):
         self.player = player
         self._artists = {}
 
+        self._model = window._app._coremodel.get_artists_model()
+        self._sidebar.bind_model(self._model, self._create_widget)
+
         sidebar_container.props.width_request = 220
         sidebar_container.get_style_context().add_class('sidebar')
         self._sidebar.props.selection_mode = Gtk.SelectionMode.SINGLE
@@ -74,7 +77,12 @@ class ArtistsView(BaseView):
         self._ctrl.connect("released", self._on_sidebar_clicked)
 
         self.show_all()
-        self._sidebar.hide()
+
+    def _create_widget(self, artist):
+        row = SidebarRow()
+        row.props.text = artist.props.artist
+
+        return row
 
     @log
     def _setup_view(self):
@@ -169,9 +177,9 @@ class ArtistsView(BaseView):
     @log
     def _populate(self, data=None):
         """Populates the view"""
-        self._window.notifications_popup.push_loading()
-        grilo.populate_artists(self._offset, self._add_item)
-        self._init = True
+        # self._window.notifications_popup.push_loading()
+        # grilo.populate_artists(self._offset, self._add_item)
+        # self._init = True
 
     @log
     def _on_sidebar_clicked(self, gesture, n_press, x, y):


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