diff options
author | Manuel Kaufmann <humitos@gmail.com> | 2012-06-05 22:14:21 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2012-06-14 18:50:56 (GMT) |
commit | 58998b12a45c5e01124c07bb1c213a74cda2ee83 (patch) | |
tree | ced3746d92370bdcd9541f9e5a573c73b34784e1 | |
parent | 762a85af2fbf6fc9ef0a1c0fa550dcc86ee2582f (diff) |
Add a "Remove" button SL #3357
This patch only adds a button to remove one item from the list.
To add more options like a clear button or a playlist toolbar,
we will wait for a discussion in the Design Team.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r-- | ControlToolbar.py | 7 | ||||
-rw-r--r-- | jukeboxactivity.py | 3 | ||||
-rw-r--r-- | widgets.py | 8 |
3 files changed, 18 insertions, 0 deletions
diff --git a/ControlToolbar.py b/ControlToolbar.py index d951b78..a4f9225 100644 --- a/ControlToolbar.py +++ b/ControlToolbar.py @@ -73,6 +73,13 @@ class Control(gobject.GObject): self.open_button.connect('clicked', jukebox.open_button_clicked_cb) self.toolbar.insert(self.open_button, -1) + erase_playlist_entry_btn = ToolButton(icon_name='edit-delete') + erase_playlist_entry_btn.set_tooltip(_('Remove selected track' \ + ' from the playlist')) + erase_playlist_entry_btn.connect('clicked', + jukebox._erase_playlist_entry_clicked_cb) + self.toolbar.insert(erase_playlist_entry_btn, -1) + self.prev_button = ToolButton('player_rew') self.prev_button.set_tooltip(_('Previous')) self.prev_button.show() diff --git a/jukeboxactivity.py b/jukeboxactivity.py index fee9d8d..a16fbd1 100644 --- a/jukeboxactivity.py +++ b/jukeboxactivity.py @@ -599,6 +599,9 @@ class JukeboxActivity(activity.Activity): return True + def _erase_playlist_entry_clicked_cb(self, widget): + self.playlist_widget.delete_selected_items() + def __go_fullscreen_cb(self, toolbar): self.fullscreen() @@ -85,3 +85,11 @@ class PlayListWidget(gtk.ScrolledWindow): def set_cursor(self, index): self.listview.set_cursor((index,)) + + def delete_selected_items(self): + selection = self.listview.get_selection() + sel_model, sel_rows = self.listview.get_selection().get_selected_rows() + for row in sel_rows: + self._playlist.pop(row[0]) + self.treemodel.remove(self.treemodel.get_iter(row)) + self.update(self._playlist) |