[gnome-music] More track to song conversion



commit 746270525de59c498317cefb1c6f030140b6ef1a
Author: Marinus Schraal <mschraal src gnome org>
Date:   Mon Feb 27 23:34:51 2017 +0100

    More track to song conversion
    
    Fixed an oversight.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=774470

 gnomemusic/grilo.py              |    4 ++--
 gnomemusic/player.py             |    2 +-
 gnomemusic/views/albumsview.py   |    2 +-
 gnomemusic/views/artistsview.py  |    6 +++---
 gnomemusic/views/baseview.py     |    6 +++---
 gnomemusic/views/playlistview.py |    2 +-
 gnomemusic/views/searchview.py   |    6 +++---
 gnomemusic/views/songsview.py    |    8 ++++----
 gnomemusic/window.py             |   19 +++++++++----------
 9 files changed, 27 insertions(+), 28 deletions(-)
---
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index 1be2709..d224b8d 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -263,8 +263,8 @@ class Grilo(GObject.GObject):
                           Query.album_songs(album.get_id()), 0, callback, count)
         else:
             source = self.sources[album.get_source()]
-            length = len(album.tracks)
-            for i, track in enumerate(album.tracks):
+            length = len(album.songs)
+            for i, track in enumerate(album.songs):
                 callback(source, None, track, length - (i + 1), None)
             callback(source, None, None, 0, None)
 
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 1a68a38..6876477 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -647,7 +647,7 @@ class Player(GObject.GObject):
         nextSong = self.playlist.get_value(_iter, self.playlistField)
         url = self.playlist.get_value(_iter, 5).get_url()
 
-        # Skip remote tracks discovery
+        # Skip remote songs discovery
         if url.startswith('http://') or url.startswith('https://'):
             return False
         elif status == DiscoveryStatus.PENDING:
diff --git a/gnomemusic/views/albumsview.py b/gnomemusic/views/albumsview.py
index e4df064..74e314b 100644
--- a/gnomemusic/views/albumsview.py
+++ b/gnomemusic/views/albumsview.py
@@ -127,7 +127,7 @@ class AlbumsView(BaseView):
         grilo.populate_albums(self._offset, self._add_item)
 
     @log
-    def get_selected_tracks(self, callback):
+    def get_selected_songs(self, callback):
         # FIXME: we call into private objects with full knowledge of
         # what is there
         if self._header_bar._state == ToolbarState.CHILD_VIEW:
diff --git a/gnomemusic/views/artistsview.py b/gnomemusic/views/artistsview.py
index 4ac2707..1e930b8 100644
--- a/gnomemusic/views/artistsview.py
+++ b/gnomemusic/views/artistsview.py
@@ -206,12 +206,12 @@ class ArtistsView(BaseView):
             self._on_changes_pending()
 
     @log
-    def get_selected_tracks(self, callback):
-        """Returns a list of tracks selected
+    def get_selected_songs(self, callback):
+        """Returns a list of songs selected
 
         In this view this will be all albums of the selected artists.
         :returns: All selected songs
