IT DISPLAYS STUFF!!
This commit is contained in:
parent
10fd018f1f
commit
9e7a6f5ecd
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
|||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
.vscode
|
.vscode
|
||||||
|
*.ui~
|
||||||
|
|||||||
@ -7,3 +7,4 @@ authors = ["Jordan Petridis <jordanpetridis@protonmail.com>"]
|
|||||||
gtk = { version = "0.2.0", features = ["v3_22"]}
|
gtk = { version = "0.2.0", features = ["v3_22"]}
|
||||||
glib = "0.3.0"
|
glib = "0.3.0"
|
||||||
gdk-pixbuf = "0.2.0"
|
gdk-pixbuf = "0.2.0"
|
||||||
|
hammond-data = {path = "../hammond-data"}
|
||||||
@ -9,7 +9,7 @@
|
|||||||
<property name="subtitle">World!</property>
|
<property name="subtitle">World!</property>
|
||||||
<property name="show_close_button">True</property>
|
<property name="show_close_button">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="RefButton">
|
<object class="GtkButton" id="refbutton">
|
||||||
<property name="label">gtk-refresh</property>
|
<property name="label">gtk-refresh</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|||||||
@ -1,18 +1,23 @@
|
|||||||
// extern crate glib;
|
// extern crate glib;
|
||||||
extern crate gtk;
|
extern crate gtk;
|
||||||
// extern crate gdk_pixbuf;
|
// extern crate gdk_pixbuf;
|
||||||
|
extern crate hammond_data;
|
||||||
|
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
use gtk::Orientation;
|
use gtk::Orientation;
|
||||||
use gtk::IconSize;
|
use gtk::IconSize;
|
||||||
// use gtk::{CellRendererText, TreeStore, TreeView, TreeViewColumn};
|
// use gtk::{CellRendererText, TreeStore, TreeView, TreeViewColumn};
|
||||||
|
|
||||||
|
use hammond_data::dbqueries;
|
||||||
|
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
|
|
||||||
|
// TODO: setup a img downloader, caching system, and then display them.
|
||||||
fn create_child(name: &str) -> gtk::Box {
|
fn create_child(name: &str) -> gtk::Box {
|
||||||
let box_ = gtk::Box::new(Orientation::Vertical, 5);
|
let box_ = gtk::Box::new(Orientation::Vertical, 5);
|
||||||
let img = gtk::Image::new_from_icon_name("gtk-missing-image", IconSize::Menu.into());
|
let img = gtk::Image::new_from_icon_name("gtk-missing-image", IconSize::Menu.into());
|
||||||
let label = gtk::Label::new(name);
|
let label = gtk::Label::new(name);
|
||||||
|
box_.set_size_request(200, 200);
|
||||||
box_.pack_start(&img, true, true, 0);
|
box_.pack_start(&img, true, true, 0);
|
||||||
box_.pack_start(&label, false, false, 0);
|
box_.pack_start(&label, false, false, 0);
|
||||||
box_
|
box_
|
||||||
@ -24,7 +29,7 @@ fn main() {
|
|||||||
return;
|
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 glade_src = include_str!("../gtk/foo.ui");
|
||||||
let builder = gtk::Builder::new_from_string(glade_src);
|
let builder = gtk::Builder::new_from_string(glade_src);
|
||||||
|
|
||||||
@ -41,12 +46,16 @@ fn main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let flowbox: gtk::FlowBox = builder.get_object("flowbox1").unwrap();
|
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);
|
flowbox.add(&f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
window.show_all();
|
window.show_all();
|
||||||
gtk::main();
|
gtk::main();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user