Commit fc8565f7 authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

use libhandy::CarouselIndicator

parent 4e28f59b
......@@ -350,7 +350,7 @@ dependencies = [
"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)",
"gtk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libhandy 1.0.0 (git+https://gitlab.gnome.org/World/Rust/libhandy-rs.git)",
"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)",
"pretty_env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
......@@ -453,8 +453,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libhandy"
version = "1.0.0"
source = "git+https://gitlab.gnome.org/World/Rust/libhandy-rs.git#8e83a51344d981f0cdb6a643ae3b6fc63b328d96"
version = "1.0.0-alpha"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -468,14 +468,14 @@ dependencies = [
"gtk-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
"libhandy-sys 1.0.0 (git+https://gitlab.gnome.org/World/Rust/libhandy-rs.git)",
"libhandy-sys 1.0.0-alpha (registry+https://github.com/rust-lang/crates.io-index)",
"pango 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libhandy-sys"
version = "1.0.0"
source = "git+https://gitlab.gnome.org/World/Rust/libhandy-rs.git#8e83a51344d981f0cdb6a643ae3b6fc63b328d96"
version = "1.0.0-alpha"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gdk 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf-sys 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -870,8 +870,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)" = "3262021842bf00fe07dbd6cf34ff25c99d7a7ebef8deea84db72be3ea3bb0aff"
"checksum libhandy 1.0.0 (git+https://gitlab.gnome.org/World/Rust/libhandy-rs.git)" = "<none>"
"checksum libhandy-sys 1.0.0 (git+https://gitlab.gnome.org/World/Rust/libhandy-rs.git)" = "<none>"
"checksum libhandy 1.0.0-alpha (registry+https://github.com/rust-lang/crates.io-index)" = "b9a7422b2333a10abc6075f7548c09f992907f73cb6da2e72de69c764def9378"
"checksum libhandy-sys 1.0.0-alpha (registry+https://github.com/rust-lang/crates.io-index)" = "6c134bdb832ef5d3812ba4aa7cd9220db6a532d8c856da66f66cfaca073b06eb"
"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"
......
......@@ -11,6 +11,6 @@ gtk = { version = "0.9", features= ["v3_16"] }
gio = "0.9"
log = "0.4"
gettext-rs = { version = "0.4", features = ["gettext-system"] }
libhandy = { git = "https://gitlab.gnome.org/World/Rust/libhandy-rs.git" }
libhandy = "1.0.0-alpha"
pretty_env_logger = "0.4"
anyhow = "1.0"
......@@ -48,7 +48,7 @@
"sources": [{
"type": "git",
"url": "https://gitlab.gnome.org/GNOME/libhandy.git",
"branch": "0.83.0"
"commit": "2e37d49b8b851315f3044aa53ccec67088859d76"
}]
},
{
......
......@@ -36,9 +36,9 @@ impl WelcomePageWidget {
self.widget.set_margin_top(24);
self.widget.set_margin_bottom(24);
let name = glib::get_os_info("NAME").unwrap_or("GNOME".into());
let version = glib::get_os_info("VERSION").unwrap_or("3.36".into());
let icon = glib::get_os_info("LOGO").unwrap_or("start-here-symbolic".into());
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 icon = glib::get_os_info("LOGO").unwrap_or_else(|| "start-here-symbolic".into());
let logo = gtk::Image::from_icon_name(Some(&icon), gtk::IconSize::Dialog);
logo.set_pixel_size(196);
......
......@@ -5,11 +5,12 @@ use std::cell::RefCell;
use std::rc::Rc;
use super::pages::Pageable;
use libhandy::prelude::{CarouselExt, HeaderBarExt};
use libhandy::prelude::{CarouselExt, CarouselIndicatorDotsExt, HeaderBarExt};
pub struct PaginatorWidget {
pub widget: gtk::Box,
carousel: libhandy::Carousel,
carousel_dots: libhandy::CarouselIndicatorDots,
headerbar: libhandy::HeaderBar,
pages: RefCell<Vec<Box<dyn Pageable>>>,
current_page: RefCell<u32>,
......@@ -25,6 +26,7 @@ impl PaginatorWidget {
let paginator = Rc::new(Self {
widget,
carousel: libhandy::Carousel::new(),
carousel_dots: libhandy::CarouselIndicatorDots::new(),
headerbar: libhandy::HeaderBar::new(),
next_btn: gtk::Button::with_label(&gettext("_Next")),
close_btn: gtk::Button::with_label(&gettext("_Close")),
......@@ -80,13 +82,13 @@ impl PaginatorWidget {
self.next_btn.set_opacity(opacity_next);
self.next_btn.set_visible(opacity_next > 0_f64);
let pages = &self.pages.borrow();
let page = pages.get(page_nr as usize).unwrap();
self.headerbar.set_title(Some(&page.get_title()));
self.headerbar.set_opacity(opacity_next);
self.current_page.replace(page_nr);
}
fn init(&self, p: Rc<Self>) {
self.carousel_dots.show();
self.carousel_dots.set_carousel(Some(&self.carousel));
self.carousel.set_property_expand(true);
self.carousel.set_animation_duration(300);
self.carousel.show();
......@@ -116,9 +118,11 @@ impl PaginatorWidget {
next_overlay.add_overlay(&self.close_btn);
next_overlay.show();
self.headerbar.set_custom_title(Some(&self.carousel_dots));
self.headerbar.pack_start(&self.previous_btn);
self.headerbar.pack_end(&next_overlay);
self.headerbar.set_show_close_button(false);
self.headerbar.set_opacity(0_f64);
self.headerbar.show();
self.widget.add(&self.headerbar);
......
......@@ -42,7 +42,6 @@ impl Window {
if PROFILE == "Devel" {
self.widget.get_style_context().add_class("devel");
}
self.paginator.borrow_mut().add_page(Box::new(WelcomePageWidget::new()));
self.paginator.borrow_mut().add_page(Box::new(ImagePageWidget::new(
......@@ -80,7 +79,7 @@ impl Window {
gettext("Discover great apps through search, browsing and our recommendations."),
)));
let name = glib::get_os_info("NAME").unwrap_or("GNOME".into());
let name = glib::get_os_info("NAME").unwrap_or_else(|| "GNOME".into());
let last_page = ImagePageWidget::new(
"/org/gnome/Tour/ready-to-go.svg",
gettext("Tour Completed"),
......
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