From 440badf1ebb813bbc2b683eef4f8d4e4f61af3bd Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Sat, 16 Dec 2017 20:45:15 +0200 Subject: [PATCH] ShowWidget: Strip html tags from the description. --- hammond-downloader/src/downloader.rs | 2 +- hammond-gtk/src/widgets/show.rs | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hammond-downloader/src/downloader.rs b/hammond-downloader/src/downloader.rs index 4343e91..e3a4a0c 100644 --- a/hammond-downloader/src/downloader.rs +++ b/hammond-downloader/src/downloader.rs @@ -8,7 +8,7 @@ use std::io::{BufWriter, Read, Write}; use std::path::Path; use errors::*; -use hammond_data::{Episode, EpisodeWidgetQuery, Podcast}; +use hammond_data::{EpisodeWidgetQuery, Podcast}; use hammond_data::xdg_dirs::{DL_DIR, HAMMOND_CACHE}; // TODO: Replace path that are of type &str with std::path. diff --git a/hammond-gtk/src/widgets/show.rs b/hammond-gtk/src/widgets/show.rs index 4d1f7ea..308964c 100644 --- a/hammond-gtk/src/widgets/show.rs +++ b/hammond-gtk/src/widgets/show.rs @@ -2,11 +2,11 @@ use gtk::prelude::*; use gtk; use diesel::Identifiable; use open; - -use std::fs; +use dissolve; use hammond_data::dbqueries; use hammond_data::Podcast; +use hammond_data::utils::replace_extra_spaces; use hammond_downloader::downloader; use widgets::episode::episodes_listbox; @@ -15,6 +15,7 @@ use content::ShowStack; use headerbar::Header; use std::rc::Rc; +use std::fs; #[derive(Debug, Clone)] pub struct ShowWidget { @@ -74,7 +75,9 @@ impl ShowWidget { self.episodes.add(&l); } - self.description.set_text(pd.description()); + // TODO: Temporary solution until we render html urls/bold/italic probably with markup. + let desc = dissolve::strip_html_tags(pd.description()).join(" "); + self.description.set_text(&replace_extra_spaces(&desc)); let img = get_pixbuf_from_path_128(pd); if let Some(i) = img { @@ -113,6 +116,7 @@ fn on_unsub_button_clicked(shows: Rc, pd: &Podcast, unsub_button: > shows.update_podcasts(); } +#[allow(dead_code)] fn on_played_button_clicked(shows: Rc, pd: &Podcast) { let _ = dbqueries::update_none_to_played_now(pd);