mirror of
https://github.com/taigrr/wails.git
synced 2026-04-17 04:05:12 -07:00
Remove old dialog code
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user