desktop

package
v0.0.0-...-9514eed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2016 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OpOpen indicates opening files
	OpOpen int32 = iota
	// OpSelect indicates selecting open programming.
	OpSelect
)

used by RequestOpen signal

View Source
const (
	// ActivateFlagNone do nothing.
	ActivateFlagNone int32 = iota
	// ActivateFlagRun run file directly.
	ActivateFlagRun
	// ActivateFlagRunInTerminal run files in terminal.
	ActivateFlagRunInTerminal
	// ActivateFlagDisplay display files.
	ActivateFlagDisplay
)
View Source
const (
	// FileManagerPerferenceSchemaID is filemanager's general preferences' schema id
	FileManagerPerferenceSchemaID string = "com.deepin.filemanager.preferences"

	// FileManagerDesktopSchemaID is desktop specific settings' schema id
	FileManagerDesktopSchemaID string = "com.deepin.dde.desktop"
)
View Source
const (
	// ConfirmTrash schema key.
	ConfirmTrash = "confirm-trash"

	// ConfirmEmptyTrash schema key.
	ConfirmEmptyTrash = "confirm-empty-trash"

	// ActivationPolicy schema key.
	ActivationPolicy = "activation-policy"

	// ClickPolicy schema key.
	ClickPolicy = "click-policy"

	// ShowThumbnail schema key.
	ShowThumbnail = "show-thumbnail"

	// ShowHiddenFiles schema key.
	ShowHiddenFiles = "show-hidden-files"

	// ShowExtensionName schema key.
	ShowExtensionName = "show-extension-name"

	// LabelPosition schema key.
	LabelPosition = "label-position"

	// AllowDeleteImmediatly schema key.
	AllowDeleteImmediatly = "allow-delete-immediatly"

	// ShowComputerIcon schema key.
	ShowComputerIcon string = "show-computer-icon"

	// ShowTrashIcon schema key.
	ShowTrashIcon = "show-trash-icon"

	// StickupGrid schema key.
	StickupGrid = "stickup-grid"

	// AutoArrangement schema key.
	AutoArrangement = "auto-arrangement"

	// ShowTrashedItemCount schema key.
	ShowTrashedItemCount = "show-trashed-item-number"

	// SortOrder schema key.
	SortOrder = "sort-order"

	// IconDefaultSize schema key
	IconDefaultSize = "icon-default-size"

	// IconZoomLevel schema key
	IconZoomLevel = "icon-zoom-level"

	// ThumbnailSizeLimitation schema key
	ThumbnailSizeLimitation = "thumbnail-size-limitation"

	// ThumbnailSizeUnit schema key
	ThumbnailSizeUnit = "thumbnail-size-unit"

	DisplayExtraItems = "display-extra-items"
)
View Source
const (
	// ActivationPolicyAsk indicates ask for behaviours when activation.
	ActivationPolicyAsk string = "ask"

	// ActivationPolicyLaunch indicates launch files when activation.
	ActivationPolicyLaunch string = "launch"

	// ActivationPolicyDisplay indicates display files when activation.
	ActivationPolicyDisplay string = "display"
)
View Source
const (
	SizeUnitByte int = iota
	SizeUnitKiB
	SizeUnitMB
	SizeUnitGB
	SizeUnitTB
	SizeUnitPB
)
View Source
const (
	// AppGroupPrefix is the prefix of AppGroup's name.
	AppGroupPrefix string = ".deepin_rich_dir_"
)

Variables

View Source
var ArchiveMimeTypes = []string{
	"application/x-gtar",
	"application/x-zip",
	"application/x-zip-compressed",
	"application/zip",
	"application/x-zip",
	"application/x-tar",
	"application/x-7z-compressed",
	"application/x-rar",
	"application/x-rar-compressed",
	"application/x-jar",
	"application/x-java-archive",
	"application/x-war",
	"application/x-ear",
	"application/x-arj",
	"application/x-gzip",
	"application/gzip",
	"application/x-bzip-compressed-tar",
	"application/x-compressed-tar",
	"application/x-archive",
	"application/x-xz-compressed-tar",
	"application/x-bzip",
	"application/x-cbz",
	"application/x-xz",
	"application/x-lzma-compressed-tar",
	"application/x-ms-dos-executable",
	"application/x-lzma",
	"application/x-cd-image",
	"application/x-deb",
	"application/x-rpm",
	"application/x-stuffit",
	"application/x-tzo",
	"application/x-tarz",
	"application/x-tzo",
	"application/x-msdownload",
	"application/x-lha",
	"application/x-zoo",
}

