Remove unused

This commit is contained in:
Ward from fusion-voyager-3 2024-08-20 18:27:01 +03:00
parent cae58cb750
commit 2f36e404a5
2 changed files with 28 additions and 79 deletions

View File

@ -216,10 +216,7 @@ pub fn create_efi_row(
} else { } else {
(*subvol_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition()); (*subvol_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition());
} }
partition_changed_action.activate(Some(&glib::variant::Variant::from_data_with_type( partition_changed_action.activate(None);
row.id().to_string(),
glib::VariantTy::STRING,
)));
} }
)); ));
@ -239,14 +236,8 @@ pub fn create_efi_row(
partition_changed_action, partition_changed_action,
move |row: DriveMountRow| { move |row: DriveMountRow| {
listbox.remove(&row); listbox.remove(&row);
(*used_partition_array_refcell.borrow_mut()) (*used_partition_array_refcell.borrow_mut()).retain(|x| x.used_by != row.id());
.retain(|x| x.used_by != row.id()); partition_changed_action.activate(None);
partition_changed_action.activate(Some(
&glib::variant::Variant::from_data_with_type(
row.id().to_string(),
glib::VariantTy::STRING,
),
));
} }
), ),
); );
@ -448,10 +439,7 @@ pub fn create_boot_row(
} else { } else {
(*subvol_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition()); (*subvol_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition());
} }
partition_changed_action.activate(Some(&glib::variant::Variant::from_data_with_type( partition_changed_action.activate(None);
row.id().to_string(),
glib::VariantTy::STRING,
)));
} }
)); ));
@ -471,14 +459,8 @@ pub fn create_boot_row(
partition_changed_action, partition_changed_action,
move |row: DriveMountRow| { move |row: DriveMountRow| {
listbox.remove(&row); listbox.remove(&row);
(*used_partition_array_refcell.borrow_mut()) (*used_partition_array_refcell.borrow_mut()).retain(|x| x.used_by != row.id());
.retain(|x| x.used_by != row.id()); partition_changed_action.activate(None);
partition_changed_action.activate(Some(
&glib::variant::Variant::from_data_with_type(
row.id().to_string(),
glib::VariantTy::STRING,
),
));
} }
), ),
); );
@ -685,10 +667,7 @@ pub fn create_root_row(
} else { } else {
(*subvol_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition()); (*subvol_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition());
} }
partition_changed_action.activate(Some(&glib::variant::Variant::from_data_with_type( partition_changed_action.activate(None);
row.id().to_string(),
glib::VariantTy::STRING,
)));
} }
)); ));
@ -708,14 +687,8 @@ pub fn create_root_row(
partition_changed_action, partition_changed_action,
move |row: DriveMountRow| { move |row: DriveMountRow| {
listbox.remove(&row); listbox.remove(&row);
(*used_partition_array_refcell.borrow_mut()) (*used_partition_array_refcell.borrow_mut()).retain(|x| x.used_by != row.id());
.retain(|x| x.used_by != row.id()); partition_changed_action.activate(None);
partition_changed_action.activate(Some(
&glib::variant::Variant::from_data_with_type(
row.id().to_string(),
glib::VariantTy::STRING,
),
));
} }
), ),
); );
@ -886,10 +859,7 @@ pub fn create_mount_row(
} else { } else {
(*subvol_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition()); (*subvol_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition());
} }
partition_changed_action.activate(Some(&glib::variant::Variant::from_data_with_type( partition_changed_action.activate(None);
row.id().to_string(),
glib::VariantTy::STRING,
)));
} }
)); ));
@ -909,14 +879,8 @@ pub fn create_mount_row(
partition_changed_action, partition_changed_action,
move |row: DriveMountRow| { move |row: DriveMountRow| {
listbox.remove(&row); listbox.remove(&row);
(*used_partition_array_refcell.borrow_mut()) (*used_partition_array_refcell.borrow_mut()).retain(|x| x.used_by != row.id());
.retain(|x| x.used_by != row.id()); partition_changed_action.activate(None);
partition_changed_action.activate(Some(
&glib::variant::Variant::from_data_with_type(
row.id().to_string(),
glib::VariantTy::STRING,
),
));
} }
), ),
); );
@ -991,12 +955,7 @@ fn post_check_drive_mount(
(*used_partition_array_refcell.borrow_mut()) (*used_partition_array_refcell.borrow_mut())
.retain(|x| x.used_by != row.id()); .retain(|x| x.used_by != row.id());
} }
partition_changed_action.activate(Some( partition_changed_action.activate(None);
&glib::variant::Variant::from_data_with_type(
row.id().to_string(),
glib::VariantTy::STRING,
),
));
} }
} }
} }
@ -1033,12 +992,7 @@ fn post_check_drive_mount(
(*used_partition_array_refcell.borrow_mut()).retain(|x| x.used_by != row.id()); (*used_partition_array_refcell.borrow_mut()).retain(|x| x.used_by != row.id());
null_checkbutton.set_active(true); null_checkbutton.set_active(true);
row.set_partition(""); row.set_partition("");
partition_changed_action.activate(Some( partition_changed_action.activate(None);
&glib::variant::Variant::from_data_with_type(
row.id().to_string(),
glib::VariantTy::STRING,
),
));
partition_row_struct.widget.set_sensitive(false); partition_row_struct.widget.set_sensitive(false);
} }
} else { } else {
@ -1066,17 +1020,11 @@ fn post_check_drive_mount(
used_partition_array_refcell, used_partition_array_refcell,
#[strong] #[strong]
subvol_partition_array_refcell, subvol_partition_array_refcell,
move |_, varient| { move |_, _| {
let part_name = &partition.part_name; let part_name = &partition.part_name;
let used_partition_array = used_partition_array_refcell.borrow(); let used_partition_array = used_partition_array_refcell.borrow();
let subvol_partition_array = subvol_partition_array_refcell.borrow(); let subvol_partition_array = subvol_partition_array_refcell.borrow();
//dbg!(&used_partition_array);
let action_id = String::from_utf8_lossy(varient.unwrap().data())
.parse::<i32>()
.unwrap();
if used_partition_array.iter().any(|e| { if used_partition_array.iter().any(|e| {
(part_name == &e.partition.part_name && part_name != &row.partition()) (part_name == &e.partition.part_name && part_name != &row.partition())
&& (subvol_partition_array.iter().any(|e| part_name == e)) && (subvol_partition_array.iter().any(|e| part_name == e))
@ -1088,10 +1036,11 @@ fn post_check_drive_mount(
partition_row_struct.widget.set_sensitive(true); partition_row_struct.widget.set_sensitive(true);
} }
(*partition_row_struct.used.borrow_mut()) = 2; (*partition_row_struct.used.borrow_mut()) = 2;
} else if used_partition_array } else if used_partition_array.iter().any(|e| {
.iter() part_name == &e.partition.part_name
.any(|e| part_name == &e.partition.part_name && e.used_by != row.id() && !subvol_partition_array.iter().any(|e| part_name == e)) && e.used_by != row.id()
{ && !subvol_partition_array.iter().any(|e| part_name == e)
}) {
if &row.partition() == part_name { if &row.partition() == part_name {
null_checkbutton.set_active(true); null_checkbutton.set_active(true);
row.set_partition(""); row.set_partition("");
@ -1099,13 +1048,13 @@ fn post_check_drive_mount(
partition_row_struct.widget.set_sensitive(false); partition_row_struct.widget.set_sensitive(false);
(*partition_row_struct.used.borrow_mut()) = 1; (*partition_row_struct.used.borrow_mut()) = 1;
} else { } else {
if *partition_row_struct.never.borrow() == false if *partition_row_struct.never.borrow() == false
&& *partition_row_struct.swap_fs_error.borrow() == false && *partition_row_struct.swap_fs_error.borrow() == false
&& *partition_row_struct.hardcode_fs_error.borrow() == false && *partition_row_struct.hardcode_fs_error.borrow() == false
{ {
partition_row_struct.widget.set_sensitive(true); partition_row_struct.widget.set_sensitive(true);
} }
(*partition_row_struct.used.borrow_mut()) = 0; (*partition_row_struct.used.borrow_mut()) = 0;
} }
} }
)); ));

View File

@ -37,7 +37,7 @@ pub fn manual_partitioning_page(
// //
let partition_changed_action = let partition_changed_action =
gio::SimpleAction::new("partition-changed", Some(glib::VariantTy::STRING)); gio::SimpleAction::new("partition-changed", None);
// //