Send luks status to UI
This commit is contained in:
parent
b466462550
commit
6e7717bae7
@ -512,16 +512,21 @@ fn set_crypttab_entries(
|
|||||||
.margin_start(10)
|
.margin_start(10)
|
||||||
.margin_end(10)
|
.margin_end(10)
|
||||||
.build();
|
.build();
|
||||||
|
let crypttab_password_status_label = gtk::Label::builder()
|
||||||
|
.build();
|
||||||
crypttab_password_listbox.add_css_class("boxed-list");
|
crypttab_password_listbox.add_css_class("boxed-list");
|
||||||
let crypttab_password = adw::PasswordEntryRow::builder()
|
let crypttab_password = adw::PasswordEntryRow::builder()
|
||||||
.title(t!("luks_password_for").to_string() + &fs_entry.partition.part_name)
|
.title(t!("luks_password_for").to_string() + &fs_entry.partition.part_name)
|
||||||
.build();
|
.build();
|
||||||
crypttab_password.set_show_apply_button(true);
|
crypttab_password.set_show_apply_button(true);
|
||||||
crypttab_password_listbox.append(&crypttab_password);
|
crypttab_password_listbox.append(&crypttab_password);
|
||||||
|
let crypttab_password_child_box = gtk::Box::new(Orientation::Vertical, 0);
|
||||||
|
crypttab_password_child_box.append(&crypttab_password_listbox);
|
||||||
|
crypttab_password_child_box.append(&crypttab_password_status_label);
|
||||||
let crypttab_dialog = adw::MessageDialog::builder()
|
let crypttab_dialog = adw::MessageDialog::builder()
|
||||||
.transient_for(&window)
|
.transient_for(&window)
|
||||||
.hide_on_close(true)
|
.hide_on_close(true)
|
||||||
.extra_child(&crypttab_password_listbox)
|
.extra_child(&crypttab_password_child_box)
|
||||||
.width_request(400)
|
.width_request(400)
|
||||||
.height_request(200)
|
.height_request(200)
|
||||||
.heading(
|
.heading(
|
||||||
@ -540,6 +545,8 @@ fn set_crypttab_entries(
|
|||||||
#[strong]
|
#[strong]
|
||||||
fs_entry,
|
fs_entry,
|
||||||
#[weak]
|
#[weak]
|
||||||
|
crypttab_password_status_label,
|
||||||
|
#[weak]
|
||||||
crypttab_dialog,
|
crypttab_dialog,
|
||||||
move |_| {
|
move |_| {
|
||||||
let luks_manual_password_sender = luks_manual_password_sender.clone();
|
let luks_manual_password_sender = luks_manual_password_sender.clone();
|
||||||
@ -547,6 +554,8 @@ fn set_crypttab_entries(
|
|||||||
|
|
||||||
let fs_entry_clone1 = fs_entry.clone();
|
let fs_entry_clone1 = fs_entry.clone();
|
||||||
|
|
||||||
|
crypttab_password_status_label.set_label(&t!("crypttab_password_status_label_label_checking"));
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
luks_manual_password_sender
|
luks_manual_password_sender
|
||||||
.send_blocking(partitioning_page::test_luks_passwd(
|
.send_blocking(partitioning_page::test_luks_passwd(
|
||||||
@ -562,9 +571,16 @@ fn set_crypttab_entries(
|
|||||||
luks_manual_password_main_context.spawn_local(clone!(
|
luks_manual_password_main_context.spawn_local(clone!(
|
||||||
#[weak]
|
#[weak]
|
||||||
crypttab_dialog,
|
crypttab_dialog,
|
||||||
|
#[weak]
|
||||||
|
crypttab_password_status_label,
|
||||||
async move {
|
async move {
|
||||||
while let Ok(state) = luks_manual_password_receiver.recv().await {
|
while let Ok(state) = luks_manual_password_receiver.recv().await {
|
||||||
crypttab_dialog.set_response_enabled("crypttab_dialog_auto", state);
|
crypttab_dialog.set_response_enabled("crypttab_dialog_auto", state);
|
||||||
|
if state == false {
|
||||||
|
crypttab_password_status_label.set_label(&t!("crypttab_password_status_label_label_wrong_password"))
|
||||||
|
} else {
|
||||||
|
crypttab_password_status_label.set_label("")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
Loading…
Reference in New Issue
Block a user