Skip to content

Commit

Permalink
wallet: add Open PSBT menu option
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Sep 12, 2023
1 parent 830abc9 commit bb004e7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/view/wallet/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion src/view/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ use crate::worker::{electrum, exchange};
#[derive(Msg)]
pub enum Msg {
New,
Open,
OpenWallet,
OpenPsbt,
Close,
About,
Duplicate,
Expand Down
14 changes: 14 additions & 0 deletions src/view/wallet/wallet.glade
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,20 @@
<object class="GtkMenu" id="menu">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkMenuItem" id="open_psbt_mi">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_Open PSBT</property>
<property name="use-underline">True</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="redefine_mi">
<property name="visible">True</property>
Expand Down
5 changes: 4 additions & 1 deletion src/view/wallet/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -155,7 +157,7 @@ impl Widgets {

pub(super) fn connect(&self, relm: &Relm<super::Component>) {
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,
Expand All @@ -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);
Expand Down

0 comments on commit bb004e7

Please sign in to comment.