remove obsolete events and callbacks

This commit is contained in:
Henrik Friedrichsen
2019-03-17 22:14:59 +01:00
parent 2d5fa1e67f
commit 9842b89457
6 changed files with 7 additions and 35 deletions

View File

@@ -4,7 +4,7 @@ use std::sync::{Arc, RwLock};
use rspotify::spotify::model::playlist::SimplifiedPlaylist;
use events::{Event, EventManager};
use events::EventManager;
use queue::Queue;
use spotify::Spotify;
use track::Track;
@@ -16,10 +16,6 @@ pub struct Playlist {
pub tracks: Vec<Track>,
}
pub enum PlaylistEvent {
NewList(usize, Playlist),
}
#[derive(Clone)]
pub struct Playlists {
pub store: Arc<RwLock<Vec<Playlist>>>,
@@ -75,7 +71,7 @@ impl Playlists {
store.extend(cache);
// force refresh of UI (if visible)
self.ev.send(Event::ScreenChange("playlists".to_owned()));
self.ev.trigger();
}
Err(e) => {
error!("can't parse playlist cache: {}", e);
@@ -154,11 +150,9 @@ impl Playlists {
if self.needs_download(remote) {
info!("updating playlist {}", remote.name);
let playlist = Self::process_playlist(&remote, &self.spotify);
let index = self.append_or_update(&playlist);
self.ev.send(Event::Playlist(PlaylistEvent::NewList(
index,
playlist.clone(),
)));
self.append_or_update(&playlist);
// trigger redraw
self.ev.trigger();
}
}