Documentation ¶
Overview ¶
Package build builds cairo-dock or applets from sources.
Index ¶
- Constants
- Variables
- func Init(log cdtype.Logger, file string, e error)
- func ProcessUptime() (time.Time, error)
- func ProcessUptimeToSeconds(t time.Time) int
- type Builder
- type BuilderApplets
- type BuilderBase
- type BuilderCompiled
- type BuilderCore
- type BuilderGodock
- type BuilderInternal
- type BuilderNull
- type BuilderProgress
- type Config
- type Counter
- type SourceType
Constants ¶
const ( // GroupHidden defines a group that should be hidden. GroupHidden = "Hidden" // TODO move to config as common )
Variables ¶
var ( // IconMissing defines the optional path to the default icon package emblem. // IconMissing string // CmdSudo defines the command used to get root access for installation. // CmdSudo = "gksudo" )
var ( // AppletInfo returns an applet location and icon. // AppletInfo func(cdtype.Logger, string) (dir, icon string) // AppletRestart restarts an applet. // AppletRestart func(name string) CloseGui = func() {} )
Set by the dock or external backend.
Functions ¶
func ProcessUptime ¶
ProcessUptime returns the time when the process started.
func ProcessUptimeToSeconds ¶
ProcessUptimeToSeconds converts a ProcessUptime to a number of seconds.
Types ¶
type Builder ¶
type Builder interface { Label() string Icon() string Build() error SourceDir() string SetProgress(func(float64)) // Need values between 0 and 1 in the renderer. Progress(float64) SetIcon(icon string) SetDir(dir string) }
Builder defines the common builder interface.
func NewBuilder ¶
func NewBuilder(target SourceType, name string, log cdtype.Logger) Builder
NewBuilder creates the target renderer/builder. The name is mandatory for a single applet (internal or not).
type BuilderApplets ¶
type BuilderApplets struct { BuilderBase BuilderProgress MakeFlags string }
BuilderApplets builds all Cairo-Dock plug-ins.
func (*BuilderApplets) Build ¶
func (build *BuilderApplets) Build() error
Build builds the source code.
func (*BuilderApplets) Icon ¶
func (build *BuilderApplets) Icon() string
Icon returns the icon name (or path) of the builder.
func (*BuilderApplets) Label ¶
func (build *BuilderApplets) Label() string
Label returns the builder label.
type BuilderBase ¶
type BuilderBase struct {
// contains filtered or unexported fields
}
BuilderBase provides basic informations about a build.
func (*BuilderBase) Icon ¶
func (build *BuilderBase) Icon() string
Icon returns the icon name (or path) of the builder.
func (*BuilderBase) SetDir ¶
func (build *BuilderBase) SetDir(dir string)
SetDir sets the source path for the builder.
func (*BuilderBase) SetIcon ¶
func (build *BuilderBase) SetIcon(icon string)
SetIcon sets the icon name (or path) for the builder.
func (*BuilderBase) SetLogger ¶
func (build *BuilderBase) SetLogger(log cdtype.Logger)
SetLogger sets the builder logger.
func (*BuilderBase) SourceDir ¶
func (build *BuilderBase) SourceDir() string
SourceDir returns the source path of the builder.
type BuilderCompiled ¶
type BuilderCompiled struct { BuilderBase BuilderProgress Module string }
BuilderCompiled builds external applet that must be compiled (golang or vala). A Makefile with default build will have to be provided in each applet dir.
func (*BuilderCompiled) Build ¶
func (build *BuilderCompiled) Build() error
Build builds the source code.
func (*BuilderCompiled) Label ¶
func (build *BuilderCompiled) Label() string
Label returns the builder label.
type BuilderCore ¶
type BuilderCore struct { BuilderBase BuilderProgress MakeFlags string }
BuilderCore builds the dock core sources.
func (*BuilderCore) Icon ¶
func (build *BuilderCore) Icon() string
Icon returns the icon name (or path) of the builder.
func (*BuilderCore) Label ¶
func (build *BuilderCore) Label() string
Label returns the builder label.
type BuilderGodock ¶
type BuilderGodock struct { BuilderBase BuilderProgress MakeFlags string }
BuilderGodock builds the new go dock version.
func (*BuilderGodock) Build ¶
func (build *BuilderGodock) Build() error
Build builds the source code.
func (*BuilderGodock) Icon ¶
func (build *BuilderGodock) Icon() string
Icon returns the icon name (or path) of the builder.
func (*BuilderGodock) Label ¶
func (build *BuilderGodock) Label() string
Label returns the builder label.
func (BuilderGodock) SourceDir ¶
func (build BuilderGodock) SourceDir() string
SourceDir returns the source path of the builder.
type BuilderInternal ¶
type BuilderInternal struct { BuilderBase BuilderProgress Module string }
BuilderInternal builds a Cairo-Dock internal applet. As C applet are provided by the plug-ins package, they are only available after the plug-ins build has been done at least once.
func (*BuilderInternal) Build ¶
func (build *BuilderInternal) Build() error
Build builds the source code.
func (*BuilderInternal) Label ¶
func (build *BuilderInternal) Label() string
Label returns the builder label.
type BuilderNull ¶
type BuilderNull struct { BuilderBase BuilderProgress }
BuilderNull is an empty Build for fallback.
func (*BuilderNull) Icon ¶
func (build *BuilderNull) Icon() string
Icon returns the icon name (or path) of the builder.
func (*BuilderNull) Label ¶
func (build *BuilderNull) Label() string
Label returns the builder label.
func (*BuilderNull) SourceDir ¶
func (build *BuilderNull) SourceDir() string
SourceDir returns the source path of the builder.
type BuilderProgress ¶
type BuilderProgress struct {
// contains filtered or unexported fields
}
BuilderProgress provides a callback handler for Builders.
func (*BuilderProgress) Progress ¶
func (build *BuilderProgress) Progress(data float64)
Progress forwards data to the provided callback.
func (*BuilderProgress) SetProgress ¶
func (build *BuilderProgress) SetProgress(f func(float64))
SetProgress sets the callback to forward progress data.
type Config ¶
type Config struct { Counter map[string]Counter `conf:"-"` CounterDB []byte TotalUptime int // in seconds File string `conf:"-"` // File location, not saved. // contains filtered or unexported fields }
Config defines the options the user can set about the GUI itself. This GUI config page will often be referred as "own config".
var Current Config
Current is the user build config live settings (what is currently active).
func (*Config) IncreaseCounter ¶
IncreaseCounter updates the build counter with a new success or fail.
func (*Config) IncreaseCrash ¶
IncreaseCrash increase the crash counter for the day.
func (*Config) IncreaseUptime ¶
IncreaseUptime updates the uptime counter with the current process uptime. Use on program close.
type SourceType ¶
type SourceType int
SourceType defines the type of a builder.
const ( TypeNull SourceType = iota // Do nothing. TypeCore // Dock core. TypeApplets // Dock all internal applets (C). TypeAppletInternal // Dock one internal applet (C). TypeAppletScript // Dock one external applet script (bash, python, ruby). TypeAppletCompiled // Dock one external applet compiled (go, mono, vala). TypeGodock // New dock. )
Applets build types.
func GetSourceType ¶
func GetSourceType(name string, log cdtype.Logger) SourceType
GetSourceType try to detect an applet type based on its location and content. Could be improved.