mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Properly scope Config to the wtf package and remove it as a dependency from everywhere else
This commit is contained in:
@@ -3,6 +3,8 @@ package clocks
|
||||
import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
)
|
||||
|
||||
type ClockCollection struct {
|
||||
@@ -10,7 +12,7 @@ type ClockCollection struct {
|
||||
}
|
||||
|
||||
func (clocks *ClockCollection) Sorted() []Clock {
|
||||
if "chronological" == Config.UString("wtf.mods.clocks.sort", "alphabetical") {
|
||||
if "chronological" == wtf.Config.UString("wtf.mods.clocks.sort", "alphabetical") {
|
||||
clocks.SortedChronologically()
|
||||
} else {
|
||||
clocks.SortedAlphabetically()
|
||||
|
||||
@@ -3,13 +3,9 @@ package clocks
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
)
|
||||
|
||||
// Config is a pointer to the global config object
|
||||
var Config *config.Config
|
||||
|
||||
type Widget struct {
|
||||
wtf.TextWidget
|
||||
|
||||
@@ -21,7 +17,7 @@ func NewWidget() *Widget {
|
||||
TextWidget: wtf.NewTextWidget(" World Clocks ", "clocks", false),
|
||||
}
|
||||
|
||||
widget.clockColl = widget.buildClockCollection(Config.UMap("wtf.mods.clocks.locations"))
|
||||
widget.clockColl = widget.buildClockCollection(wtf.Config.UMap("wtf.mods.clocks.locations"))
|
||||
|
||||
return &widget
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user