[gnome-tour/bilelmoussaoui/video: 2/2] add a welcome video page




commit 32d608f809a80c2804760d79396d02d6e919a846
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Fri Aug 7 19:22:49 2020 +0200

    add a welcome video page

 Cargo.lock                         | 200 +++++++++++++++++++++++++++++++++++++
 Cargo.toml                         |   8 ++
 data/resources.gresource.xml       |   1 +
 data/resources/assets/welcome.mp4  | Bin 0 -> 432016 bytes
 src/main.rs                        |   2 +-
 src/meson.build                    |   1 +
 src/widgets/pages/mod.rs           |   2 +
 src/widgets/pages/welcome_video.rs |  94 +++++++++++++++++
 src/widgets/window.rs              |   4 +-
 9 files changed, 309 insertions(+), 3 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index fb0cb0f..40990fc 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -47,6 +47,11 @@ dependencies = [
  "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "autocfg"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+
 [[package]]
 name = "bitflags"
 version = "1.2.1"
@@ -349,6 +354,8 @@ dependencies = [
  "gettext-rs 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "gio 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "glib 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-player 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "gtk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "libhandy 1.0.0-alpha (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -365,6 +372,129 @@ dependencies = [
  "system-deps 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "gstreamer"
+version = "0.16.2"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "futures-channel 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "futures-core 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "futures-util 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
+ "muldiv 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-rational 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "once_cell 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pretty-hex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "thiserror 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "gstreamer-base"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-base-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "gstreamer-base-sys"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "glib-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
+ "system-deps 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "gstreamer-player"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-player-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-video 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "gstreamer-player-sys"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "glib-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-video-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
+ "system-deps 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "gstreamer-sys"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "glib-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
+ "system-deps 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "gstreamer-video"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "futures-channel 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "futures-util 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-base 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-base-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-video-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
+ "once_cell 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "gstreamer-video-sys"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "glib-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-base-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gstreamer-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
+ "system-deps 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "gtk"
 version = "0.9.0"
@@ -514,6 +644,38 @@ name = "memchr"
 version = "2.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 
+[[package]]
+name = "muldiv"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+
+[[package]]
+name = "num-integer"
+version = "0.1.43"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "num-rational"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "num-traits"
+version = "0.2.12"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "once_cell"
 version = "1.4.0"
@@ -544,6 +706,23 @@ dependencies = [
  "system-deps 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "paste"
+version = "0.1.18"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "paste-impl"
+version = "0.1.18"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "pin-project"
 version = "0.4.22"
@@ -572,6 +751,11 @@ name = "pkg-config"
 version = "0.3.14"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 
+[[package]]
+name = "pretty-hex"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+
 [[package]]
 name = "pretty_env_logger"
 version = "0.4.0"
@@ -834,6 +1018,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 "checksum atk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"812b4911e210bd51b24596244523c856ca749e6223c50a7fbbba3f89ee37c426"
 "checksum atk-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"f530e4af131d94cc4fa15c5c9d0348f0ef28bac64ba660b6b2a1cf2605dedfce"
 "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = 
"d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
+"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
 "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
 "checksum cairo-rs 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"c5c0f2e047e8ca53d0ff249c54ae047931d7a6ebe05d00af73e0ffeb6e34bdb8"
 "checksum cairo-sys-rs 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"2ed2639b9ad5f1d6efa76de95558e11339e7318426d84ac4890b86c03e828ca7"
@@ -862,6 +1047,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 "checksum glib-macros 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"41486a26d1366a8032b160b59065a59fb528530a46a49f627e7048fb8c064039"
 "checksum glib-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"b6cda4af5c2f4507b7a3535b798dca2135293f4bc3a17f399ce244ef15841c4c"
 "checksum gobject-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"952133b60c318a62bf82ee75b93acc7e84028a093e06b9e27981c2b6fe68218c"
+"checksum gstreamer 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)" = 
"ce4ce1ba28d3293b8cb8c3d33f50e6da2e5cfeefa59a0d10d922ab8015791609"
+"checksum gstreamer-base 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"872893487ce8876f18c63730402822804c5762869f631d8e3e6b18aafc8399f0"
+"checksum gstreamer-base-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"c0fd5a77d39b47568fba01274dfcb28dc32382513c697009f80b89ef63fd32fd"
+"checksum gstreamer-player 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"90e8a850be21b18fb21f21fa16394bfc176013f7fffdc6719db0ea23b3c99a2b"
+"checksum gstreamer-player-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"b9f0cd125febba8f9b3cae13881c0d845a77a4e4797b9552aa4058330c23e958"
+"checksum gstreamer-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"1321f34d53bb5f60ab1aaf581e29b664b8d41601714ee1bb7dbea490b5b9ff60"
+"checksum gstreamer-video 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"42a52c141d83113e6dd080347ca49ef9be296e7900e081f2b67eaad6a3d5ef26"
+"checksum gstreamer-video-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"d6f105143a7676d2032c386c10b2d376106b5562b7a11b694b634113456f1935"
 "checksum gtk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"3adf6adf7ba686d5e4f4dae32edfa12118af9469f67425f0afd075bf4a58ea9d"
 "checksum gtk-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"89acda6f084863307d948ba64a4b1ef674e8527dddab147ee4cdcc194c880457"
 "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
@@ -875,13 +1068,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 "checksum locale_config 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = 
"73ac19ebe45489e5d53b4346d8b90bb3dd03275c5fdf2ce22a982516d86b535c"
 "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = 
"14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
 "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
+"checksum muldiv 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"0419348c027fa7be448d2ae7ea0e4e04c2334c31dc4e74ab29f00a2a7ca69204"
+"checksum num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = 
"8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b"
+"checksum num-rational 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"a5b4d7360f362cfb50dde8143501e6940b22f644be75a4cc90b2d81968908138"
+"checksum num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = 
"ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611"
 "checksum once_cell 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d"
 "checksum pango 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"460dbe5ad850c46780ba61f142e966beacf5eebb09822830f796c91d7d4fec31"
 "checksum pango-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"24d2650c8b62d116c020abd0cea26a4ed96526afda89b1c4ea567131fdefc890"
+"checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = 
"45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880"
+"checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = 
"d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6"
 "checksum pin-project 0.4.22 (registry+https://github.com/rust-lang/crates.io-index)" = 
"12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17"
 "checksum pin-project-internal 0.4.22 (registry+https://github.com/rust-lang/crates.io-index)" = 
"6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7"
 "checksum pin-utils 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
 "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = 
"676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
+"checksum pretty-hex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"be91bcc43e73799dc46a6c194a55e7aae1d86cc867c860fd4a436019af21bd8c"
 "checksum pretty_env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d"
 "checksum proc-macro-crate 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = 
"1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
 "checksum proc-macro-error 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = 
"fc175e9777c3116627248584e8f8b3e2987405cabe1c0adf7d1dd28f09dc7880"
diff --git a/Cargo.toml b/Cargo.toml
index 27b0e6d..5cccfc5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,3 +14,11 @@ gettext-rs = { version = "0.4", features = ["gettext-system"] }
 libhandy = "1.0.0-alpha"
 pretty_env_logger = "0.4"
 anyhow = "1.0"
+
+[dependencies.gst_player]
+version = "0.16"
+package = "gstreamer-player"
+
+[dependencies.gst]
+version = "0.16"
+package = "gstreamer"
diff --git a/data/resources.gresource.xml b/data/resources.gresource.xml
index 688446a..19c7242 100644
--- a/data/resources.gresource.xml
+++ b/data/resources.gresource.xml
@@ -2,6 +2,7 @@
 <gresources>
   <gresource prefix="/org/gnome/Tour/">
       <file compressed="true" alias="style.css">resources/style.css</file>
+      <file alias="welcome.mp4">resources/assets/welcome.mp4</file>
       <file compressed="true" alias="activities.svg">resources/assets/activities.svg</file>
       <file compressed="true" alias="calendar.svg">resources/assets/calendar.svg</file>
       <file compressed="true" alias="search.svg">resources/assets/search.svg</file>
diff --git a/data/resources/assets/welcome.mp4 b/data/resources/assets/welcome.mp4
new file mode 100644
index 0000000..7dca6c7
Binary files /dev/null and b/data/resources/assets/welcome.mp4 differ
diff --git a/src/main.rs b/src/main.rs
index 67b3384..2370965 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -25,7 +25,7 @@ fn main() {
     glib::set_prgname(Some("Tour"));
 
     gtk::init().expect("Unable to start GTK3");
-
+    gst::init().expect("Unable to start gst");
     static_resources::init().expect("Failed to initialize the resource file.");
 
     let app = Application::new();
diff --git a/src/meson.build b/src/meson.build
index 33879a0..83ea2ca 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -39,6 +39,7 @@ sources = files(
   'widgets/pages/image.rs',
   'widgets/pages/mod.rs',
   'widgets/pages/welcome.rs',
+  'widgets/pages/welcome_video.rs',
   'widgets/mod.rs',
   'widgets/paginator.rs',
   'widgets/window.rs',
diff --git a/src/widgets/pages/mod.rs b/src/widgets/pages/mod.rs
index 4c7ee37..259a734 100644
--- a/src/widgets/pages/mod.rs
+++ b/src/widgets/pages/mod.rs
@@ -1,5 +1,7 @@
 mod image;
 mod welcome;
+mod welcome_video;
 
 pub use image::ImagePageWidget;
 pub use welcome::WelcomePageWidget;
+pub use welcome_video::WelcomeVideoPageWidget;
diff --git a/src/widgets/pages/welcome_video.rs b/src/widgets/pages/welcome_video.rs
new file mode 100644
index 0000000..7176d2b
--- /dev/null
+++ b/src/widgets/pages/welcome_video.rs
@@ -0,0 +1,94 @@
+use gettextrs::gettext;
+use gtk::prelude::*;
+
+// The welcome page with a video instead of a static logo
+pub struct WelcomeVideoPageWidget {
+    pub widget: gtk::Box,
+}
+
+impl WelcomeVideoPageWidget {
+    pub fn new() -> Self {
+        let widget = gtk::Box::new(gtk::Orientation::Vertical, 0);
+        let welcome_page = Self { widget };
+
+        welcome_page.init();
+        welcome_page
+    }
+
+    fn init(&self) {
+        self.widget.set_property_expand(true);
+        self.widget.set_valign(gtk::Align::Center);
+        self.widget.set_halign(gtk::Align::Center);
+        self.widget.set_margin_top(24);
+        self.widget.set_margin_bottom(24);
+
+        let name = glib::get_os_info("NAME").unwrap_or_else(|| "GNOME".into());
+        let version = glib::get_os_info("VERSION").unwrap_or_else(|| "3.36".into());
+
+        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();
+        let player = gst_player::Player::new(Some(&renderer), 
Some(&dispatcher.upcast::<gst_player::PlayerSignalDispatcher>()));
+        player.set_uri("/org/gnome/Tour/welcome.mp4");
+
+        let video_widget = 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, 720);
+        video_widget.show();
+        gtk::idle_add(clone!(@strong player => move || {
+            player.play();
+            glib::Continue(false)
+        }));
+
+        self.widget.add(&video_widget);
+
+        let title = gtk::Label::new(Some(&gettext(format!("Welcome to {} {}", name, version))));
+        title.set_margin_top(36);
+        title.get_style_context().add_class("large-title");
+        title.show();
+        self.widget.add(&title);
+
+        let text = gtk::Label::new(Some(&gettext("Hi there! Take the tour to learn your way around and 
discover essential features.")));
+        text.get_style_context().add_class("body");
+        text.set_margin_top(12);
+        text.show();
+        self.widget.add(&text);
+
+        let actions_container = gtk::Box::new(gtk::Orientation::Horizontal, 12);
+        actions_container.set_halign(gtk::Align::Center);
+        actions_container.set_margin_top(36);
+
+        let skip_tour_btn = gtk::Button::with_label(&gettext("_No Thanks"));
+        skip_tour_btn.set_property_height_request(40);
+        skip_tour_btn.set_property_width_request(180);
+        skip_tour_btn.set_use_underline(true);
+        skip_tour_btn.set_action_name(Some("app.skip-tour"));
+        skip_tour_btn.show();
+        actions_container.add(&skip_tour_btn);
+
+        let start_tour_btn = gtk::Button::with_label(&gettext("_Start Tour"));
+        start_tour_btn.set_property_height_request(40);
+        start_tour_btn.set_property_width_request(180);
+        start_tour_btn.set_use_underline(true);
+        start_tour_btn.set_action_name(Some("app.start-tour"));
+        start_tour_btn.get_style_context().add_class("suggested-action");
+        start_tour_btn.show();
+        actions_container.add(&start_tour_btn);
+        actions_container.set_focus_child(Some(&start_tour_btn));
+
+        actions_container.show();
+
+        self.widget.add(&actions_container);
+        self.widget.show();
+    }
+}
diff --git a/src/widgets/window.rs b/src/widgets/window.rs
index 1f79740..6a0d04f 100644
--- a/src/widgets/window.rs
+++ b/src/widgets/window.rs
@@ -4,7 +4,7 @@ use gtk::prelude::*;
 use std::cell::RefCell;
 use std::rc::Rc;
 
-use super::pages::{ImagePageWidget, WelcomePageWidget};
+use super::pages::{ImagePageWidget, WelcomePageWidget, WelcomeVideoPageWidget};
 use super::paginator::PaginatorWidget;
 use crate::config::{APP_ID, PROFILE};
 
@@ -42,7 +42,7 @@ impl Window {
         if PROFILE == "Devel" {
             self.widget.get_style_context().add_class("devel");
         }
-        self.paginator.borrow_mut().add_page(WelcomePageWidget::new().widget.upcast::<gtk::Widget>());
+        self.paginator.borrow_mut().add_page(WelcomeVideoPageWidget::new().widget.upcast::<gtk::Widget>());
 
         self.paginator.borrow_mut().add_page(
             ImagePageWidget::new(


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]