[gnome-tour/bilelmoussaoui/video] surround the welcome page with a handy handle
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tour/bilelmoussaoui/video] surround the welcome page with a handy handle
- Date: Mon, 10 Aug 2020 09:45:38 +0000 (UTC)
commit 4601bc3b1cd270f5eaf5e2ec2680e758331d4122
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date: Mon Aug 10 11:45:14 2020 +0200
surround the welcome page with a handy handle
src/widgets/pages/welcome.rs | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/src/widgets/pages/welcome.rs b/src/widgets/pages/welcome.rs
index 32dca9c..faaf892 100644
--- a/src/widgets/pages/welcome.rs
+++ b/src/widgets/pages/welcome.rs
@@ -6,12 +6,12 @@ use gio::FileExt;
use gtk::prelude::*;
pub struct WelcomePageWidget {
- pub widget: gtk::Box,
+ pub widget: libhandy::WindowHandle,
}
impl WelcomePageWidget {
pub fn new() -> Self {
- let widget = gtk::Box::new(gtk::Orientation::Vertical, 0);
+ let widget = libhandy::WindowHandle::new();
let welcome_page = Self { widget };
welcome_page.init();
@@ -65,29 +65,31 @@ impl WelcomePageWidget {
}
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 container = gtk::Box::new(gtk::Orientation::Vertical, 0);
+
+ container.set_property_expand(true);
+ container.set_valign(gtk::Align::Center);
+ 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 version = glib::get_os_info("VERSION").unwrap_or_else(|| "3.36".into());
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))));
title.set_margin_top(36);
title.get_style_context().add_class("large-title");
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.")));
text.get_style_context().add_class("body");
text.set_margin_top(12);
text.show();
- self.widget.add(&text);
+ container.add(&text);
let actions_container = gtk::Box::new(gtk::Orientation::Horizontal, 12);
actions_container.set_halign(gtk::Align::Center);
@@ -113,7 +115,10 @@ impl WelcomePageWidget {
actions_container.show();
- self.widget.add(&actions_container);
+ container.add(&actions_container);
+
+ container.show();
+ self.widget.add(&container);
self.widget.show();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]