From 37db103e4e71cc2d67b21b88798c04deaf356183 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Tue, 11 Jul 2023 12:47:37 +0200 Subject: [PATCH] pay: connect paste secondary icons --- src/view/wallet/pay/beneficiary_row/widget.rs | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/view/wallet/pay/beneficiary_row/widget.rs b/src/view/wallet/pay/beneficiary_row/widget.rs index 28a7a2f..aabc284 100644 --- a/src/view/wallet/pay/beneficiary_row/widget.rs +++ b/src/view/wallet/pay/beneficiary_row/widget.rs @@ -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; @@ -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::() }