ArchiveMimeTypes is a list of MIMEType for archive files.

Functions

func GetDesktopDir

func GetDesktopDir() string

GetDesktopDir returns desktop's path.

func GetUserSpecialDir

func GetUserSpecialDir(dir glib.UserDirectory) string

GetUserSpecialDir returns user special dir, like music directory.

Types

type AppGroup

type AppGroup struct {
	*Item
}

AppGroup represents appgroup on desktop.

func NewAppGroup

func NewAppGroup(app *Application, uris []string) *AppGroup

NewAppGroup creates a app group.

func (*AppGroup) GenMenu

func (item *AppGroup) GenMenu() (*Menu, error)

GenMenu generates json format menu content used in DeepinMenu for AppGroup.

type Application

type Application struct {
	ActivateFlagDisplay       int32
	ActivateFlagRunInTerminal int32
	ActivateFlagRun           int32

	RequestOpenPolicyOpen   int32
	RequestOpenPolicySelect int32

	RequestRename                 func(string)
	RequestDelete                 func([]string)
	RequestEmptyTrash             func()
	RequestSort                   func(string)
	RequestCleanup                func()
	ReqeustAutoArrange            func()
	RequestCreateFile             func()
	RequestCreateFileFromTemplate func(string)
	RequestCreateDirectory        func()
	ItemCut                       func([]string)
	ItemCopied                    func([]string)

	RequestOpen func([]string, []int32)

	AppGroupCreated func(string, []string)
	AppGroupDeleted func(string)
	AppGroupMerged  func(string, []string)

	ItemDeleted  func(string)
	ItemCreated  func(string)
	ItemModified func(string)
	// contains filtered or unexported fields
}

Application for desktop daemon.

func NewApplication

func NewApplication(s *Settings) *Application

NewApplication creates a application, settings must not be nil.

func NewDesktopDaemon

func NewDesktopDaemon() (*Application, error)

func (*Application) ActivateFile

func (app *Application) ActivateFile(file string, args []string, isExecutable bool, flag int32) error

ActivateFile will activate file. NB: **deprecated**, compatible interface, use ActivateFileWithTimestamp instead.

func (*Application) ActivateFileWithTimestamp

func (app *Application) ActivateFileWithTimestamp(file string, args []string, isExecutable bool, timestamp uint32, flag int32) error

ActivateFileWithTimestamp will activate file.

func (*Application) DestroyMenu

func (app *Application) DestroyMenu()

DestroyMenu destroys the useless menu.

func (*Application) GenMenuContent

func (app *Application) GenMenuContent(uris []string) string

GenMenuContent returns the menu content in json format used in DeepinMenu.

func (*Application) GenMenuContentWithExtraItems

func (app *Application) GenMenuContentWithExtraItems(uris []string, withExtraItems bool) string

func (*Application) GetAppGroupItems

func (app *Application) GetAppGroupItems(appGroup string) (map[string]ItemInfo, error)

func (*Application) GetDBusInfo

func (app *Application) GetDBusInfo() dbus.DBusInfo

GetDBusInfo returns dbus info of Application.

func (*Application) GetDesktopItems

func (app *Application) GetDesktopItems() (map[string]ItemInfo, error)

GetDesktopItems returns all desktop files.

func (*Application) GetItemInfo

func (app *Application) GetItemInfo(file string) (ItemInfo, error)

GetItemInfo gets ItemInfo for file.

func (*Application) HandleSelectedMenuItem

func (app *Application) HandleSelectedMenuItem(id string)

HandleSelectedMenuItem will handle selected menu item according to passed id.

func (*Application) HandleSelectedMenuItemWithTimestamp

func (app *Application) HandleSelectedMenuItemWithTimestamp(id string, timestamp uint32)

HandleSelectedMenuItemWithTimestamp will handle selected menu item according to passed id and timestamp.

func (*Application) IsAppGroup

func (app *Application) IsAppGroup(uri string) bool

IsAppGroup returns whether uri is a AppGroup

func (*Application) RequestCreatingAppGroup

func (app *Application) RequestCreatingAppGroup(files []string) error

RequestCreatingAppGroup creates app group according to the files, and emits AppGroupCreated signal when it's done.

func (*Application) RequestMergeIntoAppGroup

