Add experimental open button

This commit is contained in:
Joakim Soderlund 2019-09-28 20:10:45 +02:00
parent ffeb7fe12b
commit 136b53af6c
6 changed files with 277 additions and 106 deletions

93
Cargo.lock generated
View file

@ -2,7 +2,7 @@
# It is not intended for manual editing.
[[package]]
name = "adler32"
version = "1.0.3"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -19,8 +19,8 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"atk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
@ -44,7 +44,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
version = "1.1.0"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -52,9 +52,9 @@ name = "cairo-rs"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
@ -78,7 +78,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cfg-if"
version = "0.1.9"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -89,7 +89,7 @@ dependencies = [
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -108,7 +108,7 @@ name = "crc32fast"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -126,7 +126,7 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -146,7 +146,7 @@ name = "crossbeam-utils"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -161,10 +161,10 @@ version = "0.1.0"
dependencies = [
"chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono-english 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"nom 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"zip 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -182,6 +182,7 @@ version = "0.1.0"
dependencies = [
"fimfareader 0.1.0",
"gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -204,14 +205,14 @@ name = "gdk"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
@ -226,7 +227,7 @@ dependencies = [
"gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
@ -264,10 +265,10 @@ name = "gio"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -287,10 +288,10 @@ dependencies = [
[[package]]
name = "glib"
version = "0.8.1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -322,7 +323,7 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"atk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
@ -332,7 +333,7 @@ dependencies = [
"gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -361,7 +362,7 @@ dependencies = [
[[package]]
name = "hex"
version = "0.3.2"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -376,11 +377,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "lexical-core"
version = "0.4.5"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"static_assertions 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -409,7 +410,7 @@ name = "miniz_oxide"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -422,7 +423,7 @@ name = "nom"
version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lexical-core 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"lexical-core 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -457,8 +458,8 @@ name = "pango"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -489,7 +490,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "proc-macro2"
version = "1.0.3"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -500,7 +501,7 @@ name = "quote"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -568,18 +569,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde"
version = "1.0.100"
version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_derive"
version = "1.0.100"
version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -591,7 +592,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -604,7 +605,7 @@ name = "syn"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -659,16 +660,16 @@ dependencies = [
]
[metadata]
"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c"
"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba"
"checksum atk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "86b7499272acf036bb5820c6e346bbfb5acc5dceb104bc2c4fd7e6e33dfcde6a"
"checksum atk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067531f752c01027f004032bb676e715aba74b75e904a7340a61ce3fb0b61b0"
"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875"
"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd"
"checksum bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a606a02debe2813760609f57a64a2ffd27d9fdf5b2f133eaca0b248dd92cdd2"
"checksum cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e05db47de3b0f09a222fa4bba2eab957d920d4243962a86b2d77ab401e4a359c"
"checksum cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "90a1ec04603a78c111886a385edcec396dbfbc57ea26b9e74aeea6a1fe55dcca"
"checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be"
"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e8493056968583b0193c1bb04d6f7684586f3726992d6c573261941a895dbd68"
"checksum chrono-english 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4233ee19352739cfdcb5d7c2085005b166f6170ef2845ed9eef27a8fa5f95206"
"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
@ -685,15 +686,15 @@ dependencies = [
"checksum gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ebe06357212127f50575b535bdb04638f5d375bb41062287abc6c94e5b8067b"
"checksum gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6261b5d34c30c2d59f879e643704cf54cb44731f3a2038000b68790c03e360e3"
"checksum gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "778b856a70a32e2cc5dd5cc7fa1b0c4b6df924fdf5c82984bc28f30565657cfe"
"checksum glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "91a70db179515473b57aaff8b879167f1f8460bc5523e97beacf6d1026a8b99d"
"checksum glib 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "be27232841baa43e0fd5ae003f7941925735b2f733a336dc75f07b9eff415e7b"
"checksum glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b86a9169fbc9cf9a0ef315039c2304b09d5c575c5fde7defba3576a0311b863"
"checksum gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61d55bc9202447ca776f6ad0048c36e3312010f66f82ab478e97513e93f3604b"
"checksum gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "709f1074259d4685b96133f92b75c7f35b504715b0fcdc96ec95de2607296a60"
"checksum gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bbd9395497ae1d1915d1d6e522d51ae8745bf613906c34ac191c411250fc4025"
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
"checksum hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "023b39be39e3a2da62a94feb433e91e8bcd37676fbc8bea371daf52b7a769a3e"
"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum lexical-core 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d11f3928ffd249baadf9f083cdea16d7cf317b2a8be6227e1169102432a36d2"
"checksum lexical-core 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2304bccb228c4b020f3a4835d247df0a02a7c4686098d4167762cfbbe4c5cb14"
"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba"
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
"checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f"
@ -707,7 +708,7 @@ dependencies = [
"checksum pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ee97abcad820f9875e032656257ad1c790e7b11a0e6ce2516a8f5b0d8f8213f"
"checksum pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "72d5370d90f49f70bd033c3d75e87fc529fbfff9d6f7cccef07d6170079d91ea"
"checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd"
"checksum proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e98a83a9f9b331f54b924e68a66acb1bb35cb01fb0a23645139967abefb697e8"
"checksum proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afdc77cc74ec70ed262262942ebb7dac3d479e9e5cfa2da1841c0806f6cdabcc"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
"checksum rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "83a27732a533a1be0a0035a111fe76db89ad312f6f0347004c220c57f209a123"
"checksum rayon-core 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "98dcf634205083b17d0861252431eb2acbfb698ab7478a2d20de07954f47ec7b"
@ -718,8 +719,8 @@ dependencies = [
"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)" = "f4473e8506b213730ff2061073b48fa51dcc66349219e2e7c5608f0296a1d95a"
"checksum serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)" = "11e410fde43e157d789fc290d26bc940778ad0fdd47836426fbac36573710dbb"
"checksum serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "9796c9b7ba2ffe7a9ce53c2287dfc48080f4b2b362fcc245a259b3a7201119dd"
"checksum serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "4b133a43a1ecd55d4086bd5b4dc6c1751c68b1bfbeba7a5040442022c7e7c02e"
"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704"
"checksum static_assertions 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7f3eb36b47e512f8f1c9e3d10c2c1965bc992bd9cdb024fa581e2194501c83d3"
"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"

View file

@ -10,3 +10,6 @@ features = ["v3_20"]
[dependencies.fimfareader]
path = ".."
[dependencies.rayon]
version = "*"

View file

@ -1,89 +1,207 @@
//! Application window.
use std::cell::RefCell;
use std::fs::File;
use std::io::BufReader;
use std::mem::replace;
use std::path::Path;
use std::rc::Rc;
use gtk::*;
use rayon::prelude::*;
use fimfareader::archive::Fetcher;
use fimfareader::archive::Story;
use fimfareader::query::parse;
pub struct AppWindow {
pub enum Store {
Attached(StoryView),
Detached(TreeView),
Empty,
}
pub struct StoryView {
fetcher: Fetcher<BufReader<File>>,
filter: TreeModelFilter,
rows: Vec<TreeIter>,
store: ListStore,
view: Option<TreeView>,
visible: Vec<bool>,
}
pub struct AppWindow {
query: Entry,
store: Store,
window: ApplicationWindow,
search: ToggleButton,
result: TreeView,
entry: Entry,
open: FileChooserButton,
}
impl StoryView {
pub fn new(fetcher: Fetcher<BufReader<File>>) -> Self {
const LENGTH: usize = 4;
let types: [Type; LENGTH] = [
i64::static_type(),
bool::static_type(),
String::static_type(),
String::static_type(),
];
let store = ListStore::new(&types);
let filter = TreeModelFilter::new(&store, None);
let columns: [u32; LENGTH] = [0, 1, 2, 3];
let view = None;
let mut rows: Vec<TreeIter> = Vec::with_capacity(fetcher.len());
let mut visible: Vec<bool> = Vec::with_capacity(fetcher.len());
for (i, story) in fetcher.iter().enumerate() {
let row = Some(i as u32);
let values: [&dyn ToValue; LENGTH] =
[&story.id, &true, &story.title, &story.author.name];
let row = store.insert_with_values(row, &columns, &values);
visible.push(true);
rows.push(row);
}
filter.set_visible_column(1);
StoryView {
fetcher,
filter,
rows,
store,
view,
visible,
}
}
pub fn attach(&mut self, view: TreeView) -> Option<TreeView> {
view.set_model(Some(&self.filter));
self.view.replace(view).and_then(|view| {
view.set_model(None::<&TreeModel>);
Some(view)
})
}
pub fn detach(&mut self) -> Option<TreeView> {
self.view.take().and_then(|view| {
view.set_model(None::<&TreeModel>);
Some(view)
})
}
pub fn filter<T>(&mut self, filter: T)
where
T: Sync + Fn(&Story) -> bool,
{
let store = &self.store;
let visible = &mut self.visible;
let bitmap: Vec<bool> = self.fetcher.par_iter().map(&filter).collect();
for (i, row) in self.rows.iter().enumerate() {
let new = bitmap[i];
let old = visible[i];
if new != old {
store.set_value(row, 1, &new.to_value());
}
}
self.visible = bitmap;
}
}
impl Drop for StoryView {
fn drop(&mut self) {
println!("DROP!");
self.detach();
}
}
impl AppWindow {
pub fn new(fetcher: Fetcher<BufReader<File>>) -> Option<Rc<Self>> {
pub fn new() -> Option<Rc<RefCell<Self>>> {
let ui = include_str!("app.ui");
let builder = Builder::new_from_string(ui);
let result = builder.get_object("result")?;
let this = Rc::new(Self {
fetcher: fetcher,
let this = Rc::new(RefCell::new(Self {
query: builder.get_object("entry")?,
store: Store::Detached(result),
window: builder.get_object("app")?,
search: builder.get_object("search")?,
result: builder.get_object("result")?,
entry: builder.get_object("entry")?,
});
open: builder.get_object("open")?,
}));
this.apply(this.fetcher.iter().collect());
Self::connect(this.clone());
Some(Self::connect(this))
Some(this)
}
fn connect(self: Rc<Self>) -> Rc<Self> {
self.window.connect_destroy(move |_| gtk::main_quit());
fn connect(wrapper: Rc<RefCell<Self>>) {
let this = wrapper.borrow();
let clone = self.clone();
self.entry.connect_activate(move |entry| {
this.window.connect_destroy(move |_| gtk::main_quit());
let clone = wrapper.clone();
this.query.connect_activate(move |entry| {
let mut this = clone.borrow_mut();
let text = entry.get_text().unwrap();
clone.filter(text.as_str().trim());
this.filter(text.as_str().trim());
});
self
let clone = wrapper.clone();
this.open.connect_file_set(move |dialog| {
let mut this = clone.borrow_mut();
let path = dialog.get_filename().unwrap();
this.load(path);
});
}
fn apply(&self, stories: Vec<&Story>) {
let store = ListStore::new(&[
i64::static_type(),
String::static_type(),
String::static_type(),
]);
pub fn load(&mut self, path: impl AsRef<Path>) {
use Store::*;
for (i, story) in stories.iter().enumerate() {
store.insert_with_values(
Some(i as u32),
&[0, 1, 2],
&[&story.id, &story.title, &story.author.name],
);
}
let view = match replace(&mut self.store, Empty) {
Empty => panic!(),
Detached(view) => view,
Attached(mut store) => {
let view = store.detach();
drop(store);
view.unwrap()
}
};
self.result.set_model(Some(&store));
let fetcher = Fetcher::from(path).unwrap();
let mut store = StoryView::new(fetcher);
store.attach(view);
self.store = Attached(store);
}
pub fn filter(&self, query: &str) {
let fetcher = &self.fetcher;
pub fn filter(&mut self, query: &str) {
use Store::*;
let model = match &mut self.store {
Attached(model) => model,
Detached(_) => return,
Empty => panic!(),
};
if query.trim() == "" {
let iter = fetcher.iter();
self.apply(iter.collect());
model.filter(|_| true);
return;
}
let filter = parse(query);
if filter.is_err() {
return;
match parse(query) {
Err(_) => model.filter(|_| false),
Ok(filter) => model.filter(filter),
}
let filter = filter.unwrap();
let vector = fetcher.filter(&filter);
self.apply(vector);
}
}

View file

@ -28,6 +28,14 @@ Author: Joakim Soderlund
<!-- interface-description Story browser for Fimfarchive -->
<!-- interface-copyright 2019 Joakim Soderlund -->
<!-- interface-authors Joakim Soderlund -->
<object class="GtkFileFilter" id="archive">
<mime-types>
<mime-type>application/zip</mime-type>
</mime-types>
<patterns>
<pattern>*.zip</pattern>
</patterns>
</object>
<object class="GtkApplicationWindow" id="app">
<property name="width_request">800</property>
<property name="height_request">600</property>
@ -39,6 +47,20 @@ Author: Joakim Soderlund
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkFileChooserButton" id="open">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="create_folders">False</property>
<property name="filter">archive</property>
<property name="preview_widget_active">False</property>
<property name="use_preview_label">False</property>
<property name="title" translatable="yes">Select Archive</property>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child type="title">
<object class="GtkEntry" id="entry">
<property name="width_request">500</property>
@ -99,9 +121,11 @@ Author: Joakim Soderlund
<object class="GtkTreeView" id="result">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="enable_search">False</property>
<property name="reorderable">True</property>
<property name="search_column">2</property>
<property name="fixed_height_mode">True</property>
<property name="show_expanders">False</property>
<property name="rubber_banding">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
@ -110,29 +134,47 @@ Author: Joakim Soderlund
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="fixed_width">100</property>
<property name="min_width">100</property>
<property name="max_width">100</property>
<property name="title" translatable="yes">ID</property>
<property name="clickable">True</property>
<property name="reorderable">True</property>
<property name="sort_indicator">True</property>
<property name="sort_column_id">0</property>
<child>
<object class="GtkCellRendererText"/>
<object class="GtkCellRendererText">
<property name="alignment">right</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="filter_column">
<property name="visible">False</property>
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Visible</property>
<child>
<object class="GtkCellRendererToggle"/>
<attributes>
<attribute name="active">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="title_column">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="fixed_width">400</property>
<property name="min_width">400</property>
<property name="max_width">400</property>
<property name="title" translatable="yes">Title</property>
<property name="clickable">True</property>
<property name="reorderable">True</property>
<property name="sort_column_id">2</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">1</attribute>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
@ -141,14 +183,15 @@ Author: Joakim Soderlund
<object class="GtkTreeViewColumn" id="author_column">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="fixed_width">300</property>
<property name="min_width">300</property>
<property name="max_width">300</property>
<property name="fixed_width">200</property>
<property name="title" translatable="yes">Author</property>
<property name="clickable">True</property>
<property name="reorderable">True</property>
<property name="sort_column_id">3</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">2</attribute>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>

View file

@ -11,9 +11,7 @@ fn main() -> Result<()> {
_ => Error::usage("Could not initialize GTK"),
})?;
let fetcher = Fetcher::from("fimfarchive.zip")?;
let _window = match AppWindow::new(fetcher) {
let _window = match AppWindow::new() {
Some(window) => Ok(window),
None => Err(Error::usage("Could not create main window")),
}?;

View file

@ -100,10 +100,18 @@ where
Ok(buf)
}
pub fn len(&self) -> usize {
self.index.len()
}
pub fn iter(&self) -> impl Iterator<Item = &Story> {
self.index.iter()
}
pub fn par_iter(&self) -> impl ParallelIterator<Item = &Story> {
self.index.par_iter()
}
pub fn filter<F>(&self, function: &F) -> Vec<&Story>
where
F: Sync + Fn(&Story) -> bool,