datatype

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: 10 Imported by: 0

Documentation

Overview

Package datatype defines the data source format for the config.

Index

Constants

View Source
const (
	// KeyMainDock is the key name of the first main dock (the one with the taskbar).
	//
	KeyMainDock = "_MainDock_"

	// KeyNewDock is the key name for a new dock to create.
	//
	KeyNewDock = "_New Dock_"
)
View Source
const (
	// GroupServices is the key name for the services group.
	//
	GroupServices = "_services_"

	// TitleServices is the displayed name for the services group (translatable).
	//
	TitleServices = "Services"

	// GroupDesklets is the key name for the desklets group.
	//
	GroupDesklets = "Desklets"

	// TitleDesklets is the displayed name for the desklets group (translatable).
	//
	TitleDesklets = "Desklets"

	// FieldTaskBar is the key name for the taskbar field.
	//
	FieldTaskBar = "TaskBar"

	// TitleTaskBar is the displayed name for the taskbar field (translatable).
	//
	TitleTaskBar = "--[ Taskbar ]--"
)

Custom config groups for the Icons GUI.

View Source
const (
	// DirIconsSystem is the location of desktop icons themes installed on the system.
	//
	DirIconsSystem = "/usr/share/icons"

	// DirIconsUser is the name of desktop icons themes dir in the user home dir.
	//
	DirIconsUser = ".icons" // in $HOME
)

Icons locations.

Variables

This section is empty.

Functions

func IndexHandbooksKeys

func IndexHandbooksKeys(books map[string]Handbooker) (list []string)

IndexHandbooksKeys returns the list of row keys in an index of handbooks.

func ListFieldsIDByName

func ListFieldsIDByName(fields []Field, key string, log cdtype.Logger) int

ListFieldsIDByName searches the list of fields for the matching key. Returns the position of the field in the list. Returns 0 if not found, to have a valid entry to select.

func ListFieldsKeys

func ListFieldsKeys(fields []Field) []string

ListFieldsKeys returns the list of row keys in a list of fields.

func ListFieldsSortByName

func ListFieldsSortByName(fields []Field)

ListFieldsSortByName sorts the list of fields by their readable name.

func ListHandbooksKeys

func ListHandbooksKeys(books []Handbooker) []string

ListHandbooksKeys returns the list of row keys in a list of handbooks.

Types

type Appleter

type Appleter interface {

	// Icon() string
	IsInstalled() bool
	Install(options string) error
	Uninstall() error
	CanUninstall() bool
	IsActive() bool
	Activate() string
	Deactivate()
	CanAdd() bool

	GetTitle() string // module name translated for the user.
	GetName() string  // module name used as key.
	GetAuthor() string
	GetDescription() string
	GetPreviewFilePath() string
	GetIconFilePath() string
	IconState() string
	FormatState() string
	FormatSize() string
	FormatCategory() string
	Dir() string
}

Appleter defines the interface needed by applets provided as config source.

type DesktopClassNil

type DesktopClassNil struct{}

DesktopClassNil provides an empty DesktopClasser.

func (DesktopClassNil) Command

func (DesktopClassNil) Command() string

Command is unused.

func (DesktopClassNil) Icon

func (DesktopClassNil) Icon() string

Icon is unused.

func (DesktopClassNil) MenuItems

func (DesktopClassNil) MenuItems() [][]string

MenuItems is unused.

func (DesktopClassNil) Name

func (DesktopClassNil) Name() string

Name is unused.

func (DesktopClassNil) String

func (DesktopClassNil) String() string

String is unused.

type DesktopClasser

type DesktopClasser interface {
	// String returns the desktop class as a string.
	//
	String() string

	// Name returns the desktop class application name.
	//
	Name() string

	// Command returns the desktop class command.
	//
	Command() string

	// Icon returns the desktop class icon.
	//
	Icon() string

	// MenuItems returns the list of extra commands for the class, by packs of 3
	// strings: Name, Command, Icon.
	//
	MenuItems() [][]string
}

DesktopClasser defines methods to get informations about a desktop class.

type Field

type Field struct {
	Conf string
	Key  string
	Name string
	Icon string
}

Field defines a simple data field for dock queries.

func IndexHandbooksToFields

func IndexHandbooksToFields(in map[string]Handbooker) (fields []Field)

IndexHandbooksToFields converts an index of handbooks to a list of fields.

type HandbookDescDisk

type HandbookDescDisk struct{ Handbooker }

HandbookDescDisk improves Handbooker to read the description from disk, using the current description value as source path.

func (*HandbookDescDisk) GetDescription

func (dv *HandbookDescDisk) GetDescription() string

GetDescription returns the book icon name or path.

type HandbookDescSplit

type HandbookDescSplit struct{ Handbooker }

HandbookDescSplit improves Handbooker by replacing \n to EOL in description.

func (*HandbookDescSplit) GetDescription

func (dv *HandbookDescSplit) GetDescription() string

GetDescription returns the book description.

type HandbookSimple

type HandbookSimple struct {
	Key         string
	Title       string
	Author      string
	Description string
	Preview     string
}

HandbookSimple provides a simple Handbooker.

