RR: Live retranslations
This commit is contained in:
parent
1f6e386175
commit
800293b37e
@ -78,7 +78,8 @@ pub fn automatic_partitioning(
|
|||||||
let devices_selection_expander_row_viewport =
|
let devices_selection_expander_row_viewport =
|
||||||
gtk::ScrolledWindow::builder().height_request(200).build();
|
gtk::ScrolledWindow::builder().height_request(200).build();
|
||||||
|
|
||||||
let devices_selection_expander_row_viewport_box = gtk::ListBox::builder().build();
|
let devices_selection_expander_row_viewport_box = gtk::ListBox::builder()
|
||||||
|
.build();
|
||||||
devices_selection_expander_row_viewport_box.add_css_class("boxed-list");
|
devices_selection_expander_row_viewport_box.add_css_class("boxed-list");
|
||||||
|
|
||||||
devices_selection_expander_row_viewport
|
devices_selection_expander_row_viewport
|
||||||
|
@ -18,14 +18,6 @@ use crate::efi_error_page::efi_error_page;
|
|||||||
|
|
||||||
use crate::language_page::language_page;
|
use crate::language_page::language_page;
|
||||||
|
|
||||||
use crate::eula_page::eula_page;
|
|
||||||
|
|
||||||
use crate::timezone_page::timezone_page;
|
|
||||||
|
|
||||||
use crate::keyboard_page::keyboard_page;
|
|
||||||
|
|
||||||
use crate::partitioning_page::partitioning_page;
|
|
||||||
|
|
||||||
// build ui function linked to app startup above
|
// build ui function linked to app startup above
|
||||||
pub fn build_ui(app: &adw::Application) {
|
pub fn build_ui(app: &adw::Application) {
|
||||||
// setup glib
|
// setup glib
|
||||||
@ -104,38 +96,7 @@ pub fn build_ui(app: &adw::Application) {
|
|||||||
// }));
|
// }));
|
||||||
|
|
||||||
// Add language_page.rs as a page for content_stack
|
// Add language_page.rs as a page for content_stack
|
||||||
language_page(&content_stack);
|
language_page(&content_stack, &window);
|
||||||
|
|
||||||
// Add eula_page.rs as a page for content_stack
|
|
||||||
eula_page(&content_stack);
|
|
||||||
|
|
||||||
// Add timezone_page.rs as a page for content_stack
|
|
||||||
timezone_page(&content_stack);
|
|
||||||
|
|
||||||
// Add keyboard_page.rs as a page for content_stack
|
|
||||||
keyboard_page(&content_stack);
|
|
||||||
|
|
||||||
// Add install_page.rs as a page for content_stack
|
|
||||||
let install_main_box = gtk::Box::builder()
|
|
||||||
.orientation(Orientation::Vertical)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let done_main_box = gtk::Box::builder()
|
|
||||||
.orientation(Orientation::Vertical)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// Add partitioning_page.rs as a page for content_stack
|
|
||||||
partitioning_page(&done_main_box, &install_main_box, &content_stack, &window);
|
|
||||||
|
|
||||||
//// Add the install_main_box as page: install_page, Give it nice title
|
|
||||||
content_stack.add_titled(
|
|
||||||
&install_main_box,
|
|
||||||
Some("install_page"),
|
|
||||||
&gettext("installation"),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add done_page.rs as a page for content_stack
|
|
||||||
content_stack.add_titled(&done_main_box, Some("done_page"), &gettext("done"));
|
|
||||||
|
|
||||||
// glib maximization
|
// glib maximization
|
||||||
if glib_settings.boolean("is-maximized") == true {
|
if glib_settings.boolean("is-maximized") == true {
|
||||||
|
@ -8,7 +8,9 @@ use gtk::*;
|
|||||||
|
|
||||||
use gettextrs::gettext;
|
use gettextrs::gettext;
|
||||||
|
|
||||||
pub fn eula_page(content_stack: >k::Stack) {
|
pub fn eula_page(content_stack: >k::Stack,
|
||||||
|
eula_main_box: >k::Box,
|
||||||
|
) {
|
||||||
// create the bottom box for next and back buttons
|
// create the bottom box for next and back buttons
|
||||||
let bottom_box = gtk::Box::builder()
|
let bottom_box = gtk::Box::builder()
|
||||||
.orientation(Orientation::Horizontal)
|
.orientation(Orientation::Horizontal)
|
||||||
@ -45,11 +47,6 @@ pub fn eula_page(content_stack: >k::Stack) {
|
|||||||
bottom_box.append(&bottom_back_button);
|
bottom_box.append(&bottom_back_button);
|
||||||
bottom_box.append(&bottom_next_button);
|
bottom_box.append(&bottom_next_button);
|
||||||
|
|
||||||
// the header box for the eula page
|
|
||||||
let eula_main_box = gtk::Box::builder()
|
|
||||||
.orientation(Orientation::Vertical)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// the header box for the eula page
|
// the header box for the eula page
|
||||||
let eula_header_box = gtk::Box::builder()
|
let eula_header_box = gtk::Box::builder()
|
||||||
.orientation(Orientation::Horizontal)
|
.orientation(Orientation::Horizontal)
|
||||||
@ -154,10 +151,6 @@ pub fn eula_page(content_stack: >k::Stack) {
|
|||||||
|
|
||||||
eula_main_box.append(&bottom_box);
|
eula_main_box.append(&bottom_box);
|
||||||
|
|
||||||
// / Content stack appends
|
|
||||||
//// Add the eula_main_box as page: eula_page, Give it nice title
|
|
||||||
content_stack.add_titled(&eula_main_box, Some("eula_page"), &gettext("eula"));
|
|
||||||
|
|
||||||
eula_accept_checkbutton.connect_toggled(
|
eula_accept_checkbutton.connect_toggled(
|
||||||
clone!(@weak eula_accept_checkbutton, @weak bottom_next_button => move |_| {
|
clone!(@weak eula_accept_checkbutton, @weak bottom_next_button => move |_| {
|
||||||
if eula_accept_checkbutton.is_active() == true {
|
if eula_accept_checkbutton.is_active() == true {
|
||||||
|
@ -19,7 +19,9 @@ use std::path::Path;
|
|||||||
|
|
||||||
use gnome_desktop::*;
|
use gnome_desktop::*;
|
||||||
|
|
||||||
pub fn keyboard_page(content_stack: >k::Stack) {
|
pub fn keyboard_page(content_stack: >k::Stack,
|
||||||
|
keyboard_main_box: >k::Box,
|
||||||
|
) {
|
||||||
// create the bottom box for next and back buttons
|
// create the bottom box for next and back buttons
|
||||||
let bottom_box = gtk::Box::builder()
|
let bottom_box = gtk::Box::builder()
|
||||||
.orientation(Orientation::Horizontal)
|
.orientation(Orientation::Horizontal)
|
||||||
@ -56,11 +58,6 @@ pub fn keyboard_page(content_stack: >k::Stack) {
|
|||||||
bottom_box.append(&bottom_back_button);
|
bottom_box.append(&bottom_back_button);
|
||||||
bottom_box.append(&bottom_next_button);
|
bottom_box.append(&bottom_next_button);
|
||||||
|
|
||||||
// the header box for the keyboard page
|
|
||||||
let keyboard_main_box = gtk::Box::builder()
|
|
||||||
.orientation(Orientation::Vertical)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// the header box for the keyboard page
|
// the header box for the keyboard page
|
||||||
let keyboard_header_box = gtk::Box::builder()
|
let keyboard_header_box = gtk::Box::builder()
|
||||||
.orientation(Orientation::Horizontal)
|
.orientation(Orientation::Horizontal)
|
||||||
@ -265,14 +262,6 @@ pub fn keyboard_page(content_stack: >k::Stack) {
|
|||||||
|
|
||||||
keyboard_main_box.append(&bottom_box);
|
keyboard_main_box.append(&bottom_box);
|
||||||
|
|
||||||
// / Content stack appends
|
|
||||||
//// Add the keyboard_main_box as page: keyboard_page, Give it nice title
|
|
||||||
content_stack.add_titled(
|
|
||||||
&keyboard_main_box,
|
|
||||||
Some("keyboard_page"),
|
|
||||||
&gettext("keyboard"),
|
|
||||||
);
|
|
||||||
|
|
||||||
let keyboard_data_buffer_clone = keyboard_data_buffer.clone();
|
let keyboard_data_buffer_clone = keyboard_data_buffer.clone();
|
||||||
|
|
||||||
keyboard_search_bar.connect_search_changed(clone!(@weak keyboard_search_bar, @weak keyboard_selection_expander_row_viewport_box => move |_| {
|
keyboard_search_bar.connect_search_changed(clone!(@weak keyboard_search_bar, @weak keyboard_selection_expander_row_viewport_box => move |_| {
|
||||||
|
@ -16,8 +16,12 @@ use std::process::Stdio;
|
|||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
use crate::eula_page::eula_page;
|
||||||
|
use crate::keyboard_page::keyboard_page;
|
||||||
|
use crate::partitioning_page::partitioning_page;
|
||||||
|
use crate::timezone_page::timezone_page;
|
||||||
|
|
||||||
pub fn language_page(content_stack: >k::Stack) {
|
pub fn language_page(content_stack: >k::Stack, window: &adw::ApplicationWindow) {
|
||||||
// create the bottom box for next and back buttons
|
// create the bottom box for next and back buttons
|
||||||
let bottom_box = gtk::Box::builder()
|
let bottom_box = gtk::Box::builder()
|
||||||
.orientation(Orientation::Horizontal)
|
.orientation(Orientation::Horizontal)
|
||||||
@ -241,14 +245,6 @@ pub fn language_page(content_stack: >k::Stack) {
|
|||||||
|
|
||||||
language_main_box.append(&bottom_box);
|
language_main_box.append(&bottom_box);
|
||||||
|
|
||||||
// / Content stack appends
|
|
||||||
//// Add the language_main_box as page: language_page, Give it nice title
|
|
||||||
content_stack.add_titled(
|
|
||||||
&language_main_box,
|
|
||||||
Some("language_page"),
|
|
||||||
&gettext("language"),
|
|
||||||
);
|
|
||||||
|
|
||||||
let lang_data_buffer_clone = lang_data_buffer.clone();
|
let lang_data_buffer_clone = lang_data_buffer.clone();
|
||||||
|
|
||||||
language_search_bar.connect_search_changed(clone!(@weak language_search_bar, @weak language_selection_expander_row_viewport_box => move |_| {
|
language_search_bar.connect_search_changed(clone!(@weak language_search_bar, @weak language_selection_expander_row_viewport_box => move |_| {
|
||||||
@ -273,7 +269,83 @@ pub fn language_page(content_stack: >k::Stack) {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
bottom_next_button.connect_clicked(clone!(@weak content_stack => move |_| {
|
|
||||||
|
// / Content stack appends
|
||||||
|
//// Add the language_main_box as page: language_page, Give it nice title
|
||||||
|
content_stack.add_titled(
|
||||||
|
&language_main_box,
|
||||||
|
Some("language_page"),
|
||||||
|
&gettext("language"),
|
||||||
|
);
|
||||||
|
|
||||||
|
// the header box for the eula page
|
||||||
|
let eula_main_box = gtk::Box::builder()
|
||||||
|
.orientation(Orientation::Vertical)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// / Content stack appends
|
||||||
|
//// Add the eula_main_box as page: eula_page, Give it nice title
|
||||||
|
content_stack.add_titled(&eula_main_box, Some("eula_page"), &gettext("eula"));
|
||||||
|
|
||||||
|
// the header box for the timezone page
|
||||||
|
let timezone_main_box = gtk::Box::builder()
|
||||||
|
.orientation(Orientation::Vertical)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// / Content stack appends
|
||||||
|
//// Add the keyboard_main_box as page: keyboard_page, Give it nice title
|
||||||
|
content_stack.add_titled(
|
||||||
|
&timezone_main_box,
|
||||||
|
Some("timezone_page"),
|
||||||
|
&gettext("timezone"),
|
||||||
|
);
|
||||||
|
|
||||||
|
// the header box for the keyboard page
|
||||||
|
let keyboard_main_box = gtk::Box::builder()
|
||||||
|
.orientation(Orientation::Vertical)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// / Content stack appends
|
||||||
|
//// Add the keyboard_main_box as page: keyboard_page, Give it nice title
|
||||||
|
content_stack.add_titled(
|
||||||
|
&keyboard_main_box,
|
||||||
|
Some("keyboard_page"),
|
||||||
|
&gettext("keyboard"),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Add install_page.rs as a page for content_stack
|
||||||
|
let install_main_box = gtk::Box::builder()
|
||||||
|
.orientation(Orientation::Vertical)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let done_main_box = gtk::Box::builder()
|
||||||
|
.orientation(Orientation::Vertical)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// the header box for the partitioning page
|
||||||
|
let partitioning_main_box = gtk::Box::builder()
|
||||||
|
.orientation(Orientation::Vertical)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// / Content stack appends
|
||||||
|
//// Add the partitioning_main_box as page: partitioning_page, Give it nice title
|
||||||
|
content_stack.add_titled(
|
||||||
|
&partitioning_main_box,
|
||||||
|
Some("partitioning_page"),
|
||||||
|
&gettext("partitioning"),
|
||||||
|
);
|
||||||
|
|
||||||
|
//// Add the install_main_box as page: install_page, Give it nice title
|
||||||
|
content_stack.add_titled(
|
||||||
|
&install_main_box,
|
||||||
|
Some("install_page"),
|
||||||
|
&gettext("installation"),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Add done_page.rs as a page for content_stack
|
||||||
|
content_stack.add_titled(&done_main_box, Some("done_page"), &gettext("done"));
|
||||||
|
|
||||||
|
bottom_next_button.connect_clicked(clone!(@weak content_stack, @weak window => move |_| {
|
||||||
if Path::new("/tmp/pika-installer-gtk4-lang.txt").exists() {
|
if Path::new("/tmp/pika-installer-gtk4-lang.txt").exists() {
|
||||||
fs::remove_file("/tmp/pika-installer-gtk4-lang.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-lang.txt");
|
fs::remove_file("/tmp/pika-installer-gtk4-lang.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-lang.txt");
|
||||||
}
|
}
|
||||||
@ -289,6 +361,27 @@ pub fn language_page(content_stack: >k::Stack) {
|
|||||||
println!("Warning: Current LANG is not supported, using fallback Locale.");
|
println!("Warning: Current LANG is not supported, using fallback Locale.");
|
||||||
gettextrs::setlocale(LocaleCategory::LcAll, "en_US.UTF8");
|
gettextrs::setlocale(LocaleCategory::LcAll, "en_US.UTF8");
|
||||||
}
|
}
|
||||||
|
// Add eula_page.rs as a page for content_stack
|
||||||
|
while let Some(widget) = eula_main_box.last_child() {
|
||||||
|
eula_main_box.remove(&widget);
|
||||||
|
}
|
||||||
|
eula_page(&content_stack, &eula_main_box);
|
||||||
|
// Add timezone_page.rs as a page for content_stack
|
||||||
|
while let Some(widget) = timezone_main_box.last_child() {
|
||||||
|
timezone_main_box.remove(&widget);
|
||||||
|
}
|
||||||
|
timezone_page(&content_stack, &timezone_main_box);
|
||||||
|
// Add keyboard_page.rs as a page for content_stack
|
||||||
|
while let Some(widget) = keyboard_main_box.last_child() {
|
||||||
|
keyboard_main_box.remove(&widget);
|
||||||
|
}
|
||||||
|
keyboard_page(&content_stack, &keyboard_main_box);
|
||||||
|
// Add partitioning_page.rs as a page for content_stack
|
||||||
|
while let Some(widget) = partitioning_main_box.last_child() {
|
||||||
|
partitioning_main_box.remove(&widget);
|
||||||
|
}
|
||||||
|
partitioning_page(&partitioning_main_box, &done_main_box, &install_main_box, &content_stack, &window);
|
||||||
|
//
|
||||||
content_stack.set_visible_child_name("eula_page")
|
content_stack.set_visible_child_name("eula_page")
|
||||||
}));
|
}));
|
||||||
bottom_back_button.connect_clicked(clone!(@weak content_stack => move |_| {
|
bottom_back_button.connect_clicked(clone!(@weak content_stack => move |_| {
|
||||||
|
@ -26,6 +26,7 @@ use crate::manual_partitioning;
|
|||||||
use manual_partitioning::DriveMount;
|
use manual_partitioning::DriveMount;
|
||||||
|
|
||||||
pub fn partitioning_page(
|
pub fn partitioning_page(
|
||||||
|
partitioning_main_box: >k::Box,
|
||||||
done_main_box: >k::Box,
|
done_main_box: >k::Box,
|
||||||
install_main_box: >k::Box,
|
install_main_box: >k::Box,
|
||||||
content_stack: >k::Stack,
|
content_stack: >k::Stack,
|
||||||
@ -69,11 +70,6 @@ pub fn partitioning_page(
|
|||||||
bottom_box.append(&bottom_back_button);
|
bottom_box.append(&bottom_back_button);
|
||||||
bottom_box.append(&bottom_next_button);
|
bottom_box.append(&bottom_next_button);
|
||||||
|
|
||||||
// the header box for the partitioning page
|
|
||||||
let partitioning_main_box = gtk::Box::builder()
|
|
||||||
.orientation(Orientation::Vertical)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// the header box for the partitioning page
|
// the header box for the partitioning page
|
||||||
let partitioning_header_box = gtk::Box::builder()
|
let partitioning_header_box = gtk::Box::builder()
|
||||||
.orientation(Orientation::Horizontal)
|
.orientation(Orientation::Horizontal)
|
||||||
@ -226,14 +222,6 @@ pub fn partitioning_page(
|
|||||||
partitioning_main_box.append(&partitioning_stack);
|
partitioning_main_box.append(&partitioning_stack);
|
||||||
partitioning_main_box.append(&bottom_box);
|
partitioning_main_box.append(&bottom_box);
|
||||||
|
|
||||||
// / Content stack appends
|
|
||||||
//// Add the partitioning_main_box as page: partitioning_page, Give it nice title
|
|
||||||
content_stack.add_titled(
|
|
||||||
&partitioning_main_box,
|
|
||||||
Some("partitioning_page"),
|
|
||||||
&gettext("partitioning"),
|
|
||||||
);
|
|
||||||
|
|
||||||
automatic_method_button.connect_clicked(clone!(@weak partitioning_stack => move |_| partitioning_stack.set_visible_child_name("partition_method_automatic_page")));
|
automatic_method_button.connect_clicked(clone!(@weak partitioning_stack => move |_| partitioning_stack.set_visible_child_name("partition_method_automatic_page")));
|
||||||
manual_method_button.connect_clicked(clone!(@weak partitioning_stack => move |_| partitioning_stack.set_visible_child_name("partition_method_manual_page")));
|
manual_method_button.connect_clicked(clone!(@weak partitioning_stack => move |_| partitioning_stack.set_visible_child_name("partition_method_manual_page")));
|
||||||
|
|
||||||
|
@ -17,7 +17,9 @@ use std::str;
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
pub fn timezone_page(content_stack: >k::Stack) {
|
pub fn timezone_page(content_stack: >k::Stack,
|
||||||
|
timezone_main_box: >k::Box,
|
||||||
|
) {
|
||||||
// create the bottom box for next and back buttons
|
// create the bottom box for next and back buttons
|
||||||
let bottom_box = gtk::Box::builder()
|
let bottom_box = gtk::Box::builder()
|
||||||
.orientation(Orientation::Horizontal)
|
.orientation(Orientation::Horizontal)
|
||||||
@ -54,11 +56,6 @@ pub fn timezone_page(content_stack: >k::Stack) {
|
|||||||
bottom_box.append(&bottom_back_button);
|
bottom_box.append(&bottom_back_button);
|
||||||
bottom_box.append(&bottom_next_button);
|
bottom_box.append(&bottom_next_button);
|
||||||
|
|
||||||
// the header box for the timezone page
|
|
||||||
let timezone_main_box = gtk::Box::builder()
|
|
||||||
.orientation(Orientation::Vertical)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// the header box for the timezone page
|
// the header box for the timezone page
|
||||||
let timezone_header_box = gtk::Box::builder()
|
let timezone_header_box = gtk::Box::builder()
|
||||||
.orientation(Orientation::Horizontal)
|
.orientation(Orientation::Horizontal)
|
||||||
@ -227,14 +224,6 @@ pub fn timezone_page(content_stack: >k::Stack) {
|
|||||||
|
|
||||||
timezone_main_box.append(&bottom_box);
|
timezone_main_box.append(&bottom_box);
|
||||||
|
|
||||||
// / Content stack appends
|
|
||||||
//// Add the timezone_main_box as page: timezone_page, Give it nice title
|
|
||||||
content_stack.add_titled(
|
|
||||||
&timezone_main_box,
|
|
||||||
Some("timezone_page"),
|
|
||||||
&gettext("timezone"),
|
|
||||||
);
|
|
||||||
|
|
||||||
let timezone_data_buffer_clone = timezone_data_buffer.clone();
|
let timezone_data_buffer_clone = timezone_data_buffer.clone();
|
||||||
|
|
||||||
timezone_search_bar.connect_search_changed(clone!(@weak timezone_search_bar, @weak timezone_selection_expander_row_viewport_box => move |_| {
|
timezone_search_bar.connect_search_changed(clone!(@weak timezone_search_bar, @weak timezone_selection_expander_row_viewport_box => move |_| {
|
||||||
@ -272,7 +261,7 @@ pub fn timezone_page(content_stack: >k::Stack) {
|
|||||||
.expect("timezone failed to start");
|
.expect("timezone failed to start");
|
||||||
content_stack.set_visible_child_name("keyboard_page")
|
content_stack.set_visible_child_name("keyboard_page")
|
||||||
}));
|
}));
|
||||||
bottom_back_button.connect_clicked(clone!(@weak content_stack => move |_| {
|
bottom_back_button.connect_clicked(clone!(@weak content_stack, @weak timezone_main_box => move |_| {
|
||||||
content_stack.set_visible_child_name("eula_page")
|
content_stack.set_visible_child_name("eula_page");
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user