complete used partition callback

This commit is contained in:
Ward from fusion-voyager-3 2024-08-18 20:05:02 +03:00
parent c58290e1c6
commit d3d7636db4

View File

@ -152,7 +152,9 @@ fn create_mount_row(
used_partition_array_refcell: &Rc<RefCell<Vec<String>>>, used_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
do_used_part_check_refcell: &Rc<RefCell<bool>>, do_used_part_check_refcell: &Rc<RefCell<bool>>,
) -> DriveMountRow { ) -> DriveMountRow {
let partition_scroll_child = gtk::ListBox::builder().build(); let partition_scroll_child = gtk::ListBox::builder()
.selection_mode(gtk::SelectionMode::None)
.build();
let partitions_scroll = gtk::ScrolledWindow::builder() let partitions_scroll = gtk::ScrolledWindow::builder()
.hexpand(true) .hexpand(true)
@ -163,6 +165,8 @@ fn create_mount_row(
// Create row // Create row
let row = DriveMountRow::new_with_scroll(&partitions_scroll); let row = DriveMountRow::new_with_scroll(&partitions_scroll);
row.set_deletable(true);
let null_checkbutton = gtk::CheckButton::builder().build(); let null_checkbutton = gtk::CheckButton::builder().build();
for partition in partition_array { for partition in partition_array {
@ -206,8 +210,6 @@ fn create_mount_row(
#[weak] #[weak]
row, row,
#[weak] #[weak]
listbox,
#[weak]
partition_button, partition_button,
#[strong] #[strong]
partition_changed_action, partition_changed_action,
@ -262,9 +264,15 @@ fn create_mount_row(
closure_local!( closure_local!(
#[strong] #[strong]
row, row,
#[strong]
used_partition_array_refcell,
#[strong]
partition_changed_action,
move |row: DriveMountRow| move |row: DriveMountRow|
{ {
listbox_clone.remove(&row); listbox_clone.remove(&row);
(*used_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition());
partition_changed_action.activate(None);
} }
), ),
); );