h-gtk: Fix views not updating after a download completes.

While ideally we want episode widget to determine their states
themselves and avoid refreshing the whole view, currently there
is no infrastructure for that which resulted in views not being
updated their EpisodeWidgets stuck in the InProggress state.
This commit is contained in:
Jordan Petridis 2018-04-12 06:54:08 +03:00
parent 74fb8dc75c
commit 633803e0ad
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6

View File

@ -90,6 +90,7 @@ pub fn add(id: i32, directory: String, sender: Sender<Action>) -> Result<(), Err
DLPOOL.spawn(move || {
if let Ok(episode) = dbqueries::get_episode_from_rowid(id) {
let id = episode.rowid();
let pid = episode.podcast_id();
if let Err(err) = get_episode(&mut episode.into(), directory.as_str(), Some(prog)) {
error!("Error while trying to download an episode");
@ -106,7 +107,10 @@ pub fn add(id: i32, directory: String, sender: Sender<Action>) -> Result<(), Err
// }
sender
.send(Action::RefreshEpisodesViewBGR)
.send(Action::RefreshWidgetIfSame(pid))
.expect("Action channel blew up.");
sender
.send(Action::RefreshEpisodesView)
.expect("Action channel blew up.");
}
});