Commit e5d70d9c authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

update labels & set a smaller size by default

parent 6579f486
......@@ -33,6 +33,7 @@ impl Application {
app.quit();
}),
);
// Start Tour
utils::action(
&self.app,
......@@ -64,6 +65,7 @@ impl Application {
}
}),
);
utils::action(
&self.app,
"previous-page",
......@@ -75,6 +77,7 @@ impl Application {
}
}),
);
self.app.set_accels_for_action("app.quit", &["<primary>q"]);
}
......
// based on https://gitlab.gnome.org/World/podcasts/-/blob/master/podcasts-gtk/src/i18n|utils.rs
use gettextrs::gettext;
pub fn action<T, F>(thing: &T, name: &str, action: F)
where
T: gio::ActionMapExt,
......@@ -10,3 +13,13 @@ where
// Add it to the map
thing.add_action(&act);
}
pub fn i18n_f(format: &str, args: &[&str]) -> String {
let s = gettext(format);
let mut parts = s.split("{}");
let mut output = parts.next().unwrap_or("").to_string();
for (p, a) in parts.zip(args.iter()) {
output += &(a.to_string() + &p.to_string());
}
output
}
......@@ -34,7 +34,10 @@ impl ImagePageWidget {
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);
container.set_margin_bottom(48);
container.set_margin_top(12);
container.set_margin_start(12);
container.set_margin_end(12);
let image = gtk::Image::from_resource(&resource_uri);
image.set_valign(gtk::Align::Start);
......
use crate::utils;
use gettextrs::gettext;
use gtk::prelude::*;
use std::cell::RefCell;
......@@ -34,7 +35,7 @@ impl Window {
}
fn init(&mut self) {
self.widget.set_default_size(920, 640);
self.widget.set_default_size(720, 500);
self.widget.set_icon_name(Some(APP_ID));
// Devel Profile
......@@ -71,6 +72,7 @@ impl Window {
gettext("View system information and settings"),
gettext("Get an overview of the system status and quickly change settings."),
)));
self.paginator.borrow_mut().add_page(Box::new(ImagePageWidget::new(
"/org/gnome/Tour/software.svg",
gettext("Software"),
......@@ -78,10 +80,11 @@ impl Window {
gettext("Discover great apps through search, browsing and our recommendations."),
)));
let name = glib::get_os_info("NAME").unwrap_or("GNOME".into());
let last_page = ImagePageWidget::new(
"/org/gnome/Tour/ready-to-go.svg",
gettext("Tour Completed"),
gettext("That's it! We hope that you enjoy NAME OF DISTRO."),
utils::i18n_f("That's it! We hope that you enjoy {}.", &[&name]),
gettext("To get more advice and tips, see the Help app."),
);
last_page.widget.get_style_context().add_class("last-page");
......
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