-        :rtype: A list of tracks
+        :rtype: A list of songs
         """
         self._items_selected = []
         self._items_selected_callback = callback
diff --git a/gnomemusic/views/baseview.py b/gnomemusic/views/baseview.py
index d8a5f5d..3dd344e 100644
--- a/gnomemusic/views/baseview.py
+++ b/gnomemusic/views/baseview.py
@@ -263,7 +263,7 @@ class BaseView(Gtk.Stack):
         self._header_bar._select_button.clicked()
 
     @log
-    def get_selected_tracks(self, callback):
+    def get_selected_songs(self, callback):
         callback([])
 
     @log
@@ -281,7 +281,7 @@ class BaseView(Gtk.Stack):
 
     @log
     def select_all(self):
-        """Select all the available tracks."""
+        """Select all the available songs."""
         count = self._set_selection(True)
 
         if count > 0:
@@ -294,7 +294,7 @@ class BaseView(Gtk.Stack):
 
     @log
     def unselect_all(self):
-        """Unselects all the selected tracks."""
+        """Unselects all the selected songs."""
         self._set_selection(False)
         select_toolbar = self._selection_toolbar
         select_toolbar._add_to_playlist_button.set_sensitive(False)
diff --git a/gnomemusic/views/playlistview.py b/gnomemusic/views/playlistview.py
index 1d7dd69..0640a99 100644
--- a/gnomemusic/views/playlistview.py
+++ b/gnomemusic/views/playlistview.py
@@ -548,6 +548,6 @@ class PlaylistView(BaseView):
         grilo.populate_playlists(self._offset, self._add_playlist_item)
 
     @log
-    def get_selected_tracks(self, callback):
+    def get_selected_songs(self, callback):
         callback([self.model[self.model.get_iter(path)][5]
                   for path in self._view.get_selection()])
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index b50988c..ad5c0e3 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -179,11 +179,11 @@ class SearchView(BaseView):
             self._albums[key].add_artist(artist)
             self._albums[key].set_composer(composer)
             self._albums[key].set_source(source.get_id())
-            self._albums[key].tracks = []
+            self._albums[key].songs = []
             self._add_item(source, None, self._albums[key], 0, [self.model, 'album'])
             self._add_item(source, None, self._albums[key], 0, [self.model, 'artist'])
 
-        self._albums[key].tracks.append(item)
+        self._albums[key].songs.append(item)
         self._add_item(source, None, item, 0, [self.model, 'song'])
 
     @log
@@ -309,7 +309,7 @@ class SearchView(BaseView):
         self._header_bar.set_state(ToolbarState.MAIN)
 
     @log
-    def get_selected_tracks(self, callback):
+    def get_selected_songs(self, callback):
         if self.get_visible_child() == self._albumWidget:
             callback(self._albumWidget.view.get_selected_items())
         elif self.get_visible_child() == self._artistAlbumsWidget:
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index 87cd95b..a44f282 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -101,7 +101,7 @@ class SongsView(BaseView):
 
         :param player: The main player object
         :param playlist: The current playlist object
-        :param current_iter: Iter of the current displayed tracks
+        :param current_iter: Iter of the current displayed song
         """
         if self._iter_to_clean:
             self.model[self._iter_to_clean][10] = False
@@ -231,12 +231,12 @@ class SongsView(BaseView):
             GLib.idle_add(grilo.populate_songs, self._offset, self._add_item)
 
     @log
-    def get_selected_tracks(self, callback):
-        """Returns a list of selected tracks
+    def get_selected_songs(self, callback):
+        """Returns a list of selected songs
 
         In this view this will be the all the songs selected
         :returns: All selected songs
-        :rtype: A list of tracks
+        :rtype: A list of songs
         """
         callback([self.model[self.model.get_iter(path)][5]
                   for path in self._view.get_selection()])
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index fb97488..4d27332 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -566,35 +566,34 @@ class Window(Gtk.ApplicationWindow):
         if self._stack.get_visible_child() == self.views[3]:
             return
 
-        def callback(selected_tracks):
-            if len(selected_tracks) < 1:
+        def callback(selected_songs):
+            if len(selected_songs) < 1:
                 return
 
             playlist_dialog = PlaylistDialog(self)
             if playlist_dialog.run() == Gtk.ResponseType.ACCEPT:
-                playlist.add_to_playlist(
-                    playlist_dialog.get_selected(),
-                    selected_tracks)
+                playlist.add_to_playlist(playlist_dialog.get_selected(),
+                                         selected_songs)
             self.toolbar.set_selection_mode(False)
             playlist_dialog.destroy()
 
-        self._stack.get_visible_child().get_selected_tracks(callback)
+        self._stack.get_visible_child().get_selected_songs(callback)
 
     @log
     def _on_remove_from_playlist_button_clicked(self, widget):
         if self._stack.get_visible_child() != self.views[3]:
             return
 
-        def callback(selected_tracks):
-            if len(selected_tracks) < 1:
+        def callback(selected_songs):
+            if len(selected_songs) < 1:
                 return
 
             playlist.remove_from_playlist(
                 self.views[3].current_playlist,
-                selected_tracks)
+                selected_songs)
             self.toolbar.set_selection_mode(False)
 
-        self._stack.get_visible_child().get_selected_tracks(callback)
+        self._stack.get_visible_child().get_selected_songs(callback)
 
     @log
     def push_loading_notification(self):


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