mirror of
https://github.com/jwinterm/grim.git
synced 2026-11-27 08:23:54 +01:00
ui: fix wallet deletion, node info max peers amount, paddings at logo and wallet recovery settings
This commit is contained in:
+10
-10
@@ -89,16 +89,16 @@ impl WalletList {
|
||||
list.insert(0, wallet);
|
||||
}
|
||||
|
||||
// /// Remove [`Wallet`] with provided identifier.
|
||||
// pub fn remove(&mut self, id: i64) {
|
||||
// let list = self.mut_list();
|
||||
// for (index, wallet) in list.iter().enumerate() {
|
||||
// if wallet.get_config().id == id {
|
||||
// list.remove(index);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
/// Remove [`Wallet`] with provided identifier.
|
||||
pub fn remove(&mut self, id: i64) {
|
||||
let list = self.mut_list();
|
||||
for (index, wallet) in list.iter().enumerate() {
|
||||
if wallet.get_config().id == id {
|
||||
list.remove(index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Select [`Wallet`] with provided identifier.
|
||||
pub fn select(&mut self, id: Option<i64>) {
|
||||
|
||||
@@ -1018,19 +1018,21 @@ impl Wallet {
|
||||
|
||||
/// Close the wallet, delete its files and mark it as deleted.
|
||||
pub fn delete_wallet(&self) {
|
||||
let wallet_delete = self.clone();
|
||||
// Close wallet if open.
|
||||
if self.is_open() {
|
||||
self.close();
|
||||
}
|
||||
// Mark wallet as deleted.
|
||||
let wallet_delete = self.clone();
|
||||
wallet_delete.deleted.store(true, Ordering::Relaxed);
|
||||
|
||||
thread::spawn(move || {
|
||||
// Wait wallet to be closed.
|
||||
if wallet_delete.is_open() {
|
||||
thread::sleep(Duration::from_millis(300));
|
||||
thread::sleep(Duration::from_millis(100));
|
||||
}
|
||||
// Remove wallet files.
|
||||
let _ = fs::remove_dir_all(wallet_delete.get_config().get_data_path());
|
||||
// Mark wallet as not opened and deleted.
|
||||
// Mark wallet as deleted.
|
||||
wallet_delete.deleted.store(true, Ordering::Relaxed);
|
||||
// Start sync to close thread.
|
||||
wallet_delete.sync(true);
|
||||
|
||||
Reference in New Issue
Block a user