godock: github.com/sqp/godock/services/GoGmail Index | Files

package GoGmail

import "github.com/sqp/godock/services/GoGmail"

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

Index

Package Files

GoGmail.go config.go mail.go

Constants

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

Renderers.

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.

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.

func NewApplet Uses

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

NewApplet creates a new applet instance.

type Applet Uses

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

Applet defines a dock applet.

func (*Applet) Init Uses

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

Init load user configuration if needed and initialise applet.

type Email Uses

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 Uses

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 Uses

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

NewFeed create a new Gmail inbox feed.

func (*Feed) Check Uses

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 Uses

func (feed *Feed) Clear()

Clear reset the mail list.

func (*Feed) Count Uses

func (feed *Feed) Count() int

Count return the number of unread mails.

func (*Feed) IsValid Uses

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 Uses

func (feed *Feed) LoadLogin(filename string)

LoadLogin get user login information from file.

func (*Feed) SaveLogin Uses

func (feed *Feed) SaveLogin(login string)

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

type Mailbox Uses

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 Uses

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 Uses

func NewRenderedNone() *RenderedNone

NewRenderedNone create a new null renderer.

func (*RenderedNone) Error Uses

func (rs *RenderedNone) Error(e error)

Error display.

func (*RenderedNone) Set Uses

func (rs *RenderedNone) Set(count int)

Set counter value.

type RenderedQuick Uses

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 Uses

func NewRenderedQuick(app cdtype.RenderSimple) *RenderedQuick

NewRenderedQuick create a new text renderer for quick-info.

func (*RenderedQuick) Error Uses

func (rs *RenderedQuick) Error(e error)

Error display.

func (*RenderedQuick) Set Uses

func (rs *RenderedQuick) Set(count int)

Set counter value.

type RenderedSVG Uses

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 Uses

func (rs *RenderedSVG) Error(e error)

Error display.

func (*RenderedSVG) Set Uses

func (rs *RenderedSVG) Set(count int)

Set counter value.

type RendererMail Uses

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 Uses

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

NewRenderedSVG create a new SVG image renderer.

Package GoGmail imports 12 packages (graph) and is imported by 1 packages. Updated 2017-11-25. Refresh now. Tools for package owners.