i spent an entire day thinking wrong

This commit is contained in:
Ward from fusion-voyager-3 2024-08-18 03:20:30 +03:00
parent f7cde6bf14
commit 6c15902195
3 changed files with 18 additions and 9 deletions

View File

@ -14,7 +14,11 @@ use crate::partitioning_page::FstabEntry;
#[properties(wrapper_type = super::DriveMountRow)] #[properties(wrapper_type = super::DriveMountRow)]
pub struct DriveMountRow { pub struct DriveMountRow {
#[property(get, set)] #[property(get, set)]
fstabentry: RefCell<FstabEntry>, partition: RefCell<String>,
#[property(get, set)]
mountpoint: RefCell<String>,
#[property(get, set)]
mountopts: RefCell<String>,
#[property(get, set)] #[property(get, set)]
deletable: RefCell<bool>, deletable: RefCell<bool>,
#[property(get, set)] #[property(get, set)]

View File

@ -3,6 +3,8 @@ mod imp;
use glib::Object; use glib::Object;
use gtk::glib; use gtk::glib;
use crate::partitioning_page::FstabEntry;
glib::wrapper! { glib::wrapper! {
pub struct DriveMountRow(ObjectSubclass<imp::DriveMountRow>) pub struct DriveMountRow(ObjectSubclass<imp::DriveMountRow>)
@extends adw::ActionRow, gtk::Widget, gtk::ListBoxRow, adw::PreferencesRow, @extends adw::ActionRow, gtk::Widget, gtk::ListBoxRow, adw::PreferencesRow,
@ -18,6 +20,13 @@ impl DriveMountRow {
.property("partitionscroll", partitions_scroll) .property("partitionscroll", partitions_scroll)
.build() .build()
} }
pub fn get_fstab_entry(&self) -> FstabEntry {
FstabEntry{
partition: self.partition(),
mountpoint: self.mountpoint(),
mountopt: self.mountopts()
}
}
} }
// ANCHOR_END: mod // ANCHOR_END: mod

View File

@ -167,7 +167,8 @@ fn create_mount_row(
.activatable_widget(&partition_button) .activatable_widget(&partition_button)
.title(part_name) .title(part_name)
.name(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(); .build();
prow prow
} else { } else {
@ -175,7 +176,7 @@ fn create_mount_row(
.activatable_widget(&partition_button) .activatable_widget(&partition_button)
.title(part_name) .title(part_name)
.name(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(); .build();
prow prow
}; };
@ -189,16 +190,11 @@ fn create_mount_row(
partition_button, partition_button,
#[strong] #[strong]
partition, partition,
#[strong]
fstab_refcell_array,
move |_| move |_|
{ {
let mut fstab_refcell_array_ref = RefCell::borrow_mut(&fstab_refcell_array);
if partition_button.is_active() == true { if partition_button.is_active() == true {
let part_name = &partition.part_name; let part_name = &partition.part_name;
//row.set_partition(part_name.to_string()); row.set_partition(part_name.to_string());
} else {
} }
} }
) )