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"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/rivo/tview"
|
|
||||||
"github.com/senorprogrammer/wtf/wtf"
|
"github.com/senorprogrammer/wtf/wtf"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,13 +13,11 @@ type Widget struct {
|
|||||||
calEvents []*CalEvent
|
calEvents []*CalEvent
|
||||||
ch chan struct{}
|
ch chan struct{}
|
||||||
mutex sync.Mutex
|
mutex sync.Mutex
|
||||||
app *tview.Application
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWidget(app *tview.Application) *Widget {
|
func NewWidget() *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: wtf.NewTextWidget(" Calendar ", "gcal", true),
|
TextWidget: wtf.NewTextWidget(" Calendar ", "gcal", false),
|
||||||
app: app,
|
|
||||||
ch: make(chan struct{}),
|
ch: make(chan struct{}),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +34,7 @@ func (widget *Widget) Disable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
calEvents, err := Fetch(CreateCodeInputDialog(" Calendar ", widget))
|
calEvents, err := Fetch()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
widget.calEvents = []*CalEvent{}
|
widget.calEvents = []*CalEvent{}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user