Skip to content

Commit

Permalink
Refactor GCal calendar code to simplify things
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Cummer committed Jul 12, 2018
1 parent 279822f commit 7086992
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions gcal/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"sync"
"time"

"github.com/rivo/tview"
"github.com/senorprogrammer/wtf/wtf"
)

Expand All @@ -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{}),
}

Expand All @@ -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 {
Expand Down

0 comments on commit 7086992

Please sign in to comment.