Documentation ¶
Index ¶
- Constants
- type BaseStorage
- type Builder
- type Grouper
- type GtkWidgetBase
- type Key
- func (key *Key) AdditionalItemsVBox() *gtk.Box
- func (key *Key) IsType(types ...KeyType) bool
- func (key *Key) KeyBox() *gtk.Box
- func (key *Key) Label() *gtk.Label
- func (key *Key) MakeWidget() func()
- func (key *Key) PackKeyWidget(getValue func() interface{}, setValue func(interface{}), childs ...gtk.IWidget)
- func (key *Key) PackSubWidget(child gtk.IWidget)
- func (key *Key) SetAdditionalItemsVBox(box *gtk.Box)
- func (key *Key) SetBuilder(build Builder) *Key
- func (key *Key) SetKeyBox(box *gtk.Box)
- func (key *Key) SetLabel(label *gtk.Label)
- func (key *Key) SetMakeWidget(call func(*Key))
- func (key *Key) SetWidGetValue(getValue func() interface{})
- func (key *Key) SetWidSetValue(setValue func(interface{}))
- func (key *Key) SetWidgetBox(box *gtk.Box)
- func (key *Key) UpdateStorage()
- func (key *Key) Value() valuer.Valuer
- func (key *Key) ValueGet(val interface{}) error
- func (key *Key) ValueSet(val interface{}) error
- func (key *Key) ValueState(previous valuer.Valuer) ValueStateList
- func (key *Key) WidgetBox() *gtk.Box
- type KeyType
- type ListKey
- type Source
- type Storage
- type ValueState
- type ValueStateField
- type ValueStateList
- type WinLike
Constants ¶
const ( MarginGUI = 4 MarginIcon = 6 DefaultTextColor = "153,153,153,255" // RGBA light grey )
Display constants.
const ( UserIconLauncher = iota UserIconStack UserIconSeparator )
Dock icon types.
const ( FlagCairoOnly = '*' FlagOpenGLOnly = '&' )
Modifier to show a widget according to the display backend. Unused here, kept for reference. See libs/config.
const DesktopEntry = "Desktop Entry"
DesktopEntry defines the group name for launchers.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseStorage ¶
type BaseStorage struct { File string // path to active config file. Default string // path to default config file. Build Builder }
BaseStorage provides a common base for Storage.
func (*BaseStorage) FileDefault ¶
func (conf *BaseStorage) FileDefault() string
FileDefault returns the path to the config file.
func (*BaseStorage) FilePath ¶
func (conf *BaseStorage) FilePath() string
FilePath returns the path to the config file.
func (*BaseStorage) SetBuilder ¶
func (conf *BaseStorage) SetBuilder(build Builder)
SetBuilder sets the storage builder.
type Builder ¶
type Builder interface { //-------------------------------------------------[ INTERNAL INTERFACES ]-- // // Storage gives access to the builder storage. // Storage() Storage // Storage gives access to the dock source. // Source() Source // Log gives access to the builder logger. // Log() cdtype.Logger //--------------------------------------------------------------[ COMMON ]-- // // Save updates the configuration file with user changes. // Save() // SetPostSave sets a post save call, triggered after successful real saves. // SetPostSave(func()) // Translate translates the given string using the builder domain. // Translate(str string) string // Free frees the builder internal pointers (cyclic references). // // Already called by the Grouper, but mandatory for other customs. // Free() //---------------------------------------------------------------[ BUILD ]-- // // AddGroup adds a group with optional keys. // AddGroup(group string, keys ...*Key) // AddKeys adds one or many keys to an existing group. // AddKeys(group string, keys ...*Key) // Groups lists the configured build groups. // Groups() []string // BuildPage builds a Cairo-Dock configuration page for the given group. // BuildPage(group string) GtkWidgetBase //-----------------------------------------------------[ KEYS INTERACTION]-- // // KeyAction acts on a key if found. Key access errors will just be logged. // KeyAction(group, name string, action func(*Key)) bool // KeyWalk runs the given call on all keys in the group and key build order. // KeyWalk(call func(*Key)) // KeyBool returns the key value as boolean. // KeyBool(group, name string) (val bool) // KeyInt returns the key value as int. // KeyInt(group, name string) (val int) // KeyFloat returns the key value as float64. // KeyFloat(group, name string) (val float64) // KeyString returns the key value as string. // KeyString(group, name string) (val string) //------------------------------------------------------[ WIDGET PACKING ]-- //--- Widget packing for custom and internal widgets use. // // PackWidget packs a widget in the page main box. // PackWidget(child gtk.IWidget, expand, fill bool, padding uint) BoxPage() *gtk.Box SetFrame(*gtk.Frame) SetFrameBox(*gtk.Box) SetNbControlled(nb int) //-----------------------------------------------------[ FROM GTK WIDGET ]-- // GtkWidgetBase Connect(string, interface{}, ...interface{}) (glib.SignalHandle, error) Remove(gtk.IWidget) PackStart(gtk.IWidget, bool, bool, uint) }
Builder builds a Cairo-Dock configuration page.
type Grouper ¶
type Grouper interface { Builder // Extends the Builder. // BuildSingle builds a single page config for the given group. // BuildSingle(group string, tweaks ...func(Builder)) Grouper // BuildAll builds a dock configuration widget with all groups. // BuildAll(switcher *pageswitch.Switcher, tweaks ...func(Builder)) Grouper // BuildGroups builds a dock configuration widget with the given groups. // BuildGroups(switcher *pageswitch.Switcher, groups []string, tweaks ...func(Builder)) Grouper // BuildApply applies a list of custom updates to the builder and its keys. // BuildApply(...func(Builder)) Grouper }
Grouper builds config pages from the Builder.
Custom tweaks can be applied on loaded keys before the build.
When adding keys manually, ensure you use AddGroup/AddKeys, or set the storage access fields if you need widgets that use them.
cftype.Key....NewKey(build, group, name, label) build.NewKey...(group, name, ...)
type GtkWidgetBase ¶
GtkWidgetBase extends the gtk.IWidget interface with widgets methods.
type Key ¶
type Key struct { Builder // extend the builder for widget building needs. config.KeyBase // Key options parsed from comment. Type KeyType // Type of key, for the value type, build method and options. Group string // Group for the key. Match the config group and switcher page. Name string // Name for the key. Match the config name. IsDefault bool // true when a default text has been set (must be ignored). Match "ignore-value" in the C version. // contains filtered or unexported fields }
Key defines a configuration entry.
func (*Key) AdditionalItemsVBox ¶
AdditionalItemsVBox gets the box for extra custom widgets.
func (*Key) MakeWidget ¶
func (key *Key) MakeWidget() func()
MakeWidget returns the custom make widget call for the key if set.
func (*Key) PackKeyWidget ¶
func (key *Key) PackKeyWidget(getValue func() interface{}, setValue func(interface{}), childs ...gtk.IWidget)
PackKeyWidget packs a key widget to the page with its getValue call (was _pack_subwidget).
func (*Key) PackSubWidget ¶
PackSubWidget packs a widget in the current subwidget box. (was _pack_in_widget_box)
func (*Key) SetAdditionalItemsVBox ¶
SetAdditionalItemsVBox sets the box for extra custom widgets.
func (*Key) SetBuilder ¶
SetBuilder sets the key builder. Mandatory if not using AddGroup or AddKeys.
func (*Key) SetMakeWidget ¶
SetMakeWidget sets a custom MakeWidget call for the key.
func (*Key) SetWidGetValue ¶
func (key *Key) SetWidGetValue(getValue func() interface{})
SetWidGetValue sets the get value to the widget callback.
func (*Key) SetWidSetValue ¶
func (key *Key) SetWidSetValue(setValue func(interface{}))
SetWidSetValue sets the set value to the widget callback.
func (*Key) SetWidgetBox ¶
SetWidgetBox sets the sub widget box for the key.
func (*Key) UpdateStorage ¶
func (key *Key) UpdateStorage()
UpdateStorage updates the storage with values from the widget.
func (*Key) Value ¶
Value returns an interface to the key value.
Before the build, the storage value will be used. After the build, the widget value will be used.
func (*Key) ValueGet ¶
ValueGet gets the key value.
A pointer to the value must be used to allow the value to be assigned.
Before the build, the storage value will be used. After the build, the widget value will be used.
func (*Key) ValueSet ¶
ValueSet sets the key value.
Before the build, the value will be set to the storage. After the build, the value will be set to the widget.
Values will be copied from the widget to the storage with UpdateStorage. The file will only be updated with build.Save (which calls UpdateStorage).
func (*Key) ValueState ¶
func (key *Key) ValueState(previous valuer.Valuer) ValueStateList
ValueState starts the comparison between old and new values. Only compares the presence or absence of values, not the content.
type KeyType ¶
type KeyType byte
KeyType defines the type for a key and its widget.
const ( KeyTextLabel KeyType = '>' // a simple text label. KeyLink KeyType = 'W' // a simple text label. KeySeparator KeyType = 'v' // an horizontal separator. KeyFrame KeyType = 'F' // a frame. The previous frame will be closed. KeyExpander KeyType = 'X' // a frame inside an expander. The previous frame will be closed. KeyEmptyWidget KeyType = '_' // an empty GtkContainer, in case you need to build custom widgets. KeyEmptyFull KeyType = '<' // an empty GtkContainer, the same but using full available space. KeyBoolButton KeyType = 'b' // boolean in a button to tick. KeyBoolCtrl KeyType = 'B' // boolean in a button to tick, that will control the sensitivity of the next widget. KeyIntSpin KeyType = 'i' // integer in a spin button. KeyIntScale KeyType = 'I' // integer in an horizontal scale. KeyIntSize KeyType = 'j' // pair of integer spin for size WidthxHeight. KeyFloatSpin KeyType = 'f' // double in a spin button. KeyFloatScale KeyType = 'e' // double in an horizontal scale. KeyColorSelectorRGB KeyType = 'c' // 3 doubles with a color selector (RGB). KeyColorSelectorRGBA KeyType = 'C' // 4 doubles with a color selector (RGBA). KeyStringEntry KeyType = 's' // a text entry. KeyPasswordEntry KeyType = 'p' // a text entry, where text is hidden and the result is encrypted in the .conf file. KeyFileSelector KeyType = 'S' // a text entry with a file selector. KeyImageSelector KeyType = 'g' // a text entry with a file selector, files are filtered to only display images. KeyFolderSelector KeyType = 'D' // a text entry with a folder selector. KeySoundSelector KeyType = 'u' // a text entry with a file selector and a 'play' button, for sound files. KeyShortkeySelector KeyType = 'k' // a text entry with a shortkey selector. KeyClassSelector KeyType = 'K' // a text entry with a class selector. KeyFontSelector KeyType = 'P' // a font selector button. KeyListSimple KeyType = 'L' // a text list. KeyListEntry KeyType = 'E' // a combo-entry, that is to say a list where one can add a custom choice. KeyListNumbered KeyType = 'l' // a combo where the number of the line is used for the choice. KeyListNbCtrlSimple KeyType = 'y' // a combo where the number of the line is used for the choice, and for controlling the sensitivity of the widgets below. KeyListNbCtrlSelect KeyType = 'Y' // a combo where the number of the line is used for the choice, and for controlling the sensitivity of the widgets below; controlled widgets are indicated in the list : {entry;index first widget;nb widgets}. KeyTreeViewSortSimple KeyType = 'T' // a tree view, where lines are numbered and can be moved up and down. KeyTreeViewSortModify KeyType = 'U' // a tree view, where lines can be added, removed, and moved up and down. KeyTreeViewMultiChoice KeyType = 'V' // a tree view, where lines are numbered and can be selected or not. KeyLaunchCmdSimple KeyType = 'Z' // a button to launch a specific command. KeyLaunchCmdIf KeyType = 'G' // a button to launch a specific command with a condition. KeyListViews KeyType = 'n' // list of available views. KeyListAnimation KeyType = 'a' // list of available animations. KeyListDialogDecorator KeyType = 't' // list of available dialog decorators. KeyListDeskletDecoSimple KeyType = 'O' // list of available desklet decorations. KeyListDeskletDecoDefault KeyType = 'o' // same but with the 'default' choice too. KeyListThemeApplet KeyType = 'h' // list of themes in a combo, with preview and readme (gauges, sound...). KeyListThemeDesktopIcon KeyType = 'w' // list of installed icon themes. KeyListDocks KeyType = 'd' // list of existing docks. KeyListIconsMainDock KeyType = 'N' // list of icons in the maindock. KeyListScreens KeyType = 'r' // list of screens KeyHandbook KeyType = 'A' // a label containing the handbook of the applet. KeyJumpToModuleSimple KeyType = 'm' // a button to jump to another module inside the config panel. KeyJumpToModuleIfExists KeyType = 'M' // same but only if the module exists. )
Dock buildable widgets list. Unused (HJQRqxz)
type Storage ¶
type Storage interface { SetBuilder(build Builder) FilePath() string FileDefault() string GetGroups() (uint64, []string) List(group string) []*Key ToData() (uint64, string, error) // Get data. // Valuer(group, name string) valuer.Valuer // Current value. Default(group, name string) (valuer.Valuer, error) // Default value. Get(group, key string, value interface{}) error Int(group, key string) (int, error) Bool(group, key string) (bool, error) Float(group, key string) (float64, error) String(group, key string) (string, error) ListInt(group, key string) (list []int, e error) ListBool(group, key string) (list []bool, e error) ListFloat(group, key string) (list []float64, e error) ListString(group, key string) (list []string, e error) // Set data. Only one method. // Set(group, key string, value interface{}) error }
Storage defines the storage access format.
type ValueState ¶
type ValueState int
ValueState defines the update status of the key values.
const ( StateBothEmpty ValueState = iota StateAdded // Value added to new. StateRemoved // Value removed from new. StateUnchanged // Same values. StateEdited // Different values. )
List of value status.
type ValueStateField ¶
type ValueStateField struct { State ValueState Old string New string }
ValueStateField represents a value comparison for the field.
type ValueStateList ¶
type ValueStateList []ValueStateField
ValueStateList defines a list of ValueStateField.
func (ValueStateList) IsChanged ¶
func (list ValueStateList) IsChanged() bool
IsChanged returns whether the value has changed.
type WinLike ¶
type WinLike interface { Connect(string, interface{}, ...interface{}) (glib.SignalHandle, error) HandlerDisconnect(glib.SignalHandle) HasFocus() bool Present() Destroy() }
WinLike defines actions available on the window.