func (*HandbookSimple) GetAuthor

func (hs *HandbookSimple) GetAuthor() string

GetAuthor returns the book author.

func (*HandbookSimple) GetDescription

func (hs *HandbookSimple) GetDescription() string

GetDescription returns the book description.

func (*HandbookSimple) GetGettextDomain

func (hs *HandbookSimple) GetGettextDomain() string

GetGettextDomain is unused.

func (*HandbookSimple) GetModuleVersion

func (hs *HandbookSimple) GetModuleVersion() string

GetModuleVersion is unused.

func (*HandbookSimple) GetName

func (hs *HandbookSimple) GetName() string

GetName returns the book key.

func (*HandbookSimple) GetPreviewFilePath

func (hs *HandbookSimple) GetPreviewFilePath() string

GetPreviewFilePath returns the book preview path.

func (*HandbookSimple) GetTitle

func (hs *HandbookSimple) GetTitle() string

GetTitle returns the book readable name.

type Handbooker

type Handbooker interface {
	// GetName returns the book key.
	//
	GetName() string // name will be used as key.

	// GetTitle returns the book readable name.
	//
	GetTitle() string

	// GetAuthor returns the book author.
	//
	GetAuthor() string

	// GetDescription returns the book description.
	//
	GetDescription() string

	// GetDescription returns the book icon name or path.
	//
	GetPreviewFilePath() string

	// GetDescription returns the book gettext domain for translations.
	//
	GetGettextDomain() string

	// GetDescription returns the book version.
	//
	GetModuleVersion() string
}

Handbooker defines the interface needed by handbook module data provided as config source.

type IconSimple

type IconSimple struct {
	Field
	Taskbar bool
}

IconSimple provides a simple Iconer.

func NewIconSimple

func NewIconSimple(conf, key, name, icon string) *IconSimple

NewIconSimple creates a simple Iconer compatible object.

func (*IconSimple) ConfigGroup

func (is *IconSimple) ConfigGroup() string

ConfigGroup gives the config group to build if any, or the special config key if no config file is defined.

func (*IconSimple) ConfigPath

func (is *IconSimple) ConfigPath() string

ConfigPath returns the key.

func (*IconSimple) DefaultNameIcon

func (is *IconSimple) DefaultNameIcon() (string, string)

DefaultNameIcon returns improved name and image for the icon if possible.

func (*IconSimple) GetClass

func (is *IconSimple) GetClass() DesktopClasser

GetClass is unused ATM.

func (*IconSimple) GetCommand

func (is *IconSimple) GetCommand() string

GetCommand is unused ATM.

func (*IconSimple) GetGettextDomain

func (is *IconSimple) GetGettextDomain() string

GetGettextDomain is unused.

func (*IconSimple) IsLauncher

func (is *IconSimple) IsLauncher() bool

IsLauncher returns whether the icon is a separator or not.

func (*IconSimple) IsStackIcon

func (is *IconSimple) IsStackIcon() bool

IsStackIcon returns whether the icon is a stack icon (subdock) or not.

func (*IconSimple) IsTaskbar

func (is *IconSimple) IsTaskbar() bool

IsTaskbar returns whether the icon belongs to the taskbar or not.

func (*IconSimple) MoveAfterNext

func (is *IconSimple) MoveAfterNext()

MoveAfterNext is unused.

func (*IconSimple) MoveBeforePrevious

func (is *IconSimple) MoveBeforePrevious()

MoveBeforePrevious is unused.

func (*IconSimple) OriginalConfigPath

func (is *IconSimple) OriginalConfigPath() string

OriginalConfigPath is unused.

func (*IconSimple) Reload

func (is *IconSimple) Reload()

Reload is unused ATM.

func (*IconSimple) RemoveFromDock

func (is *IconSimple) RemoveFromDock()

RemoveFromDock is unused.

type Iconer

type Iconer interface {
	// ConfigPath gives the full path to the icon config file.
	//
	ConfigPath() string

	// OriginalConfigPath gives the full path to the icon original config file.
	// This is the default unchanged config file.
	//
	OriginalConfigPath() string

	DefaultNameIcon() (string, string) //applets map[string]*packages.AppletPackage) (string, string)
	IsTaskbar() bool
	IsLauncher() bool

	IsStackIcon() bool

	// ConfigGroup gives the config group to build if any.
	// If no config file is set, it defines a special config key.
	//
	ConfigGroup() string

	// GetClass returns the class defined for the icon, able to get all related
	// desktop class informations.
	//
	GetClass() DesktopClasser

	GetCommand() string
	Reload()

	// MoveAfterNext swaps the icon position with the previous one.
	//
	MoveBeforePrevious()

	// MoveAfterNext swaps the icon position with the next one.
	//
	MoveAfterNext()

	// RemoveFromDock removes the icon from the dock.
	RemoveFromDock()

	// GetGettextDomain returns the translation domain for the applet.
	GetGettextDomain() string
}

Iconer defines the interface needed by icons provided as config source.

type ListIcon

type ListIcon struct {
	Maindocks []*ListIconContainer
	Subdocks  map[string][]Iconer
}

ListIcon defines data for icons list building.

