From 6c15902195caec23e40db770aa3eafe564bc10d9 Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Sun, 18 Aug 2024 03:20:30 +0300 Subject: [PATCH] i spent an entire day thinking wrong --- src/drive_mount_row/imp.rs | 6 +++++- src/drive_mount_row/mod.rs | 9 +++++++++ src/manual_partitioning_page/mod.rs | 12 ++++-------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/drive_mount_row/imp.rs b/src/drive_mount_row/imp.rs index c2791ca..0232b72 100644 --- a/src/drive_mount_row/imp.rs +++ b/src/drive_mount_row/imp.rs @@ -14,7 +14,11 @@ use crate::partitioning_page::FstabEntry; #[properties(wrapper_type = super::DriveMountRow)] pub struct DriveMountRow { #[property(get, set)] - fstabentry: RefCell, + partition: RefCell, + #[property(get, set)] + mountpoint: RefCell, + #[property(get, set)] + mountopts: RefCell, #[property(get, set)] deletable: RefCell, #[property(get, set)] diff --git a/src/drive_mount_row/mod.rs b/src/drive_mount_row/mod.rs index 15a2bec..4c70d91 100644 --- a/src/drive_mount_row/mod.rs +++ b/src/drive_mount_row/mod.rs @@ -3,6 +3,8 @@ mod imp; use glib::Object; use gtk::glib; +use crate::partitioning_page::FstabEntry; + glib::wrapper! { pub struct DriveMountRow(ObjectSubclass) @extends adw::ActionRow, gtk::Widget, gtk::ListBoxRow, adw::PreferencesRow, @@ -18,6 +20,13 @@ impl DriveMountRow { .property("partitionscroll", partitions_scroll) .build() } + pub fn get_fstab_entry(&self) -> FstabEntry { + FstabEntry{ + partition: self.partition(), + mountpoint: self.mountpoint(), + mountopt: self.mountopts() + } + } } // ANCHOR_END: mod diff --git a/src/manual_partitioning_page/mod.rs b/src/manual_partitioning_page/mod.rs index dbecdd0..8f517b5 100644 --- a/src/manual_partitioning_page/mod.rs +++ b/src/manual_partitioning_page/mod.rs @@ -167,7 +167,8 @@ fn create_mount_row( .activatable_widget(&partition_button) .title(part_name) .name(part_name) - .subtitle(t!("part_need_mapper")) + .subtitle(t!("part_need_mapper").to_string() + " " + &pretty_bytes::converter::convert(partition.part_size)) + .sensitive(false) .build(); prow } else { @@ -175,7 +176,7 @@ fn create_mount_row( .activatable_widget(&partition_button) .title(part_name) .name(part_name) - .subtitle(String::from(&partition.part_fs) + &pretty_bytes::converter::convert(partition.part_size)) + .subtitle(String::from(&partition.part_fs) + " " + &pretty_bytes::converter::convert(partition.part_size)) .build(); prow }; @@ -189,16 +190,11 @@ fn create_mount_row( partition_button, #[strong] partition, - #[strong] - fstab_refcell_array, move |_| { - let mut fstab_refcell_array_ref = RefCell::borrow_mut(&fstab_refcell_array); if partition_button.is_active() == true { let part_name = &partition.part_name; - //row.set_partition(part_name.to_string()); - } else { - + row.set_partition(part_name.to_string()); } } )