Move and rename stuff.
This commit is contained in:
parent
d5d55d4ef3
commit
5defb5867a
@ -4,9 +4,10 @@ use gtk::prelude::*;
|
|||||||
use hammond_data::Podcast;
|
use hammond_data::Podcast;
|
||||||
use hammond_data::dbqueries;
|
use hammond_data::dbqueries;
|
||||||
|
|
||||||
use views::podcasts::PopulatedView;
|
use views::shows::ShowsPopulated;
|
||||||
use views::empty::EmptyView;
|
use views::empty::EmptyView;
|
||||||
use widgets::podcast::PodcastWidget;
|
|
||||||
|
use widgets::show::ShowWidget;
|
||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
@ -50,8 +51,8 @@ impl ShowStack {
|
|||||||
|
|
||||||
let show = Rc::new(ShowStack { stack });
|
let show = Rc::new(ShowStack { stack });
|
||||||
|
|
||||||
let pop = PopulatedView::new_initialized(show.clone());
|
let pop = ShowsPopulated::new_initialized(show.clone());
|
||||||
let widget = PodcastWidget::new();
|
let widget = ShowWidget::new();
|
||||||
let empty = EmptyView::new();
|
let empty = EmptyView::new();
|
||||||
|
|
||||||
show.stack.add_named(&pop.container, "podcasts");
|
show.stack.add_named(&pop.container, "podcasts");
|
||||||
@ -80,7 +81,7 @@ impl ShowStack {
|
|||||||
let vis = self.stack.get_visible_child_name().unwrap();
|
let vis = self.stack.get_visible_child_name().unwrap();
|
||||||
let old = self.stack.get_child_by_name("podcasts").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()));
|
pop.init(Rc::new(self.clone()));
|
||||||
|
|
||||||
self.stack.remove(&old);
|
self.stack.remove(&old);
|
||||||
@ -99,7 +100,7 @@ impl ShowStack {
|
|||||||
|
|
||||||
pub fn replace_widget(&self, pd: &Podcast) {
|
pub fn replace_widget(&self, pd: &Podcast) {
|
||||||
let old = self.stack.get_child_by_name("widget").unwrap();
|
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.remove(&old);
|
||||||
self.stack.add_named(&new.container, "widget");
|
self.stack.add_named(&new.container, "widget");
|
||||||
|
|||||||
1
hammond-gtk/src/views/episodes.rs
Normal file
1
hammond-gtk/src/views/episodes.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
||||||
@ -1,2 +1,3 @@
|
|||||||
pub mod podcasts;
|
pub mod shows;
|
||||||
|
pub mod episodes;
|
||||||
pub mod empty;
|
pub mod empty;
|
||||||
|
|||||||
@ -12,14 +12,14 @@ use content::ShowStack;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct PopulatedView {
|
pub struct ShowsPopulated {
|
||||||
pub container: gtk::Box,
|
pub container: gtk::Box,
|
||||||
pub flowbox: gtk::FlowBox,
|
pub flowbox: gtk::FlowBox,
|
||||||
viewport: gtk::Viewport,
|
viewport: gtk::Viewport,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct PodcastChild {
|
struct ShowsChild {
|
||||||
container: gtk::Box,
|
container: gtk::Box,
|
||||||
title: gtk::Label,
|
title: gtk::Label,
|
||||||
cover: gtk::Image,
|
cover: gtk::Image,
|
||||||
@ -28,14 +28,14 @@ struct PodcastChild {
|
|||||||
child: gtk::FlowBoxChild,
|
child: gtk::FlowBoxChild,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PopulatedView {
|
impl ShowsPopulated {
|
||||||
pub fn new() -> PopulatedView {
|
pub fn new() -> ShowsPopulated {
|
||||||
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/podcasts_view.ui");
|
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 container: gtk::Box = builder.get_object("fb_parent").unwrap();
|
||||||
let flowbox: gtk::FlowBox = builder.get_object("flowbox").unwrap();
|
let flowbox: gtk::FlowBox = builder.get_object("flowbox").unwrap();
|
||||||
let viewport: gtk::Viewport = builder.get_object("viewport").unwrap();
|
let viewport: gtk::Viewport = builder.get_object("viewport").unwrap();
|
||||||
|
|
||||||
PopulatedView {
|
ShowsPopulated {
|
||||||
container,
|
container,
|
||||||
flowbox,
|
flowbox,
|
||||||
viewport,
|
viewport,
|
||||||
@ -43,8 +43,8 @@ impl PopulatedView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn new_initialized(show: Rc<ShowStack>) -> PopulatedView {
|
pub fn new_initialized(show: Rc<ShowStack>) -> ShowsPopulated {
|
||||||
let pop = PopulatedView::new();
|
let pop = ShowsPopulated::new();
|
||||||
pop.init(show);
|
pop.init(show);
|
||||||
pop
|
pop
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ impl PopulatedView {
|
|||||||
|
|
||||||
if let Ok(pds) = podcasts {
|
if let Ok(pds) = podcasts {
|
||||||
pds.iter().for_each(|parent| {
|
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.add(&flowbox_child.child);
|
||||||
});
|
});
|
||||||
self.flowbox.show_all();
|
self.flowbox.show_all();
|
||||||
@ -87,8 +87,8 @@ impl PopulatedView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PodcastChild {
|
impl ShowsChild {
|
||||||
fn new() -> PodcastChild {
|
fn new() -> ShowsChild {
|
||||||
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/podcasts_child.ui");
|
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/podcasts_child.ui");
|
||||||
|
|
||||||
// Copy of gnome-music AlbumWidget
|
// Copy of gnome-music AlbumWidget
|
||||||
@ -101,7 +101,7 @@ impl PodcastChild {
|
|||||||
let child = gtk::FlowBoxChild::new();
|
let child = gtk::FlowBoxChild::new();
|
||||||
child.add(&container);
|
child.add(&container);
|
||||||
|
|
||||||
PodcastChild {
|
ShowsChild {
|
||||||
container,
|
container,
|
||||||
title,
|
title,
|
||||||
cover,
|
cover,
|
||||||
@ -123,8 +123,8 @@ impl PodcastChild {
|
|||||||
self.configure_banner(pd);
|
self.configure_banner(pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_initialized(pd: &Podcast) -> PodcastChild {
|
pub fn new_initialized(pd: &Podcast) -> ShowsChild {
|
||||||
let child = PodcastChild::new();
|
let child = ShowsChild::new();
|
||||||
child.init(pd);
|
child.init(pd);
|
||||||
|
|
||||||
child
|
child
|
||||||
@ -13,8 +13,6 @@ use hammond_data::utils::*;
|
|||||||
use hammond_data::errors::*;
|
use hammond_data::errors::*;
|
||||||
use hammond_data::utils::replace_extra_spaces;
|
use hammond_data::utils::replace_extra_spaces;
|
||||||
|
|
||||||
// use utils::html_to_markup;
|
|
||||||
|
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::sync::mpsc::{channel, Receiver};
|
use std::sync::mpsc::{channel, Receiver};
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
pub mod podcast;
|
pub mod show;
|
||||||
pub mod episode;
|
pub mod episode;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ use content::ShowStack;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct PodcastWidget {
|
pub struct ShowWidget {
|
||||||
pub container: gtk::Box,
|
pub container: gtk::Box,
|
||||||
cover: gtk::Image,
|
cover: gtk::Image,
|
||||||
title: gtk::Label,
|
title: gtk::Label,
|
||||||
@ -24,8 +24,8 @@ pub struct PodcastWidget {
|
|||||||
played: gtk::Button,
|
played: gtk::Button,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PodcastWidget {
|
impl ShowWidget {
|
||||||
pub fn new() -> PodcastWidget {
|
pub fn new() -> ShowWidget {
|
||||||
// Adapted from gnome-music AlbumWidget
|
// Adapted from gnome-music AlbumWidget
|
||||||
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/podcast_widget.ui");
|
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/podcast_widget.ui");
|
||||||
let container: gtk::Box = builder.get_object("podcast_widget").unwrap();
|
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 unsub: gtk::Button = builder.get_object("unsub_button").unwrap();
|
||||||
let played: gtk::Button = builder.get_object("mark_all_played_button").unwrap();
|
let played: gtk::Button = builder.get_object("mark_all_played_button").unwrap();
|
||||||
|
|
||||||
PodcastWidget {
|
ShowWidget {
|
||||||
container,
|
container,
|
||||||
cover,
|
cover,
|
||||||
title,
|
title,
|
||||||
@ -48,8 +48,8 @@ impl PodcastWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_initialized(shows: Rc<ShowStack>, pd: &Podcast) -> PodcastWidget {
|
pub fn new_initialized(shows: Rc<ShowStack>, pd: &Podcast) -> ShowWidget {
|
||||||
let pdw = PodcastWidget::new();
|
let pdw = ShowWidget::new();
|
||||||
pdw.init(shows, pd);
|
pdw.init(shows, pd);
|
||||||
pdw
|
pdw
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user