mirror of
https://github.com/Xpl0itU/WiiUDownloader.git
synced 2025-05-31 23:38:23 -04:00
Improve queue error handling
This commit is contained in:
parent
c906b6a0c9
commit
2447be588f
1 changed files with 19 additions and 18 deletions
|
@ -206,9 +206,11 @@ func (mw *MainWindow) ShowAll() {
|
||||||
}
|
}
|
||||||
selectedPath, err := dialog.Directory().Title("Select the game path").Browse()
|
selectedPath, err := dialog.Directory().Title("Select the game path").Browse()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if mw.progressWindow.Window.IsVisible() {
|
glib.IdleAdd(func() {
|
||||||
mw.progressWindow.Window.Close()
|
if mw.progressWindow.Window.IsVisible() {
|
||||||
}
|
mw.progressWindow.Window.Close()
|
||||||
|
}
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,9 +355,11 @@ func (mw *MainWindow) ShowAll() {
|
||||||
}
|
}
|
||||||
selectedPath, err := dialog.Directory().Title("Select a path to save the games to").Browse()
|
selectedPath, err := dialog.Directory().Title("Select a path to save the games to").Browse()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if mw.progressWindow.Window.IsVisible() {
|
glib.IdleAdd(func() {
|
||||||
mw.progressWindow.Window.Close()
|
if mw.progressWindow.Window.IsVisible() {
|
||||||
}
|
mw.progressWindow.Window.Close()
|
||||||
|
}
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
mw.progressWindow.Window.ShowAll()
|
mw.progressWindow.Window.ShowAll()
|
||||||
|
@ -718,9 +722,11 @@ func (mw *MainWindow) updateTitlesInQueue() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mw *MainWindow) showError(err error) {
|
func (mw *MainWindow) showError(err error) {
|
||||||
if mw.progressWindow.Window.IsVisible() {
|
glib.IdleAdd(func() {
|
||||||
mw.progressWindow.Window.Close()
|
if mw.progressWindow.Window.IsVisible() {
|
||||||
}
|
mw.progressWindow.Window.Close()
|
||||||
|
}
|
||||||
|
})
|
||||||
errorDialog := gtk.MessageDialogNew(mw.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, err.Error())
|
errorDialog := gtk.MessageDialogNew(mw.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, err.Error())
|
||||||
errorDialog.Run()
|
errorDialog.Run()
|
||||||
errorDialog.Destroy()
|
errorDialog.Destroy()
|
||||||
|
@ -731,6 +737,8 @@ func (mw *MainWindow) onDownloadQueueClicked(selectedPath string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var err error = nil
|
||||||
|
|
||||||
queueStatusChan := make(chan bool, 1)
|
queueStatusChan := make(chan bool, 1)
|
||||||
defer close(queueStatusChan)
|
defer close(queueStatusChan)
|
||||||
errGroup := errgroup.Group{}
|
errGroup := errgroup.Group{}
|
||||||
|
@ -748,15 +756,8 @@ queueProcessingLoop:
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
if err := errGroup.Wait(); err != nil {
|
if err = errGroup.Wait(); err != nil {
|
||||||
queueStatusChan <- false
|
queueStatusChan <- false
|
||||||
mw.titleQueue = []wiiudownloader.TitleEntry{}
|
|
||||||
if mw.progressWindow.Window.IsVisible() {
|
|
||||||
mw.progressWindow.Window.Close()
|
|
||||||
}
|
|
||||||
mw.updateTitlesInQueue()
|
|
||||||
mw.onSelectionChanged()
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !<-queueStatusChan {
|
if !<-queueStatusChan {
|
||||||
|
@ -773,5 +774,5 @@ queueProcessingLoop:
|
||||||
mw.updateTitlesInQueue()
|
mw.updateTitlesInQueue()
|
||||||
mw.onSelectionChanged()
|
mw.onSelectionChanged()
|
||||||
|
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue