unwrap handling.
This commit is contained in:
parent
401c13eee7
commit
893218346d
@ -5,6 +5,7 @@ use hammond_data::models::Episode;
|
|||||||
use hammond_downloader::downloader;
|
use hammond_downloader::downloader;
|
||||||
use hammond_data::index_feed::Database;
|
use hammond_data::index_feed::Database;
|
||||||
use hammond_data::dbcheckup::*;
|
use hammond_data::dbcheckup::*;
|
||||||
|
use hammond_data::errors::*;
|
||||||
|
|
||||||
use dissolve::strip_html_tags;
|
use dissolve::strip_html_tags;
|
||||||
|
|
||||||
@ -133,7 +134,7 @@ fn epidose_widget(db: &Database, episode: &mut Episode, pd_title: &str) -> gtk::
|
|||||||
ep
|
ep
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: show notification when dl is finished and block play_bttn till then.
|
// TODO: show notification when dl is finished.
|
||||||
fn on_download_clicked(
|
fn on_download_clicked(
|
||||||
db: &Database,
|
db: &Database,
|
||||||
pd_title: &str,
|
pd_title: &str,
|
||||||
@ -215,11 +216,10 @@ fn receive() -> glib::Continue {
|
|||||||
glib::Continue(false)
|
glib::Continue(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn episodes_listbox(db: &Database, pd_title: &str) -> gtk::ListBox {
|
pub fn episodes_listbox(db: &Database, pd_title: &str) -> Result<gtk::ListBox> {
|
||||||
// TODO: handle unwraps.
|
|
||||||
let conn = db.lock().unwrap();
|
let conn = db.lock().unwrap();
|
||||||
let pd = dbqueries::load_podcast_from_title(&conn, pd_title).unwrap();
|
let pd = dbqueries::load_podcast_from_title(&conn, pd_title)?;
|
||||||
let mut episodes = dbqueries::get_pd_episodes(&conn, &pd).unwrap();
|
let mut episodes = dbqueries::get_pd_episodes(&conn, &pd)?;
|
||||||
drop(conn);
|
drop(conn);
|
||||||
|
|
||||||
let list = gtk::ListBox::new();
|
let list = gtk::ListBox::new();
|
||||||
@ -232,5 +232,5 @@ pub fn episodes_listbox(db: &Database, pd_title: &str) -> gtk::ListBox {
|
|||||||
list.set_hexpand(false);
|
list.set_hexpand(false);
|
||||||
list.set_visible(true);
|
list.set_visible(true);
|
||||||
list.set_selection_mode(gtk::SelectionMode::None);
|
list.set_selection_mode(gtk::SelectionMode::None);
|
||||||
list
|
Ok(list)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,14 +45,16 @@ pub fn podcast_widget(db: &Database, stack: >k::Stack, pd: &Podcast) -> gtk::B
|
|||||||
.get_object("mark_all_played_button")
|
.get_object("mark_all_played_button")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// TODO: spawn a thread to avoid locking the UI probably.
|
// TODO: should spawn a thread to avoid locking the UI probably.
|
||||||
unsub_button.connect_clicked(clone!(db, stack, pd => move |bttn| {
|
unsub_button.connect_clicked(clone!(db, stack, pd => move |bttn| {
|
||||||
on_unsub_button_clicked(&db, &stack, &pd, bttn);
|
on_unsub_button_clicked(&db, &stack, &pd, bttn);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
title_label.set_text(pd.title());
|
title_label.set_text(pd.title());
|
||||||
let listbox = episodes_listbox(db, pd.title());
|
let listbox = episodes_listbox(db, pd.title());
|
||||||
view.add(&listbox);
|
if let Ok(l) = listbox {
|
||||||
|
view.add(&l);
|
||||||
|
}
|
||||||
|
|
||||||
desc_label.set_text(pd.description());
|
desc_label.set_text(pd.description());
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user