Fix empty view.
This commit is contained in:
parent
3fca086d14
commit
fb6fc68d23
5
TODO.md
5
TODO.md
@ -1,14 +1,9 @@
|
|||||||
## TODOs:
|
## TODOs:
|
||||||
|
|
||||||
**General:**
|
|
||||||
|
|
||||||
- [ ] Write docs
|
|
||||||
|
|
||||||
## Planned Features
|
## Planned Features
|
||||||
|
|
||||||
## Priorities:
|
## 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.
|
- [ ] Unplayed Only and Downloaded only view.
|
||||||
- [ ] Auto-updater
|
- [ ] Auto-updater
|
||||||
- [ ] OPML import/export // Probably need to create a crate.
|
- [ ] OPML import/export // Probably need to create a crate.
|
||||||
|
|||||||
@ -11,12 +11,20 @@ use views::empty::EmptyView;
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Content {
|
pub struct Content {
|
||||||
pub stack: gtk::Stack,
|
pub stack: gtk::Stack,
|
||||||
pub state: ContentState,
|
|
||||||
widget: PodcastWidget,
|
widget: PodcastWidget,
|
||||||
pub podcasts: PopulatedView,
|
podcasts: PopulatedView,
|
||||||
empty: EmptyView,
|
empty: EmptyView,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #[derive(Debug)]
|
||||||
|
// pub struct Content {
|
||||||
|
// pub stack: gtk::Stack,
|
||||||
|
// pub state: ContentState,
|
||||||
|
// widget: PodcastWidget,
|
||||||
|
// pub podcasts: PopulatedView,
|
||||||
|
// empty: EmptyView,
|
||||||
|
// }
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
// TODO: find a way to wrap gtk::Stack into a State machine.
|
// TODO: find a way to wrap gtk::Stack into a State machine.
|
||||||
@ -32,12 +40,9 @@ impl Content {
|
|||||||
let widget = PodcastWidget::new();
|
let widget = PodcastWidget::new();
|
||||||
let pop = PopulatedView::new();
|
let pop = PopulatedView::new();
|
||||||
let empty = EmptyView::new();
|
let empty = EmptyView::new();
|
||||||
// TODO: Avoid cloning
|
|
||||||
let state = ContentState::Populated(pop.clone());
|
|
||||||
|
|
||||||
let content = Content {
|
let content = Content {
|
||||||
stack,
|
stack,
|
||||||
state,
|
|
||||||
widget,
|
widget,
|
||||||
empty,
|
empty,
|
||||||
podcasts: pop,
|
podcasts: pop,
|
||||||
@ -55,12 +60,14 @@ impl Content {
|
|||||||
self.stack.add_named(&self.podcasts.container, "podcasts");
|
self.stack.add_named(&self.podcasts.container, "podcasts");
|
||||||
self.stack.add_named(&self.empty.container, "empty");
|
self.stack.add_named(&self.empty.container, "empty");
|
||||||
|
|
||||||
// FIXME: needs actuall logic
|
|
||||||
self.stack.set_visible_child_name("podcasts")
|
self.stack.set_visible_child_name("podcasts")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init(&self) {
|
fn init(&self) {
|
||||||
self.setup_stack();
|
self.setup_stack();
|
||||||
self.podcasts.init(&self.stack);
|
self.podcasts.init(&self.stack);
|
||||||
|
if self.podcasts.flowbox.get_children().is_empty() {
|
||||||
|
self.stack.set_visible_child_name("empty");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ use utils::get_pixbuf_from_path;
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct PopulatedView {
|
pub struct PopulatedView {
|
||||||
pub container: gtk::Box,
|
pub container: gtk::Box,
|
||||||
flowbox: gtk::FlowBox,
|
pub flowbox: gtk::FlowBox,
|
||||||
viewport: gtk::Viewport,
|
viewport: gtk::Viewport,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user