Fix empty view.

This commit is contained in:
Jordan Petridis 2017-12-01 06:00:06 +02:00
parent 3fca086d14
commit fb6fc68d23
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
3 changed files with 14 additions and 12 deletions

View File

@ -1,14 +1,9 @@
## TODOs:
**General:**
- [ ] Write docs
## Planned Features
## Priorities:
- [ ] Discuss and decide when to schedule the download cleaner. [#3](https://gitlab.gnome.org/alatiera/Hammond/issues/3)
- [ ] Unplayed Only and Downloaded only view.
- [ ] Auto-updater
- [ ] OPML import/export // Probably need to create a crate.

View File

@ -11,12 +11,20 @@ use views::empty::EmptyView;
#[derive(Debug)]
pub struct Content {
pub stack: gtk::Stack,
pub state: ContentState,
widget: PodcastWidget,
pub podcasts: PopulatedView,
podcasts: PopulatedView,
empty: EmptyView,
}
// #[derive(Debug)]
// pub struct Content {
// pub stack: gtk::Stack,
// pub state: ContentState,
// widget: PodcastWidget,
// pub podcasts: PopulatedView,
// empty: EmptyView,
// }
#[derive(Debug)]
#[allow(dead_code)]
// TODO: find a way to wrap gtk::Stack into a State machine.
@ -32,12 +40,9 @@ impl Content {
let widget = PodcastWidget::new();
let pop = PopulatedView::new();
let empty = EmptyView::new();
// TODO: Avoid cloning
let state = ContentState::Populated(pop.clone());
let content = Content {
stack,
state,
widget,
empty,
podcasts: pop,
@ -55,12 +60,14 @@ impl Content {
self.stack.add_named(&self.podcasts.container, "podcasts");
self.stack.add_named(&self.empty.container, "empty");
// FIXME: needs actuall logic
self.stack.set_visible_child_name("podcasts")
}
fn init(&self) {
self.setup_stack();
self.podcasts.init(&self.stack);
if self.podcasts.flowbox.get_children().is_empty() {
self.stack.set_visible_child_name("empty");
}
}
}

View File

@ -12,7 +12,7 @@ use utils::get_pixbuf_from_path;
#[derive(Debug, Clone)]
pub struct PopulatedView {
pub container: gtk::Box,
flowbox: gtk::FlowBox,
pub flowbox: gtk::FlowBox,
viewport: gtk::Viewport,
}