h-gtk: Rename HomeView and ShowView parent modules.
This commit is contained in:
parent
b0c692ab7d
commit
72a6832571
@ -122,7 +122,7 @@ $ tree -d
|
||||
│ ├── resources # GResources folder
|
||||
│ │ └── gtk # Contains the glade.ui files.
|
||||
│ └── src
|
||||
│ ├── views # Contains the Empty, Episodes and Shows view.
|
||||
│ ├── stacks # Contains the gtk Stacks that hold all the different views.
|
||||
│ └── widgets # Contains custom widgets such as Show and Episode.
|
||||
```
|
||||
|
||||
|
||||
@ -182,12 +182,12 @@ impl App {
|
||||
Ok(Action::ShowWidgetAnimated) => {
|
||||
let shows = content.get_shows();
|
||||
let mut pop = shows.borrow().populated();
|
||||
pop.borrow_mut().switch_visible(PopulatedState::ShowWidget);
|
||||
pop.borrow_mut().switch_visible(PopulatedState::Widget);
|
||||
}
|
||||
Ok(Action::ShowShowsAnimated) => {
|
||||
let shows = content.get_shows();
|
||||
let mut pop = shows.borrow().populated();
|
||||
pop.borrow_mut().switch_visible(PopulatedState::ShowsView);
|
||||
pop.borrow_mut().switch_visible(PopulatedState::View);
|
||||
}
|
||||
Ok(Action::HeaderBarShowTile(title)) => headerbar.switch_to_back(&title),
|
||||
Ok(Action::HeaderBarNormal) => headerbar.switch_to_normal(),
|
||||
|
||||
@ -7,7 +7,7 @@ use hammond_data::dbqueries;
|
||||
use hammond_data::Podcast;
|
||||
|
||||
use app::Action;
|
||||
use widgets::{ShowWidget, ShowsPopulated};
|
||||
use widgets::{ShowWidget, ShowsView};
|
||||
|
||||
use std::rc::Rc;
|
||||
use std::sync::mpsc::Sender;
|
||||
@ -15,14 +15,14 @@ use std::sync::Arc;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum PopulatedState {
|
||||
ShowsView,
|
||||
ShowWidget,
|
||||
View,
|
||||
Widget,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PopulatedStack {
|
||||
container: gtk::Box,
|
||||
populated: Rc<ShowsPopulated>,
|
||||
populated: Rc<ShowsView>,
|
||||
show: Rc<ShowWidget>,
|
||||
stack: gtk::Stack,
|
||||
state: PopulatedState,
|
||||
@ -32,8 +32,8 @@ pub struct PopulatedStack {
|
||||
impl PopulatedStack {
|
||||
pub fn new(sender: Sender<Action>) -> Result<PopulatedStack, Error> {
|
||||
let stack = gtk::Stack::new();
|
||||
let state = PopulatedState::ShowsView;
|
||||
let populated = ShowsPopulated::new(sender.clone())?;
|
||||
let state = PopulatedState::View;
|
||||
let populated = ShowsView::new(sender.clone())?;
|
||||
let show = Rc::new(ShowWidget::default());
|
||||
let container = gtk::Box::new(gtk::Orientation::Horizontal, 0);
|
||||
|
||||
@ -63,7 +63,7 @@ impl PopulatedStack {
|
||||
let old = &self.populated.container.clone();
|
||||
debug!("Name: {:?}", WidgetExt::get_name(old));
|
||||
|
||||
let pop = ShowsPopulated::new(self.sender.clone())?;
|
||||
let pop = ShowsView::new(self.sender.clone())?;
|
||||
self.populated = pop;
|
||||
self.stack.remove(old);
|
||||
self.stack.add_named(&self.populated.container, "shows");
|
||||
@ -139,15 +139,15 @@ impl PopulatedStack {
|
||||
use self::PopulatedState::*;
|
||||
|
||||
match state {
|
||||
ShowsView => {
|
||||
View => {
|
||||
self.stack
|
||||
.set_visible_child_full("shows", gtk::StackTransitionType::SlideRight);
|
||||
self.state = ShowsView;
|
||||
self.state = View;
|
||||
}
|
||||
ShowWidget => {
|
||||
Widget => {
|
||||
self.stack
|
||||
.set_visible_child_full("widget", gtk::StackTransitionType::SlideLeft);
|
||||
self.state = ShowWidget;
|
||||
self.state = Widget;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
mod empty;
|
||||
mod episode;
|
||||
mod episode_states;
|
||||
mod home;
|
||||
mod home_view;
|
||||
mod show;
|
||||
mod shows;
|
||||
mod shows_view;
|
||||
|
||||
pub use self::empty::EmptyView;
|
||||
pub use self::episode::EpisodeWidget;
|
||||
pub use self::home::HomeView;
|
||||
pub use self::home_view::HomeView;
|
||||
pub use self::show::ShowWidget;
|
||||
pub use self::show::{mark_all_notif, remove_show_notif};
|
||||
pub use self::shows::ShowsPopulated;
|
||||
pub use self::shows_view::ShowsView;
|
||||
|
||||
@ -13,13 +13,13 @@ use std::sync::mpsc::Sender;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ShowsPopulated {
|
||||
pub struct ShowsView {
|
||||
pub container: gtk::Box,
|
||||
scrolled_window: gtk::ScrolledWindow,
|
||||
flowbox: gtk::FlowBox,
|
||||
}
|
||||
|
||||
impl Default for ShowsPopulated {
|
||||
impl Default for ShowsView {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/shows_view.ui");
|
||||
@ -27,7 +27,7 @@ impl Default for ShowsPopulated {
|
||||
let scrolled_window: gtk::ScrolledWindow = builder.get_object("scrolled_window").unwrap();
|
||||
let flowbox: gtk::FlowBox = builder.get_object("flowbox").unwrap();
|
||||
|
||||
ShowsPopulated {
|
||||
ShowsView {
|
||||
container,
|
||||
scrolled_window,
|
||||
flowbox,
|
||||
@ -35,10 +35,10 @@ impl Default for ShowsPopulated {
|
||||
}
|
||||
}
|
||||
|
||||
impl ShowsPopulated {
|
||||
impl ShowsView {
|
||||
#[inline]
|
||||
pub fn new(sender: Sender<Action>) -> Result<Rc<ShowsPopulated>, Error> {
|
||||
let pop = Rc::new(ShowsPopulated::default());
|
||||
pub fn new(sender: Sender<Action>) -> Result<Rc<Self>, Error> {
|
||||
let pop = Rc::new(ShowsView::default());
|
||||
pop.init(sender)?;
|
||||
Ok(pop)
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user