make data types location better
This commit is contained in:
parent
cb78296b0d
commit
20935ab35d
@ -1,15 +1,21 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
config::APP_ID, efi_error_page, eula_page, keyboard_page, language_page, partitioning_page::{self, CrypttabEntry, FstabEntry}, timezone_page, welcome_page
|
config::APP_ID, efi_error_page, eula_page, keyboard_page, language_page, timezone_page, welcome_page, partitioning_page
|
||||||
};
|
};
|
||||||
use gtk::{gio, glib, prelude::*};
|
use gtk::{gio, glib, prelude::*};
|
||||||
use std::{cell::RefCell, path::Path, rc::Rc};
|
use std::{cell::RefCell, path::Path, rc::Rc};
|
||||||
|
|
||||||
|
// Custom Installer Data types
|
||||||
|
|
||||||
|
/// Locale Data types
|
||||||
|
|
||||||
#[derive(Default, Clone, Debug)]
|
#[derive(Default, Clone, Debug)]
|
||||||
pub struct PikaLocale {
|
pub struct PikaLocale {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub pretty_name: String
|
pub pretty_name: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Keyboard Data types
|
||||||
|
|
||||||
#[derive(Default, Clone, Debug)]
|
#[derive(Default, Clone, Debug)]
|
||||||
pub struct PikaKeymap {
|
pub struct PikaKeymap {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
@ -17,6 +23,46 @@ pub struct PikaKeymap {
|
|||||||
pub pretty_name: String
|
pub pretty_name: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct BlockDevice {
|
||||||
|
pub block_name: String,
|
||||||
|
pub block_size: f64,
|
||||||
|
pub block_size_pretty: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Partitioning Data types
|
||||||
|
|
||||||
|
#[derive(Default, Clone, Debug)]
|
||||||
|
pub struct Partition {
|
||||||
|
pub part_name: String,
|
||||||
|
pub part_fs: String,
|
||||||
|
pub part_uuid: String,
|
||||||
|
pub has_encryption: bool,
|
||||||
|
pub need_mapper: bool,
|
||||||
|
pub part_size: f64,
|
||||||
|
pub part_size_pretty: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Clone, Debug)]
|
||||||
|
pub struct FstabEntry {
|
||||||
|
pub partition: Partition,
|
||||||
|
pub mountpoint: String,
|
||||||
|
pub mountopts: String,
|
||||||
|
pub used_by: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Clone, Debug)]
|
||||||
|
pub struct CrypttabEntry {
|
||||||
|
pub partition: String,
|
||||||
|
pub map: String,
|
||||||
|
pub uuid: String,
|
||||||
|
pub password: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct SubvolDeclaration {
|
||||||
|
pub part_name: Rc<std::cell::RefCell<String>>,
|
||||||
|
pub made_by: Rc<std::cell::RefCell<i32>>,
|
||||||
|
}
|
||||||
|
|
||||||
pub fn build_ui(app: &adw::Application) {
|
pub fn build_ui(app: &adw::Application) {
|
||||||
glib::set_prgname(Some(t!("application_name").to_string()));
|
glib::set_prgname(Some(t!("application_name").to_string()));
|
||||||
glib::set_application_name(&t!("application_name"));
|
glib::set_application_name(&t!("application_name"));
|
||||||
|
@ -1,20 +1,25 @@
|
|||||||
use crate::installer_stack_page;
|
use crate::{build_ui::{PikaLocale, PikaKeymap, FstabEntry, CrypttabEntry} installer_stack_page};
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use glib::{clone, closure_local};
|
use glib::{clone, closure_local};
|
||||||
use gnome_desktop::XkbInfoExt;
|
use gtk::{gio, glib};
|
||||||
use gtk::{gio, glib, prelude::*};
|
|
||||||
use std::{cell::RefCell, fs, path::Path, process::Command, rc::Rc};
|
use std::{cell::RefCell, fs, path::Path, process::Command, rc::Rc};
|
||||||
|
|
||||||
struct PikaKeymap {
|
|
||||||
name: String,
|
|
||||||
pretty_name: String
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn keyboard_page(
|
pub fn keyboard_page(
|
||||||
main_carousel: &adw::Carousel,
|
main_carousel: &adw::Carousel,
|
||||||
keymap_base_data_refcell: &Rc<RefCell<String>>,
|
|
||||||
keymap_variant_data_refcell: &Rc<RefCell<String>>,
|
|
||||||
language_changed_action: &gio::SimpleAction,
|
language_changed_action: &gio::SimpleAction,
|
||||||
|
language_selection_text_refcell: Rc<RefCell<PikaLocale>>,
|
||||||
|
keymap_selection_text_refcell: Rc<RefCell<PikaKeymap>>,
|
||||||
|
timezone_selection_text_refcell: Rc<RefCell<String>>,
|
||||||
|
partition_method_type_refcell: Rc<RefCell<String>>,
|
||||||
|
partition_method_automatic_target_refcell: Rc<RefCell<String>>,
|
||||||
|
partition_method_automatic_target_fs_refcell: Rc<RefCell<String>>,
|
||||||
|
partition_method_automatic_luks_enabled_refcell: Rc<RefCell<bool>>,
|
||||||
|
partition_method_automatic_luks_refcell: Rc<RefCell<String>>,
|
||||||
|
partition_method_automatic_ratio_refcell: Rc<RefCell<f64>>,
|
||||||
|
partition_method_automatic_seperation_refcell: Rc<RefCell<String>>,
|
||||||
|
partition_method_manual_fstab_entry_array_refcell: Rc<RefCell<Vec<FstabEntry>>>,
|
||||||
|
partition_method_manual_luks_enabled_refcell: Rc<RefCell<bool>>,
|
||||||
|
partition_method_manual_crypttab_entry_array_refcell: Rc<RefCell<Vec<CrypttabEntry>>>
|
||||||
) {
|
) {
|
||||||
let keyboard_page = installer_stack_page::InstallerStackPage::new();
|
let keyboard_page = installer_stack_page::InstallerStackPage::new();
|
||||||
keyboard_page.set_page_icon("keyboard-symbolic");
|
keyboard_page.set_page_icon("keyboard-symbolic");
|
||||||
|
19
src/main.rs
19
src/main.rs
@ -3,20 +3,23 @@ use gtk::{gdk, glib, prelude::*, CssProvider, STYLE_PROVIDER_PRIORITY_APPLICATIO
|
|||||||
use std::env;
|
use std::env;
|
||||||
mod build_ui;
|
mod build_ui;
|
||||||
mod config;
|
mod config;
|
||||||
mod efi_error_page;
|
|
||||||
mod installer_stack_page;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
mod installer_stack_page;
|
||||||
mod automatic_partitioning_page;
|
|
||||||
mod drive_mount_row;
|
mod drive_mount_row;
|
||||||
|
//
|
||||||
|
mod welcome_page;
|
||||||
|
mod efi_error_page;
|
||||||
|
//
|
||||||
mod eula_page;
|
mod eula_page;
|
||||||
mod keyboard_page;
|
mod keyboard_page;
|
||||||
mod language_page;
|
mod language_page;
|
||||||
mod manual_partitioning_page;
|
|
||||||
mod partitioning_page;
|
|
||||||
mod timezone_page;
|
mod timezone_page;
|
||||||
mod welcome_page;
|
//
|
||||||
|
mod partitioning_page;
|
||||||
|
mod automatic_partitioning_page;
|
||||||
|
mod manual_partitioning_page;
|
||||||
|
//
|
||||||
|
mod installation_summary_page;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate rust_i18n;
|
extern crate rust_i18n;
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
use crate::drive_mount_row::DriveMountRow;
|
use crate::drive_mount_row::DriveMountRow;
|
||||||
use crate::installer_stack_page;
|
use crate::{build_ui::{CrypttabEntry, FstabEntry, Partition, SubvolDeclaration}, partitioning_page::{get_partitions}};
|
||||||
use crate::partitioning_page::{get_partitions, CrypttabEntry, FstabEntry, Partition, SubvolDeclaration};
|
|
||||||
use adw::gio;
|
use adw::gio;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use glib::{clone, closure_local, ffi::gboolean};
|
use glib::{clone, closure_local};
|
||||||
use gtk::{glib, prelude::*};
|
use gtk::glib;
|
||||||
use std::{cell::RefCell, rc::Rc};
|
use std::{cell::RefCell, rc::Rc};
|
||||||
|
|
||||||
const MINIMUM_EFI_BYTE_SIZE: f64 = 500000000.0;
|
const MINIMUM_EFI_BYTE_SIZE: f64 = 500000000.0;
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
use crate::drive_mount_row::DriveMountRow;
|
use crate::drive_mount_row::DriveMountRow;
|
||||||
use crate::installer_stack_page;
|
use crate::{build_ui::{CrypttabEntry, FstabEntry, Partition, SubvolDeclaration}, installer_stack_page, partitioning_page::{get_partitions, get_luks_uuid, test_luks_passwd}};
|
||||||
use crate::partitioning_page;
|
|
||||||
use crate::partitioning_page::get_luks_uuid;
|
|
||||||
use crate::partitioning_page::{get_partitions, CrypttabEntry, FstabEntry, Partition, SubvolDeclaration};
|
|
||||||
use adw::gio;
|
use adw::gio;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use glib::{clone, closure_local, ffi::gboolean};
|
use glib::{clone, closure_local};
|
||||||
use gtk::glib::Variant;
|
use gtk::{glib, Orientation};
|
||||||
use gtk::{glib, prelude::*, Orientation};
|
|
||||||
use std::{cell::RefCell, collections::HashSet, rc::Rc};
|
use std::{cell::RefCell, collections::HashSet, rc::Rc};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
@ -599,7 +595,7 @@ fn set_crypttab_entries(
|
|||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
luks_manual_password_sender
|
luks_manual_password_sender
|
||||||
.send_blocking(partitioning_page::test_luks_passwd(
|
.send_blocking(test_luks_passwd(
|
||||||
&fs_entry_clone1.partition.part_name,
|
&fs_entry_clone1.partition.part_name,
|
||||||
&luks_password,
|
&luks_password,
|
||||||
))
|
))
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
use crate::drive_mount_row::DriveMountRow;
|
use crate::{build_ui::{FstabEntry, CrypttabEntry, BlockDevice, SubvolDeclaration, Partition}, installer_stack_page, automatic_partitioning_page, manual_partitioning_page};
|
||||||
use crate::installer_stack_page;
|
|
||||||
use crate::{automatic_partitioning_page, manual_partitioning_page};
|
|
||||||
use glib::{clone, closure_local, Properties};
|
use glib::{clone, closure_local, Properties};
|
||||||
use gtk::{gio, glib, prelude::*};
|
use gtk::{gio, glib, prelude::*};
|
||||||
use std::io::BufRead;
|
use std::io::BufRead;
|
||||||
@ -169,44 +167,6 @@ pub fn partitioning_page(
|
|||||||
main_carousel.append(&partitioning_carousel)
|
main_carousel.append(&partitioning_carousel)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct BlockDevice {
|
|
||||||
pub block_name: String,
|
|
||||||
pub block_size: f64,
|
|
||||||
pub block_size_pretty: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Clone, Debug)]
|
|
||||||
pub struct Partition {
|
|
||||||
pub part_name: String,
|
|
||||||
pub part_fs: String,
|
|
||||||
pub part_uuid: String,
|
|
||||||
pub has_encryption: bool,
|
|
||||||
pub need_mapper: bool,
|
|
||||||
pub part_size: f64,
|
|
||||||
pub part_size_pretty: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Clone, Debug)]
|
|
||||||
pub struct FstabEntry {
|
|
||||||
pub partition: Partition,
|
|
||||||
pub mountpoint: String,
|
|
||||||
pub mountopts: String,
|
|
||||||
pub used_by: i32,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Clone, Debug)]
|
|
||||||
pub struct CrypttabEntry {
|
|
||||||
pub partition: String,
|
|
||||||
pub map: String,
|
|
||||||
pub uuid: String,
|
|
||||||
pub password: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct SubvolDeclaration {
|
|
||||||
pub part_name: Rc<std::cell::RefCell<String>>,
|
|
||||||
pub made_by: Rc<std::cell::RefCell<i32>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_block_devices() -> Vec<BlockDevice> {
|
pub fn get_block_devices() -> Vec<BlockDevice> {
|
||||||
let mut block_devices = Vec::new();
|
let mut block_devices = Vec::new();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user