Small refinements, handling of unwraps, addin of TODOs and other Notes.
This commit is contained in:
parent
70d1f44147
commit
590e99b7e8
@ -1,3 +1,8 @@
|
||||
-- Till version 0.2 is released the plan is to edited directly and dont expect
|
||||
-- any kind of non-braking changes.
|
||||
-- After there is a stable prototype, Only diesel migrations will be used
|
||||
-- in order to change the db schema.
|
||||
|
||||
CREATE TABLE `source` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
|
||||
`uri` TEXT NOT NULL UNIQUE,
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
<property name="lines">3</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.20.1 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkApplicationWindow" id="window1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="default_width">1000</property>
|
||||
<property name="default_height">600</property>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@ -30,10 +30,15 @@ pub fn get_headerbar(db: Arc<Mutex<SqliteConnection>>, stack: gtk::Stack) -> gtk
|
||||
|
||||
add_button.connect_clicked(move |_| {
|
||||
let tempdb = db_clone.lock().unwrap();
|
||||
let url = new_url.get_text().unwrap();
|
||||
let _ = index_feed::insert_return_source(&tempdb, &url);
|
||||
let url = new_url.get_text().unwrap_or_default();
|
||||
// TODO: check if the feed is already present.
|
||||
let f = index_feed::insert_return_source(&tempdb, &url);
|
||||
drop(tempdb);
|
||||
info!("{:?} feed added", url);
|
||||
if f.is_err() {
|
||||
error!("Expected Error, feed probably already exists.");
|
||||
error!("Error: {:?}", f.unwrap_err());
|
||||
}
|
||||
|
||||
// update the db
|
||||
utils::refresh_db(db_clone.clone());
|
||||
|
||||
@ -30,7 +30,6 @@ use views::podcasts_view;
|
||||
|
||||
/*
|
||||
THIS IS STILL A PROTOTYPE.
|
||||
THE CODE IS TERIBLE AND USES UNWRAPS EVERYWHERE.
|
||||
*/
|
||||
|
||||
fn build_ui(app: >k::Application) {
|
||||
@ -42,7 +41,6 @@ fn build_ui(app: >k::Application) {
|
||||
app.add_window(&window);
|
||||
// Setup the Stack that will magane the switche between podcasts_view and podcast_widget.
|
||||
let stack = podcasts_view::setup_stack(db.clone());
|
||||
// Populate the flowbox with the Podcasts.
|
||||
window.add(&stack);
|
||||
|
||||
// FIXME:
|
||||
@ -66,7 +64,7 @@ fn build_ui(app: >k::Application) {
|
||||
// ddcb30d01631c0083710cf486caf04c831d38cb7/src/process_viewer.rs#L367
|
||||
fn main() {
|
||||
loggerv::init_with_level(LogLevel::Info).unwrap();
|
||||
hammond_data::init().unwrap();
|
||||
hammond_data::init().expect("Hammond Initialazation failed.");
|
||||
|
||||
// Not sure if needed.
|
||||
if gtk::init().is_err() {
|
||||
|
||||
@ -7,7 +7,10 @@ use std::sync::{Arc, Mutex};
|
||||
pub fn refresh_db(db: Arc<Mutex<SqliteConnection>>) {
|
||||
let db_clone = db.clone();
|
||||
thread::spawn(move || {
|
||||
// FIXME: Handle unwrap
|
||||
hammond_data::index_feed::index_loop(db_clone.clone(), false).unwrap();
|
||||
let t = hammond_data::index_feed::index_loop(db_clone.clone(), false);
|
||||
if t.is_err() {
|
||||
error!("Error While trying to update the database.");
|
||||
error!("Error msg: {}", t.unwrap_err());
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@ -30,7 +30,6 @@ pub fn populate_podcasts_flowbox(
|
||||
let image_uri = pd_model.get_value(&iter, 4).get::<String>();
|
||||
|
||||
let imgpath = downloader::cache_image(&title, image_uri.as_ref().map(|s| s.as_str()));
|
||||
|
||||
let pixbuf = if let Some(i) = imgpath {
|
||||
Pixbuf::new_from_file_at_scale(&i, 200, 200, true).ok()
|
||||
} else {
|
||||
@ -80,6 +79,7 @@ fn setup_podcasts_grid(db: Arc<Mutex<SqliteConnection>>, stack: gtk::Stack) {
|
||||
// Adapted copy of the way gnome-music does albumview
|
||||
// FIXME: flowbox childs activate with space/enter but not with clicks.
|
||||
let flowbox: gtk::FlowBox = builder.get_object("flowbox").unwrap();
|
||||
// Populate the flowbox with the Podcasts.
|
||||
populate_podcasts_flowbox(db.clone(), stack.clone(), flowbox.clone());
|
||||
}
|
||||
|
||||
|
||||
@ -73,6 +73,7 @@ fn epidose_widget(
|
||||
}
|
||||
|
||||
pub fn episodes_listbox(connection: Arc<Mutex<SqliteConnection>>, pd_title: &str) -> gtk::ListBox {
|
||||
// TODO: handle unwraps.
|
||||
let m = connection.lock().unwrap();
|
||||
let pd = dbqueries::load_podcast(&m, pd_title).unwrap();
|
||||
let mut episodes = dbqueries::get_pd_episodes(&m, &pd).unwrap();
|
||||
|
||||
@ -66,7 +66,7 @@ pub fn create_flowbox_child(title: &str, cover: Option<Pixbuf>) -> gtk::FlowBoxC
|
||||
|
||||
let fbc = gtk::FlowBoxChild::new();
|
||||
fbc.add(&box_);
|
||||
info!("flowbox child created");
|
||||
// info!("flowbox child created");
|
||||
fbc
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user