add ability to logout of server (via new settings menu button)
This commit is contained in:
@@ -52,6 +52,8 @@ type BrowsingPane struct {
|
||||
history []SavedPage
|
||||
historyIdx int
|
||||
|
||||
settingsBtn *widget.Button
|
||||
settingsMenu *fyne.Menu
|
||||
navBtnsContainer *fyne.Container
|
||||
pageContainer *fyne.Container
|
||||
container *fyne.Container
|
||||
@@ -65,12 +67,21 @@ func NewBrowsingPane(app *backend.App) *BrowsingPane {
|
||||
b.reload = widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), b.Reload)
|
||||
b.app.PlaybackManager.OnSongChange(b.onSongChange)
|
||||
b.pageContainer = container.NewMax(
|
||||
// TODO: get this color into the theme
|
||||
canvas.NewRectangle(color.RGBA{R: 24, G: 24, B: 24, A: 255}),
|
||||
layout.NewSpacer())
|
||||
b.settingsBtn = widget.NewButtonWithIcon("", theme.SettingsIcon(), func() {
|
||||
p := widget.NewPopUpMenu(b.settingsMenu,
|
||||
fyne.CurrentApp().Driver().CanvasForObject(b.settingsBtn))
|
||||
p.ShowAtPosition(fyne.NewPos(b.Size().Width-p.MinSize().Width-theme.Padding()/2,
|
||||
b.navBtnsContainer.MinSize().Height+theme.Padding()))
|
||||
})
|
||||
b.settingsMenu = fyne.NewMenu("")
|
||||
b.navBtnsContainer = container.NewHBox()
|
||||
b.container = container.NewBorder(
|
||||
container.New(layouts.NewLeftMiddleRightLayout(0),
|
||||
container.NewHBox(b.back, b.forward, b.reload), b.navBtnsContainer, layout.NewSpacer()),
|
||||
container.NewHBox(b.back, b.forward, b.reload), b.navBtnsContainer,
|
||||
container.NewHBox(layout.NewSpacer(), b.settingsBtn)),
|
||||
nil, nil, nil, b.pageContainer)
|
||||
return b
|
||||
}
|
||||
@@ -91,6 +102,11 @@ func (b *BrowsingPane) ClearHistory() {
|
||||
b.historyIdx = 0
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) AddSettingsMenuItem(label string, action func()) {
|
||||
b.settingsMenu.Items = append(b.settingsMenu.Items,
|
||||
fyne.NewMenuItem(label, action))
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) AddNavigationButton(iconRes fyne.Resource, action func()) {
|
||||
b.navBtnsContainer.Add(widget.NewButtonWithIcon("", iconRes, action))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user