Playlist delete works

This commit is contained in:
Sumner Evans
2019-06-29 01:23:32 -06:00
parent 27656b0f05
commit 7ca4d4aa6e

View File

@@ -12,11 +12,24 @@ from libremsonic.ui import util
class EditPlaylistDialog(util.EditFormDialog):
__gsignals__ = {
'delete-playlist': (GObject.SIGNAL_RUN_FIRST, GObject.TYPE_NONE, ()),
}
entity_name: str = 'Playlist'
initial_size = (350, 120)
text_fields = [('Name', 'name', False), ('Comment', 'comment', False)]
boolean_fields = [('Public', 'public')]
def __init__(self, *args, **kwargs):
delete_playlist = Gtk.Button('Delete Playlist')
delete_playlist.connect('clicked', self.on_delete_playlist_click)
self.extra_buttons = [delete_playlist]
super().__init__(*args, **kwargs)
def on_delete_playlist_click(self, event):
self.emit('delete-playlist')
class PlaylistsPanel(Gtk.Paned):
"""Defines the playlists panel."""
@@ -257,6 +270,14 @@ class PlaylistsPanel(Gtk.Paned):
self.get_toplevel(),
CacheManager.get_playlist(playlist_id,
before_download=lambda: None).result())
def on_delete_playlist(e):
CacheManager.delete_playlist(playlist_id)
dialog.destroy()
self.update_playlist_list(force=True)
dialog.connect('delete-playlist', on_delete_playlist)
result = dialog.run()
if result == Gtk.ResponseType.OK:
CacheManager.update_playlist(