func (app *Application) RequestMergeIntoAppGroup(files []string, appGroup string) error

RequestMergeIntoAppGroup will merge files into existed AppGroup, and emits AppGroupMerged signal when it's done.

type CategoryInfo

type CategoryInfo struct {
	Name          string
	LowerCaseName string
	Count         int32
}

CategoryInfo includes simple information for software category.

type CategoryInfos

type CategoryInfos []CategoryInfo

CategoryInfos is an array of CategoryInfo, used by sort.Sort.

func (CategoryInfos) Len

func (info CategoryInfos) Len() int

func (CategoryInfos) Less

func (info CategoryInfos) Less(i, j int) bool

func (CategoryInfos) Swap

func (info CategoryInfos) Swap(i, j int)

type ComputerItem

type ComputerItem struct {
	*Item
}

ComputerItem is computer item on desktop.

func NewComputerItem

func NewComputerItem(app *Application, uri string) *ComputerItem

NewComputerItem creates new computer item.

func (*ComputerItem) GenMenu

func (item *ComputerItem) GenMenu() (*Menu, error)

GenMenu generates json format menu content used in DeepinMenu for ComputerItem.

type Desktop

type Desktop struct {
	// contains filtered or unexported fields
}

Desktop is desktop itself.

func NewDesktop

func NewDesktop(app *Application) *Desktop

NewDesktop creates new desktop.

func (*Desktop) GenMenu

func (desktop *Desktop) GenMenu() (*Menu, error)

GenMenu generates json format menu content used in DeepinMenu for Desktop itself.

type IMenuable

type IMenuable interface {
	GenMenu() (*Menu, error)
	// contains filtered or unexported methods
}

IMenuable is the interface for something can generate menu.

type Item

type Item struct {
	// contains filtered or unexported fields
}

Item is Normal Item, like file/directory/link.

func NewItem

func NewItem(app *Application, uris []string) *Item

NewItem creates new item.

func (*Item) GenMenu

func (item *Item) GenMenu() (*Menu, error)

GenMenu generates json format menu content used in DeepinMenu for normal itself.

type ItemInfo

type ItemInfo struct {
	DisplayName string
	BaseName    string
	URI         string
	MIME        string
	Icon        string
	IconName    string
	Thumbnail   string
	Size        int64
	FileType    uint16
	IsBackup    bool
	IsHidden    bool
	IsReadOnly  bool
	IsSymlink   bool
	CanDelete   bool
	CanExecute  bool
	CanRead     bool
	CanRename   bool
	CanTrash    bool
	CanWrite    bool
}

ItemInfo includes some simple informations.

type Menu struct {
	// contains filtered or unexported fields
}

Menu is menu.

func NewMenu

func NewMenu() *Menu

NewMenu creates new menu.

func (m *Menu) AddSeparator() *Menu

AddSeparator adds a separator to menu.

func (m *Menu) AppendItem(items ...*MenuItem) *Menu

AppendItem appends a new menu item to menu.

func (m *Menu) HandleAction(id string, timestamp uint32) bool

HandleAction will call the action corresponding to the id.

func (m *Menu) SetIDGenerator(f func() string) *Menu

SetIDGenerator changes the default id generator to the passed id generator.

func (m *Menu) ToJSON() string

ToJSON generates json format menu content used in DeepinMenu.

type MenuItem struct {
	Action func(uint32)
	// contains filtered or unexported fields
}

MenuItem is menu item.

func NewMenuItem

func NewMenuItem(name string, action func(uint32), enable bool) *MenuItem

NewMenuItem creates new menu item.

type Settings

type Settings struct {

	// signals
	IconZoomLevelChanged           func(int32)
	ShowTrashIconChanged           func(bool)
	ShowComputerIconChanged        func(bool)
	StickupGridChanged             func(bool)
	AutoArrangementChanged         func(bool)
	ConfirmEmptyTrashChanged       func(bool)
	ActivationPolicyChanged        func(string)
	ClickPolicyChanged             func(string)
	ShowThumbnailChanged           func(string)
	ShowHiddenFilesChanged         func(bool)
	ShowExtensionNameChanged       func(bool)
	LabelPositionChanged           func(string)
	AllowDeleteImmediatlyChanged   func(bool)
	ThumbnailSizeLimitationChanged func(uint64)
	// contains filtered or unexported fields
}

Settings is settings used by desktop.

func NewSettings

