Gtk2HsContentsIndex
System.Gnome.VFS.Util
Maintainergtk2hs-devel@lists.sourceforge.net Stability : alpha Portability : portable (depends on GHC)
Contents
String Formatting Functions
External Applications
String Escaping Functions
TextURI and Path Functions
Miscellaneous Functions
Description
Synopsis
formatFileSizeForDisplay :: FileSize -> String
formatURIForDisplay :: TextURI -> Maybe String
urlShow :: String -> IO ()
urlShowWithEnv :: String -> [String] -> IO ()
isExecutableCommandString :: String -> IO Bool
escapeString :: String -> String
escapePathString :: FilePath -> String
escapeHostAndPathString :: FilePath -> String
escapeSlashes :: String -> String
escapeSet :: String -> String -> String
unescapeString :: String -> String -> String
unescapeStringForDisplay :: String -> String
makeURICanonical :: TextURI -> Maybe TextURI
makeURICanonicalStripFragment :: TextURI -> Maybe TextURI
makePathNameCanonical :: FilePath -> Maybe TextURI
makeURIFromInput :: String -> Maybe TextURI
makeURIFromInputWithDirs :: FilePath -> [MakeURIDirs] -> IO TextURI
makeURIFromShellArg :: String -> String
expandInitialTilde :: String -> IO String
getLocalPathFromURI :: TextURI -> Maybe FilePath
getURIFromLocalPath :: FilePath -> TextURI
iconPathFromFilename :: String -> IO String
getVolumeFreeSpace :: URI -> IO FileSize
urisMatch :: TextURI -> TextURI -> Bool
getURIScheme :: TextURI -> Maybe String
isPrimaryThread :: IO Bool
openFD :: Fd -> IO Handle
String Formatting Functions
formatFileSizeForDisplay
:: FileSizesize - the file size to be formatted
-> Stringthe formatted size ready for display
Formats size so that it is easy for the user to read. Gives the size in bytes, kilobytes, megabytes or gigabytes, choosing whatever is appropriate.
formatURIForDisplay
:: TextURItextURI - the URI to format
-> Maybe Stringthe formatted URI ready for display

Filter, modify, unescape, and change textURI to make it appropriate for display to users.

Rules: A file: URI without fragments should appear as a local path. A file: URI with fragments should appear as file:uri. All other URIs appear as expected.

External Applications
urlShow
:: Stringurl - the URL to launch an application for
-> IO ()
Launches the default application or component associated with the given URL.
urlShowWithEnv
:: Stringurl - the URL to launch an application for
-> [String]env - a list of strings ["VARIABLE1=value1", "VARIABLE2=value2", ...]
-> IO ()
Like urlShow, but using the specified environment variables.
isExecutableCommandString
:: StringcommandString -
-> IO Bool
Checks if commandString starts with the full path of an executable file or an executable in the system path.
String Escaping Functions
escapeString
:: Stringstring - the string to be escaped
-> String
Escapes string, replacing any and all special characters with equivalent escape sequences.
escapePathString
:: FilePathpath - the path string to be escaped
-> Stringthe escaped string
Escapes path, replacing only special characters that would not be found in paths (so '/', '&', and '=' will not be escaped by this function).
escapeHostAndPathString
:: FilePathpath - the path to be escaped
-> Stringthe escaped string
Escapes path, replacing only special characters that would not be found in a path or host name (so '/', '&', '=', ':' and '@' will not be escaped by this function).
escapeSlashes
:: Stringstring - the string to be escaped
-> Stringthe escaped string
Escapes only '/' and '%' characters in string, replacing them with their escape sequence equivalents.
escapeSet
:: Stringstring - the string to be escaped
-> StringmatchSet - the characters to escape
-> Stringthe escaped string
Escapes the characters listed in matchSet in string.
unescapeString
:: String
-> String
-> Stringthe unescaped string
Decodes escaped characters (i.e., %xx sequences) in escapedString. Characters are decoded in %xx form, where xx is the hex code for an ASCII character.
unescapeStringForDisplay :: String -> String

