[gnome-music] window: Do not remove static playlists when pressing Delete



commit f312ad1bfad72c641a07606865ade72f819533ec
Author: Konstantin Pospelov <kupospelov gmail com>
Date:   Sun Sep 11 18:37:51 2016 +0300

    window: Do not remove static playlists when pressing Delete
    
    The Delete action is disabled for static playlists, however there is an
    inconsistency, because it's still possible to remove such a playlist using
    the Delete key.
    
    This patch introduces a wrapper over the _on_delete_activate method to
    ignore static playlists when pressing the Delete key.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771249

 gnomemusic/view.py   |    5 +++++
 gnomemusic/window.py |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index e8fa09d..d83aa41 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -1301,6 +1301,11 @@ class Playlist(ViewContainer):
             self._populate()
 
     @log
+    def remove_playlist(self):
+        if not self.current_playlist_is_protected():
+            self._on_delete_activate(None)
+
+    @log
     def _on_playlist_activated(self, widget, item_id, path):
         _iter = self.playlists_model.get_iter(path)
         playlist_name = self.playlists_model.get_value(_iter, 2)
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index bff112d..d37a041 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -429,7 +429,7 @@ class Window(Gtk.ApplicationWindow):
         else:
             if (event.keyval == Gdk.KEY_Delete):
                 if self._stack.get_visible_child() == self.views[3]:
-                    self.views[3]._on_delete_activate(None)
+                    self.views[3].remove_playlist()
             # Close search bar after Esc is pressed
             if event.keyval == Gdk.KEY_Escape:
                 self.toolbar.searchbar.show_bar(False)


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