diff --git a/hammond-gtk/src/content.rs b/hammond-gtk/src/content.rs index 8214ab9..4e71505 100644 --- a/hammond-gtk/src/content.rs +++ b/hammond-gtk/src/content.rs @@ -4,9 +4,10 @@ use gtk::prelude::*; use hammond_data::Podcast; use hammond_data::dbqueries; -use views::podcasts::PopulatedView; +use views::shows::ShowsPopulated; use views::empty::EmptyView; -use widgets::podcast::PodcastWidget; + +use widgets::show::ShowWidget; use std::rc::Rc; @@ -50,8 +51,8 @@ impl ShowStack { let show = Rc::new(ShowStack { stack }); - let pop = PopulatedView::new_initialized(show.clone()); - let widget = PodcastWidget::new(); + let pop = ShowsPopulated::new_initialized(show.clone()); + let widget = ShowWidget::new(); let empty = EmptyView::new(); show.stack.add_named(&pop.container, "podcasts"); @@ -80,7 +81,7 @@ impl ShowStack { let vis = self.stack.get_visible_child_name().unwrap(); let old = self.stack.get_child_by_name("podcasts").unwrap(); - let pop = PopulatedView::new(); + let pop = ShowsPopulated::new(); pop.init(Rc::new(self.clone())); self.stack.remove(&old); @@ -99,7 +100,7 @@ impl ShowStack { pub fn replace_widget(&self, pd: &Podcast) { let old = self.stack.get_child_by_name("widget").unwrap(); - let new = PodcastWidget::new_initialized(Rc::new(self.clone()), pd); + let new = ShowWidget::new_initialized(Rc::new(self.clone()), pd); self.stack.remove(&old); self.stack.add_named(&new.container, "widget"); diff --git a/hammond-gtk/src/views/episodes.rs b/hammond-gtk/src/views/episodes.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/hammond-gtk/src/views/episodes.rs @@ -0,0 +1 @@ + diff --git a/hammond-gtk/src/views/mod.rs b/hammond-gtk/src/views/mod.rs index 9c47e7d..a9ea1bf 100644 --- a/hammond-gtk/src/views/mod.rs +++ b/hammond-gtk/src/views/mod.rs @@ -1,2 +1,3 @@ -pub mod podcasts; +pub mod shows; +pub mod episodes; pub mod empty; diff --git a/hammond-gtk/src/views/podcasts.rs b/hammond-gtk/src/views/shows.rs similarity index 88% rename from hammond-gtk/src/views/podcasts.rs rename to hammond-gtk/src/views/shows.rs index 58c5f14..5b2ee98 100644 --- a/hammond-gtk/src/views/podcasts.rs +++ b/hammond-gtk/src/views/shows.rs @@ -12,14 +12,14 @@ use content::ShowStack; use std::rc::Rc; #[derive(Debug, Clone)] -pub struct PopulatedView { +pub struct ShowsPopulated { pub container: gtk::Box, pub flowbox: gtk::FlowBox, viewport: gtk::Viewport, } #[derive(Debug)] -struct PodcastChild { +struct ShowsChild { container: gtk::Box, title: gtk::Label, cover: gtk::Image, @@ -28,14 +28,14 @@ struct PodcastChild { child: gtk::FlowBoxChild, } -impl PopulatedView { - pub fn new() -> PopulatedView { +impl ShowsPopulated { + pub fn new() -> ShowsPopulated { let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/podcasts_view.ui"); let container: gtk::Box = builder.get_object("fb_parent").unwrap(); let flowbox: gtk::FlowBox = builder.get_object("flowbox").unwrap(); let viewport: gtk::Viewport = builder.get_object("viewport").unwrap(); - PopulatedView { + ShowsPopulated { container, flowbox, viewport, @@ -43,8 +43,8 @@ impl PopulatedView { } #[allow(dead_code)] - pub fn new_initialized(show: Rc) -> PopulatedView { - let pop = PopulatedView::new(); + pub fn new_initialized(show: Rc) -> ShowsPopulated { + let pop = ShowsPopulated::new(); pop.init(show); pop } @@ -75,7 +75,7 @@ impl PopulatedView { if let Ok(pds) = podcasts { pds.iter().for_each(|parent| { - let flowbox_child = PodcastChild::new_initialized(parent); + let flowbox_child = ShowsChild::new_initialized(parent); self.flowbox.add(&flowbox_child.child); }); self.flowbox.show_all(); @@ -87,8 +87,8 @@ impl PopulatedView { } } -impl PodcastChild { - fn new() -> PodcastChild { +impl ShowsChild { + fn new() -> ShowsChild { let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/podcasts_child.ui"); // Copy of gnome-music AlbumWidget @@ -101,7 +101,7 @@ impl PodcastChild { let child = gtk::FlowBoxChild::new(); child.add(&container); - PodcastChild { + ShowsChild { container, title, cover, @@ -123,8 +123,8 @@ impl PodcastChild { self.configure_banner(pd); } - pub fn new_initialized(pd: &Podcast) -> PodcastChild { - let child = PodcastChild::new(); + pub fn new_initialized(pd: &Podcast) -> ShowsChild { + let child = ShowsChild::new(); child.init(pd); child diff --git a/hammond-gtk/src/widgets/episode.rs b/hammond-gtk/src/widgets/episode.rs index 7166d0c..e69efd1 100644 --- a/hammond-gtk/src/widgets/episode.rs +++ b/hammond-gtk/src/widgets/episode.rs @@ -13,8 +13,6 @@ use hammond_data::utils::*; use hammond_data::errors::*; use hammond_data::utils::replace_extra_spaces; -// use utils::html_to_markup; - use std::thread; use std::cell::RefCell; use std::sync::mpsc::{channel, Receiver}; diff --git a/hammond-gtk/src/widgets/mod.rs b/hammond-gtk/src/widgets/mod.rs index 5752aa3..d33f990 100644 --- a/hammond-gtk/src/widgets/mod.rs +++ b/hammond-gtk/src/widgets/mod.rs @@ -1,2 +1,2 @@ -pub mod podcast; +pub mod show; pub mod episode; diff --git a/hammond-gtk/src/widgets/podcast.rs b/hammond-gtk/src/widgets/show.rs similarity index 95% rename from hammond-gtk/src/widgets/podcast.rs rename to hammond-gtk/src/widgets/show.rs index 1d7f91b..b21bb06 100644 --- a/hammond-gtk/src/widgets/podcast.rs +++ b/hammond-gtk/src/widgets/show.rs @@ -14,7 +14,7 @@ use content::ShowStack; use std::rc::Rc; #[derive(Debug, Clone)] -pub struct PodcastWidget { +pub struct ShowWidget { pub container: gtk::Box, cover: gtk::Image, title: gtk::Label, @@ -24,8 +24,8 @@ pub struct PodcastWidget { played: gtk::Button, } -impl PodcastWidget { - pub fn new() -> PodcastWidget { +impl ShowWidget { + pub fn new() -> ShowWidget { // Adapted from gnome-music AlbumWidget let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/podcast_widget.ui"); let container: gtk::Box = builder.get_object("podcast_widget").unwrap(); @@ -37,7 +37,7 @@ impl PodcastWidget { let unsub: gtk::Button = builder.get_object("unsub_button").unwrap(); let played: gtk::Button = builder.get_object("mark_all_played_button").unwrap(); - PodcastWidget { + ShowWidget { container, cover, title, @@ -48,8 +48,8 @@ impl PodcastWidget { } } - pub fn new_initialized(shows: Rc, pd: &Podcast) -> PodcastWidget { - let pdw = PodcastWidget::new(); + pub fn new_initialized(shows: Rc, pd: &Podcast) -> ShowWidget { + let pdw = ShowWidget::new(); pdw.init(shows, pd); pdw }