Headerbar: ::new() method now returns Rc<Self>.

This commit is contained in:
Jordan Petridis 2018-06-27 18:20:45 +03:00
parent 301ebdbcd8
commit 5d6fbb6f04
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
2 changed files with 6 additions and 4 deletions

View File

@ -88,7 +88,7 @@ impl App {
let content = Content::new(&sender).expect("Content Initialization failed.");
// Create the headerbar
let header = Rc::new(Header::new(&content, &window, &sender));
let header = Header::new(&content, &window, &sender);
// Add the content main stack to the overlay.
let overlay = gtk::Overlay::new();

View File

@ -14,6 +14,8 @@ use app::Action;
use stacks::Content;
use utils::{itunes_to_rss, refresh};
use std::rc::Rc;
#[derive(Debug, Clone)]
// TODO: split this into smaller
pub struct Header {
@ -60,14 +62,14 @@ impl Default for Header {
}
}
// TODO: Refactor components into smaller state machines
// TODO: Refactor components into smaller widgets.
impl Header {
pub fn new(
content: &Content,
window: &gtk::ApplicationWindow,
sender: &Sender<Action>,
) -> Header {
let h = Header::default();
) -> Rc<Self> {
let h = Rc::new(Header::default());
h.init(content, window, &sender);
h
}