Commit 81dc8443 authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

surround the welcome page with a handy handle

parent b51e78f3
...@@ -6,12 +6,12 @@ use gio::FileExt; ...@@ -6,12 +6,12 @@ use gio::FileExt;
use gtk::prelude::*; use gtk::prelude::*;
pub struct WelcomePageWidget { pub struct WelcomePageWidget {
pub widget: gtk::Box, pub widget: libhandy::WindowHandle,
} }
impl WelcomePageWidget { impl WelcomePageWidget {
pub fn new() -> Self { pub fn new() -> Self {
let widget = gtk::Box::new(gtk::Orientation::Vertical, 0); let widget = libhandy::WindowHandle::new();
let welcome_page = Self { widget }; let welcome_page = Self { widget };
welcome_page.init(); welcome_page.init();
...@@ -65,29 +65,31 @@ impl WelcomePageWidget { ...@@ -65,29 +65,31 @@ impl WelcomePageWidget {
} }
fn init(&self) { fn init(&self) {
self.widget.set_property_expand(true); let container = gtk::Box::new(gtk::Orientation::Vertical, 0);
self.widget.set_valign(gtk::Align::Center);
self.widget.set_halign(gtk::Align::Center); container.set_property_expand(true);
self.widget.set_margin_top(24); container.set_valign(gtk::Align::Center);
self.widget.set_margin_bottom(24); container.set_halign(gtk::Align::Center);
container.set_margin_top(24);
container.set_margin_bottom(24);
let name = glib::get_os_info("NAME").unwrap_or_else(|| "GNOME".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 version = glib::get_os_info("VERSION").unwrap_or_else(|| "3.36".into());
let header = self.get_header_widget(); let header = self.get_header_widget();
self.widget.add(&header); container.add(&header);
let title = gtk::Label::new(Some(&gettext(format!("Welcome to {} {}", name, version)))); let title = gtk::Label::new(Some(&gettext(format!("Welcome to {} {}", name, version))));
title.set_margin_top(36); title.set_margin_top(36);
title.get_style_context().add_class("large-title"); title.get_style_context().add_class("large-title");
title.show(); title.show();
self.widget.add(&title); container.add(&title);
let text = gtk::Label::new(Some(&gettext("Hi there! Take the tour to learn your way around and discover essential features."))); 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.get_style_context().add_class("body");
text.set_margin_top(12); text.set_margin_top(12);
text.show(); text.show();
self.widget.add(&text); container.add(&text);
let actions_container = gtk::Box::new(gtk::Orientation::Horizontal, 12); let actions_container = gtk::Box::new(gtk::Orientation::Horizontal, 12);
actions_container.set_halign(gtk::Align::Center); actions_container.set_halign(gtk::Align::Center);
...@@ -113,7 +115,10 @@ impl WelcomePageWidget { ...@@ -113,7 +115,10 @@ impl WelcomePageWidget {
actions_container.show(); actions_container.show();
self.widget.add(&actions_container); container.add(&actions_container);
container.show();
self.widget.add(&container);
self.widget.show(); self.widget.show();
} }
} }
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