diff --git a/HSFM-FileSystem-FileType.html b/HSFM-FileSystem-FileType.html index 3e3598e..746bc8d 100644 --- a/HSFM-FileSystem-FileType.html +++ b/HSFM-FileSystem-FileType.html @@ -10,25 +10,25 @@ window.onload = function () {pageLoad();setSynopsis("mini_HSFM-FileSystem-FileTy happening on filesystem level.

If you interact with low-level libraries, you must not pattern match on the `File a` type. Instead, you should only use the saved path and make no assumptions about the file the path might or - might not point to.

Synopsis

Documentation

data File a Source #

The String in the path field is always a full path. + might not point to.

Synopsis

Documentation

data File a Source #

The String in the path field is always a full path. The free type variable is used in the File/Dir constructor and can hold Handles, Strings representing a file's contents or anything else you can - think of. We catch any IO errors in the Failed constructor.

Constructors

Failed 

Fields

  • path :: !(Path Abs)
     
  • err :: IOError
     
Dir 

Fields

RegFile 

Fields

SymLink 

Fields

BlockDev 

Fields

CharDev 

Fields

NamedPipe 

Fields

Socket 

Fields

Instances

Eq a => Eq (File a) Source # 

Methods

(==) :: File a -> File a -> Bool

(/=) :: File a -> File a -> Bool

Ord (File FileInfo) Source #

First compare constructors: Failed < Dir < File... + think of. We catch any IO errors in the Failed constructor.

Constructors

Failed 

Fields

Dir 

Fields

RegFile 

Fields

SymLink 

Fields

BlockDev 

Fields

CharDev 

Fields

NamedPipe 

Fields

Socket 

Fields

Instances

Eq a => Eq (File a) Source # 

Methods

(==) :: File a -> File a -> Bool #

(/=) :: File a -> File a -> Bool #

Ord (File FileInfo) Source #

First compare constructors: Failed < Dir < File... Then compare name... - Then compare free variable parameter of File constructors

Show a => Show (File a) Source # 

Methods

showsPrec :: Int -> File a -> ShowS

show :: File a -> String

showList :: [File a] -> ShowS

data FileInfo Source #

Low-level file information.

Constructors

FileInfo 

Fields

Instances

Eq FileInfo Source # 

Methods

(==) :: FileInfo -> FileInfo -> Bool

(/=) :: FileInfo -> FileInfo -> Bool

Ord FileInfo Source # 

Methods

compare :: FileInfo -> FileInfo -> Ordering

(<) :: FileInfo -> FileInfo -> Bool

(<=) :: FileInfo -> FileInfo -> Bool

(>) :: FileInfo -> FileInfo -> Bool

(>=) :: FileInfo -> FileInfo -> Bool

max :: FileInfo -> FileInfo -> FileInfo

min :: FileInfo -> FileInfo -> FileInfo

Show FileInfo Source # 

Methods

showsPrec :: Int -> FileInfo -> ShowS

show :: FileInfo -> String

showList :: [FileInfo] -> ShowS

Ord (File FileInfo) Source #

First compare constructors: Failed < Dir < File... + Then compare free variable parameter of File constructors

Show a => Show (File a) Source # 

Methods

showsPrec :: Int -> File a -> ShowS #

show :: File a -> String #

showList :: [File a] -> ShowS #

data FileInfo Source #

Low-level file information.

Instances

Eq FileInfo Source # 
Ord FileInfo Source # 
Show FileInfo Source # 
Ord (File FileInfo) Source #

First compare constructors: Failed < Dir < File... Then compare name... - Then compare free variable parameter of File constructors

pattern FileLike :: File FileInfo -> File FileInfo Source #

Matches on any non-directory kind of files, excluding symlinks.

pattern DirList :: forall t. (Foldable t, Functor t) => t (File FileInfo) -> t (File FileInfo) Source #

Matches a list of directories or symlinks pointing to directories.

pattern FileLikeList :: forall t. (Foldable t, Functor t) => t (File FileInfo) -> t (File FileInfo) Source #

Matches a list of any non-directory kind of files or symlinks - pointing to such.

pattern FileLikeSym :: File FileInfo -> File FileInfo Source #

Matches on symlinks pointing to file-like files only.

pattern BrokenSymlink :: File FileInfo -> File FileInfo Source #

Matches on broken symbolic links.

pattern DirOrSym :: File FileInfo -> File FileInfo Source #

Matches on directories or symlinks pointing to directories. + Then compare free variable parameter of File constructors

pattern FileLike :: File FileInfo -> File FileInfo Source #

Matches on any non-directory kind of files, excluding symlinks.

pattern DirList :: forall t. (Foldable t, Functor t) => t (File FileInfo) -> t (File FileInfo) Source #

Matches a list of directories or symlinks pointing to directories.

pattern FileLikeList :: forall t. (Foldable t, Functor t) => t (File FileInfo) -> t (File FileInfo) Source #

Matches a list of any non-directory kind of files or symlinks + pointing to such.

pattern FileLikeSym :: File FileInfo -> File FileInfo Source #

Matches on symlinks pointing to file-like files only.

pattern BrokenSymlink :: File FileInfo -> File FileInfo Source #

Matches on broken symbolic links.

pattern DirOrSym :: File FileInfo -> File FileInfo Source #

Matches on directories or symlinks pointing to directories. If the symlink is pointing to a symlink pointing to a directory, then it will return True, but also return the first element in the symlink- chain, not the last.

pattern DirSym :: File FileInfo -> File FileInfo Source #

Matches on symlinks pointing to directories only.

pattern FileLikeOrSym :: File FileInfo -> File FileInfo Source #

Matches on any non-directory kind of files or symlinks pointing to such. If the symlink is pointing to a symlink pointing to such a file, then it will return True, but also return the first element in the symlink- - chain, not the last.

readFile :: (Path Abs -> IO a) -> Path Abs -> IO (File a) Source #

Reads a file or directory Path into an AnchoredFile, filling the free - variables via the given function.

readDirectoryContents Source #

Arguments

:: (Path Abs -> IO a)

fills free a variable

-> Path Abs

path to read

-> IO [File a] 

Get the contents of a given directory and return them as a list - of AnchoredFile.

getContents :: (Path Abs -> IO a) -> File FileInfo -> IO [File a] Source #

A variant of readDirectoryContents where the second argument - is a File. If a non-directory is passed returns an empty list.

goUp :: File FileInfo -> IO (File FileInfo) Source #

Go up one directory in the filesystem hierarchy.

goUp' :: Path Abs -> IO (File FileInfo) Source #

Go up one directory in the filesystem hierarchy.

anyFailed :: [File a] -> Bool Source #

True if any Failed constructors in the tree.

successful :: [File a] -> Bool Source #

True if there are no Failed constructors in the tree.

failed :: File a -> Bool Source #

Returns true if argument is a Failed constructor.

failures :: [File a] -> [File a] Source #

Returns a list of Failed constructors only.

isFileC :: File a -> Bool Source #

isDirC :: File a -> Bool Source #

isSymC :: File a -> Bool Source #

isBlockC :: File a -> Bool Source #

isCharC :: File a -> Bool Source #

isNamedC :: File a -> Bool Source #

isSocketC :: File a -> Bool Source #

getFileInfo :: Path Abs -> IO FileInfo Source #

Gets all file information.

handleDT :: Path Abs -> IO (File a) -> IO (File a) Source #

isBrokenSymlink :: File FileInfo -> Bool Source #

Checks if a symlink is broken by examining the constructor of the - symlink destination.

When called on a non-symlink, returns False.

packModTime :: File FileInfo -> String Source #

Pack the modification time into a string.

packAccessTime :: File FileInfo -> String Source #

Pack the modification time into a string.

epochToString :: EpochTime -> String Source #

packPermissions :: File FileInfo -> String Source #

Pack the permissions into a string, similar to what "ls -l" does.

packFileType :: File a -> String Source #

fromFreeVar :: Default d => (a -> d) -> File a -> d Source #

Apply a function on the free variable. If there is no free variable - for the given constructor the value from the Default class is used.

getFPasStr :: File a -> String Source #

getFreeVar :: File a -> Maybe a Source #

Gets the free variable. Returns Nothing if the constructor is of Failed.

\ No newline at end of file + chain, not the last.

readFile :: (Path Abs -> IO a) -> Path Abs -> IO (File a) Source #

Reads a file or directory Path into an AnchoredFile, filling the free + variables via the given function.

readDirectoryContents Source #

Arguments

:: (Path Abs -> IO a)

fills free a variable

-> Path Abs

path to read

-> IO [File a] 

Get the contents of a given directory and return them as a list + of AnchoredFile.

getContents :: (Path Abs -> IO a) -> File FileInfo -> IO [File a] Source #

A variant of readDirectoryContents where the second argument + is a File. If a non-directory is passed returns an empty list.

goUp :: File FileInfo -> IO (File FileInfo) Source #

Go up one directory in the filesystem hierarchy.

goUp' :: Path Abs -> IO (File FileInfo) Source #

Go up one directory in the filesystem hierarchy.

anyFailed :: [File a] -> Bool Source #

True if any Failed constructors in the tree.

successful :: [File a] -> Bool Source #

True if there are no Failed constructors in the tree.

failed :: File a -> Bool Source #

Returns true if argument is a Failed constructor.

failures :: [File a] -> [File a] Source #

Returns a list of Failed constructors only.

comparingConstr :: File FileInfo -> File FileInfo -> Ordering Source #

isFileC :: File a -> Bool Source #

isDirC :: File a -> Bool Source #

isSymC :: File a -> Bool Source #

isBlockC :: File a -> Bool Source #

isCharC :: File a -> Bool Source #

isNamedC :: File a -> Bool Source #

isSocketC :: File a -> Bool Source #

getFileInfo :: Path Abs -> IO FileInfo Source #

Gets all file information.

handleDT :: Path Abs -> IO (File a) -> IO (File a) Source #

isBrokenSymlink :: File FileInfo -> Bool Source #

Checks if a symlink is broken by examining the constructor of the + symlink destination.

When called on a non-symlink, returns False.

packModTime :: File FileInfo -> String Source #

Pack the modification time into a string.

packAccessTime :: File FileInfo -> String Source #

Pack the modification time into a string.

epochToString :: EpochTime -> String Source #

packPermissions :: File FileInfo -> String Source #

Pack the permissions into a string, similar to what "ls -l" does.

packFileType :: File a -> String Source #

packLinkDestination :: File a -> Maybe ByteString Source #

fromFreeVar :: Default d => (a -> d) -> File a -> d Source #

Apply a function on the free variable. If there is no free variable + for the given constructor the value from the Default class is used.

getFPasStr :: File a -> String Source #

getFreeVar :: File a -> Maybe a Source #

Gets the free variable. Returns Nothing if the constructor is of Failed.

\ No newline at end of file diff --git a/HSFM-FileSystem-UtilTypes.html b/HSFM-FileSystem-UtilTypes.html index 3696e98..5195e68 100644 --- a/HSFM-FileSystem-UtilTypes.html +++ b/HSFM-FileSystem-UtilTypes.html @@ -13,6 +13,6 @@ window.onload = function () {pageLoad();setSynopsis("mini_HSFM-FileSystem-UtilTy the result is undefined if another process changes that context while the non-atomic operation is still happening. However, where possible, as few syscalls as possible are used and the underlying - exception handling is kept.

Synopsis

Documentation

data FileOperation Source #

Data type describing file operations. - Useful to build up a list of operations or delay operations.

Constructors

FCopy Copy 
FMove Move 
FDelete [Path Abs] 
FOpen (Path Abs) 
FExecute (Path Abs) [ByteString] 
None 

data Copy Source #

Data type describing partial or complete file copy operation.

Constructors

PartialCopy [Path Abs] 
Copy [Path Abs] (Path Abs) 

data Move Source #

Data type describing partial or complete file move operation.

Constructors

PartialMove [Path Abs] 
Move [Path Abs] (Path Abs) 

data FCollisonMode Source #

Collision modes that describe the behavior in case a file collision + exception handling is kept.

Synopsis

Documentation

data FileOperation Source #

Data type describing file operations. + Useful to build up a list of operations or delay operations.

Constructors

FCopy Copy 
FMove Move 
FDelete [Path Abs] 
FOpen (Path Abs) 
FExecute (Path Abs) [ByteString] 
None 

data Copy Source #

Data type describing partial or complete file copy operation.

Constructors

PartialCopy [Path Abs] 
Copy [Path Abs] (Path Abs) 

data Move Source #

Data type describing partial or complete file move operation.

Constructors

PartialMove [Path Abs] 
Move [Path Abs] (Path Abs) 

data FCollisonMode Source #

Collision modes that describe the behavior in case a file collision happens.

Constructors

Strict

fail if the target already exists

Overwrite 
OverwriteAll 
Skip 
Rename (Path Fn) 
\ No newline at end of file diff --git a/HSFM-GUI-Glib-GlibString.html b/HSFM-GUI-Glib-GlibString.html index d15cce4..bdd27ac 100644 --- a/HSFM-GUI-Glib-GlibString.html +++ b/HSFM-GUI-Glib-GlibString.html @@ -1,4 +1,4 @@ HSFM.GUI.Glib.GlibString

hsfm-gtk

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Glib.GlibString

Contents

Documentation

c_strlen :: CString -> IO CSize Source #

noNullPtrs :: CStringLen -> CStringLen Source #

Orphan instances

GlibString ByteString Source # 

Methods

withUTFString :: ByteString -> (CString -> IO a) -> IO a

withUTFStringLen :: ByteString -> (CStringLen -> IO a) -> IO a

peekUTFString :: CString -> IO ByteString

maybePeekUTFString :: CString -> IO (Maybe ByteString)

peekUTFStringLen :: CStringLen -> IO ByteString

newUTFString :: ByteString -> IO CString

newUTFStringLen :: ByteString -> IO CStringLen

genUTFOfs :: ByteString -> UTFCorrection

stringLength :: ByteString -> Int

unPrintf :: ByteString -> ByteString

\ No newline at end of file +

hsfm-gtk

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Glib.GlibString

Contents

Documentation

Orphan instances

\ No newline at end of file diff --git a/HSFM-GUI-Gtk-Callbacks-Utils.html b/HSFM-GUI-Gtk-Callbacks-Utils.html index 3cf6cfb..78606b2 100644 --- a/HSFM-GUI-Gtk-Callbacks-Utils.html +++ b/HSFM-GUI-Gtk-Callbacks-Utils.html @@ -1,5 +1,5 @@ HSFM.GUI.Gtk.Callbacks.Utils

hsfm-gtk

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.Callbacks.Utils

Synopsis

Documentation

doFileOperation :: FileOperation -> IO () Source #

Carries out a file operation with the appropriate error handling - allowing the user to react to various exceptions with further input.

_doFileOperation :: [Path b1] -> Path Abs -> (Path b1 -> Path Abs -> IO b) -> (Path b1 -> Path Abs -> IO a) -> IO () -> IO () Source #

goDir :: MyGUI -> MyView -> Item -> IO () Source #

Helper that is invoked for any directory change operations.

\ No newline at end of file +

hsfm-gtk

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.Callbacks.Utils

Synopsis

Documentation

doFileOperation :: FileOperation -> IO () Source #

Carries out a file operation with the appropriate error handling + allowing the user to react to various exceptions with further input.

_doFileOperation :: [Path b1] -> Path Abs -> (Path b1 -> Path Abs -> IO b) -> (Path b1 -> Path Abs -> IO a) -> IO () -> IO () Source #

goDir :: MyGUI -> MyView -> Item -> IO () Source #

Helper that is invoked for any directory change operations.

\ No newline at end of file diff --git a/HSFM-GUI-Gtk-Callbacks.html b/HSFM-GUI-Gtk-Callbacks.html index d1e6914..89ced22 100644 --- a/HSFM-GUI-Gtk-Callbacks.html +++ b/HSFM-GUI-Gtk-Callbacks.html @@ -1,5 +1,5 @@ HSFM.GUI.Gtk.Callbacks

hsfm-gtk

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.Callbacks

Synopsis

Documentation

setGUICallbacks :: MyGUI -> IO () Source #

Set callbacks for the whole gui, on hotkeys, events and stuff.

setViewCallbacks :: MyGUI -> MyView -> IO () Source #

Set callbacks specific to a given view, on hotkeys, events and stuff.

openTerminalHere :: MyView -> IO ProcessID Source #

closeTab :: MyGUI -> MyView -> IO () Source #

Closes the current tab, but only if there is more than one tab.

newTabHere :: MyGUI -> MyView -> [Item] -> IO () Source #

del :: [Item] -> MyGUI -> MyView -> IO () Source #

Supposed to be used with withRows. Deletes a file or directory.

moveInit :: [Item] -> MyGUI -> MyView -> IO () Source #

Initializes a file move operation.

copyInit :: [Item] -> MyGUI -> MyView -> IO () Source #

Supposed to be used with withRows. Initializes a file copy operation.

operationFinal :: MyGUI -> MyView -> Maybe Item -> IO () Source #

Finalizes a file operation, such as copy or move.

newFile :: MyGUI -> MyView -> IO () Source #

Create a new file.

newDir :: MyGUI -> MyView -> IO () Source #

Create a new directory.

renameF :: [Item] -> MyGUI -> MyView -> IO () Source #

urlGoTo :: MyGUI -> MyView -> IO () Source #

Go to the url given at the urlBar and visualize it in the given - treeView.

If the url is invalid, does nothing.

goHome :: MyGUI -> MyView -> IO () Source #

execute :: [Item] -> MyGUI -> MyView -> IO () Source #

Execute a given file.

open :: [Item] -> MyGUI -> MyView -> IO () Source #

Supposed to be used with withRows. Opens a file or directory.

upDir :: MyGUI -> MyView -> IO () Source #

Go up one directory and visualize it in the treeView.

goHistoryPrev :: MyGUI -> MyView -> IO () Source #

Go "back" in the history.

goHistoryNext :: MyGUI -> MyView -> IO () Source #

Go "forth" in the history.

\ No newline at end of file +

hsfm-gtk

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.Callbacks

Synopsis

Documentation

setGUICallbacks :: MyGUI -> IO () Source #

Set callbacks for the whole gui, on hotkeys, events and stuff.

setViewCallbacks :: MyGUI -> MyView -> IO () Source #

Set callbacks specific to a given view, on hotkeys, events and stuff.

closeTab :: MyGUI -> MyView -> IO () Source #

Closes the current tab, but only if there is more than one tab.

del :: [Item] -> MyGUI -> MyView -> IO () Source #

Supposed to be used with withRows. Deletes a file or directory.

moveInit :: [Item] -> MyGUI -> MyView -> IO () Source #

Initializes a file move operation.

copyInit :: [Item] -> MyGUI -> MyView -> IO () Source #

Supposed to be used with withRows. Initializes a file copy operation.

operationFinal :: MyGUI -> MyView -> Maybe Item -> IO () Source #

Finalizes a file operation, such as copy or move.

newFile :: MyGUI -> MyView -> IO () Source #

Create a new file.

newDir :: MyGUI -> MyView -> IO () Source #

Create a new directory.

renameF :: [Item] -> MyGUI -> MyView -> IO () Source #

urlGoTo :: MyGUI -> MyView -> IO () Source #

Go to the url given at the urlBar and visualize it in the given + treeView.

If the url is invalid, does nothing.

execute :: [Item] -> MyGUI -> MyView -> IO () Source #

Execute a given file.

open :: [Item] -> MyGUI -> MyView -> IO () Source #

Supposed to be used with withRows. Opens a file or directory.

upDir :: MyGUI -> MyView -> IO () Source #

Go up one directory and visualize it in the treeView.

goHistoryPrev :: MyGUI -> MyView -> IO () Source #

Go "back" in the history.

goHistoryNext :: MyGUI -> MyView -> IO () Source #

Go "forth" in the history.

\ No newline at end of file diff --git a/HSFM-GUI-Gtk-Data.html b/HSFM-GUI-Gtk-Data.html index 0ad4cad..32bcfc6 100644 --- a/HSFM-GUI-Gtk-Data.html +++ b/HSFM-GUI-Gtk-Data.html @@ -1,8 +1,8 @@ HSFM.GUI.Gtk.Data

hsfm-gtk

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.Data

Synopsis

Documentation

data MyGUI Source #

Monolithic object passed to various GUI functions in order +

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.Data

Synopsis

Documentation

data MyGUI Source #

Monolithic object passed to various GUI functions in order to keep the API stable and not alter the parameters too much. This only holds GUI widgets that are needed to be read during - runtime.

Constructors

MkMyGUI 

Fields

data MyView Source #

This describes the contents of the current view and is separated from MyGUI, - because we might want to have multiple views.

Constructors

MkMyView 

Fields

data MenuBar Source #

Constructors

MkMenuBar 

Fields

data RightClickMenu Source #

Constructors

MkRightClickMenu 

Fields

data FilePropertyGrid Source #

Constructors

MkFilePropertyGrid 

Fields

data FMSettings Source #

FM-wide settings.

Constructors

MkFMSettings 

Fields

data FMView Source #

Constructors

FMTreeView !TreeView 
FMIconView !IconView 
\ No newline at end of file + runtime.

Constructors

MkMyGUI 

Fields

data MyView Source #

This describes the contents of the current view and is separated from MyGUI, + because we might want to have multiple views.

Constructors

MkMyView 

Fields

data MenuBar Source #

Constructors

MkMenuBar 

Fields

data RightClickMenu Source #

Constructors

MkRightClickMenu 

Fields

data FilePropertyGrid Source #

Constructors

MkFilePropertyGrid 

Fields

data FMSettings Source #

FM-wide settings.

Constructors

MkFMSettings 

Fields

data FMView Source #

Constructors

FMTreeView !TreeView 
FMIconView !IconView 
\ No newline at end of file diff --git a/HSFM-GUI-Gtk-Dialogs.html b/HSFM-GUI-Gtk-Dialogs.html index 997adc0..488d513 100644 --- a/HSFM-GUI-Gtk-Dialogs.html +++ b/HSFM-GUI-Gtk-Dialogs.html @@ -1,7 +1,7 @@ HSFM.GUI.Gtk.Dialogs

hsfm-gtk

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.Dialogs

Synopsis

Documentation

showErrorDialog :: String -> IO () Source #

Pops up an error Dialog with the given String.

showConfirmationDialog :: String -> IO Bool Source #

Asks the user for confirmation and returns True/False.

showAboutDialog :: IO () Source #

Shows the about dialog from the help menu.

withConfirmationDialog :: String -> IO () -> IO () Source #

Carry out an IO action with a confirmation dialog. - If the user presses No, then do nothing.

withErrorDialog :: IO a -> IO () Source #

Execute the given IO action. If the action throws exceptions, - visualize them via showErrorDialog.

textInputDialog Source #

Arguments

:: GlibString string 
=> string

window title

-> string

initial text in input widget

-> IO (Maybe String) 

Asks the user which directory copy mode he wants via dialog popup - and returns DirCopyMode.

\ No newline at end of file +

hsfm-gtk

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.Dialogs

Synopsis

Documentation

showErrorDialog :: String -> IO () Source #

Pops up an error Dialog with the given String.

showConfirmationDialog :: String -> IO Bool Source #

Asks the user for confirmation and returns True/False.

showAboutDialog :: IO () Source #

Shows the about dialog from the help menu.

withConfirmationDialog :: String -> IO () -> IO () Source #

Carry out an IO action with a confirmation dialog. + If the user presses No, then do nothing.

withErrorDialog :: IO a -> IO () Source #

Execute the given IO action. If the action throws exceptions, + visualize them via showErrorDialog.

textInputDialog Source #

Arguments

:: GlibString string 
=> string

window title

-> string

initial text in input widget

-> IO (Maybe String) 

Asks the user which directory copy mode he wants via dialog popup + and returns DirCopyMode.

\ No newline at end of file diff --git a/HSFM-GUI-Gtk-Errors.html b/HSFM-GUI-Gtk-Errors.html index 6d0a1f7..d53f6ba 100644 --- a/HSFM-GUI-Gtk-Errors.html +++ b/HSFM-GUI-Gtk-Errors.html @@ -1,4 +1,4 @@ HSFM.GUI.Gtk.Errors

hsfm-gtk

Safe HaskellSafe
LanguageHaskell2010

HSFM.GUI.Gtk.Errors

Description

Provides error handling for Gtk.

Documentation

data GtkException Source #

Constructors

UnknownDialogButton 

Instances

Show GtkException Source # 

Methods

showsPrec :: Int -> GtkException -> ShowS

show :: GtkException -> String

showList :: [GtkException] -> ShowS

Exception GtkException Source # 

Methods

toException :: GtkException -> SomeException

fromException :: SomeException -> Maybe GtkException

displayException :: GtkException -> String

\ No newline at end of file +

hsfm-gtk

Safe HaskellSafe
LanguageHaskell2010

HSFM.GUI.Gtk.Errors

Description

Provides error handling for Gtk.

Documentation

\ No newline at end of file diff --git a/HSFM-GUI-Gtk-Icons.html b/HSFM-GUI-Gtk-Icons.html index 1af4c5b..b294a00 100644 --- a/HSFM-GUI-Gtk-Icons.html +++ b/HSFM-GUI-Gtk-Icons.html @@ -1,5 +1,5 @@ HSFM.GUI.Gtk.Icons

hsfm-gtk

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.Icons

Description

Module for Gtk icon handling.

Synopsis

Documentation

data GtkIcon Source #

Icon type we use in our GUI.

Constructors

IFolder 
SymL 
IFile 
IError 

getIcon Source #

Arguments

:: GtkIcon

icon we want

-> IconTheme

which icon theme to get the icon from

-> Int

requested icon size

-> IO Pixbuf 

Gets an icon from the default icon theme and falls back to project-icons - if not found. The requested icon size is not guaranteed.

getSymlinkIcon :: GtkIcon -> IconTheme -> Int -> IO Pixbuf Source #

\ No newline at end of file +

hsfm-gtk

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.Icons

Description

Module for Gtk icon handling.

Synopsis

Documentation

data GtkIcon Source #

Icon type we use in our GUI.

Constructors

IFolder 
SymL 
IFile 
IError 

getIcon Source #

Arguments

:: GtkIcon

icon we want

-> IconTheme

which icon theme to get the icon from

-> Int

requested icon size

-> IO Pixbuf 

Gets an icon from the default icon theme and falls back to project-icons + if not found. The requested icon size is not guaranteed.

getSymlinkIcon :: GtkIcon -> IconTheme -> Int -> IO Pixbuf Source #

\ No newline at end of file diff --git a/HSFM-GUI-Gtk-MyGUI.html b/HSFM-GUI-Gtk-MyGUI.html index a1aaab1..1235750 100644 --- a/HSFM-GUI-Gtk-MyGUI.html +++ b/HSFM-GUI-Gtk-MyGUI.html @@ -1,4 +1,4 @@ HSFM.GUI.Gtk.MyGUI

hsfm-gtk

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.MyGUI

Synopsis

Documentation

createMyGUI :: IO MyGUI Source #

Set up the GUI. This only creates the permanent widgets.

\ No newline at end of file +

hsfm-gtk

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.MyGUI

Synopsis

Documentation

createMyGUI :: IO MyGUI Source #

Set up the GUI. This only creates the permanent widgets.

\ No newline at end of file diff --git a/HSFM-GUI-Gtk-MyView.html b/HSFM-GUI-Gtk-MyView.html index b317f79..2c5e2ff 100644 --- a/HSFM-GUI-Gtk-MyView.html +++ b/HSFM-GUI-Gtk-MyView.html @@ -1,14 +1,14 @@ HSFM.GUI.Gtk.MyView

hsfm-gtk

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.MyView

Synopsis

Documentation

newTab :: MyGUI -> IO FMView -> Path Abs -> IO MyView Source #

Creates a new tab with its own view and refreshes the view.

createMyView :: MyGUI -> IO FMView -> IO MyView Source #

Constructs the initial MyView object with a few dummy models. - It also initializes the callbacks.

switchView :: MyGUI -> MyView -> IO FMView -> IO () Source #

Switch the existing view in MyView with the one that the - io action returns.

destroyView :: MyGUI -> MyView -> IO Int Source #

Destroys the current view by disconnecting the watcher +

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.MyView

Documentation

newTab :: MyGUI -> IO FMView -> Path Abs -> IO MyView Source #

Creates a new tab with its own view and refreshes the view.

createMyView :: MyGUI -> IO FMView -> IO MyView Source #

Constructs the initial MyView object with a few dummy models. + It also initializes the callbacks.

switchView :: MyGUI -> MyView -> IO FMView -> IO () Source #

Switch the existing view in MyView with the one that the + io action returns.

destroyView :: MyGUI -> MyView -> IO Int Source #

Destroys the current view by disconnecting the watcher and destroying the active FMView container.

Everything that needs to be done in order to forget about a - view needs to be done here.

Returns the page in the tab list this view corresponds to.

createIconView :: IO FMView Source #

Createss an IconView.

createTreeView :: IO FMView Source #

Creates a TreeView.

refreshView :: MyGUI -> MyView -> Maybe (Path Abs) -> IO () Source #

Re-reads the current directory or the given one and updates the View. + view needs to be done here.

Returns the page in the tab list this view corresponds to.

createIconView :: IO FMView Source #

Createss an IconView.

createTreeView :: IO FMView Source #

Creates a TreeView.

refreshView :: MyGUI -> MyView -> Maybe (Path Abs) -> IO () Source #

Re-reads the current directory or the given one and updates the View. This is more or less a wrapper around refreshView'

If the third argument is Nothing, it tries to re-read the current directory. If that fails, it reads "/" instead.

If the third argument is (Just path) it tries to read "path". If that - fails, it reads "/" instead.

refreshView' :: MyGUI -> MyView -> Item -> IO () Source #

Refreshes the View based on the given directory.

If the directory is not a Dir or a Symlink pointing to a Dir, then - calls refreshView with the 3rd argument being Nothing.

constructView :: MyGUI -> MyView -> IO () Source #

Constructs the visible View with the current underlying mutable models, + fails, it reads "/" instead.

refreshView' :: MyGUI -> MyView -> Item -> IO () Source #

Refreshes the View based on the given directory.

If the directory is not a Dir or a Symlink pointing to a Dir, then + calls refreshView with the 3rd argument being Nothing.

constructView :: MyGUI -> MyView -> IO () Source #

Constructs the visible View with the current underlying mutable models, which are retrieved from MyGUI.

This sort of merges the components mygui and myview and fires up the actual models.

\ No newline at end of file diff --git a/HSFM-GUI-Gtk-Utils.html b/HSFM-GUI-Gtk-Utils.html index c6cfbc1..50481c6 100644 --- a/HSFM-GUI-Gtk-Utils.html +++ b/HSFM-GUI-Gtk-Utils.html @@ -1,11 +1,11 @@ HSFM.GUI.Gtk.Utils
Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.Utils

Synopsis

Documentation

getSelectedTreePaths :: MyGUI -> MyView -> IO [TreePath] Source #

getSelectedItems :: MyGUI -> MyView -> IO [Item] Source #

Gets the currently selected item of the treeView, if any.

withItems Source #

Arguments

:: MyGUI 
-> MyView 
-> ([Item] -> MyGUI -> MyView -> IO ())

action to carry out

-> IO () 

Carry out an action on the currently selected item.

If there is no item selected, does nothing.

fileListStore Source #

Arguments

:: Item

current dir

-> MyView 
-> IO (ListStore Item) 

Create the ListStore of files/directories from the current directory. +

Safe HaskellNone
LanguageHaskell2010

HSFM.GUI.Gtk.Utils

Synopsis

Documentation

getSelectedItems :: MyGUI -> MyView -> IO [Item] Source #

Gets the currently selected item of the treeView, if any.

withItems Source #

Arguments

:: MyGUI 
-> MyView 
-> ([Item] -> MyGUI -> MyView -> IO ())

action to carry out

-> IO () 

Carry out an action on the currently selected item.

If there is no item selected, does nothing.

fileListStore Source #

Arguments

:: Item

current dir

-> MyView 
-> IO (ListStore Item) 

Create the ListStore of files/directories from the current directory. This is the function which maps the Data.DirTree data structures - into the GTK+ data structures.

getFirstItem :: MyView -> IO Item Source #

Currently unsafe. This is used to obtain any item, which will - fail if there is none.

getCurrentDir :: MyView -> IO Item Source #

Reads the current directory from MyView.

This reads the MVar and may block the main thread if it's - empty.

pushStatusBar :: MyGUI -> String -> IO (ContextId, MessageId) Source #

Push a message to the status bar.

popStatusbar :: MyGUI -> IO () Source #

Pop a message from the status bar.

rawPathToIter :: MyView -> TreePath -> IO (Maybe TreeIter) Source #

Turn a path on the rawModel into a path that we can - use at the outermost model layer.

rawPathToItem :: MyView -> TreePath -> IO (Maybe Item) Source #

Turn a path on the rawModel into the corresponding item - that we can use at the outermost model layer.

addHistory :: Eq a => a -> [a] -> [a] Source #

Makes sure the list is max 5. This is probably not very efficient + into the GTK+ data structures.

getFirstItem :: MyView -> IO Item Source #

Currently unsafe. This is used to obtain any item, which will + fail if there is none.

getCurrentDir :: MyView -> IO Item Source #

Reads the current directory from MyView.

This reads the MVar and may block the main thread if it's + empty.

pushStatusBar :: MyGUI -> String -> IO (ContextId, MessageId) Source #

Push a message to the status bar.

popStatusbar :: MyGUI -> IO () Source #

Pop a message from the status bar.

rawPathToIter :: MyView -> TreePath -> IO (Maybe TreeIter) Source #

Turn a path on the rawModel into a path that we can + use at the outermost model layer.

rawPathToItem :: MyView -> TreePath -> IO (Maybe Item) Source #

Turn a path on the rawModel into the corresponding item + that we can use at the outermost model layer.

addHistory :: Eq a => a -> [a] -> [a] Source #

Makes sure the list is max 5. This is probably not very efficient but we don't care, since it's a small list anyway.

\ No newline at end of file diff --git a/HSFM-Utils-IO.html b/HSFM-Utils-IO.html index 77562e1..a9b63bb 100644 --- a/HSFM-Utils-IO.html +++ b/HSFM-Utils-IO.html @@ -1,4 +1,4 @@ HSFM.Utils.IO
Safe HaskellSafe
LanguageHaskell2010

HSFM.Utils.IO

Description

Random and general IO utilities.

Synopsis

Documentation

writeTVarIO :: TVar a -> a -> IO () Source #

Atomically write a TVar.

modifyTVarIO :: TVar a -> (a -> a) -> IO () Source #

Atomically modify a TVar.

\ No newline at end of file +
Safe HaskellSafe
LanguageHaskell2010

HSFM.Utils.IO

Description

Random and general IO utilities.

Synopsis

Documentation

writeTVarIO :: TVar a -> a -> IO () Source #

Atomically write a TVar.

modifyTVarIO :: TVar a -> (a -> a) -> IO () Source #

Atomically modify a TVar.

\ No newline at end of file diff --git a/HSFM-Utils-MyPrelude.html b/HSFM-Utils-MyPrelude.html index f8a70a5..817e36b 100644 --- a/HSFM-Utils-MyPrelude.html +++ b/HSFM-Utils-MyPrelude.html @@ -1,6 +1,6 @@ HSFM.Utils.MyPrelude
Safe HaskellNone
LanguageHaskell2010

HSFM.Utils.MyPrelude

Synopsis

Documentation

listIndices :: [a] -> [Int] Source #

Turns any list into a list of the same length with the values +

Safe HaskellNone
LanguageHaskell2010

HSFM.Utils.MyPrelude

Synopsis

Documentation

listIndices :: [a] -> [Int] Source #

Turns any list into a list of the same length with the values being the indices. - E.g.: "abdasd" -> [0,1,2,3,4,5]

maybeD :: Default b => (a -> b) -> Maybe a -> b Source #

A maybe flavor using the Default class.

\ No newline at end of file + E.g.: "abdasd" -> [0,1,2,3,4,5]

maybeD :: Default b => (a -> b) -> Maybe a -> b Source #

A maybe flavor using the Default class.

\ No newline at end of file diff --git a/Main.html b/Main.html index 06224c1..215f314 100644 --- a/Main.html +++ b/Main.html @@ -1,4 +1,4 @@ Main
Safe HaskellNone
LanguageHaskell2010

Main

Documentation

main :: IO () Source #

\ No newline at end of file +
Safe HaskellNone
LanguageHaskell2010

Main

Documentation

main :: IO () Source #

\ No newline at end of file diff --git a/Paths_hsfm.html b/Paths_hsfm.html index 9af005c..0bd468a 100644 --- a/Paths_hsfm.html +++ b/Paths_hsfm.html @@ -1,4 +1,4 @@ Paths_hsfm
Safe HaskellSafe
LanguageHaskell2010

Paths_hsfm

Documentation

version :: Version Source #

getBinDir :: IO FilePath Source #

getLibDir :: IO FilePath Source #

getDataDir :: IO FilePath Source #

getLibexecDir :: IO FilePath Source #

getDataFileName :: FilePath -> IO FilePath Source #

getSysconfDir :: IO FilePath Source #

\ No newline at end of file + \ No newline at end of file diff --git a/doc-index-All.html b/doc-index-All.html index 4640cdb..5105eb0 100644 --- a/doc-index-All.html +++ b/doc-index-All.html @@ -1,4 +1,4 @@ hsfm-gtk (Index)

Index

accessTimeHSFM.FileSystem.FileType
accessTimeHiResHSFM.FileSystem.FileType
addHistoryHSFM.GUI.Gtk.Utils
anyFailedHSFM.FileSystem.FileType
BlockDevHSFM.FileSystem.FileType
BrokenSymlinkHSFM.FileSystem.FileType
brokenSymlinkHSFM.FileSystem.FileType
CharDevHSFM.FileSystem.FileType
clearStatusBarHSFM.GUI.Gtk.Data
closeTabHSFM.GUI.Gtk.Callbacks
comparingConstrHSFM.FileSystem.FileType
constructViewHSFM.GUI.Gtk.MyView
Copy 
1 (Type/Class)HSFM.FileSystem.UtilTypes
2 (Data Constructor)HSFM.FileSystem.UtilTypes
copyInitHSFM.GUI.Gtk.Callbacks
createIconViewHSFM.GUI.Gtk.MyView
createMyGUIHSFM.GUI.Gtk.MyGUI
createMyViewHSFM.GUI.Gtk.MyView
createTreeViewHSFM.GUI.Gtk.MyView
cwdHSFM.GUI.Gtk.Data
c_strlenHSFM.GUI.Glib.GlibString
delHSFM.GUI.Gtk.Callbacks
destroyViewHSFM.GUI.Gtk.MyView
deviceIDHSFM.FileSystem.FileType
DirHSFM.FileSystem.FileType
DirListHSFM.FileSystem.FileType
DirOrSymHSFM.FileSystem.FileType
DirSymHSFM.FileSystem.FileType
dirSymHSFM.FileSystem.FileType
doFileOperationHSFM.GUI.Gtk.Callbacks.Utils
epochToStringHSFM.FileSystem.FileType
errHSFM.FileSystem.FileType
executeHSFM.GUI.Gtk.Callbacks
FailedHSFM.FileSystem.FileType
failedHSFM.FileSystem.FileType
failuresHSFM.FileSystem.FileType
FCollisonModeHSFM.FileSystem.UtilTypes
FCopyHSFM.FileSystem.UtilTypes
FDeleteHSFM.FileSystem.UtilTypes
FExecuteHSFM.FileSystem.UtilTypes
FileHSFM.FileSystem.FileType
fileCollisionDialogHSFM.GUI.Gtk.Dialogs
fileGroupHSFM.FileSystem.FileType
fileIDHSFM.FileSystem.FileType
FileInfo 
1 (Type/Class)HSFM.FileSystem.FileType
2 (Data Constructor)HSFM.FileSystem.FileType
FileLikeHSFM.FileSystem.FileType
fileLikeHSFM.FileSystem.FileType
FileLikeListHSFM.FileSystem.FileType
FileLikeOrSymHSFM.FileSystem.FileType
FileLikeSymHSFM.FileSystem.FileType
fileLikeSymHSFM.FileSystem.FileType
fileListStoreHSFM.GUI.Gtk.Utils
fileModeHSFM.FileSystem.FileType
FileOperationHSFM.FileSystem.UtilTypes
fileOwnerHSFM.FileSystem.FileType
FilePropertyGridHSFM.GUI.Gtk.Data
fileSizeHSFM.FileSystem.FileType
filteredModelHSFM.GUI.Gtk.Data
FMIconViewHSFM.GUI.Gtk.Data
FMoveHSFM.FileSystem.UtilTypes
FMSettingsHSFM.GUI.Gtk.Data
FMTreeViewHSFM.GUI.Gtk.Data
FMViewHSFM.GUI.Gtk.Data
fmViewToContainerHSFM.GUI.Gtk.Data
FOpenHSFM.FileSystem.UtilTypes
fpropHSFM.GUI.Gtk.Data
fpropAcEntryHSFM.GUI.Gtk.Data
fpropFnEntryHSFM.GUI.Gtk.Data
fpropFTEntryHSFM.GUI.Gtk.Data
fpropGridHSFM.GUI.Gtk.Data
fpropLDEntryHSFM.GUI.Gtk.Data
fpropLocEntryHSFM.GUI.Gtk.Data
fpropModEntryHSFM.GUI.Gtk.Data
fpropPermEntryHSFM.GUI.Gtk.Data
fpropTsEntryHSFM.GUI.Gtk.Data
fromFreeVarHSFM.FileSystem.FileType
fvarHSFM.FileSystem.FileType
getBinDirPaths_hsfm
getContentsHSFM.FileSystem.FileType
getCurrentDirHSFM.GUI.Gtk.Utils
getDataDirPaths_hsfm
getDataFileNamePaths_hsfm
getFileInfoHSFM.FileSystem.FileType
getFirstItemHSFM.GUI.Gtk.Utils
getFPasStrHSFM.FileSystem.FileType
getFreeVarHSFM.FileSystem.FileType
getIconHSFM.GUI.Gtk.Icons
getLibDirPaths_hsfm
getLibexecDirPaths_hsfm
getSelectedItemsHSFM.GUI.Gtk.Utils
getSelectedTreePathsHSFM.GUI.Gtk.Utils
getSymlinkIconHSFM.GUI.Gtk.Icons
getSysconfDirPaths_hsfm
goDirHSFM.GUI.Gtk.Callbacks.Utils
goHistoryNextHSFM.GUI.Gtk.Callbacks
goHistoryPrevHSFM.GUI.Gtk.Callbacks
goHomeHSFM.GUI.Gtk.Callbacks
goUpHSFM.FileSystem.FileType
goUp'HSFM.FileSystem.FileType
GtkExceptionHSFM.GUI.Gtk.Errors
GtkIconHSFM.GUI.Gtk.Icons
handleDTHSFM.FileSystem.FileType
historyHSFM.GUI.Gtk.Data
homeViewBHSFM.GUI.Gtk.Data
iconSizeHSFM.GUI.Gtk.Data
IErrorHSFM.GUI.Gtk.Icons
IFileHSFM.GUI.Gtk.Icons
IFolderHSFM.GUI.Gtk.Icons
inotifyHSFM.GUI.Gtk.Data
isBlockCHSFM.FileSystem.FileType
isBrokenSymlinkHSFM.FileSystem.FileType
isCharCHSFM.FileSystem.FileType
isDirCHSFM.FileSystem.FileType
isFileCHSFM.FileSystem.FileType
isLazyHSFM.GUI.Gtk.Data
isNamedCHSFM.FileSystem.FileType
isSocketCHSFM.FileSystem.FileType
isSymCHSFM.FileSystem.FileType
ItemHSFM.GUI.Gtk.Data
linkCountHSFM.FileSystem.FileType
listIndicesHSFM.Utils.MyPrelude
mainMain
maybeDHSFM.Utils.MyPrelude
MenuBarHSFM.GUI.Gtk.Data
menubarHSFM.GUI.Gtk.Data
menubarFileQuitHSFM.GUI.Gtk.Data
menubarHelpAboutHSFM.GUI.Gtk.Data
MkFilePropertyGridHSFM.GUI.Gtk.Data
MkFMSettingsHSFM.GUI.Gtk.Data
MkMenuBarHSFM.GUI.Gtk.Data
MkMyGUIHSFM.GUI.Gtk.Data
MkMyViewHSFM.GUI.Gtk.Data
MkRightClickMenuHSFM.GUI.Gtk.Data
modificationTimeHSFM.FileSystem.FileType
modificationTimeHiResHSFM.FileSystem.FileType
modifyTVarIOHSFM.Utils.IO
Move 
1 (Type/Class)HSFM.FileSystem.UtilTypes
2 (Data Constructor)HSFM.FileSystem.UtilTypes
moveInitHSFM.GUI.Gtk.Callbacks
MyGUIHSFM.GUI.Gtk.Data
MyViewHSFM.GUI.Gtk.Data
NamedPipeHSFM.FileSystem.FileType
newDirHSFM.GUI.Gtk.Callbacks
newFileHSFM.GUI.Gtk.Callbacks
newTabHSFM.GUI.Gtk.MyView
newTabHereHSFM.GUI.Gtk.Callbacks
NoneHSFM.FileSystem.UtilTypes
noNullPtrsHSFM.GUI.Glib.GlibString
notebookHSFM.GUI.Gtk.Data
openHSFM.GUI.Gtk.Callbacks
openTerminalHereHSFM.GUI.Gtk.Callbacks
operationBufferHSFM.GUI.Gtk.Data
operationFinalHSFM.GUI.Gtk.Callbacks
OverwriteHSFM.FileSystem.UtilTypes
OverwriteAllHSFM.FileSystem.UtilTypes
packAccessTimeHSFM.FileSystem.FileType
packFileTypeHSFM.FileSystem.FileType
packLinkDestinationHSFM.FileSystem.FileType
packModTimeHSFM.FileSystem.FileType
packPermissionsHSFM.FileSystem.FileType
PartialCopyHSFM.FileSystem.UtilTypes
PartialMoveHSFM.FileSystem.UtilTypes
pathHSFM.FileSystem.FileType
popStatusbarHSFM.GUI.Gtk.Utils
pushStatusBarHSFM.GUI.Gtk.Utils
rawdestHSFM.FileSystem.FileType
rawModelHSFM.GUI.Gtk.Data
rawPathToItemHSFM.GUI.Gtk.Utils
rawPathToIterHSFM.GUI.Gtk.Utils
rcFileCopyHSFM.GUI.Gtk.Data
rcFileCutHSFM.GUI.Gtk.Data
rcFileDeleteHSFM.GUI.Gtk.Data
rcFileExecuteHSFM.GUI.Gtk.Data
rcFileIconViewHSFM.GUI.Gtk.Data
rcFileNewDirHSFM.GUI.Gtk.Data
rcFileNewRegFileHSFM.GUI.Gtk.Data
rcFileOpenHSFM.GUI.Gtk.Data
rcFilePasteHSFM.GUI.Gtk.Data
rcFilePropertyHSFM.GUI.Gtk.Data
rcFileRenameHSFM.GUI.Gtk.Data
rcFileTreeViewHSFM.GUI.Gtk.Data
rcMenuHSFM.GUI.Gtk.Data
rcmenuHSFM.GUI.Gtk.Data
readDirectoryContentsHSFM.FileSystem.FileType
readFileHSFM.FileSystem.FileType
refreshViewHSFM.GUI.Gtk.MyView
refreshView'HSFM.GUI.Gtk.MyView
refreshViewBHSFM.GUI.Gtk.Data
RegFileHSFM.FileSystem.FileType
RenameHSFM.FileSystem.UtilTypes
renameDialogHSFM.GUI.Gtk.Dialogs
renameFHSFM.GUI.Gtk.Callbacks
RightClickMenuHSFM.GUI.Gtk.Data
rootWinHSFM.GUI.Gtk.Data
scrollHSFM.GUI.Gtk.Data
sdestHSFM.FileSystem.FileType
sdirHSFM.FileSystem.FileType
setGUICallbacksHSFM.GUI.Gtk.Callbacks
settingsHSFM.GUI.Gtk.Data
setViewCallbacksHSFM.GUI.Gtk.Callbacks
sfileLikeHSFM.FileSystem.FileType
showAboutDialogHSFM.GUI.Gtk.Dialogs
showConfirmationDialogHSFM.GUI.Gtk.Dialogs
showErrorDialogHSFM.GUI.Gtk.Dialogs
showFilePropertyDialogHSFM.GUI.Gtk.Dialogs
showHiddenHSFM.GUI.Gtk.Data
SkipHSFM.FileSystem.UtilTypes
SocketHSFM.FileSystem.FileType
sortedModelHSFM.GUI.Gtk.Data
specialDeviceIDHSFM.FileSystem.FileType
statusBarHSFM.GUI.Gtk.Data
statusChangeTimeHSFM.FileSystem.FileType
statusChangeTimeHiResHSFM.FileSystem.FileType
StrictHSFM.FileSystem.UtilTypes
successfulHSFM.FileSystem.FileType
switchViewHSFM.GUI.Gtk.MyView
SymLHSFM.GUI.Gtk.Icons
SymLinkHSFM.FileSystem.FileType
textInputDialogHSFM.GUI.Gtk.Dialogs
UnknownDialogButtonHSFM.GUI.Gtk.Errors
upDirHSFM.GUI.Gtk.Callbacks
upViewBHSFM.GUI.Gtk.Data
urlBarHSFM.GUI.Gtk.Data
urlGoToHSFM.GUI.Gtk.Callbacks
versionPaths_hsfm
viewHSFM.GUI.Gtk.Data
viewBoxHSFM.GUI.Gtk.Data
withConfirmationDialogHSFM.GUI.Gtk.Dialogs
withErrorDialogHSFM.GUI.Gtk.Dialogs
withItemsHSFM.GUI.Gtk.Utils
writeTVarIOHSFM.Utils.IO
_doFileOperationHSFM.GUI.Gtk.Callbacks.Utils
\ No newline at end of file +

Index

accessTimeHSFM.FileSystem.FileType
accessTimeHiResHSFM.FileSystem.FileType
addHistoryHSFM.GUI.Gtk.Utils
anyFailedHSFM.FileSystem.FileType
BlockDevHSFM.FileSystem.FileType
BrokenSymlinkHSFM.FileSystem.FileType
brokenSymlinkHSFM.FileSystem.FileType
CharDevHSFM.FileSystem.FileType
clearStatusBarHSFM.GUI.Gtk.Data
closeTabHSFM.GUI.Gtk.Callbacks
comparingConstrHSFM.FileSystem.FileType
constructViewHSFM.GUI.Gtk.MyView
Copy 
1 (Type/Class)HSFM.FileSystem.UtilTypes
2 (Data Constructor)HSFM.FileSystem.UtilTypes
copyInitHSFM.GUI.Gtk.Callbacks
createIconViewHSFM.GUI.Gtk.MyView
createMyGUIHSFM.GUI.Gtk.MyGUI
createMyViewHSFM.GUI.Gtk.MyView
createTreeViewHSFM.GUI.Gtk.MyView
cwdHSFM.GUI.Gtk.Data
c_strlenHSFM.GUI.Glib.GlibString
delHSFM.GUI.Gtk.Callbacks
destroyViewHSFM.GUI.Gtk.MyView
deviceIDHSFM.FileSystem.FileType
DirHSFM.FileSystem.FileType
DirListHSFM.FileSystem.FileType
DirOrSymHSFM.FileSystem.FileType
DirSymHSFM.FileSystem.FileType
dirSymHSFM.FileSystem.FileType
doFileOperationHSFM.GUI.Gtk.Callbacks.Utils
epochToStringHSFM.FileSystem.FileType
errHSFM.FileSystem.FileType
executeHSFM.GUI.Gtk.Callbacks
FailedHSFM.FileSystem.FileType
failedHSFM.FileSystem.FileType
failuresHSFM.FileSystem.FileType
FCollisonModeHSFM.FileSystem.UtilTypes
FCopyHSFM.FileSystem.UtilTypes
FDeleteHSFM.FileSystem.UtilTypes
FExecuteHSFM.FileSystem.UtilTypes
FileHSFM.FileSystem.FileType
fileCollisionDialogHSFM.GUI.Gtk.Dialogs
fileGroupHSFM.FileSystem.FileType
fileIDHSFM.FileSystem.FileType
FileInfo 
1 (Type/Class)HSFM.FileSystem.FileType
2 (Data Constructor)HSFM.FileSystem.FileType
FileLikeHSFM.FileSystem.FileType
fileLikeHSFM.FileSystem.FileType
FileLikeListHSFM.FileSystem.FileType
FileLikeOrSymHSFM.FileSystem.FileType
FileLikeSymHSFM.FileSystem.FileType
fileLikeSymHSFM.FileSystem.FileType
fileListStoreHSFM.GUI.Gtk.Utils
fileModeHSFM.FileSystem.FileType
FileOperationHSFM.FileSystem.UtilTypes
fileOwnerHSFM.FileSystem.FileType
FilePropertyGridHSFM.GUI.Gtk.Data
fileSizeHSFM.FileSystem.FileType
filteredModelHSFM.GUI.Gtk.Data
FMIconViewHSFM.GUI.Gtk.Data
FMoveHSFM.FileSystem.UtilTypes
FMSettingsHSFM.GUI.Gtk.Data
FMTreeViewHSFM.GUI.Gtk.Data
FMViewHSFM.GUI.Gtk.Data
fmViewToContainerHSFM.GUI.Gtk.Data
FOpenHSFM.FileSystem.UtilTypes
fpropHSFM.GUI.Gtk.Data
fpropAcEntryHSFM.GUI.Gtk.Data
fpropFnEntryHSFM.GUI.Gtk.Data
fpropFTEntryHSFM.GUI.Gtk.Data
fpropGridHSFM.GUI.Gtk.Data
fpropLDEntryHSFM.GUI.Gtk.Data
fpropLocEntryHSFM.GUI.Gtk.Data
fpropModEntryHSFM.GUI.Gtk.Data
fpropPermEntryHSFM.GUI.Gtk.Data
fpropTsEntryHSFM.GUI.Gtk.Data
fromFreeVarHSFM.FileSystem.FileType
fvarHSFM.FileSystem.FileType
getBinDirPaths_hsfm
getContentsHSFM.FileSystem.FileType
getCurrentDirHSFM.GUI.Gtk.Utils
getDataDirPaths_hsfm
getDataFileNamePaths_hsfm
getFileInfoHSFM.FileSystem.FileType
getFirstItemHSFM.GUI.Gtk.Utils
getFPasStrHSFM.FileSystem.FileType
getFreeVarHSFM.FileSystem.FileType
getIconHSFM.GUI.Gtk.Icons
getLibDirPaths_hsfm
getLibexecDirPaths_hsfm
getSelectedItemsHSFM.GUI.Gtk.Utils
getSelectedTreePathsHSFM.GUI.Gtk.Utils
getSymlinkIconHSFM.GUI.Gtk.Icons
getSysconfDirPaths_hsfm
goDirHSFM.GUI.Gtk.Callbacks.Utils
goHistoryNextHSFM.GUI.Gtk.Callbacks
goHistoryPrevHSFM.GUI.Gtk.Callbacks
goHomeHSFM.GUI.Gtk.Callbacks
goUpHSFM.FileSystem.FileType
goUp'HSFM.FileSystem.FileType
GtkExceptionHSFM.GUI.Gtk.Errors
GtkIconHSFM.GUI.Gtk.Icons
handleDTHSFM.FileSystem.FileType
historyHSFM.GUI.Gtk.Data
homeViewBHSFM.GUI.Gtk.Data
iconSizeHSFM.GUI.Gtk.Data
IErrorHSFM.GUI.Gtk.Icons
IFileHSFM.GUI.Gtk.Icons
IFolderHSFM.GUI.Gtk.Icons
inotifyHSFM.GUI.Gtk.Data
isBlockCHSFM.FileSystem.FileType
isBrokenSymlinkHSFM.FileSystem.FileType
isCharCHSFM.FileSystem.FileType
isDirCHSFM.FileSystem.FileType
isFileCHSFM.FileSystem.FileType
isLazyHSFM.GUI.Gtk.Data
isNamedCHSFM.FileSystem.FileType
isSocketCHSFM.FileSystem.FileType
isSymCHSFM.FileSystem.FileType
ItemHSFM.GUI.Gtk.Data
linkCountHSFM.FileSystem.FileType
listIndicesHSFM.Utils.MyPrelude
mainMain
maybeDHSFM.Utils.MyPrelude
MenuBarHSFM.GUI.Gtk.Data
menubarHSFM.GUI.Gtk.Data
menubarFileQuitHSFM.GUI.Gtk.Data
menubarHelpAboutHSFM.GUI.Gtk.Data
MkFilePropertyGridHSFM.GUI.Gtk.Data
MkFMSettingsHSFM.GUI.Gtk.Data
MkMenuBarHSFM.GUI.Gtk.Data
MkMyGUIHSFM.GUI.Gtk.Data
MkMyViewHSFM.GUI.Gtk.Data
MkRightClickMenuHSFM.GUI.Gtk.Data
modificationTimeHSFM.FileSystem.FileType
modificationTimeHiResHSFM.FileSystem.FileType
modifyTVarIOHSFM.Utils.IO
Move 
1 (Type/Class)HSFM.FileSystem.UtilTypes
2 (Data Constructor)HSFM.FileSystem.UtilTypes
moveInitHSFM.GUI.Gtk.Callbacks
MyGUIHSFM.GUI.Gtk.Data
MyViewHSFM.GUI.Gtk.Data
NamedPipeHSFM.FileSystem.FileType
newDirHSFM.GUI.Gtk.Callbacks
newFileHSFM.GUI.Gtk.Callbacks
newTabHSFM.GUI.Gtk.MyView
NoneHSFM.FileSystem.UtilTypes
noNullPtrsHSFM.GUI.Glib.GlibString
notebookHSFM.GUI.Gtk.Data
openHSFM.GUI.Gtk.Callbacks
openTerminalHereHSFM.GUI.Gtk.Callbacks
operationBufferHSFM.GUI.Gtk.Data
operationFinalHSFM.GUI.Gtk.Callbacks
OverwriteHSFM.FileSystem.UtilTypes
OverwriteAllHSFM.FileSystem.UtilTypes
packAccessTimeHSFM.FileSystem.FileType
packFileTypeHSFM.FileSystem.FileType
packLinkDestinationHSFM.FileSystem.FileType
packModTimeHSFM.FileSystem.FileType
packPermissionsHSFM.FileSystem.FileType
PartialCopyHSFM.FileSystem.UtilTypes
PartialMoveHSFM.FileSystem.UtilTypes
pathHSFM.FileSystem.FileType
popStatusbarHSFM.GUI.Gtk.Utils
pushStatusBarHSFM.GUI.Gtk.Utils
rawdestHSFM.FileSystem.FileType
rawModelHSFM.GUI.Gtk.Data
rawPathToItemHSFM.GUI.Gtk.Utils
rawPathToIterHSFM.GUI.Gtk.Utils
rcFileCopyHSFM.GUI.Gtk.Data
rcFileCutHSFM.GUI.Gtk.Data
rcFileDeleteHSFM.GUI.Gtk.Data
rcFileExecuteHSFM.GUI.Gtk.Data
rcFileIconViewHSFM.GUI.Gtk.Data
rcFileNewDirHSFM.GUI.Gtk.Data
rcFileNewRegFileHSFM.GUI.Gtk.Data
rcFileOpenHSFM.GUI.Gtk.Data
rcFilePasteHSFM.GUI.Gtk.Data
rcFilePropertyHSFM.GUI.Gtk.Data
rcFileRenameHSFM.GUI.Gtk.Data
rcFileTreeViewHSFM.GUI.Gtk.Data
rcMenuHSFM.GUI.Gtk.Data
rcmenuHSFM.GUI.Gtk.Data
readDirectoryContentsHSFM.FileSystem.FileType
readFileHSFM.FileSystem.FileType
refreshViewHSFM.GUI.Gtk.MyView
refreshView'HSFM.GUI.Gtk.MyView
refreshViewBHSFM.GUI.Gtk.Data
RegFileHSFM.FileSystem.FileType
RenameHSFM.FileSystem.UtilTypes
renameDialogHSFM.GUI.Gtk.Dialogs
renameFHSFM.GUI.Gtk.Callbacks
RightClickMenuHSFM.GUI.Gtk.Data
rootWinHSFM.GUI.Gtk.Data
scrollHSFM.GUI.Gtk.Data
sdestHSFM.FileSystem.FileType
sdirHSFM.FileSystem.FileType
setGUICallbacksHSFM.GUI.Gtk.Callbacks
settingsHSFM.GUI.Gtk.Data
setViewCallbacksHSFM.GUI.Gtk.Callbacks
sfileLikeHSFM.FileSystem.FileType
showAboutDialogHSFM.GUI.Gtk.Dialogs
showConfirmationDialogHSFM.GUI.Gtk.Dialogs
showErrorDialogHSFM.GUI.Gtk.Dialogs
showFilePropertyDialogHSFM.GUI.Gtk.Dialogs
showHiddenHSFM.GUI.Gtk.Data
SkipHSFM.FileSystem.UtilTypes
SocketHSFM.FileSystem.FileType
sortedModelHSFM.GUI.Gtk.Data
specialDeviceIDHSFM.FileSystem.FileType
statusBarHSFM.GUI.Gtk.Data
statusChangeTimeHSFM.FileSystem.FileType
statusChangeTimeHiResHSFM.FileSystem.FileType
StrictHSFM.FileSystem.UtilTypes
successfulHSFM.FileSystem.FileType
switchViewHSFM.GUI.Gtk.MyView
SymLHSFM.GUI.Gtk.Icons
SymLinkHSFM.FileSystem.FileType
textInputDialogHSFM.GUI.Gtk.Dialogs
UnknownDialogButtonHSFM.GUI.Gtk.Errors
upDirHSFM.GUI.Gtk.Callbacks
upViewBHSFM.GUI.Gtk.Data
urlBarHSFM.GUI.Gtk.Data
urlGoToHSFM.GUI.Gtk.Callbacks
versionPaths_hsfm
viewHSFM.GUI.Gtk.Data
viewBoxHSFM.GUI.Gtk.Data
withConfirmationDialogHSFM.GUI.Gtk.Dialogs
withErrorDialogHSFM.GUI.Gtk.Dialogs
withItemsHSFM.GUI.Gtk.Utils
writeTVarIOHSFM.Utils.IO
_doFileOperationHSFM.GUI.Gtk.Callbacks.Utils
\ No newline at end of file diff --git a/doc-index-N.html b/doc-index-N.html index bafb9a6..e09d580 100644 --- a/doc-index-N.html +++ b/doc-index-N.html @@ -1,4 +1,4 @@ hsfm-gtk (Index - N) \ No newline at end of file + \ No newline at end of file diff --git a/hsfm.haddock b/hsfm.haddock index 9c4b758..e2f3f0f 100644 Binary files a/hsfm.haddock and b/hsfm.haddock differ diff --git a/mini_HSFM-GUI-Gtk-Callbacks.html b/mini_HSFM-GUI-Gtk-Callbacks.html index 41cf993..e81550f 100644 --- a/mini_HSFM-GUI-Gtk-Callbacks.html +++ b/mini_HSFM-GUI-Gtk-Callbacks.html @@ -1,4 +1,4 @@ HSFM.GUI.Gtk.Callbacks

HSFM.GUI.Gtk.Callbacks

\ No newline at end of file +

HSFM.GUI.Gtk.Callbacks

\ No newline at end of file diff --git a/src/HSFM-GUI-Gtk-Callbacks.html b/src/HSFM-GUI-Gtk-Callbacks.html index 2363dfb..ea65207 100644 --- a/src/HSFM-GUI-Gtk-Callbacks.html +++ b/src/HSFM-GUI-Gtk-Callbacks.html @@ -31,524 +31,513 @@ module HSFM.GUI.Gtk.Callbacks where -import Control.Applicative +import Control.Concurrent.STM ( - (<$>) + readTVarIO ) -import Control.Concurrent.STM +import Control.Exception ( - readTVarIO + throwIO ) -import Control.Exception +import Control.Monad ( - throwIO - ) -import Control.Monad - ( - forM_ - , void - , when + forM_ + , void + , when + ) +import Control.Monad.IO.Class + ( + liftIO ) -import Control.Monad.IO.Class +import Data.ByteString ( - liftIO + ByteString ) -import Data.ByteString +import Data.ByteString.UTF8 ( - ByteString - ) -import Data.ByteString.UTF8 - ( - fromString - , toString + fromString + , toString + ) +import Data.Foldable + ( + for_ ) -import Data.Foldable - ( - for_ - ) -import Graphics.UI.Gtk -import qualified HPath as P -import HPath - ( - Abs - , Path - ) -import HPath.IO -import HPath.IO.Errors -import HPath.IO.Utils -import HSFM.FileSystem.FileType -import HSFM.FileSystem.UtilTypes -import HSFM.GUI.Gtk.Callbacks.Utils -import HSFM.GUI.Gtk.Data -import HSFM.GUI.Gtk.Dialogs -import HSFM.GUI.Gtk.MyView -import HSFM.GUI.Gtk.Utils -import HSFM.Utils.IO -import Prelude hiding(readFile) -import System.Glib.UTFString +import Graphics.UI.Gtk +import qualified HPath as P +import HPath + ( + Abs + , Path + ) +import HPath.IO +import HPath.IO.Errors +import HPath.IO.Utils +import HSFM.FileSystem.FileType +import HSFM.FileSystem.UtilTypes +import HSFM.GUI.Gtk.Callbacks.Utils +import HSFM.GUI.Gtk.Data +import HSFM.GUI.Gtk.Dialogs +import HSFM.GUI.Gtk.MyView +import HSFM.GUI.Gtk.Utils +import HSFM.Utils.IO +import Prelude hiding(readFile) +import System.Glib.UTFString + ( + glibToString + ) +import System.Posix.Env.ByteString ( - glibToString + getEnv ) -import System.Posix.Env.ByteString - ( - getEnv - ) -import qualified System.Posix.Process.ByteString as SPP -import System.Posix.Types - ( - ProcessID - ) +import qualified System.Posix.Process.ByteString as SPP +import System.Posix.Types + ( + ProcessID + ) + + + + - - - + ----------------- + --[ Callbacks ]-- + ----------------- - ----------------- - --[ Callbacks ]-- - ----------------- - + + + +---- MAIN CALLBACK ENTRYPOINT ---- - ----- MAIN CALLBACK ENTRYPOINT ---- - +-- |Set callbacks for the whole gui, on hotkeys, events and stuff. +setGUICallbacks :: MyGUI -> IO () +setGUICallbacks mygui = do --- |Set callbacks for the whole gui, on hotkeys, events and stuff. -setGUICallbacks :: MyGUI -> IO () -setGUICallbacks mygui = do + _ <- clearStatusBar mygui `on` buttonActivated $ do + popStatusbar mygui + writeTVarIO (operationBuffer mygui) None - _ <- clearStatusBar mygui `on` buttonActivated $ do - popStatusbar mygui - writeTVarIO (operationBuffer mygui) None + -- menubar-file + _ <- (menubarFileQuit . menubar) mygui `on` menuItemActivated $ + mainQuit - -- menubar-file - _ <- (menubarFileQuit . menubar) mygui `on` menuItemActivated $ - mainQuit - - -- menubar-help - _ <- (menubarHelpAbout . menubar) mygui `on` menuItemActivated $ - liftIO showAboutDialog - return () - - -- key events - _ <- rootWin mygui `on` keyPressEvent $ tryEvent $ do - [Control] <- eventModifier - "q" <- fmap glibToString eventKeyName - liftIO mainQuit - - return () - - --- |Set callbacks specific to a given view, on hotkeys, events and stuff. -setViewCallbacks :: MyGUI -> MyView -> IO () -setViewCallbacks mygui myview = do - view' <- readTVarIO $ view myview - case view' of - fmv@(FMTreeView treeView) -> do - _ <- treeView `on` rowActivated - $ (\_ _ -> withItems mygui myview open) - - -- drag events - _ <- treeView `on` dragBegin $ - \_ -> withItems mygui myview moveInit - _ <- treeView `on` dragDrop $ - \dc p ts -> do - p' <- treeViewConvertWidgetToTreeCoords treeView p - mpath <- treeViewGetPathAtPos treeView p' - case mpath of - Nothing -> do - dragFinish dc False False ts - return False - Just _ -> do - atom <- atomNew ("HSFM" :: String) - dragGetData treeView dc atom ts - return True - _ <- treeView `on` dragDataReceived $ - \dc p _ ts -> - liftIO $ do - signalStopEmission treeView "drag_data_received" - p' <- treeViewConvertWidgetToTreeCoords treeView p - mpath <- treeViewGetPathAtPos treeView p' - case mpath of - Nothing -> dragFinish dc False False ts - Just (tp, _, _) -> do - mitem <- rawPathToItem myview tp - forM_ mitem $ \item -> - operationFinal mygui myview (Just item) - dragFinish dc True False ts - - commonGuiEvents fmv - return () - fmv@(FMIconView iconView) -> do - _ <- iconView `on` itemActivated - $ (\_ -> withItems mygui myview open) - commonGuiEvents fmv - return () - where - commonGuiEvents fmv = do - let view = fmViewToContainer fmv - - -- GUI events - _ <- urlBar myview `on` entryActivated $ urlGoTo mygui myview - _ <- upViewB myview `on` buttonActivated $ - upDir mygui myview - _ <- homeViewB myview `on` buttonActivated $ - goHome mygui myview - _ <- refreshViewB myview `on` buttonActivated $ do - cdir <- liftIO $ getCurrentDir myview - refreshView' mygui myview cdir - - -- key events - _ <- viewBox myview `on` keyPressEvent $ tryEvent $ do - [Control] <- eventModifier - "h" <- fmap glibToString eventKeyName - cdir <- liftIO $ getCurrentDir myview - liftIO $ modifyTVarIO (settings mygui) - (\x -> x { showHidden = not . showHidden $ x}) - >> refreshView' mygui myview cdir + -- menubar-help + _ <- (menubarHelpAbout . menubar) mygui `on` menuItemActivated $ + liftIO showAboutDialog + return () + + -- key events + _ <- rootWin mygui `on` keyPressEvent $ tryEvent $ do + [Control] <- eventModifier + "q" <- fmap glibToString eventKeyName + liftIO mainQuit + + return () + + +-- |Set callbacks specific to a given view, on hotkeys, events and stuff. +setViewCallbacks :: MyGUI -> MyView -> IO () +setViewCallbacks mygui myview = do + view' <- readTVarIO $ view myview + case view' of + fmv@(FMTreeView treeView) -> do + _ <- treeView `on` rowActivated + $ (\_ _ -> withItems mygui myview open) + + -- drag events + _ <- treeView `on` dragBegin $ + \_ -> withItems mygui myview moveInit + _ <- treeView `on` dragDrop $ + \dc p ts -> do + p' <- treeViewConvertWidgetToTreeCoords treeView p + mpath <- treeViewGetPathAtPos treeView p' + case mpath of + Nothing -> do + dragFinish dc False False ts + return False + Just _ -> do + atom <- atomNew ("HSFM" :: String) + dragGetData treeView dc atom ts + return True + _ <- treeView `on` dragDataReceived $ + \dc p _ ts -> + liftIO $ do + signalStopEmission treeView "drag_data_received" + p' <- treeViewConvertWidgetToTreeCoords treeView p + mpath <- treeViewGetPathAtPos treeView p' + case mpath of + Nothing -> dragFinish dc False False ts + Just (tp, _, _) -> do + mitem <- rawPathToItem myview tp + forM_ mitem $ \item -> + operationFinal mygui myview (Just item) + dragFinish dc True False ts + + commonGuiEvents fmv + return () + fmv@(FMIconView iconView) -> do + _ <- iconView `on` itemActivated + $ (\_ -> withItems mygui myview open) + commonGuiEvents fmv + return () + where + commonGuiEvents fmv = do + let view = fmViewToContainer fmv + + -- GUI events + _ <- urlBar myview `on` entryActivated $ urlGoTo mygui myview + _ <- upViewB myview `on` buttonActivated $ + upDir mygui myview + _ <- homeViewB myview `on` buttonActivated $ + goHome mygui myview + _ <- refreshViewB myview `on` buttonActivated $ do + cdir <- liftIO $ getCurrentDir myview + refreshView' mygui myview cdir + + -- key events + _ <- viewBox myview `on` keyPressEvent $ tryEvent $ do + [Control] <- eventModifier + "h" <- fmap glibToString eventKeyName + cdir <- liftIO $ getCurrentDir myview + liftIO $ modifyTVarIO (settings mygui) + (\x -> x { showHidden = not . showHidden $ x}) + >> refreshView' mygui myview cdir + _ <- viewBox myview `on` keyPressEvent $ tryEvent $ do + [Alt] <- eventModifier + "Up" <- fmap glibToString eventKeyName + liftIO $ upDir mygui myview _ <- viewBox myview `on` keyPressEvent $ tryEvent $ do [Alt] <- eventModifier - "Up" <- fmap glibToString eventKeyName - liftIO $ upDir mygui myview + "Left" <- fmap glibToString eventKeyName + liftIO $ goHistoryPrev mygui myview _ <- viewBox myview `on` keyPressEvent $ tryEvent $ do [Alt] <- eventModifier - "Left" <- fmap glibToString eventKeyName - liftIO $ goHistoryPrev mygui myview - _ <- viewBox myview `on` keyPressEvent $ tryEvent $ do - [Alt] <- eventModifier - "Right" <- fmap glibToString eventKeyName - liftIO $ goHistoryNext mygui myview - _ <- view `on` keyPressEvent $ tryEvent $ do - "Delete" <- fmap glibToString eventKeyName - liftIO $ withItems mygui myview del + "Right" <- fmap glibToString eventKeyName + liftIO $ goHistoryNext mygui myview + _ <- view `on` keyPressEvent $ tryEvent $ do + "Delete" <- fmap glibToString eventKeyName + liftIO $ withItems mygui myview del + _ <- view `on` keyPressEvent $ tryEvent $ do + [] <- eventModifier + "Return" <- fmap glibToString eventKeyName + liftIO $ withItems mygui myview open _ <- view `on` keyPressEvent $ tryEvent $ do - [] <- eventModifier - "Return" <- fmap glibToString eventKeyName - liftIO $ withItems mygui myview open + [Control] <- eventModifier + "c" <- fmap glibToString eventKeyName + liftIO $ withItems mygui myview copyInit _ <- view `on` keyPressEvent $ tryEvent $ do [Control] <- eventModifier - "c" <- fmap glibToString eventKeyName - liftIO $ withItems mygui myview copyInit - _ <- view `on` keyPressEvent $ tryEvent $ do + "x" <- fmap glibToString eventKeyName + liftIO $ withItems mygui myview moveInit + _ <- viewBox myview `on` keyPressEvent $ tryEvent $ do [Control] <- eventModifier - "x" <- fmap glibToString eventKeyName - liftIO $ withItems mygui myview moveInit + "v" <- fmap glibToString eventKeyName + liftIO $ operationFinal mygui myview Nothing _ <- viewBox myview `on` keyPressEvent $ tryEvent $ do [Control] <- eventModifier - "v" <- fmap glibToString eventKeyName - liftIO $ operationFinal mygui myview Nothing - _ <- viewBox myview `on` keyPressEvent $ tryEvent $ do - [Control] <- eventModifier - "t" <- fmap glibToString eventKeyName - liftIO $ void $ do - cwd <- getCurrentDir myview - newTab mygui createTreeView (path cwd) + "t" <- fmap glibToString eventKeyName + liftIO $ void $ do + cwd <- getCurrentDir myview + newTab mygui createTreeView (path cwd) + _ <- viewBox myview `on` keyPressEvent $ tryEvent $ do + [Control] <- eventModifier + "w" <- fmap glibToString eventKeyName + liftIO $ void $ closeTab mygui myview _ <- viewBox myview `on` keyPressEvent $ tryEvent $ do - [Control] <- eventModifier - "w" <- fmap glibToString eventKeyName - liftIO $ void $ closeTab mygui myview - _ <- viewBox myview `on` keyPressEvent $ tryEvent $ do - "F4" <- fmap glibToString eventKeyName - liftIO $ void $ openTerminalHere myview - - -- righ-click - _ <- view `on` buttonPressEvent $ do - eb <- eventButton - t <- eventTime - case eb of - RightButton -> do - _ <- liftIO $ menuPopup (rcMenu . rcmenu $ myview) - $ Just (RightButton, t) - -- this is just to not screw with current selection - -- on right-click - -- TODO: this misbehaves under IconView - (x, y) <- eventCoordinates - mpath <- liftIO $ getPathAtPos fmv (x, y) - case mpath of - -- item under the cursor, only pass on the signal - -- if the item under the cursor is not within the current - -- selection - (Just tp) -> do - selectedTps <- liftIO $ getSelectedTreePaths mygui myview - return $ elem tp selectedTps - -- no item under the cursor, pass on the signal - Nothing -> return False - MiddleButton -> do - liftIO $ goHistoryPrev mygui myview - return False - OtherButton 8 -> do - liftIO $ goHistoryPrev mygui myview - return False - OtherButton 9 -> do - liftIO $ goHistoryNext mygui myview - return False - -- not right-click, so pass on the signal - _ -> return False - - -- right click menu - _ <- (rcFileOpen . rcmenu) myview `on` menuItemActivated $ - liftIO $ withItems mygui myview open - _ <- (rcFileExecute . rcmenu) myview `on` menuItemActivated $ - liftIO $ withItems mygui myview execute - _ <- (rcFileNewRegFile . rcmenu) myview `on` menuItemActivated $ - liftIO $ newFile mygui myview - _ <- (rcFileNewDir . rcmenu) myview `on` menuItemActivated $ - liftIO $ newDir mygui myview - _ <- (rcFileCopy . rcmenu) myview `on` menuItemActivated $ - liftIO $ withItems mygui myview copyInit - _ <- (rcFileRename . rcmenu) myview `on` menuItemActivated $ - liftIO $ withItems mygui myview renameF - _ <- (rcFilePaste . rcmenu) myview `on` menuItemActivated $ - liftIO $ operationFinal mygui myview Nothing - _ <- (rcFileDelete . rcmenu) myview `on` menuItemActivated $ - liftIO $ withItems mygui myview del - _ <- (rcFileProperty . rcmenu) myview `on` menuItemActivated $ - liftIO $ withItems mygui myview showFilePropertyDialog - _ <- (rcFileCut . rcmenu) myview `on` menuItemActivated $ - liftIO $ withItems mygui myview moveInit - _ <- (rcFileIconView . rcmenu) myview `on` menuItemActivated $ - liftIO $ switchView mygui myview createIconView - _ <- (rcFileTreeView . rcmenu) myview `on` menuItemActivated $ - liftIO $ switchView mygui myview createTreeView - return () - - getPathAtPos fmv (x, y) = - case fmv of - FMTreeView treeView -> do - mp <- treeViewGetPathAtPos treeView (round x, round y) - return $ fmap (\(p, _, _) -> p) mp - FMIconView iconView -> - fmap (\tp -> if null tp then Nothing else Just tp) - $ iconViewGetPathAtPos iconView (round x) (round y) - - - - ----- OTHER ---- + "F4" <- fmap glibToString eventKeyName + liftIO $ void $ openTerminalHere myview + + -- righ-click + _ <- view `on` buttonPressEvent $ do + eb <- eventButton + t <- eventTime + case eb of + RightButton -> do + _ <- liftIO $ menuPopup (rcMenu . rcmenu $ myview) + $ Just (RightButton, t) + -- this is just to not screw with current selection + -- on right-click + -- TODO: this misbehaves under IconView + (x, y) <- eventCoordinates + mpath <- liftIO $ getPathAtPos fmv (x, y) + case mpath of + -- item under the cursor, only pass on the signal + -- if the item under the cursor is not within the current + -- selection + (Just tp) -> do + selectedTps <- liftIO $ getSelectedTreePaths mygui myview + return $ elem tp selectedTps + -- no item under the cursor, pass on the signal + Nothing -> return False + OtherButton 8 -> do + liftIO $ goHistoryPrev mygui myview + return False + OtherButton 9 -> do + liftIO $ goHistoryNext mygui myview + return False + -- not right-click, so pass on the signal + _ -> return False + + -- right click menu + _ <- (rcFileOpen . rcmenu) myview `on` menuItemActivated $ + liftIO $ withItems mygui myview open + _ <- (rcFileExecute . rcmenu) myview `on` menuItemActivated $ + liftIO $ withItems mygui myview execute + _ <- (rcFileNewRegFile . rcmenu) myview `on` menuItemActivated $ + liftIO $ newFile mygui myview + _ <- (rcFileNewDir . rcmenu) myview `on` menuItemActivated $ + liftIO $ newDir mygui myview + _ <- (rcFileCopy . rcmenu) myview `on` menuItemActivated $ + liftIO $ withItems mygui myview copyInit + _ <- (rcFileRename . rcmenu) myview `on` menuItemActivated $ + liftIO $ withItems mygui myview renameF + _ <- (rcFilePaste . rcmenu) myview `on` menuItemActivated $ + liftIO $ operationFinal mygui myview Nothing + _ <- (rcFileDelete . rcmenu) myview `on` menuItemActivated $ + liftIO $ withItems mygui myview del + _ <- (rcFileProperty . rcmenu) myview `on` menuItemActivated $ + liftIO $ withItems mygui myview showFilePropertyDialog + _ <- (rcFileCut . rcmenu) myview `on` menuItemActivated $ + liftIO $ withItems mygui myview moveInit + _ <- (rcFileIconView . rcmenu) myview `on` menuItemActivated $ + liftIO $ switchView mygui myview createIconView + _ <- (rcFileTreeView . rcmenu) myview `on` menuItemActivated $ + liftIO $ switchView mygui myview createTreeView + return () + + getPathAtPos fmv (x, y) = + case fmv of + FMTreeView treeView -> do + mp <- treeViewGetPathAtPos treeView (round x, round y) + return $ fmap (\(p, _, _) -> p) mp + FMIconView iconView -> + fmap (\tp -> if null tp then Nothing else Just tp) + $ iconViewGetPathAtPos iconView (round x) (round y) + + + + +---- OTHER ---- + + +openTerminalHere :: MyView -> IO ProcessID +openTerminalHere myview = do + cwd <- (P.fromAbs . path) <$> getCurrentDir myview + -- TODO: make terminal configurable + SPP.forkProcess $ SPP.executeFile "sakura" True ["-d", cwd] Nothing -openTerminalHere :: MyView -> IO ProcessID -openTerminalHere myview = do - cwd <- (P.fromAbs . path) <$> getCurrentDir myview - -- TODO: make terminal configurable - SPP.forkProcess $ SPP.executeFile "sakura" True ["-d", cwd] Nothing - - - - ----- TAB OPERATIONS ---- + + +---- TAB OPERATIONS ---- + + +-- |Closes the current tab, but only if there is more than one tab. +closeTab :: MyGUI -> MyView -> IO () +closeTab mygui myview = do + n <- notebookGetNPages (notebook mygui) + when (n > 1) $ void $ destroyView mygui myview --- |Closes the current tab, but only if there is more than one tab. -closeTab :: MyGUI -> MyView -> IO () -closeTab mygui myview = do - n <- notebookGetNPages (notebook mygui) - when (n > 1) $ void $ destroyView mygui myview - - -newTabHere :: MyGUI -> MyView -> [Item] -> IO () -newTabHere mygui myview [item] = undefined -newTabHere mygui myview _ = return () - - ----- FILE OPERATION CALLBACKS (COPY, MOVE, ...) ---- - - --- |Supposed to be used with 'withRows'. Deletes a file or directory. -del :: [Item] -> MyGUI -> MyView -> IO () -del [item] _ _ = withErrorDialog $ do - let cmsg = "Really delete \"" ++ getFPasStr item ++ "\"?" - withConfirmationDialog cmsg - $ easyDelete . path $ item --- this throws on the first error that occurs -del items@(_:_) _ _ = withErrorDialog $ do - let cmsg = "Really delete " ++ show (length items) ++ " files?" - withConfirmationDialog cmsg - $ forM_ items $ \item -> easyDelete . path $ item -del _ _ _ = withErrorDialog - . throwIO $ InvalidOperation - "Operation not supported on multiple files" - - --- |Initializes a file move operation. -moveInit :: [Item] -> MyGUI -> MyView -> IO () -moveInit items@(_:_) mygui _ = do - writeTVarIO (operationBuffer mygui) (FMove . PartialMove . map path $ items) - let sbmsg = case items of - (item:[]) -> "Move buffer: " ++ getFPasStr item - _ -> "Move buffer: " ++ (show . length $ items) - ++ " items" - popStatusbar mygui - void $ pushStatusBar mygui sbmsg -moveInit _ _ _ = withErrorDialog - . throwIO $ InvalidOperation - "No file selected!" - --- |Supposed to be used with 'withRows'. Initializes a file copy operation. -copyInit :: [Item] -> MyGUI -> MyView -> IO () -copyInit items@(_:_) mygui _ = do - writeTVarIO (operationBuffer mygui) (FCopy . PartialCopy . map path $ items) - let sbmsg = case items of - (item:[]) -> "Copy buffer: " ++ getFPasStr item - _ -> "Copy buffer: " ++ (show . length $ items) - ++ " items" - popStatusbar mygui - void $ pushStatusBar mygui sbmsg -copyInit _ _ _ = withErrorDialog - . throwIO $ InvalidOperation - "No file selected!" - - --- |Finalizes a file operation, such as copy or move. -operationFinal :: MyGUI -> MyView -> Maybe Item -> IO () -operationFinal mygui myview mitem = withErrorDialog $ do - op <- readTVarIO (operationBuffer mygui) - cdir <- case mitem of - Nothing -> path <$> getCurrentDir myview - Just x -> return $ path x - case op of - FMove (PartialMove s) -> do - let cmsg = "Really move " ++ imsg s - ++ " to \"" ++ toString (P.fromAbs cdir) - ++ "\"?" - withConfirmationDialog cmsg $ doFileOperation (FMove $ Move s cdir) - popStatusbar mygui - writeTVarIO (operationBuffer mygui) None - FCopy (PartialCopy s) -> do - let cmsg = "Really copy " ++ imsg s - ++ " to \"" ++ toString (P.fromAbs cdir) - ++ "\"?" - withConfirmationDialog cmsg $ doFileOperation (FCopy $ Copy s cdir) - _ -> return () - where - imsg s = case s of - (item:[]) -> "\"" ++ toString (P.fromAbs item) ++ "\"" - items -> (show . length $ items) ++ " items" + +---- FILE OPERATION CALLBACKS (COPY, MOVE, ...) ---- + + +-- |Supposed to be used with 'withRows'. Deletes a file or directory. +del :: [Item] -> MyGUI -> MyView -> IO () +del [item] _ _ = withErrorDialog $ do + let cmsg = "Really delete \"" ++ getFPasStr item ++ "\"?" + withConfirmationDialog cmsg + $ easyDelete . path $ item +-- this throws on the first error that occurs +del items@(_:_) _ _ = withErrorDialog $ do + let cmsg = "Really delete " ++ show (length items) ++ " files?" + withConfirmationDialog cmsg + $ forM_ items $ \item -> easyDelete . path $ item +del _ _ _ = withErrorDialog + . throwIO $ InvalidOperation + "Operation not supported on multiple files" + + +-- |Initializes a file move operation. +moveInit :: [Item] -> MyGUI -> MyView -> IO () +moveInit items@(_:_) mygui _ = do + writeTVarIO (operationBuffer mygui) (FMove . PartialMove . map path $ items) + let sbmsg = case items of + (item:[]) -> "Move buffer: " ++ getFPasStr item + _ -> "Move buffer: " ++ (show . length $ items) + ++ " items" + popStatusbar mygui + void $ pushStatusBar mygui sbmsg +moveInit _ _ _ = withErrorDialog + . throwIO $ InvalidOperation + "No file selected!" + +-- |Supposed to be used with 'withRows'. Initializes a file copy operation. +copyInit :: [Item] -> MyGUI -> MyView -> IO () +copyInit items@(_:_) mygui _ = do + writeTVarIO (operationBuffer mygui) (FCopy . PartialCopy . map path $ items) + let sbmsg = case items of + (item:[]) -> "Copy buffer: " ++ getFPasStr item + _ -> "Copy buffer: " ++ (show . length $ items) + ++ " items" + popStatusbar mygui + void $ pushStatusBar mygui sbmsg +copyInit _ _ _ = withErrorDialog + . throwIO $ InvalidOperation + "No file selected!" + + +-- |Finalizes a file operation, such as copy or move. +operationFinal :: MyGUI -> MyView -> Maybe Item -> IO () +operationFinal mygui myview mitem = withErrorDialog $ do + op <- readTVarIO (operationBuffer mygui) + cdir <- case mitem of + Nothing -> path <$> getCurrentDir myview + Just x -> return $ path x + case op of + FMove (PartialMove s) -> do + let cmsg = "Really move " ++ imsg s + ++ " to \"" ++ toString (P.fromAbs cdir) + ++ "\"?" + withConfirmationDialog cmsg $ doFileOperation (FMove $ Move s cdir) + popStatusbar mygui + writeTVarIO (operationBuffer mygui) None + FCopy (PartialCopy s) -> do + let cmsg = "Really copy " ++ imsg s + ++ " to \"" ++ toString (P.fromAbs cdir) + ++ "\"?" + withConfirmationDialog cmsg $ doFileOperation (FCopy $ Copy s cdir) + _ -> return () + where + imsg s = case s of + (item:[]) -> "\"" ++ toString (P.fromAbs item) ++ "\"" + items -> (show . length $ items) ++ " items" + + +-- |Create a new file. +newFile :: MyGUI -> MyView -> IO () +newFile _ myview = withErrorDialog $ do + mfn <- textInputDialog "Enter file name" ("" :: String) + let pmfn = P.parseFn =<< fromString <$> mfn + for_ pmfn $ \fn -> do + cdir <- getCurrentDir myview + createRegularFile (path cdir P.</> fn) + - --- |Create a new file. -newFile :: MyGUI -> MyView -> IO () -newFile _ myview = withErrorDialog $ do - mfn <- textInputDialog "Enter file name" ("" :: String) - let pmfn = P.parseFn =<< fromString <$> mfn - for_ pmfn $ \fn -> do - cdir <- getCurrentDir myview - createRegularFile (path cdir P.</> fn) +-- |Create a new directory. +newDir :: MyGUI -> MyView -> IO () +newDir _ myview = withErrorDialog $ do + mfn <- textInputDialog "Enter directory name" ("" :: String) + let pmfn = P.parseFn =<< fromString <$> mfn + for_ pmfn $ \fn -> do + cdir <- getCurrentDir myview + createDir (path cdir P.</> fn) + - --- |Create a new directory. -newDir :: MyGUI -> MyView -> IO () -newDir _ myview = withErrorDialog $ do - mfn <- textInputDialog "Enter directory name" ("" :: String) - let pmfn = P.parseFn =<< fromString <$> mfn - for_ pmfn $ \fn -> do - cdir <- getCurrentDir myview - createDir (path cdir P.</> fn) - - -renameF :: [Item] -> MyGUI -> MyView -> IO () -renameF [item] _ _ = withErrorDialog $ do - iname <- P.fromRel <$> (P.basename $ path item) - mfn <- textInputDialog "Enter new file name" (iname :: ByteString) - let pmfn = P.parseFn =<< fromString <$> mfn - for_ pmfn $ \fn -> do - let cmsg = "Really rename \"" ++ getFPasStr item - ++ "\"" ++ " to \"" - ++ toString (P.fromAbs $ (P.dirname . path $ item) - P.</> fn) ++ "\"?" - withConfirmationDialog cmsg $ - HPath.IO.renameFile (path item) - ((P.dirname $ path item) P.</> fn) -renameF _ _ _ = withErrorDialog - . throwIO $ InvalidOperation - "Operation not supported on multiple files" - - - - ----- DIRECTORY TRAVERSAL AND FILE OPENING CALLBACKS ---- - +renameF :: [Item] -> MyGUI -> MyView -> IO () +renameF [item] _ _ = withErrorDialog $ do + iname <- P.fromRel <$> (P.basename $ path item) + mfn <- textInputDialog "Enter new file name" (iname :: ByteString) + let pmfn = P.parseFn =<< fromString <$> mfn + for_ pmfn $ \fn -> do + let cmsg = "Really rename \"" ++ getFPasStr item + ++ "\"" ++ " to \"" + ++ toString (P.fromAbs $ (P.dirname . path $ item) + P.</> fn) ++ "\"?" + withConfirmationDialog cmsg $ + HPath.IO.renameFile (path item) + ((P.dirname $ path item) P.</> fn) +renameF _ _ _ = withErrorDialog + . throwIO $ InvalidOperation + "Operation not supported on multiple files" + + + + +---- DIRECTORY TRAVERSAL AND FILE OPENING CALLBACKS ---- + + +-- |Go to the url given at the 'urlBar' and visualize it in the given +-- treeView. +-- +-- If the url is invalid, does nothing. +urlGoTo :: MyGUI -> MyView -> IO () +urlGoTo mygui myview = withErrorDialog $ do + fp <- entryGetText (urlBar myview) + forM_ (P.parseAbs fp :: Maybe (Path Abs)) $ \fp' -> + whenM (canOpenDirectory fp') + (goDir mygui myview =<< (readFile getFileInfo $ fp')) --- |Go to the url given at the 'urlBar' and visualize it in the given --- treeView. --- --- If the url is invalid, does nothing. -urlGoTo :: MyGUI -> MyView -> IO () -urlGoTo mygui myview = withErrorDialog $ do - fp <- entryGetText (urlBar myview) - forM_ (P.parseAbs fp :: Maybe (Path Abs)) $ \fp' -> - whenM (canOpenDirectory fp') - (goDir mygui myview =<< (readFile getFileInfo $ fp')) - - -goHome :: MyGUI -> MyView -> IO () -goHome mygui myview = withErrorDialog $ do - mhomedir <- getEnv "HOME" - forM_ (P.parseAbs =<< mhomedir :: Maybe (Path Abs)) $ \fp' -> - whenM (canOpenDirectory fp') - (goDir mygui myview =<< (readFile getFileInfo $ fp')) - - --- |Execute a given file. -execute :: [Item] -> MyGUI -> MyView -> IO () -execute [item] _ _ = withErrorDialog $ - void $ executeFile (path item) [] -execute _ _ _ = withErrorDialog - . throwIO $ InvalidOperation - "Operation not supported on multiple files" - - --- |Supposed to be used with 'withRows'. Opens a file or directory. -open :: [Item] -> MyGUI -> MyView -> IO () -open [item] mygui myview = withErrorDialog $ - case item of - DirOrSym r -> do - nv <- readFile getFileInfo $ path r - goDir mygui myview nv - r -> - void $ openFile . path $ r --- this throws on the first error that occurs -open (FileLikeList fs) _ _ = withErrorDialog $ - forM_ fs $ \f -> void $ openFile . path $ f -open _ _ _ = withErrorDialog - . throwIO $ InvalidOperation - "Operation not supported on multiple files" - - --- |Go up one directory and visualize it in the treeView. -upDir :: MyGUI -> MyView -> IO () -upDir mygui myview = withErrorDialog $ do - cdir <- getCurrentDir myview - nv <- goUp cdir - goDir mygui myview nv - - --- |Go "back" in the history. -goHistoryPrev :: MyGUI -> MyView -> IO () -goHistoryPrev mygui myview = do - hs <- readTVarIO (history myview) - case hs of - ([], _) -> return () - (x:xs, _) -> do - cdir <- getCurrentDir myview - nv <- readFile getFileInfo $ x - modifyTVarIO (history myview) - (\(_, n) -> (xs, path cdir `addHistory` n)) - refreshView' mygui myview nv - - --- |Go "forth" in the history. -goHistoryNext :: MyGUI -> MyView -> IO () -goHistoryNext mygui myview = do - hs <- readTVarIO (history myview) - case hs of - (_, []) -> return () - (_, x:xs) -> do - cdir <- getCurrentDir myview - nv <- readFile getFileInfo $ x - modifyTVarIO (history myview) - (\(p, _) -> (path cdir `addHistory` p, xs)) - refreshView' mygui myview nv - + +goHome :: MyGUI -> MyView -> IO () +goHome mygui myview = withErrorDialog $ do + mhomedir <- getEnv "HOME" + forM_ (P.parseAbs =<< mhomedir :: Maybe (Path Abs)) $ \fp' -> + whenM (canOpenDirectory fp') + (goDir mygui myview =<< (readFile getFileInfo $ fp')) + + +-- |Execute a given file. +execute :: [Item] -> MyGUI -> MyView -> IO () +execute [item] _ _ = withErrorDialog $ + void $ executeFile (path item) [] +execute _ _ _ = withErrorDialog + . throwIO $ InvalidOperation + "Operation not supported on multiple files" + + +-- |Supposed to be used with 'withRows'. Opens a file or directory. +open :: [Item] -> MyGUI -> MyView -> IO () +open [item] mygui myview = withErrorDialog $ + case item of + DirOrSym r -> do + nv <- readFile getFileInfo $ path r + goDir mygui myview nv + r -> + void $ openFile . path $ r +-- this throws on the first error that occurs +open (FileLikeList fs) _ _ = withErrorDialog $ + forM_ fs $ \f -> void $ openFile . path $ f +open _ _ _ = withErrorDialog + . throwIO $ InvalidOperation + "Operation not supported on multiple files" + + +-- |Go up one directory and visualize it in the treeView. +upDir :: MyGUI -> MyView -> IO () +upDir mygui myview = withErrorDialog $ do + cdir <- getCurrentDir myview + nv <- goUp cdir + goDir mygui myview nv + + +-- |Go "back" in the history. +goHistoryPrev :: MyGUI -> MyView -> IO () +goHistoryPrev mygui myview = do + hs <- readTVarIO (history myview) + case hs of + ([], _) -> return () + (x:xs, _) -> do + cdir <- getCurrentDir myview + nv <- readFile getFileInfo $ x + modifyTVarIO (history myview) + (\(_, n) -> (xs, path cdir `addHistory` n)) + refreshView' mygui myview nv + + +-- |Go "forth" in the history. +goHistoryNext :: MyGUI -> MyView -> IO () +goHistoryNext mygui myview = do + hs <- readTVarIO (history myview) + case hs of + (_, []) -> return () + (_, x:xs) -> do + cdir <- getCurrentDir myview + nv <- readFile getFileInfo $ x + modifyTVarIO (history myview) + (\(p, _) -> (path cdir `addHistory` p, xs)) + refreshView' mygui myview nv +