mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-17 09:29:30 +08:00
Proper syncing and canceling of dialogs
s s s
This commit is contained in:
parent
105d9f0d3a
commit
6f75b00463
@ -272,6 +272,7 @@ func (d *OpenFileDialogStruct) PromptForSingleSelection() (string, error) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
result = <-selections
|
result = <-selections
|
||||||
}
|
}
|
||||||
|
close(selections)
|
||||||
|
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,12 @@ func (a *linuxApp) showAboutDialog(title string, message string, icon []byte) {
|
|||||||
about.SetTitle(title).
|
about.SetTitle(title).
|
||||||
SetMessage(message).
|
SetMessage(message).
|
||||||
SetIcon(icon)
|
SetIcon(icon)
|
||||||
|
InvokeAsync(func() {
|
||||||
runQuestionDialog(
|
runQuestionDialog(
|
||||||
pointer(parent),
|
pointer(parent),
|
||||||
about,
|
about,
|
||||||
)
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
type linuxDialog struct {
|
type linuxDialog struct {
|
||||||
@ -28,6 +30,7 @@ func (m *linuxDialog) show() {
|
|||||||
parent, _ = window.(*WebviewWindow).NativeWindowHandle()
|
parent, _ = window.(*WebviewWindow).NativeWindowHandle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InvokeAsync(func() {
|
||||||
response := runQuestionDialog(pointer(parent), m.dialog)
|
response := runQuestionDialog(pointer(parent), m.dialog)
|
||||||
if response >= 0 && response < len(m.dialog.Buttons) {
|
if response >= 0 && response < len(m.dialog.Buttons) {
|
||||||
button := m.dialog.Buttons[response]
|
button := m.dialog.Buttons[response]
|
||||||
@ -35,6 +38,7 @@ func (m *linuxDialog) show() {
|
|||||||
go button.Callback()
|
go button.Callback()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDialogImpl(d *MessageDialog) *linuxDialog {
|
func newDialogImpl(d *MessageDialog) *linuxDialog {
|
||||||
|
@ -1570,11 +1570,10 @@ func runChooserDialog(window pointer, allowMultiple, createFolders, showHidden b
|
|||||||
}
|
}
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
close(selections)
|
|
||||||
C.gtk_widget_destroy((*C.GtkWidget)(unsafe.Pointer(fc)))
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
})
|
})
|
||||||
|
C.gtk_widget_destroy((*C.GtkWidget)(unsafe.Pointer(fc)))
|
||||||
return selections, nil
|
return selections, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user