1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Removed a bunch of common boilerplate code from widget initialization

This commit is contained in:
Chris Cummer
2018-04-15 13:05:28 -07:00
committed by Chris Cummer
parent d812986abc
commit 693a04b5e1
14 changed files with 173 additions and 160 deletions

View File

@@ -5,9 +5,7 @@ import (
"strings"
"time"
"github.com/gdamore/tcell"
"github.com/olebedev/config"
"github.com/rivo/tview"
"github.com/senorprogrammer/wtf/wtf"
"google.golang.org/api/calendar/v3"
)
@@ -23,8 +21,6 @@ func NewWidget() *Widget {
TextWidget: wtf.NewTextWidget(" 🍿 Calendar ", "gcal"),
}
widget.addView()
return &widget
}
@@ -45,18 +41,6 @@ func (widget *Widget) Refresh() {
/* -------------------- Unexported Functions -------------------- */
func (widget *Widget) addView() {
view := tview.NewTextView()
view.SetBorder(true)
view.SetBorderColor(tcell.ColorGrey)
view.SetDynamicColors(true)
view.SetTitle(widget.Name)
view.SetWrap(false)
widget.View = view
}
func (widget *Widget) contentFrom(events *calendar.Events) string {
if events == nil {
return ""