make data types location better
This commit is contained in:
parent
cb78296b0d
commit
20935ab35d
@ -1,15 +1,21 @@
|
||||
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 std::{cell::RefCell, path::Path, rc::Rc};
|
||||
|
||||
// Custom Installer Data types
|
||||
|
||||
/// Locale Data types
|
||||
|
||||
#[derive(Default, Clone, Debug)]
|
||||
pub struct PikaLocale {
|
||||
pub name: String,
|
||||
pub pretty_name: String
|
||||
}
|
||||
|
||||
/// Keyboard Data types
|
||||
|
||||
#[derive(Default, Clone, Debug)]
|
||||
pub struct PikaKeymap {
|
||||
pub name: String,
|
||||
@ -17,6 +23,46 @@ pub struct PikaKeymap {
|
||||
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) {
|
||||
glib::set_prgname(Some(t!("application_name").to_string()));
|
||||
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 glib::{clone, closure_local};
|
||||
use gnome_desktop::XkbInfoExt;
|
||||
use gtk::{gio, glib, prelude::*};
|
||||
use gtk::{gio, glib};
|
||||
use std::{cell::RefCell, fs, path::Path, process::Command, rc::Rc};
|
||||
|
||||
struct PikaKeymap {
|
||||
name: String,
|
||||
pretty_name: String
|
||||
}
|
||||
|
||||
pub fn keyboard_page(
|
||||
main_carousel: &adw::Carousel,
|
||||
keymap_base_data_refcell: &Rc<RefCell<String>>,
|
||||
keymap_variant_data_refcell: &Rc<RefCell<String>>,
|
||||
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();
|
||||
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;
|
||||
mod build_ui;
|
||||
mod config;
|
||||
mod efi_error_page;
|
||||
mod installer_stack_page;
|
||||
|
||||
//
|
||||
|
||||
mod automatic_partitioning_page;
|
||||
mod installer_stack_page;
|
||||
mod drive_mount_row;
|
||||
//
|
||||
mod welcome_page;
|
||||
mod efi_error_page;
|
||||
//
|
||||
mod eula_page;
|
||||
mod keyboard_page;
|
||||
mod language_page;
|
||||
mod manual_partitioning_page;
|
||||
mod partitioning_page;
|
||||
mod timezone_page;
|
||||
mod welcome_page;
|
||||
//
|
||||
mod partitioning_page;
|
||||
mod automatic_partitioning_page;
|
||||
mod manual_partitioning_page;
|
||||
//
|
||||
mod installation_summary_page;
|
||||
|
||||
#[macro_use]
|
||||
extern crate rust_i18n;
|
||||
|
@ -1,10 +1,9 @@
|
||||
use crate::drive_mount_row::DriveMountRow;
|
||||
use crate::installer_stack_page;
|
||||
use crate::partitioning_page::{get_partitions, CrypttabEntry, FstabEntry, Partition, SubvolDeclaration};
|
||||
use crate::{build_ui::{CrypttabEntry, FstabEntry, Partition, SubvolDeclaration}, partitioning_page::{get_partitions}};
|
||||
use adw::gio;
|
||||
use adw::prelude::*;
|
||||
use glib::{clone, closure_local, ffi::gboolean};
|
||||
use gtk::{glib, prelude::*};
|
||||
use glib::{clone, closure_local};
|
||||
use gtk::glib;
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
|
||||
const MINIMUM_EFI_BYTE_SIZE: f64 = 500000000.0;
|
||||
|
@ -1,13 +1,9 @@
|
||||
use crate::drive_mount_row::DriveMountRow;
|
||||
use crate::installer_stack_page;
|
||||
use crate::partitioning_page;
|
||||
use crate::partitioning_page::get_luks_uuid;
|
||||
use crate::partitioning_page::{get_partitions, CrypttabEntry, FstabEntry, Partition, SubvolDeclaration};
|
||||
use crate::{build_ui::{CrypttabEntry, FstabEntry, Partition, SubvolDeclaration}, installer_stack_page, partitioning_page::{get_partitions, get_luks_uuid, test_luks_passwd}};
|
||||
use adw::gio;
|
||||
use adw::prelude::*;
|
||||
use glib::{clone, closure_local, ffi::gboolean};
|
||||
use gtk::glib::Variant;
|
||||
use gtk::{glib, prelude::*, Orientation};
|
||||
use glib::{clone, closure_local};
|
||||
use gtk::{glib, Orientation};
|
||||
use std::{cell::RefCell, collections::HashSet, rc::Rc};
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
@ -599,7 +595,7 @@ fn set_crypttab_entries(
|
||||
|
||||
std::thread::spawn(move || {
|
||||
luks_manual_password_sender
|
||||
.send_blocking(partitioning_page::test_luks_passwd(
|
||||
.send_blocking(test_luks_passwd(
|
||||
&fs_entry_clone1.partition.part_name,
|
||||
&luks_password,
|
||||
))
|
||||
|
@ -1,6 +1,4 @@
|
||||
use crate::drive_mount_row::DriveMountRow;
|
||||
use crate::installer_stack_page;
|
||||
use crate::{automatic_partitioning_page, manual_partitioning_page};
|
||||
use crate::{build_ui::{FstabEntry, CrypttabEntry, BlockDevice, SubvolDeclaration, Partition}, installer_stack_page, automatic_partitioning_page, manual_partitioning_page};
|
||||
use glib::{clone, closure_local, Properties};
|
||||
use gtk::{gio, glib, prelude::*};
|
||||
use std::io::BufRead;
|
||||
@ -169,44 +167,6 @@ pub fn partitioning_page(
|
||||
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> {
|
||||
let mut block_devices = Vec::new();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user