[gnome-music/wip/jfelder/coremodel-songs-model-rename: 14/14] grltrackerwrapper: Rename _model to _songs_model



commit e22d66e0e7fc8cb6333db9362f963d3dbe284aa6
Author: Jean Felder <jfelder src gnome org>
Date:   Sun Mar 1 20:20:50 2020 +0100

    grltrackerwrapper: Rename _model to _songs_model
    
    GrlTrackerWrapper deals with differents models and "_model" is a
    generic name. When reading the code, it is not easy to understand that
    this model represents all the songs.
    
    Rename it to "_songs_model" in order to avoid any confusion.

 gnomemusic/grilowrappers/grltrackerwrapper.py | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index 64616412..97216261 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -80,7 +80,7 @@ class GrlTrackerWrapper(GObject.GObject):
         self._grilo = grilo
         self._source = None
         self._log = application.props.log
-        self._model = self._coremodel.props.songs
+        self._songs_model = self._coremodel.props.songs
         self._albums_model = self._coremodel.props.albums
         self._album_ids = {}
         self._artists_model = self._coremodel.props.artists
@@ -95,7 +95,7 @@ class GrlTrackerWrapper(GObject.GObject):
         self._tracker_wrapper = tracker_wrapper
         self._window = application.props.window
 
-        self._song_search_tracker = Gfm.FilterListModel.new(self._model)
+        self._song_search_tracker = Gfm.FilterListModel.new(self._songs_model)
         self._song_search_tracker.set_filter_func(lambda a: False)
         self._song_search_proxy.append(self._song_search_tracker)
 
@@ -300,12 +300,12 @@ class GrlTrackerWrapper(GObject.GObject):
                 self._log.warning("Removal KeyError.")
                 return
 
-            for idx, coresong_model in enumerate(self._model):
+            for idx, coresong_model in enumerate(self._songs_model):
                 if coresong_model is coresong:
                     self._log.debug("Removing: {}, {}".format(
                         coresong.props.media.get_id(), coresong.props.title))
 
-                    self._model.remove(idx)
+                    self._songs_model.remove(idx)
                     break
 
     def _song_media_query(self, media_ids):
@@ -358,7 +358,7 @@ class GrlTrackerWrapper(GObject.GObject):
                     "Media {} not in hash".format(media.get_id()))
 
                 song = CoreSong(media, self._coreselection, self._grilo)
-                self._model.append(song)
+                self._songs_model.append(song)
                 self._hash[media.get_id()] = song
             else:
                 self._hash[media.get_id()].update(media)
@@ -380,7 +380,8 @@ class GrlTrackerWrapper(GObject.GObject):
                 return
 
             if not media:
-                self._model.splice(self._model.get_n_items(), 0, songs_added)
+                self._songs_model.splice(
+                    self._songs_model.get_n_items(), 0, songs_added)
                 self._window.notifications_popup.pop_loading()
 
                 # Initialize the playlists subwrapper after the initial
@@ -396,7 +397,8 @@ class GrlTrackerWrapper(GObject.GObject):
             songs_added.append(song)
             self._hash[media.get_id()] = song
             if len(songs_added) == self._SPLICE_SIZE:
-                self._model.splice(self._model.get_n_items(), 0, songs_added)
+                self._songs_model.splice(
+                    self._songs_model.get_n_items(), 0, songs_added)
                 songs_added.clear()
 
         query = """


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