more fyne.Do in controller
This commit is contained in:
@@ -403,7 +403,7 @@ func (m *Controller) DoEditPlaylistWorkflow(playlist *mediaprovider.Playlist) {
|
|||||||
log.Printf("error deleting playlist: %s", err.Error())
|
log.Printf("error deleting playlist: %s", err.Error())
|
||||||
} else if rte := m.CurPageFunc(); rte.Page == Playlist && rte.Arg == playlist.ID {
|
} else if rte := m.CurPageFunc(); rte.Page == Playlist && rte.Arg == playlist.ID {
|
||||||
// navigate to playlists page if user is still on the page of the deleted playlist
|
// navigate to playlists page if user is still on the page of the deleted playlist
|
||||||
m.NavigateTo(PlaylistsRoute())
|
fyne.Do(func() { m.NavigateTo(PlaylistsRoute()) })
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
@@ -418,7 +418,7 @@ func (m *Controller) DoEditPlaylistWorkflow(playlist *mediaprovider.Playlist) {
|
|||||||
log.Printf("error updating playlist: %s", err.Error())
|
log.Printf("error updating playlist: %s", err.Error())
|
||||||
} else if rte := m.CurPageFunc(); rte.Page == Playlist && rte.Arg == playlist.ID {
|
} else if rte := m.CurPageFunc(); rte.Page == Playlist && rte.Arg == playlist.ID {
|
||||||
// if user is on playlist page, reload to get the updates
|
// if user is on playlist page, reload to get the updates
|
||||||
m.ReloadFunc()
|
fyne.Do(m.ReloadFunc)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
@@ -479,6 +479,7 @@ func (m *Controller) PromptForLoginAndConnect() {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
err := m.App.ServerManager.TestConnectionAndAuth(ctx, server.ServerConnection, password)
|
err := m.App.ServerManager.TestConnectionAndAuth(ctx, server.ServerConnection, password)
|
||||||
|
fyne.Do(func() {
|
||||||
if err == backend.ErrUnreachable {
|
if err == backend.ErrUnreachable {
|
||||||
d.SetErrorText(lang.L("Server unreachable"))
|
d.SetErrorText(lang.L("Server unreachable"))
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
@@ -489,6 +490,7 @@ func (m *Controller) PromptForLoginAndConnect() {
|
|||||||
m.doModalClosed()
|
m.doModalClosed()
|
||||||
}
|
}
|
||||||
d.EnableSubmit()
|
d.EnableSubmit()
|
||||||
|
})
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
d.OnEditServer = func(server *backend.ServerConfig) {
|
d.OnEditServer = func(server *backend.ServerConfig) {
|
||||||
@@ -498,7 +500,9 @@ func (m *Controller) PromptForLoginAndConnect() {
|
|||||||
editD.OnSubmit = func() {
|
editD.OnSubmit = func() {
|
||||||
d.DisableSubmit()
|
d.DisableSubmit()
|
||||||
go func() {
|
go func() {
|
||||||
if m.testConnectionAndUpdateDialogText(editD) {
|
success := m.testConnectionAndUpdateDialogText(editD)
|
||||||
|
fyne.Do(func() {
|
||||||
|
if success {
|
||||||
// connection is good
|
// connection is good
|
||||||
editPop.Hide()
|
editPop.Hide()
|
||||||
server.Hostname = editD.Host
|
server.Hostname = editD.Host
|
||||||
@@ -510,6 +514,7 @@ func (m *Controller) PromptForLoginAndConnect() {
|
|||||||
m.doModalClosed()
|
m.doModalClosed()
|
||||||
}
|
}
|
||||||
d.EnableSubmit()
|
d.EnableSubmit()
|
||||||
|
})
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
editD.OnCancel = func() {
|
editD.OnCancel = func() {
|
||||||
@@ -525,7 +530,9 @@ func (m *Controller) PromptForLoginAndConnect() {
|
|||||||
newD.OnSubmit = func() {
|
newD.OnSubmit = func() {
|
||||||
d.DisableSubmit()
|
d.DisableSubmit()
|
||||||
go func() {
|
go func() {
|
||||||
if m.testConnectionAndUpdateDialogText(newD) {
|
success := m.testConnectionAndUpdateDialogText(newD)
|
||||||
|
fyne.Do(func() {
|
||||||
|
if success {
|
||||||
// connection is good
|
// connection is good
|
||||||
newPop.Hide()
|
newPop.Hide()
|
||||||
conn := backend.ServerConnection{
|
conn := backend.ServerConnection{
|
||||||
@@ -540,6 +547,7 @@ func (m *Controller) PromptForLoginAndConnect() {
|
|||||||
m.doModalClosed()
|
m.doModalClosed()
|
||||||
}
|
}
|
||||||
d.EnableSubmit()
|
d.EnableSubmit()
|
||||||
|
})
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
newD.OnCancel = func() {
|
newD.OnCancel = func() {
|
||||||
@@ -757,6 +765,7 @@ func (c *Controller) ShowShareDialog(id string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fyne.Do(func() {
|
||||||
hyperlink := widget.NewHyperlink(shareUrl.String(), shareUrl)
|
hyperlink := widget.NewHyperlink(shareUrl.String(), shareUrl)
|
||||||
dlg := dialog.NewCustom(lang.L("Share content"), lang.L("OK"),
|
dlg := dialog.NewCustom(lang.L("Share content"), lang.L("OK"),
|
||||||
container.NewHBox(
|
container.NewHBox(
|
||||||
@@ -775,6 +784,7 @@ func (c *Controller) ShowShareDialog(id string) {
|
|||||||
c.MainWindow,
|
c.MainWindow,
|
||||||
)
|
)
|
||||||
dlg.Show()
|
dlg.Show()
|
||||||
|
})
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -908,6 +918,7 @@ func (c *Controller) ShowAlbumInfoDialog(albumID, albumName string, albumCover i
|
|||||||
log.Print("Error getting album info: ", err)
|
log.Print("Error getting album info: ", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
fyne.Do(func() {
|
||||||
dlg := dialogs.NewAlbumInfoDialog(albumInfo, albumName, albumCover)
|
dlg := dialogs.NewAlbumInfoDialog(albumInfo, albumName, albumCover)
|
||||||
pop := widget.NewModalPopUp(dlg, c.MainWindow.Canvas())
|
pop := widget.NewModalPopUp(dlg, c.MainWindow.Canvas())
|
||||||
dlg.OnDismiss = func() {
|
dlg.OnDismiss = func() {
|
||||||
@@ -917,6 +928,7 @@ func (c *Controller) ShowAlbumInfoDialog(albumID, albumName string, albumCover i
|
|||||||
c.ClosePopUpOnEscape(pop)
|
c.ClosePopUpOnEscape(pop)
|
||||||
c.haveModal = true
|
c.haveModal = true
|
||||||
pop.Show()
|
pop.Show()
|
||||||
|
})
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -111,11 +111,13 @@ func NewMainWindow(fyneApp fyne.App, appName, displayAppName, appVersion string,
|
|||||||
m.BrowsingPane.AddSettingsMenuItem(lang.L("Check for Updates"), func() {
|
m.BrowsingPane.AddSettingsMenuItem(lang.L("Check for Updates"), func() {
|
||||||
go func() {
|
go func() {
|
||||||
if t := app.UpdateChecker.CheckLatestVersionTag(); t != "" && t != app.VersionTag() {
|
if t := app.UpdateChecker.CheckLatestVersionTag(); t != "" && t != app.VersionTag() {
|
||||||
m.ShowNewVersionDialog(displayAppName, t)
|
fyne.Do(func() { m.ShowNewVersionDialog(displayAppName, t) })
|
||||||
} else {
|
} else {
|
||||||
|
fyne.Do(func() {
|
||||||
dialog.ShowInformation(lang.L("No new version found"),
|
dialog.ShowInformation(lang.L("No new version found"),
|
||||||
lang.L("You are running the latest version of")+" "+displayAppName,
|
lang.L("You are running the latest version of")+" "+displayAppName,
|
||||||
m.Window)
|
m.Window)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user