1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Rename Prev/Next in MultiSourceWidget

This will open the possibility of a MultiSourceScrollableWidget with no collisions
This commit is contained in:
Sean Smith
2019-05-12 22:51:52 -04:00
parent bca6772a07
commit 34bf319c2e
7 changed files with 30 additions and 26 deletions

View File

@@ -1,7 +1,9 @@
package wtf
import (
"fmt"
"github.com/wtfutil/wtf/cfg"
"github.com/wtfutil/wtf/logger"
)
type MultiSourceWidget struct {
@@ -24,6 +26,8 @@ func NewMultiSourceWidget(moduleConfig *cfg.Common, singular, plural string) Mul
widget.loadSources()
logger.Log(fmt.Sprintf("%+v", widget.Sources))
return widget
}
@@ -40,7 +44,7 @@ func (widget *MultiSourceWidget) CurrentSource() string {
// Next displays the next source in the source list. If the current source is the last
// source it wraps around to the first source
func (widget *MultiSourceWidget) Next() {
func (widget *MultiSourceWidget) NextSource() {
widget.Idx = widget.Idx + 1
if widget.Idx == len(widget.Sources) {
widget.Idx = 0
@@ -53,7 +57,7 @@ func (widget *MultiSourceWidget) Next() {
// Prev displays the previous source in the source list. If the current source is the first
// source, it wraps around to the last source
func (widget *MultiSourceWidget) Prev() {
func (widget *MultiSourceWidget) PrevSource() {
widget.Idx = widget.Idx - 1
if widget.Idx < 0 {
widget.Idx = len(widget.Sources) - 1