ThunarVfsInfo

ThunarVfsInfo — Stores information about files.

Functions

Types and Values

struct ThunarVfsInfo

Object Hierarchy

    GBoxed
    ╰── ThunarVfsInfo

Includes

#include <thunar-vfs/thunar-vfs.h>

Description

Functions

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.

Parameters

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 .

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

info_list

a list of ThunarVfsInfos.

 

Types and Values

struct ThunarVfsInfo

struct ThunarVfsInfo {
  /* 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;
};

The Thunar-VFS equivalent of stat(2), extended with advanced information like display name and mime type.

See Also

Basic Types