2024-08-19 01:12:35 +02:00
|
|
|
use crate::drive_mount_row::DriveMountRow;
|
2024-08-17 00:15:03 +02:00
|
|
|
use crate::installer_stack_page;
|
2024-08-18 00:17:57 +02:00
|
|
|
use crate::partitioning_page::{get_partitions, CrypttabEntry, FstabEntry, Partition};
|
2024-08-19 01:12:35 +02:00
|
|
|
use adw::gio;
|
|
|
|
use adw::prelude::*;
|
2024-08-17 00:15:03 +02:00
|
|
|
use glib::{clone, closure_local, ffi::gboolean};
|
2024-08-19 01:12:35 +02:00
|
|
|
use gtk::{glib, prelude::*};
|
|
|
|
use std::{cell::RefCell, rc::Rc};
|
2024-08-17 00:15:03 +02:00
|
|
|
|
|
|
|
const MINIMUM_EFI_BYTE_SIZE: f64 = 500000000.0;
|
|
|
|
const MINIMUM_BOOT_BYTE_SIZE: f64 = 1000000000.0;
|
|
|
|
const MINIMUM_ROOT_BYTE_SIZE: f64 = 39000000000.0;
|
|
|
|
|
2024-08-19 02:00:49 +02:00
|
|
|
#[derive(Clone)]
|
2024-08-19 01:12:35 +02:00
|
|
|
struct PartitionRow {
|
|
|
|
widget: adw::ActionRow,
|
|
|
|
used: Rc<std::cell::RefCell<bool>>,
|
|
|
|
never: Rc<std::cell::RefCell<bool>>,
|
|
|
|
}
|
|
|
|
|
2024-08-17 00:15:03 +02:00
|
|
|
pub fn manual_partitioning_page(
|
|
|
|
partition_carousel: &adw::Carousel,
|
|
|
|
partition_method_type_refcell: &Rc<RefCell<String>>,
|
2024-08-18 00:17:57 +02:00
|
|
|
partition_method_manual_fstab_entry_array_refcell: &Rc<RefCell<Vec<FstabEntry>>>,
|
2024-08-17 00:15:03 +02:00
|
|
|
partition_method_manual_luks_enabled_refcell: &Rc<RefCell<bool>>,
|
2024-08-18 00:17:57 +02:00
|
|
|
partition_method_manual_crypttab_entry_array_refcell: &Rc<RefCell<Vec<CrypttabEntry>>>,
|
2024-08-19 01:12:35 +02:00
|
|
|
language_changed_action: &gio::SimpleAction,
|
2024-08-17 00:15:03 +02:00
|
|
|
) {
|
|
|
|
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);
|
|
|
|
|
2024-08-18 00:17:57 +02:00
|
|
|
let partition_array_refcell = Rc::new(RefCell::new(get_partitions()));
|
2024-08-18 18:56:31 +02:00
|
|
|
let used_partition_array_refcell: Rc<RefCell<Vec<String>>> = Rc::new(RefCell::default());
|
2024-08-19 02:39:52 +02:00
|
|
|
let subvol_partition_array_refcell: Rc<RefCell<Vec<String>>> = Rc::new(RefCell::default());
|
2024-08-18 18:56:31 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
let partition_changed_action = gio::SimpleAction::new("partition-changed", None);
|
2024-08-18 00:17:57 +02:00
|
|
|
|
2024-08-17 00:15:03 +02:00
|
|
|
//
|
|
|
|
|
2024-08-18 20:50:25 +02:00
|
|
|
let drive_rows_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Horizontal);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
2024-08-17 00:15:03 +02:00
|
|
|
let content_box = gtk::Box::builder()
|
|
|
|
.orientation(gtk::Orientation::Vertical)
|
|
|
|
.hexpand(true)
|
|
|
|
.vexpand(true)
|
|
|
|
.build();
|
|
|
|
|
2024-08-18 18:56:31 +02:00
|
|
|
let drive_mounts_adw_listbox = gtk::ListBox::builder()
|
|
|
|
.selection_mode(gtk::SelectionMode::None)
|
|
|
|
.build();
|
2024-08-18 00:17:57 +02:00
|
|
|
drive_mounts_adw_listbox.add_css_class("boxed-list");
|
2024-08-18 18:56:31 +02:00
|
|
|
drive_mounts_adw_listbox.add_css_class("round-all-scroll");
|
|
|
|
|
2024-08-19 01:12:35 +02:00
|
|
|
let drive_mounts_viewport = gtk::ScrolledWindow::builder()
|
2024-08-18 00:17:57 +02:00
|
|
|
.vexpand(true)
|
2024-08-18 18:56:31 +02:00
|
|
|
.hexpand(true)
|
|
|
|
.has_frame(true)
|
2024-08-18 00:17:57 +02:00
|
|
|
.child(&drive_mounts_adw_listbox)
|
|
|
|
.build();
|
|
|
|
|
2024-08-18 18:56:31 +02:00
|
|
|
drive_mounts_viewport.add_css_class("round-all-scroll");
|
|
|
|
|
2024-08-19 01:12:35 +02:00
|
|
|
create_hardcoded_rows(
|
|
|
|
&drive_mounts_adw_listbox,
|
|
|
|
&drive_rows_size_group,
|
|
|
|
&partition_array_refcell,
|
|
|
|
&partition_changed_action,
|
|
|
|
&language_changed_action,
|
|
|
|
&used_partition_array_refcell,
|
2024-08-19 02:39:52 +02:00
|
|
|
&subvol_partition_array_refcell,
|
2024-08-19 01:12:35 +02:00
|
|
|
);
|
2024-08-18 00:17:57 +02:00
|
|
|
|
2024-08-18 18:56:31 +02:00
|
|
|
content_box.append(&drive_mounts_viewport);
|
2024-08-17 00:15:03 +02:00
|
|
|
|
2024-08-18 00:17:57 +02:00
|
|
|
//
|
2024-08-17 00:15:03 +02:00
|
|
|
manual_partitioning_page.connect_closure(
|
|
|
|
"back-button-pressed",
|
|
|
|
false,
|
|
|
|
closure_local!(
|
|
|
|
#[weak]
|
|
|
|
partition_carousel,
|
2024-08-19 01:12:35 +02:00
|
|
|
move |_manual_partitioning_page: installer_stack_page::InstallerStackPage| {
|
|
|
|
partition_carousel.scroll_to(&partition_carousel.nth_page(0), true)
|
2024-08-17 00:15:03 +02:00
|
|
|
}
|
2024-08-19 01:12:35 +02:00
|
|
|
),
|
2024-08-17 00:15:03 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
manual_partitioning_page.connect_closure(
|
|
|
|
"next-button-pressed",
|
|
|
|
false,
|
|
|
|
closure_local!(
|
|
|
|
#[weak]
|
|
|
|
partition_carousel,
|
|
|
|
#[strong]
|
|
|
|
partition_method_type_refcell,
|
|
|
|
#[strong]
|
2024-08-18 00:17:57 +02:00
|
|
|
partition_method_manual_fstab_entry_array_refcell,
|
2024-08-17 00:15:03 +02:00
|
|
|
#[strong]
|
|
|
|
partition_method_manual_luks_enabled_refcell,
|
|
|
|
#[strong]
|
2024-08-18 00:17:57 +02:00
|
|
|
partition_method_manual_crypttab_entry_array_refcell,
|
2024-08-19 01:12:35 +02:00
|
|
|
move |_automatic_partitioning_page: installer_stack_page::InstallerStackPage| {
|
2024-08-17 00:15:03 +02:00
|
|
|
*partition_method_type_refcell.borrow_mut() = String::from("manual");
|
|
|
|
//partition_carousel.scroll_to(&partition_carousel.nth_page(5), true)
|
|
|
|
dbg!(partition_method_type_refcell.borrow());
|
2024-08-18 00:17:57 +02:00
|
|
|
//dbg!(partition_method_manual_fstab_entry_array_refcell.borrow());
|
2024-08-17 00:15:03 +02:00
|
|
|
dbg!(partition_method_manual_luks_enabled_refcell.borrow());
|
2024-08-18 00:17:57 +02:00
|
|
|
//dbg!(partition_method_manual_crypttab_entry_array_refcell.borrow());
|
2024-08-17 00:15:03 +02:00
|
|
|
}
|
2024-08-19 01:12:35 +02:00
|
|
|
),
|
2024-08-17 00:15:03 +02:00
|
|
|
);
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
manual_partitioning_page.set_child_widget(&content_box);
|
|
|
|
|
|
|
|
partition_carousel.append(&manual_partitioning_page);
|
|
|
|
|
2024-08-18 18:56:31 +02:00
|
|
|
//
|
|
|
|
language_changed_action.connect_activate(clone!(
|
|
|
|
#[weak]
|
|
|
|
manual_partitioning_page,
|
2024-08-19 01:12:35 +02:00
|
|
|
move |_, _| {
|
2024-08-19 01:50:56 +02:00
|
|
|
manual_partitioning_page.set_page_title(t!("manual_partitioning_page_title"));
|
|
|
|
manual_partitioning_page.set_page_subtitle(t!("manual_partitioning_page_subtitle"));
|
2024-08-19 01:12:35 +02:00
|
|
|
manual_partitioning_page.set_back_tooltip_label(t!("back"));
|
|
|
|
manual_partitioning_page.set_next_tooltip_label(t!("next"));
|
|
|
|
}
|
|
|
|
));
|
2024-08-18 18:56:31 +02:00
|
|
|
//
|
2024-08-18 00:17:57 +02:00
|
|
|
}
|
|
|
|
|
2024-08-19 01:12:35 +02:00
|
|
|
fn create_efi_row(
|
2024-08-18 00:17:57 +02:00
|
|
|
listbox: >k::ListBox,
|
2024-08-18 20:50:25 +02:00
|
|
|
drive_rows_size_group: >k::SizeGroup,
|
2024-08-18 00:17:57 +02:00
|
|
|
partition_array: &Vec<Partition>,
|
2024-08-18 18:56:31 +02:00
|
|
|
partition_changed_action: &gio::SimpleAction,
|
2024-08-18 22:13:16 +02:00
|
|
|
language_changed_action: &gio::SimpleAction,
|
2024-08-18 18:56:31 +02:00
|
|
|
used_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
2024-08-19 02:39:52 +02:00
|
|
|
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
2024-08-18 21:35:48 +02:00
|
|
|
) {
|
2024-08-18 19:05:02 +02:00
|
|
|
let partition_scroll_child = gtk::ListBox::builder()
|
|
|
|
.selection_mode(gtk::SelectionMode::None)
|
|
|
|
.build();
|
2024-08-18 00:17:57 +02:00
|
|
|
|
|
|
|
let partitions_scroll = gtk::ScrolledWindow::builder()
|
|
|
|
.hexpand(true)
|
|
|
|
.vexpand(true)
|
|
|
|
.child(&partition_scroll_child)
|
|
|
|
.build();
|
|
|
|
|
|
|
|
// Create row
|
|
|
|
let row = DriveMountRow::new_with_scroll(&partitions_scroll);
|
|
|
|
|
2024-08-19 01:12:35 +02:00
|
|
|
row.set_deletable(false);
|
2024-08-18 19:05:02 +02:00
|
|
|
|
2024-08-18 20:50:25 +02:00
|
|
|
row.set_sizegroup(drive_rows_size_group);
|
|
|
|
|
2024-08-18 22:13:16 +02:00
|
|
|
row.set_langaction(language_changed_action);
|
|
|
|
|
2024-08-19 01:12:35 +02:00
|
|
|
row.set_mountpoint("/boot/efi");
|
|
|
|
|
2024-08-18 00:17:57 +02:00
|
|
|
let null_checkbutton = gtk::CheckButton::builder().build();
|
|
|
|
|
|
|
|
for partition in partition_array {
|
|
|
|
let part_name = &partition.part_name.to_owned();
|
|
|
|
let partition_button = gtk::CheckButton::builder()
|
|
|
|
.valign(gtk::Align::Center)
|
|
|
|
.can_focus(false)
|
|
|
|
.build();
|
|
|
|
partition_button.set_group(Some(&null_checkbutton));
|
2024-08-19 01:12:35 +02:00
|
|
|
let partition_row_struct: PartitionRow = if partition.need_mapper {
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
|
|
|
.subtitle(
|
2024-08-19 01:50:56 +02:00
|
|
|
t!("partition_row_subtitle_needs_mapper").to_string()
|
2024-08-19 01:12:35 +02:00
|
|
|
+ " "
|
|
|
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
|
|
|
)
|
|
|
|
.sensitive(false)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(false)),
|
|
|
|
never: Rc::new(RefCell::new(true)),
|
2024-08-18 18:56:31 +02:00
|
|
|
}
|
2024-08-19 01:12:35 +02:00
|
|
|
} else if used_partition_array_refcell
|
|
|
|
.clone()
|
|
|
|
.borrow()
|
|
|
|
.iter()
|
|
|
|
.any(|e| part_name == e && part_name != &row.partition())
|
|
|
|
{
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
|
|
|
.subtitle(
|
|
|
|
String::from(&partition.part_fs)
|
|
|
|
+ " "
|
|
|
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
|
|
|
)
|
|
|
|
.sensitive(false)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(true)),
|
|
|
|
never: Rc::new(RefCell::new(false)),
|
|
|
|
}
|
|
|
|
} else if partition.part_fs != "vfat" {
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
2024-08-19 01:50:56 +02:00
|
|
|
.subtitle(t!("partition_row_subtitle_efi_fs_bad"))
|
2024-08-19 01:12:35 +02:00
|
|
|
.sensitive(false)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(false)),
|
|
|
|
never: Rc::new(RefCell::new(true)),
|
|
|
|
}
|
|
|
|
} else if partition.part_size < MINIMUM_EFI_BYTE_SIZE {
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
2024-08-19 01:50:56 +02:00
|
|
|
.subtitle(t!("partition_row_subtitle_efi_fs_small"))
|
2024-08-19 01:12:35 +02:00
|
|
|
.sensitive(false)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(false)),
|
|
|
|
never: Rc::new(RefCell::new(true)),
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
|
|
|
.subtitle(
|
|
|
|
String::from(&partition.part_fs)
|
|
|
|
+ " "
|
|
|
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
|
|
|
)
|
|
|
|
.sensitive(true)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(false)),
|
|
|
|
never: Rc::new(RefCell::new(false)),
|
|
|
|
}
|
|
|
|
};
|
2024-08-19 02:39:52 +02:00
|
|
|
post_check_drive_mount(&row, &partition_row_struct, &partition_button, &partition_changed_action, &partition, &used_partition_array_refcell, &subvol_partition_array_refcell);
|
2024-08-19 01:12:35 +02:00
|
|
|
partition_scroll_child.append(&partition_row_struct.widget);
|
2024-08-18 00:17:57 +02:00
|
|
|
}
|
|
|
|
|
2024-08-18 21:35:48 +02:00
|
|
|
listbox.append(&row);
|
|
|
|
|
2024-08-18 00:17:57 +02:00
|
|
|
row.connect_closure(
|
|
|
|
"row-deleted",
|
|
|
|
false,
|
|
|
|
closure_local!(
|
2024-08-18 21:35:48 +02:00
|
|
|
#[weak]
|
|
|
|
listbox,
|
2024-08-18 00:17:57 +02:00
|
|
|
#[strong]
|
|
|
|
row,
|
2024-08-18 19:05:02 +02:00
|
|
|
#[strong]
|
|
|
|
used_partition_array_refcell,
|
|
|
|
#[strong]
|
|
|
|
partition_changed_action,
|
2024-08-19 01:12:35 +02:00
|
|
|
move |row: DriveMountRow| {
|
|
|
|
listbox.remove(&row);
|
|
|
|
(*used_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition());
|
|
|
|
partition_changed_action.activate(None);
|
|
|
|
}
|
2024-08-18 00:17:57 +02:00
|
|
|
),
|
|
|
|
);
|
2024-08-18 22:25:34 +02:00
|
|
|
}
|
|
|
|
|
2024-08-19 01:12:35 +02:00
|
|
|
fn create_boot_row(
|
2024-08-18 22:25:34 +02:00
|
|
|
listbox: >k::ListBox,
|
|
|
|
drive_rows_size_group: >k::SizeGroup,
|
|
|
|
partition_array: &Vec<Partition>,
|
|
|
|
partition_changed_action: &gio::SimpleAction,
|
|
|
|
language_changed_action: &gio::SimpleAction,
|
|
|
|
used_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
2024-08-19 02:39:52 +02:00
|
|
|
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
2024-08-18 22:25:34 +02:00
|
|
|
) {
|
|
|
|
let partition_scroll_child = gtk::ListBox::builder()
|
|
|
|
.selection_mode(gtk::SelectionMode::None)
|
|
|
|
.build();
|
|
|
|
|
|
|
|
let partitions_scroll = gtk::ScrolledWindow::builder()
|
|
|
|
.hexpand(true)
|
|
|
|
.vexpand(true)
|
|
|
|
.child(&partition_scroll_child)
|
|
|
|
.build();
|
|
|
|
|
|
|
|
// Create row
|
|
|
|
let row = DriveMountRow::new_with_scroll(&partitions_scroll);
|
|
|
|
|
2024-08-19 01:12:35 +02:00
|
|
|
row.set_deletable(false);
|
2024-08-18 22:25:34 +02:00
|
|
|
|
|
|
|
row.set_sizegroup(drive_rows_size_group);
|
|
|
|
|
|
|
|
row.set_langaction(language_changed_action);
|
|
|
|
|
2024-08-19 01:12:35 +02:00
|
|
|
row.set_mountpoint("/boot");
|
|
|
|
|
2024-08-18 22:25:34 +02:00
|
|
|
let null_checkbutton = gtk::CheckButton::builder().build();
|
|
|
|
|
|
|
|
for partition in partition_array {
|
|
|
|
let part_name = &partition.part_name.to_owned();
|
|
|
|
let partition_button = gtk::CheckButton::builder()
|
|
|
|
.valign(gtk::Align::Center)
|
|
|
|
.can_focus(false)
|
|
|
|
.build();
|
|
|
|
partition_button.set_group(Some(&null_checkbutton));
|
2024-08-19 01:12:35 +02:00
|
|
|
let partition_row_struct: PartitionRow = if partition.need_mapper {
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
|
|
|
.subtitle(
|
2024-08-19 01:50:56 +02:00
|
|
|
t!("partition_row_subtitle_needs_mapper").to_string()
|
2024-08-19 01:12:35 +02:00
|
|
|
+ " "
|
|
|
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
|
|
|
)
|
|
|
|
.sensitive(false)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(false)),
|
|
|
|
never: Rc::new(RefCell::new(true)),
|
2024-08-18 22:25:34 +02:00
|
|
|
}
|
2024-08-19 01:12:35 +02:00
|
|
|
} else if used_partition_array_refcell
|
|
|
|
.clone()
|
|
|
|
.borrow()
|
|
|
|
.iter()
|
|
|
|
.any(|e| part_name == e && part_name != &row.partition())
|
|
|
|
{
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
|
|
|
.subtitle(
|
|
|
|
String::from(&partition.part_fs)
|
|
|
|
+ " "
|
|
|
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
|
|
|
)
|
|
|
|
.sensitive(false)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(true)),
|
|
|
|
never: Rc::new(RefCell::new(false)),
|
|
|
|
}
|
|
|
|
} else if partition.part_fs != "ext4" {
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
2024-08-19 01:50:56 +02:00
|
|
|
.subtitle(t!("partition_row_subtitle_boot_fs_bad"))
|
2024-08-19 01:12:35 +02:00
|
|
|
.sensitive(false)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(false)),
|
|
|
|
never: Rc::new(RefCell::new(true)),
|
|
|
|
}
|
|
|
|
} else if partition.part_size < MINIMUM_BOOT_BYTE_SIZE {
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
2024-08-19 01:50:56 +02:00
|
|
|
.subtitle(t!("partition_row_subtitle_boot_fs_small"))
|
2024-08-19 01:12:35 +02:00
|
|
|
.sensitive(false)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(false)),
|
|
|
|
never: Rc::new(RefCell::new(true)),
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
|
|
|
.subtitle(
|
|
|
|
String::from(&partition.part_fs)
|
|
|
|
+ " "
|
|
|
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
|
|
|
)
|
|
|
|
.sensitive(true)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(false)),
|
|
|
|
never: Rc::new(RefCell::new(false)),
|
|
|
|
}
|
|
|
|
};
|
2024-08-19 02:39:52 +02:00
|
|
|
post_check_drive_mount(&row, &partition_row_struct, &partition_button, &partition_changed_action, &partition, &used_partition_array_refcell, &subvol_partition_array_refcell);
|
2024-08-19 01:12:35 +02:00
|
|
|
partition_scroll_child.append(&partition_row_struct.widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
listbox.append(&row);
|
|
|
|
|
|
|
|
row.connect_closure(
|
|
|
|
"row-deleted",
|
|
|
|
false,
|
|
|
|
closure_local!(
|
2024-08-18 22:25:34 +02:00
|
|
|
#[weak]
|
2024-08-19 01:12:35 +02:00
|
|
|
listbox,
|
2024-08-18 22:25:34 +02:00
|
|
|
#[strong]
|
|
|
|
row,
|
|
|
|
#[strong]
|
|
|
|
used_partition_array_refcell,
|
|
|
|
#[strong]
|
2024-08-19 01:12:35 +02:00
|
|
|
partition_changed_action,
|
|
|
|
move |row: DriveMountRow| {
|
|
|
|
listbox.remove(&row);
|
|
|
|
(*used_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition());
|
|
|
|
partition_changed_action.activate(None);
|
|
|
|
}
|
|
|
|
),
|
|
|
|
);
|
2024-08-18 22:25:34 +02:00
|
|
|
}
|
|
|
|
|
2024-08-19 01:12:35 +02:00
|
|
|
fn create_root_row(
|
2024-08-18 22:25:34 +02:00
|
|
|
listbox: >k::ListBox,
|
|
|
|
drive_rows_size_group: >k::SizeGroup,
|
|
|
|
partition_array: &Vec<Partition>,
|
|
|
|
partition_changed_action: &gio::SimpleAction,
|
|
|
|
language_changed_action: &gio::SimpleAction,
|
|
|
|
used_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
2024-08-19 02:39:52 +02:00
|
|
|
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
2024-08-18 22:25:34 +02:00
|
|
|
) {
|
|
|
|
let partition_scroll_child = gtk::ListBox::builder()
|
|
|
|
.selection_mode(gtk::SelectionMode::None)
|
|
|
|
.build();
|
|
|
|
|
|
|
|
let partitions_scroll = gtk::ScrolledWindow::builder()
|
|
|
|
.hexpand(true)
|
|
|
|
.vexpand(true)
|
|
|
|
.child(&partition_scroll_child)
|
|
|
|
.build();
|
|
|
|
|
|
|
|
// Create row
|
|
|
|
let row = DriveMountRow::new_with_scroll(&partitions_scroll);
|
|
|
|
|
2024-08-19 01:12:35 +02:00
|
|
|
row.set_deletable(false);
|
2024-08-18 22:25:34 +02:00
|
|
|
|
|
|
|
row.set_sizegroup(drive_rows_size_group);
|
|
|
|
|
|
|
|
row.set_langaction(language_changed_action);
|
|
|
|
|
2024-08-19 01:12:35 +02:00
|
|
|
row.set_mountpoint("/");
|
|
|
|
|
2024-08-18 22:25:34 +02:00
|
|
|
let null_checkbutton = gtk::CheckButton::builder().build();
|
|
|
|
|
|
|
|
for partition in partition_array {
|
|
|
|
let part_name = &partition.part_name.to_owned();
|
|
|
|
let partition_button = gtk::CheckButton::builder()
|
|
|
|
.valign(gtk::Align::Center)
|
|
|
|
.can_focus(false)
|
|
|
|
.build();
|
|
|
|
partition_button.set_group(Some(&null_checkbutton));
|
2024-08-19 01:12:35 +02:00
|
|
|
let partition_row_struct: PartitionRow = if partition.need_mapper {
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
|
|
|
.subtitle(
|
2024-08-19 01:50:56 +02:00
|
|
|
t!("partition_row_subtitle_needs_mapper").to_string()
|
2024-08-19 01:12:35 +02:00
|
|
|
+ " "
|
|
|
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
|
|
|
)
|
|
|
|
.sensitive(false)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(false)),
|
|
|
|
never: Rc::new(RefCell::new(true)),
|
2024-08-18 22:25:34 +02:00
|
|
|
}
|
2024-08-19 01:12:35 +02:00
|
|
|
} else if used_partition_array_refcell
|
|
|
|
.clone()
|
|
|
|
.borrow()
|
|
|
|
.iter()
|
|
|
|
.any(|e| part_name == e && part_name != &row.partition())
|
|
|
|
{
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
|
|
|
.subtitle(
|
|
|
|
String::from(&partition.part_fs)
|
|
|
|
+ " "
|
|
|
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
|
|
|
)
|
|
|
|
.sensitive(false)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(true)),
|
|
|
|
never: Rc::new(RefCell::new(false)),
|
|
|
|
}
|
|
|
|
} else if partition.part_fs == "vfat"
|
|
|
|
|| partition.part_fs == "ntfs"
|
|
|
|
|| partition.part_fs == "swap"
|
|
|
|
|| partition.part_fs == "exfat"
|
|
|
|
|| partition.part_fs == "BitLocker"
|
|
|
|
{
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
2024-08-19 01:50:56 +02:00
|
|
|
.subtitle(t!("partition_row_subtitle_root_fs_bad"))
|
2024-08-19 01:12:35 +02:00
|
|
|
.sensitive(false)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(false)),
|
|
|
|
never: Rc::new(RefCell::new(true)),
|
|
|
|
}
|
|
|
|
} else if partition.part_size < MINIMUM_ROOT_BYTE_SIZE {
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
2024-08-19 01:50:56 +02:00
|
|
|
.subtitle(t!("partition_row_subtitle_root_fs_small"))
|
2024-08-19 01:12:35 +02:00
|
|
|
.sensitive(false)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(false)),
|
|
|
|
never: Rc::new(RefCell::new(true)),
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
|
|
|
.subtitle(
|
|
|
|
String::from(&partition.part_fs)
|
|
|
|
+ " "
|
|
|
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
|
|
|
)
|
|
|
|
.sensitive(true)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(false)),
|
|
|
|
never: Rc::new(RefCell::new(false)),
|
|
|
|
}
|
|
|
|
};
|
2024-08-19 02:39:52 +02:00
|
|
|
post_check_drive_mount(&row, &partition_row_struct, &partition_button, &partition_changed_action, &partition, &used_partition_array_refcell, &subvol_partition_array_refcell);
|
2024-08-19 01:12:35 +02:00
|
|
|
partition_scroll_child.append(&partition_row_struct.widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
listbox.append(&row);
|
|
|
|
|
|
|
|
row.connect_closure(
|
|
|
|
"row-deleted",
|
|
|
|
false,
|
|
|
|
closure_local!(
|
2024-08-18 22:25:34 +02:00
|
|
|
#[weak]
|
2024-08-19 01:12:35 +02:00
|
|
|
listbox,
|
2024-08-18 22:25:34 +02:00
|
|
|
#[strong]
|
|
|
|
row,
|
|
|
|
#[strong]
|
|
|
|
used_partition_array_refcell,
|
|
|
|
#[strong]
|
2024-08-19 01:12:35 +02:00
|
|
|
partition_changed_action,
|
|
|
|
move |row: DriveMountRow| {
|
|
|
|
listbox.remove(&row);
|
|
|
|
(*used_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition());
|
|
|
|
partition_changed_action.activate(None);
|
|
|
|
}
|
|
|
|
),
|
|
|
|
);
|
2024-08-18 22:25:34 +02:00
|
|
|
}
|
|
|
|
|
2024-08-19 01:12:35 +02:00
|
|
|
fn create_mount_row(
|
2024-08-18 22:25:34 +02:00
|
|
|
listbox: >k::ListBox,
|
|
|
|
drive_rows_size_group: >k::SizeGroup,
|
|
|
|
partition_array: &Vec<Partition>,
|
|
|
|
partition_changed_action: &gio::SimpleAction,
|
|
|
|
language_changed_action: &gio::SimpleAction,
|
|
|
|
used_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
2024-08-19 02:39:52 +02:00
|
|
|
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
2024-08-18 22:25:34 +02:00
|
|
|
) {
|
|
|
|
let partition_scroll_child = gtk::ListBox::builder()
|
|
|
|
.selection_mode(gtk::SelectionMode::None)
|
|
|
|
.build();
|
|
|
|
|
|
|
|
let partitions_scroll = gtk::ScrolledWindow::builder()
|
|
|
|
.hexpand(true)
|
|
|
|
.vexpand(true)
|
|
|
|
.child(&partition_scroll_child)
|
|
|
|
.build();
|
|
|
|
|
|
|
|
// Create row
|
|
|
|
let row = DriveMountRow::new_with_scroll(&partitions_scroll);
|
|
|
|
|
2024-08-19 01:12:35 +02:00
|
|
|
row.set_deletable(true);
|
2024-08-18 22:25:34 +02:00
|
|
|
|
|
|
|
row.set_sizegroup(drive_rows_size_group);
|
|
|
|
|
|
|
|
row.set_langaction(language_changed_action);
|
|
|
|
|
|
|
|
let null_checkbutton = gtk::CheckButton::builder().build();
|
|
|
|
|
|
|
|
for partition in partition_array {
|
|
|
|
let part_name = &partition.part_name.to_owned();
|
|
|
|
let partition_button = gtk::CheckButton::builder()
|
|
|
|
.valign(gtk::Align::Center)
|
|
|
|
.can_focus(false)
|
|
|
|
.build();
|
|
|
|
partition_button.set_group(Some(&null_checkbutton));
|
2024-08-19 01:12:35 +02:00
|
|
|
let partition_row_struct: PartitionRow = if partition.need_mapper {
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
|
|
|
.subtitle(
|
2024-08-19 01:50:56 +02:00
|
|
|
t!("partition_row_subtitle_needs_mapper").to_string()
|
2024-08-19 01:12:35 +02:00
|
|
|
+ " "
|
|
|
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
|
|
|
)
|
|
|
|
.sensitive(false)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(false)),
|
|
|
|
never: Rc::new(RefCell::new(true)),
|
2024-08-18 22:25:34 +02:00
|
|
|
}
|
2024-08-19 01:12:35 +02:00
|
|
|
} else if used_partition_array_refcell
|
|
|
|
.clone()
|
|
|
|
.borrow()
|
|
|
|
.iter()
|
|
|
|
.any(|e| part_name == e && part_name != &row.partition())
|
|
|
|
{
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
|
|
|
.subtitle(
|
|
|
|
String::from(&partition.part_fs)
|
|
|
|
+ " "
|
|
|
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
|
|
|
)
|
|
|
|
.sensitive(false)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(true)),
|
|
|
|
never: Rc::new(RefCell::new(false)),
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
PartitionRow {
|
|
|
|
widget: {
|
|
|
|
let prow = adw::ActionRow::builder()
|
|
|
|
.activatable_widget(&partition_button)
|
|
|
|
.title(part_name)
|
|
|
|
.subtitle(
|
|
|
|
String::from(&partition.part_fs)
|
|
|
|
+ " "
|
|
|
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
|
|
|
)
|
|
|
|
.sensitive(true)
|
|
|
|
.build();
|
|
|
|
prow
|
|
|
|
},
|
|
|
|
used: Rc::new(RefCell::new(false)),
|
|
|
|
never: Rc::new(RefCell::new(false)),
|
|
|
|
}
|
|
|
|
};
|
2024-08-19 02:39:52 +02:00
|
|
|
post_check_drive_mount(&row, &partition_row_struct, &partition_button, &partition_changed_action, &partition, &used_partition_array_refcell, &subvol_partition_array_refcell);
|
2024-08-19 01:12:35 +02:00
|
|
|
partition_scroll_child.append(&partition_row_struct.widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
listbox.append(&row);
|
|
|
|
|
|
|
|
row.connect_closure(
|
|
|
|
"row-deleted",
|
|
|
|
false,
|
|
|
|
closure_local!(
|
2024-08-18 22:25:34 +02:00
|
|
|
#[weak]
|
2024-08-19 01:12:35 +02:00
|
|
|
listbox,
|
2024-08-18 22:25:34 +02:00
|
|
|
#[strong]
|
|
|
|
row,
|
|
|
|
#[strong]
|
|
|
|
used_partition_array_refcell,
|
|
|
|
#[strong]
|
2024-08-19 01:12:35 +02:00
|
|
|
partition_changed_action,
|
|
|
|
move |row: DriveMountRow| {
|
|
|
|
listbox.remove(&row);
|
|
|
|
(*used_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition());
|
|
|
|
partition_changed_action.activate(None);
|
|
|
|
}
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-08-19 02:39:52 +02:00
|
|
|
fn post_check_drive_mount(row: &DriveMountRow, partition_row_struct: &PartitionRow, partition_button: >k::CheckButton, partition_changed_action: &gio::SimpleAction, partition: &Partition, used_partition_array_refcell: &Rc<RefCell<Vec<String>>>, subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>) {
|
2024-08-19 01:12:35 +02:00
|
|
|
partition_row_struct.widget.add_prefix(partition_button);
|
|
|
|
partition_button.connect_toggled(clone!(
|
|
|
|
#[weak]
|
|
|
|
row,
|
|
|
|
#[weak]
|
|
|
|
partition_button,
|
|
|
|
#[strong]
|
|
|
|
partition_changed_action,
|
|
|
|
#[strong]
|
|
|
|
used_partition_array_refcell,
|
|
|
|
#[strong]
|
|
|
|
partition,
|
|
|
|
move |_| {
|
|
|
|
if partition_button.is_active() == true {
|
|
|
|
let part_name = &partition.part_name;
|
|
|
|
row.set_partition(part_name.to_string());
|
|
|
|
(*used_partition_array_refcell.borrow_mut()).push(part_name.to_string());
|
|
|
|
} else {
|
|
|
|
(*used_partition_array_refcell.borrow_mut())
|
|
|
|
.retain(|x| x != &partition.part_name);
|
|
|
|
}
|
|
|
|
partition_changed_action.activate(None);
|
|
|
|
}
|
|
|
|
));
|
|
|
|
row.connect_mountpoint_notify(clone!(
|
|
|
|
#[strong]
|
|
|
|
partition_row_struct,
|
|
|
|
#[strong]
|
|
|
|
partition,
|
|
|
|
#[strong]
|
|
|
|
row,
|
|
|
|
move |_| {
|
|
|
|
if row.mountpoint() == "[SWAP]" {
|
|
|
|
if partition.part_fs != "linux-swap" {
|
|
|
|
partition_row_struct.widget.set_sensitive(false);
|
2024-08-18 22:25:34 +02:00
|
|
|
}
|
2024-08-19 01:12:35 +02:00
|
|
|
} else if *partition_row_struct.used.borrow() == false
|
|
|
|
&& *partition_row_struct.never.borrow() == false
|
|
|
|
{
|
|
|
|
partition_row_struct.widget.set_sensitive(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
));
|
2024-08-18 22:25:34 +02:00
|
|
|
|
2024-08-19 02:39:52 +02:00
|
|
|
row.connect_mountopts_notify(clone!(
|
|
|
|
#[strong]
|
|
|
|
partition,
|
|
|
|
#[strong]
|
|
|
|
partition_changed_action,
|
|
|
|
#[strong]
|
|
|
|
subvol_partition_array_refcell,
|
|
|
|
#[strong]
|
|
|
|
row,
|
|
|
|
move |_| {
|
|
|
|
if row.mountopts().contains("subvol=") || row.mountopts().contains("subvolid") {
|
|
|
|
(*subvol_partition_array_refcell.borrow_mut()).push(partition.part_name.to_string());
|
|
|
|
} else {
|
|
|
|
(*subvol_partition_array_refcell.borrow_mut())
|
|
|
|
.retain(|x| x != &partition.part_name);
|
|
|
|
}
|
|
|
|
partition_changed_action.activate(None);
|
|
|
|
}
|
|
|
|
));
|
|
|
|
|
2024-08-19 01:12:35 +02:00
|
|
|
partition_changed_action.connect_activate(clone!(
|
|
|
|
#[strong]
|
|
|
|
partition_row_struct,
|
|
|
|
#[strong]
|
|
|
|
row,
|
|
|
|
#[strong]
|
|
|
|
partition,
|
|
|
|
#[strong]
|
|
|
|
used_partition_array_refcell,
|
|
|
|
#[strong]
|
2024-08-19 02:39:52 +02:00
|
|
|
subvol_partition_array_refcell,
|
2024-08-19 01:12:35 +02:00
|
|
|
move |_, _| {
|
|
|
|
let part_name = &partition.part_name;
|
|
|
|
let used_partition_array = used_partition_array_refcell.borrow();
|
2024-08-19 02:39:52 +02:00
|
|
|
let subvol_partition_array = subvol_partition_array_refcell.borrow();
|
2024-08-19 01:12:35 +02:00
|
|
|
if used_partition_array
|
|
|
|
.iter()
|
|
|
|
.any(|e| part_name == e && part_name != &row.partition())
|
|
|
|
{
|
|
|
|
partition_row_struct.widget.set_sensitive(false);
|
|
|
|
(*partition_row_struct.used.borrow_mut()) = true;
|
2024-08-19 02:39:52 +02:00
|
|
|
if subvol_partition_array
|
|
|
|
.iter()
|
|
|
|
.any(|e| e == part_name)
|
|
|
|
{
|
|
|
|
partition_row_struct.widget.set_sensitive(true);
|
|
|
|
}
|
2024-08-19 01:12:35 +02:00
|
|
|
} else if *partition_row_struct.never.borrow() == false {
|
|
|
|
partition_row_struct.widget.set_sensitive(true);
|
|
|
|
(*partition_row_struct.used.borrow_mut()) = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
fn create_hardcoded_rows(
|
|
|
|
drive_mounts_adw_listbox: >k::ListBox,
|
|
|
|
drive_rows_size_group: >k::SizeGroup,
|
|
|
|
partition_array_refcell: &Rc<RefCell<Vec<Partition>>>,
|
|
|
|
partition_changed_action: &gio::SimpleAction,
|
|
|
|
language_changed_action: &gio::SimpleAction,
|
|
|
|
used_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
2024-08-19 02:39:52 +02:00
|
|
|
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
2024-08-19 01:12:35 +02:00
|
|
|
) {
|
|
|
|
let drive_mount_add_button = gtk::Button::builder()
|
|
|
|
.icon_name("list-add")
|
|
|
|
.vexpand(true)
|
|
|
|
.hexpand(true)
|
|
|
|
.build();
|
|
|
|
|
|
|
|
create_efi_row(
|
|
|
|
&drive_mounts_adw_listbox,
|
|
|
|
&drive_rows_size_group,
|
|
|
|
&partition_array_refcell.borrow(),
|
|
|
|
&partition_changed_action,
|
|
|
|
&language_changed_action,
|
|
|
|
&used_partition_array_refcell,
|
2024-08-19 02:39:52 +02:00
|
|
|
&subvol_partition_array_refcell,
|
2024-08-19 01:12:35 +02:00
|
|
|
);
|
|
|
|
create_boot_row(
|
|
|
|
&drive_mounts_adw_listbox,
|
|
|
|
&drive_rows_size_group,
|
|
|
|
&partition_array_refcell.borrow(),
|
|
|
|
&partition_changed_action,
|
|
|
|
&language_changed_action,
|
|
|
|
&used_partition_array_refcell,
|
2024-08-19 02:39:52 +02:00
|
|
|
&subvol_partition_array_refcell,
|
2024-08-19 01:12:35 +02:00
|
|
|
);
|
|
|
|
create_root_row(
|
|
|
|
&drive_mounts_adw_listbox,
|
|
|
|
&drive_rows_size_group,
|
|
|
|
&partition_array_refcell.borrow(),
|
|
|
|
&partition_changed_action,
|
|
|
|
&language_changed_action,
|
|
|
|
&used_partition_array_refcell,
|
2024-08-19 02:39:52 +02:00
|
|
|
&subvol_partition_array_refcell,
|
2024-08-19 01:12:35 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
drive_mounts_adw_listbox.append(&drive_mount_add_button);
|
|
|
|
|
|
|
|
drive_mount_add_button.connect_clicked(clone!(
|
|
|
|
#[weak]
|
|
|
|
drive_mounts_adw_listbox,
|
|
|
|
#[strong]
|
|
|
|
drive_rows_size_group,
|
|
|
|
#[strong]
|
|
|
|
partition_array_refcell,
|
|
|
|
#[strong]
|
|
|
|
partition_changed_action,
|
|
|
|
#[strong]
|
|
|
|
language_changed_action,
|
|
|
|
#[strong]
|
|
|
|
used_partition_array_refcell,
|
|
|
|
#[strong]
|
2024-08-19 02:39:52 +02:00
|
|
|
subvol_partition_array_refcell,
|
2024-08-19 01:12:35 +02:00
|
|
|
move |_| {
|
|
|
|
create_mount_row(
|
|
|
|
&drive_mounts_adw_listbox,
|
|
|
|
&drive_rows_size_group,
|
|
|
|
&partition_array_refcell.borrow(),
|
|
|
|
&partition_changed_action,
|
|
|
|
&language_changed_action,
|
|
|
|
&used_partition_array_refcell,
|
2024-08-19 02:39:52 +02:00
|
|
|
&subvol_partition_array_refcell,
|
2024-08-19 01:12:35 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
));
|
|
|
|
}
|