Maindocks  list of container + icons. (maindocks, desklets, services)
Subdocks   index of SubdockName => list of icons.

func NewListIcon

func NewListIcon() *ListIcon

NewListIcon creates a container to list dock icons.

func (*ListIcon) Add

func (li *ListIcon) Add(container Iconer, icons []Iconer)

Add adds a container with its icons in the list.

type ListIconContainer

type ListIconContainer struct {
	Container Iconer
	Icons     []Iconer
}

ListIconContainer defines a ListIcon container with its icons.

type Source

type Source interface {
	cdglobal.Crypto // Encrypt and Decrypt string.

	//MainConfigFile returns the full path to the dock config file.
	//
	MainConfigFile() string

	//MainConfigDefault returns the full path to the dock config file.
	//
	MainConfigDefault() string

	// AppIcon returns the application icon path.
	//
	AppIcon() string

	// DirUserAppData returns the path to user applet common data in ~/.config/cairo-dock/
	//
	DirUserAppData(path ...string) (string, error)

	// DirShareData returns the path to the shared data dir (/usr/share/cairo-dock/).
	//
	DirShareData(path ...string) string

	// DesktopClasser allows to get desktop class informations for a given name.
	//
	DesktopClasser(class string) DesktopClasser

	// DisplayMode tells which renderer mode is used.
	//
	DisplayMode() cdglobal.DisplayMode

	// ListIcons builds the list of all icons.
	//
	ListIcons() *ListIcon

	// ListKnownApplets builds the list of all applets.
	//
	ListKnownApplets() map[string]Appleter

	// ListDownloadApplets builds the list of downloadable user applets (installed or not).
	//
	ListDownloadApplets() (map[string]Appleter, error)

	// ListIconsMainDock builds the list of icons in the maindock.
	//
	ListIconsMainDock() []Field

	// ListShortkeys returns the list of dock shortkeys.
	//
	ListShortkeys() []cdglobal.Shortkeyer

	// ListScreens returns the list of screens (active monitors on the session).
	//
	ListScreens() []Field

	// ListViews returns the list of views.
	//
	ListViews() map[string]Handbooker

	// ListAnimations returns the list of animations.
	//
	ListAnimations() []Field

	// ListDeskletDecorations returns the list of desklet decorations.
	//
	ListDeskletDecorations() []Field

	// ListDialogDecorator returns the list of dialog decorators.
	//
	ListDialogDecorator() []Field

	// ListDocks builds the list of docks with a readable name.
	// Both options are docks to remove from the list. Subdock childrens are removed too.
	//
	ListDocks(parent, subdock string) []Field

	// ListThemeDesktopIcon builds a list of desktop icon-themes in system and user dir.
	//
	ListThemeDesktopIcon() []Field

	// ListDockThemes builds the list of dock themes local and distant.
	//
	ListDockThemeLoad() (map[string]Appleter, error)

	// ListDockThemes builds the list of dock themes local only.
	//
	ListDockThemeSave() []Field

	// CurrentThemeSave saves the current dock theme.
	//
	CurrentThemeSave(themeName string, saveBehaviour, saveLaunchers, needPackage bool, dirPackage string) error

	// CurrentThemeLoad imports and loads a dock theme.
	//
	CurrentThemeLoad(themeName string, useBehaviour, useLaunchers bool) error

	// Handbook creates a handbook (description) for the given applet name.
	//
	Handbook(appletName string) Handbooker

	// ListThemeXML builds a list of icon theme in system and user dir.
	//
	ListThemeXML(localSystem, localUser, distant string) map[string]Handbooker

	// ListThemeINI builds a list of icon theme in system and user dir.
	//
	ListThemeINI(localSystem, localUser, distant string) map[string]Handbooker

	// ManagerReload reloads the manager matching the given name.
	//
	ManagerReload(name string, b bool, keyf *keyfile.KeyFile)

	// CreateMainDock creates a new main dock to store a moved icon.
	//
	CreateMainDock() string

	// GrabWindowClass waits a user window selection and returns its class.
	//
	GrabWindowClass() (string, error)
}

Source defines external data needed by the config builder.

type SourceCommon

type SourceCommon struct {
	Log     cdtype.Logger
	ConfDir string // Path to user config dir with "extras" themes dir.
}

SourceCommon provides common methods for dock config data source.

func (SourceCommon) ListThemeDesktopIcon

func (SourceCommon) ListThemeDesktopIcon() []Field

ListThemeDesktopIcon builds a list of desktop icon-themes in system and user dir.

func (SourceCommon) ListThemeINI

func (sc SourceCommon) ListThemeINI(localSystem, localUser, distant string) map[string]Handbooker

ListThemeINI builds a list of icon theme in system and user dir.

func (SourceCommon) ListThemeXML

func (sc SourceCommon) ListThemeXML(localSystem, localUser, distant string) map[string]Handbooker

ListThemeXML builds a list of icon theme in system and user dir.

type UpdateModuleStater

type UpdateModuleStater interface {
	UpdateModuleState(name string, active bool)
}

UpdateModuleStater defines the UpdateModuleState single interface.

Jump to

Keyboard shortcuts

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