Proper syncing and canceling of dialogs

s

s

s
This commit is contained in:
atterpac
2024-04-08 11:17:05 -05:00
committed by Travis McLane
parent 105d9f0d3a
commit 6f75b00463
3 changed files with 16 additions and 12 deletions
+1
View File
@@ -272,6 +272,7 @@ func (d *OpenFileDialogStruct) PromptForSingleSelection() (string, error) {
if err == nil {
result = <-selections
}
close(selections)
return result, err
}
+14 -10
View File
@@ -10,10 +10,12 @@ func (a *linuxApp) showAboutDialog(title string, message string, icon []byte) {
about.SetTitle(title).
SetMessage(message).
SetIcon(icon)
runQuestionDialog(
pointer(parent),
about,
)
InvokeAsync(func() {
runQuestionDialog(
pointer(parent),
about,
)
})
}
type linuxDialog struct {
@@ -28,13 +30,15 @@ func (m *linuxDialog) show() {
parent, _ = window.(*WebviewWindow).NativeWindowHandle()
}
response := runQuestionDialog(pointer(parent), m.dialog)
if response >= 0 && response < len(m.dialog.Buttons) {
button := m.dialog.Buttons[response]
if button.Callback != nil {
go button.Callback()
InvokeAsync(func() {
response := runQuestionDialog(pointer(parent), m.dialog)
if response >= 0 && response < len(m.dialog.Buttons) {
button := m.dialog.Buttons[response]
if button.Callback != nil {
go button.Callback()
}
}
}
})
}
func newDialogImpl(d *MessageDialog) *linuxDialog {
+1 -2
View File
@@ -1570,11 +1570,10 @@ func runChooserDialog(window pointer, allowMultiple, createFolders, showHidden b
}
count++
}
close(selections)
C.gtk_widget_destroy((*C.GtkWidget)(unsafe.Pointer(fc)))
}
}()
})
C.gtk_widget_destroy((*C.GtkWidget)(unsafe.Pointer(fc)))
return selections, nil
}