Commit bfed29f9 authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

Last page: add a specific class

parent 17596715
...@@ -29,7 +29,7 @@ impl Pageable for ImagePageWidget { ...@@ -29,7 +29,7 @@ impl Pageable for ImagePageWidget {
impl ImagePageWidget { impl ImagePageWidget {
pub fn new(resource_uri: &str, title: String, head: String, body: String) -> Self { pub fn new(resource_uri: &str, title: String, head: String, body: String) -> Self {
let widget = gtk::Box::new(gtk::Orientation::Vertical, 12); let widget = gtk::Box::new(gtk::Orientation::Vertical, 0);
let image_page = Self { let image_page = Self {
widget, widget,
...@@ -44,21 +44,24 @@ impl ImagePageWidget { ...@@ -44,21 +44,24 @@ impl ImagePageWidget {
} }
fn init(&self) { fn init(&self) {
self.widget.set_halign(gtk::Align::Center); self.widget.set_halign(gtk::Align::Fill);
self.widget.set_valign(gtk::Align::Center); self.widget.set_valign(gtk::Align::Fill);
self.widget.set_property_margin(48);
let container = gtk::Box::new(gtk::Orientation::Vertical, 12);
container.set_halign(gtk::Align::Center);
container.set_valign(gtk::Align::Center);
container.set_property_margin(48);
let image = gtk::Picture::new_for_resource(Some(&self.resource_uri)); let image = gtk::Picture::new_for_resource(Some(&self.resource_uri));
image.set_valign(gtk::Align::Start); image.set_valign(gtk::Align::Start);
self.widget.add(&image); container.add(&image);
let head_label = gtk::Label::new(Some(&self.get_head())); let head_label = gtk::Label::new(Some(&self.get_head()));
head_label.set_justify(gtk::Justification::Center); head_label.set_justify(gtk::Justification::Center);
head_label.set_valign(gtk::Align::Center); head_label.set_valign(gtk::Align::Center);
head_label.set_margin_top(36); head_label.set_margin_top(36);
head_label.get_style_context().add_class("page-title"); head_label.get_style_context().add_class("page-title");
container.add(&head_label);
self.widget.add(&head_label);
let body_label = gtk::Label::new(Some(&self.get_body())); let body_label = gtk::Label::new(Some(&self.get_body()));
body_label.set_lines(2); body_label.set_lines(2);
...@@ -67,6 +70,8 @@ impl ImagePageWidget { ...@@ -67,6 +70,8 @@ impl ImagePageWidget {
body_label.set_valign(gtk::Align::Center); body_label.set_valign(gtk::Align::Center);
body_label.get_style_context().add_class("page-body"); body_label.get_style_context().add_class("page-body");
body_label.set_margin_top(12); body_label.set_margin_top(12);
self.widget.add(&body_label); container.add(&body_label);
self.widget.add(&container);
} }
} }
...@@ -123,12 +123,14 @@ impl Window { ...@@ -123,12 +123,14 @@ impl Window {
gettext("The Software app makese it easy to find and install all the apps you need."), gettext("The Software app makese it easy to find and install all the apps you need."),
))); )));
self.paginator.add_page(Box::new(ImagePageWidget::new( let last_page = ImagePageWidget::new(
"/org/gnome/Tour/ready-to-go.svg", "/org/gnome/Tour/ready-to-go.svg",
gettext("Learn More"), gettext("Learn More"),
gettext("That's it! To learn more, see the Help"), gettext("That's it! To learn more, see the Help"),
gettext("The help app contains information, tips and tricks."), gettext("The help app contains information, tips and tricks."),
))); );
last_page.widget.get_style_context().add_class("last-page");
self.paginator.add_page(Box::new(last_page));
self.container.add_named(&self.paginator.widget, "pages"); self.container.add_named(&self.paginator.widget, "pages");
self.widget.add(&self.container); self.widget.add(&self.container);
......
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