Skip to content

Commit

Permalink
Move GCal item check closer to point of impact
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Cummer committed Jun 20, 2018
1 parent 37bf942 commit 9eabbd1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions gcal/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func (widget *Widget) Disable() {
/* -------------------- Unexported Functions -------------------- */

func (widget *Widget) display() {
if widget.events == nil || len(widget.events.Items) == 0 {
return
}

widget.mutex.Lock()
defer widget.mutex.Unlock()
widget.View.SetText(fmt.Sprintf("%s", widget.contentFrom(widget.events)))
Expand Down Expand Up @@ -287,9 +291,7 @@ outer:
for {
select {
case <-tick.C:
if widget.events != nil && len(widget.events.Items) > 0 {
widget.display()
}
widget.display()
case <-widget.ch:
break outer
}
Expand Down

0 comments on commit 9eabbd1

Please sign in to comment.