wip
This commit is contained in:
parent
630804c5b5
commit
f50ea21499
89
podcasts-gtk/src/stacks/main_stack.rs
Normal file
89
podcasts-gtk/src/stacks/main_stack.rs
Normal file
@ -0,0 +1,89 @@
|
||||
// main_stack.rs
|
||||
//
|
||||
// Copyright 2019 Jordan Petridis <jpetridis@gnome.org>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
use crossbeam_channel::Sender;
|
||||
use failure::Error;
|
||||
|
||||
use crate::app::Action;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
||||
use crate::i18n::i18n;
|
||||
|
||||
use gtk::{self, prelude::*};
|
||||
|
||||
use crate:: widgets::{EpisodeWidget, EmptyView, ShowWidget, HomeView, ShowsView};
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub (crate) enum State {
|
||||
Empty, // Empty view in case you are not subbed into any shows
|
||||
Home, // ListBox with the latests episodes
|
||||
ShowsFlwobox, // Flowbox to browse all the shows you are subbed
|
||||
ShowDetails, // 2 States, either empty or episodes list
|
||||
EpisodeDetails, // WebView that shows the html description
|
||||
DisoverView, // Way into the future view ??
|
||||
}
|
||||
|
||||
struct StackWrapper {
|
||||
state: State,
|
||||
stack: gtk::Stack,
|
||||
}
|
||||
|
||||
pub struct PodcastsStack {
|
||||
sender: Sender<Action>,
|
||||
stack: StackWrapper,
|
||||
empty_view: Rc<EmptyView>,
|
||||
home: Rc<HomeView>,
|
||||
shows_flowbox: Rc<ShowsView>,
|
||||
show_details: Rc<ShowWidget>,
|
||||
// episdoe: Rc<EpisodeDetails>,
|
||||
// discover: unimplemented!(),
|
||||
}
|
||||
|
||||
impl PodcastsStack {
|
||||
fn new(sender: Sender<Action>) -> Self {
|
||||
let stack = StackWrapper {
|
||||
state: State::Empty,
|
||||
stack: gtk::Stack::new(),
|
||||
};
|
||||
|
||||
let empty = Rc::new(EmptyView::default());
|
||||
let home = HomeView::new(sender.clone(), None).expect("Could not create a HomeView");
|
||||
let shows = ShowsView::new(sender.clone(), None);
|
||||
let show = Rc::new(ShowWidget::default());
|
||||
// let episode = EpisodeDetails::default();
|
||||
|
||||
// stack.add_titled(&home.borrow().get_stack(), "home", &i18n("New"));
|
||||
// stack.add_titled(&shows.borrow().get_stack(), "shows", &i18n("Shows"));
|
||||
|
||||
PodcastsStack {
|
||||
sender,
|
||||
stack,
|
||||
empty_view: empty,
|
||||
home,
|
||||
shows_flowbox: shows,
|
||||
show_details: show,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user