Skip to content

Commit

Permalink
pay: connect paste secondary icons
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jul 11, 2023
1 parent a02cfbc commit 37db103
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/view/wallet/pay/beneficiary_row/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use bitcoin::Address;
use bitcoin_scripts::address::AddressCompat;
use gladis::Gladis;
use gtk::prelude::*;
use gtk::{glib, Entry, ListBoxRow, ToggleButton};
use gtk::{gdk, glib, Entry, EntryIconPosition, ListBoxRow, ToggleButton};
use relm::Relm;

use super::Beneficiary;
Expand Down Expand Up @@ -67,6 +67,28 @@ impl RowWidgets {
wallet::Msg::Pay(pay::Msg::BeneficiaryEdit(row.index() as u32))
);

row_widgets.address_fld.connect_icon_press(|me, icon, _| {
let me = me.clone();
if icon == EntryIconPosition::Secondary {
gtk::Clipboard::get(&gdk::SELECTION_CLIPBOARD).request_text(move |_, text| {
if let Some(text) = text {
me.set_text(text);
}
})
}
});

row_widgets.amount_fld.connect_icon_press(|me, icon, _| {
let me = me.clone();
if icon == EntryIconPosition::Secondary {
gtk::Clipboard::get(&gdk::SELECTION_CLIPBOARD).request_text(move |_, text| {
if let Some(text) = text {
me.set_text(text);
}
})
}
});

row_widgets.beneficiary_row.upcast::<gtk::Widget>()
}

Expand Down

0 comments on commit 37db103

Please sign in to comment.