[gnome-music/wip/gbsneto/contained-playlists: 33/35] playlistview: Select previous playlist if next not available
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/gbsneto/contained-playlists: 33/35] playlistview: Select previous playlist if next not available
- Date: Tue, 6 Dec 2016 16:40:59 +0000 (UTC)
commit 210b0321d6bcdeb4e366bcfc417f09957b154fbf
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Dec 1 21:08:22 2016 -0200
playlistview: Select previous playlist if next not available
When removing the last playlist of the view, there is no next
playlist to select, leading us to an invalid state.
Fix that by selecting the previous row when the next is not
available.
gnomemusic/views/playlistview.py | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gnomemusic/views/playlistview.py b/gnomemusic/views/playlistview.py
index ded0a4a..d0f6afe 100644
--- a/gnomemusic/views/playlistview.py
+++ b/gnomemusic/views/playlistview.py
@@ -362,6 +362,8 @@ class PlaylistView(BaseView):
row = self.playlists_sidebar.get_selected_row()
next_row = self.playlists_sidebar.get_row_at_index(
self.current_playlist_index + 1)
+ prev_row = self.playlists_sidebar.get_row_at_index(
+ self.current_playlist_index - 1)
self.pl_todelete_index = self.current_playlist_index
self.pl_todelete_row = row
self.pl_todelete = row.playlist
@@ -374,6 +376,9 @@ class PlaylistView(BaseView):
if next_row:
self.playlists_sidebar.select_row(next_row)
next_row.emit('activate')
+ elif prev_row:
+ self.playlists_sidebar.select_row(prev_row)
+ prev_row.emit('activate')
@log
def undo_playlist_deletion(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]