Similar to unescapeString, but returns something semi-intelligible to the user, even upon receiving traumatic input such as 00 or URIs in bad form.

WARNING: You should never use this function on a whole URI! It unescapes reserved characters, and can result in a mangled URI that can not be re-entered. For example, it unescapes '#', '&' and '?', which have special meanings in URI strings.

TextURI and Path Functions
makeURICanonical
:: TextURItextURI - an absolute or relative URI; it may have a scheme
-> Maybe TextURIthe canonical representation of the URI
Standardizes the format of uri, so that it can be used later in other functions that expect a canonical URI.
makeURICanonicalStripFragment
:: TextURItextURI - the URI to canonicalize
-> Maybe TextURIthe canonical representation of the URI
Returns a canonicalized URI. If uri contains a fragment (anything after a '#'), it is stripped off, and the resulting URI is made canonical.
makePathNameCanonical
:: FilePathpathName - the path name to canonicalize
-> Maybe TextURIthe canonicalized path name
Returns a canonicalized path name.
makeURIFromInput
:: Stringlocation - the input to try to parse
-> Maybe TextURIthe resulting URI, or Nothing if location is invalid

Takes a user input path/URI and makes a valid URI out of it.

This function is the reverse of formatURIForDisplay.

makeURIFromInputWithDirs
:: FilePathlocation - the relative or absolute input path to resolve
-> [MakeURIDirs]dirs - the directories to search
-> IO TextURIthe resulting URI
Determine a fully qualified URI from a relative or absolute input path. The directories specified by dirs are searched when the path is relative.
makeURIFromShellArg :: String -> String

Similar to makeURIFromInput, except:

1. guesses relative paths instead of HTTP domains

2. doesn't bother stripping leading/trailing white space

3. doesn't bother with tilde expansion -- that's done by the shell

expandInitialTilde :: String -> IO String
If path begins with a tilde, representing the user's home directory, expand it to the actual directory.
getLocalPathFromURI
:: TextURIthe URI to convert
-> Maybe FilePaththe resulting path

Create a local path for a uri.

If uri is not a file:/// URI, or it contains a fragment identifier or is chained, this function returns Nothing.

getURIFromLocalPath
:: FilePathlocalFullPath -
-> TextURIthe resulting URI

Returns a file:/// URI for the local path localFullPath, such as a path provided by fileChooserGetFilename. The resulting URI may be provided, for instance, to uriFromString.

On Windows localFullPath should be in the UTF-8 encoding, and can start with a drive letter, but doesn't have to.

iconPathFromFilename
:: Stringfilename - a relative or absolute pathname
-> IO Stringthe absolute path to the icon file

Returns the icon path for filename. Example:

iconPathFromFilename "nautilus/nautilus-desktop.png" will return a string forming the full path of the file nautilus-desktop.png, i.e. ${prefix}/share/pixmaps/nautilus/nautilus-desktop.png.

getVolumeFreeSpace
:: URIuri - a URI to a file on a volume
-> IO FileSizethe free space in bytes on the volume
Stores the amount of free space in bytes on uri's volume in | size.
urisMatch
:: TextURIuri1 -
-> TextURIuri2 -
-> BoolTrue if the URIs are the same, False otherwise.
Compare two URIs.
getURIScheme
:: TextURIuri -
-> Maybe Stringthe scheme used in uri, or Nothing if uri does not use a scheme
Retrieves the scheme used in uri.
Miscellaneous Functions
isPrimaryThread
:: IO BoolTrue if the current thread is the thread with the main glib event loop, otherwise False
Check if the current thread is the thread with the main glib event loop.
openFD
:: Fdfiledes - the file descriptor to use
-> IO Handlethe returned handle
Convert an open unix file descriptor into a Handle object.
Produced by Haddock version 0.8