ThunarVfsInfo

ThunarVfsInfo — Stores information about files.

Synopsis


#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);

Description

Details

ThunarVfsInfo

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 type : 8;

the file type.

ThunarVfsFileMode mode : 12;

the file permissions and special mode flags.

ThunarVfsFileFlags flags : 12;

the file flags.

ThunarVfsUserId uid;

the owner's user id.

ThunarVfsGroupId gid;

the owner's group id.

ThunarVfsFileSize size;

the file size in bytes.

ThunarVfsFileTime atime;

the time of last access.

ThunarVfsFileTime mtime;

the time of last modification.

ThunarVfsFileTime ctime;

the time of last status change.

ThunarVfsFileDevice device;

the file's device.

ThunarVfsMimeInfo *mime_info;

the file's mime type.

ThunarVfsPath *path;

the file's path.

gchar *custom_icon;

a custom icon name or NULL.

gchar *display_name;

the file's display name (UTF-8).

thunar_vfs_info_new_for_path ()

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.

path :

the ThunarVfsPath of the file whose info should be queried.

error :

return location for errors or NULL.

Returns :

the ThunarVfsInfo for path or NULL.

thunar_vfs_info_ref ()

ThunarVfsInfo *     thunar_vfs_info_ref                 (ThunarVfsInfo *info);

Increments the reference count on info by 1 and returns a pointer to info.

info :

a ThunarVfsInfo.

Returns :

a pointer to info.

thunar_vfs_info_unref ()

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.

info :

a ThunarVfsInfo.

thunar_vfs_info_copy ()

ThunarVfsInfo *     thunar_vfs_info_copy                (const ThunarVfsInfo *info);

Takes a deep copy of the info and returns it.

info :

a ThunarVfsInfo.

Returns :

a deep copy of info.

thunar_vfs_info_get_custom_icon ()

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.

info :

a ThunarVfsInfo.

Returns :

the custom icon for info or NULL.

thunar_vfs_info_get_free_space ()

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.

info :

a ThunarVfsInfo.

free_space_return :

return location for the amount of free space or NULL.

Returns :

TRUE if the amount of free space could be determined, else FALSE:

thunar_vfs_info_get_metadata ()

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.

info :

a ThunarVfsInfo.

metadata :

the ThunarVfsInfoMetadata you are interested in.

error :

return location for errors or NULL.

Returns :

the metadata for info or NULL in case of an error.

thunar_vfs_info_read_link ()

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.

info :

a ThunarVfsInfo.

error :

return location for errors or NULL.

Returns :

a newly allocated string with the contents of the symbolic link, or NULL if an error occurred.

thunar_vfs_info_execute ()

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.

info :

a ThunarVfsInfo.

screen :

a GdkScreen or NULL to use the default GdkScreen.

path_list :

the list of ThunarVfsPaths to give as parameters to the file referred to by info on execution.

working_directory :

the working directory in which to execute info or NULL.

error :

return location for errors or NULL.

Returns :

TRUE on success, else FALSE.

thunar_vfs_info_rename ()

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.

info :

a ThunarVfsInfo.

name :

the new file name in UTF-8 encoding.

error :

return location for errors or NULL.

Returns :

TRUE on success, else FALSE.

thunar_vfs_info_matches ()

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 :

a ThunarVfsInfo.

b :

a ThunarVfsInfo.

Returns :

TRUE if a and b match.

thunar_vfs_info_list_free ()

void                thunar_vfs_info_list_free           (GList *info_list);

Unrefs all ThunarVfsInfos in info_list and frees the list itself.

info_list :

a list of ThunarVfsInfos.

See Also

Basic Types