diff --git a/src/gui/views/network/node.rs b/src/gui/views/network/node.rs index 8b30457..c29cfcc 100644 --- a/src/gui/views/network/node.rs +++ b/src/gui/views/network/node.rs @@ -21,7 +21,7 @@ use crate::gui::icons::{AT, CUBE, DEVICES, FLOW_ARROW, HANDSHAKE, PACKAGE, SHARE use crate::gui::platform::PlatformCallbacks; use crate::gui::views::{NetworkContent, Root, View}; use crate::gui::views::network::types::{NetworkTab, NetworkTabType}; -use crate::node::Node; +use crate::node::{Node, NodeConfig}; /// Integrated node tab content. #[derive(Default)] @@ -176,10 +176,10 @@ fn node_stats_ui(ui: &mut egui::Ui) { [false, false, true, false]); }); columns[1].vertical_centered(|ui| { - View::rounded_box(ui, - stats.peer_count.to_string(), - t!("network_node.peers"), - [false, false, false, true]); + let peers_txt = format!("{} ({})", + stats.peer_count, + NodeConfig::get_max_outbound_peers()); + View::rounded_box(ui, peers_txt, t!("network_node.peers"), [false, false, false, true]); }); }); ui.add_space(5.0); diff --git a/src/gui/views/views.rs b/src/gui/views/views.rs index fb2e8d9..82918ec 100644 --- a/src/gui/views/views.rs +++ b/src/gui/views/views.rs @@ -637,7 +637,7 @@ impl View { }; // Show application logo and name. egui::Image::new(logo).fit_to_exact_size(egui::vec2(180.0, 180.0)).ui(ui); - ui.add_space(-17.0); + ui.add_space(-12.0); ui.label(RichText::new("GRIM") .size(24.0) .color(Colors::white_or_black(true)) diff --git a/src/gui/views/wallets/content.rs b/src/gui/views/wallets/content.rs index 50ff453..e433806 100644 --- a/src/gui/views/wallets/content.rs +++ b/src/gui/views/wallets/content.rs @@ -341,11 +341,19 @@ impl WalletsContent { View::max_width_ui(ui, Root::SIDE_PANEL_WIDTH * 1.3, |ui| { // Show application logo and name. View::app_logo_name_version(ui); - ui.add_space(20.0); + ui.add_space(15.0); let mut list = self.wallets.list().clone(); // Remove deleted wallet from the list. - list.retain(|w| !w.is_deleted()); + list.retain(|w| { + let deleted = w.is_deleted(); + if deleted { + self.wallets.select(None); + self.wallets.remove(w.get_config().id); + ui.ctx().request_repaint(); + } + !deleted + }); for wallet in &list { // Check if wallet reopen is needed. if !wallet.is_open() && wallet.reopen_needed() { diff --git a/src/gui/views/wallets/setup/recovery.rs b/src/gui/views/wallets/setup/recovery.rs index c3cc9a8..31fb0fa 100644 --- a/src/gui/views/wallets/setup/recovery.rs +++ b/src/gui/views/wallets/setup/recovery.rs @@ -70,10 +70,11 @@ impl RecoverySetup { let integrated_node = wallet.get_current_ext_conn().is_none(); let integrated_node_ready = Node::get_sync_status() == Some(SyncStatus::NoSync); if wallet.sync_error() || (integrated_node && !integrated_node_ready) { - ui.add_space(6.0); + ui.add_space(2.0); ui.label(RichText::new(t!("wallets.repair_unavailable")) .size(16.0) .color(Colors::red())); + ui.add_space(2.0); } else if !wallet.is_repairing() { ui.add_space(6.0); diff --git a/src/wallet/list.rs b/src/wallet/list.rs index 81f53a8..a8d5a45 100644 --- a/src/wallet/list.rs +++ b/src/wallet/list.rs @@ -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) { diff --git a/src/wallet/wallet.rs b/src/wallet/wallet.rs index 8ef52c6..f97aee8 100644 --- a/src/wallet/wallet.rs +++ b/src/wallet/wallet.rs @@ -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);