![]() |
![]() |
![]() |
Thunar-VFS Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <thunar-vfs/thunar-vfs.h> enum ThunarVfsPathScheme; ThunarVfsPath; #define THUNAR_VFS_TYPE_PATH #define THUNAR_VFS_TYPE_PATH_LIST ThunarVfsPath * thunar_vfs_path_new (const gchar *identifier, GError **error); ThunarVfsPath * thunar_vfs_path_get_for_home (void); ThunarVfsPath * thunar_vfs_path_get_for_root (void); ThunarVfsPath * thunar_vfs_path_ref (ThunarVfsPath *path); void thunar_vfs_path_unref (ThunarVfsPath *path); guint thunar_vfs_path_hash (gconstpointer path_ptr); gboolean thunar_vfs_path_equal (gconstpointer path_ptr_a, gconstpointer path_ptr_b); gboolean thunar_vfs_path_is_ancestor (const ThunarVfsPath *path, const ThunarVfsPath *ancestor); gboolean thunar_vfs_path_is_home (const ThunarVfsPath *path); gboolean thunar_vfs_path_is_root (const ThunarVfsPath *path); ThunarVfsPath * thunar_vfs_path_relative (ThunarVfsPath *parent, const gchar *name); const gchar * thunar_vfs_path_get_name (const ThunarVfsPath *path); ThunarVfsPath * thunar_vfs_path_get_parent (const ThunarVfsPath *path); ThunarVfsPathScheme thunar_vfs_path_get_scheme (const ThunarVfsPath *path); gchar * thunar_vfs_path_dup_string (const ThunarVfsPath *path); gssize thunar_vfs_path_to_string (const ThunarVfsPath *path, gchar *buffer, gsize bufsize, GError **error); gchar * thunar_vfs_path_dup_uri (const ThunarVfsPath *path); gssize thunar_vfs_path_to_uri (const ThunarVfsPath *path, gchar *buffer, gsize bufsize, GError **error); GList * thunar_vfs_path_list_from_string (const gchar *uri_string, GError **error); gchar * thunar_vfs_path_list_to_string (GList *path_list); GList * thunar_vfs_path_list_append (GList *path_list, ThunarVfsPath *path); GList * thunar_vfs_path_list_prepend (GList *path_list, ThunarVfsPath *path); GList * thunar_vfs_path_list_copy (GList *path_list); void thunar_vfs_path_list_free (GList *path_list);
typedef enum /*< skip >*/ { THUNAR_VFS_PATH_SCHEME_FILE = 0x00000000, THUNAR_VFS_PATH_SCHEME_TRASH = 0x40000000, THUNAR_VFS_PATH_SCHEME_MASK = 0x40000000, } ThunarVfsPathScheme;
The scheme, or the type, of resource a ThunarVfsPath refers to. This currently includes local files which are accessible via standard Unix paths, and trashed files, which are accessible via trash:-URIs.
Since 0.3.3
#define THUNAR_VFS_TYPE_PATH (thunar_vfs_path_get_type ())
Returns : |
the type id of the ThunarVfsPath type, which is a boxed type. |
#define THUNAR_VFS_TYPE_PATH_LIST (thunar_vfs_path_list_get_type ())
Returns : |
the type id for GLists of ThunarVfsPaths, which is a boxed type. |
Since 0.3.3
ThunarVfsPath * thunar_vfs_path_new (const gchar *identifier, GError **error);
Returns a ThunarVfsPath that represents the given
identifier
or NULL
on error. In the latter case
error
will be set to point to an GError describing
the problem.
The caller is responsible to free the returned
object using thunar_vfs_path_unref()
when no
longer needed.
|
an URI identifier or an absolute path. |
|
return location for errors or NULL .
|
Returns : |
the ThunarVfsPath for identifier
or NULL on error.
|
ThunarVfsPath * thunar_vfs_path_get_for_home (void);
Returns the ThunarVfsPath that represents the current users home directory.
The caller is responsible to free the
returned object using thunar_vfs_path_unref()
when no longer needed.
Returns : |
the ThunarVfsPath for the current users home directory. |
ThunarVfsPath * thunar_vfs_path_get_for_root (void);
Returns the ThunarVfsPath that represents the file systems root folder.
The caller is responsible to free the returned
object using thunar_vfs_path_unref()
when no
longer needed.
Returns : |
the ThunarVfsPath for the file systems root directory. |
ThunarVfsPath * thunar_vfs_path_ref (ThunarVfsPath *path);
Increments the reference count on path
and returns a reference to path
.
|
a ThunarVfsPath. |
Returns : |
a reference to path .
|
void thunar_vfs_path_unref (ThunarVfsPath *path);
Decreases the reference count on path
and
frees the resources allocated for path
once the reference count drops to zero.
|
a ThunarVfsPath. |
guint thunar_vfs_path_hash (gconstpointer path_ptr);
Generates a hash value for the given path_ptr
.
|
a ThunarVfsPath. |
Returns : |
the hash value for path_ptr .
|
gboolean thunar_vfs_path_equal (gconstpointer path_ptr_a, gconstpointer path_ptr_b);
Checks whether path_ptr_a
and path_ptr_b
refer
to the same local path.
|
first ThunarVfsPath. |
|
second ThunarVfsPath. |
Returns : |
TRUE if path_ptr_a and path_ptr_b
are equal.
|
gboolean thunar_vfs_path_is_ancestor (const ThunarVfsPath *path, const ThunarVfsPath *ancestor);
Determines whether path
is somewhere below ancestor
,
possible with intermediate folders.
|
a ThunarVfsPath. |
|
another ThunarVfsPath. |
Returns : |
TRUE if ancestor contains path as a
child, grandchild, great grandchild, etc.
|
gboolean thunar_vfs_path_is_home (const ThunarVfsPath *path);
Checks whether path
refers to the users home
directory.
|
a ThunarVfsPath. |
Returns : |
TRUE if path refers to the users
home directory.
|
gboolean thunar_vfs_path_is_root (const ThunarVfsPath *path);
Checks whether path refers to the root directory.
|
a ThunarVfsPath. |
Returns : |
TRUE if path refers to the root
directory.
|
ThunarVfsPath * thunar_vfs_path_relative (ThunarVfsPath *parent, const gchar *name);
Returns a ThunarVfsPath for the file name
relative to
parent
. name
must be a valid filename in the local file
system encoding and it may not contain any slashes.
The caller is responsible to free the returned object
using thunar_vfs_path_unref()
when no longer needed.
|
a ThunarVfsPath. |
|
a valid filename in the local file system encoding. |
Returns : |
the path to name relative to parent .
|
const gchar * thunar_vfs_path_get_name (const ThunarVfsPath *path);
Returns the base name of the path
in the local
file system encoding.
|
a ThunarVfsPath. |
Returns : |
the base name of path .
|
ThunarVfsPath * thunar_vfs_path_get_parent (const ThunarVfsPath *path);
Returns the ThunarVfsPath that refers to the parent
directory of path
or NULL
if path
refers to the
root file system node.
No additional reference is taken on the parent, so
you'll need to call thunar_vfs_path_ref()
yourself
if you need to keep a reference.
|
a ThunarVfsPath. |
Returns : |
the parent of path or NULL .
|
ThunarVfsPathScheme thunar_vfs_path_get_scheme (const ThunarVfsPath *path);
Returns the ThunarVfsPathScheme of the specified
path
.
|
a ThunarVfsPath. |
Returns : |
the scheme of the path .
|
Since 0.3.3
gchar * thunar_vfs_path_dup_string (const ThunarVfsPath *path);
Like thunar_vfs_path_to_string()
, this function transform
the path
to its string representation, but unlike
thunar_vfs_path_to_string()
, this function automatically
allocates the required amount of memory from the heap.
The returned string must be freed by the caller when
no longer needed.
|
a ThunarVfsPath. |
Returns : |
the string representation of path .
|
gssize thunar_vfs_path_to_string (const ThunarVfsPath *path, gchar *buffer, gsize bufsize, GError **error);
Stores the path
into the string pointed to by buffer
,
so it can be used for system path operations. Returns
the number of bytes stored to buffer
or a negative
value if bufsize
is too small to store the whole path
.
In the latter case error
will be set to point to an
error describing the problem.
If buffer
is allocated on the stack, it is suggested
to use THUNAR_VFS_PATH_MAXSTRLEN for the buffer size
in most cases. The stack should never be used in recursive
functions; use thunar_vfs_path_dup_string()
instead there.
|
a ThunarVfsPath. |
|
the buffer to store the path string to. |
|
the size of buffer in bytes.
|
|
return location for errors or NULL .
|
Returns : |
the number of bytes (including the null
byte) stored to buffer or a negative
value if buffer cannot hold the whole
path .
|
gchar * thunar_vfs_path_dup_uri (const ThunarVfsPath *path);
Similar to thunar_vfs_path_to_uri()
, but automatically
allocates memory on the heap instead of using a user
supplied buffer for the URI.
The caller is responsible to free the returned string
using g_free()
when no longer needed.
|
a ThunarVfsPath. |
Returns : |
the escaped URI for path .
|
gssize thunar_vfs_path_to_uri (const ThunarVfsPath *path, gchar *buffer, gsize bufsize, GError **error);
Escapes path
according to the rules of the file URI
specification and stores the escaped URI to buffer
.
Returns the number of bytes stored to buffer
or a
negative value if bufsize
is too small to store the
escaped URI. In the latter case error
will be set to
point to an GError describing the problem.
When using the stack for buffer
, it is suggested to
use THUNAR_VFS_PATH_MAXURILEN for the buffer size in
most cases. The stack should never be used in recursive
functions; use thunar_vfs_path_dup_uri()
instead there.
|
a ThunarVfsPath. |
|
the buffer to store the URI string to. |
|
the size of buffer in bytes.
|
|
return location for errors or NULL .
|
Returns : |
the number of bytes (including the null
byte) stored to buffer or a negative
value if buffer cannot hold the URI.
|
GList * thunar_vfs_path_list_from_string (const gchar *uri_string, GError **error);
Splits an URI list conforming to the text/uri-list mime type defined in RFC 2483 into individual URIs, discarding any comments and whitespace.
If all URIs were successfully parsed into ThunarVfsPath
objects, the list of parsed URIs will be returned, and
you'll need to call thunar_vfs_path_list_free()
to
release the list resources. Else if the parsing fails
at some point, NULL
will be returned and error
will
be set to describe the cause.
Note, that if string
contains no URIs, this function
will also return NULL
, but error
won't be set. So
take care when checking for an error condition!
|
a string representation of an URI list. |
|
return location for errors. |
Returns : |
the list of ThunarVfsPath's or NULL .
|
gchar * thunar_vfs_path_list_to_string (GList *path_list);
Free the returned value using g_free()
when you
are done with it.
|
a list of ThunarVfsPaths. |
Returns : |
the string representation of path_list conforming to the
text/uri-list mime type defined in RFC 2483.
|
GList * thunar_vfs_path_list_append (GList *path_list, ThunarVfsPath *path);
Appends path
to the path_list
while taking
an additional reference for path
.
|
a list of ThunarVfsPaths. |
|
a ThunarVfsPath. |
Returns : |
pointer to the extended path_list .
|
GList * thunar_vfs_path_list_prepend (GList *path_list, ThunarVfsPath *path);
Similar to thunar_vfs_path_list_append()
, but
prepends the path
to the path_list
.
|
a list of ThunarVfsPaths. |
|
a ThunarVfsPath. |
Returns : |
pointer to the extended path_list .
|
GList * thunar_vfs_path_list_copy (GList *path_list);
Takes a deep copy of path_list
and returns the
result. The caller is responsible to free the
returned list using thunar_vfs_path_list_free()
.
|
a list of ThunarVfsPaths. |
Returns : |
a deep copy of path_list .
|
void thunar_vfs_path_list_free (GList *path_list);
Frees the ThunarVfsPaths in path_list
and
the path_list
itself.
|
a list of ThunarVfsPaths. |