Content: ::new() method now returns Rc<Self>.
This commit is contained in:
parent
49bcf46b4f
commit
301ebdbcd8
@ -85,8 +85,7 @@ impl App {
|
||||
}));
|
||||
|
||||
// Create a content instance
|
||||
let content =
|
||||
Rc::new(Content::new(sender.clone()).expect("Content Initialization failed."));
|
||||
let content = Content::new(&sender).expect("Content Initialization failed.");
|
||||
|
||||
// Create the headerbar
|
||||
let header = Rc::new(Header::new(&content, &window, &sender));
|
||||
|
||||
@ -19,7 +19,7 @@ pub struct Content {
|
||||
}
|
||||
|
||||
impl Content {
|
||||
pub fn new(sender: Sender<Action>) -> Result<Content, Error> {
|
||||
pub fn new(sender: &Sender<Action>) -> Result<Rc<Content>, Error> {
|
||||
let stack = gtk::Stack::new();
|
||||
let home = Rc::new(RefCell::new(HomeStack::new(sender.clone())?));
|
||||
let shows = Rc::new(RefCell::new(ShowStack::new(sender.clone())?));
|
||||
@ -27,12 +27,13 @@ impl Content {
|
||||
stack.add_titled(&home.borrow().get_stack(), "home", "New");
|
||||
stack.add_titled(&shows.borrow().get_stack(), "shows", "Shows");
|
||||
|
||||
Ok(Content {
|
||||
let con = Content {
|
||||
stack,
|
||||
shows,
|
||||
home,
|
||||
sender,
|
||||
})
|
||||
sender: sender.clone(),
|
||||
};
|
||||
Ok(Rc::new(con))
|
||||
}
|
||||
|
||||
pub fn update(&self) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user