IT DISPLAYS STUFF!!

This commit is contained in:
Jordan Petridis 2017-10-10 01:26:16 +03:00
parent 10fd018f1f
commit 9e7a6f5ecd
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
4 changed files with 17 additions and 6 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
**/*.rs.bk
Cargo.lock
.vscode
*.ui~

View File

@ -6,4 +6,5 @@ authors = ["Jordan Petridis <jordanpetridis@protonmail.com>"]
[dependencies]
gtk = { version = "0.2.0", features = ["v3_22"]}
glib = "0.3.0"
gdk-pixbuf = "0.2.0"
gdk-pixbuf = "0.2.0"
hammond-data = {path = "../hammond-data"}

View File

@ -9,7 +9,7 @@
<property name="subtitle">World!</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkButton" id="RefButton">
<object class="GtkButton" id="refbutton">
<property name="label">gtk-refresh</property>
<property name="visible">True</property>
<property name="can_focus">True</property>

View File

@ -1,18 +1,23 @@
// extern crate glib;
extern crate gtk;
// extern crate gdk_pixbuf;
extern crate hammond_data;
use gtk::prelude::*;
use gtk::Orientation;
use gtk::IconSize;
// use gtk::{CellRendererText, TreeStore, TreeView, TreeViewColumn};
use hammond_data::dbqueries;
use gtk::prelude::*;
// TODO: setup a img downloader, caching system, and then display them.
fn create_child(name: &str) -> gtk::Box {
let box_ = gtk::Box::new(Orientation::Vertical, 5);
let img = gtk::Image::new_from_icon_name("gtk-missing-image", IconSize::Menu.into());
let label = gtk::Label::new(name);
box_.set_size_request(200, 200);
box_.pack_start(&img, true, true, 0);
box_.pack_start(&label, false, false, 0);
box_
@ -24,7 +29,7 @@ fn main() {
return;
}
// Direct copy of the way gnome-music does albumview
// Adapted copy of the way gnome-music does albumview
let glade_src = include_str!("../gtk/foo.ui");
let builder = gtk::Builder::new_from_string(glade_src);
@ -41,12 +46,16 @@ fn main() {
});
let flowbox: gtk::FlowBox = builder.get_object("flowbox1").unwrap();
for _ in 0..10 {
let f = create_child("placeholder");
// TODO: This should be in a TreeStore.
let db = hammond_data::establish_connection();
let podcasts = dbqueries::get_podcasts(&db).unwrap();
for pd in &podcasts {
let f = create_child(pd.title());
flowbox.add(&f);
}
window.show_all();
gtk::main();
}