Documentation ¶
Index ¶
- Constants
- Variables
- func CanPaste(file string) bool
- func CanPasteClipboardContent() bool
- func CanPasteInto(file string) bool
- func ClearClipboard()
- func CopyTag() string
- func CopyTagFmt() string
- func CopyToClipboard(files []string)
- func CutToClipboard(files []string)
- func DirIsParentOf(root *gio.File, child *gio.File) bool
- func FilenameGetExtensionOffset(name string) int
- func FilenameStripExtension(name string) string
- func GIconGetThemeIconForApp(icon *gio.Icon, size int) string
- func GIconGetThemeIconForFile(icon *gio.Icon, size int) string
- func GetClipboardContents() []string
- func GetGIconForApp(filePath string) *gio.Icon
- func GetGIconForFile(filePath string) *gio.Icon
- func GetIconName(filePath string) string
- func GetLanguageNames() []string
- func GetLocaleVariants(locale string) []string
- func GetThemeIcon(iconStr string, size int) string
- func GetThemeIconForFile(file string, size int) string
- func GetThemeIconFromIconName(iconName string, size int) string
- func HasFsID(file *gio.File, expectedID string) bool
- func MakeNextDuplicateName(namebase string, suffix string, count int, maxLength int) (newName string)
- func ParsePreviousDuplicateName(name string) (namebase string, suffix string, count int)
- func ShortenUtf8String(str string, reduceByNumBytes int) string
- type AmountUnit
- type ChmodJob
- type ChownJob
- type CommandRecorder
- type CommandType
- type CommonJob
- func (job *CommonJob) Abort()
- func (job *CommonJob) GetError() error
- func (job *CommonJob) HasError() bool
- func (job *CommonJob) ListenAborted(fn func()) (func(), error)
- func (job *CommonJob) ListenDone(fn func(error)) (func(), error)
- func (job *CommonJob) ListenPercent(fn func(int64)) (func(), error)
- func (job *CommonJob) ListenProcessedAmount(fn func(amount int64, unit AmountUnit)) (func(), error)
- func (job *CommonJob) ListenSpeed(fn func(uint64)) (func(), error)
- func (job *CommonJob) ListenTotalAmount(fn func(int64, AmountUnit)) (func(), error)
- func (job *CommonJob) Result() interface{}
- func (job *CommonJob) UI() IUIDelegate
- type CopyMoveJob
- func (job *CopyMoveJob) Execute()
- func (job *CopyMoveJob) ListenCopying(fn func(string)) (func(), error)
- func (job *CopyMoveJob) ListenCopyingMovingDone(fn func(string, string)) (func(), error)
- func (job *CopyMoveJob) ListenCreatingDir(fn func(string)) (func(), error)
- func (job *CopyMoveJob) ListenMoving(fn func(string)) (func(), error)
- type CreateJob
- func NewCreateDirectoryJob(destDirURL string, dirname string, uiDelegate IUIDelegate) *CreateJob
- func NewCreateFileFromTemplateJob(destDirURL string, templateURL string, uiDelegate IUIDelegate) *CreateJob
- func NewCreateFileJob(destDirURL string, filename string, initContent []byte, uiDelegate IUIDelegate) *CreateJob
- func NewCreateLinkJob(srcURL string, destDirURL string, uiDelegate IUIDelegate) *CreateJob
- type DeleteJob
- type EmptyTrashJob
- type Enumerator
- type FileUndoManager
- func (m *FileUndoManager) ListenAvaiable(fn func(bool)) (func(), error)
- func (m *FileUndoManager) ListenJobRecordingFinished(fn func(CommandType)) (func(), error)
- func (m *FileUndoManager) ListenJobRecordingStarted(fn func(CommandType)) (func(), error)
- func (m *FileUndoManager) ListenUndoJobFinished(fn func()) (func(), error)
- func (m *FileUndoManager) ListenUndoJobTextChanged(fn func(string)) (func(), error)
- func (*FileUndoManager) RecordJob(op CommandType, srcURLs []string, destURL string, job interface{})
- func (*FileUndoManager) Undo()
- type GFileWrapper
- type GetAllLaunchAppsJob
- type GetDefaultLaunchAppJob
- type GetLaunchAppJob
- type GetRecommendedLaunchAppsJob
- type GetTemplateJob
- type IMountUI
- type IUIDelegate
- type ListJob
- type ListJobFlag
- type ListProperty
- type MountJob
- type OpKind
- type ReactorElement
- type RenameError
- type RenameJob
- type Response
- type ResponseCode
- type SetDefaultLaunchAppJob
- type SignalError
- type SignalManager
- type SignalReactor
- type StatJob
- type StatProperty
- type UIFlags
Constants ¶
const ( OpCut = "cut" OpCopy = "copy" )
const ( ErrorInvalidFileName = -1 - iota ErrorSameFileName ErrorStatFileFailed ErrorSaveFileFailed ErrorReadFileFailed )
const ( ErrorInvalidSignalName = iota ErrorSignalNotFound ErrorNoMonitor )
Variables ¶
var NTr = gettext.NTr
var Tr = gettext.Tr
Tr is a alias for gettext.Tr, which avoids to use dot import.
Functions ¶
func CanPasteClipboardContent ¶
func CanPasteClipboardContent() bool
func CanPasteInto ¶
func ClearClipboard ¶
func ClearClipboard()
func CopyTagFmt ¶
func CopyTagFmt() string
func CopyToClipboard ¶
func CopyToClipboard(files []string)
func CutToClipboard ¶
func CutToClipboard(files []string)
func DirIsParentOf ¶
func DirIsParentOf(root *gio.File, child *gio.File) bool
DirIsParentOf checks whether the root is the parent directory of child.
func FilenameGetExtensionOffset ¶
FilenameGetExtensionOffset is a C function wrap which return the offset of the extension.
func FilenameStripExtension ¶
FilenameStripExtension returns the basename without extension name.
func GIconGetThemeIconForApp ¶
GIconGetThemeIconForApp returns the icon for application.
func GIconGetThemeIconForFile ¶
GIconGetThemeIconForFile returns the icon for normal files.
func GetClipboardContents ¶
func GetClipboardContents() []string
func GetGIconForApp ¶
func GetGIconForApp(filePath string) *gio.Icon
GetGIconForApp get gio.Icon for application. @param filePath app's filepath.
func GetGIconForFile ¶
func GetGIconForFile(filePath string) *gio.Icon
GetGIconForFile gets gio.Icon for file. @param filePath is file's path
func GetIconName ¶
GetIconName gets icon for app or file. @param filePath path for app or file.
func GetLanguageNames ¶
func GetLanguageNames() []string
GetLanguageNames returns all language names.
func GetLocaleVariants ¶
GetLocaleVariants returns locale variants
func GetThemeIcon ¶
GetThemeIcon returns full path for icon. @param iconStr can be uri or path of files, or the icon name. @param size is the expected size of icon.
func GetThemeIconForFile ¶
func GetThemeIconFromIconName ¶
GetThemeIconFromIconName returns icon from icon name.
func MakeNextDuplicateName ¶
func ShortenUtf8String ¶
ShortenUtf8String shortens a utf8 string according to the reduceByNumBytes.
Types ¶
type AmountUnit ¶
type AmountUnit uint16
AmountUnit indicates which unit is used for amount. Bytes, Files, Directories
const ( AmountUnitBytes AmountUnit = iota AmountUnitFiles AmountUnitDirectories AmountUnitSumOfFilesAndDirs = AmountUnitBytes // using Bytes as the sum of files and directories when it's useless. )
The AmountUnit
type ChmodJob ¶
type ChmodJob struct { *CommonJob // contains filtered or unexported fields }
ChmodJob change the mode of a file/directory.
func NewChmodJob ¶
NewChmodJob creates a new ChmodJob.
type ChownJob ¶
type ChownJob struct { *CommonJob // contains filtered or unexported fields }
ChownJob changes the owner or group of a file or directory.
func NewChownJob ¶
NewChownJob creates a new ChownJob.
type CommandRecorder ¶
type CommandRecorder struct { }
type CommandType ¶
type CommandType int32
const ( CommandCopy CommandType = iota CommandMove CommandRename CommandLink CommandMkdir CommandTrash CommandPut )
TODO: compact command type
type CommonJob ¶
type CommonJob struct { *SignalManager // contains filtered or unexported fields }
CommonJob is the base data field of real job.
func (*CommonJob) ListenAborted ¶
func (*CommonJob) ListenDone ¶
func (*CommonJob) ListenPercent ¶
func (*CommonJob) ListenProcessedAmount ¶
func (job *CommonJob) ListenProcessedAmount(fn func(amount int64, unit AmountUnit)) (func(), error)
ListenProcessedAmount adds observers to processed-amount signal.
func (*CommonJob) ListenSpeed ¶
func (*CommonJob) ListenTotalAmount ¶
func (job *CommonJob) ListenTotalAmount(fn func(int64, AmountUnit)) (func(), error)
type CopyMoveJob ¶
type CopyMoveJob struct { *CommonJob // contains filtered or unexported fields }
CopyMoveJob copy or move the files or directories
func NewCopyJob ¶
func NewCopyJob(srcURLs []string, destDirURL string, targetName string, flags gio.FileCopyFlags, uiDelegate IUIDelegate) *CopyMoveJob
NewCopyJob creates a copy job.
func NewMoveJob ¶
func NewMoveJob(srcURLs []string, destDirURL string, targetName string, flags gio.FileCopyFlags, uiDelegate IUIDelegate) *CopyMoveJob
NewMoveJob creates a move job.
func (*CopyMoveJob) ListenCopying ¶
func (job *CopyMoveJob) ListenCopying(fn func(string)) (func(), error)
func (*CopyMoveJob) ListenCopyingMovingDone ¶
func (job *CopyMoveJob) ListenCopyingMovingDone(fn func(string, string)) (func(), error)
func (*CopyMoveJob) ListenCreatingDir ¶
func (job *CopyMoveJob) ListenCreatingDir(fn func(string)) (func(), error)
func (*CopyMoveJob) ListenMoving ¶
func (job *CopyMoveJob) ListenMoving(fn func(string)) (func(), error)
type CreateJob ¶
type CreateJob struct { *CommonJob // contains filtered or unexported fields }
CreateJob is used to create file, directory or symbol link. The uri of created file will be returned.
func NewCreateDirectoryJob ¶
func NewCreateDirectoryJob(destDirURL string, dirname string, uiDelegate IUIDelegate) *CreateJob
NewCreateDirectoryJob creates directory @param destURL: parent dir which contains the new directory.
func NewCreateFileFromTemplateJob ¶
func NewCreateFileFromTemplateJob(destDirURL string, templateURL string, uiDelegate IUIDelegate) *CreateJob
NewCreateFileFromTemplateJob creates new file from template. @param destURL: parent dir which contains the new directory.
func NewCreateFileJob ¶
func NewCreateFileJob(destDirURL string, filename string, initContent []byte, uiDelegate IUIDelegate) *CreateJob
NewCreateFileJob is used to create a new file. @param destURL: parent dir which contains the new directory.
func NewCreateLinkJob ¶
func NewCreateLinkJob(srcURL string, destDirURL string, uiDelegate IUIDelegate) *CreateJob
NewCreateLinkJob creates symbol link.
type DeleteJob ¶
type DeleteJob struct { *CommonJob // contains filtered or unexported fields }
DeleteJob delete or trash files/directories.
func NewDeleteJob ¶
func NewDeleteJob(urls []string, shouldConfirm bool, uiDelegate IUIDelegate) *DeleteJob
NewDeleteJob creates a new delete job to delete files or directories.
func NewTrashJob ¶
func NewTrashJob(urls []string, shouldConfirm bool, uiDelegate IUIDelegate) *DeleteJob
NewTrashJob creates a new trash job to trash files or directories.
func (*DeleteJob) Execute ¶
func (job *DeleteJob) Execute()
Execute the delete job to delete files/directories.
func (*DeleteJob) ListenDeleting ¶
func (*DeleteJob) ListenTrashing ¶
type EmptyTrashJob ¶
type EmptyTrashJob struct { *CommonJob // contains filtered or unexported fields }
EmptyTrashJob is a job to empty trash.
func NewEmptyTrashJob ¶
func NewEmptyTrashJob(shouldConfirm bool, uiDelegate IUIDelegate) *EmptyTrashJob
NewEmptyTrashJob creates a new empty trash job.
func (*EmptyTrashJob) Execute ¶
func (job *EmptyTrashJob) Execute()
Execute EmptyTrashJob and finalize resources.
type Enumerator ¶
type Enumerator struct {
// contains filtered or unexported fields
}
TODO: make a real Enumerator.
func NewEnumerator ¶
func NewEnumerator(ch chan interface{}) *Enumerator
func (*Enumerator) Close ¶
func (e *Enumerator) Close()
func (*Enumerator) IsClosed ¶
func (e *Enumerator) IsClosed() bool
func (*Enumerator) Next ¶
func (e *Enumerator) Next() <-chan interface{}
type FileUndoManager ¶
type FileUndoManager struct {
*SignalManager
}
func FileUndoManagerInstance ¶
func FileUndoManagerInstance() *FileUndoManager
func (*FileUndoManager) ListenAvaiable ¶
func (m *FileUndoManager) ListenAvaiable(fn func(bool)) (func(), error)
func (*FileUndoManager) ListenJobRecordingFinished ¶
func (m *FileUndoManager) ListenJobRecordingFinished(fn func(CommandType)) (func(), error)
func (*FileUndoManager) ListenJobRecordingStarted ¶
func (m *FileUndoManager) ListenJobRecordingStarted(fn func(CommandType)) (func(), error)
func (*FileUndoManager) ListenUndoJobFinished ¶
func (m *FileUndoManager) ListenUndoJobFinished(fn func()) (func(), error)
func (*FileUndoManager) ListenUndoJobTextChanged ¶
func (m *FileUndoManager) ListenUndoJobTextChanged(fn func(string)) (func(), error)
func (*FileUndoManager) RecordJob ¶
func (*FileUndoManager) RecordJob(op CommandType, srcURLs []string, destURL string, job interface{})
func (*FileUndoManager) Undo ¶
func (*FileUndoManager) Undo()
type GFileWrapper ¶
type GFileWrapper struct { *gio.File // this field should not be operated directly in common. // contains filtered or unexported fields }
GFileWrapper wraps *gio.File to make gio.File safer and easy to use.
func NewGFileWrapper ¶
func NewGFileWrapper(file *gio.File) *GFileWrapper
NewGFileWrapper creates a new GFileWrapper.
func (*GFileWrapper) IsNil ¶
func (o *GFileWrapper) IsNil() bool
IsNil checks whether the GFile is nil or not.
func (*GFileWrapper) Reset ¶
func (o *GFileWrapper) Reset(x *gio.File)
Reset unref the old GFile that belongs to GFileWrapper and set a new GFile to it.
type GetAllLaunchAppsJob ¶
type GetAllLaunchAppsJob struct {
*CommonJob
}
GetAllLaunchAppsJob will get all apps.
func NewGetAllLaunchAppsJob ¶
func NewGetAllLaunchAppsJob() *GetAllLaunchAppsJob
func (*GetAllLaunchAppsJob) Execute ¶
func (job *GetAllLaunchAppsJob) Execute()
type GetDefaultLaunchAppJob ¶
type GetDefaultLaunchAppJob struct { *GetLaunchAppJob // contains filtered or unexported fields }
GetDefaultLaunchAppJob will get the default launch app.
func NewGetDefaultLaunchAppJob ¶
func NewGetDefaultLaunchAppJob(uri string, mustSupportURI bool) *GetDefaultLaunchAppJob
func (*GetDefaultLaunchAppJob) Execute ¶
func (job *GetDefaultLaunchAppJob) Execute()
type GetLaunchAppJob ¶
type GetLaunchAppJob struct { *CommonJob // contains filtered or unexported fields }
GetLaunchAppJob is the base struct for get launch relatived job.
func NewGetLaunchAppJob ¶
func NewGetLaunchAppJob(uri string) *GetLaunchAppJob
type GetRecommendedLaunchAppsJob ¶
type GetRecommendedLaunchAppsJob struct {
*GetLaunchAppJob
}
GetRecommendedLaunchAppsJob will get all recommended launch apps.
func NewGetRecommendedLaunchAppsJob ¶
func NewGetRecommendedLaunchAppsJob(uri string) *GetRecommendedLaunchAppsJob
func (*GetRecommendedLaunchAppsJob) Execute ¶
func (job *GetRecommendedLaunchAppsJob) Execute()
type GetTemplateJob ¶
type GetTemplateJob struct {
// contains filtered or unexported fields
}
func NewGetTemplateJob ¶
func NewGetTemplateJob(templateDirURI string) *GetTemplateJob
func (*GetTemplateJob) Execute ¶
func (job *GetTemplateJob) Execute() []string
type IUIDelegate ¶
type IUIDelegate interface { // TODO: using this internally, give a simpler interface, like kio, // a.k.a: AskDeleteConfirmation(urls, deleteType, confirmationType)) // if necessary, ask user to confirm whether to delete or trash files. AskDeleteConfirmation(primaryText string, secondaryText string, detailText string) bool AskDelete(string, string, string, UIFlags) Response AskSkip(primaryText string, secondaryText string, detailText string, uiFlags UIFlags) Response AskRetry(primaryText string, secondaryText string, detailText string) Response // TODO: decide arguments ConflictDialog() Response }
IUIDelegate is the interface for ui delegate.
type ListJob ¶
type ListJob struct { *CommonJob // contains filtered or unexported fields }
ListJob lists a directory.
func NewListDirJob ¶
func NewListDirJob(dir string, flags ListJobFlag) *ListJob
NewListDirJob creates a new list job to list the contents of a directory. if recursive, recursively list the contents of a directory. if includeHidden, list hidden files and direcories as well.
func (*ListJob) ListenProperty ¶
func (job *ListJob) ListenProperty(fn func(ListProperty)) (func(), error)
ListenProperty adds observers to property signal.
type ListJobFlag ¶
type ListJobFlag int32
const ( ListJobFlagNone ListJobFlag = iota ListJobFlagRecusive ListJobFlagIncludeHidden )
type ListProperty ¶
type ListProperty struct { DisplayName string BaseName string URI string MIME 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 }
ListProperty represents the properties of files when ListJob is executed.
func GetListProperty ¶
func GetListProperty(file *gio.File, cancellable *gio.Cancellable) (ListProperty, error)
type ReactorElement ¶
type ReactorElement struct {
// contains filtered or unexported fields
}
ReactorElement holds signal handler and a id for that.
type RenameError ¶
func (*RenameError) Error ¶
func (e *RenameError) Error() string
type RenameJob ¶
type RenameJob struct { *CommonJob // contains filtered or unexported fields }
Rename is just working for current directory.
func NewRenameJob ¶
func (*RenameJob) ListenNewFile ¶
func (*RenameJob) ListenOldName ¶
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response stores the response relavant information like ResponseCode.
func NewResponse ¶
func NewResponse(code ResponseCode, applyToAll bool) Response
NewResponse creates a new Response from response code and apply to all.
func NewResponseWithUserData ¶
func NewResponseWithUserData(code ResponseCode, applyToAll bool, userData string) Response
NewResponseWithUserData creates a Response from response code code, apply to all and user data.
func (Response) ApplyToAll ¶
ApplyToAll returns whether apply to all.
type ResponseCode ¶
type ResponseCode int32
ResponseCode is a type for the response of UIDelegate.
const ( ResponseCancel ResponseCode = 1 << iota ResponseSkip ResponseRetry ResponseDelete ResponseOverwrite ResponseAutoRename // auto rename the conflict file/directory ResponseYes )
the code for response of UIDelegate.
func (ResponseCode) String ¶
func (code ResponseCode) String() string
String returns a human readable string for ResponseCode.
type SetDefaultLaunchAppJob ¶
type SetDefaultLaunchAppJob struct { *CommonJob // contains filtered or unexported fields }
SetDefaultLaunchAppJob sets the default launch applications for a MIME type.
func NewSetDefaultLaunchAppJob ¶
func NewSetDefaultLaunchAppJob(id string, mimeType string) *SetDefaultLaunchAppJob
NewSetLaunchAppJob creates a new SetLaunchAppJob.
func (*SetDefaultLaunchAppJob) Execute ¶
func (job *SetDefaultLaunchAppJob) Execute()
Execute the SetLaunchAppJob.
type SignalError ¶
func (SignalError) Error ¶
func (e SignalError) Error() string
type SignalManager ¶
type SignalManager struct {
// contains filtered or unexported fields
}
func NewSignalManager ¶
func NewSignalManager() *SignalManager
func (*SignalManager) Emit ¶
func (m *SignalManager) Emit(signalName string, args ...interface{}) error
func (*SignalManager) ListenSignal ¶
func (m *SignalManager) ListenSignal(signalName string, fn interface{}) (func(), error)
func (*SignalManager) RegisterMonitor ¶
func (m *SignalManager) RegisterMonitor(signalName string) *SignalManager
type SignalReactor ¶
type SignalReactor struct {
// contains filtered or unexported fields
}
SignalReactor is a reactor of one signal.
func NewSignalReactor ¶
func NewSignalReactor(signalName string) *SignalReactor
NewSignalReactor creates a new SignalReactor.
func (*SignalReactor) Add ¶
func (l *SignalReactor) Add(fn interface{}) func()
Add adds a new handler to signal.
func (*SignalReactor) Enumerator ¶
func (l *SignalReactor) Enumerator() *Enumerator
Enumerator return a channel of handler.
type StatJob ¶
type StatJob struct { *CommonJob // contains filtered or unexported fields }
StatJob list some useful properties for properties window.
type StatProperty ¶
type StatProperty struct { URI string Name string MIME string LinkTarget string Mode uint32 Size int64 MTime uint64 ATime uint64 Owner string OwnerReal string Group string }
StatProperty is the useful properties for properties window. the size field of directory is not the size of the whole directory, using list job with includeHidden and recursive flags to get the real size of a directory.
Source Files ¶
- chmod_job.go
- chown_job.go
- clipboard.go
- command_recorder.go
- common_job.go
- copy_move_job.go
- create_job.go
- delete_job.go
- empty_trash_job.go
- file_undo_manager.go
- get_template_job.go
- gfile_wrapper.go
- icon.go
- language.go
- launch_app_job.go
- list_dir_job.go
- mount_job.go
- rename_job.go
- signal_manager.go
- signal_reactor.go
- stat_job.go
- ui_delegate.go
- utils.go