diff --git a/hammond-gtk/src/content.rs b/hammond-gtk/src/content.rs index 85cd98f..642078f 100644 --- a/hammond-gtk/src/content.rs +++ b/hammond-gtk/src/content.rs @@ -44,8 +44,7 @@ impl Content { podcasts: pop, }; - content.setup_stack(); - content.podcasts.init(&content.stack); + content.init(); content } @@ -57,4 +56,9 @@ impl Content { self.stack.add_named(&self.podcasts.container, "fb_parent"); // Rename into "podcasts" self.stack.add_named(&self.empty.container, "empty"); // Rename into "empty" } + + fn init(&self) { + self.setup_stack(); + self.podcasts.init(&self.stack); + } } diff --git a/hammond-gtk/src/headerbar.rs b/hammond-gtk/src/headerbar.rs index 3ccf41e..56aa666 100644 --- a/hammond-gtk/src/headerbar.rs +++ b/hammond-gtk/src/headerbar.rs @@ -9,14 +9,14 @@ use utils; #[derive(Debug)] pub struct Header { - container: gtk::HeaderBar, + pub container: gtk::HeaderBar, home: gtk::Button, refresh: gtk::Button, add_toggle: gtk::MenuButton, } impl Header { - fn new() -> Header { + pub fn new() -> Header { let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/headerbar.ui"); let header: gtk::HeaderBar = builder.get_object("headerbar1").unwrap(); @@ -32,6 +32,12 @@ impl Header { } } + pub fn new_initialized(stack: >k::Stack) -> Header { + let header = Header::new(); + header.init(stack); + header + } + fn init(&self, stack: >k::Stack) { let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/headerbar.ui"); diff --git a/hammond-gtk/src/main.rs b/hammond-gtk/src/main.rs index 56e089a..0499015 100644 --- a/hammond-gtk/src/main.rs +++ b/hammond-gtk/src/main.rs @@ -101,8 +101,10 @@ fn build_ui(app: >k::Application) { }); // Get the headerbar - let header = headerbar::get_headerbar(&stack); - window.set_titlebar(&header); + // let header = headerbar::get_headerbar(&stack); + // window.set_titlebar(&header); + let header = headerbar::Header::new_initialized(&stack); + window.set_titlebar(&header.container); window.show_all(); window.activate();