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