mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Refactor GCal calendar code to simplify things
This commit is contained in:
parent
279822f0a6
commit
708699270d
@ -4,7 +4,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/rivo/tview"
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
)
|
||||
|
||||
@ -14,13 +13,11 @@ type Widget struct {
|
||||
calEvents []*CalEvent
|
||||
ch chan struct{}
|
||||
mutex sync.Mutex
|
||||
app *tview.Application
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application) *Widget {
|
||||
func NewWidget() *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(" Calendar ", "gcal", true),
|
||||
app: app,
|
||||
TextWidget: wtf.NewTextWidget(" Calendar ", "gcal", false),
|
||||
ch: make(chan struct{}),
|
||||
}
|
||||
|
||||
@ -37,7 +34,7 @@ func (widget *Widget) Disable() {
|
||||
}
|
||||
|
||||
func (widget *Widget) Refresh() {
|
||||
calEvents, err := Fetch(CreateCodeInputDialog(" Calendar ", widget))
|
||||
calEvents, err := Fetch()
|
||||
if err != nil {
|
||||
widget.calEvents = []*CalEvent{}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user