[gnome-music/wip/gbsneto/contained-playlists: 22/29] playlists, playlistview: Code cleanup
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/gbsneto/contained-playlists: 22/29] playlists, playlistview: Code cleanup
- Date: Thu, 1 Dec 2016 23:27:25 +0000 (UTC)
commit 27d7f4d63e672a7f695af375dbfebe2f0322e528
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Dec 1 20:23:53 2016 -0200
playlists, playlistview: Code cleanup
After so many back and forth of the code, lets cleanup
the code a little bit.
gnomemusic/playlists.py | 13 -------------
gnomemusic/views/playlistview.py | 17 +++++------------
2 files changed, 5 insertions(+), 25 deletions(-)
---
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index 549d4ca..99d3d59 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -522,19 +522,6 @@ class Playlists(GObject.GObject):
return self.playlists.values()
@log
- def is_static_playlist(self, playlist):
- """Checks whether the given playlist is static or not
-
- :return: True if the playlist is static
- :rtype: bool
- """
- for static_playlist_id in self._static_playlists.get_ids():
- if playlist.get_id() == static_playlist_id:
- return True
-
- return False
-
- @log
def do_get_property(self, property):
if property.name == 'ready':
return self.ready
diff --git a/gnomemusic/views/playlistview.py b/gnomemusic/views/playlistview.py
index 85b33fc..d3d4ac9 100644
--- a/gnomemusic/views/playlistview.py
+++ b/gnomemusic/views/playlistview.py
@@ -422,24 +422,21 @@ class PlaylistView(BaseView):
@log
def _on_song_added_to_playlist(self, playlists, playlist, item):
- if self.current_playlist and \
- playlist.id == self.current_playlist.id:
+ if self.current_playlist == playlist:
self._add_item_to_model(item, self.model)
@log
def _on_song_removed_from_playlist(self, playlists, playlist, item):
- if self.current_playlist and \
- playlist.id == self.current_playlist.id:
- model = self.model
- else:
+ if self.current_playlist != playlist:
return
+ model = self.model
update_playing_track = False
+
for row in model:
if row[5].get_id() == item.get_id():
# Is the removed track now being played?
- if self.current_playlist and \
- playlist.id == self.current_playlist.id:
+ if self.current_playlist == playlist:
if self.player.currentTrack is not None and self.player.currentTrack.valid():
currentTrackpath = self.player.currentTrack.get_path().to_string()
if row.path is not None and row.path.to_string() == currentTrackpath:
@@ -468,10 +465,6 @@ class PlaylistView(BaseView):
return
@log
- def populate(self):
- pass
-
- @log
def get_selected_tracks(self, callback):
callback([self.model.get_value(self.model.get_iter(path), 5)
for path in self.view.get_selection()])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]