[gnome-music/freeze-break: 90/107] view: Implement playlist deletion in Playlists view



commit 4242b777019f57e5b593638867c76a7411ed3f20
Author: Arnel A. Borja <arnelborja src gnome org>
Date:   Sun Sep 8 19:31:27 2013 +0800

    view: Implement playlist deletion in Playlists view

 gnomemusic/view.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index ec46a19..83b0cd9 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -643,6 +643,8 @@ class Playlist(ViewContainer):
         self.menubutton = builder.get_object('playlist_menubutton')
         self.play_menuitem = builder.get_object('menuitem_play')
         self.play_menuitem.connect('activate', self._on_play_activate)
+        self.delete_menuitem = builder.get_object('menuitem_delete')
+        self.delete_menuitem.connect('activate', self._on_delete_activate)
         self._grid.insert_row(0)
         self._grid.attach(self.headerbar, 0, 0, 1, 1)
 
@@ -884,6 +886,15 @@ class Playlist(ViewContainer):
         self.view.emit('item-activated', '0',
                        self._model.get_path(_iter))
 
+    def _on_delete_activate(self, menuitem, data=None):
+        _iter = self.playlists_sidebar.get_generic_view().get_selection().get_selected()[1]
+        if not _iter:
+            return
+
+        playlist = self.playlists_model.get_value(_iter, 2)
+        playlists.delete_playlist(playlist)
+        self.playlists_model.remove(_iter)
+
     def populate(self):
         for item in self.playlists_list:
             self._add_item(item)


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