func NewSettings() (*Settings, error)

NewSettings creates a new settings.

func (*Settings) ActivationPolicy

func (s *Settings) ActivationPolicy() string

ActivationPolicy returns activation policy.

func (*Settings) AllowDeleteImmediatlyIsEnable

func (s *Settings) AllowDeleteImmediatlyIsEnable() bool

AllowDeleteImmediatlyIsEnable returns whether AllowDeleteImmediatly is enabled.

func (*Settings) AutoArrangement

func (s *Settings) AutoArrangement() bool

func (*Settings) ClickPolicy

func (s *Settings) ClickPolicy() string

ClickPolicy returns click policy.

func (*Settings) ConfirmEmptyTrashIsEnable

func (s *Settings) ConfirmEmptyTrashIsEnable() bool

ConfirmEmptyTrashIsEnable returns whether ConfirmEmptyTrash is enabled.

func (*Settings) ConfirmTrashIsEnable

func (s *Settings) ConfirmTrashIsEnable() bool

ConfirmTrashIsEnable returns whether ConfirmTrash is enabled.

func (*Settings) DisplayExtraItems

func (s *Settings) DisplayExtraItems() bool

func (*Settings) EnableAutoArrangement

func (s *Settings) EnableAutoArrangement(enable bool)

func (*Settings) EnableShowComputerIcon

func (s *Settings) EnableShowComputerIcon(enable bool)

EnableShowComputerIcon enables or disables ShowComputerIcon.

func (*Settings) EnableShowTrashIcon

func (s *Settings) EnableShowTrashIcon(enable bool)

EnableShowTrashIcon enables or disables ShowTrashIcon.

func (*Settings) EnableStickupGrid

func (s *Settings) EnableStickupGrid(enable bool)

EnableStickupGrid enables or disables StickupGrid.

func (*Settings) GetDBusInfo

func (s *Settings) GetDBusInfo() dbus.DBusInfo

GetDBusInfo returns dbus info for Settings.

func (*Settings) IconDefaultSize

func (s *Settings) IconDefaultSize() int32

IconDefaultSize returns the default icon size.

func (*Settings) IconZoomLevel

func (s *Settings) IconZoomLevel() int32

IconZoomLevel returns the zoom level of icons.

func (*Settings) LabelPosition

func (s *Settings) LabelPosition() string

LabelPosition returns the label position of name.

func (*Settings) SetIconZoomLevel

func (s *Settings) SetIconZoomLevel(zoomLevel int32) bool

SetIconZoomLevel will change the zoom level of icons.

func (*Settings) ShowComputerIconIsEnable

func (s *Settings) ShowComputerIconIsEnable() bool

ShowComputerIconIsEnable returns whether ShowComputerIcon is enabled.

func (*Settings) ShowExtensionNameIsEnable

func (s *Settings) ShowExtensionNameIsEnable() bool

ShowExtensionNameIsEnable returns whether ShowExtensionName is enabled.

func (*Settings) ShowHiddenFilesIsEnable

func (s *Settings) ShowHiddenFilesIsEnable() bool

ShowHiddenFilesIsEnable returns whether ShowHiddenFiles is enabled.

func (*Settings) ShowThumbnail

func (s *Settings) ShowThumbnail() string

ShowThumbnail returns show thumbnail policy.

func (*Settings) ShowTrashIconIsEnable

func (s *Settings) ShowTrashIconIsEnable() bool

ShowTrashIconIsEnable returns whether ShowTrashIcon is enabled.

func (*Settings) ShowTrashedItemCountIsEnable

func (s *Settings) ShowTrashedItemCountIsEnable() bool

ShowTrashedItemCountIsEnable returns whether ShowTrashedItemCount is enabled.

func (*Settings) StickupGridIsEnable

func (s *Settings) StickupGridIsEnable() bool

StickupGridIsEnable returns whether StickupGrid is enabled.

func (*Settings) ThumbnailSizeLimitation

func (s *Settings) ThumbnailSizeLimitation() uint64

type TrashItem

type TrashItem struct {
	*Item
}

TrashItem is TrashItem.

func NewTrashItem

func NewTrashItem(app *Application, uri string) *TrashItem

NewTrashItem creates new trash item.

func (*TrashItem) GenMenu

func (item *TrashItem) GenMenu() (*Menu, error)

GenMenu generates json format menu content used in DeepinMenu for TrashItem.

Jump to

Keyboard shortcuts

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