Minor cleanups.
This commit is contained in:
parent
2d4acc3ba3
commit
91ac2c6445
@ -1,38 +0,0 @@
|
|||||||
use gtk::prelude::*;
|
|
||||||
use gtk::{Window, WindowType};
|
|
||||||
|
|
||||||
use headerbar::Header;
|
|
||||||
use content::Content;
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct App<'a> {
|
|
||||||
window: Window,
|
|
||||||
header: Header,
|
|
||||||
content: Content<'a>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl <'a>App<'a> {
|
|
||||||
pub fn new() -> App<'a> {
|
|
||||||
let window = Window::new(WindowType::Toplevel);
|
|
||||||
let content = Content::new();
|
|
||||||
let header = Header::new(content.stack.clone());
|
|
||||||
|
|
||||||
window.set_default_size(1150, 650);
|
|
||||||
window.connect_delete_event(|w, _| {
|
|
||||||
w.destroy();
|
|
||||||
Inhibit(false)
|
|
||||||
});
|
|
||||||
|
|
||||||
window.set_titlebar(&header.container);
|
|
||||||
window.add(&content.stack);
|
|
||||||
|
|
||||||
window.show_all();
|
|
||||||
window.activate();
|
|
||||||
|
|
||||||
App {
|
|
||||||
window,
|
|
||||||
header,
|
|
||||||
content,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -53,9 +53,6 @@ impl Content {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn setup_stack(&self) {
|
fn setup_stack(&self) {
|
||||||
// self.stack
|
|
||||||
// .set_transition_type(gtk::StackTransitionType::SlideLeftRight);
|
|
||||||
|
|
||||||
self.stack.add_named(&self.widget.container, "widget");
|
self.stack.add_named(&self.widget.container, "widget");
|
||||||
self.stack.add_named(&self.podcasts.container, "podcasts");
|
self.stack.add_named(&self.podcasts.container, "podcasts");
|
||||||
self.stack.add_named(&self.empty.container, "empty");
|
self.stack.add_named(&self.empty.container, "empty");
|
||||||
|
|||||||
@ -65,12 +65,8 @@ fn refresh_podcasts_view() -> glib::Continue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_pixbuf_from_path(pd: &Podcast) -> Option<Pixbuf> {
|
pub fn get_pixbuf_from_path(pd: &Podcast) -> Option<Pixbuf> {
|
||||||
let img_path = downloader::cache_image(pd);
|
let img_path = downloader::cache_image(pd)?;
|
||||||
if let Some(i) = img_path {
|
Pixbuf::new_from_file_at_scale(&img_path, 256, 256, true).ok()
|
||||||
Pixbuf::new_from_file_at_scale(&i, 256, 256, true).ok()
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@ -40,6 +40,13 @@ impl PopulatedView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn new_initialized(stack: >k::Stack) -> PopulatedView {
|
||||||
|
let pop = PopulatedView::new();
|
||||||
|
pop.init(stack);
|
||||||
|
pop
|
||||||
|
}
|
||||||
|
|
||||||
pub fn init(&self, stack: >k::Stack) {
|
pub fn init(&self, stack: >k::Stack) {
|
||||||
use gtk::WidgetExt;
|
use gtk::WidgetExt;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user