From 7d7343ea8c3f74eaa5412d3f289de4f8afc097f4 Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Fri, 7 May 2021 23:49:05 +0200 Subject: [PATCH] Update gtk-rs crates --- .gitignore | 1 - Cargo.lock | 2477 +++++++++++++++++++++ backend/src/error.rs | 2 - backend/src/library.rs | 12 +- backend/src/player.rs | 46 +- backend/src/secure.rs | 18 +- client/src/error.rs | 2 - client/src/instruments.rs | 3 +- client/src/lib.rs | 17 +- client/src/mediums.rs | 4 +- client/src/recordings.rs | 3 +- client/src/register.rs | 2 +- database/src/thread.rs | 14 +- import/src/disc.rs | 57 +- import/src/error.rs | 6 +- import/src/folder.rs | 29 +- import/src/lib.rs | 2 +- import/src/session.rs | 4 +- musicus/Cargo.toml | 4 +- musicus/src/editors/ensemble.rs | 2 +- musicus/src/editors/performance.rs | 27 +- musicus/src/editors/person.rs | 6 +- musicus/src/editors/recording.rs | 46 +- musicus/src/editors/work.rs | 36 +- musicus/src/editors/work_part.rs | 10 +- musicus/src/editors/work_section.rs | 10 +- musicus/src/import/import_screen.rs | 29 +- musicus/src/import/medium_editor.rs | 34 +- musicus/src/import/medium_preview.rs | 12 +- musicus/src/import/source_selector.rs | 14 +- musicus/src/import/track_editor.rs | 13 +- musicus/src/import/track_selector.rs | 15 +- musicus/src/import/track_set_editor.rs | 12 +- musicus/src/macros.rs | 24 +- musicus/src/main.rs | 7 +- musicus/src/navigator/mod.rs | 26 +- musicus/src/navigator/window.rs | 2 +- musicus/src/preferences/login.rs | 14 +- musicus/src/preferences/mod.rs | 6 +- musicus/src/preferences/register.rs | 14 +- musicus/src/preferences/server.rs | 2 +- musicus/src/screens/ensemble.rs | 124 +- musicus/src/screens/main.rs | 83 +- musicus/src/screens/medium.rs | 71 +- musicus/src/screens/person.rs | 170 +- musicus/src/screens/player.rs | 51 +- musicus/src/screens/recording.rs | 78 +- musicus/src/screens/welcome.rs | 19 +- musicus/src/screens/work.rs | 86 +- musicus/src/selectors/ensemble.rs | 52 +- musicus/src/selectors/instrument.rs | 52 +- musicus/src/selectors/medium.rs | 111 +- musicus/src/selectors/person.rs | 52 +- musicus/src/selectors/recording.rs | 111 +- musicus/src/selectors/selector.rs | 45 +- musicus/src/selectors/work.rs | 73 +- musicus/src/widgets/button_row.rs | 5 +- musicus/src/widgets/entry_row.rs | 7 +- musicus/src/widgets/indexed_list_model.rs | 111 +- musicus/src/widgets/list.rs | 21 +- musicus/src/widgets/screen.rs | 7 +- musicus/src/widgets/upload_section.rs | 9 +- musicus/src/window.rs | 5 +- 63 files changed, 3499 insertions(+), 908 deletions(-) create mode 100644 Cargo.lock diff --git a/.gitignore b/.gitignore index 34368a5..97e2100 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ /builddir /flatpak /target -Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..155e3b1 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2477 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "aes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" +dependencies = [ + "aes-soft", + "aesni", + "cipher", +] + +[[package]] +name = "aes-soft" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" +dependencies = [ + "cipher", + "opaque-debug", +] + +[[package]] +name = "aesni" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" +dependencies = [ + "cipher", + "opaque-debug", +] + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "anyhow" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b" + +[[package]] +name = "async-channel" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-io" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bbfd5cf2794b1e908ea8457e6c45f8f8f1f6ec5f74617bf4662623f47503c3b" +dependencies = [ + "concurrent-queue", + "fastrand", + "futures-lite", + "libc", + "log", + "once_cell", + "parking", + "polling", + "slab", + "socket2 0.4.0", + "waker-fn", + "winapi", +] + +[[package]] +name = "async-trait" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b98e84bbb4cbcdd97da190ba0c58a1bb0de2c1fdf67d159e192ed766aeca722" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-modes" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" +dependencies = [ + "block-padding", + "cipher", +] + +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" + +[[package]] +name = "cache-padded" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" + +[[package]] +name = "cairo-rs" +version = "0.13.0" +source = "git+https://github.com/gtk-rs/gtk-rs/#5dc0f087d1e56b7c31f968fed575924e58ebaece" +dependencies = [ + "bitflags", + "cairo-sys-rs", + "glib 0.13.0", + "libc", + "thiserror", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.13.0" +source = "git+https://github.com/gtk-rs/gtk-rs/#5dc0f087d1e56b7c31f968fed575924e58ebaece" +dependencies = [ + "glib-sys 0.13.0", + "libc", + "system-deps 3.1.1", +] + +[[package]] +name = "cc" +version = "1.0.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" + +[[package]] +name = "cfg-expr" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30aa9e2ffbb838c6b451db14f3cd8e63ed622bf859f9956bc93845a10fafc26a" +dependencies = [ + "smallvec", +] + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array", +] + +[[package]] +name = "concurrent-queue" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" +dependencies = [ + "cache-padded", +] + +[[package]] +name = "cpufeatures" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec1028182c380cc45a2e2c5ec841134f2dfd0f8f5f0a5bcd68004f81b5efdf4" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4feb231f0d4d6af81aed15928e58ecf5816aa62a2393e2c82f46973e92a9a278" +dependencies = [ + "autocfg", + "cfg-if 1.0.0", + "lazy_static", +] + +[[package]] +name = "crypto-mac" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "curl" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a872858e9cb9e3b96c80dd78774ad9e32e44d3b05dc31e142b858d14aebc82c" +dependencies = [ + "curl-sys", + "libc", + "openssl-probe", + "openssl-sys", + "schannel", + "socket2 0.3.19", + "winapi", +] + +[[package]] +name = "curl-sys" +version = "0.4.42+curl-7.76.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4636d8d6109c842707018a104051436bffb8991ea20b2d1293db70b6e0ee4c7c" +dependencies = [ + "cc", + "libc", + "libnghttp2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", + "winapi", +] + +[[package]] +name = "dbus" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48b5f0f36f1eebe901b0e6bee369a77ed3396334bf3f09abd46454a576f71819" +dependencies = [ + "libc", + "libdbus-sys", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "diesel" +version = "1.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "047bfc4d5c3bd2ef6ca6f981941046113524b9a9f9a7cbdfdd7ff40f58e6f542" +dependencies = [ + "byteorder", + "diesel_derives", + "libsqlite3-sys", +] + +[[package]] +name = "diesel_derives" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "diesel_migrations" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf3cde8413353dc7f5d72fa8ce0b99a560a359d2c5ef1e5817ca731cd9008f4c" +dependencies = [ + "migrations_internals", + "migrations_macros", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "encoding_rs" +version = "0.8.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "enumflags2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "event-listener" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" + +[[package]] +name = "fastrand" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77b705829d1e87f762c2df6da140b26af5839e1033aa84aa5f56bb688e4e1bdb" +dependencies = [ + "instant", +] + +[[package]] +name = "field-offset" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf539fba70056b50f40a22e0da30639518a12ee18c35807858a63b158cb6dde7" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "fragile" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69a039c3498dc930fe810151a34ba0c1c70b02b8625035592e74432f678591f2" + +[[package]] +name = "futures" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d5813545e459ad3ca1bff9915e9ad7f1a47dc6a91b627ce321d5863b7dd253" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce79c6a52a299137a6013061e0cf0e688fce5d7f1bc60125f520912fdb29ec25" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "098cd1c6dda6ca01650f1a37a794245eb73181d0d4d4e955e2f3c37db7af1815" + +[[package]] +name = "futures-executor" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f6cb7042eda00f0049b1d2080aa4b93442997ee507eb3828e8bd7577f94c9d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "365a1a1fb30ea1c03a830fdb2158f5236833ac81fa0ad12fe35b29cddc35cb04" + +[[package]] +name = "futures-lite" +version = "1.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4481d0cd0de1d204a4fa55e7d45f07b1d958abcb06714b3446438e2eff695fb" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + +[[package]] +name = "futures-macro" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668c6733a182cd7deb4f1de7ba3bf2120823835b3bcfbeacf7d2c4a773c1bb8b" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5629433c555de3d82861a7a4e3794a4c40040390907cfbfd7143a92a426c23" + +[[package]] +name = "futures-task" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba7aa51095076f3ba6d9a1f702f74bd05ec65f555d70d2033d55ba8d69f581bc" + +[[package]] +name = "futures-util" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c144ad54d60f23927f0a6b6d816e4271278b64f005ad65e4e35291d2de9c025" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.13.0" +source = "git+https://github.com/gtk-rs/gtk-rs/#5dc0f087d1e56b7c31f968fed575924e58ebaece" +dependencies = [ + "gdk-pixbuf-sys", + "gio 0.13.0", + "glib 0.13.0", + "libc", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.13.0" +source = "git+https://github.com/gtk-rs/gtk-rs/#5dc0f087d1e56b7c31f968fed575924e58ebaece" +dependencies = [ + "gio-sys 0.13.0", + "glib-sys 0.13.0", + "gobject-sys 0.13.0", + "libc", + "system-deps 3.1.1", +] + +[[package]] +name = "gdk4" +version = "0.1.0" +source = "git+https://github.com/gtk-rs/gtk4-rs/#e90c5752ba5229f874e912e84bc83739003434ed" +dependencies = [ + "bitflags", + "cairo-rs", + "gdk-pixbuf", + "gdk4-sys", + "gio 0.13.0", + "glib 0.13.0", + "libc", + "pango", +] + +[[package]] +name = "gdk4-sys" +version = "0.1.0" +source = "git+https://github.com/gtk-rs/gtk4-rs/#e90c5752ba5229f874e912e84bc83739003434ed" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys 0.13.0", + "glib-sys 0.13.0", + "gobject-sys 0.13.0", + "graphene-sys", + "libc", + "pango-sys", + "system-deps 3.1.1", +] + +[[package]] +name = "generic-array" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.10.2+wasi-snapshot-preview1", +] + +[[package]] +name = "gettext-rs" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b95fa19cca70adf9888150e979839ae9bd58f85a1a42e4753699112875189e1" +dependencies = [ + "gettext-sys", + "locale_config", +] + +[[package]] +name = "gettext-sys" +version = "0.19.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e034c4ba5bb796730a6cc5eb0d654c16885006a7c3d6c6603581ed809434f153" +dependencies = [ + "cc", +] + +[[package]] +name = "gio" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fb60242bfff700772dae5d9e3a1f7aa2e4ebccf18b89662a16acb2822568561" +dependencies = [ + "bitflags", + "futures", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "gio-sys 0.10.1", + "glib 0.10.3", + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "libc", + "once_cell", + "thiserror", +] + +[[package]] +name = "gio" +version = "0.13.0" +source = "git+https://github.com/gtk-rs/gtk-rs/#5dc0f087d1e56b7c31f968fed575924e58ebaece" +dependencies = [ + "bitflags", + "futures-channel", + "futures-core", + "futures-io", + "gio-sys 0.13.0", + "glib 0.13.0", + "libc", + "once_cell", + "thiserror", +] + +[[package]] +name = "gio-sys" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e24fb752f8f5d2cf6bbc2c606fd2bc989c81c5e2fe321ab974d54f8b6344eac" +dependencies = [ + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "libc", + "system-deps 1.3.2", + "winapi", +] + +[[package]] +name = "gio-sys" +version = "0.13.0" +source = "git+https://github.com/gtk-rs/gtk-rs/#5dc0f087d1e56b7c31f968fed575924e58ebaece" +dependencies = [ + "glib-sys 0.13.0", + "gobject-sys 0.13.0", + "libc", + "system-deps 3.1.1", + "winapi", +] + +[[package]] +name = "glib" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c685013b7515e668f1b57a165b009d4d28cb139a8a989bbd699c10dad29d0c5" +dependencies = [ + "bitflags", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "glib-macros 0.10.1", + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "libc", + "once_cell", +] + +[[package]] +name = "glib" +version = "0.13.0" +source = "git+https://github.com/gtk-rs/gtk-rs/#5dc0f087d1e56b7c31f968fed575924e58ebaece" +dependencies = [ + "bitflags", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "glib-macros 0.13.0", + "glib-sys 0.13.0", + "gobject-sys 0.13.0", + "libc", + "once_cell", + "smallvec", +] + +[[package]] +name = "glib-macros" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41486a26d1366a8032b160b59065a59fb528530a46a49f627e7048fb8c064039" +dependencies = [ + "anyhow", + "heck", + "itertools 0.9.0", + "proc-macro-crate 0.1.5", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "glib-macros" +version = "0.13.0" +source = "git+https://github.com/gtk-rs/gtk-rs/#5dc0f087d1e56b7c31f968fed575924e58ebaece" +dependencies = [ + "anyhow", + "heck", + "proc-macro-crate 1.0.0", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "glib-sys" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e9b997a66e9a23d073f2b1abb4dbfc3925e0b8952f67efd8d9b6e168e4cdc1" +dependencies = [ + "libc", + "system-deps 1.3.2", +] + +[[package]] +name = "glib-sys" +version = "0.13.0" +source = "git+https://github.com/gtk-rs/gtk-rs/#5dc0f087d1e56b7c31f968fed575924e58ebaece" +dependencies = [ + "libc", + "system-deps 3.1.1", +] + +[[package]] +name = "gobject-sys" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "952133b60c318a62bf82ee75b93acc7e84028a093e06b9e27981c2b6fe68218c" +dependencies = [ + "glib-sys 0.10.1", + "libc", + "system-deps 1.3.2", +] + +[[package]] +name = "gobject-sys" +version = "0.13.0" +source = "git+https://github.com/gtk-rs/gtk-rs/#5dc0f087d1e56b7c31f968fed575924e58ebaece" +dependencies = [ + "glib-sys 0.13.0", + "libc", + "system-deps 3.1.1", +] + +[[package]] +name = "graphene-rs" +version = "0.13.0" +source = "git+https://github.com/gtk-rs/gtk-rs/#5dc0f087d1e56b7c31f968fed575924e58ebaece" +dependencies = [ + "glib 0.13.0", + "graphene-sys", + "libc", +] + +[[package]] +name = "graphene-sys" +version = "0.13.0" +source = "git+https://github.com/gtk-rs/gtk-rs/#5dc0f087d1e56b7c31f968fed575924e58ebaece" +dependencies = [ + "glib-sys 0.13.0", + "libc", + "pkg-config", + "system-deps 3.1.1", +] + +[[package]] +name = "gsk4" +version = "0.1.0" +source = "git+https://github.com/gtk-rs/gtk4-rs/#e90c5752ba5229f874e912e84bc83739003434ed" +dependencies = [ + "bitflags", + "cairo-rs", + "gdk4", + "glib 0.13.0", + "graphene-rs", + "gsk4-sys", + "libc", + "pango", +] + +[[package]] +name = "gsk4-sys" +version = "0.1.0" +source = "git+https://github.com/gtk-rs/gtk4-rs/#e90c5752ba5229f874e912e84bc83739003434ed" +dependencies = [ + "cairo-sys-rs", + "gdk4-sys", + "glib-sys 0.13.0", + "gobject-sys 0.13.0", + "graphene-sys", + "libc", + "pango-sys", + "system-deps 3.1.1", +] + +[[package]] +name = "gstreamer" +version = "0.16.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ff5d0f7ff308ae37e6eb47b6ded17785bdea06e438a708cd09e0288c1862f33" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "futures-channel", + "futures-core", + "futures-util", + "glib 0.10.3", + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "gstreamer-sys", + "libc", + "muldiv", + "num-rational", + "once_cell", + "paste", + "pretty-hex", + "thiserror", +] + +[[package]] +name = "gstreamer-audio-sys" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b614d5e478ad2ff6f5699757d03f11f2868ea43164c651c60449bd0e3c6b7d75" +dependencies = [ + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "gstreamer-base-sys", + "gstreamer-sys", + "libc", + "system-deps 1.3.2", +] + +[[package]] +name = "gstreamer-base" +version = "0.16.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bafd01c56f59cb10f4b5a10f97bb4bdf8c2b2784ae5b04da7e2d400cf6e6afcf" +dependencies = [ + "bitflags", + "glib 0.10.3", + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "gstreamer", + "gstreamer-base-sys", + "gstreamer-sys", + "libc", +] + +[[package]] +name = "gstreamer-base-sys" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b7b6dc2d6e160a1ae28612f602bd500b3fa474ce90bf6bb2f08072682beef5" +dependencies = [ + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "gstreamer-sys", + "libc", + "system-deps 1.3.2", +] + +[[package]] +name = "gstreamer-pbutils" +version = "0.16.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55ddbc57cf6d4fb1b1f590e723d8fa28a2ebdbdf709cae634c69e273dc006e4" +dependencies = [ + "bitflags", + "glib 0.10.3", + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "gstreamer", + "gstreamer-pbutils-sys", + "gstreamer-sys", + "libc", + "thiserror", +] + +[[package]] +name = "gstreamer-pbutils-sys" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22af977134e952b1dcb98260f8f2388d7255baa66cf4ebeb2c2c8542093130c5" +dependencies = [ + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "gstreamer-audio-sys", + "gstreamer-sys", + "gstreamer-video-sys", + "libc", + "system-deps 1.3.2", +] + +[[package]] +name = "gstreamer-player" +version = "0.16.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34edf65e48e0d29c18101d77a2e004488a61f81a852a75e19d9c73e03d35cb77" +dependencies = [ + "bitflags", + "glib 0.10.3", + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "gstreamer", + "gstreamer-player-sys", + "gstreamer-sys", + "gstreamer-video", + "libc", +] + +[[package]] +name = "gstreamer-player-sys" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53aaf79503e691a32266670bc631edb6c52bdb854984da76a0ce2756f49584a2" +dependencies = [ + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "gstreamer-sys", + "gstreamer-video-sys", + "libc", + "system-deps 1.3.2", +] + +[[package]] +name = "gstreamer-sys" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1f154082d01af5718c5f8a8eb4f565a4ea5586ad8833a8fc2c2aa6844b601d" +dependencies = [ + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "libc", + "system-deps 1.3.2", +] + +[[package]] +name = "gstreamer-video" +version = "0.16.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7bbb1485d87469849ec45c08e03c2f280d3ea20ff3c439d03185be54e3ce98e" +dependencies = [ + "bitflags", + "futures-channel", + "futures-util", + "glib 0.10.3", + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "gstreamer", + "gstreamer-base", + "gstreamer-base-sys", + "gstreamer-sys", + "gstreamer-video-sys", + "libc", + "once_cell", +] + +[[package]] +name = "gstreamer-video-sys" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92347e46438007d6a2386302125f62cb9df6769cdacb931af5c0f12c1ee21de4" +dependencies = [ + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "gstreamer-base-sys", + "gstreamer-sys", + "libc", + "system-deps 1.3.2", +] + +[[package]] +name = "gtk-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da5bf7748fd4cd0b2490df8debcc911809dbcbee4ece9531b96c29a9c729de5a" + +[[package]] +name = "gtk4" +version = "0.1.0" +source = "git+https://github.com/gtk-rs/gtk4-rs/#e90c5752ba5229f874e912e84bc83739003434ed" +dependencies = [ + "bitflags", + "cairo-rs", + "field-offset", + "futures-channel", + "gdk-pixbuf", + "gdk4", + "gio 0.13.0", + "glib 0.13.0", + "graphene-rs", + "gsk4", + "gtk4-macros", + "gtk4-sys", + "libc", + "once_cell", + "pango", +] + +[[package]] +name = "gtk4-macros" +version = "0.1.0" +source = "git+https://github.com/gtk-rs/gtk4-rs/#e90c5752ba5229f874e912e84bc83739003434ed" +dependencies = [ + "anyhow", + "heck", + "itertools 0.10.0", + "proc-macro-crate 1.0.0", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "gtk4-sys" +version = "0.1.0" +source = "git+https://github.com/gtk-rs/gtk4-rs/#e90c5752ba5229f874e912e84bc83739003434ed" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk4-sys", + "gio-sys 0.13.0", + "glib-sys 0.13.0", + "gobject-sys 0.13.0", + "graphene-sys", + "gsk4-sys", + "libc", + "pango-sys", + "system-deps 3.1.1", +] + +[[package]] +name = "heck" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hkdf" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51ab2f639c231793c5f6114bdb9bbe50a7dbbfcd7c7c6bd8475dec2d991e964f" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "hmac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +dependencies = [ + "crypto-mac", + "digest", +] + +[[package]] +name = "http" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "instant" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "isahc" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd9294f1ecdda747b8a092b07873285e613adc14e9c9526205eacedcf3ecd2b" +dependencies = [ + "async-channel", + "crossbeam-utils", + "curl", + "curl-sys", + "encoding_rs", + "futures-lite", + "http", + "log", + "mime", + "once_cell", + "polling", + "slab", + "sluice", + "tracing", + "tracing-futures", + "url", + "waker-fn", +] + +[[package]] +name = "itertools" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libadwaita" +version = "0.1.0" +source = "git+https://gitlab.gnome.org/World/Rust/libadwaita-rs.git#ddc44f4616de5b8820783cf5bf21565d3caab096" +dependencies = [ + "gdk-pixbuf", + "gdk4", + "gio 0.13.0", + "glib 0.13.0", + "gtk4", + "libadwaita-sys", + "libc", + "pango", +] + +[[package]] +name = "libadwaita-sys" +version = "0.1.0" +source = "git+https://gitlab.gnome.org/World/Rust/libadwaita-rs.git#ddc44f4616de5b8820783cf5bf21565d3caab096" +dependencies = [ + "gdk-pixbuf-sys", + "gdk4-sys", + "gio-sys 0.13.0", + "glib-sys 0.13.0", + "gobject-sys 0.13.0", + "gtk4-sys", + "libc", + "pango-sys", + "system-deps 3.1.1", +] + +[[package]] +name = "libc" +version = "0.2.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" + +[[package]] +name = "libdbus-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc12a3bc971424edbbf7edaf6e5740483444db63aa8e23d3751ff12a30f306f0" +dependencies = [ + "pkg-config", +] + +[[package]] +name = "libnghttp2-sys" +version = "0.1.6+1.43.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0af55541a8827e138d59ec9e5877fb6095ece63fb6f4da45e7491b4fbd262855" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64d31059f22935e6c31830db5249ba2b7ecd54fd73a9909286f0a67aa55c2fbd" +dependencies = [ + "pkg-config", + "vcpkg", +] + +[[package]] +name = "libz-sys" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "locale_config" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d2c35b16f4483f6c26f0e4e9550717a2f6575bcd6f12a53ff0c490a94a6934" +dependencies = [ + "lazy_static", + "objc", + "objc-foundation", + "regex", + "winapi", +] + +[[package]] +name = "log" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" + +[[package]] +name = "memchr" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" + +[[package]] +name = "memoffset" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" +dependencies = [ + "autocfg", +] + +[[package]] +name = "migrations_internals" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b4fc84e4af020b837029e017966f86a1c2d5e83e64b589963d5047525995860" +dependencies = [ + "diesel", +] + +[[package]] +name = "migrations_macros" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9753f12909fd8d923f75ae5c3258cae1ed3c8ec052e1b38c93c21a6d157f789c" +dependencies = [ + "migrations_internals", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "mpris-player" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f6badd6ebe31be46eb2e2975cf3b34b183bace5f8a8db1d609fefc4d46fbb07" +dependencies = [ + "dbus", + "glib 0.10.3", +] + +[[package]] +name = "muldiv" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0419348c027fa7be448d2ae7ea0e4e04c2334c31dc4e74ab29f00a2a7ca69204" + +[[package]] +name = "musicus" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "futures-channel", + "gdk4", + "gettext-rs", + "gio 0.13.0", + "glib 0.13.0", + "gstreamer", + "gtk-macros", + "gtk4", + "libadwaita", + "log", + "musicus_backend", + "once_cell", + "pango", + "rand 0.7.3", + "sanitize-filename", +] + +[[package]] +name = "musicus_backend" +version = "0.1.0" +dependencies = [ + "fragile", + "gio 0.9.1", + "glib 0.10.3", + "gstreamer", + "gstreamer-player", + "log", + "mpris-player", + "musicus_client", + "musicus_database", + "musicus_import", + "secret-service", + "thiserror", + "tokio", +] + +[[package]] +name = "musicus_client" +version = "0.1.0" +dependencies = [ + "isahc", + "log", + "musicus_database", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "musicus_database" +version = "0.1.0" +dependencies = [ + "diesel", + "diesel_migrations", + "log", + "rand 0.7.3", + "serde", + "serde_json", + "thiserror", + "tokio", + "uuid", +] + +[[package]] +name = "musicus_import" +version = "0.1.0" +dependencies = [ + "base64", + "glib 0.13.0", + "gstreamer", + "gstreamer-pbutils", + "log", + "once_cell", + "rand 0.7.3", + "sha2", + "thiserror", + "tokio", +] + +[[package]] +name = "nb-connect" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1bb540dc6ef51cfe1916ec038ce7a620daf3a111e2502d745197cd53d6bca15" +dependencies = [ + "libc", + "socket2 0.4.0", +] + +[[package]] +name = "nix" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363" +dependencies = [ + "bitflags", + "cc", + "cfg-if 0.1.10", + "libc", + "void", +] + +[[package]] +name = "num" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d0a3d5e207573f948a9e5376662aa743a2ea13f7c50a554d7af443a73fbfeba" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" +dependencies = [ + "autocfg", + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + +[[package]] +name = "objc-foundation" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" +dependencies = [ + "block", + "objc", + "objc_id", +] + +[[package]] +name = "objc_id" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" +dependencies = [ + "objc", +] + +[[package]] +name = "once_cell" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "openssl-probe" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" + +[[package]] +name = "openssl-sys" +version = "0.9.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b0d6fb7d80f877617dfcb014e605e2b5ab2fb0afdf27935219bb6bd984cb98" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "pango" +version = "0.13.0" +source = "git+https://github.com/gtk-rs/gtk-rs/#5dc0f087d1e56b7c31f968fed575924e58ebaece" +dependencies = [ + "bitflags", + "glib 0.13.0", + "libc", + "once_cell", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.13.0" +source = "git+https://github.com/gtk-rs/gtk-rs/#5dc0f087d1e56b7c31f968fed575924e58ebaece" +dependencies = [ + "glib-sys 0.13.0", + "gobject-sys 0.13.0", + "libc", + "system-deps 3.1.1", +] + +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + +[[package]] +name = "paste" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + +[[package]] +name = "pin-project" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7509cc106041c40a4518d2af7a61530e1eed0e6285296a3d8c5472806ccc4a4" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c950132583b500556b1efd71d45b319029f2b71518d979fcc208e16b42426f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" + +[[package]] +name = "polling" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fc12d774e799ee9ebae13f4076ca003b40d18a11ac0f3641e6f899618580b7b" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "log", + "wepoll-sys", + "winapi", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[package]] +name = "pretty-hex" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5c99d529f0d30937f6f4b8a86d988047327bb88d04d2c4afc356de74722131" + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro-crate" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fdbd1df62156fbc5945f4762632564d7d038153091c3fcf1067f6aef7cff92" +dependencies = [ + "thiserror", + "toml", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + +[[package]] +name = "proc-macro-nested" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" + +[[package]] +name = "proc-macro2" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", +] + +[[package]] +name = "rand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +dependencies = [ + "libc", + "rand_chacha 0.3.0", + "rand_core 0.6.2", + "rand_hc 0.3.0", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.2", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +dependencies = [ + "getrandom 0.2.2", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +dependencies = [ + "rand_core 0.6.2", +] + +[[package]] +name = "regex" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "sanitize-filename" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf18934a12018228c5b55a6dae9df5d0641e3566b3630cb46cc55564068e7c2f" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "schannel" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +dependencies = [ + "lazy_static", + "winapi", +] + +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" + +[[package]] +name = "secret-service" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2400fb1bf2a87b303ada204946294f932ade4929477e9e2bf66d7b49a66656ec" +dependencies = [ + "aes", + "block-modes", + "hkdf", + "lazy_static", + "num", + "rand 0.8.3", + "serde", + "sha2", + "zbus", + "zbus_macros", + "zvariant", + "zvariant_derive", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + +[[package]] +name = "serde" +version = "1.0.125" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.125" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_repr" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dc6b7951b17b051f3210b063f12cc17320e2fe30ae05b0fe2a3abb068551c76" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sha2" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8f6b75b17576b792bef0db1bcc4b8b8bcdf9506744cf34b974195487af6cff2" +dependencies = [ + "block-buffer", + "cfg-if 1.0.0", + "cpufeatures", + "digest", + "opaque-debug", +] + +[[package]] +name = "slab" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" + +[[package]] +name = "sluice" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fa0333a60ff2e3474a6775cc611840c2a55610c831dd366503474c02f1a28f5" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", +] + +[[package]] +name = "smallvec" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" + +[[package]] +name = "socket2" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "strum" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b" + +[[package]] +name = "strum" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7318c509b5ba57f18533982607f24070a55d353e90d4cae30c467cdb2ad5ac5c" + +[[package]] +name = "strum_macros" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "strum_macros" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8bc6b87a5112aeeab1f4a9f7ab634fe6cbefc4850006df31267f4cfb9e3149" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "subtle" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" + +[[package]] +name = "syn" +version = "1.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "system-deps" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3ecc17269a19353b3558b313bba738b25d82993e30d62a18406a24aba4649b" +dependencies = [ + "heck", + "pkg-config", + "strum 0.18.0", + "strum_macros 0.18.0", + "thiserror", + "toml", + "version-compare 0.0.10", +] + +[[package]] +name = "system-deps" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c248107ad7bc1ac07066a4d003cae9e9a7bc2e27d3418f7a9cdcdc8699dbea70" +dependencies = [ + "anyhow", + "cfg-expr", + "heck", + "itertools 0.10.0", + "pkg-config", + "strum 0.20.0", + "strum_macros 0.20.1", + "thiserror", + "toml", + "version-compare 0.0.11", +] + +[[package]] +name = "thiserror" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinyvec" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83f0c8e7c0addab50b663055baf787d0af7f413a46e6e7fb9559a4e4db7137a5" +dependencies = [ + "autocfg", + "pin-project-lite", +] + +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + +[[package]] +name = "tracing" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" +dependencies = [ + "cfg-if 1.0.0", + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "typenum" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" + +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + +[[package]] +name = "unicode-bidi" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" +dependencies = [ + "matches", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "url" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", +] + +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.2", +] + +[[package]] +name = "vcpkg" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbdbff6266a24120518560b5dc983096efb98462e51d0d68169895b237be3e5d" + +[[package]] +name = "version-compare" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1" + +[[package]] +name = "version-compare" +version = "0.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b" + +[[package]] +name = "version_check" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" + +[[package]] +name = "wepoll-sys" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcb14dea929042224824779fbc82d9fab8d2e6d3cbc0ac404de8edf489e77ff" +dependencies = [ + "cc", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "zbus" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2326acc379a3ac4e34b794089f5bdb17086bf29a5fdf619b7b4cc772dc2e9dad" +dependencies = [ + "async-io", + "byteorder", + "derivative", + "enumflags2", + "fastrand", + "futures", + "nb-connect", + "nix", + "once_cell", + "polling", + "scoped-tls", + "serde", + "serde_repr", + "zbus_macros", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a482c56029e48681b89b92b5db3c446db0915e8dd1052c0328a574eda38d5f93" +dependencies = [ + "proc-macro-crate 0.1.5", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zvariant" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678e7262502a135f49b1ece65010526649be7ee68acb80e1fc5377fc71fef878" +dependencies = [ + "byteorder", + "enumflags2", + "serde", + "zvariant_derive", +] + +[[package]] +name = "zvariant_derive" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d7c34325a35020b94343389cc9391e0f8ac245cca9155429c4022d93141241" +dependencies = [ + "proc-macro-crate 0.1.5", + "proc-macro2", + "quote", + "syn", +] diff --git a/backend/src/error.rs b/backend/src/error.rs index 4693d3c..0fbb735 100644 --- a/backend/src/error.rs +++ b/backend/src/error.rs @@ -21,6 +21,4 @@ pub enum Error { Other(String), } - pub type Result = std::result::Result; - diff --git a/backend/src/library.rs b/backend/src/library.rs index 4a4ba18..7c5d852 100644 --- a/backend/src/library.rs +++ b/backend/src/library.rs @@ -20,9 +20,15 @@ impl Backend { /// Set the path to the music library folder and start a database thread in the background. pub async fn set_music_library_path(&self, path: PathBuf) -> Result<()> { - if let Err(err) = self.settings.set_string("music-library-path", path.to_str().unwrap()) { - warn!("The music library path could not be saved using GSettings. It will most likely \ - not be available at the next startup. Error message: {}", err); + if let Err(err) = self + .settings + .set_string("music-library-path", path.to_str().unwrap()) + { + warn!( + "The music library path could not be saved using GSettings. It will most likely \ + not be available at the next startup. Error message: {}", + err + ); } self.set_music_library_path_priv(path).await diff --git a/backend/src/player.rs b/backend/src/player.rs index f2388fd..9c9cbed 100644 --- a/backend/src/player.rs +++ b/backend/src/player.rs @@ -1,7 +1,7 @@ use crate::{Error, Result}; -use musicus_database::Track; use glib::clone; use gstreamer_player::prelude::*; +use musicus_database::Track; use std::cell::{Cell, RefCell}; use std::path::PathBuf; use std::rc::Rc; @@ -101,9 +101,11 @@ impl Player { #[cfg(target_os = "linux")] { - result.mpris.connect_play_pause(clone!(@weak result => move || { - result.play_pause(); - })); + result + .mpris + .connect_play_pause(clone!(@weak result => move || { + result.play_pause(); + })); result.mpris.connect_play(clone!(@weak result => move || { if !result.is_playing() { @@ -117,9 +119,11 @@ impl Player { } })); - result.mpris.connect_previous(clone!(@weak result => move || { - let _ = result.previous(); - })); + result + .mpris + .connect_previous(clone!(@weak result => move || { + let _ = result.previous(); + })); result.mpris.connect_next(clone!(@weak result => move || { let _ = result.next(); @@ -246,10 +250,9 @@ impl Player { } pub fn previous(&self) -> Result<()> { - let mut current_track = self - .current_track - .get() - .ok_or(Error::Other(String::from("Player tried to access non existant current track.")))?; + let mut current_track = self.current_track.get().ok_or(Error::Other(String::from( + "Player tried to access non existant current track.", + )))?; if current_track > 0 { current_track -= 1; @@ -270,10 +273,9 @@ impl Player { } pub fn next(&self) -> Result<()> { - let mut current_track = self - .current_track - .get() - .ok_or(Error::Other(String::from("Player tried to access non existant current track.")))?; + let mut current_track = self.current_track.get().ok_or(Error::Other(String::from( + "Player tried to access non existant current track.", + )))?; let playlist = self.playlist.borrow(); @@ -289,11 +291,17 @@ impl Player { pub fn set_track(&self, current_track: usize) -> Result<()> { let track = &self.playlist.borrow()[current_track]; - let path = self.music_library_path.join(track.path.clone()) - .into_os_string().into_string().unwrap(); + let path = self + .music_library_path + .join(track.path.clone()) + .into_os_string() + .into_string() + .unwrap(); - let uri = glib::filename_to_uri(&path, None) - .or(Err(Error::Other(format!("Failed to create URI from path: {}", path))))?; + let uri = glib::filename_to_uri(&path, None).or(Err(Error::Other(format!( + "Failed to create URI from path: {}", + path + ))))?; self.player.set_uri(&uri); diff --git a/backend/src/secure.rs b/backend/src/secure.rs index 7005a00..6ab018e 100644 --- a/backend/src/secure.rs +++ b/backend/src/secure.rs @@ -1,6 +1,6 @@ use crate::{Backend, Error, Result}; -use musicus_client::LoginData; use futures_channel::oneshot; +use musicus_client::LoginData; use secret_service::{Collection, EncryptionType, SecretService}; use std::collections::HashMap; use std::thread; @@ -35,14 +35,18 @@ impl Backend { let items = collection.get_all_items()?; let key = "musicus-login-data"; - let item = items.iter().find(|item| item.get_label().unwrap_or_default() == key); + let item = items + .iter() + .find(|item| item.get_label().unwrap_or_default() == key); Ok(match item { Some(item) => { let username = item .get_attributes()? .get("username") - .ok_or(Error::Other("Missing username in SecretService attributes."))? + .ok_or(Error::Other( + "Missing username in SecretService attributes.", + ))? .to_owned(); let password = std::str::from_utf8(&item.get_secret()?)?.to_owned(); @@ -63,7 +67,13 @@ impl Backend { let mut attributes = HashMap::new(); attributes.insert("username", data.username.as_str()); - collection.create_item(key, attributes, data.password.as_bytes(), true, "text/plain")?; + collection.create_item( + key, + attributes, + data.password.as_bytes(), + true, + "text/plain", + )?; Ok(()) } diff --git a/client/src/error.rs b/client/src/error.rs index c14f64d..b3c30c8 100644 --- a/client/src/error.rs +++ b/client/src/error.rs @@ -31,6 +31,4 @@ pub enum Error { Other(&'static str), } - pub type Result = std::result::Result; - diff --git a/client/src/instruments.rs b/client/src/instruments.rs index dfb33b1..13b28dc 100644 --- a/client/src/instruments.rs +++ b/client/src/instruments.rs @@ -14,7 +14,8 @@ impl Client { /// Post a new instrument to the server. pub async fn post_instrument(&self, data: &Instrument) -> Result<()> { info!("Post instrument {:?}", data); - self.post("instruments", serde_json::to_string(data)?).await?; + self.post("instruments", serde_json::to_string(data)?) + .await?; Ok(()) } } diff --git a/client/src/lib.rs b/client/src/lib.rs index 2624843..21decc0 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -1,10 +1,10 @@ -use isahc::{AsyncBody, Request, Response}; use isahc::http::StatusCode; use isahc::prelude::*; +use isahc::{AsyncBody, Request, Response}; use log::info; use serde::Serialize; -use std::time::Duration; use std::cell::RefCell; +use std::time::Duration; pub mod ensembles; pub use ensembles::*; @@ -112,7 +112,7 @@ impl Client { .body(())? .send_async() .await?; - + match response.status() { StatusCode::OK => Ok(response.text().await?), status_code => Err(Error::UnexpectedResponse(status_code)), @@ -164,16 +164,21 @@ impl Client { /// Require the server URL to be set. fn server_url(&self) -> Result { - self.get_server_url().ok_or(Error::Other("The server URL is not available!")) + self.get_server_url() + .ok_or(Error::Other("The server URL is not available!")) } /// Require the login data to be set. fn login_data(&self) -> Result { - self.get_login_data().ok_or(Error::Other("The login data is unset!")) + self.get_login_data() + .ok_or(Error::Other("The login data is unset!")) } /// Require a login token to be set. fn token(&self) -> Result { - self.token.borrow().clone().ok_or(Error::Other("No login token found!")) + self.token + .borrow() + .clone() + .ok_or(Error::Other("No login token found!")) } } diff --git a/client/src/mediums.rs b/client/src/mediums.rs index 255c12d..244f4b5 100644 --- a/client/src/mediums.rs +++ b/client/src/mediums.rs @@ -7,7 +7,9 @@ impl Client { /// recording. pub async fn get_mediums_for_recording(&self, recording_id: &str) -> Result> { info!("Get mediums for recording {}", recording_id); - let body = self.get(&format!("recordings/{}/mediums", recording_id)).await?; + let body = self + .get(&format!("recordings/{}/mediums", recording_id)) + .await?; let mediums: Vec = serde_json::from_str(&body)?; Ok(mediums) } diff --git a/client/src/recordings.rs b/client/src/recordings.rs index 21c15e6..e83bd6e 100644 --- a/client/src/recordings.rs +++ b/client/src/recordings.rs @@ -14,7 +14,8 @@ impl Client { /// Post a new recording to the server. pub async fn post_recording(&self, data: &Recording) -> Result<()> { info!("Post recording {:?}", data); - self.post("recordings", serde_json::to_string(data)?).await?; + self.post("recordings", serde_json::to_string(data)?) + .await?; Ok(()) } } diff --git a/client/src/register.rs b/client/src/register.rs index a6ab725..ff3ce24 100644 --- a/client/src/register.rs +++ b/client/src/register.rs @@ -1,7 +1,7 @@ use crate::{Client, Result}; -use isahc::Request; use isahc::http::StatusCode; use isahc::prelude::*; +use isahc::Request; use log::info; use serde::{Deserialize, Serialize}; use std::time::Duration; diff --git a/database/src/thread.rs b/database/src/thread.rs index be030ec..4d6e0e4 100644 --- a/database/src/thread.rs +++ b/database/src/thread.rs @@ -1,8 +1,8 @@ use super::*; use log::debug; -use tokio::sync::oneshot::{self, Sender}; use std::sync::mpsc; use std::thread; +use tokio::sync::oneshot::{self, Sender}; /// An action the database thread can perform. #[derive(Debug)] @@ -359,28 +359,32 @@ impl DbThread { /// Get all mediums with the specified source ID. pub async fn get_mediums_by_source_id(&self, id: &str) -> Result> { let (sender, receiver) = oneshot::channel(); - self.action_sender.send(GetMediumsBySourceId(id.to_owned(), sender))?; + self.action_sender + .send(GetMediumsBySourceId(id.to_owned(), sender))?; receiver.await? } /// Get all mediums on which a person performs. pub async fn get_mediums_for_person(&self, id: &str) -> Result> { let (sender, receiver) = oneshot::channel(); - self.action_sender.send(GetMediumsForPerson(id.to_owned(), sender))?; + self.action_sender + .send(GetMediumsForPerson(id.to_owned(), sender))?; receiver.await? } /// Get all mediums on which an ensemble performs. pub async fn get_mediums_for_ensemble(&self, id: &str) -> Result> { let (sender, receiver) = oneshot::channel(); - self.action_sender.send(GetMediumsForEnsemble(id.to_owned(), sender))?; + self.action_sender + .send(GetMediumsForEnsemble(id.to_owned(), sender))?; receiver.await? } /// Get all tracks for a recording. pub async fn get_tracks(&self, recording_id: &str) -> Result> { let (sender, receiver) = oneshot::channel(); - self.action_sender.send(GetTracks(recording_id.to_owned(), sender))?; + self.action_sender + .send(GetTracks(recording_id.to_owned(), sender))?; receiver.await? } diff --git a/import/src/disc.rs b/import/src/disc.rs index 2b8f697..763b207 100644 --- a/import/src/disc.rs +++ b/import/src/disc.rs @@ -1,10 +1,10 @@ use crate::error::{Error, Result}; use crate::session::{ImportSession, ImportTrack, State}; use gstreamer::prelude::*; -use gstreamer::{ClockTime, ElementFactory, MessageType, MessageView, TocEntryType}; use gstreamer::tags::{Duration, TrackNumber}; +use gstreamer::{ClockTime, ElementFactory, MessageType, MessageView, TocEntryType}; use log::info; -use sha2::{Sha256, Digest}; +use sha2::{Digest, Sha256}; use std::path::PathBuf; use tokio::sync::watch; @@ -28,23 +28,31 @@ pub(super) fn new() -> Result { pipeline.add_many(&[&cdparanoiasrc, &queue, &audioconvert, &flacenc, &fakesink])?; gstreamer::Element::link_many(&[&cdparanoiasrc, &queue, &audioconvert, &flacenc, &fakesink])?; - let bus = pipeline.get_bus().ok_or(Error::u(String::from("Failed to get bus from pipeline.")))?; + let bus = pipeline + .get_bus() + .ok_or(Error::u(String::from("Failed to get bus from pipeline.")))?; // Run the pipeline into the paused state and wait for the resulting TOC message on the bus. pipeline.set_state(gstreamer::State::Paused)?; - let msg = bus.timed_pop_filtered(ClockTime::from_seconds(5), - &vec![MessageType::Toc, MessageType::Error]); + let msg = bus.timed_pop_filtered( + ClockTime::from_seconds(5), + &vec![MessageType::Toc, MessageType::Error], + ); let toc = match msg { Some(msg) => match msg.view() { MessageView::Error(err) => Err(Error::os(err.get_error())), MessageView::Toc(toc) => Ok(toc.get_toc().0), - _ => Err(Error::u(format!("Unexpected message from GStreamer: {:?}", msg))), + _ => Err(Error::u(format!( + "Unexpected message from GStreamer: {:?}", + msg + ))), }, - None => Err(Error::Timeout( - format!("Timeout while waiting for first message from GStreamer."))), + None => Err(Error::Timeout(format!( + "Timeout while waiting for first message from GStreamer." + ))), }?; pipeline.set_state(gstreamer::State::Ready)?; @@ -66,22 +74,31 @@ pub(super) fn new() -> Result { for entry in toc.get_entries() { if entry.get_entry_type() == TocEntryType::Track { - let duration = entry.get_tags() + let duration = entry + .get_tags() .ok_or(Error::u(String::from("No tags in TOC entry.")))? .get::() - .ok_or(Error::u(String::from("No duration tag found in TOC entry.")))? + .ok_or(Error::u(String::from( + "No duration tag found in TOC entry.", + )))? .get() - .ok_or(Error::u(String::from("Failed to unwrap duration tag from TOC entry.")))? + .ok_or(Error::u(String::from( + "Failed to unwrap duration tag from TOC entry.", + )))? .mseconds() .ok_or(Error::u(String::from("Failed to unwrap track duration.")))?; - let number = entry.get_tags() + let number = entry + .get_tags() .ok_or(Error::u(String::from("No tags in TOC entry.")))? .get::() - .ok_or(Error::u(String::from("No track number tag found in TOC entry.")))? + .ok_or(Error::u(String::from( + "No track number tag found in TOC entry.", + )))? .get() - .ok_or(Error::u( - String::from("Failed to unwrap track number tag from TOC entry.")))?; + .ok_or(Error::u(String::from( + "Failed to unwrap track number tag from TOC entry.", + )))?; hasher.update(duration.to_le_bytes()); @@ -129,11 +146,11 @@ pub(super) fn new() -> Result { info!("Finished ripping track {}.", track.number); pipeline.set_state(gstreamer::State::Ready)?; break; - }, + } MessageView::Error(err) => { pipeline.set_state(gstreamer::State::Null)?; Err(Error::os(err.get_error()))?; - }, + } _ => (), } } @@ -157,8 +174,9 @@ pub(super) fn new() -> Result { /// Create a new temporary directory and return its path. fn create_tmp_dir() -> Result { - let mut tmp_dir = glib::get_tmp_dir().ok_or(Error::u( - String::from("Failed to get temporary directory using glib::get_tmp_dir().")))?; + let mut tmp_dir = glib::tmp_dir().ok_or(Error::u(String::from( + "Failed to get temporary directory using glib::get_tmp_dir().", + )))?; let dir_name = format!("musicus-{}", rand::random::()); tmp_dir.push(dir_name); @@ -167,4 +185,3 @@ fn create_tmp_dir() -> Result { Ok(tmp_dir) } - diff --git a/import/src/error.rs b/import/src/error.rs index adcded0..127b65c 100644 --- a/import/src/error.rs +++ b/import/src/error.rs @@ -39,10 +39,7 @@ impl Error { /// Create a new unexpected error without an explicit source. pub(super) fn u(msg: String) -> Self { - Self::Unexpected { - msg, - source: None, - } + Self::Unexpected { msg, source: None } } /// Create a new unexpected error with an explicit source. @@ -85,4 +82,3 @@ impl From for Error { } pub type Result = std::result::Result; - diff --git a/import/src/folder.rs b/import/src/folder.rs index a072cbc..d629dd0 100644 --- a/import/src/folder.rs +++ b/import/src/folder.rs @@ -2,8 +2,8 @@ use crate::error::{Error, Result}; use crate::session::{ImportSession, ImportTrack, State}; use gstreamer::ClockTime; use gstreamer_pbutils::Discoverer; -use log::{warn, info}; -use sha2::{Sha256, Digest}; +use log::{info, warn}; +use sha2::{Digest, Sha256}; use std::fs::DirEntry; use std::path::PathBuf; use tokio::sync::watch; @@ -17,26 +17,32 @@ pub(super) fn new(path: PathBuf) -> Result { let mut hasher = Sha256::new(); let discoverer = Discoverer::new(ClockTime::from_seconds(1))?; - let mut entries = std::fs::read_dir(path)?.collect::, std::io::Error>>()?; + let mut entries = + std::fs::read_dir(path)?.collect::, std::io::Error>>()?; entries.sort_by(|entry1, entry2| entry1.file_name().cmp(&entry2.file_name())); for entry in entries { if entry.file_type()?.is_file() { let path = entry.path(); - let uri = glib::filename_to_uri(&path, None) - .or(Err(Error::u(format!("Failed to create URI from path: {:?}", path))))?; + let uri = glib::filename_to_uri(&path, None).or(Err(Error::u(format!( + "Failed to create URI from path: {:?}", + path + ))))?; let info = discoverer.discover_uri(&uri)?; if !info.get_audio_streams().is_empty() { - let duration = info.get_duration().mseconds() + let duration = info + .get_duration() + .mseconds() .ok_or(Error::u(format!("Failed to get duration for {}.", uri)))?; let file_name = entry.file_name(); - let name = file_name.into_string() - .or(Err(Error::u(format!( - "Failed to convert OsString to String: {:?}", entry.file_name()))))?; + let name = file_name.into_string().or(Err(Error::u(format!( + "Failed to convert OsString to String: {:?}", + entry.file_name() + ))))?; hasher.update(duration.to_le_bytes()); @@ -50,7 +56,10 @@ pub(super) fn new(path: PathBuf) -> Result { tracks.push(track); number += 1; } else { - warn!("File {} skipped, because it doesn't contain any audio streams.", uri); + warn!( + "File {} skipped, because it doesn't contain any audio streams.", + uri + ); } } } diff --git a/import/src/lib.rs b/import/src/lib.rs index c0e87b6..4912a13 100644 --- a/import/src/lib.rs +++ b/import/src/lib.rs @@ -1,5 +1,5 @@ -pub use session::{ImportSession, ImportTrack, State}; pub use error::{Error, Result}; +pub use session::{ImportSession, ImportTrack, State}; pub mod error; pub mod session; diff --git a/import/src/session.rs b/import/src/session.rs index fd9e226..5a009da 100644 --- a/import/src/session.rs +++ b/import/src/session.rs @@ -1,8 +1,8 @@ -use crate::{disc, folder}; use crate::error::Result; +use crate::{disc, folder}; use std::path::PathBuf; -use std::thread; use std::sync::Arc; +use std::thread; use tokio::sync::{oneshot, watch}; /// The current state of the import process. diff --git a/musicus/Cargo.toml b/musicus/Cargo.toml index 36aaaff..4d269ad 100644 --- a/musicus/Cargo.toml +++ b/musicus/Cargo.toml @@ -9,7 +9,7 @@ async-trait = "0.1.42" futures-channel = "0.3.5" gettext-rs = { version = "0.5.0", features = ["gettext-system"] } gstreamer = "0.16.4" -gtk-macros = "0.2.0" +gtk-macros = "0.3.0" log = "0.4.14" musicus_backend = { version = "0.1.0", path = "../backend" } once_cell = "1.5.2" @@ -33,7 +33,7 @@ git = "https://github.com/gtk-rs/gtk4-rs" package = "gtk4" [dependencies.libadwaita] -git = "https://gitlab.gnome.org/bilelmoussaoui/libadwaita-rs" +git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs.git" package = "libadwaita" [dependencies.pango] diff --git a/musicus/src/editors/ensemble.rs b/musicus/src/editors/ensemble.rs index fe58d8a..6947492 100644 --- a/musicus/src/editors/ensemble.rs +++ b/musicus/src/editors/ensemble.rs @@ -78,7 +78,7 @@ impl Screen, Ensemble> for EnsembleEditor { this.name .entry .connect_changed(clone!(@weak this => move |_| this.validate())); - + this.validate(); this diff --git a/musicus/src/editors/performance.rs b/musicus/src/editors/performance.rs index af76258..05a7c8a 100644 --- a/musicus/src/editors/performance.rs +++ b/musicus/src/editors/performance.rs @@ -1,11 +1,11 @@ use crate::navigator::{NavigationHandle, Screen}; use crate::selectors::{EnsembleSelector, InstrumentSelector, PersonSelector}; -use crate::widgets::{Editor, Section, ButtonRow, Widget}; +use crate::widgets::{ButtonRow, Editor, Section, Widget}; use gettextrs::gettext; use glib::clone; use gtk::prelude::*; use libadwaita::prelude::*; -use musicus_backend::db::{Performance, Person, Ensemble, Instrument}; +use musicus_backend::db::{Ensemble, Instrument, Performance, Person}; use std::cell::RefCell; use std::rc::Rc; @@ -40,8 +40,9 @@ impl Screen, Performance> for PerformanceEditor { performer_list.append(&ensemble_row.get_widget()); let performer_section = Section::new(&gettext("Performer"), &performer_list); - performer_section.set_subtitle( - &gettext("Select either a person or an ensemble as a performer.")); + performer_section.set_subtitle(&gettext( + "Select either a person or an ensemble as a performer.", + )); let role_list = gtk::ListBoxBuilder::new() .selection_mode(gtk::SelectionMode::None) @@ -59,8 +60,9 @@ impl Screen, Performance> for PerformanceEditor { role_list.append(&role_row.get_widget()); let role_section = Section::new(&gettext("Role"), &role_list); - role_section.set_subtitle( - &gettext("Optionally, choose a role to specify what the performer does.")); + role_section.set_subtitle(&gettext( + "Optionally, choose a role to specify what the performer does.", + )); editor.add_content(&performer_section); editor.add_content(&role_section); @@ -102,7 +104,7 @@ impl Screen, Performance> for PerformanceEditor { }); })); - this.ensemble_row.set_cb(clone!(@weak this => move || { + this.ensemble_row.set_cb(clone!(@weak this => move || { spawn!(@clone this, async move { if let Some(ensemble) = push!(this.handle, EnsembleSelector).await { this.show_person(None); @@ -113,7 +115,7 @@ impl Screen, Performance> for PerformanceEditor { }); })); - this.role_row.set_cb(clone!(@weak this => move || { + this.role_row.set_cb(clone!(@weak this => move || { spawn!(@clone this, async move { if let Some(role) = push!(this.handle, InstrumentSelector).await { this.show_role(Some(&role)); @@ -122,10 +124,11 @@ impl Screen, Performance> for PerformanceEditor { }); })); - this.reset_role_button.connect_clicked(clone!(@weak this => move |_| { - this.show_role(None); - this.role.replace(None); - })); + this.reset_role_button + .connect_clicked(clone!(@weak this => move |_| { + this.show_role(None); + this.role.replace(None); + })); // Initialize diff --git a/musicus/src/editors/person.rs b/musicus/src/editors/person.rs index eeb679d..2b99d1c 100644 --- a/musicus/src/editors/person.rs +++ b/musicus/src/editors/person.rs @@ -63,7 +63,7 @@ impl Screen, Person> for PersonEditor { // Connect signals and callbacks - this.editor.set_back_cb(clone!(@weak this => move || { + this.editor.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); @@ -84,11 +84,11 @@ impl Screen, Person> for PersonEditor { this.first_name .entry - .connect_changed(clone!(@weak this => move |_| this.validate())); + .connect_changed(clone!(@weak this => move |_| this.validate())); this.last_name .entry - .connect_changed(clone!(@weak this => move |_| this.validate())); + .connect_changed(clone!(@weak this => move |_| this.validate())); this.validate(); diff --git a/musicus/src/editors/recording.rs b/musicus/src/editors/recording.rs index 89b55b0..0604b35 100644 --- a/musicus/src/editors/recording.rs +++ b/musicus/src/editors/recording.rs @@ -1,7 +1,7 @@ use super::performance::PerformanceEditor; +use crate::navigator::{NavigationHandle, Screen}; use crate::selectors::WorkSelector; use crate::widgets::{List, Widget}; -use crate::navigator::{NavigationHandle, Screen}; use anyhow::Result; use gettextrs::gettext; use glib::clone; @@ -74,26 +74,27 @@ impl Screen, Recording> for RecordingEditor { // Connect signals and callbacks - back_button.connect_clicked(clone!(@weak this => move |_| { + back_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); - this.save_button.connect_clicked(clone!(@weak this => move |_| { - spawn!(@clone this, async move { - this.widget.set_visible_child_name("loading"); - match this.save().await { - Ok(recording) => { - this.handle.pop(Some(recording)); + this.save_button + .connect_clicked(clone!(@weak this => move |_| { + spawn!(@clone this, async move { + this.widget.set_visible_child_name("loading"); + match this.save().await { + Ok(recording) => { + this.handle.pop(Some(recording)); + } + Err(_) => { + this.info_bar.set_revealed(true); + this.widget.set_visible_child_name("content"); + } } - Err(_) => { - this.info_bar.set_revealed(true); - this.widget.set_visible_child_name("content"); - } - } - }); - })); + }); + })); - work_button.connect_clicked(clone!(@weak this => move |_| { + work_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { if let Some(work) = push!(this.handle, WorkSelector).await { this.work_selected(&work); @@ -102,13 +103,13 @@ impl Screen, Recording> for RecordingEditor { }); })); - this.performance_list.set_make_widget_cb(clone!(@weak this => move |index| { + this.performance_list.set_make_widget_cb(clone!(@weak this => @default-panic, move |index| { let performance = &this.performances.borrow()[index]; let delete_button = gtk::Button::from_icon_name(Some("user-trash-symbolic")); delete_button.set_valign(gtk::Align::Center); - delete_button.connect_clicked(clone!(@weak this => move |_| { + delete_button.connect_clicked(clone!(@weak this => move |_| { let length = { let mut performances = this.performances.borrow_mut(); performances.remove(index); @@ -121,7 +122,7 @@ impl Screen, Recording> for RecordingEditor { let edit_button = gtk::Button::from_icon_name(Some("document-edit-symbolic")); edit_button.set_valign(gtk::Align::Center); - edit_button.connect_clicked(clone!(@weak this => move |_| { + edit_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { let performance = &this.performances.borrow()[index]; if let Some(performance) = push!(this.handle, PerformanceEditor, Some(performance.to_owned())).await { @@ -190,16 +191,17 @@ impl RecordingEditor { .borrow() .clone() .expect("Tried to create recording without work!"), - comment: self.comment_entry.get_text().to_string(), + comment: self.comment_entry.text().to_string(), performances: self.performances.borrow().clone(), }; - let upload = self.upload_switch.get_active(); + let upload = self.upload_switch.state(); if upload { self.handle.backend.cl().post_recording(&recording).await?; } - self.handle.backend + self.handle + .backend .db() .update_recording(recording.clone().into()) .await diff --git a/musicus/src/editors/work.rs b/musicus/src/editors/work.rs index 708c85b..cea397e 100644 --- a/musicus/src/editors/work.rs +++ b/musicus/src/editors/work.rs @@ -117,12 +117,12 @@ impl Screen, Work> for WorkEditor { // Connect signals and callbacks - back_button.connect_clicked(clone!(@weak this => move |_| { + back_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); this.save_button - .connect_clicked(clone!(@weak this => move |_| { + .connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { this.widget.set_visible_child_name("loading"); match this.save().await { @@ -137,7 +137,7 @@ impl Screen, Work> for WorkEditor { }); })); - composer_button.connect_clicked(clone!(@weak this => move |_| { + composer_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { if let Some(person) = push!(this.handle, PersonSelector).await { this.show_composer(&person); @@ -147,10 +147,10 @@ impl Screen, Work> for WorkEditor { })); this.title_entry - .connect_changed(clone!(@weak this => move |_| this.validate())); + .connect_changed(clone!(@weak this => move |_| this.validate())); - this.instrument_list - .set_make_widget_cb(clone!(@weak this => move |index| { + this.instrument_list.set_make_widget_cb( + clone!(@weak this => @default-panic, move |index| { let instrument = &this.instruments.borrow()[index]; let delete_button = gtk::Button::from_icon_name(Some("user-trash-symbolic")); @@ -171,9 +171,10 @@ impl Screen, Work> for WorkEditor { row.add_suffix(&delete_button); row.upcast() - })); + }), + ); - add_instrument_button.connect_clicked(clone!(@weak this => move |_| { + add_instrument_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { if let Some(instrument) = push!(this.handle, InstrumentSelector).await { let length = { @@ -187,13 +188,13 @@ impl Screen, Work> for WorkEditor { }); })); - this.part_list.set_make_widget_cb(clone!(@weak this => move |index| { + this.part_list.set_make_widget_cb(clone!(@weak this => @default-panic, move |index| { let pos = &this.structure.borrow()[index]; let delete_button = gtk::Button::from_icon_name(Some("user-trash-symbolic")); delete_button.set_valign(gtk::Align::Center); - delete_button.connect_clicked(clone!(@weak this => move |_| { + delete_button.connect_clicked(clone!(@weak this => move |_| { let length = { let mut structure = this.structure.borrow_mut(); structure.remove(index); @@ -206,7 +207,7 @@ impl Screen, Work> for WorkEditor { let edit_button = gtk::Button::from_icon_name(Some("document-edit-symbolic")); edit_button.set_valign(gtk::Align::Center); - edit_button.connect_clicked(clone!(@weak this => move |_| { + edit_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { match this.structure.borrow()[index].clone() { PartOrSection::Part(part) => { @@ -251,7 +252,7 @@ impl Screen, Work> for WorkEditor { })); this.part_list - .set_move_cb(clone!(@weak this => move |old_index, new_index| { + .set_move_cb(clone!(@weak this => move |old_index, new_index| { let length = { let mut structure = this.structure.borrow_mut(); structure.swap(old_index, new_index); @@ -261,7 +262,7 @@ impl Screen, Work> for WorkEditor { this.part_list.update(length); })); - add_part_button.connect_clicked(clone!(@weak this => move |_| { + add_part_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { if let Some(part) = push!(this.handle, WorkPartEditor, None).await { let length = { @@ -312,9 +313,8 @@ impl WorkEditor { /// Validate inputs and enable/disable saving. fn validate(&self) { - self.save_button.set_sensitive( - !self.title_entry.get_text().is_empty() && self.composer.borrow().is_some(), - ); + self.save_button + .set_sensitive(!self.title_entry.text().is_empty() && self.composer.borrow().is_some()); } /// Save the work and possibly upload it to the server. @@ -337,7 +337,7 @@ impl WorkEditor { let work = Work { id: self.id.clone(), - title: self.title_entry.get_text().to_string(), + title: self.title_entry.text().to_string(), composer: self .composer .borrow() @@ -348,7 +348,7 @@ impl WorkEditor { sections: sections, }; - let upload = self.upload_switch.get_active(); + let upload = self.upload_switch.state(); if upload { self.handle.backend.cl().post_work(&work).await?; } diff --git a/musicus/src/editors/work_part.rs b/musicus/src/editors/work_part.rs index b0ac68b..6e28fef 100644 --- a/musicus/src/editors/work_part.rs +++ b/musicus/src/editors/work_part.rs @@ -39,21 +39,21 @@ impl Screen, WorkPart> for WorkPartEditor { // Connect signals and callbacks - back_button.connect_clicked(clone!(@weak this => move |_| { + back_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); this.save_button - .connect_clicked(clone!(@weak this => move |_| { + .connect_clicked(clone!(@weak this => move |_| { let section = WorkPart { - title: this.title_entry.get_text().to_string(), + title: this.title_entry.text().to_string(), }; this.handle.pop(Some(section)); })); this.title_entry - .connect_changed(clone!(@weak this => move |_| this.validate())); + .connect_changed(clone!(@weak this => move |_| this.validate())); this.validate(); @@ -65,7 +65,7 @@ impl WorkPartEditor { /// Validate inputs and enable/disable saving. fn validate(&self) { self.save_button - .set_sensitive(!self.title_entry.get_text().is_empty()); + .set_sensitive(!self.title_entry.text().is_empty()); } } diff --git a/musicus/src/editors/work_section.rs b/musicus/src/editors/work_section.rs index ff09409..fbe8a9d 100644 --- a/musicus/src/editors/work_section.rs +++ b/musicus/src/editors/work_section.rs @@ -39,22 +39,22 @@ impl Screen, WorkSection> for WorkSectionEditor { // Connect signals and callbacks - back_button.connect_clicked(clone!(@weak this => move |_| { + back_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); this.save_button - .connect_clicked(clone!(@weak this => move |_| { + .connect_clicked(clone!(@weak this => move |_| { let section = WorkSection { before_index: 0, - title: this.title_entry.get_text().to_string(), + title: this.title_entry.text().to_string(), }; this.handle.pop(Some(section)); })); this.title_entry - .connect_changed(clone!(@weak this => move |_| this.validate())); + .connect_changed(clone!(@weak this => move |_| this.validate())); this.validate(); @@ -66,7 +66,7 @@ impl WorkSectionEditor { /// Validate inputs and enable/disable saving. fn validate(&self) { self.save_button - .set_sensitive(!self.title_entry.get_text().is_empty()); + .set_sensitive(!self.title_entry.text().is_empty()); } } diff --git a/musicus/src/import/import_screen.rs b/musicus/src/import/import_screen.rs index 07aeae6..bfc5fd9 100644 --- a/musicus/src/import/import_screen.rs +++ b/musicus/src/import/import_screen.rs @@ -7,9 +7,9 @@ use glib::clone; use gtk::prelude::*; use gtk_macros::get_widget; use libadwaita::prelude::*; -use musicus_backend::Error; use musicus_backend::db::Medium; use musicus_backend::import::ImportSession; +use musicus_backend::Error; use std::rc::Rc; use std::sync::Arc; @@ -31,7 +31,7 @@ impl ImportScreen { let this = self; spawn!(@clone this, async move { - let mediums: Result, Error> = if this.server_check_button.get_active() { + let mediums: Result, Error> = if this.server_check_button.is_active() { this.handle.backend.cl().get_mediums_by_discid(this.session.source_id()).await.map_err(|err| err.into()) } else { this.handle.backend.db().get_mediums_by_source_id(this.session.source_id()).await.map_err(|err| err.into()) @@ -56,9 +56,9 @@ impl ImportScreen { /// Populate the list of matches fn show_matches(self: &Rc, mediums: Vec) { - if let Some(mut child) = self.matching_list.get_first_child() { + if let Some(mut child) = self.matching_list.first_child() { loop { - let next_child = child.get_next_sibling(); + let next_child = child.next_sibling(); self.matching_list.remove(&child); match next_child { @@ -77,7 +77,7 @@ impl ImportScreen { .activatable(true) .build(); - row.connect_activated(clone!(@weak this => move |_| { + row.connect_activated(clone!(@weak this => move |_| { let medium = medium.clone(); spawn!(@clone this, async move { if let Some(()) = push!(this.handle, MediumPreview, (this.session.clone(), medium.clone())).await { @@ -133,20 +133,21 @@ impl Screen, ()> for ImportScreen { // Connect signals and callbacks - back_button.connect_clicked(clone!(@weak this => move |_| { + back_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); - this.server_check_button.connect_toggled(clone!(@weak this => move |_| { - this.handle.backend.set_use_server(this.server_check_button.get_active()); + this.server_check_button + .connect_toggled(clone!(@weak this => move |_| { + this.handle.backend.set_use_server(this.server_check_button.is_active()); + this.load_matches(); + })); + + try_again_button.connect_clicked(clone!(@weak this => move |_| { this.load_matches(); })); - try_again_button.connect_clicked(clone!(@weak this => move |_| { - this.load_matches(); - })); - - select_button.connect_clicked(clone!(@weak this => move |_| { + select_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { if let Some(medium) = push!(this.handle, MediumSelector).await { this.select_medium(medium); @@ -154,7 +155,7 @@ impl Screen, ()> for ImportScreen { }); })); - add_button.connect_clicked(clone!(@weak this => move |_| { + add_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { if let Some(medium) = push!(this.handle, MediumEditor, (Arc::clone(&this.session), None)).await { this.select_medium(medium); diff --git a/musicus/src/import/medium_editor.rs b/musicus/src/import/medium_editor.rs index 14e663d..163386f 100644 --- a/musicus/src/import/medium_editor.rs +++ b/musicus/src/import/medium_editor.rs @@ -66,12 +66,12 @@ impl Screen<(Arc, Option), Medium> for MediumEditor { // Connect signals and callbacks - back_button.connect_clicked(clone!(@weak this => move |_| { + back_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); this.done_button - .connect_clicked(clone!(@weak this => move |_| { + .connect_clicked(clone!(@weak this => move |_| { this.widget.set_visible_child_name("loading"); spawn!(@clone this, async move { match this.save().await { @@ -85,9 +85,9 @@ impl Screen<(Arc, Option), Medium> for MediumEditor { })); this.name_entry - .connect_changed(clone!(@weak this => move |_| this.validate())); + .connect_changed(clone!(@weak this => move |_| this.validate())); - add_button.connect_clicked(clone!(@weak this => move |_| { + add_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { if let Some(track_set) = push!(this.handle, TrackSetEditor, Arc::clone(&this.session)).await { let length = { @@ -102,12 +102,13 @@ impl Screen<(Arc, Option), Medium> for MediumEditor { }); })); - this.publish_switch.connect_property_state_notify(clone!(@weak this => move |_| { - this.handle.backend.set_use_server(this.publish_switch.get_state()); - })); + this.publish_switch + .connect_state_notify(clone!(@weak this => move |_| { + this.handle.backend.set_use_server(this.publish_switch.state()); + })); - this.track_set_list - .set_make_widget_cb(clone!(@weak this => move |index| { + this.track_set_list.set_make_widget_cb( + clone!(@weak this => @default-panic, move |index| { let track_set = &this.track_sets.borrow()[index]; let title = track_set.recording.work.get_title(); @@ -126,18 +127,19 @@ impl Screen<(Arc, Option), Medium> for MediumEditor { row.add_suffix(&edit_button); row.set_activatable_widget(Some(&edit_button)); - edit_button.connect_clicked(clone!(@weak this => move |_| { + edit_button.connect_clicked(clone!(@weak this => move |_| { // TODO: Implement editing. })); row.upcast() - })); + }), + ); - try_again_button.connect_clicked(clone!(@weak this => move |_| { + try_again_button.connect_clicked(clone!(@weak this => move |_| { this.widget.set_visible_child_name("content"); })); - cancel_button.connect_clicked(clone!(@weak this => move |_| { + cancel_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); @@ -182,7 +184,7 @@ impl MediumEditor { /// Validate inputs and enable/disable saving. fn validate(&self) { self.done_button.set_sensitive( - !self.name_entry.get_text().is_empty() && !self.track_sets.borrow().is_empty(), + !self.name_entry.text().is_empty() && !self.track_sets.borrow().is_empty(), ); } @@ -207,12 +209,12 @@ impl MediumEditor { let medium = Medium { id: generate_id(), - name: self.name_entry.get_text().to_string(), + name: self.name_entry.text().to_string(), discid: Some(self.session.source_id().to_owned()), tracks: tracks, }; - let upload = self.publish_switch.get_active(); + let upload = self.publish_switch.state(); if upload { self.handle.backend.cl().post_medium(&medium).await?; } diff --git a/musicus/src/import/medium_preview.rs b/musicus/src/import/medium_preview.rs index b8c90d0..211038d 100644 --- a/musicus/src/import/medium_preview.rs +++ b/musicus/src/import/medium_preview.rs @@ -60,11 +60,11 @@ impl Screen<(Arc, Medium), ()> for MediumPreview { // Connect signals and callbacks - back_button.connect_clicked(clone!(@weak this => move |_| { + back_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); - edit_button.connect_clicked(clone!(@weak this => move |_| { + edit_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { let old_medium = this.medium.borrow().clone().unwrap(); if let Some(medium) = push!(this.handle, MediumEditor, (this.session.clone(), Some(old_medium))).await { @@ -74,7 +74,7 @@ impl Screen<(Arc, Medium), ()> for MediumPreview { })); this.import_button - .connect_clicked(clone!(@weak this => move |_| { + .connect_clicked(clone!(@weak this => move |_| { this.widget.set_visible_child_name("loading"); spawn!(@clone this, async move { @@ -88,7 +88,7 @@ impl Screen<(Arc, Medium), ()> for MediumPreview { }); })); - try_again_button.connect_clicked(clone!(@weak this => move |_| { + try_again_button.connect_clicked(clone!(@weak this => move |_| { this.widget.set_visible_child_name("content"); })); @@ -116,11 +116,11 @@ impl MediumPreview { fn set_medium(&self, medium: Medium) { self.name_label.set_text(&medium.name); - if let Some(widget) = self.medium_box.get_first_child() { + if let Some(widget) = self.medium_box.first_child() { let mut child = widget; loop { - let next_child = child.get_next_sibling(); + let next_child = child.next_sibling(); self.medium_box.remove(&child); match next_child { diff --git a/musicus/src/import/source_selector.rs b/musicus/src/import/source_selector.rs index 418236b..6b3c97a 100644 --- a/musicus/src/import/source_selector.rs +++ b/musicus/src/import/source_selector.rs @@ -38,11 +38,11 @@ impl Screen<(), ()> for SourceSelector { // Connect signals and callbacks - back_button.connect_clicked(clone!(@weak this => move |_| { + back_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); - folder_button.connect_clicked(clone!(@weak this => move |_| { + folder_button.connect_clicked(clone!(@weak this => move |_| { let dialog = gtk::FileChooserDialog::new( Some(&gettext("Select folder")), Some(&this.handle.window), @@ -54,12 +54,12 @@ impl Screen<(), ()> for SourceSelector { dialog.set_modal(true); - dialog.connect_response(clone!(@weak this => move |dialog, response| { + dialog.connect_response(clone!(@weak this => move |dialog, response| { dialog.hide(); if let gtk::ResponseType::Accept = response { - if let Some(file) = dialog.get_file() { - if let Some(path) = file.get_path() { + if let Some(file) = dialog.file() { + if let Some(path) = file.path() { this.widget.set_visible_child_name("loading"); spawn!(@clone this, async move { @@ -82,7 +82,7 @@ impl Screen<(), ()> for SourceSelector { dialog.show(); })); - disc_button.connect_clicked(clone!(@weak this => move |_| { + disc_button.connect_clicked(clone!(@weak this => move |_| { this.widget.set_visible_child_name("loading"); spawn!(@clone this, async move { @@ -99,7 +99,7 @@ impl Screen<(), ()> for SourceSelector { }); })); - try_again_button.connect_clicked(clone!(@weak this => move |_| { + try_again_button.connect_clicked(clone!(@weak this => move |_| { this.widget.set_visible_child_name("content"); })); diff --git a/musicus/src/import/track_editor.rs b/musicus/src/import/track_editor.rs index d87fee7..0f0887b 100644 --- a/musicus/src/import/track_editor.rs +++ b/musicus/src/import/track_editor.rs @@ -17,7 +17,10 @@ pub struct TrackEditor { impl Screen<(Recording, Vec), Vec> for TrackEditor { /// Create a new track editor. - fn new((recording, selection): (Recording, Vec), handle: NavigationHandle>) -> Rc { + fn new( + (recording, selection): (Recording, Vec), + handle: NavigationHandle>, + ) -> Rc { // Create UI let builder = gtk::Builder::from_resource("/de/johrpan/musicus/ui/track_editor.ui"); @@ -41,11 +44,11 @@ impl Screen<(Recording, Vec), Vec> for TrackEditor { // Connect signals and callbacks - back_button.connect_clicked(clone!(@weak this => move |_| { + back_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); - select_button.connect_clicked(clone!(@weak this => move |_| { + select_button.connect_clicked(clone!(@weak this => move |_| { let selection = this.selection.borrow().clone(); this.handle.pop(Some(selection)); })); @@ -54,9 +57,9 @@ impl Screen<(Recording, Vec), Vec> for TrackEditor { let check = gtk::CheckButton::new(); check.set_active(this.selection.borrow().contains(&index)); - check.connect_toggled(clone!(@weak this => move |check| { + check.connect_toggled(clone!(@weak this => move |check| { let mut selection = this.selection.borrow_mut(); - if check.get_active() { + if check.is_active() { selection.push(index); } else { if let Some(pos) = selection.iter().position(|part| *part == index) { diff --git a/musicus/src/import/track_selector.rs b/musicus/src/import/track_selector.rs index 93e204d..63bd623 100644 --- a/musicus/src/import/track_selector.rs +++ b/musicus/src/import/track_selector.rs @@ -46,23 +46,24 @@ impl Screen, Vec> for TrackSelector { // Connect signals and callbacks - back_button.connect_clicked(clone!(@weak this => move |_| { + back_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); - this.select_button.connect_clicked(clone!(@weak this => move |_| { - let selection = this.selection.borrow().clone(); - this.handle.pop(Some(selection)); - })); + this.select_button + .connect_clicked(clone!(@weak this => move |_| { + let selection = this.selection.borrow().clone(); + this.handle.pop(Some(selection)); + })); let tracks = this.session.tracks(); for (index, track) in tracks.iter().enumerate() { let check = gtk::CheckButton::new(); - check.connect_toggled(clone!(@weak this => move |check| { + check.connect_toggled(clone!(@weak this => move |check| { let mut selection = this.selection.borrow_mut(); - if check.get_active() { + if check.is_active() { selection.push(index); } else { if let Some(pos) = selection.iter().position(|part| *part == index) { diff --git a/musicus/src/import/track_set_editor.rs b/musicus/src/import/track_set_editor.rs index a71a5b9..00f7342 100644 --- a/musicus/src/import/track_set_editor.rs +++ b/musicus/src/import/track_set_editor.rs @@ -74,12 +74,12 @@ impl Screen, TrackSetData> for TrackSetEditor { // Connect signals and callbacks - back_button.connect_clicked(clone!(@weak this => move |_| { + back_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); this.save_button - .connect_clicked(clone!(@weak this => move |_| { + .connect_clicked(clone!(@weak this => move |_| { let data = TrackSetData { recording: this.recording.borrow().clone().unwrap(), tracks: this.tracks.borrow().clone(), @@ -88,7 +88,7 @@ impl Screen, TrackSetData> for TrackSetEditor { this.handle.pop(Some(data)); })); - select_recording_button.connect_clicked(clone!(@weak this => move |_| { + select_recording_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { if let Some(recording) = push!(this.handle, RecordingSelector).await { this.recording.replace(Some(recording)); @@ -97,7 +97,7 @@ impl Screen, TrackSetData> for TrackSetEditor { }); })); - edit_tracks_button.connect_clicked(clone!(@weak this => move |_| { + edit_tracks_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { if let Some(selection) = push!(this.handle, TrackSelector, Arc::clone(&this.session)).await { let mut tracks = Vec::new(); @@ -119,7 +119,7 @@ impl Screen, TrackSetData> for TrackSetEditor { }); })); - this.track_list.set_make_widget_cb(clone!(@weak this => move |index| { + this.track_list.set_make_widget_cb(clone!(@weak this => @default-panic, move |index| { let track = &this.tracks.borrow()[index]; let mut title_parts = Vec::::new(); @@ -152,7 +152,7 @@ impl Screen, TrackSetData> for TrackSetEditor { row.add_suffix(&edit_button); row.set_activatable_widget(Some(&edit_button)); - edit_button.connect_clicked(clone!(@weak this => move |_| { + edit_button.connect_clicked(clone!(@weak this => move |_| { let recording = this.recording.borrow().clone(); if let Some(recording) = recording { spawn!(@clone this, async move { diff --git a/musicus/src/macros.rs b/musicus/src/macros.rs index 1a80193..3a1af6c 100644 --- a/musicus/src/macros.rs +++ b/musicus/src/macros.rs @@ -68,19 +68,13 @@ macro_rules! replace { /// }); #[macro_export] macro_rules! spawn { - ($future:expr) => { - { - let context = glib::MainContext::default(); - context.spawn_local($future); - - } - }; - (@clone $data:ident, $future:expr) => { - { - let context = glib::MainContext::default(); - let $data = Rc::clone(&$data); - context.spawn_local($future); - - } - }; + ($future:expr) => {{ + let context = glib::MainContext::default(); + context.spawn_local($future); + }}; + (@clone $data:ident, $future:expr) => {{ + let context = glib::MainContext::default(); + let $data = Rc::clone(&$data); + context.spawn_local($future); + }}; } diff --git a/musicus/src/main.rs b/musicus/src/main.rs index a851c7d..4b92e05 100644 --- a/musicus/src/main.rs +++ b/musicus/src/main.rs @@ -30,9 +30,7 @@ fn main() { libadwaita::init(); resources::init().expect("Failed to initialize resources!"); - let app = gtk::Application::new(Some("de.johrpan.musicus"), gio::ApplicationFlags::empty()) - .expect("Failed to initialize GTK application!"); - + let app = gtk::Application::new(Some("de.johrpan.musicus"), gio::ApplicationFlags::empty()); let window: RefCell>> = RefCell::new(None); app.connect_activate(clone!(@strong app => move |_| { @@ -43,6 +41,5 @@ fn main() { window.as_ref().unwrap().present(); })); - let args = std::env::args().collect::>(); - app.run(&args); + app.run(); } diff --git a/musicus/src/navigator/mod.rs b/musicus/src/navigator/mod.rs index 26eb898..9bd4d5f 100644 --- a/musicus/src/navigator/mod.rs +++ b/musicus/src/navigator/mod.rs @@ -14,7 +14,9 @@ pub use window::*; /// that optionally resolves to a specific return value. pub trait Screen: Widget { /// Create a new screen and initialize it with the provided input value. - fn new(input: I, navigation_handle: NavigationHandle) -> Rc where Self: Sized; + fn new(input: I, navigation_handle: NavigationHandle) -> Rc + where + Self: Sized; } /// An accessor to navigation functionality for screens. @@ -46,7 +48,9 @@ impl NavigationHandle { pub fn pop(&self, output: Option) { self.unwrap_navigator().pop(); - let sender = self.sender.take() + let sender = self + .sender + .take() .expect("Tried to send result from screen through a dropped sender."); if sender.send(output).is_err() { @@ -112,11 +116,12 @@ impl Navigator { back_cb: RefCell::new(None), }); - this.widget.connect_property_transition_running_notify(clone!(@strong this => move |_| { - if !this.widget.get_transition_running() { - this.clear_old_widgets(); - } - })); + this.widget + .connect_transition_running_notify(clone!(@strong this => move |_| { + if !this.widget.is_transition_running() { + this.clear_old_widgets(); + } + })); this } @@ -135,7 +140,7 @@ impl Navigator { let receiver = self.push::(input); - if !self.widget.get_transition_running() { + if !self.widget.is_transition_running() { self.clear_old_widgets(); } @@ -143,7 +148,6 @@ impl Navigator { receiver.await.unwrap_or(None) } - /// Drop all screens and go back to the initial screen. The back callback /// will not be called. pub fn reset(&self) { @@ -153,7 +157,7 @@ impl Navigator { self.old_widgets.borrow_mut().push(screen.get_widget()); } - if !self.widget.get_transition_running() { + if !self.widget.is_transition_running() { self.clear_old_widgets(); } } @@ -203,7 +207,7 @@ impl Navigator { } } - if !self.widget.get_transition_running() { + if !self.widget.is_transition_running() { self.clear_old_widgets(); } } diff --git a/musicus/src/navigator/window.rs b/musicus/src/navigator/window.rs index 6440650..77c3b39 100644 --- a/musicus/src/navigator/window.rs +++ b/musicus/src/navigator/window.rs @@ -17,7 +17,7 @@ impl NavigatorWindow { window.set_default_size(600, 424); let placeholder = gtk::Label::new(None); let navigator = Navigator::new(backend, &window, &placeholder); - libadwaita::WindowExt::set_child(&window, Some(&navigator.widget)); + window.set_child(Some(&navigator.widget)); let this = Rc::new(Self { navigator, window }); diff --git a/musicus/src/preferences/login.rs b/musicus/src/preferences/login.rs index cd7f14c..c73a8c6 100644 --- a/musicus/src/preferences/login.rs +++ b/musicus/src/preferences/login.rs @@ -1,6 +1,6 @@ use super::register::RegisterDialog; -use crate::push; use crate::navigator::{NavigationHandle, Screen}; +use crate::push; use crate::widgets::Widget; use glib::clone; use gtk::prelude::*; @@ -49,16 +49,16 @@ impl Screen, Option> for LoginDialog { // Connect signals and callbacks - cancel_button.connect_clicked(clone!(@weak this => move |_| { + cancel_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); - login_button.connect_clicked(clone!(@weak this => move |_| { + login_button.connect_clicked(clone!(@weak this => move |_| { this.widget.set_visible_child_name("loading"); let data = LoginData { - username: this.username_entry.get_text().to_string(), - password: this.password_entry.get_text().to_string(), + username: this.username_entry.text().to_string(), + password: this.password_entry.text().to_string(), }; spawn!(@clone this, async move { @@ -72,7 +72,7 @@ impl Screen, Option> for LoginDialog { }); })); - register_button.connect_clicked(clone!(@weak this => move |_| { + register_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { if let Some(data) = push!(this.handle, RegisterDialog).await { this.handle.pop(Some(Some(data))); @@ -80,7 +80,7 @@ impl Screen, Option> for LoginDialog { }); })); - logout_button.connect_clicked(clone!(@weak this => move |_| { + logout_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { this.handle.backend.set_login_data(None).await; this.handle.pop(Some(None)); diff --git a/musicus/src/preferences/mod.rs b/musicus/src/preferences/mod.rs index 761fdd8..72c4dd0 100644 --- a/musicus/src/preferences/mod.rs +++ b/musicus/src/preferences/mod.rs @@ -3,8 +3,8 @@ use gettextrs::gettext; use glib::clone; use gtk::prelude::*; use gtk_macros::get_widget; -use musicus_backend::Backend; use libadwaita::prelude::*; +use musicus_backend::Backend; use std::rc::Rc; mod login; @@ -64,8 +64,8 @@ impl Preferences { dialog.connect_response(clone!(@strong this => move |dialog, response| { if let gtk::ResponseType::Accept = response { - if let Some(file) = dialog.get_file() { - if let Some(path) = file.get_path() { + if let Some(file) = dialog.file() { + if let Some(path) = file.path() { this.music_library_path_row.set_subtitle(Some(path.to_str().unwrap())); spawn!(@clone this, async move { diff --git a/musicus/src/preferences/register.rs b/musicus/src/preferences/register.rs index ebe84b8..0a81e01 100644 --- a/musicus/src/preferences/register.rs +++ b/musicus/src/preferences/register.rs @@ -51,13 +51,13 @@ impl Screen<(), LoginData> for RegisterDialog { // Connect signals and callbacks - cancel_button.connect_clicked(clone!(@weak this => move |_| { + cancel_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); - register_button.connect_clicked(clone!(@weak this => move |_| { - let password = this.password_entry.get_text().to_string(); - let repeat = this.repeat_password_entry.get_text().to_string(); + register_button.connect_clicked(clone!(@weak this => move |_| { + let password = this.password_entry.text().to_string(); + let repeat = this.repeat_password_entry.text().to_string(); if password != repeat { // TODO: Show error and validate other input. @@ -65,10 +65,10 @@ impl Screen<(), LoginData> for RegisterDialog { this.widget.set_visible_child_name("loading"); spawn!(@clone this, async move { - let username = this.username_entry.get_text().to_string(); - let email = this.email_entry.get_text().to_string(); + let username = this.username_entry.text().to_string(); + let email = this.email_entry.text().to_string(); let captcha_id = this.captcha_id.borrow().clone().unwrap(); - let answer = this.captcha_entry.get_text().to_string(); + let answer = this.captcha_entry.text().to_string(); let email = if email.len() == 0 { None diff --git a/musicus/src/preferences/server.rs b/musicus/src/preferences/server.rs index fa46cf2..58fd386 100644 --- a/musicus/src/preferences/server.rs +++ b/musicus/src/preferences/server.rs @@ -40,7 +40,7 @@ impl ServerDialog { })); set_button.connect_clicked(clone!(@strong this => move |_| { - let url = this.url_entry.get_text().to_string(); + let url = this.url_entry.text().to_string(); this.backend.set_server_url(&url); if let Some(cb) = &*this.selected_cb.borrow() { diff --git a/musicus/src/screens/ensemble.rs b/musicus/src/screens/ensemble.rs index 083a1c0..d21d0b1 100644 --- a/musicus/src/screens/ensemble.rs +++ b/musicus/src/screens/ensemble.rs @@ -1,6 +1,6 @@ use super::{MediumScreen, RecordingScreen}; use crate::editors::EnsembleEditor; -use crate::navigator::{NavigatorWindow, NavigationHandle, Screen}; +use crate::navigator::{NavigationHandle, NavigatorWindow, Screen}; use crate::widgets; use crate::widgets::{List, Section, Widget}; use gettextrs::gettext; @@ -42,80 +42,90 @@ impl Screen for EnsembleScreen { mediums: RefCell::new(Vec::new()), }); - this.widget.set_back_cb(clone!(@weak this => move || { + this.widget.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); + this.widget.add_action( + &gettext("Edit ensemble"), + clone!(@weak this => move || { + spawn!(@clone this, async move { + let window = NavigatorWindow::new(this.handle.backend.clone()); + replace!(window.navigator, EnsembleEditor, Some(this.ensemble.clone())).await; + }); + }), + ); - this.widget.add_action(&gettext("Edit ensemble"), clone!(@weak this => move || { - spawn!(@clone this, async move { - let window = NavigatorWindow::new(this.handle.backend.clone()); - replace!(window.navigator, EnsembleEditor, Some(this.ensemble.clone())).await; - }); - })); + this.widget.add_action( + &gettext("Delete ensemble"), + clone!(@weak this => move || { + spawn!(@clone this, async move { + this.handle.backend.db().delete_ensemble(&this.ensemble.id).await.unwrap(); + this.handle.backend.library_changed(); + }); + }), + ); - this.widget.add_action(&gettext("Delete ensemble"), clone!(@weak this => move || { - spawn!(@clone this, async move { - this.handle.backend.db().delete_ensemble(&this.ensemble.id).await.unwrap(); - this.handle.backend.library_changed(); - }); - })); - - this.widget.set_search_cb(clone!(@weak this => move || { + this.widget.set_search_cb(clone!(@weak this => move || { this.recording_list.invalidate_filter(); this.medium_list.invalidate_filter(); })); - this.recording_list.set_make_widget_cb(clone!(@weak this => move |index| { - let recording = &this.recordings.borrow()[index]; + this.recording_list.set_make_widget_cb( + clone!(@weak this => @default-panic, move |index| { + let recording = &this.recordings.borrow()[index]; - let row = libadwaita::ActionRow::new(); - row.set_activatable(true); - row.set_title(Some(&recording.work.get_title())); - row.set_subtitle(Some(&recording.get_performers())); + let row = libadwaita::ActionRow::new(); + row.set_activatable(true); + row.set_title(Some(&recording.work.get_title())); + row.set_subtitle(Some(&recording.get_performers())); - let recording = recording.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { - let recording = recording.clone(); - spawn!(@clone this, async move { - push!(this.handle, RecordingScreen, recording.clone()).await; - }); + let recording = recording.to_owned(); + row.connect_activated(clone!(@weak this => move |_| { + let recording = recording.clone(); + spawn!(@clone this, async move { + push!(this.handle, RecordingScreen, recording.clone()).await; + }); + })); + + row.upcast() + }), + ); + + this.recording_list + .set_filter_cb(clone!(@weak this => @default-panic, move |index| { + let recording = &this.recordings.borrow()[index]; + let search = this.widget.get_search(); + let text = recording.work.get_title() + &recording.get_performers(); + search.is_empty() || text.to_lowercase().contains(&search) })); - row.upcast() - })); + this.medium_list + .set_make_widget_cb(clone!(@weak this => @default-panic, move |index| { + let medium = &this.mediums.borrow()[index]; - this.recording_list.set_filter_cb(clone!(@weak this => move |index| { - let recording = &this.recordings.borrow()[index]; - let search = this.widget.get_search(); - let text = recording.work.get_title() + &recording.get_performers(); - search.is_empty() || text.to_lowercase().contains(&search) - })); + let row = libadwaita::ActionRow::new(); + row.set_activatable(true); + row.set_title(Some(&medium.name)); - this.medium_list.set_make_widget_cb(clone!(@weak this => move |index| { - let medium = &this.mediums.borrow()[index]; + let medium = medium.to_owned(); + row.connect_activated(clone!(@weak this => move |_| { + let medium = medium.clone(); + spawn!(@clone this, async move { + push!(this.handle, MediumScreen, medium.clone()).await; + }); + })); - let row = libadwaita::ActionRow::new(); - row.set_activatable(true); - row.set_title(Some(&medium.name)); - - let medium = medium.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { - let medium = medium.clone(); - spawn!(@clone this, async move { - push!(this.handle, MediumScreen, medium.clone()).await; - }); + row.upcast() })); - row.upcast() - })); - - this.medium_list.set_filter_cb(clone!(@weak this => move |index| { - let medium = &this.mediums.borrow()[index]; - let search = this.widget.get_search(); - let name = medium.name.to_lowercase(); - search.is_empty() || name.contains(&search) - })); + this.medium_list + .set_filter_cb(clone!(@weak this => @default-panic, move |index| { + let medium = &this.mediums.borrow()[index]; + let search = this.widget.get_search(); + let name = medium.name.to_lowercase(); + search.is_empty() || name.contains(&search) + })); // Load the content asynchronously. diff --git a/musicus/src/screens/main.rs b/musicus/src/screens/main.rs index 5d42abc..868e751 100644 --- a/musicus/src/screens/main.rs +++ b/musicus/src/screens/main.rs @@ -1,7 +1,7 @@ use super::{EnsembleScreen, PersonScreen, PlayerScreen}; use crate::config; use crate::import::SourceSelector; -use crate::navigator::{Navigator, NavigatorWindow, NavigationHandle, Screen}; +use crate::navigator::{NavigationHandle, Navigator, NavigatorWindow, Screen}; use crate::preferences::Preferences; use crate::widgets::{List, PlayerBar, Widget}; use gettextrs::gettext; @@ -87,64 +87,67 @@ impl Screen<(), ()> for MainScreen { poes: RefCell::new(Vec::new()), }); - preferences_action.connect_activate(clone!(@weak this => move |_, _| { + preferences_action.connect_activate(clone!(@weak this => move |_, _| { Preferences::new(Rc::clone(&this.handle.backend), &this.handle.window).show(); })); - about_action.connect_activate(clone!(@weak this => move |_, _| { + about_action.connect_activate(clone!(@weak this => move |_, _| { this.show_about_dialog(); })); - add_button.connect_clicked(clone!(@weak this => move |_| { + add_button.connect_clicked(clone!(@weak this => move |_| { spawn!(@clone this, async move { let window = NavigatorWindow::new(Rc::clone(&this.handle.backend)); replace!(window.navigator, SourceSelector).await; }); })); - this.search_entry.connect_search_changed(clone!(@weak this => move |_| { - this.poe_list.invalidate_filter(); - })); - - this.poe_list.set_make_widget_cb(clone!(@weak this => move |index| { - let poe = &this.poes.borrow()[index]; - - let row = libadwaita::ActionRow::new(); - row.set_activatable(true); - row.set_title(Some(&poe.get_title())); - - let poe = poe.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { - let poe = poe.clone(); - spawn!(@clone this, async move { - this.leaflet.set_visible_child(&this.navigator.widget); - - match poe { - PersonOrEnsemble::Person(person) => { - replace!(this.navigator, PersonScreen, person).await; - } - PersonOrEnsemble::Ensemble(ensemble) => { - replace!(this.navigator, EnsembleScreen, ensemble).await; - } - } - }); + this.search_entry + .connect_search_changed(clone!(@weak this => move |_| { + this.poe_list.invalidate_filter(); })); - row.upcast() - })); + this.poe_list + .set_make_widget_cb(clone!(@weak this => @default-panic, move |index| { + let poe = &this.poes.borrow()[index]; - this.poe_list.set_filter_cb(clone!(@weak this => move |index| { - let poe = &this.poes.borrow()[index]; - let search = this.search_entry.get_text().to_string().to_lowercase(); - let title = poe.get_title().to_lowercase(); - search.is_empty() || title.contains(&search) - })); + let row = libadwaita::ActionRow::new(); + row.set_activatable(true); + row.set_title(Some(&poe.get_title())); - this.navigator.set_back_cb(clone!(@weak this => move || { + let poe = poe.to_owned(); + row.connect_activated(clone!(@weak this => move |_| { + let poe = poe.clone(); + spawn!(@clone this, async move { + this.leaflet.set_visible_child(&this.navigator.widget); + + match poe { + PersonOrEnsemble::Person(person) => { + replace!(this.navigator, PersonScreen, person).await; + } + PersonOrEnsemble::Ensemble(ensemble) => { + replace!(this.navigator, EnsembleScreen, ensemble).await; + } + } + }); + })); + + row.upcast() + })); + + this.poe_list + .set_filter_cb(clone!(@weak this => @default-panic, move |index| { + let poe = &this.poes.borrow()[index]; + let search = this.search_entry.text().to_string().to_lowercase(); + let title = poe.get_title().to_lowercase(); + search.is_empty() || title.contains(&search) + })); + + this.navigator.set_back_cb(clone!(@weak this => move || { this.leaflet.set_visible_child_name("sidebar"); })); - player_bar.set_playlist_cb(clone!(@weak this => move || { + player_bar.set_playlist_cb(clone!(@weak this => move || { spawn!(@clone this, async move { push!(this.handle, PlayerScreen).await; }); diff --git a/musicus/src/screens/medium.rs b/musicus/src/screens/medium.rs index 6b55e3e..96f6236 100644 --- a/musicus/src/screens/medium.rs +++ b/musicus/src/screens/medium.rs @@ -35,47 +35,56 @@ impl Screen for MediumScreen { list, }); - this.widget.set_back_cb(clone!(@weak this => move || { + this.widget.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); + this.widget.add_action( + &gettext("Edit medium"), + clone!(@weak this => move || { + // TODO: Show medium editor. + }), + ); - this.widget.add_action(&gettext("Edit medium"), clone!(@weak this => move || { - // TODO: Show medium editor. - })); + this.widget.add_action( + &gettext("Delete medium"), + clone!(@weak this => move || { + // TODO: Delete medium and maybe also the tracks? + }), + ); - this.widget.add_action(&gettext("Delete medium"), clone!(@weak this => move || { - // TODO: Delete medium and maybe also the tracks? - })); + section.add_action( + "media-playback-start-symbolic", + clone!(@weak this => move || { + for track in &this.medium.tracks { + this.handle.backend.pl().add_item(track.clone()).unwrap(); + } + }), + ); - section.add_action("media-playback-start-symbolic", clone!(@weak this => move || { - for track in &this.medium.tracks { - this.handle.backend.pl().add_item(track.clone()).unwrap(); - } - })); + this.list + .set_make_widget_cb(clone!(@weak this => @default-panic, move |index| { + let track = &this.medium.tracks[index]; - this.list.set_make_widget_cb(clone!(@weak this => move |index| { - let track = &this.medium.tracks[index]; + let mut parts = Vec::::new(); + for part in &track.work_parts { + parts.push(track.recording.work.parts[*part].title.clone()); + } - let mut parts = Vec::::new(); - for part in &track.work_parts { - parts.push(track.recording.work.parts[*part].title.clone()); - } + let title = if parts.is_empty() { + gettext("Unknown") + } else { + parts.join(", ") + }; - let title = if parts.is_empty() { - gettext("Unknown") - } else { - parts.join(", ") - }; + let row = libadwaita::ActionRow::new(); + row.set_selectable(false); + row.set_activatable(false); + row.set_title(Some(&title)); + row.set_margin_start(12); - let row = libadwaita::ActionRow::new(); - row.set_selectable(false); - row.set_activatable(false); - row.set_title(Some(&title)); - row.set_margin_start(12); - - row.upcast() - })); + row.upcast() + })); this.list.update(this.medium.tracks.len()); diff --git a/musicus/src/screens/person.rs b/musicus/src/screens/person.rs index 94ca099..0a63951 100644 --- a/musicus/src/screens/person.rs +++ b/musicus/src/screens/person.rs @@ -1,6 +1,6 @@ -use super::{MediumScreen, WorkScreen, RecordingScreen}; +use super::{MediumScreen, RecordingScreen, WorkScreen}; use crate::editors::PersonEditor; -use crate::navigator::{NavigatorWindow, NavigationHandle, Screen}; +use crate::navigator::{NavigationHandle, NavigatorWindow, Screen}; use crate::widgets; use crate::widgets::{List, Section, Widget}; use gettextrs::gettext; @@ -47,106 +47,118 @@ impl Screen for PersonScreen { mediums: RefCell::new(Vec::new()), }); - this.widget.set_back_cb(clone!(@weak this => move || { + this.widget.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); + this.widget.add_action( + &gettext("Edit person"), + clone!(@weak this => move || { + spawn!(@clone this, async move { + let window = NavigatorWindow::new(this.handle.backend.clone()); + replace!(window.navigator, PersonEditor, Some(this.person.clone())).await; + }); + }), + ); - this.widget.add_action(&gettext("Edit person"), clone!(@weak this => move || { - spawn!(@clone this, async move { - let window = NavigatorWindow::new(this.handle.backend.clone()); - replace!(window.navigator, PersonEditor, Some(this.person.clone())).await; - }); - })); + this.widget.add_action( + &gettext("Delete person"), + clone!(@weak this => move || { + spawn!(@clone this, async move { + this.handle.backend.db().delete_person(&this.person.id).await.unwrap(); + this.handle.backend.library_changed(); + }); + }), + ); - this.widget.add_action(&gettext("Delete person"), clone!(@weak this => move || { - spawn!(@clone this, async move { - this.handle.backend.db().delete_person(&this.person.id).await.unwrap(); - this.handle.backend.library_changed(); - }); - })); - - this.widget.set_search_cb(clone!(@weak this => move || { + this.widget.set_search_cb(clone!(@weak this => move || { this.work_list.invalidate_filter(); this.recording_list.invalidate_filter(); this.medium_list.invalidate_filter(); })); - this.work_list.set_make_widget_cb(clone!(@weak this => move |index| { - let work = &this.works.borrow()[index]; + this.work_list + .set_make_widget_cb(clone!(@weak this => @default-panic, move |index| { + let work = &this.works.borrow()[index]; - let row = libadwaita::ActionRow::new(); - row.set_activatable(true); - row.set_title(Some(&work.title)); + let row = libadwaita::ActionRow::new(); + row.set_activatable(true); + row.set_title(Some(&work.title)); - let work = work.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { - let work = work.clone(); - spawn!(@clone this, async move { - push!(this.handle, WorkScreen, work.clone()).await; - }); + let work = work.to_owned(); + row.connect_activated(clone!(@weak this => move |_| { + let work = work.clone(); + spawn!(@clone this, async move { + push!(this.handle, WorkScreen, work.clone()).await; + }); + })); + + row.upcast() })); - row.upcast() - })); - - this.work_list.set_filter_cb(clone!(@weak this => move |index| { - let work = &this.works.borrow()[index]; - let search = this.widget.get_search(); - let title = work.title.to_lowercase(); - search.is_empty() || title.contains(&search) - })); - - this.recording_list.set_make_widget_cb(clone!(@weak this => move |index| { - let recording = &this.recordings.borrow()[index]; - - let row = libadwaita::ActionRow::new(); - row.set_activatable(true); - row.set_title(Some(&recording.work.get_title())); - row.set_subtitle(Some(&recording.get_performers())); - - let recording = recording.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { - let recording = recording.clone(); - spawn!(@clone this, async move { - push!(this.handle, RecordingScreen, recording.clone()).await; - }); + this.work_list + .set_filter_cb(clone!(@weak this => @default-panic, move|index| { + let work = &this.works.borrow()[index]; + let search = this.widget.get_search(); + let title = work.title.to_lowercase(); + search.is_empty() || title.contains(&search) })); - row.upcast() - })); + this.recording_list.set_make_widget_cb( + clone!(@weak this => @default-panic, move |index| { + let recording = &this.recordings.borrow()[index]; - this.recording_list.set_filter_cb(clone!(@weak this => move |index| { - let recording = &this.recordings.borrow()[index]; - let search = this.widget.get_search(); - let text = recording.work.get_title() + &recording.get_performers(); - search.is_empty() || text.to_lowercase().contains(&search) - })); + let row = libadwaita::ActionRow::new(); + row.set_activatable(true); + row.set_title(Some(&recording.work.get_title())); + row.set_subtitle(Some(&recording.get_performers())); - this.medium_list.set_make_widget_cb(clone!(@weak this => move |index| { - let medium = &this.mediums.borrow()[index]; + let recording = recording.to_owned(); + row.connect_activated(clone!(@weak this => move |_| { + let recording = recording.clone(); + spawn!(@clone this, async move { + push!(this.handle, RecordingScreen, recording.clone()).await; + }); + })); - let row = libadwaita::ActionRow::new(); - row.set_activatable(true); - row.set_title(Some(&medium.name)); + row.upcast() + }), + ); - let medium = medium.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { - let medium = medium.clone(); - spawn!(@clone this, async move { - push!(this.handle, MediumScreen, medium.clone()).await; - }); + this.recording_list + .set_filter_cb(clone!(@weak this => @default-panic,move |index| { + let recording = &this.recordings.borrow()[index]; + let search = this.widget.get_search(); + let text = recording.work.get_title() + &recording.get_performers(); + search.is_empty() || text.to_lowercase().contains(&search) })); - row.upcast() - })); + this.medium_list + .set_make_widget_cb(clone!(@weak this => @default-panic, move |index| { + let medium = &this.mediums.borrow()[index]; - this.medium_list.set_filter_cb(clone!(@weak this => move |index| { - let medium = &this.mediums.borrow()[index]; - let search = this.widget.get_search(); - let name = medium.name.to_lowercase(); - search.is_empty() || name.contains(&search) - })); + let row = libadwaita::ActionRow::new(); + row.set_activatable(true); + row.set_title(Some(&medium.name)); + + let medium = medium.to_owned(); + row.connect_activated(clone!(@weak this => move |_| { + let medium = medium.clone(); + spawn!(@clone this, async move { + push!(this.handle, MediumScreen, medium.clone()).await; + }); + })); + + row.upcast() + })); + + this.medium_list + .set_filter_cb(clone!(@weak this => @default-panic, move |index| { + let medium = &this.mediums.borrow()[index]; + let search = this.widget.get_search(); + let name = medium.name.to_lowercase(); + search.is_empty() || name.contains(&search) + })); // Load the content asynchronously. diff --git a/musicus/src/screens/player.rs b/musicus/src/screens/player.rs index b414b82..4deea77 100644 --- a/musicus/src/screens/player.rs +++ b/musicus/src/screens/player.rs @@ -95,7 +95,7 @@ impl Screen<(), ()> for PlayerScreen { let player = &this.handle.backend.pl(); - player.add_playlist_cb(clone!(@weak this => @default-return (), move |playlist| { + player.add_playlist_cb(clone!(@weak this => move |playlist| { if playlist.is_empty() { this.handle.pop(None); } @@ -104,7 +104,7 @@ impl Screen<(), ()> for PlayerScreen { this.show_playlist(); })); - player.add_track_cb(clone!(@weak this, @weak player => @default-return (), move |current_track| { + player.add_track_cb(clone!(@weak this, @weak player => move |current_track| { this.previous_button.set_sensitive(this.handle.backend.pl().has_previous()); this.next_button.set_sensitive(this.handle.backend.pl().has_next()); @@ -129,14 +129,14 @@ impl Screen<(), ()> for PlayerScreen { this.show_playlist(); })); - player.add_duration_cb(clone!(@weak this => @default-return (), move |ms| { + player.add_duration_cb(clone!(@weak this => move |ms| { let min = ms / 60000; let sec = (ms % 60000) / 1000; this.duration_label.set_text(&format!("{}:{:02}", min, sec)); this.position.set_upper(ms as f64); })); - player.add_playing_cb(clone!(@weak this => @default-return (), move |playing| { + player.add_playing_cb(clone!(@weak this => move |playing| { this.play_button.set_child(Some(if playing { &this.pause_image } else { @@ -144,7 +144,7 @@ impl Screen<(), ()> for PlayerScreen { })); })); - player.add_position_cb(clone!(@weak this => @default-return (), move |ms| { + player.add_position_cb(clone!(@weak this => move |ms| { if !this.seeking.get() { let min = ms / 60000; let sec = (ms % 60000) / 1000; @@ -153,35 +153,38 @@ impl Screen<(), ()> for PlayerScreen { } })); - back_button.connect_clicked(clone!(@weak this => move |_| { + back_button.connect_clicked(clone!(@weak this => move |_| { this.handle.pop(None); })); - this.previous_button.connect_clicked(clone!(@weak this => move |_| { - this.handle.backend.pl().previous().unwrap(); - })); + this.previous_button + .connect_clicked(clone!(@weak this => move |_| { + this.handle.backend.pl().previous().unwrap(); + })); - this.play_button.connect_clicked(clone!(@weak this => move |_| { - this.handle.backend.pl().play_pause(); - })); + this.play_button + .connect_clicked(clone!(@weak this => move |_| { + this.handle.backend.pl().play_pause(); + })); - this.next_button.connect_clicked(clone!(@weak this => move |_| { - this.handle.backend.pl().next().unwrap(); - })); + this.next_button + .connect_clicked(clone!(@weak this => move |_| { + this.handle.backend.pl().next().unwrap(); + })); - stop_button.connect_clicked(clone!(@weak this => move |_| { + stop_button.connect_clicked(clone!(@weak this => move |_| { this.handle.backend.pl().clear(); })); - event_controller.connect_event(clone!(@weak this => move |_, event| { + event_controller.connect_event(clone!(@weak this => @default-panic, move |_, event| { if let Some(event) = event.downcast_ref::() { - if event.get_button() == gdk::BUTTON_PRIMARY { - match event.get_event_type() { + if event.button() == gdk::BUTTON_PRIMARY { + match event.event_type() { gdk::EventType::ButtonPress => { this.seeking.replace(true); } gdk::EventType::ButtonRelease => { - this.handle.backend.pl().seek(this.position.get_value() as u64); + this.handle.backend.pl().seek(this.position.value() as u64); this.seeking.replace(false); } _ => (), @@ -193,9 +196,9 @@ impl Screen<(), ()> for PlayerScreen { glib::signal::Inhibit(false) })); - position_scale.connect_value_changed(clone!(@weak this => move |_| { + position_scale.connect_value_changed(clone!(@weak this => move |_| { if this.seeking.get() { - let ms = this.position.get_value() as u64; + let ms = this.position.value() as u64; let min = ms / 60000; let sec = (ms % 60000) / 1000; @@ -203,7 +206,7 @@ impl Screen<(), ()> for PlayerScreen { } })); - this.list.set_make_widget_cb(clone!(@weak this => move |index| { + this.list.set_make_widget_cb(clone!(@weak this => @default-panic, move |index| { let widget = match this.items.borrow()[index] { ListItem::Track {index, first, playing} => { let track = &this.playlist.borrow()[index]; @@ -236,7 +239,7 @@ impl Screen<(), ()> for PlayerScreen { row.set_subtitle(Some(&subtitle)); } - row.connect_activated(clone!(@weak this => move |_| { + row.connect_activated(clone!(@weak this => move |_| { this.handle.backend.pl().set_track(index).unwrap(); })); diff --git a/musicus/src/screens/recording.rs b/musicus/src/screens/recording.rs index 44892ec..0207a41 100644 --- a/musicus/src/screens/recording.rs +++ b/musicus/src/screens/recording.rs @@ -1,5 +1,5 @@ use crate::editors::RecordingEditor; -use crate::navigator::{NavigatorWindow, NavigationHandle, Screen}; +use crate::navigator::{NavigationHandle, NavigatorWindow, Screen}; use crate::widgets; use crate::widgets::{List, Section, Widget}; use gettextrs::gettext; @@ -39,49 +39,59 @@ impl Screen for RecordingScreen { tracks: RefCell::new(Vec::new()), }); - section.add_action("media-playback-start-symbolic", clone!(@weak this => move || { - for track in &*this.tracks.borrow() { - this.handle.backend.pl().add_item(track.clone()).unwrap(); - } - })); + section.add_action( + "media-playback-start-symbolic", + clone!(@weak this => move || { + for track in &*this.tracks.borrow() { + this.handle.backend.pl().add_item(track.clone()).unwrap(); + } + }), + ); - this.widget.set_back_cb(clone!(@weak this => move || { + this.widget.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); - this.widget.add_action(&gettext("Edit recording"), clone!(@weak this => move || { - spawn!(@clone this, async move { - let window = NavigatorWindow::new(this.handle.backend.clone()); - replace!(window.navigator, RecordingEditor, Some(this.recording.clone())).await; - }); - })); + this.widget.add_action( + &gettext("Edit recording"), + clone!(@weak this => move || { + spawn!(@clone this, async move { + let window = NavigatorWindow::new(this.handle.backend.clone()); + replace!(window.navigator, RecordingEditor, Some(this.recording.clone())).await; + }); + }), + ); - this.widget.add_action(&gettext("Delete recording"), clone!(@weak this => move || { - spawn!(@clone this, async move { - this.handle.backend.db().delete_recording(&this.recording.id).await.unwrap(); - this.handle.backend.library_changed(); - }); - })); + this.widget.add_action( + &gettext("Delete recording"), + clone!(@weak this => move || { + spawn!(@clone this, async move { + this.handle.backend.db().delete_recording(&this.recording.id).await.unwrap(); + this.handle.backend.library_changed(); + }); + }), + ); - this.list.set_make_widget_cb(clone!(@weak this => move |index| { - let track = &this.tracks.borrow()[index]; + this.list + .set_make_widget_cb(clone!(@weak this => @default-panic, move |index| { + let track = &this.tracks.borrow()[index]; - let mut title_parts = Vec::::new(); - for part in &track.work_parts { - title_parts.push(this.recording.work.parts[*part].title.clone()); - } + let mut title_parts = Vec::::new(); + for part in &track.work_parts { + title_parts.push(this.recording.work.parts[*part].title.clone()); + } - let title = if title_parts.is_empty() { - gettext("Unknown") - } else { - title_parts.join(", ") - }; + let title = if title_parts.is_empty() { + gettext("Unknown") + } else { + title_parts.join(", ") + }; - let row = libadwaita::ActionRow::new(); - row.set_title(Some(&title)); + let row = libadwaita::ActionRow::new(); + row.set_title(Some(&title)); - row.upcast() - })); + row.upcast() + })); // Load the content asynchronously. diff --git a/musicus/src/screens/welcome.rs b/musicus/src/screens/welcome.rs index 08fae82..bca0720 100644 --- a/musicus/src/screens/welcome.rs +++ b/musicus/src/screens/welcome.rs @@ -31,8 +31,10 @@ impl Screen<(), ()> for WelcomeScreen { let welcome = libadwaita::StatusPageBuilder::new() .icon_name("folder-music-symbolic") .title(&gettext("Welcome to Musicus!")) - .description(&gettext("Get startet by selecting the folder containing your music \ - files! Musicus will create a new database there or open one that already exists.")) + .description(&gettext( + "Get startet by selecting the folder containing your music \ + files! Musicus will create a new database there or open one that already exists.", + )) .child(&button) .vexpand(true) .build(); @@ -42,12 +44,9 @@ impl Screen<(), ()> for WelcomeScreen { widget.append(&header); widget.append(&welcome); - let this = Rc::new(Self { - handle, - widget, - }); + let this = Rc::new(Self { handle, widget }); - button.connect_clicked(clone!(@weak this => move |_| { + button.connect_clicked(clone!(@weak this => move |_| { let dialog = gtk::FileChooserDialog::new( Some(&gettext("Select music library folder")), Some(&this.handle.window), @@ -59,10 +58,10 @@ impl Screen<(), ()> for WelcomeScreen { dialog.set_modal(true); - dialog.connect_response(clone!(@weak this => move |dialog, response| { + dialog.connect_response(clone!(@weak this => move |dialog, response| { if let gtk::ResponseType::Accept = response { - if let Some(file) = dialog.get_file() { - if let Some(path) = file.get_path() { + if let Some(file) = dialog.file() { + if let Some(path) = file.path() { spawn!(@clone this, async move { this.handle.backend.set_music_library_path(path).await.unwrap(); }); diff --git a/musicus/src/screens/work.rs b/musicus/src/screens/work.rs index 059338d..66ac8fb 100644 --- a/musicus/src/screens/work.rs +++ b/musicus/src/screens/work.rs @@ -1,13 +1,13 @@ use super::RecordingScreen; use crate::editors::WorkEditor; -use crate::navigator::{NavigatorWindow, NavigationHandle, Screen}; +use crate::navigator::{NavigationHandle, NavigatorWindow, Screen}; use crate::widgets; use crate::widgets::{List, Section, Widget}; use gettextrs::gettext; use glib::clone; use gtk::prelude::*; use libadwaita::prelude::*; -use musicus_backend::db::{Work, Recording}; +use musicus_backend::db::{Recording, Work}; use std::cell::RefCell; use std::rc::Rc; @@ -38,55 +38,63 @@ impl Screen for WorkScreen { recordings: RefCell::new(Vec::new()), }); - this.widget.set_back_cb(clone!(@weak this => move || { + this.widget.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); + this.widget.add_action( + &gettext("Edit work"), + clone!(@weak this => move || { + spawn!(@clone this, async move { + let window = NavigatorWindow::new(this.handle.backend.clone()); + replace!(window.navigator, WorkEditor, Some(this.work.clone())).await; + }); + }), + ); - this.widget.add_action(&gettext("Edit work"), clone!(@weak this => move || { - spawn!(@clone this, async move { - let window = NavigatorWindow::new(this.handle.backend.clone()); - replace!(window.navigator, WorkEditor, Some(this.work.clone())).await; - }); - })); + this.widget.add_action( + &gettext("Delete work"), + clone!(@weak this => move || { + spawn!(@clone this, async move { + this.handle.backend.db().delete_work(&this.work.id).await.unwrap(); + this.handle.backend.library_changed(); + }); + }), + ); - this.widget.add_action(&gettext("Delete work"), clone!(@weak this => move || { - spawn!(@clone this, async move { - this.handle.backend.db().delete_work(&this.work.id).await.unwrap(); - this.handle.backend.library_changed(); - }); - })); - - this.widget.set_search_cb(clone!(@weak this => move || { + this.widget.set_search_cb(clone!(@weak this => move || { this.recording_list.invalidate_filter(); })); - this.recording_list.set_make_widget_cb(clone!(@weak this => move |index| { - let recording = &this.recordings.borrow()[index]; + this.recording_list.set_make_widget_cb( + clone!(@weak this => @default-panic, move |index| { + let recording = &this.recordings.borrow()[index]; - let row = libadwaita::ActionRow::new(); - row.set_activatable(true); - row.set_title(Some(&recording.work.get_title())); - row.set_subtitle(Some(&recording.get_performers())); + let row = libadwaita::ActionRow::new(); + row.set_activatable(true); + row.set_title(Some(&recording.work.get_title())); + row.set_subtitle(Some(&recording.get_performers())); - let recording = recording.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { - let recording = recording.clone(); - spawn!(@clone this, async move { - push!(this.handle, RecordingScreen, recording.clone()).await; - }); + let recording = recording.to_owned(); + row.connect_activated(clone!(@weak this => move |_| { + let recording = recording.clone(); + spawn!(@clone this, async move { + push!(this.handle, RecordingScreen, recording.clone()).await; + }); + })); + + row.upcast() + }), + ); + + this.recording_list + .set_filter_cb(clone!(@weak this => @default-panic, move |index| { + let recording = &this.recordings.borrow()[index]; + let search = this.widget.get_search(); + let text = recording.work.get_title() + &recording.get_performers(); + search.is_empty() || text.to_lowercase().contains(&search) })); - row.upcast() - })); - - this.recording_list.set_filter_cb(clone!(@weak this => move |index| { - let recording = &this.recordings.borrow()[index]; - let search = this.widget.get_search(); - let text = recording.work.get_title() + &recording.get_performers(); - search.is_empty() || text.to_lowercase().contains(&search) - })); - // Load the content asynchronously. spawn!(@clone this, async move { diff --git a/musicus/src/selectors/ensemble.rs b/musicus/src/selectors/ensemble.rs index d969a7e..e644c77 100644 --- a/musicus/src/selectors/ensemble.rs +++ b/musicus/src/selectors/ensemble.rs @@ -23,18 +23,15 @@ impl Screen<(), Ensemble> for EnsembleSelector { let selector = Selector::::new(Rc::clone(&handle.backend)); selector.set_title(&gettext("Select ensemble")); - let this = Rc::new(Self { - handle, - selector, - }); + let this = Rc::new(Self { handle, selector }); // Connect signals and callbacks - this.selector.set_back_cb(clone!(@weak this => move || { + this.selector.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); - this.selector.set_add_cb(clone!(@weak this => move || { + this.selector.set_add_cb(clone!(@weak this => move || { spawn!(@clone this, async move { if let Some(ensemble) = push!(this.handle, EnsembleEditor, None).await { this.handle.pop(Some(ensemble)); @@ -42,28 +39,31 @@ impl Screen<(), Ensemble> for EnsembleSelector { }); })); - this.selector.set_load_online(clone!(@weak this => move || { - let clone = this.clone(); - async move { Ok(clone.handle.backend.cl().get_ensembles().await?) } - })); - - this.selector.set_load_local(clone!(@weak this => move || { - let clone = this.clone(); - async move { clone.handle.backend.db().get_ensembles().await.unwrap() } - })); - - this.selector.set_make_widget(clone!(@weak this => move |ensemble| { - let row = libadwaita::ActionRow::new(); - row.set_activatable(true); - row.set_title(Some(&ensemble.name)); - - let ensemble = ensemble.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { - this.handle.pop(Some(ensemble.clone())) + this.selector + .set_load_online(clone!(@weak this => @default-panic, move || { + let clone = this.clone(); + async move { Ok(clone.handle.backend.cl().get_ensembles().await?) } })); - row.upcast() - })); + this.selector + .set_load_local(clone!(@weak this => @default-panic, move || { + let clone = this.clone(); + async move { clone.handle.backend.db().get_ensembles().await.unwrap() } + })); + + this.selector + .set_make_widget(clone!(@weak this => @default-panic, move |ensemble| { + let row = libadwaita::ActionRow::new(); + row.set_activatable(true); + row.set_title(Some(&ensemble.name)); + + let ensemble = ensemble.to_owned(); + row.connect_activated(clone!(@weak this => move |_| { + this.handle.pop(Some(ensemble.clone())) + })); + + row.upcast() + })); this.selector .set_filter(|search, ensemble| ensemble.name.to_lowercase().contains(search)); diff --git a/musicus/src/selectors/instrument.rs b/musicus/src/selectors/instrument.rs index 5ce242b..996a89d 100644 --- a/musicus/src/selectors/instrument.rs +++ b/musicus/src/selectors/instrument.rs @@ -23,18 +23,15 @@ impl Screen<(), Instrument> for InstrumentSelector { let selector = Selector::::new(Rc::clone(&handle.backend)); selector.set_title(&gettext("Select instrument")); - let this = Rc::new(Self { - handle, - selector, - }); + let this = Rc::new(Self { handle, selector }); // Connect signals and callbacks - this.selector.set_back_cb(clone!(@weak this => move || { + this.selector.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); - this.selector.set_add_cb(clone!(@weak this => move || { + this.selector.set_add_cb(clone!(@weak this => move || { spawn!(@clone this, async move { if let Some(instrument) = push!(this.handle, InstrumentEditor, None).await { this.handle.pop(Some(instrument)); @@ -42,28 +39,31 @@ impl Screen<(), Instrument> for InstrumentSelector { }); })); - this.selector.set_load_online(clone!(@weak this => move || { - let clone = this.clone(); - async move { Ok(clone.handle.backend.cl().get_instruments().await?) } - })); - - this.selector.set_load_local(clone!(@weak this => move || { - let clone = this.clone(); - async move { clone.handle.backend.db().get_instruments().await.unwrap() } - })); - - this.selector.set_make_widget(clone!(@weak this => move |instrument| { - let row = libadwaita::ActionRow::new(); - row.set_activatable(true); - row.set_title(Some(&instrument.name)); - - let instrument = instrument.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { - this.handle.pop(Some(instrument.clone())) + this.selector + .set_load_online(clone!(@weak this => @default-panic, move || { + let clone = this.clone(); + async move { Ok(clone.handle.backend.cl().get_instruments().await?) } })); - row.upcast() - })); + this.selector + .set_load_local(clone!(@weak this => @default-panic, move || { + let clone = this.clone(); + async move { clone.handle.backend.db().get_instruments().await.unwrap() } + })); + + this.selector + .set_make_widget(clone!(@weak this => @default-panic, move |instrument| { + let row = libadwaita::ActionRow::new(); + row.set_activatable(true); + row.set_title(Some(&instrument.name)); + + let instrument = instrument.to_owned(); + row.connect_activated(clone!(@weak this => move |_| { + this.handle.pop(Some(instrument.clone())) + })); + + row.upcast() + })); this.selector .set_filter(|search, instrument| instrument.name.to_lowercase().contains(search)); diff --git a/musicus/src/selectors/medium.rs b/musicus/src/selectors/medium.rs index a8c04ad..1ab0087 100644 --- a/musicus/src/selectors/medium.rs +++ b/musicus/src/selectors/medium.rs @@ -5,7 +5,7 @@ use gettextrs::gettext; use glib::clone; use gtk::prelude::*; use libadwaita::prelude::*; -use musicus_backend::db::{Person, Ensemble, Medium}; +use musicus_backend::db::{Ensemble, Medium, Person}; use std::rc::Rc; /// Either a person or an ensemble to be shown in the list. @@ -38,62 +38,61 @@ impl Screen<(), Medium> for MediumSelector { let selector = Selector::::new(Rc::clone(&handle.backend)); selector.set_title(&gettext("Select performer")); - let this = Rc::new(Self { - handle, - selector, - }); + let this = Rc::new(Self { handle, selector }); // Connect signals and callbacks - this.selector.set_back_cb(clone!(@weak this => move || { + this.selector.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); - this.selector.set_load_online(clone!(@weak this => move || { - async move { - let mut poes = Vec::new(); + this.selector + .set_load_online(clone!(@weak this => @default-panic, move || { + async move { + let mut poes = Vec::new(); - let persons = this.handle.backend.cl().get_persons().await?; - let ensembles = this.handle.backend.cl().get_ensembles().await?; + let persons = this.handle.backend.cl().get_persons().await?; + let ensembles = this.handle.backend.cl().get_ensembles().await?; - for person in persons { - poes.push(PersonOrEnsemble::Person(person)); + for person in persons { + poes.push(PersonOrEnsemble::Person(person)); + } + + for ensemble in ensembles { + poes.push(PersonOrEnsemble::Ensemble(ensemble)); + } + + Ok(poes) } + })); - for ensemble in ensembles { - poes.push(PersonOrEnsemble::Ensemble(ensemble)); + this.selector + .set_load_local(clone!(@weak this => @default-panic, move || { + async move { + let mut poes = Vec::new(); + + let persons = this.handle.backend.db().get_persons().await.unwrap(); + let ensembles = this.handle.backend.db().get_ensembles().await.unwrap(); + + for person in persons { + poes.push(PersonOrEnsemble::Person(person)); + } + + for ensemble in ensembles { + poes.push(PersonOrEnsemble::Ensemble(ensemble)); + } + + poes } + })); - Ok(poes) - } - })); - - this.selector.set_load_local(clone!(@weak this => move || { - async move { - let mut poes = Vec::new(); - - let persons = this.handle.backend.db().get_persons().await.unwrap(); - let ensembles = this.handle.backend.db().get_ensembles().await.unwrap(); - - for person in persons { - poes.push(PersonOrEnsemble::Person(person)); - } - - for ensemble in ensembles { - poes.push(PersonOrEnsemble::Ensemble(ensemble)); - } - - poes - } - })); - - this.selector.set_make_widget(clone!(@weak this => move |poe| { + this.selector.set_make_widget(clone!(@weak this => @default-panic, move |poe| { let row = libadwaita::ActionRow::new(); row.set_activatable(true); row.set_title(Some(&poe.get_title())); let poe = poe.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { + row.connect_activated(clone!(@weak this => move |_| { let poe = poe.clone(); spawn!(@clone this, async move { if let Some(medium) = push!(this.handle, MediumSelectorMediumScreen, poe).await { @@ -137,43 +136,45 @@ impl Screen for MediumSelectorMediumScreen { selector, }); - this.selector.set_back_cb(clone!(@weak this => move || { + this.selector.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); match this.poe.clone() { PersonOrEnsemble::Person(person) => { - // this.selector.set_load_online(clone!(@weak this => move || { + // this.selector.set_load_online(clone!(@weak this => move || { // async move { this.handle.backend.cl().get_mediums_for_person(&person.id).await } // })); - this.selector.set_load_local(clone!(@weak this => move || { + this.selector.set_load_local(clone!(@weak this => @default-panic, move || { let person = person.clone(); async move { this.handle.backend.db().get_mediums_for_person(&person.id).await.unwrap() } })); } PersonOrEnsemble::Ensemble(ensemble) => { - this.selector.set_load_local(clone!(@weak this => move || { + this.selector.set_load_local(clone!(@weak this => @default-panic, move || { let ensemble = ensemble.clone(); async move { this.handle.backend.db().get_mediums_for_ensemble(&ensemble.id).await.unwrap() } })); } } - this.selector.set_make_widget(clone!(@weak this => move |medium| { - let row = libadwaita::ActionRow::new(); - row.set_activatable(true); - row.set_title(Some(&medium.name)); + this.selector + .set_make_widget(clone!(@weak this => @default-panic, move |medium| { + let row = libadwaita::ActionRow::new(); + row.set_activatable(true); + row.set_title(Some(&medium.name)); - let medium = medium.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { - this.handle.pop(Some(medium.clone())); + let medium = medium.to_owned(); + row.connect_activated(clone!(@weak this => move |_| { + this.handle.pop(Some(medium.clone())); + })); + + row.upcast() })); - row.upcast() - })); - - this.selector.set_filter(|search, medium| medium.name.to_lowercase().contains(search)); + this.selector + .set_filter(|search, medium| medium.name.to_lowercase().contains(search)); this } diff --git a/musicus/src/selectors/person.rs b/musicus/src/selectors/person.rs index 87e2a82..184e17f 100644 --- a/musicus/src/selectors/person.rs +++ b/musicus/src/selectors/person.rs @@ -23,18 +23,15 @@ impl Screen<(), Person> for PersonSelector { let selector = Selector::::new(Rc::clone(&handle.backend)); selector.set_title(&gettext("Select person")); - let this = Rc::new(Self { - handle, - selector, - }); + let this = Rc::new(Self { handle, selector }); // Connect signals and callbacks - this.selector.set_back_cb(clone!(@weak this => move || { + this.selector.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); - this.selector.set_add_cb(clone!(@weak this => move || { + this.selector.set_add_cb(clone!(@weak this => move || { spawn!(@clone this, async move { if let Some(person) = push!(this.handle, PersonEditor, None).await { this.handle.pop(Some(person)); @@ -42,28 +39,31 @@ impl Screen<(), Person> for PersonSelector { }); })); - this.selector.set_load_online(clone!(@weak this => move || { - let clone = this.clone(); - async move { Ok(clone.handle.backend.cl().get_persons().await?) } - })); - - this.selector.set_load_local(clone!(@weak this => move || { - let clone = this.clone(); - async move { clone.handle.backend.db().get_persons().await.unwrap() } - })); - - this.selector.set_make_widget(clone!(@weak this => move |person| { - let row = libadwaita::ActionRow::new(); - row.set_activatable(true); - row.set_title(Some(&person.name_lf())); - - let person = person.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { - this.handle.pop(Some(person.clone())); + this.selector + .set_load_online(clone!(@weak this => @default-panic, move || { + let clone = this.clone(); + async move { Ok(clone.handle.backend.cl().get_persons().await?) } })); - row.upcast() - })); + this.selector + .set_load_local(clone!(@weak this => @default-panic, move || { + let clone = this.clone(); + async move { clone.handle.backend.db().get_persons().await.unwrap() } + })); + + this.selector + .set_make_widget(clone!(@weak this => @default-panic, move |person| { + let row = libadwaita::ActionRow::new(); + row.set_activatable(true); + row.set_title(Some(&person.name_lf())); + + let person = person.to_owned(); + row.connect_activated(clone!(@weak this => move |_| { + this.handle.pop(Some(person.clone())); + })); + + row.upcast() + })); this.selector .set_filter(|search, person| person.name_fl().to_lowercase().contains(search)); diff --git a/musicus/src/selectors/recording.rs b/musicus/src/selectors/recording.rs index 33bd320..a354422 100644 --- a/musicus/src/selectors/recording.rs +++ b/musicus/src/selectors/recording.rs @@ -1,12 +1,12 @@ use super::selector::Selector; -use crate::editors::{PersonEditor, WorkEditor, RecordingEditor}; +use crate::editors::{PersonEditor, RecordingEditor, WorkEditor}; use crate::navigator::{NavigationHandle, Screen}; use crate::widgets::Widget; use gettextrs::gettext; use glib::clone; use gtk::prelude::*; use libadwaita::prelude::*; -use musicus_backend::db::{Person, Work, Recording}; +use musicus_backend::db::{Person, Recording, Work}; use std::rc::Rc; /// A screen for selecting a recording. @@ -22,18 +22,15 @@ impl Screen<(), Recording> for RecordingSelector { let selector = Selector::::new(Rc::clone(&handle.backend)); selector.set_title(&gettext("Select composer")); - let this = Rc::new(Self { - handle, - selector, - }); + let this = Rc::new(Self { handle, selector }); // Connect signals and callbacks - this.selector.set_back_cb(clone!(@weak this => move || { + this.selector.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); - this.selector.set_add_cb(clone!(@weak this => move || { + this.selector.set_add_cb(clone!(@weak this => move || { spawn!(@clone this, async move { if let Some(person) = push!(this.handle, PersonEditor, None).await { // We can assume that there are no existing works of this composer and @@ -54,21 +51,23 @@ impl Screen<(), Recording> for RecordingSelector { }); })); - this.selector.set_load_online(clone!(@weak this => move || { - async move { Ok(this.handle.backend.cl().get_persons().await?) } - })); + this.selector + .set_load_online(clone!(@weak this => @default-panic, move || { + async move { Ok(this.handle.backend.cl().get_persons().await?) } + })); - this.selector.set_load_local(clone!(@weak this => move || { - async move { this.handle.backend.db().get_persons().await.unwrap() } - })); + this.selector + .set_load_local(clone!(@weak this => @default-panic, move || { + async move { this.handle.backend.db().get_persons().await.unwrap() } + })); - this.selector.set_make_widget(clone!(@weak this => move |person| { + this.selector.set_make_widget(clone!(@weak this => @default-panic, move |person| { let row = libadwaita::ActionRow::new(); row.set_activatable(true); row.set_title(Some(&person.name_lf())); let person = person.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { + row.connect_activated(clone!(@weak this => move |_| { // Instead of returning the person from here, like the person selector does, we // show a second selector for choosing the work. @@ -119,11 +118,11 @@ impl Screen for RecordingSelectorWorkScreen { selector, }); - this.selector.set_back_cb(clone!(@weak this => move || { + this.selector.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); - this.selector.set_add_cb(clone!(@weak this => move || { + this.selector.set_add_cb(clone!(@weak this => move || { spawn!(@clone this, async move { let work = Work::new(this.person.clone()); if let Some(work) = push!(this.handle, WorkEditor, Some(work)).await { @@ -132,28 +131,32 @@ impl Screen for RecordingSelectorWorkScreen { }); })); - this.selector.set_load_online(clone!(@weak this => move || { - async move { Ok(this.handle.backend.cl().get_works(&this.person.id).await?) } - })); - - this.selector.set_load_local(clone!(@weak this => move || { - async move { this.handle.backend.db().get_works(&this.person.id).await.unwrap() } - })); - - this.selector.set_make_widget(clone!(@weak this => move |work| { - let row = libadwaita::ActionRow::new(); - row.set_activatable(true); - row.set_title(Some(&work.title)); - - let work = work.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { - this.handle.pop(Some(work.clone())); + this.selector + .set_load_online(clone!(@weak this => @default-panic, move || { + async move { Ok(this.handle.backend.cl().get_works(&this.person.id).await?) } })); - row.upcast() - })); + this.selector + .set_load_local(clone!(@weak this => @default-panic, move || { + async move { this.handle.backend.db().get_works(&this.person.id).await.unwrap() } + })); - this.selector.set_filter(|search, work| work.title.to_lowercase().contains(search)); + this.selector + .set_make_widget(clone!(@weak this => @default-panic, move |work| { + let row = libadwaita::ActionRow::new(); + row.set_activatable(true); + row.set_title(Some(&work.title)); + + let work = work.to_owned(); + row.connect_activated(clone!(@weak this => move |_| { + this.handle.pop(Some(work.clone())); + })); + + row.upcast() + })); + + this.selector + .set_filter(|search, work| work.title.to_lowercase().contains(search)); this } @@ -184,11 +187,11 @@ impl Screen for RecordingSelectorRecordingScreen { selector, }); - this.selector.set_back_cb(clone!(@weak this => move || { + this.selector.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); - this.selector.set_add_cb(clone!(@weak this => move || { + this.selector.set_add_cb(clone!(@weak this => move || { spawn!(@clone this, async move { let recording = Recording::new(this.work.clone()); if let Some(recording) = push!(this.handle, RecordingEditor, Some(recording)).await { @@ -197,29 +200,31 @@ impl Screen for RecordingSelectorRecordingScreen { }); })); - this.selector.set_load_online(clone!(@weak this => move || { + this.selector.set_load_online(clone!(@weak this => @default-panic, move || { async move { Ok(this.handle.backend.cl().get_recordings_for_work(&this.work.id).await?) } })); - this.selector.set_load_local(clone!(@weak this => move || { + this.selector.set_load_local(clone!(@weak this => @default-panic, move || { async move { this.handle.backend.db().get_recordings_for_work(&this.work.id).await.unwrap() } })); - this.selector.set_make_widget(clone!(@weak this => move |recording| { - let row = libadwaita::ActionRow::new(); - row.set_activatable(true); - row.set_title(Some(&recording.get_performers())); + this.selector + .set_make_widget(clone!(@weak this => @default-panic, move |recording| { + let row = libadwaita::ActionRow::new(); + row.set_activatable(true); + row.set_title(Some(&recording.get_performers())); - let recording = recording.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { - this.handle.pop(Some(recording.clone())); + let recording = recording.to_owned(); + row.connect_activated(clone!(@weak this => move |_| { + this.handle.pop(Some(recording.clone())); + })); + + row.upcast() })); - row.upcast() - })); - - this.selector - .set_filter(|search, recording| recording.get_performers().to_lowercase().contains(search)); + this.selector.set_filter(|search, recording| { + recording.get_performers().to_lowercase().contains(search) + }); this } diff --git a/musicus/src/selectors/selector.rs b/musicus/src/selectors/selector.rs index 19bb11b..9d3c078 100644 --- a/musicus/src/selectors/selector.rs +++ b/musicus/src/selectors/selector.rs @@ -82,13 +82,14 @@ impl Selector { } })); - this.search_entry.connect_search_changed(clone!(@strong this => move |_| { - this.list.invalidate_filter(); - })); + this.search_entry + .connect_search_changed(clone!(@strong this => move |_| { + this.list.invalidate_filter(); + })); this.server_check_button .connect_toggled(clone!(@strong this => move |_| { - let active = this.server_check_button.get_active(); + let active = this.server_check_button.is_active(); this.backend.set_use_server(active); if active { @@ -98,25 +99,27 @@ impl Selector { } })); - this.list.set_make_widget_cb(clone!(@strong this => move |index| { - if let Some(cb) = &*this.make_widget.borrow() { - let item = &this.items.borrow()[index]; - cb(item) - } else { - gtk::Label::new(None).upcast() - } - })); - - this.list.set_filter_cb(clone!(@strong this => move |index| { - match &*this.filter.borrow() { - Some(filter) => { + this.list + .set_make_widget_cb(clone!(@strong this => move |index| { + if let Some(cb) = &*this.make_widget.borrow() { let item = &this.items.borrow()[index]; - let search = this.search_entry.get_text().to_string().to_lowercase(); - search.is_empty() || filter(&search, item) + cb(item) + } else { + gtk::Label::new(None).upcast() } - None => true, - } - })); + })); + + this.list + .set_filter_cb(clone!(@strong this => move |index| { + match &*this.filter.borrow() { + Some(filter) => { + let item = &this.items.borrow()[index]; + let search = this.search_entry.text().to_string().to_lowercase(); + search.is_empty() || filter(&search, item) + } + None => true, + } + })); try_again_button.connect_clicked(clone!(@strong this => move |_| { this.clone().load_online(); diff --git a/musicus/src/selectors/work.rs b/musicus/src/selectors/work.rs index 5355886..d0f7fa0 100644 --- a/musicus/src/selectors/work.rs +++ b/musicus/src/selectors/work.rs @@ -22,18 +22,15 @@ impl Screen<(), Work> for WorkSelector { let selector = Selector::::new(Rc::clone(&handle.backend)); selector.set_title(&gettext("Select composer")); - let this = Rc::new(Self { - handle, - selector, - }); + let this = Rc::new(Self { handle, selector }); // Connect signals and callbacks - this.selector.set_back_cb(clone!(@weak this => move || { + this.selector.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); - this.selector.set_add_cb(clone!(@weak this => move || { + this.selector.set_add_cb(clone!(@weak this => move || { spawn!(@clone this, async move { if let Some(person) = push!(this.handle, PersonEditor, None).await { // We can assume that there are no existing works of this composer and @@ -48,21 +45,23 @@ impl Screen<(), Work> for WorkSelector { }); })); - this.selector.set_load_online(clone!(@weak this => move || { - async move { Ok(this.handle.backend.cl().get_persons().await?) } - })); + this.selector + .set_load_online(clone!(@weak this => @default-panic, move || { + async move { Ok(this.handle.backend.cl().get_persons().await?) } + })); - this.selector.set_load_local(clone!(@weak this => move || { - async move { this.handle.backend.db().get_persons().await.unwrap() } - })); + this.selector + .set_load_local(clone!(@weak this => @default-panic, move || { + async move { this.handle.backend.db().get_persons().await.unwrap() } + })); - this.selector.set_make_widget(clone!(@weak this => move |person| { + this.selector.set_make_widget(clone!(@weak this => @default-panic, move |person| { let row = libadwaita::ActionRow::new(); row.set_activatable(true); row.set_title(Some(&person.name_lf())); let person = person.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { + row.connect_activated(clone!(@weak this => move |_| { // Instead of returning the person from here, like the person selector does, we // show a second selector for choosing the work. @@ -109,11 +108,11 @@ impl Screen for WorkSelectorWorkScreen { selector, }); - this.selector.set_back_cb(clone!(@weak this => move || { + this.selector.set_back_cb(clone!(@weak this => move || { this.handle.pop(None); })); - this.selector.set_add_cb(clone!(@weak this => move || { + this.selector.set_add_cb(clone!(@weak this => move || { spawn!(@clone this, async move { let work = Work::new(this.person.clone()); if let Some(work) = push!(this.handle, WorkEditor, Some(work)).await { @@ -122,28 +121,32 @@ impl Screen for WorkSelectorWorkScreen { }); })); - this.selector.set_load_online(clone!(@weak this => move || { - async move { Ok(this.handle.backend.cl().get_works(&this.person.id).await?) } - })); - - this.selector.set_load_local(clone!(@weak this => move || { - async move { this.handle.backend.db().get_works(&this.person.id).await.unwrap() } - })); - - this.selector.set_make_widget(clone!(@weak this => move |work| { - let row = libadwaita::ActionRow::new(); - row.set_activatable(true); - row.set_title(Some(&work.title)); - - let work = work.to_owned(); - row.connect_activated(clone!(@weak this => move |_| { - this.handle.pop(Some(work.clone())); + this.selector + .set_load_online(clone!(@weak this => @default-panic, move || { + async move { Ok(this.handle.backend.cl().get_works(&this.person.id).await?) } })); - row.upcast() - })); + this.selector + .set_load_local(clone!(@weak this => @default-panic, move || { + async move { this.handle.backend.db().get_works(&this.person.id).await.unwrap() } + })); - this.selector.set_filter(|search, work| work.title.to_lowercase().contains(search)); + this.selector + .set_make_widget(clone!(@weak this => @default-panic, move |work| { + let row = libadwaita::ActionRow::new(); + row.set_activatable(true); + row.set_title(Some(&work.title)); + + let work = work.to_owned(); + row.connect_activated(clone!(@weak this => move |_| { + this.handle.pop(Some(work.clone())); + })); + + row.upcast() + })); + + this.selector + .set_filter(|search, work| work.title.to_lowercase().contains(search)); this } diff --git a/musicus/src/widgets/button_row.rs b/musicus/src/widgets/button_row.rs index 7ffe142..4160e2d 100644 --- a/musicus/src/widgets/button_row.rs +++ b/musicus/src/widgets/button_row.rs @@ -27,10 +27,7 @@ impl ButtonRow { widget.add_suffix(&button); - Self { - widget, - button, - } + Self { widget, button } } /// Set the subtitle of the row. diff --git a/musicus/src/widgets/entry_row.rs b/musicus/src/widgets/entry_row.rs index f3f6442..638316c 100644 --- a/musicus/src/widgets/entry_row.rs +++ b/musicus/src/widgets/entry_row.rs @@ -26,10 +26,7 @@ impl EntryRow { widget.add_suffix(&entry); - Self { - widget, - entry, - } + Self { widget, entry } } /// Set the text of the entry. @@ -39,6 +36,6 @@ impl EntryRow { /// Get the text that was entered by the user. pub fn get_text(&self) -> String { - self.entry.get_text().to_string() + self.entry.text().to_string() } } diff --git a/musicus/src/widgets/indexed_list_model.rs b/musicus/src/widgets/indexed_list_model.rs index 6d8395d..cf952a5 100644 --- a/musicus/src/widgets/indexed_list_model.rs +++ b/musicus/src/widgets/indexed_list_model.rs @@ -1,12 +1,10 @@ -use glib::prelude::*; -use glib::subclass; -use glib::subclass::prelude::*; use gio::prelude::*; use gio::subclass::prelude::*; use once_cell::sync::Lazy; use std::cell::Cell; glib::wrapper! { + /// A thin list model managing only indices to an external data source. pub struct IndexedListModel(ObjectSubclass) @implements gio::ListModel; } @@ -19,7 +17,7 @@ impl IndexedListModel { /// Set the length of the list model. pub fn set_length(&self, length: u32) { - let old_length = self.get_property("length").unwrap().get_some::().unwrap(); + let old_length = self.property("length").unwrap().get::().unwrap(); self.set_property("length", &length).unwrap(); self.items_changed(0, old_length, length); } @@ -28,58 +26,54 @@ impl IndexedListModel { mod indexed_list_model { use super::*; - #[derive(Debug)] + #[derive(Debug, Default)] pub struct IndexedListModel { length: Cell, } + #[glib::object_subclass] impl ObjectSubclass for IndexedListModel { const NAME: &'static str = "IndexedListModel"; - type Type = super::IndexedListModel; type ParentType = glib::Object; type Interfaces = (gio::ListModel,); - type Instance = subclass::simple::InstanceStruct; - type Class = subclass::simple::ClassStruct; - - glib::object_subclass!(); - - fn new() -> Self { - Self { length: Cell::new(0) } - } } impl ObjectImpl for IndexedListModel { fn properties() -> &'static [glib::ParamSpec] { static PROPERTIES: Lazy> = Lazy::new(|| { - vec![ - glib::ParamSpec::uint( - "length", - "Length", - "Length", - 0, - std::u32::MAX, - 0, - glib::ParamFlags::READWRITE, - ), - ] + vec![glib::ParamSpec::new_uint( + "length", + "Length", + "Length", + 0, + std::u32::MAX, + 0, + glib::ParamFlags::READWRITE, + )] }); PROPERTIES.as_ref() } - fn set_property(&self, _obj: &Self::Type, _id: usize, value: &glib::Value, pspec: &glib::ParamSpec) { - match pspec.get_name() { + fn set_property( + &self, + _: &Self::Type, + _: usize, + value: &glib::Value, + pspec: &glib::ParamSpec, + ) { + match pspec.name() { "length" => { - let length = value.get().unwrap().unwrap(); + let length = value.get::().unwrap(); self.length.set(length); } _ => unimplemented!(), } } - fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value { - match pspec.get_name() { + fn property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value { + match pspec.name() { "length" => self.length.get().to_value(), _ => unimplemented!(), } @@ -87,21 +81,22 @@ mod indexed_list_model { } impl ListModelImpl for IndexedListModel { - fn get_item_type(&self, _: &Self::Type) -> glib::Type { + fn item_type(&self, _: &Self::Type) -> glib::Type { ItemIndex::static_type() } - fn get_n_items(&self, _: &Self::Type) -> u32 { + fn n_items(&self, _: &Self::Type) -> u32 { self.length.get() } - fn get_item(&self, _: &Self::Type, position: u32) -> Option { + fn item(&self, _: &Self::Type, position: u32) -> Option { Some(ItemIndex::new(position).upcast()) } } } glib::wrapper! { + /// A simple GObject holding just one integer. pub struct ItemIndex(ObjectSubclass); } @@ -113,65 +108,61 @@ impl ItemIndex { /// Get the value of the item index.. pub fn get(&self) -> u32 { - self.get_property("value").unwrap().get_some::().unwrap() + self.property("value").unwrap().get::().unwrap() } } mod item_index { use super::*; - #[derive(Debug)] + #[derive(Debug, Default)] pub struct ItemIndex { value: Cell, } + #[glib::object_subclass] impl ObjectSubclass for ItemIndex { const NAME: &'static str = "ItemIndex"; - type Type = super::ItemIndex; type ParentType = glib::Object; type Interfaces = (); - type Instance = subclass::simple::InstanceStruct; - type Class = subclass::simple::ClassStruct; - - glib::object_subclass!(); - - fn new() -> Self { - Self { value: Cell::new(0) } - } } impl ObjectImpl for ItemIndex { fn properties() -> &'static [glib::ParamSpec] { static PROPERTIES: Lazy> = Lazy::new(|| { - vec![ - glib::ParamSpec::uint( - "value", - "Value", - "Value", - 0, - std::u32::MAX, - 0, - glib::ParamFlags::READWRITE, - ), - ] + vec![glib::ParamSpec::new_uint( + "value", + "Value", + "Value", + 0, + std::u32::MAX, + 0, + glib::ParamFlags::READWRITE, + )] }); PROPERTIES.as_ref() } - fn set_property(&self, _obj: &Self::Type, _id: usize, value: &glib::Value, pspec: &glib::ParamSpec) { - match pspec.get_name() { + fn set_property( + &self, + _: &Self::Type, + _: usize, + value: &glib::Value, + pspec: &glib::ParamSpec, + ) { + match pspec.name() { "value" => { - let value = value.get().unwrap().unwrap(); + let value = value.get::().unwrap(); self.value.set(value); } _ => unimplemented!(), } } - fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value { - match pspec.get_name() { + fn property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value { + match pspec.name() { "value" => self.value.get().to_value(), _ => unimplemented!(), } diff --git a/musicus/src/widgets/list.rs b/musicus/src/widgets/list.rs index 950b2e8..7550894 100644 --- a/musicus/src/widgets/list.rs +++ b/musicus/src/widgets/list.rs @@ -40,14 +40,15 @@ impl List { move_cb: RefCell::new(None), }); - this.filter.set_filter_func(clone!(@strong this => move |index| { - if let Some(cb) = &*this.filter_cb.borrow() { - let index = index.downcast_ref::().unwrap().get() as usize; - cb(index) - } else { - true - } - })); + this.filter + .set_filter_func(clone!(@strong this => move |index| { + if let Some(cb) = &*this.filter_cb.borrow() { + let index = index.downcast_ref::().unwrap().get() as usize; + cb(index) + } else { + true + } + })); this.widget.bind_model(Some(&filter_model), clone!(@strong this => move |index| { let index = index.downcast_ref::().unwrap().get() as usize; @@ -64,13 +65,13 @@ impl List { })); let drag_value = (index as u32).to_value(); - drag_source.set_content(Some(&gdk::ContentProvider::new_for_value(&drag_value))); + drag_source.set_content(Some(&gdk::ContentProvider::for_value(&drag_value))); let drop_target = gtk::DropTarget::new(glib::Type::U32, gdk::DragAction::COPY); drop_target.connect_drop(clone!(@strong this => move |_, value, _, _| { if let Some(cb) = &*this.move_cb.borrow() { - let old_index: u32 = value.get_some().unwrap(); + let old_index: u32 = value.get().unwrap(); cb(old_index as usize, index); true } else { diff --git a/musicus/src/widgets/screen.rs b/musicus/src/widgets/screen.rs index 13af797..388bed4 100644 --- a/musicus/src/widgets/screen.rs +++ b/musicus/src/widgets/screen.rs @@ -49,7 +49,7 @@ impl Screen { widget.insert_action_group("widget", Some(&actions)); search_button.connect_toggled(clone!(@strong search_entry => move |search_button| { - if search_button.get_active() { + if search_button.is_active() { search_entry.grab_focus(); } })); @@ -88,7 +88,8 @@ impl Screen { action.connect_activate(move |_, _| cb()); self.actions.add_action(&action); - self.menu.append(Some(label), Some(&format!("widget.{}", name))); + self.menu + .append(Some(label), Some(&format!("widget.{}", name))); } /// Set the closure to be called when the search string has changed. @@ -98,7 +99,7 @@ impl Screen { /// Get the current search string. pub fn get_search(&self) -> String { - self.search_entry.get_text().to_string().to_lowercase() + self.search_entry.text().to_string().to_lowercase() } /// Hide the loading page and switch to the content. diff --git a/musicus/src/widgets/upload_section.rs b/musicus/src/widgets/upload_section.rs index b3500e9..2dc60b6 100644 --- a/musicus/src/widgets/upload_section.rs +++ b/musicus/src/widgets/upload_section.rs @@ -45,15 +45,16 @@ impl UploadSection { switch, }); - this.switch.connect_property_state_notify(clone!(@weak this => move |_| { - this.backend.set_use_server(this.switch.get_state()); - })); + this.switch + .connect_state_notify(clone!(@weak this => move |_| { + this.backend.set_use_server(this.switch.state()); + })); this } /// Return whether the user has enabled the upload switch. pub fn get_active(&self) -> bool { - self.switch.get_active() + self.switch.state() } } diff --git a/musicus/src/window.rs b/musicus/src/window.rs index df76134..50c490e 100644 --- a/musicus/src/window.rs +++ b/musicus/src/window.rs @@ -1,5 +1,5 @@ -use crate::screens::{MainScreen, WelcomeScreen}; use crate::navigator::Navigator; +use crate::screens::{MainScreen, WelcomeScreen}; use gtk::prelude::*; use musicus_backend::{Backend, BackendState}; use std::rc::Rc; @@ -41,9 +41,8 @@ impl Window { loading_screen.append(&header); loading_screen.append(&spinner); - let navigator = Navigator::new(Rc::clone(&backend), &window, &loading_screen); - libadwaita::ApplicationWindowExt::set_child(&window, Some(&navigator.widget)); + window.set_child(Some(&navigator.widget)); let this = Rc::new(Self { backend,