[gnome-music/wip/jfelder/restore-select-playlist-on-deletion: 2/2] playlistsview: Select the next playlist on playlist deletion
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/restore-select-playlist-on-deletion: 2/2] playlistsview: Select the next playlist on playlist deletion
- Date: Tue, 7 Jan 2020 01:43:41 +0000 (UTC)
commit 3fd883c95d457df3a93fc929b92636f1823519dc
Author: Jean Felder <jfelder src gnome org>
Date: Tue Jan 7 01:12:31 2020 +0100
playlistsview: Select the next playlist on playlist deletion
When a user playlist is deleted, the next playlist from the list is
selected. If there is no next playlist, the previous one is selected.
This fixes a regression from the core rewrite (commits
e626a26ad0912e2b322a09638ef1fa95bceb117d and
bda877bb538d8fbddca65dea8a79b13583e3d6f9).
Closes: #359
gnomemusic/views/playlistsview.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/gnomemusic/views/playlistsview.py b/gnomemusic/views/playlistsview.py
index bc133426..e7c60755 100644
--- a/gnomemusic/views/playlistsview.py
+++ b/gnomemusic/views/playlistsview.py
@@ -149,10 +149,22 @@ class PlaylistsView(BaseView):
def _on_playlists_loaded(self, klass):
self._coremodel.disconnect(self._loaded_id)
+ self._model.connect("items-changed", self._on_playlists_model_changed)
+
first_row = self._sidebar.get_row_at_index(0)
self._sidebar.select_row(first_row)
first_row.emit("activate")
+ def _on_playlists_model_changed(self, model, position, removed, added):
+ if removed == 0:
+ return
+
+ row_next = (self._sidebar.get_row_at_index(position)
+ or self._sidebar.get_row_at_index(position - 1))
+ if row_next:
+ self._sidebar.select_row(row_next)
+ row_next.emit("activate")
+
@log
def _on_view_right_clicked(self, gesture, n_press, x, y):
requested_row = self._view.get_row_at_y(y)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]