From bb004e762acead50392b17d13584ccbe7f7549b0 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Tue, 12 Sep 2023 20:42:20 +0200 Subject: [PATCH] wallet: add Open PSBT menu option --- src/view/wallet/component.rs | 7 ++++++- src/view/wallet/mod.rs | 3 ++- src/view/wallet/wallet.glade | 14 ++++++++++++++ src/view/wallet/widget.rs | 5 ++++- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/view/wallet/component.rs b/src/view/wallet/component.rs index b69208b..60670af 100644 --- a/src/view/wallet/component.rs +++ b/src/view/wallet/component.rs @@ -334,11 +334,16 @@ impl Update for Component { .as_ref() .map(|stream| stream.emit(launch::Msg::ShowPage(launch::Page::Template))); } - Msg::Open => { + Msg::OpenWallet => { self.launcher_stream .as_ref() .map(|stream| stream.emit(launch::Msg::Wallet)); } + Msg::OpenPsbt => { + self.launcher_stream + .as_ref() + .map(|stream| stream.emit(launch::Msg::Psbt(None))); + } Msg::Duplicate => { let settings = self.model.to_settings(); let path: PathBuf = self.model.path().clone(); diff --git a/src/view/wallet/mod.rs b/src/view/wallet/mod.rs index b17fdc6..49e8460 100644 --- a/src/view/wallet/mod.rs +++ b/src/view/wallet/mod.rs @@ -31,7 +31,8 @@ use crate::worker::{electrum, exchange}; #[derive(Msg)] pub enum Msg { New, - Open, + OpenWallet, + OpenPsbt, Close, About, Duplicate, diff --git a/src/view/wallet/wallet.glade b/src/view/wallet/wallet.glade index 6d8c6aa..974c7ac 100644 --- a/src/view/wallet/wallet.glade +++ b/src/view/wallet/wallet.glade @@ -363,6 +363,20 @@ True False + + + True + False + _Open PSBT + True + + + + + True + False + + True diff --git a/src/view/wallet/widget.rs b/src/view/wallet/widget.rs index 3b64fe4..9c69aa1 100644 --- a/src/view/wallet/widget.rs +++ b/src/view/wallet/widget.rs @@ -70,6 +70,8 @@ pub struct Widgets { new_btn: Button, open_btn: Button, settings_btn: Button, + + open_psbt_mi: MenuItem, redefine_mi: MenuItem, import_mi: MenuItem, settings_mi: MenuItem, @@ -155,7 +157,7 @@ impl Widgets { pub(super) fn connect(&self, relm: &Relm) { connect!(relm, self.new_btn, connect_clicked(_), Msg::New); - connect!(relm, self.open_btn, connect_clicked(_), Msg::Open); + connect!(relm, self.open_btn, connect_clicked(_), Msg::OpenWallet); connect!(relm, self.settings_btn, connect_clicked(_), Msg::Settings); connect!( relm, @@ -164,6 +166,7 @@ impl Widgets { Msg::Pay(pay::Msg::Show) ); connect!(relm, self.refresh_btn, connect_clicked(_), Msg::Refresh); + connect!(relm, self.open_psbt_mi, connect_activate(_), Msg::OpenPsbt); connect!(relm, self.redefine_mi, connect_activate(_), Msg::Duplicate); connect!(relm, self.import_mi, connect_activate(_), Msg::Import); connect!(relm, self.settings_mi, connect_activate(_), Msg::Settings);