GtkApplication: Headbar and Content constructors now return Self instead of Arc<Self>.
This commit is contained in:
parent
1e722e0d58
commit
a7e3b1b99e
@ -66,10 +66,10 @@ impl App {
|
|||||||
let (sender, receiver) = channel();
|
let (sender, receiver) = channel();
|
||||||
|
|
||||||
// Create a content instance
|
// Create a content instance
|
||||||
let content = Content::new(sender.clone());
|
let content = Arc::new(Content::new(sender.clone()));
|
||||||
|
|
||||||
// Create the headerbar
|
// 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.
|
// Add the Headerbar to the window.
|
||||||
window.set_titlebar(&header.container);
|
window.set_titlebar(&header.container);
|
||||||
|
|||||||
@ -24,7 +24,7 @@ pub struct Content {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Content {
|
impl Content {
|
||||||
pub fn new(sender: Sender<Action>) -> Arc<Content> {
|
pub fn new(sender: Sender<Action>) -> Content {
|
||||||
let stack = gtk::Stack::new();
|
let stack = gtk::Stack::new();
|
||||||
let episodes = Arc::new(EpisodeStack::new(sender.clone()));
|
let episodes = Arc::new(EpisodeStack::new(sender.clone()));
|
||||||
let shows = Arc::new(ShowStack::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(&episodes.stack, "episodes", "Episodes");
|
||||||
stack.add_titled(&shows.stack, "shows", "Shows");
|
stack.add_titled(&shows.stack, "shows", "Shows");
|
||||||
|
|
||||||
Arc::new(Content {
|
Content {
|
||||||
stack,
|
stack,
|
||||||
shows,
|
shows,
|
||||||
episodes,
|
episodes,
|
||||||
sender,
|
sender,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(&self) {
|
pub fn update(&self) {
|
||||||
|
|||||||
@ -51,12 +51,10 @@ impl Default for Header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Header {
|
impl Header {
|
||||||
#[allow(dead_code)]
|
pub fn new(content: Arc<Content>, sender: Sender<Action>) -> Header {
|
||||||
// FIXME: should not return arc and stuff
|
|
||||||
pub fn new(content: Arc<Content>, sender: Sender<Action>) -> Arc<Header> {
|
|
||||||
let h = Header::default();
|
let h = Header::default();
|
||||||
h.init(content, sender);
|
h.init(content, sender);
|
||||||
Arc::new(h)
|
h
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init(&self, content: Arc<Content>, sender: Sender<Action>) {
|
pub fn init(&self, content: Arc<Content>, sender: Sender<Action>) {
|
||||||
|
|||||||
@ -104,7 +104,6 @@ impl EpisodeWidget {
|
|||||||
widget
|
widget
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: wire the cancel button.
|
|
||||||
fn init(&self, episode: &mut EpisodeWidgetQuery, sender: Sender<Action>) {
|
fn init(&self, episode: &mut EpisodeWidgetQuery, sender: Sender<Action>) {
|
||||||
WidgetExt::set_name(&self.container, &episode.rowid().to_string());
|
WidgetExt::set_name(&self.container, &episode.rowid().to_string());
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user