@@ -49,7 +49,7 @@ type SendData struct {
49
49
50
50
items []* SendItem
51
51
info sendInfoDialog
52
- textWindow * textSendWindow
52
+ textWindow textSendWindow
53
53
54
54
deleting atomic.Bool
55
55
list * widget.List
@@ -414,30 +414,27 @@ func (s *textSendWindow) send() {
414
414
s .textEntry .SetText ("" )
415
415
}
416
416
417
- func createTextSendWindow (app fyne.App ) * textSendWindow {
418
- display := & textSendWindow {
419
- window : app .NewWindow ("Send Text" ),
420
- textEntry : & widget.Entry {MultiLine : true , Wrapping : fyne .TextWrapWord },
421
- cancelButton : & widget.Button {Text : "Cancel" , Icon : theme .CancelIcon ()},
422
- sendButton : & widget.Button {Text : "Send" , Icon : theme .MailSendIcon (), Importance : widget .HighImportance },
417
+ func (d * SendData ) createTextSendWindow () {
418
+ window := d .Client .App .NewWindow ("Send Text" )
419
+ window .SetCloseIntercept (d .textWindow .dismiss )
420
+
421
+ d .textWindow = textSendWindow {
422
+ window : window ,
423
+ textEntry : & widget.Entry {MultiLine : true , Wrapping : fyne .TextWrapWord , OnSubmitted : func (_ string ) { d .textWindow .send () }},
424
+ cancelButton : & widget.Button {Text : "Cancel" , Icon : theme .CancelIcon (), OnTapped : d .textWindow .dismiss },
425
+ sendButton : & widget.Button {Text : "Send" , Icon : theme .MailSendIcon (), Importance : widget .HighImportance , OnTapped : d .textWindow .send },
423
426
text : make (chan string ),
424
427
}
425
428
426
- display .window .SetCloseIntercept (display .dismiss )
427
- display .cancelButton .OnTapped = display .dismiss
428
- display .sendButton .OnTapped = display .send
429
- display .textEntry .OnSubmitted = func (_ string ) { display .send () }
430
-
431
- actionContainer := container .NewGridWithColumns (2 , display .cancelButton , display .sendButton )
432
- display .window .SetContent (container .NewBorder (nil , actionContainer , nil , nil , display .textEntry ))
433
- display .window .Resize (fyne .NewSize (400 , 300 ))
434
- return display
429
+ actionContainer := container .NewGridWithColumns (2 , d .textWindow .cancelButton , d .textWindow .sendButton )
430
+ window .SetContent (container .NewBorder (nil , actionContainer , nil , nil , d .textWindow .textEntry ))
431
+ window .Resize (fyne .NewSize (400 , 300 ))
435
432
}
436
433
437
434
// showTextSendWindow opens a new window for setting up text to send.
438
435
func (d * SendData ) showTextSendWindow () string {
439
- if d .textWindow == nil {
440
- d .textWindow = createTextSendWindow (d . Client . App )
436
+ if d .textWindow . window == nil {
437
+ d .createTextSendWindow ()
441
438
} else if d .textWindow .window .Canvas ().Content ().Visible () {
442
439
d .textWindow .window .RequestFocus ()
443
440
return ""
0 commit comments