From 633803e0ad5563c1624dfa677bd6b27f1c9f8836 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Thu, 12 Apr 2018 06:54:08 +0300 Subject: [PATCH] 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. --- hammond-gtk/src/manager.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hammond-gtk/src/manager.rs b/hammond-gtk/src/manager.rs index 10deb0b..70dd9a9 100644 --- a/hammond-gtk/src/manager.rs +++ b/hammond-gtk/src/manager.rs @@ -90,6 +90,7 @@ pub fn add(id: i32, directory: String, sender: Sender) -> 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) -> Result<(), Err // } sender - .send(Action::RefreshEpisodesViewBGR) + .send(Action::RefreshWidgetIfSame(pid)) + .expect("Action channel blew up."); + sender + .send(Action::RefreshEpisodesView) .expect("Action channel blew up."); } });