Remove old dialog code

This commit is contained in:
Lea Anthony
2020-09-26 16:16:25 +10:00
parent 9b0f58ddf5
commit 5ce5e129cf
11 changed files with 8 additions and 179 deletions

View File

@@ -265,7 +265,7 @@ func (w *WebView) SelectFile(title string, filter string) string {
// OpenDialog opens a dialog that allows the user to select a directory
func (w *WebView) OpenDialog() []string {
var result string
var result []string
// We need to run this on the main thread, however Dispatch is
// non-blocking so we launch this in a goroutine and wait for
// dispatch to finish before returning the result
@@ -281,24 +281,6 @@ func (w *WebView) OpenDialog() []string {
return result
}
// SelectSaveFile opens a dialog that allows the user to select a file to save
func (w *WebView) SelectSaveFile(title string, filter string) string {
var result string
// We need to run this on the main thread, however Dispatch is
// non-blocking so we launch this in a goroutine and wait for
// dispatch to finish before returning the result
var wg sync.WaitGroup
wg.Add(1)
go func() {
w.window.Dispatch(func() {
result = w.window.Dialog(wv.DialogTypeSave, 0, title, "", filter)
wg.Done()
})
}()
wg.Wait()
return result
}
// callback sends a callback to the frontend
func (w *WebView) callback(data string) error {
callbackCMD := fmt.Sprintf("window.wails._.Callback('%s');", data)

View File

@@ -186,7 +186,7 @@ type WebView interface {
// Dialog() opens a system dialog of the given type and title. String
// argument can be provided for certain dialogs, such as alert boxes. For
// alert boxes argument is a message inside the dialog box.
Dialog(dlgType DialogType, flags int, title string, arg string, filter string) string
Dialog(dlgType DialogType, flags int, title string, arg string, filter string) []string
// Terminate() breaks the main UI loop. This method must be called from the main thread
// only. See Dispatch() for more details.
Terminate()