begin manual UI GRAFT

This commit is contained in:
Ward from fusion-voyager-3 2024-08-17 01:03:09 +03:00
parent 633dd20936
commit 909fb657f3
5 changed files with 111 additions and 22 deletions

View File

@ -14,9 +14,9 @@
"manual_partition_drive": "Manually Partition The Drive", "manual_partition_drive": "Manually Partition The Drive",
"auto_partition_drive": "Automatically Partition\nThe Drive", "auto_partition_drive": "Automatically Partition\nThe Drive",
"manual_part_installer": "Manual Partitioning Installer", "manual_part_installer": "Manual Partitioning Installer",
"use_utility_manual": "Use this utility to partition/mount/format your drives.", "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]",
"open_gparted": "Open GPARTED", "open_gparted": "Open GPARTED",
"manual_part_note": " - Press the plus button below to begin adding filesystem entries.\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]\n - We recommend the following partitions as a base layout:\n /boot ~ 1000mb ext4.\n /boot/efi ~ 512mb vfat/fat32.\n / >= 25GB btrfs.\n ", "manual_part_note": " - Press the plus button below to begin adding filesystem entries.",
"refresh_part_table": "Refresh Partition Table", "refresh_part_table": "Refresh Partition Table",
"validate_fs_table": "Validate Filesystem Table", "validate_fs_table": "Validate Filesystem Table",
"fstab_status_valid": "Filesystem Table Status: All entries are valid!", "fstab_status_valid": "Filesystem Table Status: All entries are valid!",

View File

@ -10,7 +10,7 @@ const BOOT_AND_EFI_BYTE_SIZE: f64 = 1611661312.0;
const MINIMUM_ROOT_BYTE_SIZE: f64 = 39000000000.0; const MINIMUM_ROOT_BYTE_SIZE: f64 = 39000000000.0;
pub fn automatic_partitioning_page( pub fn automatic_partitioning_page(
main_carousel: &adw::Carousel, partition_carousel: &adw::Carousel,
partition_method_type_refcell: &Rc<RefCell<String>>, partition_method_type_refcell: &Rc<RefCell<String>>,
partition_method_automatic_target_refcell: &Rc<RefCell<String>>, partition_method_automatic_target_refcell: &Rc<RefCell<String>>,
partition_method_automatic_target_fs_refcell: &Rc<RefCell<String>>, partition_method_automatic_target_fs_refcell: &Rc<RefCell<String>>,
@ -33,19 +33,6 @@ pub fn automatic_partitioning_page(
.vexpand(true) .vexpand(true)
.build(); .build();
automatic_partitioning_page.connect_closure(
"back-button-pressed",
false,
closure_local!(
#[weak]
main_carousel,
move |_automatic_partitioning_page: installer_stack_page::InstallerStackPage|
{
main_carousel.scroll_to(&main_carousel.nth_page(0), true)
}
)
);
// //
// Advanced // Advanced
@ -572,10 +559,10 @@ pub fn automatic_partitioning_page(
false, false,
closure_local!( closure_local!(
#[weak] #[weak]
main_carousel, partition_carousel,
move |_automatic_partitioning_page: installer_stack_page::InstallerStackPage| move |_automatic_partitioning_page: installer_stack_page::InstallerStackPage|
{ {
main_carousel.scroll_to(&main_carousel.nth_page(0), true) partition_carousel.scroll_to(&partition_carousel.nth_page(0), true)
} }
) )
); );
@ -585,7 +572,7 @@ pub fn automatic_partitioning_page(
false, false,
closure_local!( closure_local!(
#[weak] #[weak]
main_carousel, partition_carousel,
#[strong] #[strong]
partition_method_type_refcell, partition_method_type_refcell,
#[strong] #[strong]
@ -603,7 +590,7 @@ pub fn automatic_partitioning_page(
move |_automatic_partitioning_page: installer_stack_page::InstallerStackPage| move |_automatic_partitioning_page: installer_stack_page::InstallerStackPage|
{ {
*partition_method_type_refcell.borrow_mut() = String::from("automatic"); *partition_method_type_refcell.borrow_mut() = String::from("automatic");
//main_carousel.scroll_to(&main_carousel.nth_page(5), true) //partition_carousel.scroll_to(&partition_carousel.nth_page(5), true)
dbg!(partition_method_type_refcell.borrow()); dbg!(partition_method_type_refcell.borrow());
dbg!(partition_method_automatic_target_fs_refcell.borrow()); dbg!(partition_method_automatic_target_fs_refcell.borrow());
dbg!(partition_method_automatic_target_refcell.borrow()); dbg!(partition_method_automatic_target_refcell.borrow());
@ -618,7 +605,7 @@ pub fn automatic_partitioning_page(
automatic_partitioning_page.set_child_widget(&content_box); automatic_partitioning_page.set_child_widget(&content_box);
main_carousel.append(&automatic_partitioning_page); partition_carousel.append(&automatic_partitioning_page);
// //
language_changed_action.connect_activate(clone!( language_changed_action.connect_activate(clone!(

View File

@ -60,6 +60,9 @@ pub fn build_ui(app: &adw::Application) {
let partition_method_automatic_luks_refcell: Rc<RefCell<String>> = Rc::new(RefCell::default()); let partition_method_automatic_luks_refcell: Rc<RefCell<String>> = Rc::new(RefCell::default());
let partition_method_automatic_ratio_refcell: Rc<RefCell<f64>> = Rc::new(RefCell::new(0.0)); let partition_method_automatic_ratio_refcell: Rc<RefCell<f64>> = Rc::new(RefCell::new(0.0));
let partition_method_automatic_seperation_refcell: Rc<RefCell<String>> = Rc::new(RefCell::default()); let partition_method_automatic_seperation_refcell: Rc<RefCell<String>> = Rc::new(RefCell::default());
let partition_method_manual_fstab_json_refcell: Rc<RefCell<String>> = Rc::new(RefCell::default());
let partition_method_manual_luks_enabled_refcell: Rc<RefCell<bool>> = Rc::new(RefCell::new(false));
let partition_method_manual_crypttab_json_refcell: Rc<RefCell<String>> = Rc::new(RefCell::default());
let language_changed_action = gio::SimpleAction::new("lang-changed", None); let language_changed_action = gio::SimpleAction::new("lang-changed", None);

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(
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("automatic");
//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!("auto_part_installer"));
manual_partitioning_page.set_page_subtitle(t!("choose_drive_auto"));
manual_partitioning_page.set_back_tooltip_label(t!("back"));
manual_partitioning_page.set_next_tooltip_label(t!("next"));
}
)
);
//
}

View File

@ -164,7 +164,7 @@ pub fn manual_partitioning(
// the header icon for the partitioning icon // the header icon for the partitioning icon
let partition_method_manual_header_icon = gtk::Image::builder() let partition_method_manual_header_icon = gtk::Image::builder()
.icon_name("org.gnome.Settings") .icon_name("emblem-system-symbolic")
.halign(gtk::Align::Start) .halign(gtk::Align::Start)
.hexpand(true) .hexpand(true)
.pixel_size(78) .pixel_size(78)