diff --git a/hammond-data/src/dbqueries.rs b/hammond-data/src/dbqueries.rs index efd269c..ca9b44c 100644 --- a/hammond-data/src/dbqueries.rs +++ b/hammond-data/src/dbqueries.rs @@ -363,13 +363,13 @@ pub fn is_episodes_populated() -> Result { /// Check if the `podcast` table contains any rows /// /// Return true if `podcast table is populated. -pub fn is_podcasts_populated() -> Result { +pub fn is_podcasts_populated(filter_ids: &[i32]) -> Result { use schema::podcast::dsl::*; let db = connection(); let con = db.get()?; - select(exists(podcast.as_query())) + select(exists(podcast.filter(id.ne_all(filter_ids)))) .get_result(&con) .map_err(From::from) } diff --git a/hammond-gtk/src/stacks/content.rs b/hammond-gtk/src/stacks/content.rs index a6af0b6..3bff486 100644 --- a/hammond-gtk/src/stacks/content.rs +++ b/hammond-gtk/src/stacks/content.rs @@ -63,9 +63,8 @@ impl Content { } pub fn update_shows_view(&self) { - let pop = self.shows.borrow().populated(); - pop.borrow_mut() - .update_shows() + self.shows.borrow_mut() + .update() .map_err(|err| error!("Failed to update ShowsView: {}", err)) .ok(); } diff --git a/hammond-gtk/src/stacks/show.rs b/hammond-gtk/src/stacks/show.rs index 89df1f0..c92dac0 100644 --- a/hammond-gtk/src/stacks/show.rs +++ b/hammond-gtk/src/stacks/show.rs @@ -6,6 +6,7 @@ use hammond_data::dbqueries::is_podcasts_populated; use app::Action; use stacks::PopulatedStack; +use utils::get_ignored_shows; use widgets::EmptyView; use std::cell::RefCell; @@ -82,7 +83,9 @@ impl ShowStack { fn determine_state(&mut self) -> Result<(), Error> { use self::ShowState::*; - if is_podcasts_populated()? { + let ign = get_ignored_shows()?; + debug!("IGNORED SHOWS {:?}", ign); + if is_podcasts_populated(&ign)? { self.switch_visible(Populated); } else { self.switch_visible(Empty); diff --git a/hammond-gtk/src/widgets/show.rs b/hammond-gtk/src/widgets/show.rs index 5ce4206..e4b7bd3 100644 --- a/hammond-gtk/src/widgets/show.rs +++ b/hammond-gtk/src/widgets/show.rs @@ -303,18 +303,20 @@ pub fn remove_show_notif(pd: Arc, sender: Sender) -> InAppNotif .map_err(|_| error!("Could not insert {} to the ignore list.", pd.title())) .ok(); - let callback = clone!(pd => move || { + let callback = clone!(pd, sender => move || { utils::uningore_show(pd.id()) .map_err(|err| error!("Error: {}", err)) .map_err(|_| error!("Could not remove {} from the ignore list.", pd.title())) .ok(); // Spawn a thread so it won't block the ui. - rayon::spawn(clone!(pd => move || { + rayon::spawn(clone!(pd, sender => move || { delete_show(&pd) .map_err(|err| error!("Error: {}", err)) .map_err(|_| error!("Failed to delete {}", pd.title())) .ok(); + + sender.send(Action::RefreshEpisodesView).ok(); })); glib::Continue(false) });