some thingies
This commit is contained in:
parent
4cc755dbf7
commit
92b18f2139
@ -75,31 +75,36 @@ pub fn automatic_partitioning_page(
|
|||||||
|
|
||||||
devices_selection_expander_row.add_row(&devices_selection_expander_row_viewport);
|
devices_selection_expander_row.add_row(&devices_selection_expander_row_viewport);
|
||||||
|
|
||||||
let partition_method_automatic_disk_error_label = gtk::Label::builder()
|
let partition_method_automatic_disk_nodisk_error_label = gtk::Label::builder()
|
||||||
.name("status:no_disk_specified,")
|
|
||||||
.halign(gtk::Align::Start)
|
.halign(gtk::Align::Start)
|
||||||
.valign(gtk::Align::End)
|
.valign(gtk::Align::End)
|
||||||
.vexpand(true)
|
.vexpand(true)
|
||||||
.build();
|
.build();
|
||||||
partition_method_automatic_disk_error_label.add_css_class("small_error_text");
|
partition_method_automatic_disk_nodisk_error_label.add_css_class("small_error_text");
|
||||||
|
|
||||||
let partition_method_automatic_luks_error_label = gtk::Label::builder()
|
let partition_method_automatic_disk_small_error_label = gtk::Label::builder()
|
||||||
.name("status:luks_yes_but_empty,")
|
|
||||||
.halign(gtk::Align::Start)
|
.halign(gtk::Align::Start)
|
||||||
.valign(gtk::Align::End)
|
.valign(gtk::Align::End)
|
||||||
.vexpand(true)
|
.vexpand(true)
|
||||||
.visible(false)
|
.visible(false)
|
||||||
.build();
|
.build();
|
||||||
partition_method_automatic_luks_error_label.add_css_class("small_error_text");
|
partition_method_automatic_disk_small_error_label.add_css_class("small_error_text");
|
||||||
|
|
||||||
let partition_method_automatic_luks_error2_label = gtk::Label::builder()
|
let partition_method_automatic_luks_empty_error_label = gtk::Label::builder()
|
||||||
.name("status:luks_not_match,")
|
|
||||||
.halign(gtk::Align::Start)
|
.halign(gtk::Align::Start)
|
||||||
.valign(gtk::Align::End)
|
.valign(gtk::Align::End)
|
||||||
.vexpand(true)
|
.vexpand(true)
|
||||||
.visible(false)
|
.visible(false)
|
||||||
.build();
|
.build();
|
||||||
partition_method_automatic_luks_error2_label.add_css_class("small_error_text");
|
partition_method_automatic_luks_empty_error_label.add_css_class("small_error_text");
|
||||||
|
|
||||||
|
let partition_method_automatic_luks_missmatch_error_label = gtk::Label::builder()
|
||||||
|
.halign(gtk::Align::Start)
|
||||||
|
.valign(gtk::Align::End)
|
||||||
|
.vexpand(true)
|
||||||
|
.visible(false)
|
||||||
|
.build();
|
||||||
|
partition_method_automatic_luks_missmatch_error_label.add_css_class("small_error_text");
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -108,11 +113,11 @@ pub fn automatic_partitioning_page(
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
let partition_method_automatic_luks_checkbutton = gtk::CheckButton::builder()
|
let partition_method_automatic_luks_checkbutton = gtk::CheckButton::builder()
|
||||||
.label(t!("enable_luks2_enc"))
|
|
||||||
.margin_top(15)
|
.margin_top(15)
|
||||||
.margin_bottom(15)
|
.margin_bottom(15)
|
||||||
.margin_start(15)
|
.margin_start(15)
|
||||||
.margin_end(15)
|
.margin_end(15)
|
||||||
|
.valign(gtk::Align::Start)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let partition_method_automatic_luks_listbox = gtk::ListBox::builder()
|
let partition_method_automatic_luks_listbox = gtk::ListBox::builder()
|
||||||
@ -124,19 +129,17 @@ pub fn automatic_partitioning_page(
|
|||||||
partition_method_automatic_luks_listbox.add_css_class("boxed-list");
|
partition_method_automatic_luks_listbox.add_css_class("boxed-list");
|
||||||
|
|
||||||
let partition_method_automatic_luks_password_entry = adw::PasswordEntryRow::builder()
|
let partition_method_automatic_luks_password_entry = adw::PasswordEntryRow::builder()
|
||||||
.title(t!("luks2_password"))
|
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
.sensitive(false)
|
.sensitive(false)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let partition_method_automatic_luks_password_confirm_entry = adw::PasswordEntryRow::builder()
|
let partition_method_automatic_luks_password_confirm_entry = adw::PasswordEntryRow::builder()
|
||||||
.title(t!("luks2_password_confirm"))
|
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
.sensitive(true)
|
.sensitive(true)
|
||||||
.visible(false)
|
.visible(false)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let _partition_method_automatic_luks_password = partition_method_automatic_luks_password_entry
|
partition_method_automatic_luks_password_entry
|
||||||
.bind_property(
|
.bind_property(
|
||||||
"sensitive",
|
"sensitive",
|
||||||
&partition_method_automatic_luks_password_confirm_entry,
|
&partition_method_automatic_luks_password_confirm_entry,
|
||||||
@ -145,6 +148,15 @@ pub fn automatic_partitioning_page(
|
|||||||
.sync_create()
|
.sync_create()
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
partition_method_automatic_luks_checkbutton
|
||||||
|
.bind_property(
|
||||||
|
"active",
|
||||||
|
&partition_method_automatic_luks_password_entry,
|
||||||
|
"sensitive",
|
||||||
|
)
|
||||||
|
.sync_create()
|
||||||
|
.build();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
for device in get_block_devices() {
|
for device in get_block_devices() {
|
||||||
@ -165,51 +177,26 @@ pub fn automatic_partitioning_page(
|
|||||||
#[weak]
|
#[weak]
|
||||||
device_button,
|
device_button,
|
||||||
#[weak]
|
#[weak]
|
||||||
partition_method_automatic_luks_password_entry,
|
|
||||||
#[weak]
|
|
||||||
devices_selection_expander_row,
|
devices_selection_expander_row,
|
||||||
#[weak]
|
#[weak]
|
||||||
automatic_partitioning_page,
|
partition_method_automatic_disk_nodisk_error_label,
|
||||||
#[weak]
|
#[weak]
|
||||||
partition_method_automatic_disk_error_label,
|
partition_method_automatic_disk_small_error_label,
|
||||||
#[weak]
|
|
||||||
partition_method_automatic_luks_error_label,
|
|
||||||
#[weak]
|
|
||||||
partition_method_automatic_luks_checkbutton,
|
|
||||||
#[strong]
|
#[strong]
|
||||||
partition_method_automatic_target_buffer,
|
partition_method_automatic_target_buffer,
|
||||||
#[strong]
|
|
||||||
partition_method_automatic_luks_buffer,
|
|
||||||
move |_| {
|
move |_| {
|
||||||
if device_button.is_active() == true {
|
disk_check(&device_button, &devices_selection_expander_row, &partition_method_automatic_disk_small_error_label, &device.block_name, device.block_size);
|
||||||
devices_selection_expander_row.set_title(&device.block_name);
|
partition_method_automatic_disk_nodisk_error_label.set_visible(false);
|
||||||
if device.block_size > 39000000000.0 {
|
|
||||||
partition_method_automatic_disk_error_label.set_visible(false);
|
|
||||||
if partition_method_automatic_luks_checkbutton.is_active() == true {
|
|
||||||
if partition_method_automatic_luks_error_label.get_visible() {
|
|
||||||
//
|
|
||||||
} else {
|
|
||||||
automatic_partitioning_page.set_next_sensitive(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
partition_method_automatic_target_buffer.set_text(&device.block_name);
|
partition_method_automatic_target_buffer.set_text(&device.block_name);
|
||||||
partition_method_automatic_luks_buffer.set_text(&partition_method_automatic_luks_password_entry.text().to_string());
|
|
||||||
automatic_partitioning_page.set_next_sensitive(true);
|
|
||||||
}
|
}
|
||||||
} else {
|
)
|
||||||
partition_method_automatic_disk_error_label.set_visible(true);
|
);
|
||||||
partition_method_automatic_disk_error_label.set_widget_name("status:disk=small,");
|
|
||||||
partition_method_automatic_disk_error_label.set_label(&t!("disk_auto_target_small"));
|
|
||||||
automatic_partitioning_page.set_next_sensitive(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
partition_method_automatic_luks_checkbutton.connect_toggled(
|
/* partition_method_automatic_luks_checkbutton.connect_toggled(
|
||||||
clone!(
|
clone!(
|
||||||
#[strong]
|
#[strong]
|
||||||
partition_method_automatic_luks_error2_label,
|
partition_method_automatic_luks_missmatch_error_label,
|
||||||
#[strong]
|
#[strong]
|
||||||
partition_method_automatic_luks_checkbutton,
|
partition_method_automatic_luks_checkbutton,
|
||||||
#[strong]
|
#[strong]
|
||||||
@ -217,9 +204,9 @@ pub fn automatic_partitioning_page(
|
|||||||
#[strong]
|
#[strong]
|
||||||
partition_method_automatic_luks_password_entry,
|
partition_method_automatic_luks_password_entry,
|
||||||
#[strong]
|
#[strong]
|
||||||
partition_method_automatic_disk_error_label,
|
partition_method_automatic_disk_nodisk_error_label,
|
||||||
#[strong]
|
#[strong]
|
||||||
partition_method_automatic_luks_error_label,
|
partition_method_automatic_luks_empty_error_label,
|
||||||
#[weak]
|
#[weak]
|
||||||
automatic_partitioning_page,
|
automatic_partitioning_page,
|
||||||
#[strong]
|
#[strong]
|
||||||
@ -260,12 +247,12 @@ pub fn automatic_partitioning_page(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
); */
|
||||||
|
|
||||||
partition_method_automatic_luks_password_entry.connect_changed(
|
/* partition_method_automatic_luks_password_entry.connect_changed(
|
||||||
clone!(
|
clone!(
|
||||||
#[weak]
|
#[weak]
|
||||||
partition_method_automatic_luks_error2_label,
|
partition_method_automatic_luks_missmatch_error_label,
|
||||||
#[weak]
|
#[weak]
|
||||||
partition_method_automatic_luks_checkbutton,
|
partition_method_automatic_luks_checkbutton,
|
||||||
#[weak]
|
#[weak]
|
||||||
@ -273,9 +260,9 @@ pub fn automatic_partitioning_page(
|
|||||||
#[weak]
|
#[weak]
|
||||||
partition_method_automatic_luks_password_entry,
|
partition_method_automatic_luks_password_entry,
|
||||||
#[weak]
|
#[weak]
|
||||||
partition_method_automatic_disk_error_label,
|
partition_method_automatic_disk_nodisk_error_label,
|
||||||
#[weak]
|
#[weak]
|
||||||
partition_method_automatic_luks_error_label,
|
partition_method_automatic_luks_empty_error_label,
|
||||||
#[weak]
|
#[weak]
|
||||||
automatic_partitioning_page,
|
automatic_partitioning_page,
|
||||||
#[strong]
|
#[strong]
|
||||||
@ -321,7 +308,7 @@ pub fn automatic_partitioning_page(
|
|||||||
partition_method_automatic_luks_password_confirm_entry.connect_changed(
|
partition_method_automatic_luks_password_confirm_entry.connect_changed(
|
||||||
clone!(
|
clone!(
|
||||||
#[weak]
|
#[weak]
|
||||||
partition_method_automatic_luks_error2_label,
|
partition_method_automatic_luks_missmatch_error_label,
|
||||||
#[weak]
|
#[weak]
|
||||||
partition_method_automatic_luks_checkbutton,
|
partition_method_automatic_luks_checkbutton,
|
||||||
#[weak]
|
#[weak]
|
||||||
@ -329,9 +316,9 @@ pub fn automatic_partitioning_page(
|
|||||||
#[weak]
|
#[weak]
|
||||||
partition_method_automatic_luks_password_entry,
|
partition_method_automatic_luks_password_entry,
|
||||||
#[weak]
|
#[weak]
|
||||||
partition_method_automatic_disk_error_label,
|
partition_method_automatic_disk_nodisk_error_label,
|
||||||
#[weak]
|
#[weak]
|
||||||
partition_method_automatic_luks_error_label,
|
partition_method_automatic_luks_empty_error_label,
|
||||||
#[weak]
|
#[weak]
|
||||||
automatic_partitioning_page,
|
automatic_partitioning_page,
|
||||||
#[strong]
|
#[strong]
|
||||||
@ -372,7 +359,7 @@ pub fn automatic_partitioning_page(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
); */
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -386,48 +373,10 @@ pub fn automatic_partitioning_page(
|
|||||||
|
|
||||||
content_box.append(&devices_selection_expander_row_viewport_listbox);
|
content_box.append(&devices_selection_expander_row_viewport_listbox);
|
||||||
content_box.append(&partition_method_automatic_luks_box);
|
content_box.append(&partition_method_automatic_luks_box);
|
||||||
content_box.append(&partition_method_automatic_luks_error_label);
|
content_box.append(&partition_method_automatic_luks_empty_error_label);
|
||||||
content_box.append(&partition_method_automatic_luks_error2_label);
|
content_box.append(&partition_method_automatic_luks_missmatch_error_label);
|
||||||
content_box.append(&partition_method_automatic_disk_error_label);
|
content_box.append(&partition_method_automatic_disk_nodisk_error_label);
|
||||||
|
content_box.append(&partition_method_automatic_disk_small_error_label);
|
||||||
//
|
|
||||||
language_changed_action.connect_activate(
|
|
||||||
clone!(
|
|
||||||
#[weak]
|
|
||||||
automatic_partitioning_page,
|
|
||||||
#[weak]
|
|
||||||
devices_selection_expander_row,
|
|
||||||
move |_, _| {
|
|
||||||
automatic_partitioning_page.set_page_title(t!("auto_part_installer"));
|
|
||||||
automatic_partitioning_page.set_page_subtitle(t!("choose_drive_auto"));
|
|
||||||
automatic_partitioning_page.set_back_tooltip_label(t!("back"));
|
|
||||||
automatic_partitioning_page.set_next_tooltip_label(t!("next"));
|
|
||||||
//
|
|
||||||
if devices_selection_expander_row.widget_name() == "status:disk=none," {
|
|
||||||
devices_selection_expander_row.set_title(&t!("no_drive_auto_selected"));
|
|
||||||
}
|
|
||||||
//
|
|
||||||
match partition_method_automatic_disk_error_label.widget_name().as_str() {
|
|
||||||
"status:no_disk_specified," => {
|
|
||||||
partition_method_automatic_disk_error_label.set_label(&t!("no_disk_specified"));
|
|
||||||
}
|
|
||||||
"status:disk=small," => {
|
|
||||||
partition_method_automatic_disk_error_label.set_label(&t!("disk_auto_target_small"));
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if partition_method_automatic_luks_error_label.widget_name() == "status:luks_yes_but_empty," {
|
|
||||||
partition_method_automatic_luks_error_label.set_label(&t!("luks_yes_but_empty"));
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if partition_method_automatic_luks_error2_label.widget_name() == "status:luks_not_match," {
|
|
||||||
partition_method_automatic_luks_error2_label.set_label(&t!("luks_not_match"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
//
|
|
||||||
|
|
||||||
automatic_partitioning_page.connect_closure(
|
automatic_partitioning_page.connect_closure(
|
||||||
"back-button-pressed",
|
"back-button-pressed",
|
||||||
@ -459,7 +408,7 @@ pub fn automatic_partitioning_page(
|
|||||||
#[strong]
|
#[strong]
|
||||||
partition_method_automatic_seperation_buffer,
|
partition_method_automatic_seperation_buffer,
|
||||||
move |_automatic_partitioning_page: installer_stack_page::InstallerStackPage|
|
move |_automatic_partitioning_page: installer_stack_page::InstallerStackPage|
|
||||||
{;
|
{
|
||||||
//main_carousel.scroll_to(&main_carousel.nth_page(5), true)
|
//main_carousel.scroll_to(&main_carousel.nth_page(5), true)
|
||||||
dbg!(partition_method_type_buffer.text(&partition_method_type_buffer.bounds().0, &partition_method_type_buffer.bounds().1, true).to_string());
|
dbg!(partition_method_type_buffer.text(&partition_method_type_buffer.bounds().0, &partition_method_type_buffer.bounds().1, true).to_string());
|
||||||
dbg!(partition_method_automatic_target_buffer.text(&partition_method_automatic_target_buffer.bounds().0, &partition_method_automatic_target_buffer.bounds().1, true).to_string());
|
dbg!(partition_method_automatic_target_buffer.text(&partition_method_automatic_target_buffer.bounds().0, &partition_method_automatic_target_buffer.bounds().1, true).to_string());
|
||||||
@ -469,12 +418,47 @@ pub fn automatic_partitioning_page(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
automatic_partitioning_page.set_child_widget(&content_box);
|
automatic_partitioning_page.set_child_widget(&content_box);
|
||||||
|
|
||||||
main_carousel.append(&automatic_partitioning_page);
|
main_carousel.append(&automatic_partitioning_page);
|
||||||
|
|
||||||
|
//
|
||||||
|
language_changed_action.connect_activate(
|
||||||
|
move |_, _| {
|
||||||
|
automatic_partitioning_page.set_page_title(t!("auto_part_installer"));
|
||||||
|
automatic_partitioning_page.set_page_subtitle(t!("choose_drive_auto"));
|
||||||
|
automatic_partitioning_page.set_back_tooltip_label(t!("back"));
|
||||||
|
automatic_partitioning_page.set_next_tooltip_label(t!("next"));
|
||||||
|
//
|
||||||
|
devices_selection_expander_row.set_title(&t!("no_drive_auto_selected"));
|
||||||
|
//
|
||||||
|
partition_method_automatic_disk_nodisk_error_label.set_label(&t!("no_disk_specified"));
|
||||||
|
//
|
||||||
|
partition_method_automatic_disk_small_error_label.set_label(&t!("disk_auto_target_small"));
|
||||||
|
//
|
||||||
|
partition_method_automatic_luks_empty_error_label.set_label(&t!("luks_yes_but_empty"));
|
||||||
|
//
|
||||||
|
partition_method_automatic_luks_missmatch_error_label.set_label(&t!("luks_not_match"));
|
||||||
|
//
|
||||||
|
partition_method_automatic_luks_checkbutton.set_label(Some(&t!("enable_luks2_enc")));
|
||||||
|
//
|
||||||
|
partition_method_automatic_luks_password_entry.set_title(&t!("luks2_password"));
|
||||||
|
//
|
||||||
|
partition_method_automatic_luks_password_confirm_entry.set_title(&t!("luks2_password_confirm"));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
fn disk_check(device_button: >k::CheckButton ,devices_selection_expander_row: &adw::ExpanderRow, partition_method_automatic_disk_size_error_label: >k::Label, device_block_name: &str, device_block_size: f64) {
|
||||||
|
if device_button.is_active() == true {
|
||||||
|
devices_selection_expander_row.set_title(device_block_name);
|
||||||
|
if device_block_size > 39000000000.0 {
|
||||||
|
partition_method_automatic_disk_size_error_label.set_visible(false);
|
||||||
|
} else {
|
||||||
|
partition_method_automatic_disk_size_error_label.set_visible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user