[niepce] rust: Update glib and gtk to 0.15.
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] rust: Update glib and gtk to 0.15.
- Date: Sat, 3 Jul 2021 16:26:59 +0000 (UTC)
commit 7db0507b819e6624295fb78aaca1479c285a7154
Author: Hubert Figuière <hub figuiere net>
Date: Wed Jun 30 21:59:29 2021 -0400
rust: Update glib and gtk to 0.15.
- Update cbindings to 0.19 otherwise it break
Cargo.lock | 628 +++++++++------------
crates/npc-engine/Cargo.toml | 2 +-
crates/npc-fwk/Cargo.toml | 14 +-
crates/npc-fwk/src/lib.rs | 1 -
crates/npc-fwk/src/toolkit/gdk_utils.rs | 6 +-
crates/npc-fwk/src/toolkit/mimetype.rs | 4 +-
crates/npc-fwk/src/toolkit/thumbnail.rs | 27 +-
crates/npc-fwk/src/toolkit/widgets/rating_label.rs | 160 +++---
crates/npc-fwk/src/utils/files.rs | 20 +-
niepce-main/Cargo.toml | 4 +-
niepce-main/build.rs | 1 +
.../src/niepce/ui/dialogs/requestnewfolder.rs | 12 +-
niepce-main/src/niepce/ui/image_grid_view.rs | 46 +-
niepce-main/src/niepce/ui/image_list_store.rs | 59 +-
niepce-main/src/niepce/ui/library_cell_renderer.rs | 205 ++++---
niepce-main/src/niepce/ui/thumb_nav.rs | 232 ++++----
niepce-main/src/niepce/ui/thumb_strip_view.rs | 125 ++--
17 files changed, 679 insertions(+), 867 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index bd2337a..0a5ea81 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,5 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
+version = 3
+
[[package]]
name = "ansi_term"
version = "0.11.0"
@@ -11,29 +13,27 @@ dependencies = [
[[package]]
name = "anyhow"
-version = "1.0.31"
+version = "1.0.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f"
+checksum = "15af2628f6890fe2609a3b91bef4c83450512802e59489f9c1cb1fa5df064a61"
[[package]]
name = "atk"
-version = "0.9.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "812b4911e210bd51b24596244523c856ca749e6223c50a7fbbba3f89ee37c426"
+checksum = "a83b21d2aa75e464db56225e1bda2dd5993311ba1095acaa8fa03d1ae67026ba"
dependencies = [
"atk-sys",
"bitflags",
"glib",
- "glib-sys",
- "gobject-sys",
"libc",
]
[[package]]
name = "atk-sys"
-version = "0.10.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f530e4af131d94cc4fa15c5c9d0348f0ef28bac64ba660b6b2a1cf2605dedfce"
+checksum = "badcf670157c84bb8b1cf6b5f70b650fed78da2033c9eed84c4e49b11cbe83ea"
dependencies = [
"glib-sys",
"gobject-sys",
@@ -54,9 +54,9 @@ dependencies = [
[[package]]
name = "autocfg"
-version = "1.0.0"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
+checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "bitflags"
@@ -64,35 +64,24 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
-[[package]]
-name = "c2-chacha"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb"
-dependencies = [
- "ppv-lite86",
-]
-
[[package]]
name = "cairo-rs"
-version = "0.9.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "20c39055f35fb3cf8cc2683e8e85097cc1b26f76ac1438626a50c503cc141e5c"
+checksum = "8d32eecb1e806433cf68063c4548bbdc15cc56d35db19d685ab60909c4c85206"
dependencies = [
"bitflags",
"cairo-sys-rs",
"glib",
- "glib-sys",
- "gobject-sys",
"libc",
"thiserror",
]
[[package]]
name = "cairo-sys-rs"
-version = "0.10.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2ed2639b9ad5f1d6efa76de95558e11339e7318426d84ac4890b86c03e828ca7"
+checksum = "d7c9c3928781e8a017ece15eace05230f04b647457d170d2d9641c94a444ff80"
dependencies = [
"glib-sys",
"libc",
@@ -101,11 +90,13 @@ dependencies = [
[[package]]
name = "cbindgen"
-version = "0.13.1"
+version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c955bd5e66e36a03612c877585d75219da64e3d9ae5f14d76c979ccb95de070"
+checksum = "38728c31b994e4b849cf59feefb4a8bf26acd299ee0b92c9fb35bd14ad4b8dfa"
dependencies = [
"clap",
+ "heck",
+ "indexmap",
"log",
"proc-macro2",
"quote",
@@ -117,33 +108,38 @@ dependencies = [
]
[[package]]
-name = "cc"
-version = "1.0.50"
+name = "cfg-expr"
+version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"
+checksum = "30aa9e2ffbb838c6b451db14f3cd8e63ed622bf859f9956bc93845a10fafc26a"
+dependencies = [
+ "smallvec",
+]
[[package]]
name = "cfg-if"
-version = "0.1.10"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
-version = "0.4.10"
+version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "31850b4a4d6bae316f7a09e691c944c28299298837edc0a03f755618c23cbc01"
+checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
dependencies = [
+ "libc",
"num-integer",
"num-traits",
"time",
+ "winapi",
]
[[package]]
name = "clap"
-version = "2.33.0"
+version = "2.33.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
+checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
dependencies = [
"ansi_term",
"atty",
@@ -154,20 +150,11 @@ dependencies = [
"vec_map",
]
-[[package]]
-name = "cloudabi"
-version = "0.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
-dependencies = [
- "bitflags",
-]
-
[[package]]
name = "either"
-version = "1.5.3"
+version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
+checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
[[package]]
name = "exempi"
@@ -189,41 +176,35 @@ dependencies = [
]
[[package]]
-name = "futures"
-version = "0.3.5"
+name = "field-offset"
+version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613"
+checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92"
dependencies = [
- "futures-channel",
- "futures-core",
- "futures-executor",
- "futures-io",
- "futures-sink",
- "futures-task",
- "futures-util",
+ "memoffset",
+ "rustc_version",
]
[[package]]
name = "futures-channel"
-version = "0.3.5"
+version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5"
+checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2"
dependencies = [
"futures-core",
- "futures-sink",
]
[[package]]
name = "futures-core"
-version = "0.3.5"
+version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399"
+checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1"
[[package]]
name = "futures-executor"
-version = "0.3.5"
+version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314"
+checksum = "badaa6a909fac9e7236d0620a2f57f7664640c56575b71a7552fbd68deafab79"
dependencies = [
"futures-core",
"futures-task",
@@ -232,97 +213,63 @@ dependencies = [
[[package]]
name = "futures-io"
-version = "0.3.5"
+version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789"
-
-[[package]]
-name = "futures-macro"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39"
-dependencies = [
- "proc-macro-hack",
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "futures-sink"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc"
+checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1"
[[package]]
name = "futures-task"
-version = "0.3.5"
+version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626"
-dependencies = [
- "once_cell 1.4.0",
-]
+checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae"
[[package]]
name = "futures-util"
-version = "0.3.5"
+version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6"
+checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967"
dependencies = [
- "futures-channel",
+ "autocfg",
"futures-core",
- "futures-io",
- "futures-macro",
- "futures-sink",
"futures-task",
- "memchr",
- "pin-project",
+ "pin-project-lite",
"pin-utils",
- "proc-macro-hack",
- "proc-macro-nested",
"slab",
]
[[package]]
name = "gdk"
-version = "0.13.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7764140c1246a19ce9b5f7e8b760f7d11644651a8e18a64873e9980cd68ba558"
+checksum = "679e22651cd15888e7acd01767950edca2ee9fcd6421fbf5b3c3b420d4e88bb0"
dependencies = [
"bitflags",
"cairo-rs",
- "cairo-sys-rs",
"gdk-pixbuf",
"gdk-sys",
"gio",
- "gio-sys",
"glib",
- "glib-sys",
- "gobject-sys",
"libc",
"pango",
]
[[package]]
name = "gdk-pixbuf"
-version = "0.9.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f6dae3cb99dd49b758b88f0132f8d401108e63ae8edd45f432d42cdff99998a"
+checksum = "534192cb8f01daeb8fab2c8d4baa8f9aae5b7a39130525779f5c2608e235b10f"
dependencies = [
"gdk-pixbuf-sys",
"gio",
- "gio-sys",
"glib",
- "glib-sys",
- "gobject-sys",
"libc",
]
[[package]]
name = "gdk-pixbuf-sys"
-version = "0.10.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3bfe468a7f43e97b8d193a762b6c5cf67a7d36cacbc0b9291dbcae24bfea1e8f"
+checksum = "f097c0704201fbc8f69c1762dc58c6947c8bb188b8ed0bc7e65259f1894fe590"
dependencies = [
"gio-sys",
"glib-sys",
@@ -333,9 +280,9 @@ dependencies = [
[[package]]
name = "gdk-sys"
-version = "0.10.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0a9653cfc500fd268015b1ac055ddbc3df7a5c9ea3f4ccef147b3957bd140d69"
+checksum = "0e091b3d3d6696949ac3b3fb3c62090e5bfd7bd6850bef5c3c5ea701de1b1f1e"
dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
@@ -350,9 +297,9 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.1.14"
+version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
+checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
dependencies = [
"cfg-if",
"libc",
@@ -367,9 +314,9 @@ checksum = "823d7e5d0e615f937c7629991bc9f4c090ad582303214c38744e1a16d6ffbe5e"
[[package]]
name = "gexiv2-sys"
-version = "1.1.1"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "edc8f7e79962171a99792ff6895fac7abe89380c02f9abf9dc73c88f2e56697c"
+checksum = "b3e66ac4aab8b401ca63838116d080b98e12fb5056e1c2a44e35c93da3526d13"
dependencies = [
"libc",
"pkg-config",
@@ -377,65 +324,61 @@ dependencies = [
[[package]]
name = "gio"
-version = "0.9.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c5492e80b45e6c56214894a9a0cbe1340ab5066eb44a2dbe151393b6d7942c0"
+checksum = "86c6823b39d46d22cac2466de261f28d7f049ebc18f7b35296a42c7ed8a88325"
dependencies = [
"bitflags",
- "futures",
"futures-channel",
"futures-core",
"futures-io",
- "futures-util",
"gio-sys",
"glib",
- "glib-sys",
- "gobject-sys",
"libc",
- "once_cell 1.4.0",
+ "once_cell",
"thiserror",
]
[[package]]
name = "gio-sys"
-version = "0.10.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "35993626299fbcaa73c0a19be8fdd01c950f9f3d3ac9cb4fb5532b924ab1a5d7"
+checksum = "c0a41df66e57fcc287c4bcf74fc26b884f31901ea9792ec75607289b456f48fa"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps",
+ "winapi",
]
[[package]]
name = "glib"
-version = "0.10.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01a6c19f992a95e76c09391ee85be09b2e1360a87f792f1f461824aa74133587"
+checksum = "f0028bbfd270d0778540294abca11141d59cb474da4c1f61ca1e11f579c49247"
dependencies = [
"bitflags",
"futures-channel",
"futures-core",
"futures-executor",
"futures-task",
- "futures-util",
"glib-macros",
"glib-sys",
"gobject-sys",
"libc",
- "once_cell 1.4.0",
+ "once_cell",
+ "smallvec",
]
[[package]]
name = "glib-macros"
-version = "0.10.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4585654c573f43122004f1ceab20c1bcfa31353431c54062ababf61efe7b5755"
+checksum = "9eb7bdf41972a6f6dab5d72c23d22789f400059a43ba0d72b4bb2f8664d946a9"
dependencies = [
"anyhow",
"heck",
- "itertools",
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
@@ -445,9 +388,9 @@ dependencies = [
[[package]]
name = "glib-sys"
-version = "0.10.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6cda4af5c2f4507b7a3535b798dca2135293f4bc3a17f399ce244ef15841c4c"
+checksum = "1c1d60554a212445e2a858e42a0e48cece1bd57b311a19a9468f70376cf554ae"
dependencies = [
"libc",
"system-deps",
@@ -455,9 +398,9 @@ dependencies = [
[[package]]
name = "gobject-sys"
-version = "0.10.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "952133b60c318a62bf82ee75b93acc7e84028a093e06b9e27981c2b6fe68218c"
+checksum = "aa92cae29759dae34ab5921d73fff5ad54b3d794ab842c117e36cafc7994c3f5"
dependencies = [
"glib-sys",
"libc",
@@ -466,37 +409,32 @@ dependencies = [
[[package]]
name = "gtk"
-version = "0.9.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3adf6adf7ba686d5e4f4dae32edfa12118af9469f67425f0afd075bf4a58ea9d"
+checksum = "10ae864e5eab8bc8b6b8544ed259eb02dd61b25323b20e777a77aa289c05fd0c"
dependencies = [
"atk",
"bitflags",
"cairo-rs",
- "cairo-sys-rs",
- "cc",
+ "field-offset",
+ "futures-channel",
"gdk",
"gdk-pixbuf",
- "gdk-pixbuf-sys",
- "gdk-sys",
"gio",
- "gio-sys",
"glib",
- "glib-sys",
- "gobject-sys",
"gtk-sys",
+ "gtk3-macros",
"libc",
- "once_cell 1.4.0",
+ "once_cell",
"pango",
- "pango-sys",
"pkg-config",
]
[[package]]
name = "gtk-sys"
-version = "0.10.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "89acda6f084863307d948ba64a4b1ef674e8527dddab147ee4cdcc194c880457"
+checksum = "8c14c8d3da0545785a7c5a120345b3abb534010fb8ae0f2ef3f47c027fba303e"
dependencies = [
"atk-sys",
"cairo-sys-rs",
@@ -510,38 +448,69 @@ dependencies = [
"system-deps",
]
+[[package]]
+name = "gtk3-macros"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "21de1da96dc117443fb03c2e270b2d34b7de98d0a79a19bbb689476173745b79"
+dependencies = [
+ "anyhow",
+ "heck",
+ "proc-macro-crate",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.11.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
+
[[package]]
name = "heck"
-version = "0.3.1"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
+checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "hermit-abi"
-version = "0.1.6"
+version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772"
+checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
+[[package]]
+name = "indexmap"
+version = "1.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
+dependencies = [
+ "autocfg",
+ "hashbrown",
+]
+
[[package]]
name = "itertools"
-version = "0.9.0"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
+checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
dependencies = [
"either",
]
[[package]]
name = "itoa"
-version = "0.4.5"
+version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e"
+checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
[[package]]
name = "lazy_static"
@@ -551,9 +520,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
-version = "0.2.66"
+version = "0.2.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
+checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6"
[[package]]
name = "libopenraw-rs"
@@ -581,24 +550,15 @@ dependencies = [
[[package]]
name = "linked-hash-map"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83"
-
-[[package]]
-name = "lock_api"
-version = "0.3.3"
+version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b"
-dependencies = [
- "scopeguard",
-]
+checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
[[package]]
name = "log"
-version = "0.4.8"
+version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
+checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
dependencies = [
"cfg-if",
]
@@ -619,16 +579,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]]
-name = "maybe-uninit"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
-
-[[package]]
-name = "memchr"
-version = "2.3.2"
+name = "memoffset"
+version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "53445de381a1f436797497c61d851644d0e8e88e6140f22872ad33a704933978"
+checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
+dependencies = [
+ "autocfg",
+]
[[package]]
name = "multimap"
@@ -657,7 +614,7 @@ dependencies = [
"libc",
"npc-engine",
"npc-fwk",
- "once_cell 0.2.4",
+ "once_cell",
]
[[package]]
@@ -699,16 +656,16 @@ dependencies = [
"libc",
"libopenraw-rs",
"multimap",
- "once_cell 0.2.4",
+ "once_cell",
"rexiv2",
"try_opt",
]
[[package]]
name = "num-integer"
-version = "0.1.42"
+version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
+checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
dependencies = [
"autocfg",
"num-traits",
@@ -716,9 +673,9 @@ dependencies = [
[[package]]
name = "num-rational"
-version = "0.2.3"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da4dc79f9e6c81bef96148c8f6b8e72ad4541caa4a24373e900a36da07de03a3"
+checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"
dependencies = [
"autocfg",
"num-integer",
@@ -727,48 +684,37 @@ dependencies = [
[[package]]
name = "num-traits"
-version = "0.2.11"
+version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
+checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
dependencies = [
"autocfg",
]
[[package]]
name = "once_cell"
-version = "0.2.4"
+version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d584f08c2d717d5c23a6414fc2822b71c651560713e54fa7eace675f758a355e"
-dependencies = [
- "parking_lot",
-]
-
-[[package]]
-name = "once_cell"
-version = "1.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d"
+checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
[[package]]
name = "pango"
-version = "0.9.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "460dbe5ad850c46780ba61f142e966beacf5eebb09822830f796c91d7d4fec31"
+checksum = "415823a4fb9f1789785cd6e2d2413816f2ecff92380382969aaca9c400e13a19"
dependencies = [
"bitflags",
"glib",
- "glib-sys",
- "gobject-sys",
"libc",
- "once_cell 1.4.0",
+ "once_cell",
"pango-sys",
]
[[package]]
name = "pango-sys"
-version = "0.10.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24d2650c8b62d116c020abd0cea26a4ed96526afda89b1c4ea567131fdefc890"
+checksum = "2367099ca5e761546ba1d501955079f097caa186bb53ce0f718dca99ac1942fe"
dependencies = [
"glib-sys",
"gobject-sys",
@@ -777,50 +723,19 @@ dependencies = [
]
[[package]]
-name = "parking_lot"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252"
-dependencies = [
- "lock_api",
- "parking_lot_core",
- "rustc_version",
-]
-
-[[package]]
-name = "parking_lot_core"
-version = "0.6.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b"
-dependencies = [
- "cfg-if",
- "cloudabi",
- "libc",
- "redox_syscall",
- "rustc_version",
- "smallvec",
- "winapi",
-]
-
-[[package]]
-name = "pin-project"
-version = "0.4.22"
+name = "pest"
+version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17"
+checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53"
dependencies = [
- "pin-project-internal",
+ "ucd-trie",
]
[[package]]
-name = "pin-project-internal"
-version = "0.4.22"
+name = "pin-project-lite"
+version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
+checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"
[[package]]
name = "pin-utils"
@@ -830,30 +745,31 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
-version = "0.3.17"
+version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
+checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
[[package]]
name = "ppv-lite86"
-version = "0.2.6"
+version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
+checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
[[package]]
name = "proc-macro-crate"
-version = "0.1.4"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e10d4b51f154c8a7fb96fd6dad097cb74b863943ec010ac94b9fd1be8861fe1e"
+checksum = "41fdbd1df62156fbc5945f4762632564d7d038153091c3fcf1067f6aef7cff92"
dependencies = [
+ "thiserror",
"toml",
]
[[package]]
name = "proc-macro-error"
-version = "1.0.3"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc175e9777c3116627248584e8f8b3e2987405cabe1c0adf7d1dd28f09dc7880"
+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
@@ -864,59 +780,39 @@ dependencies = [
[[package]]
name = "proc-macro-error-attr"
-version = "1.0.3"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3cc9795ca17eb581285ec44936da7fc2335a3f34f2ddd13118b6f4d515435c50"
+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
- "syn",
- "syn-mid",
"version_check",
]
-[[package]]
-name = "proc-macro-hack"
-version = "0.5.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "proc-macro-nested"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e"
-
[[package]]
name = "proc-macro2"
-version = "1.0.8"
+version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548"
+checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"
dependencies = [
"unicode-xid",
]
[[package]]
name = "quote"
-version = "1.0.2"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
+checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
-version = "0.7.3"
+version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
+checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
dependencies = [
- "getrandom",
"libc",
"rand_chacha",
"rand_core",
@@ -925,43 +821,46 @@ dependencies = [
[[package]]
name = "rand_chacha"
-version = "0.2.1"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853"
+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
- "c2-chacha",
+ "ppv-lite86",
"rand_core",
]
[[package]]
name = "rand_core"
-version = "0.5.1"
+version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
+checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
dependencies = [
"getrandom",
]
[[package]]
name = "rand_hc"
-version = "0.2.0"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
+checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
dependencies = [
"rand_core",
]
[[package]]
name = "redox_syscall"
-version = "0.1.56"
+version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
+checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee"
+dependencies = [
+ "bitflags",
+]
[[package]]
name = "remove_dir_all"
-version = "0.5.2"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"
+checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [
"winapi",
]
@@ -991,54 +890,51 @@ dependencies = [
[[package]]
name = "rustc_version"
-version = "0.2.3"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
+checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
dependencies = [
"semver",
]
[[package]]
name = "ryu"
-version = "1.0.2"
+version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8"
-
-[[package]]
-name = "scopeguard"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d"
+checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
[[package]]
name = "semver"
-version = "0.9.0"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
+checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
dependencies = [
"semver-parser",
]
[[package]]
name = "semver-parser"
-version = "0.7.0"
+version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
+checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
+dependencies = [
+ "pest",
+]
[[package]]
name = "serde"
-version = "1.0.104"
+version = "1.0.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449"
+checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.104"
+version = "1.0.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64"
+checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43"
dependencies = [
"proc-macro2",
"quote",
@@ -1047,9 +943,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.48"
+version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9371ade75d4c2d6cb154141b9752cf3781ec9c05e0e5cf35060e1e70ee7b9c25"
+checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
dependencies = [
"itoa",
"ryu",
@@ -1058,18 +954,15 @@ dependencies = [
[[package]]
name = "slab"
-version = "0.4.2"
+version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
+checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527"
[[package]]
name = "smallvec"
-version = "0.6.13"
+version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6"
-dependencies = [
- "maybe-uninit",
-]
+checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
[[package]]
name = "strsim"
@@ -1079,15 +972,15 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "strum"
-version = "0.18.0"
+version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b"
+checksum = "aaf86bbcfd1fa9670b7a129f64fc0c9fcbbfe4f1bc4210e9e98fe71ffc12cde2"
[[package]]
name = "strum_macros"
-version = "0.18.0"
+version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c"
+checksum = "d06aaeeee809dbc59eb4556183dd927df67db1540de5be8d3ec0b6636358a5ec"
dependencies = [
"heck",
"proc-macro2",
@@ -1097,33 +990,25 @@ dependencies = [
[[package]]
name = "syn"
-version = "1.0.14"
+version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5"
+checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
-[[package]]
-name = "syn-mid"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
[[package]]
name = "system-deps"
-version = "1.3.1"
+version = "3.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "80e452a47a990cc127ae1cbb7b687774b1bf5a497351a9f8ff488209e76295ed"
+checksum = "7ab7dbd121ce66af2176147a48c7e01aaf1f001837a18a7cf4317858606bbdf8"
dependencies = [
+ "anyhow",
+ "cfg-expr",
"heck",
+ "itertools",
"pkg-config",
"strum",
"strum_macros",
@@ -1134,9 +1019,9 @@ dependencies = [
[[package]]
name = "tempfile"
-version = "3.1.0"
+version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
+checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
dependencies = [
"cfg-if",
"libc",
@@ -1157,18 +1042,18 @@ dependencies = [
[[package]]
name = "thiserror"
-version = "1.0.20"
+version = "1.0.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08"
+checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.20"
+version = "1.0.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793"
+checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d"
dependencies = [
"proc-macro2",
"quote",
@@ -1177,20 +1062,19 @@ dependencies = [
[[package]]
name = "time"
-version = "0.1.42"
+version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
+checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
dependencies = [
"libc",
- "redox_syscall",
"winapi",
]
[[package]]
name = "toml"
-version = "0.5.6"
+version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
+checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
dependencies = [
"serde",
]
@@ -1201,59 +1085,65 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d30b71e7ba40551f9873f3ba9f4ee36f16015adf0962aba57caf403088370db1"
+[[package]]
+name = "ucd-trie"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
+
[[package]]
name = "unicode-segmentation"
-version = "1.6.0"
+version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
+checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
[[package]]
name = "unicode-width"
-version = "0.1.7"
+version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
+checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]]
name = "unicode-xid"
-version = "0.2.0"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
+checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "vcpkg"
-version = "0.2.8"
+version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168"
+checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "vec_map"
-version = "0.8.1"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
+checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version-compare"
-version = "0.0.10"
+version = "0.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1"
+checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b"
[[package]]
name = "version_check"
-version = "0.9.2"
+version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
+checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
[[package]]
name = "wasi"
-version = "0.9.0+wasi-snapshot-preview1"
+version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
+checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "winapi"
-version = "0.3.8"
+version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
diff --git a/crates/npc-engine/Cargo.toml b/crates/npc-engine/Cargo.toml
index a59658e..a865f42 100644
--- a/crates/npc-engine/Cargo.toml
+++ b/crates/npc-engine/Cargo.toml
@@ -22,4 +22,4 @@ try_opt = "0.1.1"
npc-fwk = { path = "../npc-fwk" }
[build-dependencies]
-cbindgen = { version = "0.13.1" }
+cbindgen = { version = "0.19.0" }
diff --git a/crates/npc-fwk/Cargo.toml b/crates/npc-fwk/Cargo.toml
index 88d0a4c..77a9aed 100644
--- a/crates/npc-fwk/Cargo.toml
+++ b/crates/npc-fwk/Cargo.toml
@@ -12,23 +12,23 @@ cairo-rs = "*"
chrono = "0.4.0"
exempi = { version = "2.6.0", git = "https://github.com/hfiguiere/exempi-rs.git", rev="99e8ba5" }
gio-sys = "*"
-gio = "^0.9.0"
+gio = "^0.14.0"
glib-sys = "*"
-glib = { version = "^0.10.0" }
+glib = "^0.14.0"
gtk-sys = "*"
-gdk = "^0.13.0"
+gdk = "^0.14.0"
gdk-pixbuf-sys = "*"
-gdk-pixbuf = { version = "0.9.0", features = [ "v2_32" ] }
-gtk = { version = "^0.9.0" }
+gdk-pixbuf = "^0.14.0"
+gtk = "^0.14.0"
lazy_static = "^1.2.0"
libc = "0.2.39"
libopenraw-rs = { path = "../../../libopenraw-rs/libopenraw-rs" }
# { git = "https://gitlab.freedesktop.org/libopenraw/libopenraw-rs.git", rev =
"edae9f8771fa4f4b577ef2e56d9dbd6f68d97105" }
multimap = "0.4.0"
-once_cell = "^0"
+once_cell = "1.8.0"
rexiv2 = "^0.7.0"
try_opt = "0.1.1"
[build-dependencies]
-cbindgen = { version = "0.13.1" }
+cbindgen = { version = "0.19.0" }
diff --git a/crates/npc-fwk/src/lib.rs b/crates/npc-fwk/src/lib.rs
index 4147819..74fa6e9 100644
--- a/crates/npc-fwk/src/lib.rs
+++ b/crates/npc-fwk/src/lib.rs
@@ -24,7 +24,6 @@ extern crate gdk_pixbuf;
extern crate gdk_pixbuf_sys;
extern crate gio;
extern crate gio_sys;
-#[macro_use]
extern crate glib;
extern crate glib_sys;
extern crate gtk;
diff --git a/crates/npc-fwk/src/toolkit/gdk_utils.rs b/crates/npc-fwk/src/toolkit/gdk_utils.rs
index 12cc8bc..a3859c1 100644
--- a/crates/npc-fwk/src/toolkit/gdk_utils.rs
+++ b/crates/npc-fwk/src/toolkit/gdk_utils.rs
@@ -30,8 +30,8 @@ pub fn gdkpixbuf_scale_to_fit(
dim: i32,
) -> Option<gdk_pixbuf::Pixbuf> {
pix.and_then(|pix| {
- let orig_h = pix.get_height();
- let orig_w = pix.get_width();
+ let orig_h = pix.height();
+ let orig_w = pix.width();
let orig_dim = cmp::max(orig_h, orig_w);
let ratio: f64 = dim as f64 / orig_dim as f64;
let width = ratio * orig_w as f64;
@@ -97,7 +97,7 @@ fn thumbnail_to_pixbuf(thumbnail: &or::Thumbnail, orientation: i32) -> Option<gd
if let Err(err) = loader.close() {
err_out!("loader close error: {}", err);
}
- loader.get_pixbuf()
+ loader.pixbuf()
}
_ => None,
};
diff --git a/crates/npc-fwk/src/toolkit/mimetype.rs b/crates/npc-fwk/src/toolkit/mimetype.rs
index ea6aa2a..f8fc292 100644
--- a/crates/npc-fwk/src/toolkit/mimetype.rs
+++ b/crates/npc-fwk/src/toolkit/mimetype.rs
@@ -57,10 +57,10 @@ pub fn guess_type(gmtype: &str) -> MType {
/// Guess the type from a file
fn guess_type_for_file<P: AsRef<Path>>(p: P) -> MType {
let path = p.as_ref();
- let file = gio::File::new_for_path(path);
+ let file = gio::File::for_path(path);
let cancellable: Option<&gio::Cancellable> = None;
if let Ok(fileinfo) = file.query_info("*", gio::FileQueryInfoFlags::NONE, cancellable) {
- if let Some(gmtype) = fileinfo.get_content_type() {
+ if let Some(gmtype) = fileinfo.content_type() {
let t = guess_type(&gmtype);
if t != MType::None {
return t;
diff --git a/crates/npc-fwk/src/toolkit/thumbnail.rs b/crates/npc-fwk/src/toolkit/thumbnail.rs
index f0f00ce..ea7123d 100644
--- a/crates/npc-fwk/src/toolkit/thumbnail.rs
+++ b/crates/npc-fwk/src/toolkit/thumbnail.rs
@@ -112,13 +112,12 @@ impl Thumbnail {
} else if mime_type.is_movie() {
// XXX FIXME
dbg_out!("video thumbnail");
- if let Some(mut cached) = glib::get_tmp_dir() {
- cached.push("temp-1234");
- if movieutils::thumbnail_movie(filename, w, h, &cached) {
- pix = gdk_pixbuf::Pixbuf::from_file_at_size(&cached, w, h).ok();
- if let Err(err) = fs::remove_file(&cached) {
- err_out!("Remove temporary file {:?} failed: {}", &cached, err);
- }
+ let mut cached = glib::tmp_dir();
+ cached.push("temp-1234");
+ if movieutils::thumbnail_movie(filename, w, h, &cached) {
+ pix = gdk_pixbuf::Pixbuf::from_file_at_size(&cached, w, h).ok();
+ if let Err(err) = fs::remove_file(&cached) {
+ err_out!("Remove temporary file {:?} failed: {}", &cached, err);
}
}
if pix.is_none() {
@@ -138,7 +137,7 @@ impl Thumbnail {
dbg_out!("trying raw loader");
pix = gdk_utils::openraw_extract_rotated_thumbnail(filename, cmp::min(w, h) as u32);
if let Some(ref pixbuf) = pix {
- if (w < pixbuf.get_width()) || (h < pixbuf.get_height()) {
+ if (w < pixbuf.width()) || (h < pixbuf.height()) {
pix = gdk_utils::gdkpixbuf_scale_to_fit(Some(pixbuf), cmp::min(w, h));
}
} else {
@@ -154,12 +153,12 @@ impl From<Option<gdk_pixbuf::Pixbuf>> for Thumbnail {
fn from(pixbuf: Option<gdk_pixbuf::Pixbuf>) -> Self {
if let Some(pixbuf) = pixbuf {
if let Some(bytes) = pixbuf.read_pixel_bytes() {
- let width = pixbuf.get_width();
- let height = pixbuf.get_height();
- let stride = pixbuf.get_rowstride();
- let bits_per_sample = pixbuf.get_bits_per_sample();
- let colorspace = pixbuf.get_colorspace();
- let has_alpha = pixbuf.get_has_alpha();
+ let width = pixbuf.width();
+ let height = pixbuf.height();
+ let stride = pixbuf.rowstride();
+ let bits_per_sample = pixbuf.bits_per_sample();
+ let colorspace = pixbuf.colorspace();
+ let has_alpha = pixbuf.has_alpha();
return Self {
width,
height,
diff --git a/crates/npc-fwk/src/toolkit/widgets/rating_label.rs
b/crates/npc-fwk/src/toolkit/widgets/rating_label.rs
index 23ebe43..7f445ab 100644
--- a/crates/npc-fwk/src/toolkit/widgets/rating_label.rs
+++ b/crates/npc-fwk/src/toolkit/widgets/rating_label.rs
@@ -22,10 +22,10 @@ use std::cell::Cell;
use gdk::prelude::*;
use gdk_pixbuf::Pixbuf;
-use glib::subclass;
+use glib;
use glib::subclass::prelude::*;
+use glib::subclass::Signal;
use glib::translate::*;
-use glib::Type;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
@@ -41,15 +41,10 @@ const PIXBUFS: Lazy<Pixbufs> = Lazy::new(|| Pixbufs {
unstar: Pixbuf::from_resource("/org/gnome/Niepce/pixmaps/niepce-unset-star.png").unwrap(),
});
-glib_wrapper! {
+glib::wrapper! {
pub struct RatingLabel(
- Object<subclass::simple::InstanceStruct<RatingLabelPriv>,
- subclass::simple::ClassStruct<RatingLabelPriv>, RatingLabelClass>)
+ ObjectSubclass<RatingLabelPriv>)
@extends gtk::DrawingArea, gtk::Widget;
-
- match fn {
- get_type => || RatingLabelPriv::get_type().to_glib(),
- }
}
pub struct RatingLabelPriv {
@@ -64,40 +59,16 @@ impl RatingLabelPriv {
fn set_rating(&self, rating: i32) {
self.rating.set(rating);
- let w = self.get_instance();
+ let w = self.instance();
w.queue_draw();
}
}
-static PROPERTIES: [subclass::Property; 1] = [subclass::Property("rating", |rating| {
- glib::ParamSpec::int(
- rating,
- "Rating",
- "The rating value",
- 0,
- 5,
- 0,
- glib::ParamFlags::READWRITE,
- )
-})];
-
+#[glib::object_subclass]
impl ObjectSubclass for RatingLabelPriv {
const NAME: &'static str = "RatingLabel";
+ type Type = RatingLabel;
type ParentType = gtk::DrawingArea;
- type Instance = subclass::simple::InstanceStruct<Self>;
- type Class = subclass::simple::ClassStruct<Self>;
-
- glib_object_subclass!();
-
- fn class_init(klass: &mut Self::Class) {
- klass.install_properties(&PROPERTIES);
- klass.add_signal(
- "rating-changed",
- glib::SignalFlags::RUN_LAST,
- &[Type::I32],
- Type::Unit,
- );
- }
fn new() -> Self {
Self {
@@ -108,17 +79,15 @@ impl ObjectSubclass for RatingLabelPriv {
}
impl ObjectImpl for RatingLabelPriv {
- glib_object_impl!();
-
- fn constructed(&self, obj: &glib::Object) {
+ fn constructed(&self, obj: &Self::Type) {
self.parent_constructed(obj);
- let widget = self.get_instance();
+ let widget = self.instance();
widget.connect_realize(|w| {
let priv_ = RatingLabelPriv::from_instance(w);
if priv_.editable.get() {
- if let Some(win) = w.get_window() {
- let mut mask = win.get_events();
+ if let Some(win) = w.window() {
+ let mut mask = win.events();
mask |= gdk::EventMask::BUTTON_PRESS_MASK;
win.set_events(mask);
}
@@ -126,13 +95,47 @@ impl ObjectImpl for RatingLabelPriv {
});
}
- fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
- let prop = &PROPERTIES[id];
+ fn signals() -> &'static [Signal] {
+ use once_cell::sync::Lazy;
+ static SIGNALS: Lazy<Vec<Signal>> = Lazy::new(|| {
+ vec![Signal::builder(
+ "rating-changed",
+ &[<i32>::static_type().into()],
+ <()>::static_type().into(),
+ )
+ .run_last()
+ .build()]
+ });
+ SIGNALS.as_ref()
+ }
+
+ fn properties() -> &'static [glib::ParamSpec] {
+ use once_cell::sync::Lazy;
+ static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
+ vec![glib::ParamSpec::new_int(
+ "rating",
+ "Rating",
+ "The rating value",
+ 0,
+ 5,
+ 0,
+ glib::ParamFlags::READWRITE,
+ )]
+ });
+ PROPERTIES.as_ref()
+ }
- match *prop {
- subclass::Property("rating", ..) => {
+ fn set_property(
+ &self,
+ _obj: &Self::Type,
+ _id: usize,
+ value: &glib::Value,
+ pspec: &glib::ParamSpec,
+ ) {
+ match pspec.name() {
+ "rating" => {
let rating = value
- .get_some()
+ .get()
.expect("type conformity checked by `Object::set_property`");
self.set_rating(rating);
}
@@ -140,11 +143,9 @@ impl ObjectImpl for RatingLabelPriv {
}
}
- fn get_property(&self, _obj: &glib::Object, id: usize) -> Result<glib::Value, ()> {
- let prop = &PROPERTIES[id];
-
- match *prop {
- subclass::Property("rating", ..) => Ok(self.rating.get().to_value()),
+ fn property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
+ match pspec.name() {
+ "rating" => self.rating.get().to_value(),
_ => unimplemented!(),
}
}
@@ -162,17 +163,17 @@ impl RatingLabelExt for RatingLabel {
}
impl RatingLabel {
- pub fn get_star() -> Pixbuf {
+ pub fn star() -> Pixbuf {
PIXBUFS.star.clone()
}
- pub fn get_unstar() -> Pixbuf {
+ pub fn unstar() -> Pixbuf {
PIXBUFS.unstar.clone()
}
- pub fn get_geometry() -> (i32, i32) {
- let star = Self::get_star();
- (star.get_width() * 5, star.get_height())
+ pub fn geometry() -> (i32, i32) {
+ let star = Self::star();
+ (star.width() * 5, star.height())
}
pub fn draw_rating(
@@ -185,8 +186,8 @@ impl RatingLabel {
) {
let rating = if rating == -1 { 0 } else { rating };
- let w = star.get_width();
- let h = star.get_height();
+ let w = star.width();
+ let h = star.height();
let mut y = y;
y -= h as f64;
let mut x = x;
@@ -202,15 +203,12 @@ impl RatingLabel {
}
pub fn rating_value_from_hit_x(x: f64) -> i32 {
- let width: f64 = Self::get_star().get_width().into();
+ let width: f64 = Self::star().width().into();
(x / width).round() as i32
}
pub fn new(rating: i32, editable: bool) -> Self {
- let obj: Self = glib::Object::new(Self::static_type(), &[])
- .expect("Failed to create RatingLabel")
- .downcast()
- .expect("Created RatingLabel is of the wrong type");
+ let obj: Self = glib::Object::new(&[]).expect("Failed to create RatingLabel");
let priv_ = RatingLabelPriv::from_instance(&obj);
priv_.set_editable(editable);
@@ -221,15 +219,18 @@ impl RatingLabel {
impl DrawingAreaImpl for RatingLabelPriv {}
impl WidgetImpl for RatingLabelPriv {
- fn button_press_event(&self, _widget: >k::Widget, event: &gdk::EventButton) -> Inhibit {
- if event.get_button() != 1 {
+ fn button_press_event(&self, _widget: &RatingLabel, event: &gdk::EventButton) -> Inhibit {
+ if event.button() != 1 {
Inhibit(false)
} else {
- if let Some((x, _)) = event.get_coords() {
+ if let Some((x, _)) = event.coords() {
let new_rating = RatingLabel::rating_value_from_hit_x(x);
if new_rating != self.rating.get() {
self.set_rating(new_rating);
- if let Err(err) = self.get_instance().emit("rating-changed", &[&new_rating]) {
+ if let Err(err) = self
+ .instance()
+ .emit_by_name("rating-changed", &[&new_rating])
+ {
err_out!("Emit signal 'rating-changed' failed: {}", err);
}
}
@@ -238,29 +239,22 @@ impl WidgetImpl for RatingLabelPriv {
}
}
- fn draw(&self, _widget: >k::Widget, cr: &cairo::Context) -> Inhibit {
- let star = RatingLabel::get_star();
+ fn draw(&self, _widget: &RatingLabel, cr: &cairo::Context) -> Inhibit {
+ let star = RatingLabel::star();
let x = 0_f64;
- let y = star.get_height() as f64;
- RatingLabel::draw_rating(
- cr,
- self.rating.get(),
- &star,
- &RatingLabel::get_unstar(),
- x,
- y,
- );
+ let y = star.height() as f64;
+ RatingLabel::draw_rating(cr, self.rating.get(), &star, &RatingLabel::unstar(), x, y);
Inhibit(true)
}
- fn get_preferred_width(&self, _widget: >k::Widget) -> (i32, i32) {
- let w = RatingLabel::get_star().get_width() * 5;
+ fn preferred_width(&self, _widget: &RatingLabel) -> (i32, i32) {
+ let w = RatingLabel::star().width() * 5;
(w, w)
}
- fn get_preferred_height(&self, _widget: >k::Widget) -> (i32, i32) {
- let h = RatingLabel::get_star().get_height();
+ fn preferred_height(&self, _widget: &RatingLabel) -> (i32, i32) {
+ let h = RatingLabel::star().height();
(h, h)
}
}
diff --git a/crates/npc-fwk/src/utils/files.rs b/crates/npc-fwk/src/utils/files.rs
index aa65698..f385c42 100644
--- a/crates/npc-fwk/src/utils/files.rs
+++ b/crates/npc-fwk/src/utils/files.rs
@@ -1,7 +1,7 @@
/*
* niepce - fwk/utils/files.rs
*
- * Copyright (C) 2018-2020 Hubert Figuière
+ * Copyright (C) 2018-2021 Hubert Figuière
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -37,8 +37,8 @@ impl FileList {
{
let mut l = FileList::default();
- let dir = gio::File::new_for_path(dir);
- let dir_path = dir.get_path();
+ let dir = gio::File::for_path(dir);
+ let dir_path = dir.path();
if dir_path.is_none() {
err_out!("Couldn't get dir path");
return l;
@@ -53,18 +53,16 @@ impl FileList {
continue;
}
let finfo = itr.unwrap();
- let ftype = finfo.get_file_type();
+ let ftype = finfo.file_type();
if ftype == gio::FileType::Regular || ftype == gio::FileType::SymbolicLink {
if !filter(&finfo) {
err_out!("Filtered out");
continue;
}
- if let Some(name) = finfo.get_name() {
- if let Some(fullname) = glib::build_filenamev(&[&dir_path, &name]) {
- dbg_out!("Found file {:?}", &fullname);
- l.0.push(fullname);
- }
- }
+ let name = finfo.name();
+ let fullname = glib::build_filenamev(&[&dir_path, &name]);
+ dbg_out!("Found file {:?}", &fullname);
+ l.0.push(fullname);
}
}
}
@@ -74,7 +72,7 @@ impl FileList {
}
pub fn file_is_media(fileinfo: &gio::FileInfo) -> bool {
- if let Some(gmtype) = fileinfo.get_content_type() {
+ if let Some(gmtype) = fileinfo.content_type() {
let t = guess_type(&gmtype);
return match t {
MType::Image(_) | MType::Movie => true,
diff --git a/niepce-main/Cargo.toml b/niepce-main/Cargo.toml
index 91f8f9d..646518b 100644
--- a/niepce-main/Cargo.toml
+++ b/niepce-main/Cargo.toml
@@ -5,7 +5,7 @@ authors = ["Hubert Figuière <hub figuiere net>"]
build = "build.rs"
[dependencies]
-once_cell = "^0"
+once_cell = "^1.8.0"
gettext-rs = "0.3.0"
glib = "*"
gio-sys = "*"
@@ -23,7 +23,7 @@ npc-fwk = { path = "../crates/npc-fwk" }
npc-engine = { path = "../crates/npc-engine" }
[build-dependencies]
-cbindgen = { version = "0.13.1" }
+cbindgen = { version = "0.19.0" }
[lib]
name = "niepce_rust"
diff --git a/niepce-main/build.rs b/niepce-main/build.rs
index 47f0151..883215e 100644
--- a/niepce-main/build.rs
+++ b/niepce-main/build.rs
@@ -37,6 +37,7 @@ fn main() {
.exclude_item("GtkCellRenderer")
.exclude_item("GtkWidget")
.exclude_item("GFileInfo")
+ .exclude_item("PortableChannel")
.with_crate(&crate_dir)
.generate()
.expect("Couldn't generate bindings")
diff --git a/niepce-main/src/niepce/ui/dialogs/requestnewfolder.rs
b/niepce-main/src/niepce/ui/dialogs/requestnewfolder.rs
index c00841b..e187f8f 100644
--- a/niepce-main/src/niepce/ui/dialogs/requestnewfolder.rs
+++ b/niepce-main/src/niepce/ui/dialogs/requestnewfolder.rs
@@ -1,7 +1,7 @@
/*
* niepce - niepce/ui/dialogs/requestnewfolder.rs
*
- * Copyright (C) 2017-2019 Hubert Figuière
+ * Copyright (C) 2017-2021 Hubert Figuière
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -41,16 +41,16 @@ pub unsafe extern "C" fn dialog_request_new_folder(
(&gettext("Cancel"), gtk::ResponseType::Cancel),
],
);
- let label = Label::with_mnemonic(Some(gettext("Folder _name:").as_str()));
- dialog.get_content_area().pack_start(&label, true, false, 4);
+ let label = Label::with_mnemonic(gettext("Folder _name:").as_str());
+ dialog.content_area().pack_start(&label, true, false, 4);
let entry = Entry::new();
entry.set_text("foobar");
entry.add_mnemonic_label(&label);
- dialog.get_content_area().pack_end(&entry, true, false, 4);
+ dialog.content_area().pack_end(&entry, true, false, 4);
- dialog.get_content_area().show_all();
+ dialog.content_area().show_all();
let cancel = dialog.run() != gtk::ResponseType::Ok;
- let folder_name = entry.get_text();
+ let folder_name = entry.text();
dialog.destroy();
if !cancel {
client
diff --git a/niepce-main/src/niepce/ui/image_grid_view.rs b/niepce-main/src/niepce/ui/image_grid_view.rs
index cb73f13..3cfa866 100644
--- a/niepce-main/src/niepce/ui/image_grid_view.rs
+++ b/niepce-main/src/niepce/ui/image_grid_view.rs
@@ -1,7 +1,7 @@
/*
* niepce - niepce/ui/image_grid_view.rs
*
- * Copyright (C) 2020 Hubert Figuière
+ * Copyright (C) 2020-2021 Hubert Figuière
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-use glib::subclass;
use glib::subclass::prelude::*;
use glib::translate::*;
use gtk;
@@ -28,42 +27,25 @@ use gtk::subclass::widget::WidgetImplExt;
use super::library_cell_renderer::LibraryCellRenderer;
use npc_fwk::toolkit::clickable_cell_renderer::ClickableCellRenderer;
-glib_wrapper! {
+glib::wrapper! {
pub struct ImageGridView(
- Object<subclass::simple::InstanceStruct<ImageGridViewPriv>,
- subclass::simple::ClassStruct<ImageGridViewPriv>,
- ImageGridViewClass>)
+ ObjectSubclass<ImageGridViewPriv>)
@extends gtk::IconView, gtk::Container, gtk::Widget;
-
- match fn {
- get_type => || ImageGridViewPriv::get_type().to_glib(),
- }
}
impl ImageGridView {
pub fn new(store: >k::TreeModel) -> Self {
- glib::Object::new(Self::static_type(), &[("model", store)])
- .expect("Failed to create ImageGridView")
- .downcast()
- .expect("Created ImageGridView is of the wrong type")
+ glib::Object::new(&[("model", store)]).expect("Failed to create ImageGridView")
}
}
pub struct ImageGridViewPriv {}
-static PROPERTIES: [subclass::Property; 0] = [];
-
+#[glib::object_subclass]
impl ObjectSubclass for ImageGridViewPriv {
const NAME: &'static str = "ImageGridView";
+ type Type = ImageGridView;
type ParentType = gtk::IconView;
- type Instance = subclass::simple::InstanceStruct<Self>;
- type Class = subclass::simple::ClassStruct<Self>;
-
- glib_object_subclass!();
-
- fn class_init(klass: &mut Self::Class) {
- klass.install_properties(&PROPERTIES);
- }
fn new() -> Self {
Self {}
@@ -71,23 +53,19 @@ impl ObjectSubclass for ImageGridViewPriv {
}
impl ObjectImpl for ImageGridViewPriv {
- glib_object_impl!();
-
- fn constructed(&self, obj: &glib::Object) {
+ fn constructed(&self, obj: &ImageGridView) {
self.parent_constructed(obj);
}
}
impl WidgetImpl for ImageGridViewPriv {
- fn button_press_event(&self, widget: >k::Widget, event: &gdk::EventButton) -> gtk::Inhibit {
+ fn button_press_event(&self, widget: &ImageGridView, event: &gdk::EventButton) -> gtk::Inhibit {
let r = self.parent_button_press_event(widget, event);
- if let Some((x, y)) = event.get_coords() {
- if let Some(iconview) = widget.downcast_ref::<gtk::IconView>() {
- if let Some((_, cell)) = iconview.get_item_at_pos(x as i32, y as i32) {
- if let Ok(mut cell) = cell.downcast::<LibraryCellRenderer>() {
- cell.hit(x as i32, y as i32);
- }
+ if let Some((x, y)) = event.coords() {
+ if let Some((_, cell)) = widget.item_at_pos(x as i32, y as i32) {
+ if let Ok(mut cell) = cell.downcast::<LibraryCellRenderer>() {
+ cell.hit(x as i32, y as i32);
}
}
}
diff --git a/niepce-main/src/niepce/ui/image_list_store.rs b/niepce-main/src/niepce/ui/image_list_store.rs
index 41f0462..fcdd816 100644
--- a/niepce-main/src/niepce/ui/image_list_store.rs
+++ b/niepce-main/src/niepce/ui/image_list_store.rs
@@ -25,7 +25,6 @@ use gdk_pixbuf_sys;
use glib::translate::*;
use gtk;
use gtk::prelude::*;
-use gtk::subclass::prelude::*;
use gtk_sys;
use once_cell::unsync::OnceCell;
@@ -66,7 +65,7 @@ impl ImageListStore {
pub fn new() -> Self {
let col_types: [glib::Type; 4] = [
gdk_pixbuf::Pixbuf::static_type(),
- StoreLibFile::get_type(),
+ StoreLibFile::static_type(),
gdk_pixbuf::Pixbuf::static_type(),
glib::Type::I32,
];
@@ -85,7 +84,7 @@ impl ImageListStore {
fn get_loading_icon(&self) -> Option<&gdk_pixbuf::Pixbuf> {
self.image_loading_icon
.get_or_init(|| {
- if let Some(theme) = gtk::IconTheme::get_default() {
+ if let Some(theme) = gtk::IconTheme::default() {
if let Ok(icon) =
theme.load_icon("image-loading", 32, gtk::IconLookupFlags::USE_BUILTIN)
{
@@ -204,10 +203,12 @@ impl ImageListStore {
let pixbuf = t.pix.make_pixbuf();
self.store.set(
iter,
- &[ColIndex::Thumb as u32, ColIndex::StripThumb as u32],
&[
- &pixbuf,
- &gdk_utils::gdkpixbuf_scale_to_fit(pixbuf.as_ref(), 100),
+ (ColIndex::Thumb as u32, &pixbuf),
+ (
+ ColIndex::StripThumb as u32,
+ &gdk_utils::gdkpixbuf_scale_to_fit(pixbuf.as_ref(), 100),
+ ),
],
);
}
@@ -218,10 +219,10 @@ impl ImageListStore {
}
pub fn get_file_id_at_path(&self, path: >k::TreePath) -> LibraryId {
- if let Some(iter) = self.store.get_iter(&path) {
- if let Ok(Some(libfile)) = self
+ if let Some(iter) = self.store.iter(&path) {
+ if let Ok(libfile) = self
.store
- .get_value(&iter, ColIndex::File as i32)
+ .value(&iter, ColIndex::File as i32)
.get::<&StoreLibFile>()
{
return libfile.0.id();
@@ -232,15 +233,14 @@ impl ImageListStore {
pub fn get_file(&self, id: LibraryId) -> Option<LibFile> {
if let Some(iter) = self.idmap.get(&id) {
- if let Ok(libfile) = self
- .store
- .get_value(&iter, ColIndex::File as i32)
+ self.store
+ .value(&iter, ColIndex::File as i32)
.get::<&StoreLibFile>()
- {
- return libfile.map(|v| v.0.clone());
- }
+ .map(|v| v.0.clone())
+ .ok()
+ } else {
+ None
}
- None
}
pub fn add_row(
@@ -252,16 +252,14 @@ impl ImageListStore {
) -> gtk::TreeIter {
let iter = self.store.append();
let store_libfile = StoreLibFile(file.clone());
- let indices: [u32; 4] = [
- ColIndex::Thumb as u32,
- ColIndex::File as u32,
- ColIndex::StripThumb as u32,
- ColIndex::FileStatus as u32,
- ];
self.store.set(
&iter,
- &indices,
- &[&thumb, &store_libfile, &strip_thumb, &(status as i32)],
+ &[
+ (ColIndex::Thumb as u32, &thumb),
+ (ColIndex::File as u32, &store_libfile),
+ (ColIndex::StripThumb as u32, &strip_thumb),
+ (ColIndex::FileStatus as u32, &(status as i32)),
+ ],
);
iter
}
@@ -269,16 +267,21 @@ impl ImageListStore {
pub fn set_thumbnail(&mut self, id: LibraryId, thumb: &gdk_pixbuf::Pixbuf) {
if let Some(iter) = self.idmap.get(&id) {
let strip_thumb = gdk_utils::gdkpixbuf_scale_to_fit(Some(thumb), 100);
- let indices: [u32; 2] = [ColIndex::Thumb as u32, ColIndex::StripThumb as u32];
assert!(thumb.ref_count() > 0);
- self.store.set(iter, &indices, &[thumb, &strip_thumb]);
+ self.store.set(
+ iter,
+ &[
+ (ColIndex::Thumb as u32, thumb),
+ (ColIndex::StripThumb as u32, &strip_thumb),
+ ],
+ );
}
}
pub fn set_property(&self, iter: >k::TreeIter, change: &MetadataChange) {
- if let Ok(Some(libfile)) = self
+ if let Ok(libfile) = self
.store
- .get_value(&iter, ColIndex::File as i32)
+ .value(&iter, ColIndex::File as i32)
.get::<&StoreLibFile>()
{
assert!(libfile.0.id() == change.id);
diff --git a/niepce-main/src/niepce/ui/library_cell_renderer.rs
b/niepce-main/src/niepce/ui/library_cell_renderer.rs
index fbe6329..c964146 100644
--- a/niepce-main/src/niepce/ui/library_cell_renderer.rs
+++ b/niepce-main/src/niepce/ui/library_cell_renderer.rs
@@ -1,7 +1,7 @@
/*
* niepce - niepce/ui/library_cell_renderer.rs
*
- * Copyright (C) 2020 Hubert Figuière
+ * Copyright (C) 2020-2021 Hubert Figuière
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,14 +26,12 @@ use cairo;
use gdk;
use gdk::prelude::*;
use gdk_pixbuf::Pixbuf;
-use glib::subclass;
use glib::subclass::prelude::*;
+use glib::subclass::Signal;
use glib::translate::*;
-use glib::Type;
use gtk;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
-use gtk::CellRendererPixbufClass;
use crate::niepce::ui::image_list_store::StoreLibFile;
use npc_engine::db::libfile::{FileStatus, FileType};
@@ -65,16 +63,10 @@ const EMBLEMS: Lazy<Emblems> = Lazy::new(|| Emblems {
flag_pick: Pixbuf::from_resource("/org/gnome/Niepce/pixmaps/niepce-flag-pick.png").unwrap(),
});
-glib_wrapper! {
+glib::wrapper! {
pub struct LibraryCellRenderer(
- Object<subclass::simple::InstanceStruct<LibraryCellRendererPriv>,
- subclass::simple::ClassStruct<LibraryCellRendererPriv>,
- LibraryCellRendererClass>)
+ ObjectSubclass<LibraryCellRendererPriv>)
@extends gtk::CellRendererPixbuf, gtk::CellRenderer;
-
- match fn {
- get_type => || LibraryCellRendererPriv::get_type().to_glib(),
- }
}
impl LibraryCellRenderer {
@@ -82,13 +74,8 @@ impl LibraryCellRenderer {
/// callback: an optional callback used to get a colour for labels.
/// callback_data: raw pointer passed as is to the callback.
pub fn new(callback: Option<GetColourCallback>, callback_data: *const c_void) -> Self {
- let obj: Self = glib::Object::new(
- Self::static_type(),
- &[("mode", >k::CellRendererMode::Activatable)],
- )
- .expect("Failed to create Library Cell Renderer")
- .downcast()
- .expect("Created Library Cell Renderer is of wrong type");
+ let obj: Self = glib::Object::new(&[("mode", >k::CellRendererMode::Activatable)])
+ .expect("Failed to create Library Cell Renderer");
if callback.is_some() {
let priv_ = LibraryCellRendererPriv::from_instance(&obj);
@@ -232,8 +219,8 @@ impl LibraryCellRendererPriv {
}
fn do_draw_thumbnail(&self, cr: &cairo::Context, pixbuf: &Pixbuf, r: &gdk::Rectangle) {
- let w = pixbuf.get_width();
- let h = pixbuf.get_height();
+ let w = pixbuf.width();
+ let h = pixbuf.height();
let offset_x = (self.size.get() - w) / 2;
let offset_y = (self.size.get() - h) / 2;
let x: f64 = (r.x + self.pad.get() + offset_x).into();
@@ -257,7 +244,7 @@ impl LibraryCellRendererPriv {
_ => return,
};
- let w = pixbuf.get_width();
+ let w = pixbuf.width();
let x: f64 = (r.x + r.width - CELL_PADDING - w).into();
let y: f64 = (r.y + CELL_PADDING).into();
cr.set_source_pixbuf(&pixbuf, x, y);
@@ -275,8 +262,8 @@ impl LibraryCellRendererPriv {
}
fn do_draw_format_emblem(cr: &cairo::Context, emblem: &Pixbuf, r: &gdk::Rectangle) -> i32 {
- let w = emblem.get_width();
- let h = emblem.get_height();
+ let w = emblem.width();
+ let h = emblem.height();
let left = CELL_PADDING + w;
let x: f64 = (r.x + r.width - left).into();
let y: f64 = (r.y + r.height - CELL_PADDING - h).into();
@@ -312,46 +299,11 @@ impl LibraryCellRendererPriv {
}
}
-static PROPERTIES: [subclass::Property; 2] = [
- subclass::Property("libfile", |libfile| {
- glib::ParamSpec::boxed(
- libfile,
- "Library File",
- "File from the library in the cell",
- StoreLibFile::get_type(),
- glib::ParamFlags::READWRITE,
- )
- }),
- subclass::Property("status", |status| {
- glib::ParamSpec::int(
- status,
- "File Status",
- "Status of the file in the cell",
- FileStatus::Ok as i32,
- FileStatus::Missing as i32,
- FileStatus::Ok as i32,
- glib::ParamFlags::READWRITE,
- )
- }),
-];
-
+#[glib::object_subclass]
impl ObjectSubclass for LibraryCellRendererPriv {
const NAME: &'static str = "LibraryCellRenderer";
+ type Type = LibraryCellRenderer;
type ParentType = gtk::CellRendererPixbuf;
- type Instance = subclass::simple::InstanceStruct<Self>;
- type Class = subclass::simple::ClassStruct<Self>;
-
- glib_object_subclass!();
-
- fn class_init(klass: &mut Self::Class) {
- klass.install_properties(&PROPERTIES);
- klass.add_signal(
- "rating-changed",
- glib::SignalFlags::RUN_LAST,
- &[Type::I64, Type::I32],
- Type::Unit,
- );
- }
fn new() -> Self {
Self {
@@ -373,25 +325,66 @@ impl ObjectSubclass for LibraryCellRendererPriv {
}
impl ObjectImpl for LibraryCellRendererPriv {
- glib_object_impl!();
-
- fn constructed(&self, obj: &glib::Object) {
+ fn constructed(&self, obj: &LibraryCellRenderer) {
self.parent_constructed(obj);
}
- fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
- let prop = &PROPERTIES[id];
- match *prop {
- subclass::Property("libfile", ..) => {
- let libfile = value
- .get::<&StoreLibFile>()
- .expect("type conformity checked by `Object::set_property`")
- .map(|f| f.clone());
+ fn properties() -> &'static [glib::ParamSpec] {
+ use once_cell::sync::Lazy;
+ static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
+ vec![
+ glib::ParamSpec::new_boxed(
+ "libfile",
+ "Library File",
+ "File from the library in the cell",
+ StoreLibFile::static_type(),
+ glib::ParamFlags::READWRITE,
+ ),
+ glib::ParamSpec::new_int(
+ "status",
+ "File Status",
+ "Status of the file in the cell",
+ FileStatus::Ok as i32,
+ FileStatus::Missing as i32,
+ FileStatus::Ok as i32,
+ glib::ParamFlags::READWRITE,
+ ),
+ ]
+ });
+
+ PROPERTIES.as_ref()
+ }
+
+ fn signals() -> &'static [Signal] {
+ use once_cell::sync::Lazy;
+ static SIGNALS: Lazy<Vec<Signal>> = Lazy::new(|| {
+ vec![Signal::builder(
+ "rating-changed",
+ &[<i64>::static_type().into(), <i32>::static_type().into()],
+ <()>::static_type().into(),
+ )
+ .run_last()
+ .build()]
+ });
+
+ SIGNALS.as_ref()
+ }
+
+ fn set_property(
+ &self,
+ _obj: &LibraryCellRenderer,
+ _id: usize,
+ value: &glib::Value,
+ pspec: &glib::ParamSpec,
+ ) {
+ match pspec.name() {
+ "libfile" => {
+ let libfile = value.get::<&StoreLibFile>().map(|f| f.clone()).ok();
self.set_libfile(libfile);
}
- subclass::Property("status", ..) => {
+ "status" => {
let status: i32 = value
- .get_some()
+ .get()
.expect("type conformity checked by `Object::set_property`");
self.set_status(FileStatus::from(status));
}
@@ -399,12 +392,15 @@ impl ObjectImpl for LibraryCellRendererPriv {
}
}
- fn get_property(&self, _obj: &glib::Object, id: usize) -> Result<glib::Value, ()> {
- let prop = &PROPERTIES[id];
-
- match *prop {
- subclass::Property("libfile", ..) => Ok(self.libfile.borrow().to_value()),
- subclass::Property("status", ..) => Ok((self.status.get() as i32).to_value()),
+ fn property(
+ &self,
+ _obj: &LibraryCellRenderer,
+ _id: usize,
+ pspec: &glib::ParamSpec,
+ ) -> glib::Value {
+ match pspec.name() {
+ "libfile" => self.libfile.borrow().to_value(),
+ "status" => (self.status.get() as i32).to_value(),
_ => unimplemented!(),
}
}
@@ -413,18 +409,18 @@ impl ObjectImpl for LibraryCellRendererPriv {
impl CellRendererPixbufImpl for LibraryCellRendererPriv {}
impl CellRendererImpl for LibraryCellRendererPriv {
- fn get_preferred_width<P: IsA<gtk::Widget>>(
+ fn preferred_width<P: IsA<gtk::Widget>>(
&self,
- _renderer: >k::CellRenderer,
+ _renderer: &LibraryCellRenderer,
_widget: &P,
) -> (i32, i32) {
let maxdim: i32 = self.size.get() + self.pad.get() * 2;
(maxdim, maxdim)
}
- fn get_preferred_height<P: IsA<gtk::Widget>>(
+ fn preferred_height<P: IsA<gtk::Widget>>(
&self,
- _renderer: >k::CellRenderer,
+ _renderer: &LibraryCellRenderer,
_widget: &P,
) -> (i32, i32) {
let maxdim: i32 = self.size.get() + self.pad.get() * 2;
@@ -433,16 +429,16 @@ impl CellRendererImpl for LibraryCellRendererPriv {
fn render<P: IsA<gtk::Widget>>(
&self,
- _renderer: >k::CellRenderer,
+ _renderer: &LibraryCellRenderer,
cr: &cairo::Context,
widget: &P,
_background_area: &gdk::Rectangle,
cell_area: &gdk::Rectangle,
flags: gtk::CellRendererState,
) {
- let self_ = self.get_instance();
- let xpad = self_.get_property_xpad();
- let ypad = self_.get_property_ypad();
+ let self_ = self.instance();
+ let xpad = self_.xpad();
+ let ypad = self_.ypad();
let mut r = cell_area.clone();
r.x += xpad as i32;
@@ -450,7 +446,7 @@ impl CellRendererImpl for LibraryCellRendererPriv {
let file = self.libfile.borrow();
- let style_context = widget.get_style_context();
+ let style_context = widget.style_context();
style_context.save();
style_context.set_state(if flags.contains(gtk::CellRendererState::SELECTED) {
@@ -479,7 +475,7 @@ impl CellRendererImpl for LibraryCellRendererPriv {
}
style_context.restore();
- if let Some(pixbuf) = self_.get_property_pixbuf() {
+ if let Some(pixbuf) = self_.pixbuf() {
self.do_draw_thumbnail(cr, &pixbuf, &r);
}
if self.draw_rating.get() {
@@ -492,8 +488,8 @@ impl CellRendererImpl for LibraryCellRendererPriv {
RatingLabel::draw_rating(
cr,
rating,
- &RatingLabel::get_star(),
- &RatingLabel::get_unstar(),
+ &RatingLabel::star(),
+ &RatingLabel::unstar(),
x,
y,
);
@@ -540,7 +536,7 @@ impl CellRendererImpl for LibraryCellRendererPriv {
fn activate<P: IsA<gtk::Widget>>(
&self,
- _renderer: >k::CellRenderer,
+ _renderer: &LibraryCellRenderer,
_event: Option<&gdk::Event>,
_widget: &P,
_path: &str,
@@ -548,22 +544,19 @@ impl CellRendererImpl for LibraryCellRendererPriv {
cell_area: &gdk::Rectangle,
_flags: gtk::CellRendererState,
) -> bool {
- let mut instance = self
- .get_instance()
- .downcast::<LibraryCellRenderer>()
- .unwrap();
+ let mut instance = self.instance().downcast::<LibraryCellRenderer>().unwrap();
if instance.is_hit() {
instance.reset_hit();
// hit test with the rating region
- let xpad = instance.get_property_xpad();
- let ypad = instance.get_property_ypad();
+ let xpad = instance.xpad();
+ let ypad = instance.ypad();
let mut r = cell_area.clone();
r.x += xpad as i32;
r.y += ypad as i32;
- let (rw, rh) = RatingLabel::get_geometry();
+ let (rw, rh) = RatingLabel::geometry();
let rect = gdk::Rectangle {
x: r.x + CELL_PADDING,
y: r.y + r.height - rh - CELL_PADDING,
@@ -598,7 +591,9 @@ impl CellRendererImpl for LibraryCellRendererPriv {
if let Some(f) = &*file {
if f.0.rating() != new_rating {
// emit signal if changed
- if let Err(err) = instance.emit("rating-changed", &[&f.0.id(), &new_rating]) {
+ if let Err(err) =
+ instance.emit_by_name("rating-changed", &[&f.0.id(), &new_rating])
+ {
err_out!("Can't emit rating-changed signal: {}", err);
}
}
@@ -613,14 +608,6 @@ impl CellRendererImpl for LibraryCellRendererPriv {
// allow subclassing this
pub trait LibraryCellRendererImpl: CellRendererPixbufImpl + 'static {}
-unsafe impl<T: ObjectSubclass + LibraryCellRendererImpl> IsSubclassable<T>
- for LibraryCellRendererClass
-{
- fn override_vfuncs(&mut self) {
- <CellRendererPixbufClass as IsSubclassable<T>>::override_vfuncs(self);
- }
-}
-
#[no_mangle]
pub unsafe extern "C" fn npc_library_cell_renderer_new(
get_colour: Option<unsafe extern "C" fn(i32, *mut RgbColour, *const c_void) -> bool>,
diff --git a/niepce-main/src/niepce/ui/thumb_nav.rs b/niepce-main/src/niepce/ui/thumb_nav.rs
index 5a8c5fc..e467874 100644
--- a/niepce-main/src/niepce/ui/thumb_nav.rs
+++ b/niepce-main/src/niepce/ui/thumb_nav.rs
@@ -1,7 +1,7 @@
/*
* niepce - niepce/ui/thumb_nav.rs
*
- * Copyright (C) 2020 Hubert Figuière
+ * Copyright (C) 2020-2021 Hubert Figuière
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,7 +22,6 @@ use std::rc::Rc;
use once_cell::unsync::OnceCell;
-use glib::subclass;
use glib::subclass::prelude::*;
use glib::translate::*;
use gtk;
@@ -31,7 +30,7 @@ use gtk::subclass::prelude::*;
const SCROLL_INC: f64 = 1.;
const SCROLL_MOVE: f64 = 20.;
-const SCROLL_TIMEOUT: u32 = 20;
+const SCROLL_TIMEOUT: std::time::Duration = std::time::Duration::from_millis(20);
#[repr(i32)]
#[derive(Clone, Copy, PartialEq)]
@@ -67,34 +66,23 @@ impl From<i32> for ThumbNavMode {
}
}
-glib_wrapper! {
+glib::wrapper! {
pub struct ThumbNav(
- Object<subclass::simple::InstanceStruct<ThumbNavPriv>,
- subclass::simple::ClassStruct<ThumbNavPriv>,
- ThumbNavClass>)
+ ObjectSubclass<ThumbNavPriv>)
@extends gtk::Box, gtk::Container, gtk::Widget;
-
- match fn {
- get_type => || ThumbNavPriv::get_type().to_glib(),
- }
}
impl ThumbNav {
pub fn new(thumbview: >k::IconView, mode: ThumbNavMode, show_buttons: bool) -> Self {
let mode_n: i32 = mode.into();
- glib::Object::new(
- Self::static_type(),
- &[
- ("mode", &mode_n),
- ("show-buttons", &show_buttons),
- ("thumbview", thumbview),
- ("homogeneous", &false),
- ("spacing", &0),
- ],
- )
+ glib::Object::new(&[
+ ("mode", &mode_n),
+ ("show-buttons", &show_buttons),
+ ("thumbview", thumbview),
+ ("homogeneous", &false),
+ ("spacing", &0),
+ ])
.expect("Failed to create Thumbnail Navigator")
- .downcast()
- .expect("Created Thumbnail Navigator is of wrong type")
}
}
@@ -116,17 +104,17 @@ pub struct ThumbNavPriv {
pub trait ThumbNavExt {
/// Get whether we show the left and right scroll buttons.
- fn get_show_buttons(&self) -> bool;
+ fn show_buttons(&self) -> bool;
/// Set whether we show the left and right scroll buttons.
fn set_show_buttons(&self, show_buttons: bool);
/// Get the navigation mode.
- fn get_mode(&self) -> ThumbNavMode;
+ fn mode(&self) -> ThumbNavMode;
/// Set the navigation mode.
fn set_mode(&self, mode: ThumbNavMode);
}
impl ThumbNavExt for ThumbNav {
- fn get_show_buttons(&self) -> bool {
+ fn show_buttons(&self) -> bool {
let priv_ = ThumbNavPriv::from_instance(self);
priv_.show_buttons.get()
}
@@ -136,7 +124,7 @@ impl ThumbNavExt for ThumbNav {
priv_.set_show_buttons(show_buttons);
}
- fn get_mode(&self) -> ThumbNavMode {
+ fn mode(&self) -> ThumbNavMode {
let priv_ = ThumbNavPriv::from_instance(self);
priv_.mode.get()
}
@@ -149,33 +137,33 @@ impl ThumbNavExt for ThumbNav {
impl ThumbNavPriv {
fn left_button_clicked(&self) {
- if let Some(adj) = self.widgets.get().unwrap().sw.get_hadjustment() {
+ if let Some(adj) = self.widgets.get().map(|w| w.sw.hadjustment()) {
let adj = Rc::new(adj);
let i = self.left_i.clone();
- gtk::timeout_add(SCROLL_TIMEOUT, move || ThumbNavPriv::scroll_left(&i, &adj));
+ glib::timeout_add_local(SCROLL_TIMEOUT, move || ThumbNavPriv::scroll_left(&i, &adj));
}
}
fn right_button_clicked(&self) {
- if let Some(adj) = self.widgets.get().unwrap().sw.get_hadjustment() {
+ if let Some(adj) = self.widgets.get().map(|w| w.sw.hadjustment()) {
let adj = Rc::new(adj);
let i = self.right_i.clone();
- gtk::timeout_add(SCROLL_TIMEOUT, move || ThumbNavPriv::scroll_right(&i, &adj));
+ glib::timeout_add_local(SCROLL_TIMEOUT, move || ThumbNavPriv::scroll_right(&i, &adj));
}
}
fn adj_changed(&self, adj: >k::Adjustment) {
if let Some(widgets) = self.widgets.get() {
- let upper = adj.get_upper();
- let page_size = adj.get_page_size();
+ let upper = adj.upper();
+ let page_size = adj.page_size();
widgets.button_right.set_sensitive(upper > page_size)
}
}
fn adj_value_changed(&self, adj: >k::Adjustment) {
- let upper = adj.get_upper();
- let page_size = adj.get_page_size();
- let value = adj.get_value();
+ let upper = adj.upper();
+ let page_size = adj.page_size();
+ let value = adj.value();
if let Some(w) = self.widgets.get() {
w.button_left.set_sensitive(value > 0.0);
@@ -184,12 +172,12 @@ impl ThumbNavPriv {
}
fn scroll_left(ref_i: &Cell<f64>, adj: >k::Adjustment) -> glib::Continue {
- let value = adj.get_value();
+ let value = adj.value();
let i = ref_i.get();
if i == SCROLL_MOVE || value - SCROLL_INC < 0.0 {
ref_i.set(0.0);
- if let Err(err) = adj.emit("value-changed", &[]) {
+ if let Err(err) = adj.emit_by_name("value-changed", &[]) {
err_out!("signal emit value-changed {}", err);
}
return Continue(false);
@@ -204,9 +192,9 @@ impl ThumbNavPriv {
}
fn scroll_right(ref_i: &Cell<f64>, adj: >k::Adjustment) -> glib::Continue {
- let upper = adj.get_upper();
- let page_size = adj.get_page_size();
- let value = adj.get_value();
+ let upper = adj.upper();
+ let page_size = adj.page_size();
+ let value = adj.value();
let i = ref_i.get();
if i == SCROLL_MOVE || value + SCROLL_INC > upper - page_size {
@@ -296,49 +284,11 @@ impl ThumbNavPriv {
}
}
-static PROPERTIES: [subclass::Property; 3] = [
- subclass::Property("show-buttons", |show_buttons| {
- glib::ParamSpec::boolean(
- show_buttons,
- "Show Buttons",
- "Whether to show navigation buttons or not",
- true, // Default value
- glib::ParamFlags::READWRITE,
- )
- }),
- subclass::Property("thumbview", |thumbview| {
- glib::ParamSpec::object(
- thumbview,
- "Thumbnail View",
- "The internal thumbnail viewer widget",
- gtk::IconView::static_type(),
- glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
- )
- }),
- subclass::Property("mode", |mode| {
- glib::ParamSpec::int(
- mode,
- "Mode",
- "Thumb navigator mode",
- ThumbNavMode::OneRow.into(),
- ThumbNavMode::MultipleRows.into(),
- ThumbNavMode::OneRow.into(),
- glib::ParamFlags::READWRITE,
- )
- }),
-];
-
+#[glib::object_subclass]
impl ObjectSubclass for ThumbNavPriv {
const NAME: &'static str = "NpcThumbNav";
+ type Type = ThumbNav;
type ParentType = gtk::Box;
- type Instance = subclass::simple::InstanceStruct<Self>;
- type Class = subclass::simple::ClassStruct<Self>;
-
- glib_object_subclass!();
-
- fn class_init(klass: &mut Self::Class) {
- klass.install_properties(&PROPERTIES);
- }
fn new() -> Self {
Self {
@@ -353,50 +303,45 @@ impl ObjectSubclass for ThumbNavPriv {
}
impl ObjectImpl for ThumbNavPriv {
- glib_object_impl!();
-
- fn constructed(&self, obj: &glib::Object) {
+ fn constructed(&self, obj: &ThumbNav) {
self.parent_constructed(obj);
- let self_ = obj.downcast_ref::<ThumbNav>().unwrap();
-
let button_left = gtk::Button::new();
button_left.set_relief(gtk::ReliefStyle::None);
let arrow = gtk::Image::from_icon_name(Some(&"pan-start-symbolic"), gtk::IconSize::Button);
button_left.add(&arrow);
button_left.set_size_request(20, 0);
- self_.pack_start(&button_left, false, false, 0);
- button_left.connect_clicked(clone!(@weak self_ => move |_| {
- let priv_ = ThumbNavPriv::from_instance(&self_);
+ obj.pack_start(&button_left, false, false, 0);
+ button_left.connect_clicked(clone!(@weak obj => move |_| {
+ let priv_ = ThumbNavPriv::from_instance(&obj);
priv_.left_button_clicked();
}));
let sw = gtk::ScrolledWindow::new(gtk::NONE_ADJUSTMENT, gtk::NONE_ADJUSTMENT);
sw.set_shadow_type(gtk::ShadowType::In);
sw.set_policy(gtk::PolicyType::Always, gtk::PolicyType::Never);
- if let Some(adj) = sw.get_hadjustment() {
- adj.connect_changed(clone!(@weak self_ => move |adj| {
- let priv_ = ThumbNavPriv::from_instance(&self_);
- priv_.adj_changed(adj);
- }));
- adj.connect_value_changed(clone!(@weak self_ => move |adj| {
- let priv_ = ThumbNavPriv::from_instance(&self_);
- priv_.adj_value_changed(adj);
- }));
- }
- self_.pack_start(&sw, true, true, 0);
+ let adj = sw.hadjustment();
+ adj.connect_changed(clone!(@weak obj => move |adj| {
+ let priv_ = ThumbNavPriv::from_instance(&obj);
+ priv_.adj_changed(adj);
+ }));
+ adj.connect_value_changed(clone!(@weak obj => move |adj| {
+ let priv_ = ThumbNavPriv::from_instance(&obj);
+ priv_.adj_value_changed(adj);
+ }));
+ obj.pack_start(&sw, true, true, 0);
let button_right = gtk::Button::new();
button_right.set_relief(gtk::ReliefStyle::None);
let arrow = gtk::Image::from_icon_name(Some(&"pan-end-symbolic"), gtk::IconSize::Button);
button_right.add(&arrow);
button_right.set_size_request(20, 0);
- self_.pack_start(&button_right, false, false, 0);
- button_right.connect_clicked(clone!(@weak self_ => move |_| {
- let priv_ = ThumbNavPriv::from_instance(&self_);
+ obj.pack_start(&button_right, false, false, 0);
+ button_right.connect_clicked(clone!(@weak obj => move |_| {
+ let priv_ = ThumbNavPriv::from_instance(&obj);
priv_.right_button_clicked();
}));
- let adj = sw.get_hadjustment();
+ let adj = sw.hadjustment();
if self
.widgets
@@ -410,37 +355,72 @@ impl ObjectImpl for ThumbNavPriv {
err_out!("Widgets already set.");
}
- if let Some(adj) = adj {
- // The value-changed signal might not be emitted because the value is already 0.
- // Ensure the state first.
- self.adj_value_changed(&adj);
- if let Err(err) = adj.emit("value-changed", &[]) {
- err_out!("ThumbNav::constructed: signal emit failed: {}", err);
- }
+ // The value-changed signal might not be emitted because the value is already 0.
+ // Ensure the state first.
+ self.adj_value_changed(&adj);
+ if let Err(err) = adj.emit_by_name("value-changed", &[]) {
+ err_out!("ThumbNav::constructed: signal emit failed: {}", err);
}
self.add_thumbview();
}
- fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
- let prop = &PROPERTIES[id];
- match *prop {
- subclass::Property("show-buttons", ..) => {
+ fn properties() -> &'static [glib::ParamSpec] {
+ use once_cell::sync::Lazy;
+ static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
+ vec![
+ glib::ParamSpec::new_boolean(
+ "show-buttons",
+ "Show Buttons",
+ "Whether to show navigation buttons or not",
+ true, // Default value
+ glib::ParamFlags::READWRITE,
+ ),
+ glib::ParamSpec::new_object(
+ "thumbview",
+ "Thumbnail View",
+ "The internal thumbnail viewer widget",
+ gtk::IconView::static_type(),
+ glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
+ ),
+ glib::ParamSpec::new_int(
+ "mode",
+ "Mode",
+ "Thumb navigator mode",
+ ThumbNavMode::OneRow.into(),
+ ThumbNavMode::MultipleRows.into(),
+ ThumbNavMode::OneRow.into(),
+ glib::ParamFlags::READWRITE,
+ ),
+ ]
+ });
+ PROPERTIES.as_ref()
+ }
+
+ fn set_property(
+ &self,
+ _obj: &ThumbNav,
+ _id: usize,
+ value: &glib::Value,
+ pspec: &glib::ParamSpec,
+ ) {
+ match pspec.name() {
+ "show-buttons" => {
let show_buttons = value
- .get_some()
+ .get()
.expect("type conformity checked by `Object::set_property`");
self.set_show_buttons(show_buttons);
}
- subclass::Property("thumbview", ..) => {
+ "thumbview" => {
let thumbview: Option<gtk::IconView> = value
.get()
.expect("type conformity checked by `Object::set_property`");
self.thumbview.replace(thumbview);
self.add_thumbview();
}
- subclass::Property("mode", ..) => {
+ "mode" => {
let mode: i32 = value
- .get_some()
+ .get()
.expect("type conformity checked by `Object::set_property`");
self.set_mode(ThumbNavMode::from(mode));
}
@@ -448,15 +428,13 @@ impl ObjectImpl for ThumbNavPriv {
}
}
- fn get_property(&self, _obj: &glib::Object, id: usize) -> Result<glib::Value, ()> {
- let prop = &PROPERTIES[id];
-
- match *prop {
- subclass::Property("show-buttons", ..) => Ok(self.show_buttons.get().to_value()),
- subclass::Property("thumbview", ..) => Ok(self.thumbview.borrow().to_value()),
- subclass::Property("mode", ..) => {
+ fn property(&self, _obj: &ThumbNav, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
+ match pspec.name() {
+ "show-buttons" => self.show_buttons.get().to_value(),
+ "thumbview" => self.thumbview.borrow().to_value(),
+ "mode" => {
let n: i32 = self.mode.get().into();
- Ok(n.to_value())
+ n.to_value()
}
_ => unimplemented!(),
}
diff --git a/niepce-main/src/niepce/ui/thumb_strip_view.rs b/niepce-main/src/niepce/ui/thumb_strip_view.rs
index 38afcbb..c6c5546 100644
--- a/niepce-main/src/niepce/ui/thumb_strip_view.rs
+++ b/niepce-main/src/niepce/ui/thumb_strip_view.rs
@@ -1,7 +1,7 @@
/*
* niepce - niepce/ui/thumbstripview.rs
*
- * Copyright (C) 2020 Hubert Figuière
+ * Copyright (C) 2020-2021 Hubert Figuière
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,7 +22,6 @@ use std::rc::Rc;
use once_cell::unsync::OnceCell;
-use glib::subclass;
use glib::subclass::prelude::*;
use glib::translate::*;
use gtk;
@@ -42,34 +41,23 @@ pub enum ImageListStoreColIndex {
FileStatusIndex = 3,
}
-glib_wrapper! {
+glib::wrapper! {
pub struct ThumbStripView(
- Object<subclass::simple::InstanceStruct<ThumbStripViewPriv>,
- subclass::simple::ClassStruct<ThumbStripViewPriv>,
- ThumbStripViewClass>)
+ ObjectSubclass<ThumbStripViewPriv>)
@extends gtk::IconView, gtk::Container, gtk::Widget;
-
- match fn {
- get_type => || ThumbStripViewPriv::get_type().to_glib(),
- }
}
impl ThumbStripView {
pub fn new(store: >k::TreeModel) -> Self {
- glib::Object::new(
- Self::static_type(),
- &[
- ("model", store),
- ("item-height", &THUMB_STRIP_VIEW_DEFAULT_ITEM_HEIGHT),
- ("selection-mode", >k::SelectionMode::Multiple),
- ("column-spacing", &THUMB_STRIP_VIEW_SPACING),
- ("row-spacing", &THUMB_STRIP_VIEW_SPACING),
- ("margin", &0),
- ],
- )
+ glib::Object::new(&[
+ ("model", store),
+ ("item-height", &THUMB_STRIP_VIEW_DEFAULT_ITEM_HEIGHT),
+ ("selection-mode", >k::SelectionMode::Multiple),
+ ("column-spacing", &THUMB_STRIP_VIEW_SPACING),
+ ("row-spacing", &THUMB_STRIP_VIEW_SPACING),
+ ("margin", &0),
+ ])
.expect("Failed to create ThumbStripView")
- .downcast()
- .expect("Created ThumbStripView is of the wrong type")
}
}
@@ -88,12 +76,12 @@ impl ItemCount {
self.count.set(count);
}
- fn row_added(&self, view: >k::IconView) {
+ fn row_added(&self, view: &ThumbStripView) {
self.count.replace(self.count.get() + 1);
self.update(view);
}
- fn row_deleted(&self, view: >k::IconView) {
+ fn row_deleted(&self, view: &ThumbStripView) {
let count = self.count.get();
if count > 0 {
self.count.replace(count + 1);
@@ -101,7 +89,7 @@ impl ItemCount {
self.update(view);
}
- fn update(&self, view: >k::IconView) {
+ fn update(&self, view: &ThumbStripView) {
view.set_columns(self.count.get());
}
}
@@ -135,7 +123,7 @@ impl ThumbStripViewPriv {
fn set_item_height(&self, height: i32) {
self.item_height.set(height);
if let Some(renderer) = self.renderer.get() {
- renderer.set_property_height(height);
+ renderer.set_height(height);
}
}
@@ -152,13 +140,13 @@ impl ThumbStripViewPriv {
self.store.replace(model.clone());
self.setup_model();
- self.get_instance().set_model(model.as_ref());
+ ThumbStripViewExt::set_model(&self.instance(), model);
}
fn setup_model(&self) {
if let Some(store) = &*self.store.borrow() {
// model item count
- let iter = store.get_iter_first();
+ let iter = store.iter_first();
let count = if let Some(ref iter) = iter {
let mut c = 0;
while store.iter_next(iter) {
@@ -170,7 +158,7 @@ impl ThumbStripViewPriv {
};
self.item_count.set(count);
- let view = self.get_instance();
+ let view = self.instance();
// update item count
self.item_count.update(&view);
@@ -189,29 +177,11 @@ impl ThumbStripViewPriv {
}
}
-static PROPERTIES: [subclass::Property; 1] = [subclass::Property("item-height", |item_height| {
- glib::ParamSpec::int(
- item_height,
- "Item Height",
- "The Item Height",
- -1,
- 100,
- THUMB_STRIP_VIEW_DEFAULT_ITEM_HEIGHT, // Default value
- glib::ParamFlags::READWRITE,
- )
-})];
-
+#[glib::object_subclass]
impl ObjectSubclass for ThumbStripViewPriv {
const NAME: &'static str = "ThumbStripView";
+ type Type = ThumbStripView;
type ParentType = gtk::IconView;
- type Instance = subclass::simple::InstanceStruct<Self>;
- type Class = subclass::simple::ClassStruct<Self>;
-
- glib_object_subclass!();
-
- fn class_init(klass: &mut Self::Class) {
- klass.install_properties(&PROPERTIES);
- }
fn new() -> Self {
Self {
@@ -227,20 +197,16 @@ impl ObjectSubclass for ThumbStripViewPriv {
}
impl ObjectImpl for ThumbStripViewPriv {
- glib_object_impl!();
-
- fn constructed(&self, obj: &glib::Object) {
+ fn constructed(&self, obj: &Self::Type) {
self.parent_constructed(obj);
- let self_ = obj.downcast_ref::<ThumbStripView>().unwrap();
-
let cell_renderer = LibraryCellRenderer::new_thumb_renderer();
- let icon_view_self = self_.clone().upcast::<gtk::IconView>();
+ let icon_view_self = obj.clone().upcast::<gtk::IconView>();
icon_view_self.pack_start(&cell_renderer, false);
- cell_renderer.set_property_height(100);
- cell_renderer.set_property_yalign(0.5);
- cell_renderer.set_property_xalign(0.5);
+ cell_renderer.set_height(100);
+ cell_renderer.set_yalign(0.5);
+ cell_renderer.set_xalign(0.5);
icon_view_self.add_attribute(
&cell_renderer,
@@ -260,18 +226,39 @@ impl ObjectImpl for ThumbStripViewPriv {
self.renderer
.set(cell_renderer)
.expect("ThumbStripView::constructed set cell render failed.");
- let model = icon_view_self.get_model();
+ let model = icon_view_self.model();
self.setup_model();
self.store.replace(model);
}
- fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) {
- let prop = &PROPERTIES[id];
- match *prop {
- subclass::Property("item-height", ..) => {
+ fn properties() -> &'static [glib::ParamSpec] {
+ use once_cell::sync::Lazy;
+ static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
+ vec![glib::ParamSpec::new_int(
+ "item-height",
+ "Item Height",
+ "The Item Height",
+ -1,
+ 100,
+ THUMB_STRIP_VIEW_DEFAULT_ITEM_HEIGHT, // Default value
+ glib::ParamFlags::READWRITE,
+ )]
+ });
+ PROPERTIES.as_ref()
+ }
+
+ fn set_property(
+ &self,
+ _obj: &ThumbStripView,
+ _id: usize,
+ value: &glib::Value,
+ pspec: &glib::ParamSpec,
+ ) {
+ match pspec.name() {
+ "item-height" => {
let height: i32 = value
- .get_some()
+ .get()
.expect("type conformity checked by `Object::set_property`");
self.set_item_height(height);
}
@@ -279,11 +266,9 @@ impl ObjectImpl for ThumbStripViewPriv {
}
}
- fn get_property(&self, _obj: &glib::Object, id: usize) -> Result<glib::Value, ()> {
- let prop = &PROPERTIES[id];
-
- match *prop {
- subclass::Property("item-height", ..) => Ok(self.item_height.get().to_value()),
+ fn property(&self, _obj: &ThumbStripView, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
+ match pspec.name() {
+ "item-height" => self.item_height.get().to_value(),
_ => unimplemented!(),
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]