GtkApplication: Headbar and Content constructors now return Self instead of Arc<Self>.

This commit is contained in:
Jordan Petridis 2018-01-26 19:05:19 +02:00
parent 1e722e0d58
commit a7e3b1b99e
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
4 changed files with 7 additions and 10 deletions

View File

@ -66,10 +66,10 @@ impl App {
let (sender, receiver) = channel();
// Create a content instance
let content = Content::new(sender.clone());
let content = Arc::new(Content::new(sender.clone()));
// Create the headerbar
let header = Header::new(content.clone(), sender.clone());
let header = Arc::new(Header::new(content.clone(), sender.clone()));
// Add the Headerbar to the window.
window.set_titlebar(&header.container);

View File

@ -24,7 +24,7 @@ pub struct Content {
}
impl Content {
pub fn new(sender: Sender<Action>) -> Arc<Content> {
pub fn new(sender: Sender<Action>) -> Content {
let stack = gtk::Stack::new();
let episodes = Arc::new(EpisodeStack::new(sender.clone()));
let shows = Arc::new(ShowStack::new(sender.clone()));
@ -32,12 +32,12 @@ impl Content {
stack.add_titled(&episodes.stack, "episodes", "Episodes");
stack.add_titled(&shows.stack, "shows", "Shows");
Arc::new(Content {
Content {
stack,
shows,
episodes,
sender,
})
}
}
pub fn update(&self) {

View File

@ -51,12 +51,10 @@ impl Default for Header {
}
impl Header {
#[allow(dead_code)]
// FIXME: should not return arc and stuff
pub fn new(content: Arc<Content>, sender: Sender<Action>) -> Arc<Header> {
pub fn new(content: Arc<Content>, sender: Sender<Action>) -> Header {
let h = Header::default();
h.init(content, sender);
Arc::new(h)
h
}
pub fn init(&self, content: Arc<Content>, sender: Sender<Action>) {

View File

@ -104,7 +104,6 @@ impl EpisodeWidget {
widget
}
// TODO: wire the cancel button.
fn init(&self, episode: &mut EpisodeWidgetQuery, sender: Sender<Action>) {
WidgetExt::set_name(&self.container, &episode.rowid().to_string());