Commit c4dce50a authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

Merge branch 'bilelmoussaoui/fixes' into 'master'

Cleanup in preparation of the next gtk-rs release Closes #47, #46, #21, and #44 See merge request GNOME/gnome-tour!60
parents 8992d346 0ba10569
......@@ -4,7 +4,7 @@ _build/
build-aux/app
build-aux/.flatpak-builder/
src/config.rs
src/static_resources.rs
*.ui.in~
*.ui~
.flatpak
.vscode
......@@ -26,7 +26,6 @@ rustfmt:
# Create blank versions of our configured files
# so rustfmt does not yell about non-existent files or completely empty files
- echo -e "" >> src/config.rs
- echo -e "" >> src/static_resources.rs
- rustc -Vv && cargo -Vv
- cargo fmt --version
- cargo fmt --all -- --color=always --check
......@@ -4,18 +4,18 @@ version = 3
[[package]]
name = "aho-corasick"
version = "0.7.15"
version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
dependencies = [
"memchr",
]
[[package]]
name = "anyhow"
version = "1.0.38"
version = "1.0.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1"
checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0"
[[package]]
name = "atty"
......@@ -36,9 +36,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "bitflags"
version = "1.2.1"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "block"
......@@ -48,9 +48,9 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
[[package]]
name = "cairo-rs"
version = "0.14.3"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f859ade407c19810ae920b4fafab92189ed312adad490d08fb16b5f49f1e2207"
checksum = "b869e97a87170f96762f9f178eae8c461147e722ba21dd8814105bf5716bf14a"
dependencies = [
"bitflags",
"cairo-sys-rs",
......@@ -61,29 +61,20 @@ dependencies = [
[[package]]
name = "cairo-sys-rs"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7c9c3928781e8a017ece15eace05230f04b647457d170d2d9641c94a444ff80"
checksum = "3c55d429bef56ac9172d25fecb85dc8068307d17acd74b377866b7a1ef25d3c8"
dependencies = [
"glib-sys",
"libc",
"system-deps 3.2.0",
"system-deps",
]
[[package]]
name = "cc"
version = "1.0.66"
version = "1.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
[[package]]
name = "cfg-expr"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b412e83326147c2bb881f8b40edfbf9905b9b8abaebd0e47ca190ba62fda8f0e"
dependencies = [
"smallvec",
]
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
[[package]]
name = "cfg-expr"
......@@ -101,12 +92,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "either"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
[[package]]
name = "env_logger"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
......@@ -131,24 +116,24 @@ dependencies = [
[[package]]
name = "futures-channel"
version = "0.3.12"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846"
checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b"
dependencies = [
"futures-core",
]
[[package]]
name = "futures-core"
version = "0.3.12"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65"
checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7"
[[package]]
name = "futures-executor"
version = "0.3.12"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9e59fdc009a4b3096bf94f740a0f2424c082521f20a9b08c5c07c48d90fd9b9"
checksum = "29d6d2ff5bb10fb95c85b8ce46538a2e5f5e7fdc755623a7d4529ab8a4ed9d2a"
dependencies = [
"futures-core",
"futures-task",
......@@ -157,24 +142,21 @@ dependencies = [
[[package]]
name = "futures-io"
version = "0.3.12"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28be053525281ad8259d47e4de5de657b25e7bac113458555bb4b70bc6870500"
checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2"
[[package]]
name = "futures-task"
version = "0.3.12"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86"
dependencies = [
"once_cell",
]
checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72"
[[package]]
name = "futures-util"
version = "0.3.12"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b"
checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164"
dependencies = [
"futures-core",
"futures-task",
......@@ -185,10 +167,11 @@ dependencies = [
[[package]]
name = "gdk-pixbuf"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "534192cb8f01daeb8fab2c8d4baa8f9aae5b7a39130525779f5c2608e235b10f"
checksum = "172dfe1d9dfb62936bf7ad3ede2913a1b21b1e3db56990e46e00789201de9070"
dependencies = [
"bitflags",
"gdk-pixbuf-sys",
"gio",
"glib",
......@@ -197,22 +180,22 @@ dependencies = [
[[package]]
name = "gdk-pixbuf-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f097c0704201fbc8f69c1762dc58c6947c8bb188b8ed0bc7e65259f1894fe590"
checksum = "413424d9818621fa3cfc8a3a915cdb89a7c3c507d56761b4ec83a9a98e587171"
dependencies = [
"gio-sys",
"glib-sys",
"gobject-sys",
"libc",
"system-deps 3.2.0",
"system-deps",
]
[[package]]
name = "gdk4"
version = "0.3.0"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c0f7f98ad25b81ac9462f74a091b0e4c0983ed1e74d19a38230c772b4dcef81"
checksum = "319c74160dbe3e29cc1bf36ae4a08b9072f352b751e9e3e5501b3aa3ca633f66"
dependencies = [
"bitflags",
"cairo-rs",
......@@ -226,37 +209,26 @@ dependencies = [
[[package]]
name = "gdk4-sys"
version = "0.3.0"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "262a79666b42e1884577f11a050439a964b95dec55343ac6ace7930e1415fa18"
checksum = "48a39e34abe35ee2cf54a1e29dd983accecd113ad30bdead5050418fa92f2a1b"
dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"graphene-sys",
"libc",
"pango-sys",
"system-deps 4.0.0",
]
[[package]]
name = "getrandom"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
dependencies = [
"cfg-if",
"libc",
"wasi",
"pkg-config",
"system-deps",
]
[[package]]
name = "gettext-rs"
version = "0.6.0"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3df4e7a9dc238dddd30f183d43e4f497990885daa211fcf01657159ade8f1610"
checksum = "e49ea8a8fad198aaa1f9655a2524b64b70eb06b2f3ff37da407566c93054f364"
dependencies = [
"gettext-sys",
"locale_config",
......@@ -264,19 +236,19 @@ dependencies = [
[[package]]
name = "gettext-sys"
version = "0.21.0"
version = "0.21.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "885d118016f633f99f741afe6c1433c040813a3cbc755cbfdf85f963e02fad80"
checksum = "afa9e06ab9e7514cc9ae668ea3b71ea1536259d767dff0289ac23ad134f99929"
dependencies = [
"cc",
"tempfile",
"temp-dir",
]
[[package]]
name = "gio"
version = "0.14.5"
version = "0.15.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81a4c12fcba7a6402ae843a0085ec16d3658a87901763b6a7f0a7c5d60e555a5"
checksum = "4f80391bd2ac4981a3433137691211775bbb37c5347f8cfb7c0980187e0300c5"
dependencies = [
"bitflags",
"futures-channel",
......@@ -291,22 +263,22 @@ dependencies = [
[[package]]
name = "gio-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0a41df66e57fcc287c4bcf74fc26b884f31901ea9792ec75607289b456f48fa"
checksum = "04b57719ccaacf2a0d9c79f151be629f3a3ef3991658ee2af0bb66287e4ea86c"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps 3.2.0",
"system-deps",
"winapi",
]
[[package]]
name = "glib"
version = "0.14.5"
version = "0.15.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4a930b7208e6e0ab839eea5f65ac2b82109f729621430d47fe905e2e09d33f4"
checksum = "4a703581e2538fe699c5476cf26b456d694c5272b6e999d3ab47711c5eaa2dd2"
dependencies = [
"bitflags",
"futures-channel",
......@@ -319,16 +291,17 @@ dependencies = [
"libc",
"once_cell",
"smallvec",
"thiserror",
]
[[package]]
name = "glib-macros"
version = "0.14.1"
version = "0.15.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aad66361f66796bfc73f530c51ef123970eb895ffba991a234fcf7bea89e518"
checksum = "e58b262ff65ef771003873cea8c10e0fe854f1c508d48d62a4111a1ff163f7d1"
dependencies = [
"anyhow",
"heck",
"heck 0.4.0",
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
......@@ -338,12 +311,12 @@ dependencies = [
[[package]]
name = "glib-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c1d60554a212445e2a858e42a0e48cece1bd57b311a19a9468f70376cf554ae"
checksum = "c668102c6e15e0a7f6b99b59f602c2e806967bb86414f617b77e19b1de5b3fac"
dependencies = [
"libc",
"system-deps 3.2.0",
"system-deps",
]
[[package]]
......@@ -351,8 +324,6 @@ name = "gnome-tour"
version = "40.0.0"
dependencies = [
"gettext-rs",
"gstreamer",
"gstreamer-player",
"gtk4",
"libadwaita",
"log",
......@@ -361,20 +332,20 @@ dependencies = [
[[package]]
name = "gobject-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa92cae29759dae34ab5921d73fff5ad54b3d794ab842c117e36cafc7994c3f5"
checksum = "6edb1f0b3e4c08e2a0a490d1082ba9e902cdff8ff07091e85c6caec60d17e2ab"
dependencies = [
"glib-sys",
"libc",
"system-deps 3.2.0",
"system-deps",
]
[[package]]
name = "graphene-rs"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1460a39f06e491e6112f27e71e51435c833ba370723224dd1743dfd1f201f19"
checksum = "7c54f9fbbeefdb62c99f892dfca35f83991e2cb5b46a8dc2a715e58612f85570"
dependencies = [
"glib",
"graphene-sys",
......@@ -383,21 +354,21 @@ dependencies = [
[[package]]
name = "graphene-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7d23fb7a9547e5f072a7e0cd49cd648fedeb786d122b106217511980cbb8962"
checksum = "03f311acb023cf7af5537f35de028e03706136eead7f25a31e8fd26f5011e0b3"
dependencies = [
"glib-sys",
"libc",
"pkg-config",
"system-deps 3.2.0",
"system-deps",
]
[[package]]
name = "gsk4"
version = "0.3.0"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20b71f2e2cc699c2e0fbfa22899eeaffd84f9c1dc01e9263deac8664eec22dc0"
checksum = "0672c63e4101e19d5e9cb4a0aed8b3278e9573529bd0b6a86d9c748c71bd9882"
dependencies = [
"bitflags",
"cairo-rs",
......@@ -411,9 +382,9 @@ dependencies = [
[[package]]
name = "gsk4-sys"
version = "0.3.0"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30468aff80e4faadf22f9ba164ea17511a69a9995d7a13827a13424ef47b2472"
checksum = "e31d21d7ce02ba261bb24c50c4ab238a10b41a2c97c32afffae29471b7cca69b"
dependencies = [
"cairo-sys-rs",
"gdk4-sys",
......@@ -422,136 +393,14 @@ dependencies = [
"graphene-sys",
"libc",
"pango-sys",
"system-deps 4.0.0",
]
[[package]]
name = "gstreamer"
version = "0.17.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "810e68483c27518ec8491d71ee163f9fc03dcc4ebacee98caa348e8a064898ef"
dependencies = [
"bitflags",
"cfg-if",
"futures-channel",
"futures-core",
"futures-util",
"glib",
"gstreamer-sys",
"libc",
"muldiv",
"num-integer",
"num-rational",
"once_cell",
"paste",
"pretty-hex",
"thiserror",
]
[[package]]
name = "gstreamer-base"
version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c0c1d8c62eb5d08fb80173609f2eea71d385393363146e4e78107facbd67715"
dependencies = [
"bitflags",
"cfg-if",
"glib",
"gstreamer",
"gstreamer-base-sys",
"libc",
]
[[package]]
name = "gstreamer-base-sys"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28169a7b58edb93ad8ac766f0fa12dcd36a2af4257a97ee10194c7103baf3e27"
dependencies = [
"glib-sys",
"gobject-sys",
"gstreamer-sys",
"libc",
"system-deps 3.2.0",
]
[[package]]
name = "gstreamer-player"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c503dba6f79b5cd8a4be5329119892c196db013ce66fce16079a7df8ce819a3a"
dependencies = [
"bitflags",
"glib",
"gstreamer",
"gstreamer-player-sys",
"gstreamer-video",
"libc",
"once_cell",
]
[[package]]
name = "gstreamer-player-sys"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e50bed2a120574750ea1370163df21b50762d0b4967f569fdc58232f4c930d5"
dependencies = [
"glib-sys",
"gobject-sys",
"gstreamer-sys",
"gstreamer-video-sys",
"libc",
"system-deps 3.2.0",
]
[[package]]
name = "gstreamer-sys"
version = "0.17.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a81704feeb3e8599913bdd1e738455c2991a01ff4a1780cb62200993e454cc3e"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps 3.2.0",
]
[[package]]
name = "gstreamer-video"
version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3447ee95c8e79daec0b163260cf6a3de9bc19ff47a01b533787f900074a3476"
dependencies = [
"bitflags",
"cfg-if",
"futures-channel",
"glib",
"gstreamer",
"gstreamer-base",
"gstreamer-video-sys",
"libc",
"once_cell",
]
[[package]]
name = "gstreamer-video-sys"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b81608f4182bdddd5bd33aaaa341d5544eda12b067a3dab75b1b7d2de01a3ba7"
dependencies = [
"glib-sys",
"gobject-sys",
"gstreamer-base-sys",
"gstreamer-sys",
"libc",
"system-deps 3.2.0",
"system-deps",
]
[[package]]
name = "gtk4"
version = "0.3.0"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "906f9308d15789d96a736881582181d710ae0937197119df459f3d2b46ef6776"
checksum = "d6f9e36fb6db3d70edf5cea9f4a20928c1d08ed3f27697cfd2d21ca3d8ac4a2d"
dependencies = [
"bitflags",
"cairo-rs",
......@@ -572,13 +421,11 @@ dependencies = [
[[package]]
name = "gtk4-macros"
version = "0.3.0"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d0d008cdf23214c697482415dd20f666bdf3cc9f5e803b017223c17c5b59a6e"
checksum = "573db42bb64973a4d5f718b73caa7204285a1a665308a23b11723d0ee56ec305"
dependencies = [
"anyhow",
"heck",
"itertools",
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
......@@ -588,9 +435,9 @@ dependencies = [
[[package]]
name = "gtk4-sys"
version = "0.3.0"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d06be0a6322aa77dd372f726e97efbcbb192d9a824a414a8874f238effd7747c"
checksum = "c47c075e8f795c38f6e9a47b51a73eab77b325f83c0154979ed4d4245c36490d"
dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
......@@ -602,23 +449,29 @@ dependencies = [
"gsk4-sys",
"libc",
"pango-sys",
"system-deps 4.0.0",
"system-deps",
]
[[package]]
name = "heck"
version = "0.3.2"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "heck"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
version = "0.1.18"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
......@@ -633,15 +486,6 @@ dependencies = [
]
[[package]]
name = "itertools"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
dependencies = [
"either",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
......@@ -649,9 +493,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libadwaita"
version = "0.1.0-beta-1"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cef1e2d4b5490caff8a1d44648f68721ab917f765a7fa1d0226fcdac42d86552"
checksum = "0d4b1d54d907dfa5d6663fdf4bdbe46c34747258b85c787adbf66187ccbaac81"
dependencies = [
"gdk-pixbuf",
"gdk4",
......@@ -666,9 +510,9 @@ dependencies = [
[[package]]
name = "libadwaita-sys"
version = "0.1.0-beta-1"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a165d8c96824753ec072b70a9149790efa3d5abb07e130cda7eb04ef2006d4c"
checksum = "f18b6ac4cadd252a89f5cba0a5a4e99836131795d6fad37b859ac79e8cb7d2c8"
dependencies = [
"gdk4-sys",
"gio-sys",
......@@ -676,14 +520,14 @@ dependencies = [
"gobject-sys",
"gtk4-sys",
"libc",
"system-deps 3.2.0",
"system-deps",
]
[[package]]
name = "libc"
version = "0.2.86"
version = "0.2.114"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c"
checksum = "b0005d08a8f7b65fb8073cb697aa0b12b631ed251ce73d862ce50eeb52ce3b50"
[[package]]
name = "locale_config"
......@@ -718,51 +562,15 @@ dependencies = [
[[package]]
name = "memchr"
version = "2.3.4"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "memoffset"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
dependencies = [
"autocfg",
]
[[package]]
name = "muldiv"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5136edda114182728ccdedb9f5eda882781f35fa6e80cc360af12a8932507f3"
[[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-rational"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.14"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
dependencies = [
"autocfg",
]
......@@ -798,15 +606,15 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.5.2"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0"
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
[[package]]
name = "pango"
version = "0.14.3"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1fc88307d9797976ea62722ff2ec5de3fae279c6e20100ed3f49ca1a4bf3f96"
checksum = "79211eff430c29cc38c69e0ab54bc78fa1568121ca9737707eee7f92a8417a94"
dependencies = [
"bitflags",
"glib",
......@@ -817,23 +625,17 @@ dependencies = [
[[package]]
name = "pango-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2367099ca5e761546ba1d501955079f097caa186bb53ce0f718dca99ac1942fe"
checksum = "7022c2fb88cd2d9d55e1a708a8c53a3ae8678234c4a54bf623400aeb7f31fac2"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps 3.2.0",
"system-deps",
]
[[package]]
name = "paste"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5d65c4d95931acda4498f675e332fcbdc9a06705cd07086c510e9b6009cd1c1"
[[package]]
name = "pest"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
......@@ -844,9 +646,9 @@ dependencies = [
[[package]]
name = "pin-project-lite"
version = "0.2.4"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827"
checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c"
[[package]]
name = "pin-utils"
......@@ -856,21 +658,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.19"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
[[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"
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
[[package]]
name = "pretty_env_logger"
......@@ -884,9 +674,9 @@ dependencies = [
[[package]]
name = "proc-macro-crate"
version = "1.0.0"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41fdbd1df62156fbc5945f4762632564d7d038153091c3fcf1067f6aef7cff92"
checksum = "1ebace6889caf889b4d3f76becee12e90353f2b8c7d875534a71e5742f8f6f83"
dependencies = [
"thiserror",
"toml",
......@@ -918,9 +708,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.24"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
dependencies = [
"unicode-xid",
]
......@@ -933,88 +723,29 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
[[package]]
name = "quote"
version = "1.0.9"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
dependencies = [
"libc",
"rand_chacha",
"rand_core",
"rand_hc",
]
[[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",
]
[[package]]
name = "rand_core"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7"
dependencies = [
"getrandom",
]
[[package]]
name = "rand_hc"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
dependencies = [
"rand_core",
]
[[package]]
name = "redox_syscall"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9"
dependencies = [
"bitflags",
]
[[package]]
name = "regex"
version = "1.4.3"
version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
"thread_local",
]
[[package]]
name = "regex-syntax"
version = "0.6.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
[[package]]
name = "remove_dir_all"
version = "0.5.3"
version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [
"winapi",
]
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "rustc_version"
......@@ -1045,45 +776,27 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.123"
version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae"
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
[[package]]
name = "slab"
version = "0.4.2"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5"
[[package]]
name = "smallvec"
version = "1.6.1"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
[[package]]
name = "strum"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aaf86bbcfd1fa9670b7a129f64fc0c9fcbbfe4f1bc4210e9e98fe71ffc12cde2"
[[package]]
name = "strum_macros"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d06aaeeee809dbc59eb4556183dd927df67db1540de5be8d3ec0b6636358a5ec"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
]
checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
[[package]]
name = "syn"
version = "1.0.60"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081"
checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b"
dependencies = [
"proc-macro2",
"quote",
......@@ -1092,48 +805,22 @@ dependencies = [
[[package]]
name = "system-deps"
version = "3.2.0"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "480c269f870722b3b08d2f13053ce0c2ab722839f472863c3e2d61ff3a1c2fa6"
checksum = "7b1487aaddaacbc5d60a2a507ba1617c5ca66c57dd0dd07d0c5efd5b693841d4"
dependencies = [
"anyhow",
"cfg-expr 0.8.1",
"heck",
"itertools",
"cfg-expr",
"heck 0.3.3",
"pkg-config",
"strum",
"strum_macros",
"thiserror",
"toml",
"version-compare",
]
[[package]]
name = "system-deps"
version = "4.0.0"
name = "temp-dir"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c1889ab44c2a423ba9ba4d64cd04989b25c0280ca7ade813f05368418722a04"
dependencies = [
"cfg-expr 0.9.0",
"heck",
"pkg-config",
"toml",
"version-compare",
]
[[package]]
name = "tempfile"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
dependencies = [
"cfg-if",
"libc",
"rand",
"redox_syscall",
"remove_dir_all",
"winapi",
]
checksum = "af547b166dd1ea4b472165569fc456cfb6818116f854690b0ff205e636523dab"
[[package]]
name = "termcolor"
......@@ -1146,18 +833,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.29"
version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "602eca064b2d83369e2b2f34b09c70b605402801927c65c11071ac911d299b88"
checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.29"
version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bad553cc2c78e8de258400763a647e80e6d1b31ee237275d756f6836d204494c"
checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
dependencies = [
"proc-macro2",
"quote",
......@@ -1165,15 +852,6 @@ dependencies = [
]
[[package]]
name = "thread_local"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd"
dependencies = [
"once_cell",
]
[[package]]
name = "toml"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
......@@ -1190,33 +868,27 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
[[package]]
name = "unicode-segmentation"
version = "1.7.1"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
[[package]]
name = "unicode-xid"
version = "0.2.1"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "version-compare"
version = "0.0.11"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b"
checksum = "fe88247b92c1df6b6de80ddc290f3976dbdf2f5f5d3fd049a9fb598c6dd5ca73"
[[package]]
name = "version_check"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
[[package]]
name = "wasi"
version = "0.10.2+wasi-snapshot-preview1"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "winapi"
......
......@@ -2,25 +2,13 @@
name = "gnome-tour"
version = "40.0.0"
authors = ["Bilal Elmoussaoui <bil.elmoussaoui@gmail.com>"]
edition = "2018"
edition = "2021"
[features]
video = ["gst_player", "gst"]
[dependencies]
gtk = { package = "gtk4", version = "0.3", features= ["v4_2"]}
gtk = { package = "gtk4", version = "0.4", features= ["v4_2"]}
log = "0.4"
gettext-rs = { version = "0.6", features = ["gettext-system"] }
libadwaita = "0.1.0-beta-1"
gettext-rs = { version = "0.7", features = ["gettext-system"] }
adw = {package = "libadwaita", version = "0.1"}
pretty_env_logger = "0.4"
[dependencies.gst_player]
version = "0.17"
package = "gstreamer-player"
optional = true
[dependencies.gst]
version = "0.17"
package = "gstreamer"
optional = true
......@@ -9,24 +9,3 @@
![screenshot](data/resources/screenshots/screenshot1.png)
</div>
### Video Feature
Tour uses by default the logo of the distribution based on the info from `/etc/os-release`. The application comes with a feature to replace the logo with a welcome video shipped by the distribution.
To enable the feature, you need to build the application with
```bash
meson _builddir -Dvideo_path=/absolute/path/to/the/video.mp4
```
If you're testing the application using Builder, make sure to change the `config-opts` accordingly & give the application filesystem access so it can play the video file.
Example:
This needs to be added to the `gnome-tour` module
```json
"config-opts" : [
"-Dvideo_path=/home/username/to/the/video.mp4"
]
```
along with `--filesystem=home` in `finish-args`
#!/bin/sh
export MESON_BUILD_ROOT="$1"
export MESON_SOURCE_ROOT="$2"
export CARGO_TARGET_DIR="$MESON_BUILD_ROOT"/target
export CARGO_HOME="$MESON_BUILD_ROOT"/cargo-home
FEATURES="$6"
if [ $4 = "Devel" ]
then
echo "DEBUG MODE"
cargo build --manifest-path \
"$MESON_SOURCE_ROOT"/Cargo.toml $FEATURES && \
cp "$CARGO_TARGET_DIR"/debug/$5 $3
else
echo "RELEASE MODE"
cargo build --manifest-path \
"$MESON_SOURCE_ROOT"/Cargo.toml $FEATURES --release && \
cp "$CARGO_TARGET_DIR"/release/$5 $3
fi
#!/usr/bin/env python3
from os import environ, path
from subprocess import call
if not environ.get('DESTDIR', ''):
PREFIX = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
DATA_DIR = path.join(PREFIX, 'share')
print('Updating icon cache...')
call(['gtk-update-icon-cache', '-qtf', path.join(DATA_DIR, 'icons/hicolor')])
print("Updating desktop database...")
call(["update-desktop-database", path.join(DATA_DIR, 'applications')])
{
"app-id" : "org.gnome.TourDevel",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
"sdk-extensions" : [
"app-id": "org.gnome.TourDevel",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
"sdk-extensions": [
"org.freedesktop.Sdk.Extension.rust-stable"
],
"command" : "gnome-tour",
"tags" : [
"nightly"
],
"finish-args" : [
"command": "gnome-tour",
"finish-args": [
"--share=ipc",
"--socket=fallback-x11",
"--socket=wayland",
"--device=dri"
"--device=dri",
"--env=RUST_LOG=gnome_tour=debug"
],
"build-options" : {
"append-path" : "/usr/lib/sdk/rust-stable/bin",
"build-args" : [
"build-options": {
"append-path": "/usr/lib/sdk/rust-stable/bin",
"build-args": [
"--share=network"
],
"env" : {
"GTK_DEBUG" : "interactive",
"CARGO_HOME" : "/run/build/gnome-tour/cargo",
"RUST_BACKTRACE" : "1"
}
]
},
"modules" : [
{
"name" : "libadwaita",
"buildsystem" : "meson",
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/libadwaita.git",
"branch" : "main"
}
]
},
"modules": [
{
"name" : "gnome-tour",
"buildsystem" : "meson",
"config-opts" : [
"name": "gnome-tour",
"buildsystem": "meson",
"config-opts": [
"-Dprofile=development"
],
"sources" : [
"sources": [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/gnome-tour.git"
"type": "git",
"url": "https://gitlab.gnome.org/GNOME/gnome-tour.git"
}
]
}
......
......@@ -56,6 +56,7 @@ resources = gnome.compile_resources(
'resources',
'resources.gresource.xml',
gresource_bundle: true,
source_dir: meson.current_build_dir()
source_dir: meson.current_build_dir(),
install: true,
install_dir: pkgdatadir,
)
......@@ -3,7 +3,7 @@
<component type="desktop-application">
<id>@app-id@</id>
<metadata_license>CC0</metadata_license>
<project_license>GPL-3.0+</project_license>
<project_license>GPL-3.0-or-later</project_license>
<name>Tour</name>
<summary>GNOME Tour and Greeter</summary>
<description>
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/Tour/">
<file compressed="true" alias="style.css">resources/style.css</file>
<file compressed="true" alias="welcome.svg">resources/assets/welcome.svg</file>
<file compressed="true" alias="overview.svg">resources/assets/overview.svg</file>
<file compressed="true" alias="search.svg">resources/assets/search.svg</file>
<file compressed="true" alias="blank.svg">resources/assets/blank.svg</file>
<file compressed="true" alias="workspaces.svg">resources/assets/workspaces.svg</file>
<file compressed="true" alias="ready-to-go.svg">resources/assets/ready-to-go.svg</file>
<file compressed="true" alias="hand-fg.svg">resources/assets/hand-fg.svg</file>
<file compressed="true" alias="updown-bg.svg">resources/assets/updown-bg.svg</file>
<file compressed="true" alias="leftright-bg.svg">resources/assets/leftright-bg.svg</file>
<file compressed="true" alias="style.css">resources/style.css</file>
<file compressed="true" preprocess="xml-stripblanks" alias="ui/paginator.ui">resources/ui/paginator.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="ui/window.ui">resources/ui/window.ui</file>
<file compressed="true" alias="welcome.svg">resources/assets/welcome.svg</file>
<file compressed="true" alias="overview.svg">resources/assets/overview.svg</file>
<file compressed="true" alias="search.svg">resources/assets/search.svg</file>
<file compressed="true" alias="blank.svg">resources/assets/blank.svg</file>
<file compressed="true" alias="workspaces.svg">resources/assets/workspaces.svg</file>
<file compressed="true" alias="ready-to-go.svg">resources/assets/ready-to-go.svg</file>
<file compressed="true" alias="hand-fg.svg">resources/assets/hand-fg.svg</file>
<file compressed="true" alias="updown-bg.svg">resources/assets/updown-bg.svg</file>
<file compressed="true" alias="leftright-bg.svg">resources/assets/leftright-bg.svg</file>
</gresource>
<gresource prefix="/org/gnome/Tour/icons/scalable/actions">
<file compressed="true" alias="left-large-symbolic.svg">resources/left-large-symbolic.svg</file>
<file compressed="true" alias="right-large-symbolic.svg">resources/right-large-symbolic.svg</file>
</gresource>
</gresources>
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="16px" viewBox="0 0 16 16" width="16px"><filter id="a" height="100%" width="100%" x="0%" y="0%"><feColorMatrix in="SourceGraphic" type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/></filter><mask id="b"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.3"/></g></mask><clipPath id="c"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="d"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="e"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="f"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="g"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="h"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="i"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="j"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="k"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="l"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="m"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="n"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="o"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="p"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.3"/></g></mask><clipPath id="q"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="r"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.5"/></g></mask><clipPath id="s"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><g clip-path="url(#c)" mask="url(#b)" transform="matrix(1 0 0 1 -980 -80)"><path d="m 562.460938 212.058594 h 10.449218 c -1.183594 0.492187 -1.296875 2.460937 0 3 h -10.449218 z m 0 0" fill="#2e3436"/></g><g clip-path="url(#e)" mask="url(#d)" transform="matrix(1 0 0 1 -980 -80)"><path d="m 16 748 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#g)" mask="url(#f)" transform="matrix(1 0 0 1 -980 -80)"><path d="m 17 747 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#i)" mask="url(#h)" transform="matrix(1 0 0 1 -980 -80)"><path d="m 18 750 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#k)" mask="url(#j)" transform="matrix(1 0 0 1 -980 -80)"><path d="m 16 750 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#m)" mask="url(#l)" transform="matrix(1 0 0 1 -980 -80)"><path d="m 17 751 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#o)" mask="url(#n)" transform="matrix(1 0 0 1 -980 -80)"><path d="m 19 751 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#q)" mask="url(#p)" transform="matrix(1 0 0 1 -980 -80)"><path d="m 136 776 v 7 h 7 v -7 z m 0 0" fill="#2e3436"/></g><g clip-path="url(#s)" mask="url(#r)" transform="matrix(1 0 0 1 -980 -80)"><path d="m 219 758 h 3 v 12 h -3 z m 0 0" fill="#2e3436"/></g><g fill="#474747"><path d="m 11.644531 2.707031 l -1.414062 -1.414062 l -6.707031 6.707031 l 6.707031 6.707031 l 1.414062 -1.414062 l -5.292969 -5.292969 z m 0 0"/><path d="m 10.9375 15 h 1 v -1 h -1 z m 0 0"/><path d="m 10.9375 2 h 1 v -1 h -1 z m 0 0"/><path d="m 10.9375 3 c 0.554688 0 1 -0.449219 1 -1 c 0 -0.554688 -0.445312 -1 -1 -1 s -1 0.445312 -1 1 c 0 0.550781 0.445312 1 1 1 z m 0 0"/><path d="m 10.9375 15 c 0.554688 0 1 -0.449219 1 -1 c 0 -0.554688 -0.445312 -1 -1 -1 s -1 0.445312 -1 1 c 0 0.550781 0.445312 1 1 1 z m 0 0"/></g></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="16px" viewBox="0 0 16 16" width="16px"><filter id="a" height="100%" width="100%" x="0%" y="0%"><feColorMatrix in="SourceGraphic" type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/></filter><mask id="b"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.3"/></g></mask><clipPath id="c"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="d"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="e"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="f"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="g"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="h"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="i"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="j"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="k"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="l"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="m"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="n"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="o"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="p"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.3"/></g></mask><clipPath id="q"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="r"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.5"/></g></mask><clipPath id="s"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><g clip-path="url(#c)" mask="url(#b)" transform="matrix(1 0 0 1 -1000 -80)"><path d="m 562.460938 212.058594 h 10.449218 c -1.183594 0.492187 -1.296875 2.460937 0 3 h -10.449218 z m 0 0" fill="#2e3436"/></g><g clip-path="url(#e)" mask="url(#d)" transform="matrix(1 0 0 1 -1000 -80)"><path d="m 16 748 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#g)" mask="url(#f)" transform="matrix(1 0 0 1 -1000 -80)"><path d="m 17 747 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#i)" mask="url(#h)" transform="matrix(1 0 0 1 -1000 -80)"><path d="m 18 750 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#k)" mask="url(#j)" transform="matrix(1 0 0 1 -1000 -80)"><path d="m 16 750 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#m)" mask="url(#l)" transform="matrix(1 0 0 1 -1000 -80)"><path d="m 17 751 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#o)" mask="url(#n)" transform="matrix(1 0 0 1 -1000 -80)"><path d="m 19 751 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#q)" mask="url(#p)" transform="matrix(1 0 0 1 -1000 -80)"><path d="m 136 776 v 7 h 7 v -7 z m 0 0" fill="#2e3436"/></g><g clip-path="url(#s)" mask="url(#r)" transform="matrix(1 0 0 1 -1000 -80)"><path d="m 219 758 h 3 v 12 h -3 z m 0 0" fill="#2e3436"/></g><g fill="#474747"><path d="m 4.292969 2.707031 l 1.414062 -1.414062 l 6.707031 6.707031 l -6.707031 6.707031 l -1.414062 -1.414062 l 5.292969 -5.292969 z m 0 0"/><path d="m 5 15 h -1 v -1 h 1 z m 0 0"/><path d="m 5 2 h -1 v -1 h 1 z m 0 0"/><path d="m 5 3 c -0.554688 0 -1 -0.449219 -1 -1 c 0 -0.554688 0.445312 -1 1 -1 s 1 0.445312 1 1 c 0 0.550781 -0.445312 1 -1 1 z m 0 0"/><path d="m 5 15 c -0.554688 0 -1 -0.449219 -1 -1 c 0 -0.554688 0.445312 -1 1 -1 s 1 0.445312 1 1 c 0 0.550781 -0.445312 1 -1 1 z m 0 0"/></g></svg>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="PaginatorWidget" parent="GtkBox">
<child>
<object class="GtkHeaderBar">
<property name="show-title-buttons">True</property>
<property name="title-widget">
<object class="AdwCarouselIndicatorDots" id="carousel_dots">
<property name="carousel">carousel</property>
</object>
</property>
<style>
<class name="flat" />
</style>
</object>
</child>
<child>
<object class="GtkOverlay" id="previous_overlay">
<property name="valign">center</property>
<child type="overlay">
<object class="GtkButton" id="previous_btn">
<property name="margin-start">12</property>
<property name="icon-name">left-large-symbolic</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="action-name">app.previous-page</property>
<property name="tooltip-text" translatable="yes">Previous</property>
<style>
<class name="circular" />
</style>
</object>
</child>
<child type="overlay">
<object class="GtkButton" id="next_btn">
<property name="margin-end">12</property>
<property name="icon-name">right-large-symbolic</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="action-name">app.next-page</property>
<property name="tooltip-text" translatable="yes">Next</property>
<style>
<class name="circular" />
</style>
</object>
</child>
<child type="overlay">
<object class="GtkButton" id="start_btn">
<property name="margin-end">12</property>
<property name="icon-name">right-large-symbolic</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="action-name">app.start-tour</property>
<property name="tooltip-text" translatable="yes">Start</property>
<style>
<class name="suggested-action" />
<class name="circular" />
</style>
</object>
</child>
<child>
<object class="AdwCarousel" id="carousel">
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
</template>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="Window" parent="AdwApplicationWindow">
<property name="default-width">960</property>
<property name="default-height">720</property>
<property name="content">
<object class="PaginatorWidget" id="paginator">
<child>
<object class="ImagePageWidget">
<property name="resource-uri">/org/gnome/Tour/overview.svg</property>
<property name="head" translatable="yes">Get an Overview</property>
<property name="body" translatable="yes">Press the Super key to see open windows and apps.</property>
</object>
</child>
<child>
<object class="ImagePageWidget">
<property name="resource-uri">/org/gnome/Tour/search.svg</property>
<property name="head" translatable="yes">Just Type to Search</property>
<property name="body" translatable="yes">Type in the overview to search. Launch apps, find things.</property>
</object>
</child>
<child>
<object class="ImagePageWidget">
<property name="resource-uri">/org/gnome/Tour/workspaces.svg</property>
<property name="head" translatable="yes">Keep on Top with Workspaces</property>
<property name="body" translatable="yes">Easily organize windows with the workspaces view.</property>
</object>
</child>
<child>
<object class="ImagePageWidget">
<property name="resource-uri">/org/gnome/Tour/blank.svg</property>
<property name="head" translatable="yes">Up/Down for the Overview</property>
<property name="body" translatable="yes">On a touchpad, use three-finger vertical swipes. Try it!</property>
</object>
</child>
<child>
<object class="ImagePageWidget">
<property name="resource-uri">/org/gnome/Tour/blank.svg</property>
<property name="head" translatable="yes">Left/Right for Workspaces</property>
<property name="body" translatable="yes">On a touchpad, use three-finger horizontal swipes. Try it!</property>
</object>
</child>
<child>
<object class="ImagePageWidget">
<property name="resource-uri">/org/gnome/Tour/ready-to-go.svg</property>
<property name="head" translatable="yes">That's it. Have a nice day!</property>
<property name="body" translatable="yes">To get more advice and tips, see the Help app.</property>
<style>
<class name="last-page" />
</style>
</object>
</child>
</object>
</property>
</template>
</interface>
project('gnome-tour',
'rust',
version: '41.rc',
meson_version : '>= 0.50')
license: 'GPL-3.0-or-later',
meson_version : '>= 0.59')
i18n = import('i18n')
gnome = import('gnome')
......@@ -14,17 +15,10 @@ dependency('gdk-pixbuf-2.0')
dependency('gtk4', version: '>= 4.4')
dependency('libadwaita-1', version: '>= 1')
if get_option('video_path') != ''
dependency('gstreamer-1.0', version: '>= 1.12')
dependency('gstreamer-video-1.0', version: '>= 1.12')
dependency('gstreamer-player-1.0', version: '>= 1.12')
endif
glib_compile_resources = find_program('glib-compile-resources', required: true)
desktop_file_validate = find_program('desktop-file-validate', required: false)
appstream_util = find_program('appstream-util', required: false)
cargo = find_program('cargo', required: false)
cargo_script = find_program('build-aux/cargo.sh')
cargo = find_program('cargo')
version = meson.project_version()
......@@ -35,7 +29,7 @@ localedir = prefix / get_option('localedir')
datadir = prefix / get_option('datadir')
pkgdatadir = datadir / meson.project_name()
iconsdir = datadir / 'icons'
podir =meson.source_root () / 'po'
podir =meson.project_source_root () / 'po'
gettext_package = meson.project_name()
......@@ -57,8 +51,8 @@ application_id = '@0@@1@'.format(base_id, profile)
meson.add_dist_script(
'build-aux/dist-vendor.sh',
meson.build_root() / 'meson-dist' / meson.project_name() + '-' + version,
meson.source_root()
meson.project_build_root() / 'meson-dist' / meson.project_name() + '-' + version,
meson.project_source_root()
)
if get_option('profile') == 'development'
......@@ -71,4 +65,8 @@ subdir('data')
subdir('po')
subdir('src')
meson.add_install_script('build-aux/meson_post_install.py')
gnome.post_install(
gtk_update_icon_cache: true,
update_desktop_database: true,
)
......@@ -9,9 +9,3 @@ option (
description: 'The build profile for GNOME Tour. One of "default" or "development".'
)
option(
'video_path',
type : 'string',
value: '',
description : 'Sets the absolute path of a welcome video'
)
data/org.gnome.Tour.desktop.in.in
data/org.gnome.Tour.metainfo.xml.in.in
src/main.rs
src/widgets/pages/welcome.rs
data/resources/ui/paginator.ui
data/resources/ui/window.ui
src/widgets/image_page.rs
src/widgets/paginator.rs
src/widgets/window.rs
src/main.rs
use crate::config;
use crate::utils;
use crate::widgets::Window;
use gtk::gio::{self, prelude::*};
use gtk::glib::{self, clone};
use gtk::prelude::*;
use adw::prelude::*;
use gtk::{
gio,
glib::{self, clone},
subclass::prelude::*,
};
use log::info;
use std::{cell::RefCell, rc::Rc};
pub struct Application {
app: libadwaita::Application,
window: RefCell<Rc<Option<Window>>>,
}
impl Application {
pub fn new() -> Rc<Self> {
let app =
libadwaita::Application::new(Some(config::APP_ID), gio::ApplicationFlags::FLAGS_NONE);
app.set_resource_base_path(Some("/org/gnome/Tour"));
mod imp {
use super::*;
use adw::subclass::prelude::*;
use gtk::glib::{once_cell::sync::OnceCell, WeakRef};
let application = Rc::new(Self {
app,
window: RefCell::new(Rc::new(None)),
});
#[derive(Debug, Default)]
pub struct Application {
pub(super) window: OnceCell<WeakRef<Window>>,
}
application.setup_signals(application.clone());
application
#[glib::object_subclass]
impl ObjectSubclass for Application {
const NAME: &'static str = "Application";
type ParentType = adw::Application;
type Type = super::Application;
}
fn setup_gactions(&self, application: Rc<Self>) {
// Quit
utils::action(
&self.app,
"quit",
clone!(@strong self.app as app => move |_, _| {
app.quit();
}),
);
impl ObjectImpl for Application {}
impl ApplicationImpl for Application {
fn activate(&self, application: &Self::Type) {
let window = Window::new(application);
application.add_window(&window);
window.present();
self.window.set(window.downgrade()).unwrap();
self.parent_activate(application);
}
fn startup(&self, application: &Self::Type) {
// Quit
utils::action(
application,
"quit",
clone!(@weak application => move |_, _| {
application.quit();
}),
);
// Start Tour
utils::action(
&self.app,
"start-tour",
clone!(@strong application => move |_, _| {
if let Some(window) = &*application.window.borrow().clone() {
window.start_tour();
}
}),
);
// Start Tour
utils::action(
application,
"start-tour",
clone!(@weak application => move |_, _| {
application.window().start_tour();
}),
);
// Skip Tour
utils::action(
&self.app,
"skip-tour",
clone!(@strong self.app as app => move |_, _| {
app.quit();
}),
);
// Skip Tour
utils::action(
application,
"skip-tour",
clone!(@weak application => move |_, _| {
application.quit();
}),
);
utils::action(
&self.app,
"next-page",
clone!(@strong application => move |_, _| {
if let Some(window) = &*application.window.borrow().clone() {
if window.paginator.borrow_mut().try_next().is_none() {
window.widget.close();
utils::action(
application,
"next-page",
clone!(@weak application => move |_, _| {
let window = application.window();
if window.paginator().try_next().is_none() {
window.close();
}
}
}),
);
}),
);
utils::action(
&self.app,
"previous-page",
clone!(@strong application => move |_, _| {
if let Some(window) = &*application.window.borrow().clone() {
if window.paginator.borrow_mut().try_previous().is_none() {
utils::action(
application,
"previous-page",
clone!(@weak application => move |_, _| {
let window = application.window();
if window.paginator().try_previous().is_none() {
window.reset_tour();
}
}
}),
);
}),
);
application.set_accels_for_action("app.quit", &["<Control>q"]);
application.set_accels_for_action("app.skip-tour", &["Escape"]);
self.parent_startup(application);
}
}
impl GtkApplicationImpl for Application {}
impl AdwApplicationImpl for Application {}
}
glib::wrapper! {
pub struct Application(ObjectSubclass<imp::Application>)
@extends gio::Application, gtk::Application, adw::Application,
@implements gio::ActionMap, gio::ActionGroup;
}
self.app.set_accels_for_action("app.quit", &["<primary>q"]);
impl Application {
#[allow(clippy::new_without_default)]
pub fn new() -> Self {
glib::Object::new(&[
("application-id", &config::APP_ID),
("resource-base-path", &Some("/org/gnome/Tour")),
])
.unwrap()
}
fn setup_signals(&self, app: Rc<Self>) {
self.app.connect_startup(clone!(@weak app => move |_| {
app.setup_gactions(app.clone());
}));
self.app
.connect_activate(clone!(@weak app => move |gtk_app| {
let window = Window::new(&gtk_app);
gtk_app.add_window(&window.widget);
window.widget.present();
window.widget.show();
app.window.replace(Rc::new(Some(window)));
}));
fn window(&self) -> Window {
self.imp().window.get().and_then(|w| w.upgrade()).unwrap()
}
pub fn run(&self) {
pub fn run() {
info!("GNOME Tour ({})", config::APP_ID);
info!("Version: {} ({})", config::VERSION, config::PROFILE);
info!("Datadir: {}", config::PKGDATADIR);
self.app.run();
let app = Self::new();
gtk::prelude::ApplicationExtManual::run(&app);
}
}
......@@ -4,5 +4,4 @@ pub static PROFILE: &str = @PROFILE@;
pub static VERSION: &str = @VERSION@;
pub static GETTEXT_PACKAGE: &str = @GETTEXT_PACKAGE@;
pub static LOCALEDIR: &str = @LOCALEDIR@;
#[cfg(feature = "video")]
pub static VIDEO_PATH: &str = @VIDEO_PATH@;
pub const RESOURCES_FILE: &str = concat!(@PKGDATADIR@, "/resources.gresource");
use gettextrs::*;
use gtk::glib;
use gtk::{gio, glib};
mod application;
mod config;
mod static_resources;
mod utils;
mod widgets;
......@@ -14,24 +13,18 @@ fn main() {
pretty_env_logger::init();
// Prepare i18n
setlocale(LocaleCategory::LcAll, "");
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR).expect(&format!(
"Unable to bind text domain for {}",
GETTEXT_PACKAGE
));
textdomain(GETTEXT_PACKAGE).expect(&format!(
"Unable to switch to text domain {}",
GETTEXT_PACKAGE
));
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR)
.unwrap_or_else(|_| panic!("Unable to bind text domain for {}", GETTEXT_PACKAGE));
textdomain(GETTEXT_PACKAGE)
.unwrap_or_else(|_| panic!("Unable to switch to text domain {}", GETTEXT_PACKAGE));
glib::set_application_name(&gettext("Tour"));
glib::set_prgname(Some("Tour"));
gtk::init().expect("Unable to start GTK3");
#[cfg(feature = "video")]
gst::init().expect("Unable to start gst");
static_resources::init().expect("Failed to initialize the resource file.");
let res = gio::Resource::load(config::RESOURCES_FILE).expect("Could not load resources");
gio::resources_register(&res);
let app = Application::new();
app.run();
Application::run()
}
......@@ -5,7 +5,6 @@ global_conf.set_quoted('PROFILE', profile)
global_conf.set_quoted('VERSION', version + version_suffix)
global_conf.set_quoted('GETTEXT_PACKAGE', gettext_package)
global_conf.set_quoted('LOCALEDIR', localedir)
global_conf.set_quoted('VIDEO_PATH', get_option('video_path'))
config = configure_file(
input: 'config.rs.in',
output: 'config.rs',
......@@ -14,62 +13,42 @@ config = configure_file(
# Copy the config.rs output to the source directory.
run_command(
'cp',
meson.build_root() / 'src' / 'config.rs',
meson.source_root() / 'src' / 'config.rs',
meson.project_build_root() / 'src' / 'config.rs',
meson.project_source_root() / 'src' / 'config.rs',
check: true
)
# include_bytes! only takes a string literal
resource_conf = configuration_data()
resource_conf.set_quoted('RESOURCEFILE', resources.full_path())
resource_rs = configure_file(
input: 'static_resources.rs.in',
output: 'static_resources.rs',
configuration: resource_conf
)
run_command(
'cp',
resource_rs,
meson.current_source_dir(),
check: true
)
cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ]
cargo_options += [ '--target-dir', meson.project_build_root() / 'src' ]
sources = files(
'widgets/pages/image.rs',
'widgets/pages/mod.rs',
'widgets/pages/welcome.rs',
'widgets/mod.rs',
'widgets/paginator.rs',
'widgets/window.rs',
'application.rs',
'config.rs',
'main.rs',
'static_resources.rs',
'utils.rs',
)
features = ''
if get_option('video_path') != ''
features = '--features video'
if get_option('profile') == 'default'
cargo_options += [ '--release' ]
rust_target = 'release'
message('Building in release mode')
else
rust_target = 'debug'
message('Building in debug mode')
endif
custom_target(
cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ]
cargo_build = custom_target(
'cargo-build',
build_by_default: true,
input: sources,
build_always_stale: true,
output: meson.project_name(),
console: true,
install: true,
install_dir: bindir,
depends: resources,
command: [
cargo_script,
meson.build_root(),
meson.source_root(),
'@OUTPUT@',
profile,
meson.project_name(),
features
'env',
cargo_env,
cargo, 'build',
cargo_options,
'&&',
'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@',
]
)
// Source: https://gitlab.gnome.org/World/podcasts/blob/master/podcasts-gtk/src/static_resource.rs
use gtk::gio::{resources_register, Resource};
use gtk::glib::{Bytes, Error};
pub(crate) fn init() -> Result<(), Error> {
// load the gresource binary at build time and include/link it into the final
// binary.
let res_bytes = include_bytes!(@RESOURCEFILE@);
// Create Resource it will live as long the value lives.
let gbytes = Bytes::from_static(res_bytes.as_ref());
let resource = Resource::from_data(&gbytes)?;
// Register the resource so it won't be dropped and will continue to live in
// memory.
resources_register(&resource);
Ok(())
}
use gtk::glib;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
mod imp {
use super::*;
use glib::once_cell::sync::Lazy;
use glib::{ParamFlags, ParamSpec, ParamSpecString, Value};
use gtk::glib::once_cell::sync::OnceCell;
#[derive(Debug, Default)]
pub struct ImagePageWidget {
pub(super) resource_uri: OnceCell<String>,
pub(super) head: OnceCell<String>,
pub(super) body: OnceCell<String>,
pub(super) picture: gtk::Picture,
}
#[glib::object_subclass]
impl ObjectSubclass for ImagePageWidget {
const NAME: &'static str = "ImagePageWidget";
type ParentType = gtk::Box;
type Type = super::ImagePageWidget;
}
impl ObjectImpl for ImagePageWidget {
fn constructed(&self, obj: &Self::Type) {
let layout_manager = obj
.layout_manager()
.map(|l| l.downcast::<gtk::BoxLayout>().unwrap())
.unwrap();
layout_manager.set_orientation(gtk::Orientation::Vertical);
obj.add_css_class("page");
obj.set_hexpand(true);
obj.set_vexpand(true);
obj.set_halign(gtk::Align::Fill);
obj.set_valign(gtk::Align::Fill);
let container = gtk::Box::builder()
.orientation(gtk::Orientation::Vertical)
.spacing(12)
.halign(gtk::Align::Center)
.valign(gtk::Align::Center)
.vexpand(true)
.margin_bottom(48)
.margin_top(12)
.margin_start(12)
.margin_end(12)
.build();
let clamp = adw::Clamp::new();
clamp.set_child(Some(&container));
self.picture.set_can_shrink(false);
self.picture.set_keep_aspect_ratio(true);
container.append(&self.picture);
let head_label = gtk::Label::builder()
.justify(gtk::Justification::Center)
.valign(gtk::Align::Center)
.margin_top(36)
.build();
obj.bind_property("head", &head_label, "label")
.flags(glib::BindingFlags::SYNC_CREATE)
.build();
head_label.add_css_class("title-1");
container.append(&head_label);
let body_label = gtk::Label::builder()
.lines(2)
.wrap(true)
.justify(gtk::Justification::Center)
.valign(gtk::Align::Center)
.margin_top(12)
.build();
obj.bind_property("body", &body_label, "label")
.flags(glib::BindingFlags::SYNC_CREATE)
.build();
container.append(&body_label);
obj.append(&clamp);
self.parent_constructed(obj);
}
fn properties() -> &'static [ParamSpec] {
static PROPERTIES: Lazy<Vec<ParamSpec>> = Lazy::new(|| {
vec![
ParamSpecString::new(
"resource-uri",
"Resource URI",
"Resource URI of the image",
None,
ParamFlags::READWRITE | ParamFlags::CONSTRUCT_ONLY,
),
ParamSpecString::new(
"head",
"Head",
"The title of the page",
None,
ParamFlags::READWRITE | ParamFlags::CONSTRUCT_ONLY,
),
ParamSpecString::new(
"body",
"Body",
"The body of the page",
None,
ParamFlags::READWRITE | ParamFlags::CONSTRUCT_ONLY,
),
]
});
PROPERTIES.as_ref()
}
fn set_property(&self, _obj: &Self::Type, _id: usize, value: &Value, pspec: &ParamSpec) {
match pspec.name() {
"resource-uri" => {
let resource_uri: String = value.get().unwrap();
self.picture.set_resource(Some(&resource_uri));
self.resource_uri.set(resource_uri).unwrap();
}
"head" => {
let head = value.get().unwrap();
self.head.set(head).unwrap();
}
"body" => {
let body = value.get().unwrap();
self.body.set(body).unwrap();
}
_ => unimplemented!(),
}
}
fn property(&self, _obj: &Self::Type, _id: usize, pspec: &ParamSpec) -> Value {
match pspec.name() {
"resource-uri" => self.resource_uri.get().to_value(),
"head" => self.head.get().to_value(),
"body" => self.body.get().to_value(),
_ => unimplemented!(),
}
}
}
impl WidgetImpl for ImagePageWidget {}
impl BoxImpl for ImagePageWidget {}
}
glib::wrapper! {
pub struct ImagePageWidget(ObjectSubclass<imp::ImagePageWidget>)
@extends gtk::Widget, gtk::Box;
}
impl ImagePageWidget {
pub fn new(resource_uri: &str, head: String, body: String) -> Self {
glib::Object::new::<Self>(&[
("resource-uri", &resource_uri),
("head", &head),
("body", &body),
])
.unwrap()
}
}
mod pages;
mod image_page;
mod paginator;
mod window;
mod window;
pub use image_page::ImagePageWidget;
pub use window::Window;
use gtk::prelude::*;
pub struct ImagePageWidget {
pub widget: gtk::Box,
}
impl ImagePageWidget {
pub fn new(resource_uri: &str, head: String, body: String) -> Self {
let widget = gtk::Box::new(gtk::Orientation::Vertical, 0);
let image_page = Self { widget };
image_page.init(resource_uri, head, body);
image_page
}
fn init(&self, resource_uri: &str, head: String, body: String) {
self.widget.set_hexpand(true);
self.widget.set_vexpand(true);
self.widget.add_css_class("page");
self.widget.set_halign(gtk::Align::Fill);
self.widget.set_valign(gtk::Align::Fill);
let container = gtk::Box::builder()
.orientation(gtk::Orientation::Vertical)
.spacing(12)
.halign(gtk::Align::Center)
.valign(gtk::Align::Center)
.vexpand(true)
.margin_bottom(48)
.margin_top(12)
.margin_start(12)
.margin_end(12)
.build();
let clamp = libadwaita::Clamp::new();
clamp.set_child(Some(&container));
let picture = gtk::Picture::builder()
.can_shrink(false)
.keep_aspect_ratio(true)
.build();
picture.set_resource(Some(resource_uri));
container.append(&picture);
let head_label = gtk::Label::builder()
.label(&head)
.justify(gtk::Justification::Center)
.valign(gtk::Align::Center)
.margin_top(36)
.build();
head_label.add_css_class("title-1");
container.append(&head_label);
let body_label = gtk::Label::builder()
.label(&body)
.lines(2)
.wrap(true)
.justify(gtk::Justification::Center)
.valign(gtk::Align::Center)
.margin_top(12)
.build();
container.append(&body_label);
self.widget.append(&clamp);
}
}
mod image;
mod welcome;
pub use image::ImagePageWidget;
pub use welcome::WelcomePageWidget;
#[cfg(feature = "video")]
use crate::config;
use crate::utils::i18n_f;
use gettextrs::gettext;
#[cfg(feature = "video")]
use gio::FileExt;
use gtk::glib;
#[cfg(feature = "video")]
use gtk::glib::clone;
#[cfg(feature = "video")]
use gtk::glib::{Receiver, Sender};
use gtk::prelude::*;
#[cfg(feature = "video")]
use std::cell::RefCell;
#[derive(PartialEq)]
#[cfg(feature = "video")]
pub enum Action {
VideoReady,
VideoUp,
}
pub struct WelcomePageWidget {
pub widget: gtk::Box,
#[cfg(feature = "video")]
player: gst_player::Player,
#[cfg(feature = "video")]
receiver: RefCell<Option<Receiver<Action>>>,
#[cfg(feature = "video")]
sender: Sender<Action>,
}
impl WelcomePageWidget {
pub fn new() -> Self {
let widget = gtk::Box::new(gtk::Orientation::Horizontal, 0);
#[cfg(feature = "video")]
let player = {
let dispatcher = gst_player::PlayerGMainContextSignalDispatcher::new(None);
let sink = gst::ElementFactory::make("gtksink", None)
.expect("Missing dependency: element gtksink is needed (usually, in gstreamer-plugins-good or in gst-plugin-gtk).");
let renderer = gst_player::PlayerVideoOverlayVideoRenderer::with_sink(&sink).upcast();
gst_player::Player::new(
Some(&renderer),
Some(&dispatcher.upcast::<gst_player::PlayerSignalDispatcher>()),
)
};
#[cfg(feature = "video")]
let (sender, r) = glib::MainContext::channel(glib::PRIORITY_DEFAULT);
#[cfg(feature = "video")]
let receiver = RefCell::new(Some(r));
let welcome_page = Self {
widget,
#[cfg(feature = "video")]
player,
#[cfg(feature = "video")]
sender,
#[cfg(feature = "video")]
receiver,
};
welcome_page.init();
welcome_page
}
fn init(&self) {
let container = gtk::Box::builder()
.orientation(gtk::Orientation::Vertical)
.spacing(0)
.hexpand(true)
.vexpand(true)
.valign(gtk::Align::Center)
.halign(gtk::Align::Center)
.margin_top(24)
.margin_bottom(24)
.build();
self.widget.add_css_class("page");
self.widget.add_css_class("welcome-page");
let clamp = libadwaita::Clamp::new();
clamp.set_child(Some(&container));
#[cfg(not(feature = "video"))]
let header = {
let logo = gtk::Picture::builder()
.can_shrink(false)
.keep_aspect_ratio(true)
.build();
logo.set_resource(Some("/org/gnome/Tour/welcome.svg"));
logo.upcast::<gtk::Widget>()
};
#[cfg(feature = "video")]
let header = {
let video_widget = self
.player
.get_pipeline()
.get_property("video-sink")
.unwrap()
.get::<gst::Element>()
.expect("The player of a VideoPlayerWidget should not use the default sink.")
.unwrap()
.get_property("widget")
.unwrap()
.get::<gtk::Widget>()
.unwrap()
.unwrap();
video_widget.set_size_request(-1, 360);
video_widget.set_property("ignore-alpha", &false).unwrap();
video_widget.show();
video_widget.add_css_class("video");
video_widget
};
container.append(&header);
#[cfg(feature = "video")]
{
let receiver = self.receiver.borrow_mut().take().unwrap();
receiver.attach(
None,
clone!(@strong self.player as player => move |action| {
match action {
Action::VideoReady => player.play(),
Action::VideoUp => header.add_css_class("playing"),
};
glib::Continue(true)
}),
);
self.player.connect_state_changed(
clone!(@strong self.sender as sender => move |_p,state| {
if state == gst_player::PlayerState::Playing {
sender.send(Action::VideoUp).unwrap();
}
}),
);
self.player.connect_uri_loaded(
clone!(@strong self.sender as sender => move |_p, _uri| {
sender.send(Action::VideoReady).unwrap();
}),
);
self.player.connect_end_of_stream(move |p| p.stop());
let video_file = gio::File::new_for_path(config::VIDEO_PATH);
gtk::timeout_add(
500,
clone!(@strong self.player as player => move || {
player.set_uri(&video_file.get_uri());
glib::Continue(false)
}),
);
};
let title = gtk::Label::new(Some(&gettext("Start the Tour")));
title.set_margin_top(36);
title.add_css_class("title-1");
container.append(&title);
let name = glib::os_info("NAME").unwrap_or_else(|| "GNOME".into());
let version = glib::os_info("VERSION").unwrap_or_else(|| "".into());
// Translators: The following string is formated as "Learn about new and essential features in GNOME 3.36" for example
let text = gtk::Label::new(Some(&i18n_f(
"Learn about the key features in {} {}.",
&[&name, &version],
)));
text.add_css_class("body");
text.set_margin_top(12);
container.append(&text);
self.widget.append(&clamp);
}
}
use crate::{utils::i18n_f, widgets::ImagePageWidget};
use gettextrs::gettext;
use gtk::glib::{self, clone};
use gtk::prelude::*;
use std::cell::RefCell;
use std::rc::Rc;
pub struct PaginatorWidget {
pub widget: gtk::Box,
carousel: libadwaita::Carousel,
carousel_dots: libadwaita::CarouselIndicatorDots,
headerbar: gtk::HeaderBar,
pages: RefCell<Vec<gtk::Widget>>,
current_page: RefCell<u32>,
next_overlay: gtk::Overlay,
next_btn: gtk::Button,
start_btn: gtk::Button,
finish_btn: gtk::Button,
close_btn: gtk::Button,
previous_btn: gtk::Button,
use gtk::{
gdk,
glib::{self, clone},
subclass::prelude::*,
};
mod imp {
use super::*;
use std::cell::Cell;
use std::cell::RefCell;
#[derive(Debug, gtk::CompositeTemplate)]
#[template(resource = "/org/gnome/Tour/ui/paginator.ui")]
pub struct PaginatorWidget {
#[template_child]
pub(super) carousel: TemplateChild<adw::Carousel>,
pub(super) pages: RefCell<Vec<gtk::Widget>>,
pub(super) current_page: Cell<u32>,
#[template_child]
pub(super) next_btn: TemplateChild<gtk::Button>,
#[template_child]
pub(super) start_btn: TemplateChild<gtk::Button>,
#[template_child]
pub(super) previous_btn: TemplateChild<gtk::Button>,
pub(super) going_backward: Cell<bool>,
}
impl Default for PaginatorWidget {
fn default() -> Self {
Self {
carousel: TemplateChild::default(),
start_btn: TemplateChild::default(),
next_btn: TemplateChild::default(),
previous_btn: TemplateChild::default(),
pages: RefCell::new(Vec::new()),
current_page: Cell::new(0),
going_backward: Cell::new(false),
}
}
}
#[glib::object_subclass]
impl ObjectSubclass for PaginatorWidget {
const NAME: &'static str = "PaginatorWidget";
type ParentType = gtk::Box;
type Type = super::PaginatorWidget;
type Interfaces = (gtk::Buildable,);
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);
}
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
obj.init_template();
}
}
impl ObjectImpl for PaginatorWidget {
fn constructed(&self, obj: &Self::Type) {
let layout_manager = obj
.layout_manager()
.map(|l| l.downcast::<gtk::BoxLayout>().unwrap())
.unwrap();
layout_manager.set_orientation(gtk::Orientation::Vertical);
self.carousel
.set_scroll_params(&adw::SpringParams::new(1.0, 0.5, 300.0));
self.carousel
.connect_position_notify(clone!(@weak obj => move |_| {
obj.update_position();
}));
let name = glib::os_info("NAME").unwrap_or_else(|| "GNOME".into());
let version = glib::os_info("VERSION").unwrap_or_else(|| "".into());
// Translators: The following string is formated as "Learn about new and essential features in GNOME 3.36" for example
let body = i18n_f("Learn about the key features in {} {}.", &[&name, &version]);
let welcome_page = ImagePageWidget::new(
"/org/gnome/Tour/welcome.svg",
gettext("Start the Tour"),
body,
);
obj.add_page(Some(-1), welcome_page);
let controller = gtk::EventControllerKey::new();
controller.connect_key_pressed(clone!(@weak obj => @default-return gtk::Inhibit(true), move |_controller, keyval, _keycode, _state| {
if keyval == gdk::Key::Right {
obj.try_next();
} else if keyval == gdk::Key::Left {
obj.try_previous();
}
gtk::Inhibit(false)
}));
obj.add_controller(&controller);
self.parent_constructed(obj);
}
}
impl WidgetImpl for PaginatorWidget {}
impl BoxImpl for PaginatorWidget {}
impl BuildableImpl for PaginatorWidget {
fn add_child(
&self,
buildable: &Self::Type,
builder: &gtk::Builder,
child: &glib::Object,
type_: Option<&str>,
) {
if !self.carousel.is_bound() {
self.parent_add_child(buildable, builder, child, type_);
} else {
buildable.add_page(None, child.clone().downcast::<gtk::Widget>().unwrap());
}
}
}
}
glib::wrapper! {
pub struct PaginatorWidget(ObjectSubclass<imp::PaginatorWidget>)
@extends gtk::Widget, gtk::Box,
@implements gtk::Buildable;
}
impl PaginatorWidget {
pub fn new() -> Rc<Self> {
let widget = gtk::Box::new(gtk::Orientation::Vertical, 0);
let paginator = Rc::new(Self {
widget,
carousel: libadwaita::Carousel::new(),
carousel_dots: libadwaita::CarouselIndicatorDots::new(),
headerbar: gtk::HeaderBar::builder().show_title_buttons(false).build(),
start_btn: gtk::Button::with_label(&gettext("_Start")),
next_overlay: gtk::Overlay::new(),
next_btn: gtk::Button::with_label(&gettext("_Next")),
finish_btn: gtk::Button::with_label(&gettext("_Close")),
close_btn: gtk::Button::with_label(&gettext("_Close")),
previous_btn: gtk::Button::with_label(&gettext("_Previous")),
pages: RefCell::new(Vec::new()),
current_page: RefCell::new(0),
});
paginator.init(paginator.clone());
paginator
pub fn new() -> Self {
glib::Object::new(&[]).unwrap()
}
pub fn try_next(&self) -> Option<()> {
let p = *self.current_page.borrow() + 1;
if p == self.carousel.n_pages() {
let imp = self.imp();
let p = imp.current_page.get() + 1;
if p == imp.carousel.n_pages() {
return None;
}
self.set_page(p);
......@@ -51,7 +139,7 @@ impl PaginatorWidget {
}
pub fn try_previous(&self) -> Option<()> {
let p = *self.current_page.borrow();
let p = self.imp().current_page.get();
if p == 0 {
return None;
}
......@@ -59,117 +147,86 @@ impl PaginatorWidget {
Some(())
}
pub fn add_page(&self, page: gtk::Widget) {
let page_nr = self.pages.borrow().len();
self.carousel.insert(&page, page_nr as i32);
self.pages.borrow_mut().push(page);
pub fn add_page(&self, at: Option<i32>, page: impl IsA<gtk::Widget>) {
let imp = self.imp();
let page_nr = imp.pages.borrow().len();
imp.carousel.insert(&page, at.unwrap_or(page_nr as i32));
imp.pages.borrow_mut().push(page.upcast());
self.update_position();
}
fn update_position(&self) {
let position = self.carousel.position();
let imp = self.imp();
let position = imp.carousel.position();
let page_nr = position.round() as u32;
let n_pages = self.carousel.n_pages() as f64;
let n_pages = imp.carousel.n_pages() as f64;
let forelast_page = n_pages - 2.0;
let last_page = n_pages - 1.0;
let (opacity_finish, opacity_previous, opacity_start, opacity_next, opacity_close) =
if (0.0..1.0).contains(&position) {
if position == 0.0 {
(0.0, position, 1.0, position, 1.0)
} else {
(0.0, position, 1.0, position, 1f64 - position)
}
} else if (0.0 <= position) && (position <= forelast_page) {
(0.0, 1.0, 1f64 - position, 1.0, 0.0)
} else if (forelast_page < position) && (position <= last_page) {
(position - forelast_page, 1.0, 0.0, 1.0, 0.0)
} else {
panic!("Position of the carousel is outside the allowed range");
};
let (opacity_previous, opacity_start, opacity_next) = if (0.0..1.0).contains(&position) {
(position, 1.0 - position, position)
} else if position <= forelast_page {
(1.0, 0.0, 1.0)
} else if position > forelast_page {
(1.0, 0.0, last_page - position)
} else {
panic!("Position of the carousel is outside the allowed range");
};
self.start_btn.set_opacity(opacity_start);
self.start_btn.set_visible(opacity_start > 0_f64);
// While transitioning to the last page the next button is still visible
// pressing it would crash the app so we make it not targetable.
let can_target_start = opacity_next < f64::EPSILON;
let can_target_next = opacity_next > 0_f64 && position <= forelast_page;
self.next_btn.set_opacity(opacity_next);
self.next_btn.set_visible(opacity_next > 0_f64);
self.next_overlay.set_can_target(opacity_next > 0_f64);
log::debug!("page number {}/{}", page_nr, last_page);
self.finish_btn.set_opacity(opacity_finish);
self.finish_btn.set_visible(opacity_finish > 0_f64);
imp.start_btn.set_opacity(opacity_start);
imp.start_btn.set_visible(opacity_start > 0_f64);
imp.start_btn.set_can_target(can_target_start);
self.previous_btn.set_opacity(opacity_previous);
self.previous_btn.set_visible(opacity_previous > 0_f64);
imp.next_btn.set_opacity(opacity_next);
imp.next_btn.set_visible(opacity_next > 0_f64);
imp.next_btn.set_can_target(can_target_next);
self.close_btn.set_opacity(opacity_close);
self.start_btn.set_visible(opacity_close > 0_f64);
imp.previous_btn.set_opacity(opacity_previous);
imp.previous_btn.set_visible(opacity_previous > 0_f64);
self.current_page.replace(page_nr);
imp.current_page.set(page_nr);
}
fn init(&self, p: Rc<Self>) {
self.carousel_dots.set_carousel(Some(&self.carousel));
self.carousel.set_hexpand(true);
self.carousel.set_vexpand(true);
self.carousel
.set_scroll_params(&libadwaita::SpringParams::new(1.0, 0.5, 300.0));
self.carousel
.connect_position_notify(clone!(@weak p => move |_| {
p.update_position();
}));
self.start_btn.add_css_class("suggested-action");
self.start_btn.set_use_underline(true);
self.start_btn.set_action_name(Some("app.start-tour"));
self.next_btn.add_css_class("suggested-action");
self.next_btn.set_use_underline(true);
self.next_btn.set_action_name(Some("app.next-page"));
self.close_btn.set_use_underline(true);
self.close_btn.set_action_name(Some("app.quit"));
self.finish_btn.add_css_class("suggested-action");
self.finish_btn.set_use_underline(true);
self.finish_btn.set_action_name(Some("app.quit"));
self.previous_btn.set_use_underline(true);
self.previous_btn.set_action_name(Some("app.previous-page"));
self.next_overlay.set_child(Some(&self.next_btn));
self.next_overlay.add_overlay(&self.finish_btn);
self.next_overlay.set_can_target(false);
let previous_overlay = gtk::Overlay::new();
previous_overlay.set_child(Some(&self.close_btn));
previous_overlay.add_overlay(&self.previous_btn);
let start_overlay = gtk::Overlay::new();
start_overlay.set_child(Some(&self.start_btn));
start_overlay.add_overlay(&self.next_overlay);
let btn_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Horizontal);
btn_size_group.add_widget(&self.previous_btn);
btn_size_group.add_widget(&self.close_btn);
btn_size_group.add_widget(&self.next_overlay);
btn_size_group.add_widget(&start_overlay);
btn_size_group.add_widget(&self.finish_btn);
pub fn set_page(&self, page_nr: u32) {
let imp = self.imp();
let total_pages = imp.carousel.n_pages();
self.headerbar.set_title_widget(Some(&self.carousel_dots));
self.headerbar.pack_start(&previous_overlay);
self.headerbar.pack_end(&start_overlay);
if page_nr == total_pages - 1 {
imp.going_backward.set(true);
} else if page_nr == 0 {
imp.going_backward.set(false);
}
self.widget.append(&self.headerbar);
self.widget.append(&self.carousel);
}
if !imp.going_backward.get() {
if page_nr == 0 {
imp.start_btn.grab_focus();
} else {
imp.next_btn.grab_focus();
}
} else {
imp.previous_btn.grab_focus();
}
pub fn set_page(&self, page_nr: u32) {
if page_nr < self.carousel.n_pages() {
let pages = &self.pages.borrow();
if page_nr < imp.carousel.n_pages() {
let pages = &imp.pages.borrow();
let page = pages.get(page_nr as usize).unwrap();
self.carousel.scroll_to(page, true);
imp.carousel.scroll_to(page, true);
}
}
}
impl Default for PaginatorWidget {
fn default() -> Self {
Self::new()
}
}
use gettextrs::gettext;
use gtk::glib;
use gtk::prelude::*;
use libadwaita::traits::ApplicationWindowExt;
use std::cell::RefCell;
use std::rc::Rc;
use adw::prelude::*;
use gtk::subclass::prelude::*;
use gtk::{gio, glib};
use super::pages::{ImagePageWidget, WelcomePageWidget};
use super::paginator::PaginatorWidget;
use crate::config::{APP_ID, PROFILE};
pub struct Window {
pub widget: libadwaita::ApplicationWindow,
pub paginator: RefCell<Rc<PaginatorWidget>>,
}
impl Window {
pub fn new(app: &libadwaita::Application) -> Self {
let widget = libadwaita::ApplicationWindow::new(app);
let paginator = RefCell::new(PaginatorWidget::new());
let mut window_widget = Window { widget, paginator };
window_widget.init();
window_widget
use crate::Application;
mod imp {
use super::*;
use crate::config;
use crate::widgets::ImagePageWidget;
use adw::subclass::prelude::*;
#[derive(Debug, Default, gtk::CompositeTemplate)]
#[template(resource = "/org/gnome/Tour/ui/window.ui")]
pub struct Window {
#[template_child]
pub(super) paginator: TemplateChild<PaginatorWidget>,
}
pub fn start_tour(&self) {
self.paginator.borrow_mut().set_page(1);
}
#[glib::object_subclass]
impl ObjectSubclass for Window {
const NAME: &'static str = "Window";
type Type = super::Window;
type ParentType = adw::ApplicationWindow;
pub fn reset_tour(&self) {
self.paginator.borrow_mut().set_page(0);
fn class_init(klass: &mut Self::Class) {
ImagePageWidget::static_type();
Self::bind_template(klass);
}
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
obj.init_template();
}
}
fn init(&mut self) {
self.widget.set_default_size(960, 720);
self.widget.set_icon_name(Some(APP_ID));
impl ObjectImpl for Window {
fn constructed(&self, widget: &Self::Type) {
widget.set_icon_name(Some(config::APP_ID));
// Devel Profile
if PROFILE == "Devel" {
self.widget.add_css_class("devel");
// Devel Profile
if config::PROFILE == "Devel" {
widget.add_css_class("devel");
}
self.parent_constructed(widget);
}
self.paginator
.borrow_mut()
.add_page(WelcomePageWidget::new().widget.upcast::<gtk::Widget>());
self.paginator.borrow_mut().add_page(
ImagePageWidget::new(
"/org/gnome/Tour/overview.svg",
gettext("Get an Overview"),
gettext("Press the Super key to see open windows and apps."),
)
.widget
.upcast::<gtk::Widget>(),
);
self.paginator.borrow_mut().add_page(
ImagePageWidget::new(
"/org/gnome/Tour/search.svg",
gettext("Just Type to Search"),
gettext("Type in the overview to search. Launch apps, find things."),
)
.widget
.upcast::<gtk::Widget>(),
);
}
impl WidgetImpl for Window {}
impl WindowImpl for Window {}
impl ApplicationWindowImpl for Window {}
impl AdwApplicationWindowImpl for Window {}
}
self.paginator.borrow_mut().add_page(
ImagePageWidget::new(
"/org/gnome/Tour/workspaces.svg",
gettext("Keep on Top with Workspaces"),
gettext("Easily organize windows with the workspaces view."),
)
.widget
.upcast::<gtk::Widget>(),
);
glib::wrapper! {
pub struct Window(ObjectSubclass<imp::Window>)
@extends gtk::Widget, gtk::Window, gtk::ApplicationWindow, adw::ApplicationWindow,
@implements gio::ActionMap, gio::ActionGroup;
}
self.paginator.borrow_mut().add_page(
ImagePageWidget::new(
"/org/gnome/Tour/blank.svg",
gettext("Up/Down for the Overview"),
gettext("On a touchpad, use three-finger vertical swipes. Try it!"),
)
.widget
.upcast::<gtk::Widget>(),
);
impl Window {
pub fn new(app: &Application) -> Self {
glib::Object::new(&[("application", app)]).unwrap()
}
self.paginator.borrow_mut().add_page(
ImagePageWidget::new(
"/org/gnome/Tour/blank.svg",
gettext("Left/Right for Workspaces"),
gettext("On a touchpad, use three-finger horizontal swipes. Try it!"),
)
.widget
.upcast::<gtk::Widget>(),
);
pub fn paginator(&self) -> PaginatorWidget {
self.imp().paginator.clone()
}
let last_page = ImagePageWidget::new(
"/org/gnome/Tour/ready-to-go.svg",
gettext("That's it. Have a nice day!"),
gettext("To get more advice and tips, see the Help app."),
);
last_page.widget.add_css_class("last-page");
self.paginator
.borrow_mut()
.add_page(last_page.widget.upcast::<gtk::Widget>());
pub fn start_tour(&self) {
self.imp().paginator.set_page(1);
}
self.widget
.set_content(Some(&self.paginator.borrow().widget));
pub fn reset_tour(&self) {
self.imp().paginator.set_page(0);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment