Create basis for manual parting UI

This commit is contained in:
Ward from fusion-voyager-3 2024-08-17 01:15:03 +03:00
parent 909fb657f3
commit 757f0c3f95
5 changed files with 117 additions and 7 deletions

View File

@ -13,8 +13,8 @@
"choose_install_method": "Choose an install method",
"manual_partition_drive": "Manually Partition The Drive",
"auto_partition_drive": "Automatically Partition\nThe Drive",
"manual_part_installer": "Manual Partitioning Installer",
"use_utility_manual": "Use this utility to partition/mount/format your drives.\nNotes:\n - This installer doesn't erase any data automatically, format your drives manually via gparted.\n - To Add a linux-swap partition set mountpoint to [SWAP]",
"manual_part_installer": "Manual Disk Partitioning",
"manual_part_info": "Use This Page to Create a Custom Filesystem Table for PikaOS to install into.\nNotes:\n - This installer doesn't erase any data automatically, format your drives manually via gparted.\n - To Add a linux-swap partition set mountpoint to [SWAP]",
"open_gparted": "Open GPARTED",
"manual_part_note": " - Press the plus button below to begin adding filesystem entries.",
"refresh_part_table": "Refresh Partition Table",

View File

@ -83,6 +83,9 @@ pub fn build_ui(app: &adw::Application) {
&partition_method_automatic_luks_refcell,
&partition_method_automatic_ratio_refcell,
&partition_method_automatic_seperation_refcell,
&partition_method_manual_fstab_json_refcell,
&partition_method_manual_luks_enabled_refcell,
&partition_method_manual_crypttab_json_refcell,
&language_changed_action);
window.present()

View File

@ -15,7 +15,7 @@ mod keyboard_page;
mod timezone_page;
mod partitioning_page;
mod automatic_partitioning_page;
mod manual_partitioning;
mod manual_partitioning_page;
#[macro_use]
extern crate rust_i18n;

View File

@ -0,0 +1,99 @@
use adw::gio;
use crate::installer_stack_page;
use gtk::{prelude::*, glib as glib};
use crate::partitioning_page::{get_block_devices};
use adw::{prelude::*};
use glib::{clone, closure_local, ffi::gboolean};
use std::{rc::Rc, cell::RefCell};
const MINIMUM_EFI_BYTE_SIZE: f64 = 500000000.0;
const MINIMUM_BOOT_BYTE_SIZE: f64 = 1000000000.0;
const MINIMUM_ROOT_BYTE_SIZE: f64 = 39000000000.0;
pub fn manual_partitioning_page(
partition_carousel: &adw::Carousel,
partition_method_type_refcell: &Rc<RefCell<String>>,
partition_method_manual_fstab_json_refcell: &Rc<RefCell<String>>,
partition_method_manual_luks_enabled_refcell: &Rc<RefCell<bool>>,
partition_method_manual_crypttab_json_refcell: &Rc<RefCell<String>>,
language_changed_action: &gio::SimpleAction
) {
let manual_partitioning_page = installer_stack_page::InstallerStackPage::new();
manual_partitioning_page.set_page_icon("emblem-system-symbolic");
manual_partitioning_page.set_back_visible(true);
manual_partitioning_page.set_next_visible(true);
manual_partitioning_page.set_back_sensitive(true);
manual_partitioning_page.set_next_sensitive(false);
//
let content_box = gtk::Box::builder()
.orientation(gtk::Orientation::Vertical)
.hexpand(true)
.vexpand(true)
.build();
//
manual_partitioning_page.connect_closure(
"back-button-pressed",
false,
closure_local!(
#[weak]
partition_carousel,
move |_manual_partitioning_page: installer_stack_page::InstallerStackPage|
{
partition_carousel.scroll_to(&partition_carousel.nth_page(0), true)
}
)
);
manual_partitioning_page.connect_closure(
"next-button-pressed",
false,
closure_local!(
#[weak]
partition_carousel,
#[strong]
partition_method_type_refcell,
#[strong]
partition_method_manual_fstab_json_refcell,
#[strong]
partition_method_manual_luks_enabled_refcell,
#[strong]
partition_method_manual_crypttab_json_refcell,
move |_automatic_partitioning_page: installer_stack_page::InstallerStackPage|
{
*partition_method_type_refcell.borrow_mut() = String::from("manual");
//partition_carousel.scroll_to(&partition_carousel.nth_page(5), true)
dbg!(partition_method_type_refcell.borrow());
dbg!(partition_method_manual_fstab_json_refcell.borrow());
dbg!(partition_method_manual_luks_enabled_refcell.borrow());
dbg!(partition_method_manual_crypttab_json_refcell.borrow());
}
)
);
//
//
manual_partitioning_page.set_child_widget(&content_box);
partition_carousel.append(&manual_partitioning_page);
//
language_changed_action.connect_activate(clone!(
#[weak]
manual_partitioning_page,
move |_, _| {
manual_partitioning_page.set_page_title(t!("manual_part_installer"));
manual_partitioning_page.set_page_subtitle(t!("manual_part_info"));
manual_partitioning_page.set_back_tooltip_label(t!("back"));
manual_partitioning_page.set_next_tooltip_label(t!("next"));
}
)
);
//
}

View File

@ -1,7 +1,7 @@
use crate::installer_stack_page;
use gtk::{prelude::*, glib as glib, gio as gio};
use glib::{clone, closure_local};
use crate::{automatic_partitioning_page};
use crate::{automatic_partitioning_page, manual_partitioning_page};
use std::{rc::Rc, cell::RefCell};
use std::io::BufRead;
@ -14,6 +14,9 @@ pub fn partitioning_page(
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_json_refcell: &Rc<RefCell<String>>,
partition_method_manual_luks_enabled_refcell: &Rc<RefCell<bool>>,
partition_method_manual_crypttab_json_refcell: &Rc<RefCell<String>>,
language_changed_action: &gio::SimpleAction
) {
let partitioning_page = installer_stack_page::InstallerStackPage::new();
@ -47,7 +50,7 @@ pub fn partitioning_page(
.build();
let manual_method_button = gtk::Button::builder()
.icon_name("org.gnome.Settings")
.icon_name("emblem-system-symbolics")
.build();
automatic_method_button.connect_clicked(
@ -103,6 +106,13 @@ pub fn partitioning_page(
&partition_method_automatic_ratio_refcell,
&partition_method_automatic_seperation_refcell,
&language_changed_action);
manual_partitioning_page::manual_partitioning_page(
&partitioning_carousel,
&partition_method_type_refcell,
&partition_method_manual_fstab_json_refcell,
&partition_method_manual_luks_enabled_refcell,
&partition_method_manual_crypttab_json_refcell,
&language_changed_action);
partitioning_page.connect_closure(
"back-button-pressed",
@ -117,8 +127,6 @@ pub fn partitioning_page(
)
);
dbg!(get_partitions());
main_carousel.append(&partitioning_carousel)
}