![]() |
![]() |
![]() |
Thunar-VFS Reference Manual | ![]() |
---|---|---|---|---|
#include <thunar-vfs/thunar-vfs.h> ThunarVfsInfo; ThunarVfsInfo* thunar_vfs_info_new_for_path (ThunarVfsPath *path, GError **error); ThunarVfsInfo* thunar_vfs_info_ref (ThunarVfsInfo *info); void thunar_vfs_info_unref (ThunarVfsInfo *info); ThunarVfsInfo* thunar_vfs_info_copy (const ThunarVfsInfo *info); const gchar* thunar_vfs_info_get_custom_icon (const ThunarVfsInfo *info); gboolean thunar_vfs_info_get_free_space (const ThunarVfsInfo *info, ThunarVfsFileSize *free_space_return); gchar* thunar_vfs_info_get_metadata (const ThunarVfsInfo *info, ThunarVfsInfoMetadata metadata, GError **error); gchar* thunar_vfs_info_read_link (const ThunarVfsInfo *info, GError **error); gboolean thunar_vfs_info_execute (const ThunarVfsInfo *info, GdkScreen *screen, GList *path_list, const gchar *working_directory, GError **error); gboolean thunar_vfs_info_rename (ThunarVfsInfo *info, const gchar *name, GError **error); gboolean thunar_vfs_info_matches (const ThunarVfsInfo *a, const ThunarVfsInfo *b); void thunar_vfs_info_list_free (GList *info_list);
typedef struct { /* File type */ ThunarVfsFileType type : 8; /* File permissions and special mode flags */ ThunarVfsFileMode mode : 12; /* File flags */ ThunarVfsFileFlags flags : 12; /* Owner's user id */ ThunarVfsUserId uid; /* Owner's group id */ ThunarVfsGroupId gid; /* Size in bytes */ ThunarVfsFileSize size; /* time of last access */ ThunarVfsFileTime atime; /* time of last modification */ ThunarVfsFileTime mtime; /* time of last status change */ ThunarVfsFileTime ctime; /* device id */ ThunarVfsFileDevice device; /* file's mime type */ ThunarVfsMimeInfo *mime_info; /* file's absolute path */ ThunarVfsPath *path; /* file's custom icon (path or themed icon name) */ gchar *custom_icon; /* file's display name (UTF-8) */ gchar *display_name; } ThunarVfsInfo;
The Thunar-VFS equivalent of stat(2)
, extended with
advanced information like display name and mime type.
ThunarVfsFileType |
the file type. |
ThunarVfsFileMode |
the file permissions and special mode flags. |
ThunarVfsFileFlags |
the file flags. |
ThunarVfsUserId |
the owner's user id. |
ThunarVfsGroupId |
the owner's group id. |
ThunarVfsFileSize |
the file size in bytes. |
ThunarVfsFileTime |
the time of last access. |
ThunarVfsFileTime |
the time of last modification. |
ThunarVfsFileTime |
the time of last status change. |
ThunarVfsFileDevice |
the file's device. |
ThunarVfsMimeInfo * |
the file's mime type. |
ThunarVfsPath * |
the file's path. |
gchar * |
a custom icon name or NULL .
|
gchar * |
the file's display name (UTF-8). |
ThunarVfsInfo* thunar_vfs_info_new_for_path (ThunarVfsPath *path, GError **error);
Queries the ThunarVfsInfo for the given path
. Returns the
ThunarVfsInfo if the operation is successfull, else NULL
.
In the latter case, error
will be set to point to a GError
describing the cause of the failure.
|
the ThunarVfsPath of the file whose info should be queried. |
|
return location for errors or NULL .
|
Returns : |
the ThunarVfsInfo for path or NULL .
|
ThunarVfsInfo* thunar_vfs_info_ref (ThunarVfsInfo *info);
Increments the reference count on info
by 1 and
returns a pointer to info
.
|
a ThunarVfsInfo. |
Returns : |
a pointer to info .
|
void thunar_vfs_info_unref (ThunarVfsInfo *info);
Decrements the reference count on info
by 1 and if
the reference count drops to zero as a result of this
operation, the info
will be freed completely.
|
a ThunarVfsInfo. |
ThunarVfsInfo* thunar_vfs_info_copy (const ThunarVfsInfo *info);
Takes a deep copy of the info
and returns
it.
|
a ThunarVfsInfo. |
Returns : |
a deep copy of info .
|
const gchar* thunar_vfs_info_get_custom_icon (const ThunarVfsInfo *info);
Returns the custom icon for info
if there's
a custom icon, else NULL
.
The custom icon can be a themed icon name or an absolute path to an icon file in the local file system.
|
a ThunarVfsInfo. |
Returns : |
the custom icon for info or NULL .
|
gboolean thunar_vfs_info_get_free_space (const ThunarVfsInfo *info, ThunarVfsFileSize *free_space_return);
Determines the amount of free space available on the volume on which the
file to which info
refers resides. If the system is able to determine the
amount of free space, it will be placed into the location to which
free_space_return
points and TRUE
will be returned, else the function
will return FALSE
indicating that the system is unable to determine the
amount of free space.
|
a ThunarVfsInfo. |
|
return location for the amount of free space or NULL .
|
Returns : |
TRUE if the amount of free space could be determined, else
FALSE :
|
gchar* thunar_vfs_info_get_metadata (const ThunarVfsInfo *info, ThunarVfsInfoMetadata metadata, GError **error);
Queries the metadata
for info
and returns a string with the
data, or NULL
if either metadata
is invalid for info
or an
error occurred while querying the metadata
.
The caller is responsible to free the returned string using
g_free()
when no longer needed.
|
a ThunarVfsInfo. |
|
the ThunarVfsInfoMetadata you are interested in. |
|
return location for errors or NULL .
|
Returns : |
the metadata for info or NULL in case of an
error.
|
gchar* thunar_vfs_info_read_link (const ThunarVfsInfo *info, GError **error);
Reads the contents of the symbolic link to which info
refers to,
like the POSIX readlink()
function. The returned string is in the
encoding used for filenames.
The caller is responsible to free the returned string using g_free()
when no longer needed.
|
a ThunarVfsInfo. |
|
return location for errors or NULL .
|
Returns : |
a newly allocated string with the contents of the
symbolic link, or NULL if an error occurred.
|
gboolean thunar_vfs_info_execute (const ThunarVfsInfo *info, GdkScreen *screen, GList *path_list, const gchar *working_directory, GError **error);
Executes the file referred to by info
, given path_list
as parameters,
on the specified screen
. info
may refer to either a regular,
executable file, or a .desktop
file, whose
type is Application
.
If working_directory
is NULL
, the directory of the first path in path_list
will be used as working directory. If path_list
is also NULL
, the directory
of info
will be used.
|
a ThunarVfsInfo. |
|
a GdkScreen or NULL to use the default GdkScreen.
|
|
the list of ThunarVfsPaths to give as parameters
to the file referred to by info on execution.
|
|
the working directory in which to execute info or NULL .
|
|
return location for errors or NULL .
|
Returns : |
TRUE on success, else FALSE .
|
gboolean thunar_vfs_info_rename (ThunarVfsInfo *info, const gchar *name, GError **error);
Tries to rename the file referred to by info
to the
new name
.
The rename operation is smart in that it checks the
type of info
first, and if info
refers to a
.desktop
file, the file name
won't be touched, but instead the Name
field of the .desktop
will be
changed to name
. Else, if info
refers to a regular
file or directory, the file will be given a new
name.
|
a ThunarVfsInfo. |
|
the new file name in UTF-8 encoding. |
|
return location for errors or NULL .
|
Returns : |
TRUE on success, else FALSE .
|
gboolean thunar_vfs_info_matches (const ThunarVfsInfo *a, const ThunarVfsInfo *b);
Checks whether a
and b
refer to the same file
and share the same properties.
|
a ThunarVfsInfo. |
|
a ThunarVfsInfo. |
Returns : |
TRUE if a and b match.
|
void thunar_vfs_info_list_free (GList *info_list);
Unrefs all ThunarVfsInfos in info_list
and
frees the list itself.
|
a list of ThunarVfsInfos. |