Beispiel #1
0
// NewRenderedSVG create a new SVG image renderer.
//
func NewRenderedSVG(app cdtype.RenderSimple, typ string) (RendererMail, error) {
	size := strings.Split(string(typ), " ")[0]

	source, e := ioutil.ReadFile(app.FileLocation("img", size+".svg"))
	if e != nil {
		return NewRenderedNone(), e
	}

	rs := &RenderedSVG{
		RenderSimple: app,
		pathDefault:  app.FileLocation("img", "gmail-icon.svg"),
		// pathTemp:   app.FileLocation("img", "temp.svg"),
		pathError:  app.FileLocation("img", "gmail-error-"+size+".svg"),
		iconSource: string(source),
	}

	f, et := ioutil.TempFile("", "cairo-dock-gogmail-icon-") // Need to create a new temp file
	if et != nil {
		return NewRenderedNone(), e
	}

	rs.pathTemp = f.Name()
	f.Close()
	// TODO: remove tempfile.

	return rs, nil
}
Beispiel #2
0
// NewRenderedQuick create a new text renderer for quick-info.
//
func NewRenderedQuick(app cdtype.RenderSimple) *RenderedQuick {
	return &RenderedQuick{
		RenderSimple: app,
		pathDefault:  app.FileLocation("img", "gmail-icon.svg"),
	}
}