Make buttons push selections to files
This commit is contained in:
parent
e8780ae35b
commit
259034b982
@ -13,6 +13,28 @@ use vte::*;
|
||||
|
||||
pub fn install_page(content_stack: >k::Stack) {
|
||||
|
||||
// create the bottom box for next and back buttons
|
||||
let bottom_box = gtk::Box::builder()
|
||||
.orientation(Orientation::Horizontal)
|
||||
.valign(gtk::Align::End)
|
||||
.vexpand(true)
|
||||
.build();
|
||||
|
||||
// Next and back button
|
||||
let bottom_back_button = gtk::Button::builder()
|
||||
.label("Back")
|
||||
.margin_top(15)
|
||||
.margin_bottom(15)
|
||||
.margin_start(15)
|
||||
.margin_end(15)
|
||||
.halign(gtk::Align::Start)
|
||||
.hexpand(true)
|
||||
.build();
|
||||
|
||||
// / bottom_box appends
|
||||
//// Add the next and back buttons
|
||||
bottom_box.append(&bottom_back_button);
|
||||
|
||||
let install_main_box = gtk::Box::builder()
|
||||
.orientation(Orientation::Vertical)
|
||||
.build();
|
||||
@ -56,14 +78,51 @@ pub fn install_page(content_stack: >k::Stack) {
|
||||
// make install selection box for choosing installation or live media
|
||||
let install_confirm_selection_box = gtk::Box::builder()
|
||||
.orientation(Orientation::Vertical)
|
||||
.halign(gtk::Align::Fill)
|
||||
.valign(gtk::Align::Center)
|
||||
.vexpand(true)
|
||||
.hexpand(true)
|
||||
.build();
|
||||
|
||||
let install_confirm_details_boxed_list = gtk::ListBox::builder()
|
||||
.margin_top(15)
|
||||
.margin_bottom(15)
|
||||
.margin_start(256)
|
||||
.margin_end(256)
|
||||
.halign(gtk::Align::Fill)
|
||||
.valign(gtk::Align::Center)
|
||||
.hexpand(true)
|
||||
.build();
|
||||
install_confirm_details_boxed_list.add_css_class("boxed-list");
|
||||
|
||||
let install_confirm_detail_language = adw::ActionRow::builder()
|
||||
.title("Language:")
|
||||
.subtitle("en_us")
|
||||
.build();
|
||||
install_confirm_detail_language.add_css_class("property");
|
||||
|
||||
let install_confirm_detail_timezone = adw::ActionRow::builder()
|
||||
.title("Time zone:")
|
||||
.subtitle("Europe/Moscow")
|
||||
.build();
|
||||
install_confirm_detail_timezone.add_css_class("property");
|
||||
|
||||
let install_confirm_detail_keyboard = adw::ActionRow::builder()
|
||||
.title("Keyboard layout:")
|
||||
.subtitle("us")
|
||||
.build();
|
||||
install_confirm_detail_keyboard.add_css_class("property");
|
||||
|
||||
let install_confirm_detail_target = adw::ActionRow::builder()
|
||||
.title("Install Target:")
|
||||
.subtitle("/dev/sda1")
|
||||
.build();
|
||||
install_confirm_detail_target.add_css_class("property");
|
||||
|
||||
let install_confirm_button = gtk::Button::builder()
|
||||
.label("Confirm & Install PikaOS")
|
||||
.vexpand(true)
|
||||
.hexpand(true)
|
||||
.halign(gtk::Align::Center)
|
||||
.valign(gtk::Align::Start)
|
||||
.valign(gtk::Align::Center)
|
||||
.build();
|
||||
install_confirm_button.add_css_class("destructive-action");
|
||||
|
||||
@ -82,6 +141,12 @@ pub fn install_page(content_stack: >k::Stack) {
|
||||
|
||||
// / install_confirm_selection_box appends
|
||||
//// add live and install media button to install page selections
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_language);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_timezone);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_keyboard);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_target);
|
||||
//
|
||||
install_confirm_selection_box.append(&install_confirm_details_boxed_list);
|
||||
install_confirm_selection_box.append(&install_confirm_button);
|
||||
|
||||
// / install_confirm_header_box appends
|
||||
@ -97,6 +162,8 @@ pub fn install_page(content_stack: >k::Stack) {
|
||||
|
||||
install_main_box.append(&install_nested_stack);
|
||||
|
||||
install_confirm_box.append(&bottom_box);
|
||||
|
||||
///
|
||||
|
||||
let install_progress_box = gtk::Box::builder()
|
||||
@ -120,11 +187,11 @@ pub fn install_page(content_stack: >k::Stack) {
|
||||
&[],
|
||||
SpawnFlags::DEFAULT,
|
||||
|| {},
|
||||
10,
|
||||
-1,
|
||||
None::<&gio::Cancellable>,
|
||||
move |result| {
|
||||
match result {
|
||||
Ok(pid) => { eprintln!("could not spawn terminal:") }
|
||||
Ok(_) => { eprintln!("could not spawn terminal")}
|
||||
Err(err) => {
|
||||
eprintln!("could not spawn terminal: {}", err);
|
||||
}
|
||||
@ -142,4 +209,8 @@ pub fn install_page(content_stack: >k::Stack) {
|
||||
content_stack.add_titled(&install_main_box, Some("install_page"), "Welcome");
|
||||
|
||||
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 |_| {
|
||||
content_stack.set_visible_child_name("partitioning_page");
|
||||
}));
|
||||
}
|
@ -16,6 +16,9 @@ use std::process::Stdio;
|
||||
use std::time::Instant;
|
||||
use std::str;
|
||||
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn keyboard_page(content_stack: >k::Stack) {
|
||||
|
||||
// create the bottom box for next and back buttons
|
||||
@ -179,6 +182,9 @@ pub fn keyboard_page(content_stack: >k::Stack) {
|
||||
let keyboard_layout_stdout = keyboard_layout_cli.stdout.expect("could not get stdout");
|
||||
let keyboard_layout_reader = BufReader::new(keyboard_layout_stdout);
|
||||
|
||||
let keyboard_data_buffer = gtk::TextBuffer::builder()
|
||||
.build();
|
||||
|
||||
for keyboard_layout in keyboard_layout_reader.lines() {
|
||||
let keyboard_layout = keyboard_layout.unwrap();
|
||||
let keyboard_layout_clone = keyboard_layout.clone();
|
||||
@ -187,10 +193,11 @@ pub fn keyboard_page(content_stack: >k::Stack) {
|
||||
.build();
|
||||
keyboard_layout_checkbutton.set_group(Some(&null_checkbutton));
|
||||
keyboard_selection_expander_row_viewport_box.append(&keyboard_layout_checkbutton);
|
||||
keyboard_layout_checkbutton.connect_toggled(clone!(@weak keyboard_layout_checkbutton, @weak keyboard_selection_expander_row, @weak bottom_next_button => move |_| {
|
||||
keyboard_layout_checkbutton.connect_toggled(clone!(@weak keyboard_layout_checkbutton, @weak keyboard_selection_expander_row, @weak bottom_next_button, @weak keyboard_data_buffer => move |_| {
|
||||
if keyboard_layout_checkbutton.is_active() == true {
|
||||
keyboard_selection_expander_row.set_title(&keyboard_layout);
|
||||
bottom_next_button.set_sensitive(true);
|
||||
keyboard_data_buffer.set_text(&keyboard_layout);
|
||||
}
|
||||
}));
|
||||
if current_keyboard.contains(&(keyboard_layout_clone)) {
|
||||
@ -220,9 +227,16 @@ pub fn keyboard_page(content_stack: >k::Stack) {
|
||||
//// Add the keyboard_main_box as page: keyboard_page, Give it nice title
|
||||
content_stack.add_titled(&keyboard_main_box, Some("keyboard_page"), "Keyboard");
|
||||
|
||||
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")
|
||||
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");
|
||||
}));
|
||||
|
||||
bottom_back_button.connect_clicked(clone!(@weak content_stack => move |_| {
|
||||
content_stack.set_visible_child_name("timezone_page")
|
||||
}));
|
||||
|
@ -16,6 +16,9 @@ use std::process::Stdio;
|
||||
use std::time::Instant;
|
||||
use std::env;
|
||||
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
|
||||
pub fn language_page(content_stack: >k::Stack) {
|
||||
|
||||
@ -174,6 +177,9 @@ pub fn language_page(content_stack: >k::Stack) {
|
||||
|
||||
let locale_reader = BufReader::new(locale_cli_sort.stdout.expect("could not get stdout"));
|
||||
|
||||
let lang_data_buffer = gtk::TextBuffer::builder()
|
||||
.build();
|
||||
|
||||
for locale in locale_reader.lines() {
|
||||
let locale = locale.unwrap();
|
||||
let locale_clone = locale.clone();
|
||||
@ -182,10 +188,11 @@ pub fn language_page(content_stack: >k::Stack) {
|
||||
.build();
|
||||
locale_checkbutton.set_group(Some(&null_checkbutton));
|
||||
language_selection_expander_row_viewport_box.append(&locale_checkbutton);
|
||||
locale_checkbutton.connect_toggled(clone!(@weak locale_checkbutton, @weak language_selection_expander_row, @weak bottom_next_button => move |_| {
|
||||
locale_checkbutton.connect_toggled(clone!(@weak locale_checkbutton, @weak language_selection_expander_row, @weak bottom_next_button, @weak lang_data_buffer => move |_| {
|
||||
if locale_checkbutton.is_active() == true {
|
||||
language_selection_expander_row.set_title(&locale);
|
||||
bottom_next_button.set_sensitive(true);
|
||||
lang_data_buffer.set_text(&locale);
|
||||
}
|
||||
}));
|
||||
if current_locale.contains(&(locale_clone)) {
|
||||
@ -215,11 +222,16 @@ pub fn language_page(content_stack: >k::Stack) {
|
||||
//// Add the language_main_box as page: language_page, Give it nice title
|
||||
content_stack.add_titled(&language_main_box, Some("language_page"), "Language");
|
||||
|
||||
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")
|
||||
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");
|
||||
}));
|
||||
bottom_back_button.connect_clicked(clone!(@weak content_stack => move |_| {
|
||||
content_stack.set_visible_child_name("welcome_page")
|
||||
}));
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,9 @@ use pretty_bytes::converter::convert;
|
||||
use std::thread;
|
||||
use std::time::*;
|
||||
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::Stack) {
|
||||
|
||||
// create the bottom box for next and back buttons
|
||||
@ -333,6 +336,12 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
.sensitive(false)
|
||||
.build();
|
||||
|
||||
let partition_method_automatic_target_buffer = gtk::TextBuffer::builder()
|
||||
.build();
|
||||
|
||||
let partition_method_automatic_luks_buffer = gtk::TextBuffer::builder()
|
||||
.build();
|
||||
|
||||
for device in partition_method_automatic_get_devices_reader.lines() {
|
||||
let device = device.unwrap();
|
||||
let device_size_cli = Command::new("pkexec")
|
||||
@ -354,7 +363,7 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
.build();
|
||||
device_row.add_prefix(&device_button);
|
||||
devices_selection_expander_row_viewport_box.append(&device_row);
|
||||
device_button.connect_toggled(clone!(@weak device_button, @weak devices_selection_expander_row, @weak bottom_next_button, @weak partition_method_automatic_disk_error_label, @weak partition_method_automatic_luks_error_label, @weak partition_method_automatic_luks_checkbutton => move |_| {
|
||||
device_button.connect_toggled(clone!(@weak device_button,@weak partition_method_automatic_luks_password_entry, @weak devices_selection_expander_row, @weak bottom_next_button, @weak partition_method_automatic_disk_error_label, @weak partition_method_automatic_luks_error_label, @weak partition_method_automatic_luks_checkbutton, @weak partition_method_automatic_target_buffer, @weak partition_method_automatic_luks_buffer => move |_| {
|
||||
if device_button.is_active() == true {
|
||||
devices_selection_expander_row.set_title(&device);
|
||||
if device_size > 39000000000.0 {
|
||||
@ -366,6 +375,8 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
bottom_next_button.set_sensitive(true);
|
||||
}
|
||||
} else {
|
||||
partition_method_automatic_target_buffer.set_text(&device);
|
||||
partition_method_automatic_luks_buffer.set_text(&partition_method_automatic_luks_password_entry.text().to_string());
|
||||
bottom_next_button.set_sensitive(true);
|
||||
}
|
||||
} else {
|
||||
@ -377,7 +388,7 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
}));
|
||||
}
|
||||
|
||||
partition_method_automatic_luks_checkbutton.connect_toggled(clone!(@weak partition_method_automatic_luks_checkbutton, @weak partition_method_automatic_luks_password_entry, @weak partition_method_automatic_disk_error_label, @weak partition_method_automatic_luks_error_label, @weak bottom_next_button => move |_| {
|
||||
partition_method_automatic_luks_checkbutton.connect_toggled(clone!(@weak partition_method_automatic_luks_checkbutton, @weak partition_method_automatic_luks_password_entry, @weak partition_method_automatic_disk_error_label, @weak partition_method_automatic_luks_error_label, @weak bottom_next_button, @weak partition_method_automatic_target_buffer, @weak partition_method_automatic_luks_buffer => move |_| {
|
||||
if partition_method_automatic_luks_checkbutton.is_active() == true {
|
||||
partition_method_automatic_luks_password_entry.set_sensitive(true);
|
||||
if partition_method_automatic_luks_password_entry.text().to_string().is_empty() {
|
||||
@ -402,7 +413,7 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
}
|
||||
}));
|
||||
|
||||
partition_method_automatic_luks_password_entry.connect_changed(clone!(@weak partition_method_automatic_luks_checkbutton, @weak partition_method_automatic_luks_password_entry, @weak partition_method_automatic_disk_error_label, @weak partition_method_automatic_luks_error_label, @weak bottom_next_button => move |_| {
|
||||
partition_method_automatic_luks_password_entry.connect_changed(clone!(@weak partition_method_automatic_luks_checkbutton, @weak partition_method_automatic_luks_password_entry, @weak partition_method_automatic_disk_error_label, @weak partition_method_automatic_luks_error_label, @weak bottom_next_button, @weak partition_method_automatic_luks_buffer => move |_| {
|
||||
if partition_method_automatic_luks_checkbutton.is_active() == true {
|
||||
partition_method_automatic_luks_password_entry.set_sensitive(true);
|
||||
if partition_method_automatic_luks_password_entry.text().to_string().is_empty() {
|
||||
@ -413,6 +424,7 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
if partition_method_automatic_disk_error_label.get_visible() {
|
||||
//
|
||||
} else {
|
||||
partition_method_automatic_luks_buffer.set_text(&partition_method_automatic_luks_password_entry.text().to_string());
|
||||
bottom_next_button.set_sensitive(true);
|
||||
}
|
||||
}
|
||||
@ -422,6 +434,7 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
if partition_method_automatic_disk_error_label.get_visible() {
|
||||
//
|
||||
} else {
|
||||
partition_method_automatic_luks_buffer.set_text(&partition_method_automatic_luks_password_entry.text().to_string());
|
||||
bottom_next_button.set_sensitive(true);
|
||||
}
|
||||
}
|
||||
@ -635,7 +648,13 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
}
|
||||
}));
|
||||
|
||||
partition_method_manual_chroot_dir_entry.connect_changed(clone!(@weak bottom_next_button, @weak partition_method_manual_chroot_dir_entry, @weak partition_method_manual_luks_password_entry, @weak partition_method_manual_luks_error_label, @weak partition_method_manual_chroot_error_label, @weak partition_method_manual_boot_error_label, @weak partition_method_manual_efi_error_label => move |_| {
|
||||
let partition_method_manual_target_buffer = gtk::TextBuffer::builder()
|
||||
.build();
|
||||
|
||||
let partition_method_manual_luks_buffer = gtk::TextBuffer::builder()
|
||||
.build();
|
||||
|
||||
partition_method_manual_chroot_dir_entry.connect_changed(clone!(@weak bottom_next_button, @weak partition_method_manual_chroot_dir_entry, @weak partition_method_manual_luks_password_entry, @weak partition_method_manual_luks_error_label, @weak partition_method_manual_chroot_error_label, @weak partition_method_manual_boot_error_label, @weak partition_method_automatic_target_buffer, @weak partition_method_automatic_luks_buffer, @weak partition_method_manual_efi_error_label, @weak partition_method_manual_target_buffer, @weak partition_method_manual_luks_buffer => move |_| {
|
||||
bottom_next_button.set_sensitive(false);
|
||||
let custom_root_mountpoint = partition_method_manual_chroot_dir_entry.text().to_string();
|
||||
// Mountpoint Check
|
||||
@ -677,12 +696,11 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
.expect("The channel needs to be open.");
|
||||
}
|
||||
}));
|
||||
let partition_method_manual_luks_password_entry_clone = partition_method_manual_luks_password_entry.clone();
|
||||
let luks_manual_is_encrypt_main_context = MainContext::default();
|
||||
// The main loop executes the asynchronous block
|
||||
luks_manual_is_encrypt_main_context.spawn_local(clone!(@weak partition_method_manual_luks_password_entry_clone => async move {
|
||||
luks_manual_is_encrypt_main_context.spawn_local(clone!(@weak partition_method_manual_luks_password_entry => async move {
|
||||
while let Ok(state) = luks_manual_is_encrypt_receiver.recv().await {
|
||||
partition_method_manual_luks_password_entry_clone.set_sensitive(state);
|
||||
partition_method_manual_luks_password_entry.set_sensitive(state);
|
||||
}
|
||||
}));
|
||||
// Luks Password Checking
|
||||
@ -708,12 +726,12 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
.expect("The channel needs to be open.");
|
||||
}
|
||||
}));
|
||||
let partition_method_manual_luks_error_label_clone = partition_method_manual_luks_error_label.clone();
|
||||
let luks_manual_password_main_context = MainContext::default();
|
||||
// The main loop executes the asynchronous block
|
||||
luks_manual_password_main_context.spawn_local(clone!(@weak partition_method_manual_luks_error_label_clone => async move {
|
||||
luks_manual_password_main_context.spawn_local(clone!(@weak partition_method_manual_luks_error_label, @weak bottom_next_button => async move {
|
||||
while let Ok(state) = luks_manual_password_receiver.recv().await {
|
||||
partition_method_manual_luks_error_label_clone.set_visible(state);
|
||||
partition_method_manual_luks_error_label.set_visible(state);
|
||||
bottom_next_button.set_sensitive(!state);
|
||||
}
|
||||
}));
|
||||
}
|
||||
@ -741,19 +759,19 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
partition_method_manual_boot_error_label.set_visible(false)
|
||||
} else {
|
||||
if home_not_boot_cli.status.success() {
|
||||
//
|
||||
partition_method_manual_boot_error_label.set_visible(false);
|
||||
} else {
|
||||
partition_method_manual_boot_error_label.set_label("the /home and /boot partitions are the same.");
|
||||
partition_method_manual_boot_error_label.set_visible(true);
|
||||
}
|
||||
if boot_not_efi_cli.status.success() {
|
||||
//
|
||||
partition_method_manual_boot_error_label.set_visible(false);
|
||||
} else {
|
||||
partition_method_manual_boot_error_label.set_label("the /boot/efi and /boot partitions are the same.");
|
||||
partition_method_manual_boot_error_label.set_visible(true);
|
||||
}
|
||||
if root_not_boot_cli.status.success() {
|
||||
//
|
||||
partition_method_manual_boot_error_label.set_visible(false);
|
||||
} else {
|
||||
partition_method_manual_boot_error_label.set_label("No boot partition found in chroot, mount (CUSTOM_ROOT)/boot.");
|
||||
partition_method_manual_boot_error_label.set_visible(true);
|
||||
@ -767,15 +785,18 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
.output()
|
||||
.expect("failed to execute process");
|
||||
if root_not_efi_cli.status.success() {
|
||||
partition_method_manual_efi_error_label.set_visible(false);
|
||||
} else {
|
||||
partition_method_manual_efi_error_label.set_label("No EFI partition found in chroot, mount (CUSTOM_ROOT)/boot/efi.");
|
||||
partition_method_manual_efi_error_label.set_visible(true);
|
||||
}
|
||||
if partition_method_manual_chroot_error_label.get_visible() == false && partition_method_manual_luks_error_label.get_visible() == false && partition_method_manual_boot_error_label.get_visible() == false && partition_method_manual_efi_error_label.get_visible() == false {
|
||||
partition_method_manual_target_buffer.set_text(&custom_root_mountpoint);
|
||||
bottom_next_button.set_sensitive(true);
|
||||
}
|
||||
}));
|
||||
|
||||
partition_method_manual_luks_password_entry.connect_changed(clone!(@weak bottom_next_button, @weak partition_method_manual_chroot_dir_entry, @weak partition_method_manual_luks_password_entry, @weak partition_method_manual_luks_error_label, @weak partition_method_manual_chroot_error_label, @weak partition_method_manual_boot_error_label, @weak partition_method_manual_efi_error_label => move |_| {
|
||||
partition_method_manual_luks_password_entry.connect_changed(clone!(@weak bottom_next_button, @weak partition_method_manual_chroot_dir_entry, @weak partition_method_manual_luks_password_entry, @weak partition_method_manual_luks_error_label, @weak partition_method_manual_chroot_error_label, @weak partition_method_manual_boot_error_label, @weak partition_method_automatic_target_buffer, @weak partition_method_automatic_luks_buffer, @weak partition_method_manual_efi_error_label, @weak partition_method_manual_target_buffer, @weak partition_method_manual_luks_buffer => move |_| {
|
||||
bottom_next_button.set_sensitive(false);
|
||||
let custom_root_mountpoint = partition_method_manual_chroot_dir_entry.text().to_string();
|
||||
// Mountpoint Check
|
||||
@ -817,12 +838,11 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
.expect("The channel needs to be open.");
|
||||
}
|
||||
}));
|
||||
let partition_method_manual_luks_password_entry_clone = partition_method_manual_luks_password_entry.clone();
|
||||
let luks_manual_is_encrypt_main_context = MainContext::default();
|
||||
// The main loop executes the asynchronous block
|
||||
luks_manual_is_encrypt_main_context.spawn_local(clone!(@weak partition_method_manual_luks_password_entry_clone => async move {
|
||||
luks_manual_is_encrypt_main_context.spawn_local(clone!(@weak partition_method_manual_luks_password_entry => async move {
|
||||
while let Ok(state) = luks_manual_is_encrypt_receiver.recv().await {
|
||||
partition_method_manual_luks_password_entry_clone.set_sensitive(state);
|
||||
partition_method_manual_luks_password_entry.set_sensitive(state);
|
||||
}
|
||||
}));
|
||||
// Luks Password Checking
|
||||
@ -848,12 +868,12 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
.expect("The channel needs to be open.");
|
||||
}
|
||||
}));
|
||||
let partition_method_manual_luks_error_label_clone = partition_method_manual_luks_error_label.clone();
|
||||
let luks_manual_password_main_context = MainContext::default();
|
||||
// The main loop executes the asynchronous block
|
||||
luks_manual_password_main_context.spawn_local(clone!(@weak partition_method_manual_luks_error_label_clone => async move {
|
||||
luks_manual_password_main_context.spawn_local(clone!(@weak partition_method_manual_luks_error_label, @weak bottom_next_button => async move {
|
||||
while let Ok(state) = luks_manual_password_receiver.recv().await {
|
||||
partition_method_manual_luks_error_label_clone.set_visible(state);
|
||||
partition_method_manual_luks_error_label.set_visible(state);
|
||||
bottom_next_button.set_sensitive(!state);
|
||||
}
|
||||
}));
|
||||
}
|
||||
@ -881,19 +901,19 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
partition_method_manual_boot_error_label.set_visible(false)
|
||||
} else {
|
||||
if home_not_boot_cli.status.success() {
|
||||
//
|
||||
partition_method_manual_boot_error_label.set_visible(false);
|
||||
} else {
|
||||
partition_method_manual_boot_error_label.set_label("the /home and /boot partitions are the same.");
|
||||
partition_method_manual_boot_error_label.set_visible(true);
|
||||
}
|
||||
if boot_not_efi_cli.status.success() {
|
||||
//
|
||||
partition_method_manual_boot_error_label.set_visible(false);
|
||||
} else {
|
||||
partition_method_manual_boot_error_label.set_label("the /boot/efi and /boot partitions are the same.");
|
||||
partition_method_manual_boot_error_label.set_visible(true);
|
||||
}
|
||||
if root_not_boot_cli.status.success() {
|
||||
//
|
||||
partition_method_manual_boot_error_label.set_visible(false);
|
||||
} else {
|
||||
partition_method_manual_boot_error_label.set_label("No boot partition found in chroot, mount (CUSTOM_ROOT)/boot.");
|
||||
partition_method_manual_boot_error_label.set_visible(true);
|
||||
@ -907,10 +927,13 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
.output()
|
||||
.expect("failed to execute process");
|
||||
if root_not_efi_cli.status.success() {
|
||||
partition_method_manual_efi_error_label.set_visible(false);
|
||||
} else {
|
||||
partition_method_manual_efi_error_label.set_label("No EFI partition found in chroot, mount (CUSTOM_ROOT)/boot/efi.");
|
||||
partition_method_manual_efi_error_label.set_visible(true);
|
||||
}
|
||||
if partition_method_manual_chroot_error_label.get_visible() == false && partition_method_manual_luks_error_label.get_visible() == false && partition_method_manual_boot_error_label.get_visible() == false && partition_method_manual_efi_error_label.get_visible() == false {
|
||||
partition_method_manual_target_buffer.set_text(&custom_root_mountpoint);
|
||||
bottom_next_button.set_sensitive(true);
|
||||
}
|
||||
}));
|
||||
@ -937,6 +960,14 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
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")));
|
||||
|
||||
let partition_method_automatic_target_buffer_clone = partition_method_automatic_target_buffer.clone();
|
||||
|
||||
let partition_method_automatic_luks_buffer_clone = partition_method_automatic_luks_buffer.clone();
|
||||
|
||||
let partition_method_manual_target_buffer_clone = partition_method_manual_target_buffer.clone();
|
||||
|
||||
let partition_method_manual_luks_buffer_clone = partition_method_manual_luks_buffer.clone();
|
||||
|
||||
bottom_next_button.connect_clicked(clone!(@weak content_stack => move |_| {
|
||||
content_stack.set_visible_child_name("install_page")
|
||||
}));
|
||||
@ -945,4 +976,38 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: >k::S
|
||||
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");
|
||||
}
|
||||
if Path::new("/tmp/pika-installer-gtk4-target-manual.txt").exists() {
|
||||
fs::remove_file("/tmp/pika-installer-gtk4-target-manual.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt");
|
||||
}
|
||||
if Path::new("/tmp/pika-installer-gtk4-target-automatic-luks.txt").exists() {
|
||||
fs::remove_file("/tmp/pika-installer-gtk4-target-automatic-luks.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt");
|
||||
}
|
||||
if Path::new("/tmp/pika-installer-gtk4-target-manual-luks.txt").exists() {
|
||||
fs::remove_file("/tmp/pika-installer-gtk4-target-manual-luks.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt");
|
||||
}
|
||||
if partitioning_stack.visible_child_name() == Some(GString::from_string_unchecked("partition_method_automatic_page".into())) {
|
||||
fs::write("/tmp/pika-installer-gtk4-target-auto.txt", partition_method_automatic_target_buffer_clone.text(&partition_method_automatic_target_buffer_clone.bounds().0, &partition_method_automatic_target_buffer_clone.bounds().1, true).to_string()).expect("Unable to write file");
|
||||
let automatic_luks_result = partition_method_automatic_luks_buffer_clone.text(&partition_method_automatic_luks_buffer_clone.bounds().0, &partition_method_automatic_luks_buffer_clone.bounds().1, true).to_string();
|
||||
if automatic_luks_result.is_empty() {
|
||||
//
|
||||
} else {
|
||||
fs::write("/tmp/pika-installer-gtk4-target-automatic-luks.txt", automatic_luks_result);
|
||||
}
|
||||
} 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());
|
||||
let manual_luks_result = partition_method_manual_luks_buffer_clone.text(&partition_method_manual_luks_buffer_clone.bounds().0, &partition_method_manual_luks_buffer_clone.bounds().1, true).to_string();
|
||||
if manual_luks_result.is_empty() {
|
||||
//
|
||||
} else {
|
||||
fs::write("/tmp/pika-installer-gtk4-target-manual-luks.txt", manual_luks_result);
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
}
|
@ -16,6 +16,9 @@ use std::process::Stdio;
|
||||
use std::time::Instant;
|
||||
use std::str;
|
||||
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn timezone_page(content_stack: >k::Stack) {
|
||||
|
||||
// create the bottom box for next and back buttons
|
||||
@ -169,6 +172,9 @@ pub fn timezone_page(content_stack: >k::Stack) {
|
||||
let timezone_layout_stdout = timezone_layout_cli.stdout.expect("could not get stdout");
|
||||
let timezone_layout_reader = BufReader::new(timezone_layout_stdout);
|
||||
|
||||
let timezone_data_buffer = gtk::TextBuffer::builder()
|
||||
.build();
|
||||
|
||||
for timezone_layout in timezone_layout_reader.lines() {
|
||||
let timezone_layout = timezone_layout.unwrap();
|
||||
let timezone_layout_clone = timezone_layout.clone();
|
||||
@ -177,10 +183,11 @@ pub fn timezone_page(content_stack: >k::Stack) {
|
||||
.build();
|
||||
timezone_layout_checkbutton.set_group(Some(&null_checkbutton));
|
||||
timezone_selection_expander_row_viewport_box.append(&timezone_layout_checkbutton);
|
||||
timezone_layout_checkbutton.connect_toggled(clone!(@weak timezone_layout_checkbutton, @weak timezone_selection_expander_row, @weak bottom_next_button => move |_| {
|
||||
timezone_layout_checkbutton.connect_toggled(clone!(@weak timezone_layout_checkbutton, @weak timezone_selection_expander_row, @weak bottom_next_button, @weak timezone_data_buffer => move |_| {
|
||||
if timezone_layout_checkbutton.is_active() == true {
|
||||
timezone_selection_expander_row.set_title(&timezone_layout);
|
||||
bottom_next_button.set_sensitive(true);
|
||||
timezone_data_buffer.set_text(&timezone_layout);
|
||||
}
|
||||
}));
|
||||
if current_timezone.contains(&(timezone_layout_clone)) {
|
||||
@ -210,8 +217,14 @@ pub fn timezone_page(content_stack: >k::Stack) {
|
||||
//// Add the timezone_main_box as page: timezone_page, Give it nice title
|
||||
content_stack.add_titled(&timezone_main_box, Some("timezone_page"), "Time Zone");
|
||||
|
||||
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")
|
||||
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");
|
||||
}));
|
||||
bottom_back_button.connect_clicked(clone!(@weak content_stack => move |_| {
|
||||
content_stack.set_visible_child_name("eula_page")
|
||||
|
Loading…
Reference in New Issue
Block a user