GoGmail

package
v0.0.0-...-0caaa62 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2017 License: GPL-3.0-or-later Imports: 12 Imported by: 0

Documentation

Overview

Package GoGmail is a mail checker applet for Cairo-Dock.

Index

Constants

View Source
const (
	NoDisplay   = "no"
	QuickInfo   = "quickinfo"
	EmblemSmall = "small emblem"
	EmblemLarge = "large emblem"
)

Renderers.

View Source
const (
	MailClientLocation = iota // Open mail client as location, with cdglobal.CmdOpen.
	MailClientProgram         // Open mail client as command.
	MailClientMonitor         // Open mail client as command and monitor it.
)

Mail client action settings.

View Source
const (
	ActionNone = iota
	ActionOpenClient
	ActionShowMails
	ActionCheckMail
	ActionRegister
)

List of actions defined in this applet. Actions order in this list must match the order in defineActions. The reference in shortkey declaration must also match.

Variables

This section is empty.

Functions

func NewApplet

func NewApplet(base cdtype.AppBase, events *cdtype.Events) cdtype.AppInstance

NewApplet creates a new applet instance.

Types

type Applet

type Applet struct {
	cdtype.AppBase // Applet base and dock connection.
	// contains filtered or unexported fields
}

Applet defines a dock applet.

func (*Applet) Init

func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool)

Init load user configuration if needed and initialise applet.

type Email

type Email struct {
	Title       string `xml:"title"`
	Summary     string `xml:"summary"`
	Modified    string `xml:"modified"`
	Issued      string `xml:"issued"`
	AuthorName  string `xml:"author>name"`
	AuthorEmail string `xml:"author>email"`
}

Email is a single email data. Disabled fields are just examples of what is supposed to be parsed if you want to use them.

type Feed

type Feed struct {
	Title   string `xml:"title"`
	Tagline string `xml:"tagline"`
	Total   int    `xml:"fullcount"`
	//~ Link  string   `xml:"href,attr"`
	//~ Modified string   `xml:"modified"`
	Mail []*Email `xml:"entry"`

	// Display fields.
	New      int
	Plural   bool
	MailsNew []*Email
	// contains filtered or unexported fields
}

Feed contains Gmail inbox data. Some fields are disabled because they are unused. They could be enabled simply by uncommenting them.

func NewFeed

func NewFeed(onResult func(int, bool, error)) *Feed

NewFeed create a new Gmail inbox feed.

func (*Feed) Check

func (feed *Feed) Check()

Check callback for poller mail checking. Launch the check mail action. Check for new mails and launch the result callback with the mails count delta (change since last check).

func (*Feed) Clear

func (feed *Feed) Clear()

Clear reset the mail list.

func (*Feed) Count

func (feed *Feed) Count() int

Count return the number of unread mails.

func (*Feed) IsValid

func (feed *Feed) IsValid() bool

IsValid return true is user informations were provided. Only tells if login and password were submitted, not if they are valid.

func (*Feed) LoadLogin

func (feed *Feed) LoadLogin(filename string)

LoadLogin get user login information from file.

func (*Feed) SaveLogin

func (feed *Feed) SaveLogin(login string)

SaveLogin login informations to file with the same format as the Gmail applet.

type Mailbox

type Mailbox interface {
	// Timer management.
	Check()

	// Mail management.
	IsValid() bool
	Count() (nbInbox int)
	Clear()
	LoadLogin(filepath string)
	SaveLogin(login string)
}

Mailbox is a mail client interface.

type RenderedNone

type RenderedNone struct{}

RenderedNone is a stub. Used for the none choice and as a fallback for SVG renderer if it failed to load its data.

func NewRenderedNone

func NewRenderedNone() *RenderedNone

NewRenderedNone create a new null renderer.

func (*RenderedNone) Error

func (rs *RenderedNone) Error(e error)

Error display.

func (*RenderedNone) Set

func (rs *RenderedNone) Set(count int)

Set counter value.

type RenderedQuick

type RenderedQuick struct {
	cdtype.RenderSimple // Controler to the Cairo-Dock icon.
	// contains filtered or unexported fields
}

RenderedQuick displays mail count on the icon QuickInfo.

func NewRenderedQuick

func NewRenderedQuick(app cdtype.RenderSimple) *RenderedQuick

NewRenderedQuick create a new text renderer for quick-info.

func (*RenderedQuick) Error

func (rs *RenderedQuick) Error(e error)

Error display.

func (*RenderedQuick) Set

func (rs *RenderedQuick) Set(count int)

Set counter value.

type RenderedSVG

type RenderedSVG struct {
	cdtype.RenderSimple // Controler to the Cairo-Dock icon.
	// contains filtered or unexported fields
}

RenderedSVG displays mail count in a hacked svg icon. The icon is rewritten with the new value on every change. In case of file loading problem, a new RenderedNone will be returned, so a valid renderer will always be provided.

func (*RenderedSVG) Error

func (rs *RenderedSVG) Error(e error)

Error display.

func (*RenderedSVG) Set

func (rs *RenderedSVG) Set(count int)

Set counter value.

type RendererMail

type RendererMail interface {
	Set(count int) // Set new value.
	Error(e error) // Set error.
}

RendererMail is a display interface to show inbox mail count on the icon.

func NewRenderedSVG

func NewRenderedSVG(app cdtype.RenderSimple, typ string) (RendererMail, error)

NewRenderedSVG create a new SVG image renderer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL