From ac80ab04d41d0c7365fcae33c0260717dfaab103 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Mon, 30 Oct 2017 13:02:35 +0200 Subject: [PATCH] Added the ability to mark episodes of a Podcast as watched/played. --- Cargo.lock | 162 ++++++++++++----------------- hammond-data/src/dbcheckup.rs | 2 +- hammond-data/src/dbqueries.rs | 26 +++++ hammond-data/src/index_feed.rs | 12 ++- hammond-gtk/gtk/episode_widget.ui | 52 ++++++++- hammond-gtk/gtk/podcast_widget.ui | 39 +++++-- hammond-gtk/src/widgets/episode.rs | 23 +++- hammond-gtk/src/widgets/podcast.rs | 58 ++++++++--- 8 files changed, 242 insertions(+), 132 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1d373c0..f4d27da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,20 +1,3 @@ -[root] -name = "hammond-gtk" -version = "0.1.0" -dependencies = [ - "dissolve 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "gtk 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hammond-data 0.1.0", - "hammond-downloader 0.1.0", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "loggerv 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "open 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "adler32" version = "1.0.2" @@ -55,7 +38,7 @@ dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -68,7 +51,7 @@ dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -78,8 +61,8 @@ name = "backtrace-sys" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -134,7 +117,7 @@ dependencies = [ "cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "glib 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -143,14 +126,14 @@ name = "cairo-sys-rs" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cc" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -176,21 +159,13 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "conv" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "core-foundation" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -198,7 +173,7 @@ name = "core-foundation-sys" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -224,11 +199,6 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "custom_derive" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "dbghelp-sys" version = "0.2.0" @@ -471,7 +441,7 @@ dependencies = [ "glib 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pango 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -484,7 +454,7 @@ dependencies = [ "glib 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -496,7 +466,7 @@ dependencies = [ "gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -511,7 +481,7 @@ dependencies = [ "gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -526,7 +496,7 @@ dependencies = [ "glib 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -537,7 +507,7 @@ dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -550,7 +520,7 @@ dependencies = [ "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -559,7 +529,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -570,7 +540,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -592,7 +562,7 @@ dependencies = [ "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "gtk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pango 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -609,7 +579,7 @@ dependencies = [ "gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -649,6 +619,23 @@ dependencies = [ "rss 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "hammond-gtk" +version = "0.1.0" +dependencies = [ + "dissolve 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hammond-data 0.1.0", + "hammond-downloader 0.1.0", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "loggerv 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "open 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "html5ever" version = "0.5.4" @@ -749,7 +736,7 @@ name = "iovec" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -784,7 +771,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.32" +version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -825,23 +812,6 @@ name = "mac" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "magenta" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "magenta-sys" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "matches" version = "0.1.6" @@ -852,7 +822,7 @@ name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -884,16 +854,16 @@ dependencies = [ [[package]] name = "mio" -version = "0.6.10" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -930,7 +900,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -972,7 +942,7 @@ name = "num_cpus" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -988,7 +958,7 @@ dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.20 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -997,8 +967,8 @@ name = "openssl-sys" version = "0.9.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1012,7 +982,7 @@ dependencies = [ "glib 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1024,7 +994,7 @@ dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1094,7 +1064,7 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1113,7 +1083,7 @@ dependencies = [ "coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1158,7 +1128,7 @@ dependencies = [ "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.16 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.4 (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.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1177,7 +1147,7 @@ dependencies = [ "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.16 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.4 (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)", "tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1269,7 +1239,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "security-framework-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1279,7 +1249,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1299,7 +1269,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_json" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1408,7 +1378,7 @@ version = "0.1.38" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1422,7 +1392,7 @@ dependencies = [ "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1622,17 +1592,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6237ac5a4b1e81c213c24c6437964c61e646df910a914b4ab1487b46df20bd13" "checksum cairo-rs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9d336f1b2ff46c17475a14360de7f456707008da475c54824887e52e453ab00" "checksum cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9e8a1e2a76ac09b959788c2c30a355d693ce6f7f7d7268f6d1dd5d8c3359c521" -"checksum cc 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ef4019bdb99c0c1ddd56c12c2f507c174d729c6915eca6bd9d27c42f3d93b0f4" +"checksum cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a9b13a57efd6b30ecd6598ebdb302cca617930b5470647570468a65d12ef9719" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" "checksum chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c20ebe0b2b08b0aeddba49c609fe7957ba2e33449882cb186a180bc60682fa9" "checksum coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c06169f5beb7e31c7c67ebf5540b8b472d23e3eade3b2ec7d1f5b504a85f91bd" -"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" "checksum core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25bfd746d203017f7d5cbd31ee5d8e17f94b6521c7af77ece6c9e4b2d4b16c67" "checksum core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "065a5d7ffdcbc8fa145d6f0746f3555025b9097a9e9cda59f7467abae670c78d" "checksum crc 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fba69ea0e15e720f7e1cfe1cf3bc55007fbd41e32b8ae11cfa343e7e5961e79a" "checksum crc-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "003d1170779d405378223470f5864b41b79a91969be1260e4de7b4ec069af69c" "checksum crypt32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e34988f7e069e0b2f3bfc064295161e489b2d4e04a2e4248fb94360cdf00b4ec" -"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" "checksum dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97590ba53bcb8ac28279161ca943a924d1fd4a8fb3fa63302591647c4fc5b850" "checksum debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9a032eac705ca39214d169f83e3d3da290af06d8d1d344d1baad2fd002dca4b3" "checksum derive-error-chain 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c9ca9ade651388daad7c993f005d0d20c4f6fe78c1cdc93e95f161c6f5ede4a" @@ -1685,20 +1653,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c9e5e58fa1a4c3b915a561a78a22ee0cac6ab97dca2504428bc1cb074375f8d5" "checksum lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3b585b7a6811fb03aa10e74b278a0f00f8dd9b45dc681f148bb29fa5cb61859b" -"checksum libc 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "56cce3130fd040c28df6f495c8492e5ec5808fb4c9093c310df02b0c8f030148" +"checksum libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "5ba3df4dcb460b9dfbd070d41c94c19209620c191b0340b929ce748a2bcd42d2" "checksum libflate 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ae46bcdafa496981e996e57c5be82c0a7f130a071323764c6faa4803619f1e67" "checksum libsqlite3-sys 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "370090ad578ba845a3ad4f383ceb3deba7abd51ab1915ad1f2c982cc6035e31c" "checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" "checksum loggerv 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "00bfcca20b5c9fb254e8479d1a04330666e218418aec0832da66688aff8e7e5f" "checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" -"checksum magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf0336886480e671965f794bc9b6fce88503563013d1bfb7a502c81fe3ac527" -"checksum magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40d014c7011ac470ae28e2f76a02bfea4a8480f73e701353b49ad7a8d75f4699" "checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" "checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" "checksum mime 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e2e00e17be181010a91dbfefb01660b17311059dc8c7f48b9017677721e732bd" "checksum mime_guess 2.0.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)" = "27a5e6679a0614e25adc14c6434ba84e41632b765a6d9cb2031a0cca682699ae" -"checksum mio 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "dbd91d3bfbceb13897065e97b2ef177a09a438cb33612b2d371bf568819a9313" +"checksum mio 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0e8411968194c7b139e9105bc4ae7db0bae232af087147e72f0616ebf5fdb9cb" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum native-tls 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04b781c9134a954c84f0594b9ab3f5606abc516030388e8511887ef4c204a1e5" "checksum net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "3a80f842784ef6c9a958b68b7516bc7e35883c614004dd94959a4dca1b716c09" @@ -1744,7 +1710,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" "checksum serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" "checksum serde 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "e11a631f964d4e6572712ea12075fb1d65eeef42b0058884195b430ac1e26809" -"checksum serde_json 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ee28c1d94a7745259b767ca9e5b95d55bafbd3205ca3acb978cad84a6ed6bc62" +"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" "checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23" diff --git a/hammond-data/src/dbcheckup.rs b/hammond-data/src/dbcheckup.rs index 1beb528..57f7e0a 100644 --- a/hammond-data/src/dbcheckup.rs +++ b/hammond-data/src/dbcheckup.rs @@ -78,7 +78,7 @@ pub fn delete_local_content(db: &Database, ep: &mut Episode) -> Result<()> { Ok(()) } -pub fn set_watched(db: &Database, ep: &mut Episode) -> Result<()> { +pub fn set_watched_now(db: &Database, ep: &mut Episode) -> Result<()> { let epoch = Utc::now().timestamp() as i32; ep.set_watched(Some(epoch)); ep.save(db)?; diff --git a/hammond-data/src/dbqueries.rs b/hammond-data/src/dbqueries.rs index 9e9204a..125989a 100644 --- a/hammond-data/src/dbqueries.rs +++ b/hammond-data/src/dbqueries.rs @@ -5,6 +5,7 @@ use diesel; use models::{Episode, Podcast, Source}; use index_feed::Database; use errors::*; +use chrono::prelude::*; // TODO: Needs cleanup. @@ -96,6 +97,19 @@ pub fn get_pd_episodes(con: &SqliteConnection, parent: &Podcast) -> QueryResult< eps } +pub fn get_pd_unplayed_episodes( + con: &SqliteConnection, + parent: &Podcast, +) -> QueryResult> { + use schema::episode::dsl::*; + + let eps = Episode::belonging_to(parent) + .filter(watched.is_null()) + .order(epoch.desc()) + .load::(con); + eps +} + pub fn get_pd_episodes_limit( con: &SqliteConnection, parent: &Podcast, @@ -165,3 +179,15 @@ pub fn delete_podcast_episodes(connection: &SqliteConnection, parent_id: i32) -> diesel::delete(episode.filter(podcast_id.eq(parent_id))).execute(connection)?; Ok(()) } + +// TODO: make it transaction. +pub fn update_none_to_played_now(connection: &SqliteConnection, parent: &Podcast) -> Result<()> { + use schema::episode::dsl::*; + + let epoch_now = Utc::now().timestamp() as i32; + diesel::update(Episode::belonging_to(parent).filter(watched.is_null())) + .set(watched.eq(Some(epoch_now))) + .execute(connection)?; + + Ok(()) +} diff --git a/hammond-data/src/index_feed.rs b/hammond-data/src/index_feed.rs index 89e66c0..7e5ea1b 100644 --- a/hammond-data/src/index_feed.rs +++ b/hammond-data/src/index_feed.rs @@ -23,7 +23,9 @@ fn index_source(con: &SqliteConnection, foo: &NewSource) -> Result<()> { match dbqueries::load_source_from_uri(con, foo.uri) { Ok(_) => Ok(()), Err(_) => { - diesel::insert(foo).into(schema::source::table).execute(con)?; + diesel::insert(foo) + .into(schema::source::table) + .execute(con)?; Ok(()) } } @@ -38,7 +40,9 @@ fn index_podcast(con: &SqliteConnection, pd: &NewPodcast) -> Result<()> { foo.save_changes::(con)?; }, Err(_) => { - diesel::insert(pd).into(schema::podcast::table).execute(con)?; + diesel::insert(pd) + .into(schema::podcast::table) + .execute(con)?; } } Ok(()) @@ -58,7 +62,9 @@ fn index_episode(con: &SqliteConnection, ep: &NewEpisode) -> Result<()> { foo.save_changes::(con)?; }, Err(_) => { - diesel::insert(ep).into(schema::episode::table).execute(con)?; + diesel::insert(ep) + .into(schema::episode::table) + .execute(con)?; } } Ok(()) diff --git a/hammond-gtk/gtk/episode_widget.ui b/hammond-gtk/gtk/episode_widget.ui index e81528d..1cd47e3 100644 --- a/hammond-gtk/gtk/episode_widget.ui +++ b/hammond-gtk/gtk/episode_widget.ui @@ -15,7 +15,7 @@ delete_button True True - center + end center @@ -37,6 +37,7 @@ True True True + end center 5 5 @@ -55,13 +56,14 @@ False 5 end - 1 + 0 True True + end center 5 5 @@ -79,6 +81,51 @@ False 5 end + 0 + + + + + True + True + Mark episode as Unplayed. + end + center + + + True + False + gtk-undo + + + + + False + False + end + 1 + + + + + True + True + True + Mark episode as played. + end + center + + + True + False + gtk-apply + + + + + False + False + end 2 @@ -151,7 +198,6 @@ True True - 5 3 diff --git a/hammond-gtk/gtk/podcast_widget.ui b/hammond-gtk/gtk/podcast_widget.ui index e910b88..2cd5eb8 100644 --- a/hammond-gtk/gtk/podcast_widget.ui +++ b/hammond-gtk/gtk/podcast_widget.ui @@ -19,14 +19,12 @@ 32 - 50 - 50 True False center - start + center vertical - 18 + 15 True @@ -86,9 +84,10 @@ - True + False True - 0 + 5 + 1 @@ -114,9 +113,29 @@ Warn: This will delete downloaded content associated with this Podcast.1 + + + True + True + True + Mark all episodes as Played. + + + True + False + gtk-apply + + + + + False + False + 2 + + - True + False True 0 @@ -141,21 +160,21 @@ Warn: This will delete downloaded content associated with this Podcast. False - False + True 1 False - False + True 0 False - False + True 1 diff --git a/hammond-gtk/src/widgets/episode.rs b/hammond-gtk/src/widgets/episode.rs index b5eb350..3cf3baa 100644 --- a/hammond-gtk/src/widgets/episode.rs +++ b/hammond-gtk/src/widgets/episode.rs @@ -52,6 +52,8 @@ fn epidose_widget(db: &Database, episode: &mut Episode, pd_title: &str) -> gtk:: let download_button: gtk::Button = builder.get_object("download_button").unwrap(); let play_button: gtk::Button = builder.get_object("play_button").unwrap(); let delete_button: gtk::Button = builder.get_object("delete_button").unwrap(); + let played_button: gtk::Button = builder.get_object("mark_played_button").unwrap(); + let unplayed_button: gtk::Button = builder.get_object("mark_unplayed_button").unwrap(); let title_label: gtk::Label = builder.get_object("title_label").unwrap(); let desc_label: gtk::Label = builder.get_object("desc_label").unwrap(); @@ -73,6 +75,11 @@ fn epidose_widget(db: &Database, episode: &mut Episode, pd_title: &str) -> gtk:: }); } + if episode.watched().is_some() { + unplayed_button.show(); + played_button.hide(); + } + // Show or hide the play/delete/download buttons upon widget initialization. let local_uri = episode.local_uri(); if local_uri.is_some() && Path::new(local_uri.unwrap()).exists() { @@ -83,7 +90,7 @@ fn epidose_widget(db: &Database, episode: &mut Episode, pd_title: &str) -> gtk:: play_button.connect_clicked(clone!(db, episode => move |_| { on_play_bttn_clicked(&db, episode.id()); - let _ = set_watched(&db, &mut episode.clone()); + let _ = set_watched_now(&db, &mut episode.clone()); })); delete_button.connect_clicked( @@ -95,6 +102,20 @@ fn epidose_widget(db: &Database, episode: &mut Episode, pd_title: &str) -> gtk:: }), ); + played_button.connect_clicked(clone!(db, episode, unplayed_button => move |watched| { + let _ = set_watched_now(&db, &mut episode.clone()); + watched.hide(); + unplayed_button.show(); + })); + + unplayed_button.connect_clicked(clone!(db, episode, played_button => move |un| { + let mut episode = episode.clone(); + episode.set_watched(None); + let _ = episode.save(&db); + un.hide(); + played_button.show(); + })); + let pd_title = pd_title.to_owned(); download_button.connect_clicked( clone!(db, play_button, delete_button, episode => move |dl| { diff --git a/hammond-gtk/src/widgets/podcast.rs b/hammond-gtk/src/widgets/podcast.rs index c1fc1a3..74ba8cf 100644 --- a/hammond-gtk/src/widgets/podcast.rs +++ b/hammond-gtk/src/widgets/podcast.rs @@ -7,7 +7,7 @@ use std::fs; use hammond_data::models::Podcast; use hammond_downloader::downloader; use hammond_data::index_feed::Database; -use hammond_data::dbqueries::{load_podcast_from_title, remove_feed}; +use hammond_data::dbqueries; use widgets::episode::episodes_listbox; use podcasts_view::update_podcasts_view; @@ -30,6 +30,7 @@ macro_rules! clone { ); } +// TODO: Refacto to take a Podcast Stuct as argument instead. pub fn podcast_widget( db: &Database, stack: >k::Stack, @@ -47,6 +48,9 @@ pub fn podcast_widget( let desc_label: gtk::Label = pd_widget_buidler.get_object("description_label").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(); // TODO: refactor, splitoff, spawn a thread probably. if title.is_some() { @@ -54,10 +58,10 @@ pub fn podcast_widget( unsub_button.connect_clicked(clone!(db, stack, t => move |bttn| { let pd = { let tempdb = db.lock().unwrap(); - load_podcast_from_title(&tempdb, &t)}; + dbqueries::load_podcast_from_title(&tempdb, &t)}; if let Ok(pd) = pd { - let res = remove_feed(&db, &pd); + let res = dbqueries::remove_feed(&db, &pd); if res.is_ok(){ info!("{} was removed succesfully.", &t); // hack to get away without properly checking for none. @@ -93,6 +97,29 @@ pub fn podcast_widget( cover.set_from_pixbuf(&i); } + // TODO: refactor + if let Some(t) = title { + let t = t.to_owned(); + played_button.connect_clicked(clone!(db, stack, t => move |_| { + let tempdb = db.lock().unwrap(); + let parent = dbqueries::load_podcast_from_title(&tempdb, &t).unwrap(); + let _ = dbqueries::update_none_to_played_now(&tempdb, &parent); + drop(tempdb); + update_podcast_widget(&db, &stack, &parent); + })); + } + + if let Some(t) = title { + let tempdb = db.lock().unwrap(); + let parent = dbqueries::load_podcast_from_title(&tempdb, &t).unwrap(); + let f = dbqueries::get_pd_unplayed_episodes(&tempdb, &parent); + if let Ok(l) = f { + if l.len() > 0 { + played_button.show() + } + } + } + pd_widget } @@ -158,18 +185,17 @@ pub fn get_pixbuf_from_path(img_path: Option<&str>, pd_title: &str) -> Option gtk::Box { -// let img = get_pixbuf_from_path(pd.image_uri(), pd.title()); -// podcast_widget(db, Some(pd.title()), Some(pd.description()), img) -// } +fn pd_widget_from_diesel_model(db: &Database, pd: &Podcast, stack: >k::Stack) -> gtk::Box { + let img = get_pixbuf_from_path(pd.image_uri(), pd.title()); + podcast_widget(db, stack, Some(pd.title()), Some(pd.description()), img) +}