wallets: fix wallet mutability, wallet connection change, optimize wallet lists for different chain types

This commit is contained in:
ardocrat
2023-08-11 17:29:25 +03:00
parent 3635b7abe6
commit d466cb1d9c
10 changed files with 133 additions and 60 deletions
+8 -6
View File
@@ -60,11 +60,12 @@ impl WalletContent {
.show_inside(ui, |ui| {
ui.vertical_centered(|ui| {
// Setup tabs width.
let mut rect = ui.available_rect_before_wrap();
let mut width = f32::min(ui.available_width(), Root::SIDE_PANEL_WIDTH * 2.0);
if width == 0.0 {
let available_width = ui.available_width();
if available_width == 0.0 {
return;
}
let mut rect = ui.available_rect_before_wrap();
let width = f32::min(available_width, Root::SIDE_PANEL_WIDTH * 2.0);
rect.set_width(width);
// Draw wallet tabs.
@@ -90,11 +91,12 @@ impl WalletContent {
.show_inside(ui, |ui| {
ui.vertical_centered(|ui| {
// Setup tab content width.
let mut rect = ui.available_rect_before_wrap();
let mut width = f32::min(ui.available_width(), Root::SIDE_PANEL_WIDTH * 2.0);
if width == 0.0 {
let available_width = ui.available_width();
if available_width == 0.0 {
return;
}
let mut rect = ui.available_rect_before_wrap();
let width = f32::min(available_width, Root::SIDE_PANEL_WIDTH * 2.0);
rect.set_width(width);
// Draw current tab content.
+1 -1
View File
@@ -30,7 +30,7 @@ impl WalletTab for WalletInfo {
fn ui(&mut self,
ui: &mut egui::Ui,
frame: &mut eframe::Frame,
wallet: &Wallet,
wallet: &mut Wallet,
cb: &dyn PlatformCallbacks) {
WalletContent::loading_ui(ui, frame, wallet);
}
+5 -1
View File
@@ -25,6 +25,10 @@ impl WalletTab for WalletReceive {
WalletTabType::Receive
}
fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, wallet: &Wallet, cb: &dyn PlatformCallbacks) {
fn ui(&mut self,
ui: &mut egui::Ui,
frame: &mut eframe::Frame,
wallet: &mut Wallet,
cb: &dyn PlatformCallbacks) {
}
}
+5 -1
View File
@@ -25,6 +25,10 @@ impl WalletTab for WalletSend {
WalletTabType::Send
}
fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, wallet: &Wallet, cb: &dyn PlatformCallbacks) {
fn ui(&mut self,
ui: &mut egui::Ui,
frame: &mut eframe::Frame,
wallet: &mut Wallet,
cb: &dyn PlatformCallbacks) {
}
}
+7 -2
View File
@@ -13,12 +13,16 @@
// limitations under the License.
use crate::gui::platform::PlatformCallbacks;
use crate::gui::views::wallets::setup::ConnectionSetup;
use crate::gui::views::wallets::wallet::types::{WalletTab, WalletTabType};
use crate::wallet::Wallet;
/// Wallet settings tab content.
#[derive(Default)]
pub struct WalletSettings;
pub struct WalletSettings {
/// Connection setup content.
conn_setup: ConnectionSetup
}
impl WalletTab for WalletSettings {
fn get_type(&self) -> WalletTabType {
@@ -28,7 +32,8 @@ impl WalletTab for WalletSettings {
fn ui(&mut self,
ui: &mut egui::Ui,
frame: &mut eframe::Frame,
wallet: &Wallet,
wallet: &mut Wallet,
cb: &dyn PlatformCallbacks) {
self.conn_setup.wallet_ui(ui, frame, wallet, cb);
}
}
+1 -1
View File
@@ -21,7 +21,7 @@ pub trait WalletTab {
fn ui(&mut self,
ui: &mut egui::Ui,
frame: &mut eframe::Frame,
wallet: &Wallet,
wallet: &mut Wallet,
cb: &dyn PlatformCallbacks);
}