diff --git a/cmd/gtk/assets/ui/dialog_transaction_bond.ui b/cmd/gtk/assets/ui/dialog_transaction_bond.ui index 088eb0501..6b83ee8df 100644 --- a/cmd/gtk/assets/ui/dialog_transaction_bond.ui +++ b/cmd/gtk/assets/ui/dialog_transaction_bond.ui @@ -1,5 +1,5 @@ - + @@ -220,7 +220,7 @@ True False start - Memo: + Amount: False @@ -229,13 +229,13 @@ - + True True True - 32 False number + False @@ -244,9 +244,11 @@ - + True False + start + True False @@ -258,8 +260,6 @@ True False - start - Amount: False @@ -268,14 +268,11 @@ - + True - True - True - 32 - False - number - + False + start + Memo (Up to 64 characters, Optional): False @@ -284,11 +281,11 @@ - + True - False - start - True + True + True + False False diff --git a/cmd/gtk/assets/ui/dialog_transaction_transfer.ui b/cmd/gtk/assets/ui/dialog_transaction_transfer.ui index 8cd4d810c..a645cad9f 100644 --- a/cmd/gtk/assets/ui/dialog_transaction_transfer.ui +++ b/cmd/gtk/assets/ui/dialog_transaction_transfer.ui @@ -1,5 +1,5 @@ - + @@ -142,7 +142,6 @@ True True True - 32 False @@ -180,7 +179,7 @@ True False start - Memo: + Amount: False @@ -189,12 +188,13 @@ - + True True True - 32 False + number + False @@ -203,9 +203,11 @@ - + True False + start + True False @@ -217,8 +219,6 @@ True False - start - Amount: False @@ -227,14 +227,11 @@ - + True - True - True - 32 - False - number - + False + start + Memo (Up to 64 characters, Optional): False @@ -243,11 +240,11 @@ - + True - False - start - True + True + True + False False diff --git a/cmd/gtk/assets/ui/dialog_transaction_unbond.ui b/cmd/gtk/assets/ui/dialog_transaction_unbond.ui index 0caa94f68..64cf89c6b 100644 --- a/cmd/gtk/assets/ui/dialog_transaction_unbond.ui +++ b/cmd/gtk/assets/ui/dialog_transaction_unbond.ui @@ -1,5 +1,5 @@ - + @@ -136,7 +136,7 @@ True False start - Memo: + Memo (Up to 64 characters, Optional): False @@ -149,9 +149,7 @@ True True True - 32 False - number False @@ -159,18 +157,6 @@ 5 - - - True - False - start - - - False - True - 6 - - True diff --git a/cmd/gtk/assets/ui/dialog_transaction_withdraw.ui b/cmd/gtk/assets/ui/dialog_transaction_withdraw.ui index 0e425dd55..8ccd92ad5 100644 --- a/cmd/gtk/assets/ui/dialog_transaction_withdraw.ui +++ b/cmd/gtk/assets/ui/dialog_transaction_withdraw.ui @@ -1,36 +1,7 @@ - + - - False - dialog - 20 - - - False - vertical - 2 - - - False - end - - - - - - - - - False - False - 0 - - - - - 600 False @@ -203,7 +174,7 @@ True False start - Memo: + Stake: False @@ -212,13 +183,13 @@ - + True True True - 32 False number + False @@ -227,9 +198,11 @@ - + True False + start + True False @@ -241,8 +214,6 @@ True False - start - Stake: False @@ -251,14 +222,11 @@ - + True - True - True - 32 - False - number - + False + start + Memo (Up to 64 characters, Optional): False @@ -267,11 +235,11 @@ - + True - False - start - True + True + True + False False diff --git a/cmd/gtk/dialog_transaction_bond.go b/cmd/gtk/dialog_transaction_bond.go index 8677c959b..fe4c5fb22 100644 --- a/cmd/gtk/dialog_transaction_bond.go +++ b/cmd/gtk/dialog_transaction_bond.go @@ -85,15 +85,15 @@ func broadcastTransactionBond(wlt *wallet.Wallet) { } msg := fmt.Sprintf(` You are going to sign and broadcast this transaction: - + From: %s To: %s Amount: %s -Memo: %s Fee: %s - -THIS ACTION IS NOT REVERSIBLE. Do you want to continue?`, - sender, receiver, amt, trx.Memo(), trx.Fee()) +Memo: %s + +THIS ACTION IS NOT REVERSIBLE. Do you want to continue?`, + sender, receiver, amt, trx.Fee(), trx.Memo()) signAndBroadcastTransaction(dlg, msg, wlt, trx) diff --git a/cmd/gtk/dialog_transaction_transfer.go b/cmd/gtk/dialog_transaction_transfer.go index bf3d92799..628bdda5c 100644 --- a/cmd/gtk/dialog_transaction_transfer.go +++ b/cmd/gtk/dialog_transaction_transfer.go @@ -76,15 +76,15 @@ func broadcastTransactionTransfer(wlt *wallet.Wallet) { } msg := fmt.Sprintf(` You are going to sign and broadcast this transaction: - + From: %s To: %s Amount: %s -Memo: %s Fee: %s - -THIS ACTION IS NOT REVERSIBLE. Do you want to continue?`, - sender, receiver, amt, trx.Memo(), trx.Fee()) +Memo: %s + +THIS ACTION IS NOT REVERSIBLE. Do you want to continue?`, + sender, receiver, amt, trx.Fee(), trx.Memo()) signAndBroadcastTransaction(dlg, msg, wlt, trx) diff --git a/cmd/gtk/dialog_transaction_unbond.go b/cmd/gtk/dialog_transaction_unbond.go index ab15a7dde..9722865a2 100644 --- a/cmd/gtk/dialog_transaction_unbond.go +++ b/cmd/gtk/dialog_transaction_unbond.go @@ -52,11 +52,11 @@ func broadcastTransactionUnbond(wlt *wallet.Wallet) { } msg := fmt.Sprintf(` You are going to sign and broadcast this transaction: - + Validator: %s Memo: %s - -THIS ACTION IS NOT REVERSIBLE. Do you want to continue?`, validator, trx.Memo()) + +THIS ACTION IS NOT REVERSIBLE. Do you want to continue?`, validator, trx.Memo()) signAndBroadcastTransaction(dlg, msg, wlt, trx) diff --git a/cmd/gtk/dialog_transaction_withdraw.go b/cmd/gtk/dialog_transaction_withdraw.go index d55fca766..62560cae8 100644 --- a/cmd/gtk/dialog_transaction_withdraw.go +++ b/cmd/gtk/dialog_transaction_withdraw.go @@ -82,15 +82,15 @@ func broadcastTransactionWithdraw(wlt *wallet.Wallet) { } msg := fmt.Sprintf(` You are going to sign and broadcast this transaction: - + From: %s To: %s Amount: %s Memo: %s Fee: %s - -THIS ACTION IS NOT REVERSIBLE. Do you want to continue?`, - sender, receiver, amt, trx.Memo(), trx.Fee()) + +THIS ACTION IS NOT REVERSIBLE. Do you want to continue?`, + sender, receiver, amt, trx.Fee(), trx.Memo()) signAndBroadcastTransaction(dlg, msg, wlt, trx) diff --git a/cmd/gtk/utils.go b/cmd/gtk/utils.go index 694f35769..9f3f6054f 100644 --- a/cmd/gtk/utils.go +++ b/cmd/gtk/utils.go @@ -19,9 +19,25 @@ import ( "github.com/pactus-project/pactus/wallet" ) +// https://stackoverflow.com/questions/3249053/copying-the-text-from-a-gtk-messagedialog +func updateMessageDialog(dlg *gtk.MessageDialog) { + area, err := dlg.GetMessageArea() + if err == nil { + children := area.GetChildren() + children.Foreach(func(item interface{}) { + label, err := gtk.WidgetToLabel(item.(*gtk.Widget)) + if err == nil { + label.SetSelectable(true) + label.SetUseMarkup(true) + } + }) + } +} + func showQuestionDialog(parent gtk.IWindow, msg string) bool { dlg := gtk.MessageDialogNew(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, msg) + updateMessageDialog(dlg) res := dlg.Run() dlg.Destroy() @@ -31,6 +47,7 @@ func showQuestionDialog(parent gtk.IWindow, msg string) bool { func showInfoDialog(parent gtk.IWindow, msg string) { dlg := gtk.MessageDialogNew(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, msg) + updateMessageDialog(dlg) dlg.Run() dlg.Destroy() } @@ -38,6 +55,7 @@ func showInfoDialog(parent gtk.IWindow, msg string) { func showWarningDialog(parent gtk.IWindow, msg string) { dlg := gtk.MessageDialogNew(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK, msg) + updateMessageDialog(dlg) dlg.Run() dlg.Destroy() } @@ -45,6 +63,7 @@ func showWarningDialog(parent gtk.IWindow, msg string) { func showErrorDialog(parent gtk.IWindow, msg string) { dlg := gtk.MessageDialogNew(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, msg) + updateMessageDialog(dlg) dlg.Run() dlg.Destroy() } @@ -216,7 +235,8 @@ func signAndBroadcastTransaction(parent *gtk.Dialog, msg string, w *wallet.Walle return } - showInfoDialog(parent, fmt.Sprintf("Your transaction Hash: %s", txID)) + showInfoDialog(parent, + fmt.Sprintf("Transaction Hash: %s", txID, txID)) } }