fixes shit

This commit is contained in:
Ward from fusion-voyager-3 2024-01-21 20:37:09 +03:00
parent 259034b982
commit 26c6a2bd38
6 changed files with 25 additions and 15 deletions

View File

@ -16,7 +16,6 @@ use crate::eula_page;
use crate::timezone_page;
use crate::keyboard_page;
use crate::partitioning_page;
use crate::install_page;
use std::path::Path;
@ -121,9 +120,6 @@ pub fn build_ui(app: &adw::Application) {
// Add partitioning_page.rs as a page for content_stack
partitioning_page(&window, &content_stack);
// Add install_page.rs as a page for content_stack
install_page(&content_stack);
// glib maximization
if glib_settings.boolean("is-maximized") == true {
window.maximize()

View File

@ -11,6 +11,9 @@ use gtk::subclass::layout_child;
use vte::prelude::*;
use vte::*;
use std::fs;
use std::path::Path;
pub fn install_page(content_stack: &gtk::Stack) {
// create the bottom box for next and back buttons
@ -97,26 +100,31 @@ pub fn install_page(content_stack: &gtk::Stack) {
let install_confirm_detail_language = adw::ActionRow::builder()
.title("Language:")
.subtitle("en_us")
.subtitle(fs::read_to_string("/tmp/pika-installer-gtk4-lang.txt").expect("Unable to read file"))
.build();
install_confirm_detail_language.add_css_class("property");
let install_confirm_detail_timezone = adw::ActionRow::builder()
.title("Time zone:")
.subtitle("Europe/Moscow")
.subtitle(fs::read_to_string("/tmp/pika-installer-gtk4-timezone.txt").expect("Unable to read file"))
.build();
install_confirm_detail_timezone.add_css_class("property");
let install_confirm_detail_keyboard = adw::ActionRow::builder()
.title("Keyboard layout:")
.subtitle("us")
.subtitle(fs::read_to_string("/tmp/pika-installer-gtk4-keyboard.txt").expect("Unable to read file"))
.build();
install_confirm_detail_keyboard.add_css_class("property");
let install_confirm_detail_target = adw::ActionRow::builder()
.title("Install Target:")
.subtitle("/dev/sda1")
.build();
if Path::new("/tmp/pika-installer-gtk4-target-manual.txt").exists() {
install_confirm_detail_target.set_subtitle(&fs::read_to_string("/tmp/pika-installer-gtk4-target-manual.txt").expect("Unable to read file"));
} else {
install_confirm_detail_target.set_subtitle(&fs::read_to_string("/tmp/pika-installer-gtk4-target-auto.txt").expect("Unable to read file"));
}
install_confirm_detail_target.add_css_class("property");
let install_confirm_button = gtk::Button::builder()
@ -206,11 +214,12 @@ pub fn install_page(content_stack: &gtk::Stack) {
// / Content stack appends
//// Add the install_main_box as page: install_page, Give it nice title
content_stack.add_titled(&install_main_box, Some("install_page"), "Welcome");
content_stack.add_titled(&install_main_box, Some("install_page"), "Installation");
install_confirm_button.connect_clicked(clone!(@weak install_nested_stack => move |_| install_nested_stack.set_visible_child_name("progress_page")));
bottom_back_button.connect_clicked(clone!(@weak content_stack => move |_| {
bottom_back_button.connect_clicked(clone!(@weak content_stack, @weak install_main_box => move |_| {
content_stack.remove(&install_main_box);
content_stack.set_visible_child_name("partitioning_page");
}));
}

View File

@ -230,11 +230,11 @@ pub fn keyboard_page(content_stack: &gtk::Stack) {
let keyboard_data_buffer_clone = keyboard_data_buffer.clone();
bottom_next_button.connect_clicked(clone!(@weak content_stack => move |_| {
content_stack.set_visible_child_name("partitioning_page");
if Path::new("/tmp/pika-installer-gtk4-keyboard.txt").exists() {
fs::remove_file("/tmp/pika-installer-gtk4-keyboard.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-keyboard.txt");
}
fs::write("/tmp/pika-installer-gtk4-keyboard.txt", keyboard_data_buffer_clone.text(&keyboard_data_buffer_clone.bounds().0, &keyboard_data_buffer_clone.bounds().1, true).to_string()).expect("Unable to write file");
content_stack.set_visible_child_name("partitioning_page")
}));
bottom_back_button.connect_clicked(clone!(@weak content_stack => move |_| {

View File

@ -225,11 +225,11 @@ pub fn language_page(content_stack: &gtk::Stack) {
let lang_data_buffer_clone = lang_data_buffer.clone();
bottom_next_button.connect_clicked(clone!(@weak content_stack => move |_| {
content_stack.set_visible_child_name("eula_page");
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::write("/tmp/pika-installer-gtk4-lang.txt", lang_data_buffer_clone.text(&lang_data_buffer_clone.bounds().0, &lang_data_buffer_clone.bounds().1, true).to_string()).expect("Unable to write file");
content_stack.set_visible_child_name("eula_page")
}));
bottom_back_button.connect_clicked(clone!(@weak content_stack => move |_| {
content_stack.set_visible_child_name("welcome_page")

View File

@ -23,6 +23,8 @@ use std::time::*;
use std::fs;
use std::path::Path;
use crate::install_page;
pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: &gtk::Stack) {
// create the bottom box for next and back buttons
@ -971,13 +973,12 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: &gtk::S
bottom_next_button.connect_clicked(clone!(@weak content_stack => move |_| {
content_stack.set_visible_child_name("install_page")
}));
bottom_back_button.connect_clicked(clone!(@weak content_stack, @weak partitioning_stack => move |_| {
bottom_back_button.connect_clicked(clone!(@weak content_stack, @weak partitioning_stack, @weak partitioning_main_box => move |_| {
content_stack.set_visible_child_name("keyboard_page");
partitioning_stack.set_visible_child_name("partition_method_select_page");
}));
bottom_next_button.connect_clicked(clone!(@weak content_stack, @weak partitioning_stack => move |_| {
content_stack.set_visible_child_name("install_page");
if Path::new("/tmp/pika-installer-gtk4-target-auto.txt").exists() {
fs::remove_file("/tmp/pika-installer-gtk4-target-auto.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-target-auto.txt");
}
@ -998,6 +999,8 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: &gtk::S
} else {
fs::write("/tmp/pika-installer-gtk4-target-automatic-luks.txt", automatic_luks_result);
}
install_page(&content_stack);
content_stack.set_visible_child_name("install_page");
} else {
fs::write("/tmp/pika-installer-gtk4-target-manual.txt", partition_method_manual_target_buffer_clone.text(&partition_method_manual_target_buffer_clone.bounds().0, &partition_method_manual_target_buffer_clone.bounds().1, true).to_string()).expect("Unable to write file");
partition_method_manual_luks_buffer_clone.set_text(&partition_method_manual_luks_password_entry.text().to_string());
@ -1007,6 +1010,8 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: &gtk::S
} else {
fs::write("/tmp/pika-installer-gtk4-target-manual-luks.txt", manual_luks_result);
}
install_page(&content_stack);
content_stack.set_visible_child_name("install_page");
}
}));

View File

@ -220,11 +220,11 @@ pub fn timezone_page(content_stack: &gtk::Stack) {
let timezone_data_buffer_clone = timezone_data_buffer.clone();
bottom_next_button.connect_clicked(clone!(@weak content_stack => move |_| {
content_stack.set_visible_child_name("keyboard_page");
if Path::new("/tmp/pika-installer-gtk4-timezone.txt").exists() {
fs::remove_file("/tmp/pika-installer-gtk4-timezone.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-timezone.txt");
}
fs::write("/tmp/pika-installer-gtk4-timezone.txt", timezone_data_buffer_clone.text(&timezone_data_buffer_clone.bounds().0, &timezone_data_buffer_clone.bounds().1, true).to_string()).expect("Unable to write file");
content_stack.set_visible_child_name("keyboard_page")
}));
bottom_back_button.connect_clicked(clone!(@weak content_stack => move |_| {
content_stack.set_visible_child_name("eula_page")