Moved banner.png from assets into hammond-gtk/gtk

This commit is contained in:
Jordan Petridis 2017-11-04 11:28:10 +02:00
parent 72ac709cda
commit 7e8f39119d
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
6 changed files with 25 additions and 35 deletions

14
Cargo.lock generated
View File

@ -1105,7 +1105,7 @@ dependencies = [
"hyper-native-tls 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libflate 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_urlencoded 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1124,7 +1124,7 @@ dependencies = [
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 2.0.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)",
"native-tls 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_urlencoded 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1237,7 +1237,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde"
version = "1.0.17"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -1248,7 +1248,7 @@ dependencies = [
"dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1258,7 +1258,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1291,7 +1291,7 @@ dependencies = [
"lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_codegen 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1705,7 +1705,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum security-framework 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "dfa44ee9c54ce5eecc9de7d5acbad112ee58755239381f687e564004ba4a2332"
"checksum security-framework-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "5421621e836278a0b139268f36eee0dc7e389b784dc3f79d8f11aabadf41bead"
"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac"
"checksum serde 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "d1d023215fabcf74f35f056ec7c2e3bc492b3207443150f8673309a40ba8d10a"
"checksum serde 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "395993cac4e3599c7c1b70a6a92d3b3f55f4443df9f0b5294e362285ad7c9ecb"
"checksum serde_json 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1e67ce320daa7e494c578e34d4b00689f23bb94512fe0ca0dfaf02ea53fb67"
"checksum serde_urlencoded 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce0fd303af908732989354c6f02e05e2e6d597152870f2c6990efb0577137480"
"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -8,8 +8,7 @@ use podcasts_view::update_podcasts_view;
use utils;
pub fn get_headerbar(db: &Database, stack: &gtk::Stack) -> gtk::HeaderBar {
let builder = include_str!("../gtk/headerbar.ui");
let builder = gtk::Builder::new_from_string(builder);
let builder = gtk::Builder::new_from_string(include_str!("../gtk/headerbar.ui"));
let header: gtk::HeaderBar = builder.get_object("headerbar1").unwrap();
let home_button: gtk::Button = builder.get_object("homebutton").unwrap();

View File

@ -7,8 +7,7 @@ use hammond_data::index_feed::Database;
use widgets::podcast::*;
fn show_empty_view(stack: &gtk::Stack) {
let builder = include_str!("../../gtk/empty_view.ui");
let builder = gtk::Builder::new_from_string(builder);
let builder = gtk::Builder::new_from_string(include_str!("../../gtk/empty_view.ui"));
let view: gtk::Box = builder.get_object("empty_view").unwrap();
stack.add_named(&view, "empty");
stack.set_visible_child_name("empty");
@ -38,16 +37,14 @@ fn populate_flowbox(db: &Database, stack: &gtk::Stack, flowbox: &gtk::FlowBox) {
}
fn setup_podcast_widget(stack: &gtk::Stack) {
let pd_widget_source = include_str!("../../gtk/podcast_widget.ui");
let pd_widget_buidler = gtk::Builder::new_from_string(pd_widget_source);
let pd_widget: gtk::Box = pd_widget_buidler.get_object("podcast_widget").unwrap();
let buidler = gtk::Builder::new_from_string(include_str!("../../gtk/podcast_widget.ui"));
let pd_widget: gtk::Box = buidler.get_object("podcast_widget").unwrap();
stack.add_named(&pd_widget, "pdw");
}
fn setup_podcasts_grid(db: &Database, stack: &gtk::Stack) {
let builder = include_str!("../../gtk/podcasts_view.ui");
let builder = gtk::Builder::new_from_string(builder);
let builder = gtk::Builder::new_from_string(include_str!("../../gtk/podcasts_view.ui"));
let grid: gtk::Grid = builder.get_object("grid").unwrap();
stack.add_named(&grid, "pd_grid");
stack.set_visible_child(&grid);
@ -67,8 +64,7 @@ pub fn setup_stack(db: &Database) -> gtk::Stack {
}
pub fn update_podcasts_view(db: &Database, stack: &gtk::Stack) {
let builder = include_str!("../../gtk/podcasts_view.ui");
let builder = gtk::Builder::new_from_string(builder);
let builder = gtk::Builder::new_from_string(include_str!("../../gtk/podcasts_view.ui"));
let grid: gtk::Grid = builder.get_object("grid").unwrap();
let flowbox: gtk::FlowBox = builder.get_object("flowbox").unwrap();

View File

@ -26,8 +26,7 @@ thread_local!(
fn epidose_widget(db: &Database, episode: &mut Episode, pd_title: &str) -> gtk::Box {
// This is just a prototype and will be reworked probably.
let builder = include_str!("../../gtk/episode_widget.ui");
let builder = gtk::Builder::new_from_string(builder);
let builder = gtk::Builder::new_from_string(include_str!("../../gtk/episode_widget.ui"));
let ep: gtk::Box = builder.get_object("episode_box").unwrap();
let download_button: gtk::Button = builder.get_object("download_button").unwrap();

View File

@ -14,19 +14,15 @@ use podcasts_view::update_podcasts_view;
fn podcast_widget(db: &Database, stack: &gtk::Stack, pd: &Podcast) -> gtk::Box {
// Adapted from gnome-music AlbumWidget
let pd_widget_source = include_str!("../../gtk/podcast_widget.ui");
let pd_widget_buidler = gtk::Builder::new_from_string(pd_widget_source);
let pd_widget: gtk::Box = pd_widget_buidler.get_object("podcast_widget").unwrap();
let builder = gtk::Builder::new_from_string(include_str!("../../gtk/podcast_widget.ui"));
let pd_widget: gtk::Box = builder.get_object("podcast_widget").unwrap();
let cover: gtk::Image = pd_widget_buidler.get_object("cover").unwrap();
let title_label: gtk::Label = pd_widget_buidler.get_object("title_label").unwrap();
// let desc_label: gtk::Label = pd_widget_buidler.get_object("description_label").unwrap();
let desc_text_view: gtk::TextView = pd_widget_buidler.get_object("desc_text_view").unwrap();
let view: gtk::Viewport = pd_widget_buidler.get_object("view").unwrap();
let unsub_button: gtk::Button = pd_widget_buidler.get_object("unsub_button").unwrap();
let played_button: gtk::Button = pd_widget_buidler
.get_object("mark_all_played_button")
.unwrap();
let cover: gtk::Image = builder.get_object("cover").unwrap();
let title_label: gtk::Label = builder.get_object("title_label").unwrap();
let desc_text_view: gtk::TextView = builder.get_object("desc_text_view").unwrap();
let view: gtk::Viewport = builder.get_object("view").unwrap();
let unsub_button: gtk::Button = builder.get_object("unsub_button").unwrap();
let played_button: gtk::Button = builder.get_object("mark_all_played_button").unwrap();
// TODO: should spawn a thread to avoid locking the UI probably.
unsub_button.connect_clicked(clone!(db, stack, pd => move |bttn| {
@ -106,8 +102,7 @@ fn show_played_button(db: &Database, pd: &Podcast, played_button: &gtk::Button)
}
pub fn create_flowbox_child(db: &Database, pd: &Podcast) -> gtk::FlowBoxChild {
let build_src = include_str!("../../gtk/podcasts_child.ui");
let builder = gtk::Builder::new_from_string(build_src);
let builder = gtk::Builder::new_from_string(include_str!("../../gtk/podcasts_child.ui"));
// Copy of gnome-music AlbumWidget
let box_: gtk::Box = builder.get_object("fb_child").unwrap();
@ -132,7 +127,8 @@ pub fn create_flowbox_child(db: &Database, pd: &Podcast) -> gtk::FlowBoxChild {
}
fn configure_banner(db: &Database, pd: &Podcast, banner: &gtk::Image, banner_title: &gtk::Label) {
let bann = Pixbuf::new_from_file_at_scale("assets/banner.png", 256, 256, true);
// TODO: use GResource instead.
let bann = Pixbuf::new_from_file_at_scale("hammond-gtk/gtk/banner.png", 256, 256, true);
if let Ok(b) = bann {
banner.set_from_pixbuf(&b);