create new page for GoHome instead of using browsing history
This commit is contained in:
@@ -75,10 +75,10 @@ type BrowsingPane struct {
|
||||
navBtnsPageMap map[controller.PageName]fyne.Resource
|
||||
}
|
||||
|
||||
func NewBrowsingPane(app *backend.App, contr *controller.Controller) *BrowsingPane {
|
||||
func NewBrowsingPane(app *backend.App, contr *controller.Controller, onGoHome func()) *BrowsingPane {
|
||||
b := &BrowsingPane{app: app}
|
||||
b.ExtendBaseWidget(b)
|
||||
b.home = widget.NewButtonWithIcon("", theme.HomeIcon(), b.GoHome)
|
||||
b.home = widget.NewButtonWithIcon("", theme.HomeIcon(), onGoHome)
|
||||
b.back = widget.NewButtonWithIcon("", theme.NavigateBackIcon(), b.GoBack)
|
||||
b.forward = widget.NewButtonWithIcon("", theme.NavigateNextIcon(), b.GoForward)
|
||||
b.reload = widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), b.Reload)
|
||||
@@ -269,17 +269,6 @@ func (b *BrowsingPane) updateHistoryButtons() {
|
||||
}
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) GoHome() {
|
||||
if len(b.history) > 0 {
|
||||
homePage := b.history[0].Restore()
|
||||
if b.CurrentPage() != homePage.Route() {
|
||||
b.addPageToHistory(b.curPage, false)
|
||||
b.doSetPage(homePage)
|
||||
b.updateHistoryButtons()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) GoBack() {
|
||||
if b.historyIdx > 0 {
|
||||
// due to widget reuse between pages,
|
||||
|
||||
Reference in New Issue
Block a user