Skip to content

Commit 791e6b7

Browse files
committed
Don't show a new file dialog each time
Most of the other dialogs already had this improvement (except for errors).
1 parent 70e87ff commit 791e6b7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

internal/ui/send.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ type send struct {
1414
contentPicker dialog.Dialog
1515

1616
fileChoice *widget.Button
17+
fileDialog *dialog.FileDialog
1718
directoryChoice *widget.Button
19+
directoryDialog *dialog.FileDialog
1820
textChoice *widget.Button
1921

2022
contentToSend *widget.Button
@@ -32,12 +34,12 @@ func newSend(a fyne.App, w fyne.Window, b *bridge.Bridge, as *AppSettings) *send
3234

3335
func (s *send) onFileSend() {
3436
s.contentPicker.Hide()
35-
dialog.ShowFileOpen(s.sendList.OnFileSelect, s.window)
37+
s.fileDialog.Show()
3638
}
3739

3840
func (s *send) onDirSend() {
3941
s.contentPicker.Hide()
40-
dialog.ShowFolderOpen(s.sendList.OnDirSelect, s.window)
42+
s.directoryDialog.Show()
4143
}
4244

4345
func (s *send) onTextSend() {
@@ -61,6 +63,9 @@ func (s *send) buildUI() *fyne.Container {
6163
s.sendList = widgets.NewSendList(s.bridge)
6264
s.contentToSend = &widget.Button{Text: "Add content to send", Icon: theme.ContentAddIcon(), OnTapped: s.onContentToSend}
6365

66+
s.fileDialog = dialog.NewFileOpen(s.sendList.OnFileSelect, s.window)
67+
s.directoryDialog = dialog.NewFolderOpen(s.sendList.OnDirSelect, s.window)
68+
6469
box := container.NewVBox(s.contentToSend, &widget.Label{})
6570
return container.NewBorder(box, nil, nil, nil, s.sendList)
6671
}

0 commit comments

Comments
 (0)