various utilities functions to manipulate uris
mchars
) ⇒ (ret mchars
)Filter, modify, unescape and change uri to make it appropriate for display to users. The conversion is done such that the roundtrip to UTF-8 is reversible.
Rules: file: uri without fragments should appear as local paths. file: uri with fragments should appear as file:uri. All other uri appear as expected.
- uri
- uri to be displayed.
- ret
- a string which represents uri and can be displayed.
Since 2.2
mchars
) ⇒ (ret <gnome-vfs-result>
)Launches the default application or component associated with the given url.
- url
- url to be shown.
- ret
- ‘GNOME_VFS_OK’ if the default action was launched, ‘GNOME_VFS_ERROR_BAD_PARAMETERS’ for an invalid or non-existant url, ‘GNOME_VFS_ERROR_NO_DEFAULT’ if no default action is associated with the url. Also error codes from
gnome-vfs-mime-action-launch
orgnome-vfs-mime-action-launch-with-env
.Since 2.4
mchars
) ⇒ (ret mchars
)Escapes string, replacing any and all special characters with equivalent escape sequences.
- string
- string to be escaped.
- ret
- a newly allocated string equivalent to string but with all special characters escaped.
mchars
) ⇒ (ret mchars
)Escapes path, replacing only special characters that would not be found in paths (so '/', '&', and '=' will not be escaped by this function).
- path
- string to be escaped.
- ret
- a newly allocated string equivalent to path but with non-path characters escaped.
mchars
) ⇒ (ret mchars
)Escapes only '/' and '%' characters in string, replacing them with their escape sequence equivalents.
- string
- string to be escaped.
- ret
- a newly allocated string equivalent to string, but with no unescaped '/' or '%' characters.
mchars
) (match_set mchars
) ⇒ (ret mchars
)Escapes all characters in string which are listed in match-set.
- string
- string to be escaped.
- match-set
- a string containing all characters to be escaped in string.
- ret
- a newly allocated string equivalent to string but with characters in match-string escaped.
mchars
) (illegal_characters mchars
) ⇒ (ret mchars
)Decodes escaped characters (i.e. PERCENTxx sequences) in escaped-string. Characters are encoded in PERCENTxy form, where xy is the ASCII hex code for character 16x+y.
- escaped-string
- an escaped uri, path, or other string.
- illegal-characters
- a string containing a sequence of characters considered "illegal" to be escaped, '\0' is automatically in this list.
- ret
- a newly allocated string with the unescaped equivalents, or ‘
#f
’ if escaped-string contained an escaped encoding of one of the characters in illegal-characters.
mchars
) ⇒ (ret mchars
)Standardizes the format of the uri, so that it can be used later in other functions that expect a canonical uri.
- uri
- an absolute or relative stringified uri. It might have scheme.
- ret
- a newly allocated string that contains the canonical representation of uri.
Since 2.2
mchars
) ⇒ (ret mchars
)Calls
-gnome-vfs-canonicalize-pathname
, allocating storage for the result and providing for a cleaner memory management.
- path
- a file path, relative or absolute.
- ret
- a canonical version of path.
mchars
) ⇒ (ret mchars
)Takes a user input path/uri and makes a valid uri out of it.
This function is the reverse of
gnome-vfs-format-uri-for-display
but it also handles the fact that the user could have typed arbitrary UTF-8 in the entry showing the string.
- location
- a possibly mangled "uri", in UTF-8.
- ret
- a newly allocated uri.
Since 2.2
mchars
) ⇒ (ret mchars
)Similar to
gnome-vfs-make-uri-from-input
, except that:1) guesses relative paths instead of http domains. 2) doesn't bother stripping leading/trailing white space. 3) doesn't bother with ~ expansion–that's done by the shell.
- uri
- path to make the uri from.
- ret
- a newly allocated string representing uri.
Since 2.2
mchars
) ⇒ (ret mchars
)If path starts with a ~, representing the user's home directory, expand it to the actual path location.
- path
- a local file path which may start with a '~'.
- ret
- a newly allocated string with the initial tilde (if there was one) converted to an actual path.
mchars
) ⇒ (ret mchars
)Create a local path for a file:/// uri. Do not use with uris of other methods.
- uri
- uri to convert to a local path.
- ret
- a newly allocated string containing the local path. ‘
#f
’ is returned on error or if the uri isn't a file: uri without a fragment identifier (or chained uri).
mchars
) ⇒ (ret mchars
)Returns a file:/// URI for the local path local-full-path, such as a path provided by
gtk-file-chooser-get-filename
. The resulting URI may be provided, for instance, tognome-vfs-uri-new
.On Windows local-full-path should be in the UTF-8 encoding, and can start with a drive letter, but doesn't have to.
- local-full-path
- a full local filesystem path (i.e. not relative).
- ret
- a newly allocated string containing the uri corresponding to local-full-path (‘
#f
’ for some bad errors).
mchars
) ⇒ (ret mchars
)
- filename
- path to a file. Could be relative or absolute path.
- ret
- Returns the icon path for the filename. Example: gnome_vfs_icon_path_from_filename ("nautilus/nautilus-desktop.png") will return a string forming the full path of the file nautilus-desktop.png ie $PREFIX/share/pixmaps/nautilus/nautilus-desktop.png.
bool
)Check if the current thread is the thread with the main glib event loop.
- ret
- ‘
#t
’ if the current thread is the thread with the main glib event loop.