## ThunarFile

ThunarFile

## Functions

void | ( *ThunarFileGetFunc ) ()
ThunarFile * | thunar_file_get ()
ThunarFile * | thunar_file_get_with_info ()
ThunarFile * | thunar_file_get_for_uri ()
void | thunar_file_get_async ()
GFile * | thunar_file_get_file ()
GFileInfo * | thunar_file_get_info ()
ThunarFile * | thunar_file_get_parent ()
gboolean | thunar_file_check_loaded ()
gboolean | thunar_file_execute ()
gboolean | thunar_file_launch ()
gboolean | thunar_file_rename ()
GdkDragAction | thunar_file_accepts_drop ()
guint64 | thunar_file_get_date ()
gchar * | thunar_file_get_date_string ()
gchar * | thunar_file_get_mode_string ()
gchar * | thunar_file_get_size_string ()
gchar * | thunar_file_get_size_in_bytes_string ()
gchar * | thunar_file_get_size_string_formatted ()
gchar * | thunar_file_get_size_string_long ()
GVolume * | thunar_file_get_volume ()
ThunarGroup * | thunar_file_get_group ()
ThunarUser * | thunar_file_get_user ()
const gchar * | thunar_file_get_content_type ()
gchar * | thunar_file_get_content_type_desc ()
gboolean | thunar_file_load_content_type ()
const gchar * | thunar_file_get_symlink_target ()
const gchar * | thunar_file_get_basename ()
gboolean | thunar_file_is_symlink ()
guint64 | thunar_file_get_size ()
GAppInfo * | thunar_file_get_default_handler ()
GFileType | thunar_file_get_kind ()
GFile * | thunar_file_get_target_location ()
ThunarFileMode | thunar_file_get_mode ()
gboolean | thunar_file_is_mounted ()
gboolean | thunar_file_exists ()
gboolean | thunar_file_is_directory ()
gboolean | thunar_file_is_shortcut ()
gboolean | thunar_file_is_mountable ()
gboolean | thunar_file_is_local ()
gboolean | thunar_file_is_parent ()
gboolean | thunar_file_is_gfile_ancestor ()
gboolean | thunar_file_is_ancestor ()
gboolean | thunar_file_can_execute ()
gboolean | thunar_file_is_writable ()
gboolean | thunar_file_is_hidden ()
gboolean | thunar_file_is_home ()
gboolean | thunar_file_is_regular ()
gboolean | thunar_file_is_trash ()
gboolean | thunar_file_is_trashed ()
gboolean | thunar_file_is_recent ()
gboolean | thunar_file_is_in_recent ()
void | thunar_file_add_to_recent ()
gboolean | thunar_file_is_desktop_file ()
const gchar * | thunar_file_get_display_name ()
gchar * | thunar_file_get_deletion_date ()
gchar * | thunar_file_get_recency ()
const gchar * | thunar_file_get_original_path ()
guint32 | thunar_file_get_item_count ()
gboolean | thunar_file_is_chmodable ()
gboolean | thunar_file_is_renameable ()
gboolean | thunar_file_can_be_trashed ()
guint | thunar_file_get_file_count ()
void | thunar_file_set_file_count ()
GList * | thunar_file_get_emblem_names ()
void | thunar_file_set_emblem_names ()
const gchar * | thunar_file_get_custom_icon ()
gboolean | thunar_file_set_custom_icon ()
const gchar * | thunar_file_get_thumbnail_path ()
gchar * | thunar_file_get_thumbnail_path_forced ()
ThunarFileThumbState | thunar_file_get_thumb_state ()
void | thunar_file_set_thumb_state ()
GIcon * | thunar_file_get_preview_icon ()
GFilesystemPreviewType | thunar_file_get_preview_type ()
const gchar * | thunar_file_get_icon_name ()
const gchar * | thunar_file_get_device_type ()
void | thunar_file_watch ()
void | thunar_file_unwatch ()
gboolean | thunar_file_reload ()
void | thunar_file_reload_idle ()
void | thunar_file_reload_idle_unref ()
void | thunar_file_reload_parent ()
void | thunar_file_destroy ()
gint | thunar_file_compare_by_type ()
gint | thunar_file_compare_by_name ()
ThunarFile * | thunar_file_cache_lookup ()
gchar * | thunar_file_cached_display_name ()
GList * | thunar_file_list_get_applications ()
GList * | thunar_file_list_to_thunar_g_file_list ()
gboolean | thunar_file_is_desktop ()
const gchar * | thunar_file_get_metadata_setting ()
void | thunar_file_set_metadata_setting ()
void | thunar_file_clear_metadata_setting ()
void | thunar_file_clear_directory_specific_settings ()
gboolean | thunar_file_has_directory_specific_settings ()
#define | thunar_file_is_root ()
#define | thunar_file_has_parent ()
#define | thunar_file_dup_uri ()
#define | thunar_file_has_uri_scheme ()
#define | thunar_file_changed ()

## Signals

void | destroy | No Hooks

## Types and Values

enum | ThunarFileDateType
enum | ThunarFileIconState
enum | ThunarFileThumbState
#define | THUNAR_FILE_EMBLEM_NAME_SYMBOLIC_LINK
#define | THUNAR_FILE_EMBLEM_NAME_CANT_READ
#define | THUNAR_FILE_EMBLEM_NAME_CANT_WRITE
#define | THUNAR_FILE_EMBLEM_NAME_DESKTOP

## Object Hierarchy

        GObject
        ╰── ThunarFile

## Description

## Functions

### ThunarFileGetFunc ()

    void
    (*ThunarFileGetFunc) (GFile *location,
                          ThunarFile *file,
                          GError *error,
                          gpointer user_data);

Callback type for loading ThunarFiles asynchronously. If you want to keep the ThunarFile, you need to ref it, else it will be destroyed.

### thunar_file_get ()

    ThunarFile *
    thunar_file_get (GFile *file,
                     GError **error);

Looks up the ThunarFile referred to by `file` . This function may return a ThunarFile even though the file doesn't actually exist. This is the case with remote URIs (like SFTP) for instance, if they are not mounted.

The caller is responsible to call `g_object_unref()` when done with the returned object.

#### Parameters

file | a GFile. |
error | return location for errors. |

#### Returns

the ThunarFile for `file` or `NULL` on errors.

### thunar_file_get_with_info ()

    ThunarFile *
    thunar_file_get_with_info (GFile *file,
                               GFileInfo *info,
                               GFileInfo *recent_info,
                               gboolean not_mounted);

Looks up the ThunarFile referred to by `file` . This function may return a ThunarFile even though the file doesn't actually exist. This is the case with remote URIs (like SFTP) for instance, if they are not mounted.

This function does not use `g_file_query_info()` to get the info, but takes a reference on the `info` ,

The caller is responsible to call `g_object_unref()` when done with the returned object.

#### Parameters

uri | an URI or an absolute filename. |
info | GFileInfo to use when loading the info. |
recent_info | additional GFileInfo to use when loading the info, only for files in `recent:///`. |
not_mounted | if the file is mounted. |

#### Returns

the ThunarFile for `file` or `NULL` on errors.

### thunar_file_get_for_uri ()

    ThunarFile *
    thunar_file_get_for_uri (const gchar *uri,
                             GError **error);

Convenience wrapper function for `thunar_file_get_for_path()`, as its often required to determine a ThunarFile for a given `uri` .

The caller is responsible to free the returned object using `g_object_unref()` when no longer needed.

#### Parameters

uri | an URI or an absolute filename. |
error | return location for errors or `NULL`. |

#### Returns

the ThunarFile for the given `uri` or `NULL` if unable to determine.

### thunar_file_get_async ()

    void
    thunar_file_get_async (GFile *location,
                           GCancellable *cancellable,
                           ThunarFileGetFunc func,
                           gpointer user_data);

### thunar_file_get_file ()

    GFile *
    thunar_file_get_file (const ThunarFile *file);

Returns the GFile that refers to the location of `file` .

The returned GFile is owned by `file` and must not be released with `g_object_unref()`.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the GFile corresponding to `file` .

### thunar_file_get_info ()

    GFileInfo *
    thunar_file_get_info (const ThunarFile *file);

Returns the GFileInfo for `file` .

Note, that there's no reference taken for the caller on the returned GFileInfo, so if you need the object for a longer perioud, you'll need to take a reference yourself using the `g_object_ref()` method.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the GFileInfo for `file` or `NULL`.

### thunar_file_get_parent ()

    ThunarFile *
    thunar_file_get_parent (const ThunarFile *file,
                            GError **error);

Determines the parent ThunarFile for `file` . If `file` has no parent or the user is not allowed to open the parent folder of `file` , `NULL` will be returned and `error` will be set to point to a GError that describes the cause. Else, the ThunarFile will be returned, and the caller must call `g_object_unref()` on it.

You may want to call `thunar_file_has_parent()` first to determine whether `file` has a parent.

#### Parameters

file | a ThunarFile instance. |
error | return location for errors. |

#### Returns

the parent ThunarFile or `NULL`.

### thunar_file_check_loaded ()

    gboolean
    thunar_file_check_loaded (ThunarFile *file);

Check if `file` has its information loaded, if not, try this once else return `FALSE`.

#### Parameters

file | a ThunarFile instance. |

#### Returns

`TRUE` on success, else `FALSE`.

### thunar_file_execute ()

    gboolean
    thunar_file_execute (ThunarFile *file,
                         GFile *working_directory,
                         gpointer parent,
                         GList *path_list,
                         const gchar *startup_id,
                         GError **error);

Tries to execute `file` on the specified `screen` . If `file` is executable and could have been spawned successfully, `TRUE` is returned, else `FALSE` will be returned and `error` will be set to point to the error location.

#### Parameters

file | a ThunarFile instance. |
working_directory | the working directory used to resolve relative filenames in `file_list` . |
parent | `NULL`, a GdkScreen or GtkWidget. |
file_list | the list of GFiles to supply to `file` on execution. |
startup_id | startup id for the new window (send over for dbus) or `NULL`. |
error | return location for errors or `NULL`. |

#### Returns

`TRUE` on success, else `FALSE`.

### thunar_file_launch ()

    gboolean
    thunar_file_launch (ThunarFile *file,
                        gpointer parent,
                        const gchar *startup_id,
                        GError **error);

If `file` is an executable file, tries to execute it. Else if `file` is a directory, opens a new ThunarWindow to display the directory. Else, the default handler for `file` is determined and run.

The `parent` can be either a GtkWidget or a GdkScreen, on which to launch the `file` . If `parent` is a GtkWidget, the chooser dialog (if no default application is available for `file` ) will be transient for `parent` . Else if `parent` is a GdkScreen it specifies the screen on which to launch `file` .

#### Parameters

file | a ThunarFile instance. |
parent | a GtkWidget or a GdkScreen on which to launch the `file` . May also be `NULL` in which case the default GdkScreen will be used. |
startup_id | startup id for the new window (send over for dbus) or `NULL`. |
error | return location for errors or `NULL`. |

#### Returns

`TRUE` on success, else `FALSE`.

### thunar_file_rename ()

    gboolean
    thunar_file_rename (ThunarFile *file,
                        const gchar *name,
                        GCancellable *cancellable,
                        gboolean called_from_job,
                        GError **error);

Tries to rename `file` to the new `name` . If `file` cannot be renamed, `FALSE` will be returned and `error` will be set accordingly. Else, if the operation succeeds, `TRUE` will be returned, and `file` will have a new URI and a new display name.

When offering a rename action in the user interface, the implementation should first check whether the file is available, using the `thunar_file_is_renameable()` method.

#### Parameters

file | a ThunarFile instance. |
name | the new file name in UTF-8 encoding. |
error | return location for errors or `NULL`. |

#### Returns

`TRUE` on success, else `FALSE`.

### thunar_file_accepts_drop ()

    GdkDragAction
    thunar_file_accepts_drop (ThunarFile *file,
                              GList *path_list,
                              GdkDragContext *context,
                              GdkDragAction *suggested_action_return);

Checks whether `file` can accept `file_list` for the given `context` and returns the GdkDragActions that can be used or 0 if no actions apply.

If any GdkDragActions apply and `suggested_action_return` is not `NULL`, the suggested GdkDragAction for this drop will be stored to the location pointed to by `suggested_action_return` .

#### Parameters

file | a ThunarFile instance. |
file_list | the list of GFiles that will be dropped. |
context | the current GdkDragContext, which is used for the drop. |
suggested_action_return | return location for the suggested GdkDragAction or `NULL`. |

#### Returns

the GdkDragActions supported for the drop or 0 if no drop is possible.

### thunar_file_get_date ()

    guint64
    thunar_file_get_date (const ThunarFile *file,
                          ThunarFileDateType date_type);

Queries the given `date_type` from `file` and returns the result.

#### Parameters

file | a ThunarFile instance. |
date_type | the kind of date you are interested in. |

#### Returns

the time for `file` of the given `date_type` .

### thunar_file_get_date_string ()

    gchar *
    thunar_file_get_date_string (const ThunarFile *file,
                                 ThunarFileDateType date_type,
                                 ThunarDateStyle date_style,
                                 const gchar *date_custom_style);

Tries to determine the `date_type` of `file` , and if `file` supports the given `date_type` , it'll be formatted as string and returned. The caller is responsible for freeing the string using the `g_free()` function.

#### Parameters

file | a ThunarFile instance. |
date_type | the kind of date you are interested to know about `file` . |
date_style | the style used to format the date. |
date_custom_style | custom style to apply, if `date_style` is set to custom |

#### Returns

the `date_type` of `file` formatted as string.

### thunar_file_get_mode_string ()

    gchar *
    thunar_file_get_mode_string (const ThunarFile *file);

Returns the mode of `file` as text. You'll need to free the result using `g_free()` when you're done with it.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the mode of `file` as string.

### thunar_file_get_size_string ()

    gchar *
    thunar_file_get_size_string (const ThunarFile *file);

Returns the size of the file as text in a human readable format. You'll need to free the result using `g_free()` if you're done with it.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the size of `file` in a human readable format.

### thunar_file_get_size_in_bytes_string ()

    gchar *
    thunar_file_get_size_in_bytes_string (const ThunarFile *file);

Returns the size in bytes of the file as text. You'll need to free the result using `g_free()` if you're done with it.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the size of `file` in bytes.

### thunar_file_get_size_string_formatted ()

    gchar *
    thunar_file_get_size_string_formatted (const ThunarFile *file,
                                           const gboolean file_size_binary);

Returns the size of the file as text in a human readable format in decimal or binary format. You'll need to free the result using `g_free()` if you're done with it.

#### Parameters

file | a ThunarFile instance. |
file_size_binary | indicates if file size format should be binary or not. |

#### Returns

the size of `file` in a human readable format.

### thunar_file_get_size_string_long ()

    gchar *
    thunar_file_get_size_string_long (const ThunarFile *file,
                                      const gboolean file_size_binary);

Returns the size of the file as text in a human readable format in decimal or binary format, including the exact size in bytes. You'll need to free the result using `g_free()` if you're done with it.

#### Parameters

file | a ThunarFile instance. |
file_size_binary | indicates if file size format should be binary or not. |

#### Returns

the size of `file` in a human readable format, including size in bytes.

### thunar_file_get_volume ()

    GVolume *
    thunar_file_get_volume (const ThunarFile *file);

Attempts to determine the GVolume on which `file` is located. If `file` cannot determine it's volume, then `NULL` will be returned. Else a GVolume instance is returned which has to be released by the caller using `g_object_unref()`.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the GVolume for `file` or `NULL`.

### thunar_file_get_group ()

    ThunarGroup *
    thunar_file_get_group (const ThunarFile *file);

Determines the ThunarGroup for `file` . If there's no group associated with `file` or if the system is unable to determine the group, `NULL` will be returned.

The caller is responsible for freeing the returned object using `g_object_unref()`.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the ThunarGroup for `file` or `NULL`.

### thunar_file_get_user ()

    ThunarUser *
    thunar_file_get_user (const ThunarFile *file);

Determines the ThunarUser for `file` . If there's no user associated with `file` or if the system is unable to determine the user, `NULL` will be returned.

The caller is responsible for freeing the returned object using `g_object_unref()`.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the ThunarUser for `file` or `NULL`.

### thunar_file_get_content_type ()

    const gchar *
    thunar_file_get_content_type (ThunarFile *file);

Returns the content type of `file` .

#### Parameters

file | a ThunarFile. |

#### Returns

content type of `file` .

### thunar_file_get_content_type_desc ()

    gchar *
    thunar_file_get_content_type_desc (ThunarFile *file);

### thunar_file_load_content_type ()

    gboolean
    thunar_file_load_content_type (ThunarFile *file);

### thunar_file_get_symlink_target ()

    const gchar *
    thunar_file_get_symlink_target (const ThunarFile *file);

Returns the path of the symlink target or `NULL` if the `file` is not a symlink.

#### Parameters

file | a ThunarFile. |

#### Returns

path of the symlink target or `NULL`.

### thunar_file_get_basename ()

    const gchar *
    thunar_file_get_basename (const ThunarFile *file);

Returns the basename of the `file` in UTF-8 encoding.

#### Parameters

file | a ThunarFile. |

#### Returns

UTF-8 encoded basename of the `file` .

### thunar_file_is_symlink ()

    gboolean
    thunar_file_is_symlink (const ThunarFile *file);

Returns `TRUE` if `file` is a symbolic link.

#### Parameters

file | a ThunarFile. |

#### Returns

`TRUE` if `file` is a symbolic link.

### thunar_file_get_size ()

    guint64
    thunar_file_get_size (const ThunarFile *file);

Tries to determine the size of `file` in bytes and returns the size.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the size of `file` in bytes.

### thunar_file_get_default_handler ()

    GAppInfo *
    thunar_file_get_default_handler (const ThunarFile *file);

Returns the default GAppInfo for `file` or `NULL` if there is none.

The caller is responsible to free the returned GAppInfo using `g_object_unref()`.

#### Parameters

file | a ThunarFile instance. |

#### Returns

Default GAppInfo for `file` or `NULL` if there is none.

### thunar_file_get_kind ()

    GFileType
    thunar_file_get_kind (const ThunarFile *file);

Returns the kind of `file` .

#### Parameters

file | a ThunarFile instance. |

#### Returns

the kind of `file` .

### thunar_file_get_target_location ()

    GFile *
    thunar_file_get_target_location (const ThunarFile *file);

### thunar_file_get_mode ()

    ThunarFileMode
    thunar_file_get_mode (const ThunarFile *file);

Returns the permission bits of `file` .

#### Parameters

file | a ThunarFile instance. |

#### Returns

the permission bits of `file` .

### thunar_file_is_mounted ()

    gboolean
    thunar_file_is_mounted (const ThunarFile *file);

### thunar_file_exists ()

    gboolean
    thunar_file_exists (const ThunarFile *file);

### thunar_file_is_directory ()

    gboolean
    thunar_file_is_directory (const ThunarFile *file);

Checks whether `file` refers to a directory.

#### Parameters

file | a ThunarFile instance. |

#### Returns

`TRUE` if `file` is a directory.

### thunar_file_is_shortcut ()

    gboolean
    thunar_file_is_shortcut (const ThunarFile *file);

Checks whether `file` refers to a shortcut to something else.

#### Parameters

file | a ThunarFile instance. |

#### Returns

`TRUE` if `file` is a shortcut.

### thunar_file_is_mountable ()

    gboolean
    thunar_file_is_mountable (const ThunarFile *file);

Checks whether `file` refers to a mountable file/directory.

#### Parameters

file | a ThunarFile instance. |

#### Returns

`TRUE` if `file` is a mountable file/directory.

### thunar_file_is_local ()

    gboolean
    thunar_file_is_local (const ThunarFile *file);

Returns `TRUE` if `file` is a local file with the file:// URI scheme.

#### Parameters

file | a ThunarFile instance. |

#### Returns

`TRUE` if `file` is local.

### thunar_file_is_parent ()

    gboolean
    thunar_file_is_parent (const ThunarFile *file,
                           const ThunarFile *child);

Determines whether `file` is the parent directory of `child` .

#### Parameters

file | a ThunarFile instance. |
child | another ThunarFile instance. |

#### Returns

`TRUE` if `file` is the parent of `child` .

### thunar_file_is_gfile_ancestor ()

    gboolean
    thunar_file_is_gfile_ancestor (const ThunarFile *file,
                                   GFile *ancestor);

### thunar_file_is_ancestor ()

    gboolean
    thunar_file_is_ancestor (const ThunarFile *file,
                             const ThunarFile *ancestor);

Determines whether `file` is somewhere inside `ancestor` , possibly with intermediate folders.

#### Parameters

file | a ThunarFile instance. |
ancestor | another ThunarFile instance. |

#### Returns

`TRUE` if `ancestor` contains `file` as a child, grandchild, great grandchild, etc.

### thunar_file_can_execute ()

    gboolean
    thunar_file_can_execute (ThunarFile *file);

Determines whether the owner of the current process is allowed to execute the `file` (or enter the directory refered to by `file` ). On UNIX it also returns `TRUE` if `file` refers to a desktop entry.

#### Parameters

file | a ThunarFile instance. |

#### Returns

`TRUE` if `file` can be executed.

### thunar_file_is_writable ()

    gboolean
    thunar_file_is_writable (const ThunarFile *file);

Determines whether the owner of the current process is allowed to write the `file` .

#### Parameters

file | a ThunarFile instance. |

#### Returns

`TRUE` if `file` can be read.

### thunar_file_is_hidden ()

    gboolean
    thunar_file_is_hidden (const ThunarFile *file);

Checks whether `file` can be considered a hidden file.

#### Parameters

file | a ThunarFile instance. |

#### Returns

`TRUE` if `file` is a hidden file, else `FALSE`.

### thunar_file_is_home ()

    gboolean
    thunar_file_is_home (const ThunarFile *file);

Checks whether `file` refers to the users home directory.

#### Parameters

file | a ThunarFile. |

#### Returns

`TRUE` if `file` is the users home directory.

### thunar_file_is_regular ()

    gboolean
    thunar_file_is_regular (const ThunarFile *file);

Checks whether `file` refers to a regular file.

#### Parameters

file | a ThunarFile. |

#### Returns

`TRUE` if `file` is a regular file.

### thunar_file_is_trash ()

    gboolean
    thunar_file_is_trash (const ThunarFile *file);

Returns `TRUE` if `file` is the trash bin.

#### Parameters

file | a ThunarFile instance. |

#### Returns

`TRUE` if `file` is in the trash bin

### thunar_file_is_trashed ()

    gboolean
    thunar_file_is_trashed (const ThunarFile *file);

Returns `TRUE` if `file` is a local file that resides in the trash bin.

#### Parameters

file | a ThunarFile instance. |

#### Returns

`TRUE` if `file` is in the trash, or the trash folder itself.

### thunar_file_is_recent ()

    gboolean
    thunar_file_is_recent (const ThunarFile *file);

Returns `TRUE` if `file` is the recent folder.

#### Parameters

file | a ThunarFile instance. |

#### Returns

`TRUE` if `file` is the recent folder bin

### thunar_file_is_in_recent ()

    gboolean
    thunar_file_is_in_recent (const ThunarFile *file);

### thunar_file_add_to_recent ()

    void
    thunar_file_add_to_recent (const ThunarFile *file);

Adds the file to recent:/// if it is not a directory

#### Parameters

file | a ThunarFile instance. |

### thunar_file_is_desktop_file ()

    gboolean
    thunar_file_is_desktop_file (const ThunarFile *file);

Returns `TRUE` if `file` is a .desktop file.

#### Parameters

file | a ThunarFile. |

#### Returns

`TRUE` if `file` is a .desktop file.

### thunar_file_get_display_name ()

    const gchar *
    thunar_file_get_display_name (const ThunarFile *file);

Returns the `file` name in the UTF-8 encoding, which is suitable for displaying the file name in the GUI.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the `file` name suitable for display.

### thunar_file_get_deletion_date ()

    gchar *
    thunar_file_get_deletion_date (const ThunarFile *file,
                                   ThunarDateStyle date_style,
                                   const gchar *date_custom_style);

Returns the deletion date of the `file` if the `file` is located in the trash. Otherwise `NULL` will be returned.

The caller is responsible to free the returned string using `g_free()` when no longer needed.

#### Parameters

file | a ThunarFile instance. |
date_style | the style used to format the date. |
date_custom_style | custom style to apply, if `date_style` is set to custom |

#### Returns

the deletion date of `file` if `file` is in the trash, `NULL` otherwise.

### thunar_file_get_recency ()

    gchar *
    thunar_file_get_recency (const ThunarFile *file,
                             ThunarDateStyle date_style,
                             const gchar *date_custom_style);

Returns the recency date of the `file` if the `file` is in the `recent:///` location. Recency differs from date accessed and date modified. It refers to the time of the last metadata change of a file in `recent:///`.

#### Parameters

file | a ThunarFile instance. |
date_style | the style used to format the date. |
date_custom_style | custom style to apply, if `date_style` is set to custom |

#### Returns

the recency date of `file` if `file` is in `recent:///`, `NULL` otherwise.

### thunar_file_get_original_path ()

    const gchar *
    thunar_file_get_original_path (const ThunarFile *file);

Returns the original path of the `file` if the `file` is located in the trash. Otherwise `NULL` will be returned.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the original path of `file` if `file` is in the trash, `NULL` otherwise.

### thunar_file_get_item_count ()

    guint32
    thunar_file_get_item_count (const ThunarFile *file);

Returns the number of items in the trash, if `file` refers to the trash root directory. Otherwise returns 0.

#### Parameters

file | a ThunarFile instance. |

#### Returns

number of files in the trash if `file` is the trash root dir, 0 otherwise.

### thunar_file_is_chmodable ()

    gboolean
    thunar_file_is_chmodable (const ThunarFile *file);

Determines whether the owner of the current process is allowed to changed the file mode of `file` .

#### Parameters

file | a ThunarFile instance. |

#### Returns

`TRUE` if the mode of `file` can be changed.

### thunar_file_is_renameable ()

    gboolean
    thunar_file_is_renameable (const ThunarFile *file);

Determines whether `file` can be renamed using `thunar_file_rename()`. Note that the return value is just a guess and `thunar_file_rename()` may fail even if this method returns `TRUE`.

#### Parameters

file | a ThunarFile instance. |

#### Returns

`TRUE` if `file` can be renamed.

### thunar_file_can_be_trashed ()

    gboolean
    thunar_file_can_be_trashed (const ThunarFile *file);

### thunar_file_get_file_count ()

    guint
    thunar_file_get_file_count (ThunarFile *file,
                                GCallback callback,
                                gpointer data);

Returns the number of items in the directory Counts the number of files in the directory as fast as possible. Will use cached data to do calculations only when the file has been modified since the last time its contents were counted.

#### Parameters

file | a ThunarFile instance. |
callback | a GCallback to be executed after the file count |
data | a gpointer containing user data to pass to the callback |

#### Returns

Number of files in a folder

### thunar_file_set_file_count ()

    void
    thunar_file_set_file_count (ThunarFile *file,
                                const guint count);

Set `file` 's count to the given number if it is a directory. Does *NOT* update the file's count timestamp.

#### Parameters

file | A ThunarFileInstance |
count | The value to set the file's count to |

### thunar_file_get_emblem_names ()

    GList *
    thunar_file_get_emblem_names (ThunarFile *file);

Determines the names of the emblems that should be displayed for `file` . The returned list is owned by the caller, but the list items - the name strings - are owned by `file` . So the caller must call `g_list_free()`, but don't `g_free()` the list items.

Note that the strings contained in the returned list are not garantied to exist over the next iteration of the main loop. So in case you need the list of emblem names for a longer time, you'll need to take a copy of the strings.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the names of the emblems for `file` .

### thunar_file_set_emblem_names ()

    void
    thunar_file_set_emblem_names (ThunarFile *file,
                                  GList *emblem_names);

Sets the custom emblem name list of `file` to `emblem_names` and stores them in the `file` s metadata.

#### Parameters

file | a ThunarFile instance. |
emblem_names | a GList of emblem names. |

### thunar_file_get_custom_icon ()

    const gchar *
    thunar_file_get_custom_icon (const ThunarFile *file);

Queries the custom icon from `file` if any, else `NULL` is returned. The custom icon can be either a themed icon name or an absolute path to an icon file in the local file system.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the custom icon for `file` or `NULL`.

### thunar_file_set_custom_icon ()

    gboolean
    thunar_file_set_custom_icon (ThunarFile *file,
                                 const gchar *custom_icon,
                                 GError **error);

Tries to change the custom icon of the .desktop file referred to by `file` . If that fails, `FALSE` is returned and the `error` is set accordingly.

#### Parameters

file | a ThunarFile instance. |
custom_icon | the new custom icon for the `file` . |
error | return location for errors or `NULL`. |

#### Returns

`TRUE` if the icon of `file` was changed, `FALSE` otherwise.

### thunar_file_get_thumbnail_path ()

    const gchar *
    thunar_file_get_thumbnail_path (ThunarFile *file,
                                    ThunarThumbnailSize thumbnail_size);

### thunar_file_get_thumbnail_path_forced ()

    gchar *
    thunar_file_get_thumbnail_path_forced (ThunarFile *file,
                                           ThunarThumbnailSize thumbnail_size);

### thunar_file_get_thumb_state ()

    ThunarFileThumbState
    thunar_file_get_thumb_state (const ThunarFile *file);

Returns the current ThunarFileThumbState for `file` . This method is intended to be used by ThunarIconFactory only.

#### Parameters

file | a ThunarFile. |

#### Returns

the ThunarFileThumbState for `file` .

### thunar_file_set_thumb_state ()

    void
    thunar_file_set_thumb_state (ThunarFile *file,
                                 ThunarFileThumbState state);

Sets the ThunarFileThumbState for `file` to `thumb_state` . This will cause a "file-changed" signal to be emitted from ThunarFileMonitor.

#### Parameters

file | a ThunarFile. |
thumb_state | the new ThunarFileThumbState. |

### thunar_file_get_preview_icon ()

    GIcon *
    thunar_file_get_preview_icon (const ThunarFile *file);

Returns the preview icon for `file` if any, else `NULL` is returned.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the custom icon for `file` or `NULL`, the GIcon is owner by the file, so do not unref it.

### thunar_file_get_preview_type ()

    GFilesystemPreviewType
    thunar_file_get_preview_type (const ThunarFile *file);

### thunar_file_get_icon_name ()

    const gchar *
    thunar_file_get_icon_name (ThunarFile *file,
                               ThunarFileIconState icon_state,
                               GtkIconTheme *icon_theme);

Returns the name of the icon that can be used to present `file` , based on the given `icon_state` and `icon_theme` .

#### Parameters

file | a ThunarFile instance. |
icon_state | the state of the `file` s icon we are interested in. |
icon_theme | the GtkIconTheme on which to lookup up the icon name. |

#### Returns

the icon name for `file` in `icon_theme` .

### thunar_file_get_device_type ()

    const gchar *
    thunar_file_get_device_type (ThunarFile *file);

Returns : (transfer none) (nullable): the string of the device type.

#### Parameters

file | a ThunarFile instance. |

### thunar_file_watch ()

    void
    thunar_file_watch (ThunarFile *file);

Tells `file` to watch itself for changes. Not all ThunarFile implementations must support this, but if a ThunarFile implementation implements the `thunar_file_watch()` method, it must also implement the `thunar_file_unwatch()` method.

The ThunarFile base class implements automatic "ref counting" for watches, that says, you can call `thunar_file_watch()` multiple times, but the virtual method will be invoked only once. This also means that you MUST call `thunar_file_unwatch()` for every `thunar_file_watch()` invokation, else the application will abort.

#### Parameters

file | a ThunarFile instance. |

### thunar_file_unwatch ()

    void
    thunar_file_unwatch (ThunarFile *file);

See `thunar_file_watch()` for a description of how watching ThunarFiles works.

#### Parameters

file | a ThunarFile instance. |

### thunar_file_reload ()

    gboolean
    thunar_file_reload (ThunarFile *file);

Tells `file` to reload its internal state, e.g. by reacquiring the file info from the underlying media.

You must be able to handle the case that `file` is destroyed during the reload call.

#### Parameters

file | a ThunarFile instance. |

#### Returns

TRUE on success, FALSE otherwise

### thunar_file_reload_idle ()

    void
    thunar_file_reload_idle (ThunarFile *file);

Schedules a single reload of the `file` by calling thunar_file_reload when idle.

#### Parameters

file | a ThunarFile instance. |

### thunar_file_reload_idle_unref ()

    void
    thunar_file_reload_idle_unref (ThunarFile *file);

Schedules a reload of the `file` by calling thunar_file_reload when idle. When scheduled function returns `file` object will be unreferenced.

#### Parameters

file | a ThunarFile instance. |

### thunar_file_reload_parent ()

    void
    thunar_file_reload_parent (ThunarFile *file);

### thunar_file_destroy ()

    void
    thunar_file_destroy (ThunarFile *file);

Emits the ::destroy signal notifying all reference holders that they should release their references to the `file` .

This method is very similar to what `gtk_object_destroy()` does for GtkObjects.

#### Parameters

file | a ThunarFile instance. |

### thunar_file_compare_by_type ()

    gint
    thunar_file_compare_by_type (ThunarFile *file_a,
                                 ThunarFile *file_b);

Compares items so that directories come before files and ancestors come before descendants.

#### Parameters

a | the first ThunarFile. |
b | the second ThunarFile. |

#### Returns

-1 if `file_a` should be sorted before `file_b` , 1 if `file_b` should be sorted before `file_a` , 0 if equal.

### thunar_file_compare_by_name ()

    gint
    thunar_file_compare_by_name (const ThunarFile *file_a,
                                 const ThunarFile *file_b,
                                 gboolean case_sensitive);

Compares `file_a` and `file_b` by their display names. If `case_sensitive` is `TRUE` the comparison will be case-sensitive.

#### Parameters

file_a | the first ThunarFile. |
file_b | the second ThunarFile. |
case_sensitive | whether the comparison should be case-sensitive. |

#### Returns

-1 if `file_a` should be sorted before `file_b` , 1 if `file_b` should be sorted before `file_a` , 0 if equal.

### thunar_file_cache_lookup ()

    ThunarFile *
    thunar_file_cache_lookup (const GFile *file);

Looks up the ThunarFile for `file` in the internal file cache and returns the file present for `file` in the cache or `NULL` if no ThunarFile is cached for `file` .

Note that no reference is taken for the caller.

This method should not be used but in very rare cases. Consider using `thunar_file_get()` instead.

#### Parameters

file | a GFile. |

#### Returns

the ThunarFile for `file` in the internal cache, or `NULL`. If you are done with the file, use g_object_unref to release.

### thunar_file_cached_display_name ()

    gchar *
    thunar_file_cached_display_name (const GFile *file);

### thunar_file_list_get_applications ()

    GList *
    thunar_file_list_get_applications (GList *file_list);

Returns the GList of GAppInfos that can be used to open all ThunarFiles in the given `file_list` .

The caller is responsible to free the returned list using something like:

    1

    g_list_free_full (list, g_object_unref);

#### Parameters

file_list | a GList of ThunarFiles. |

#### Returns

the list of GAppInfos that can be used to open all items in the `file_list` .

### thunar_file_list_to_thunar_g_file_list ()

    GList *
    thunar_file_list_to_thunar_g_file_list
                                   (GList *file_list);

Transforms the `file_list` to a GList of GFiles for the ThunarFiles contained within `file_list` .

The caller is responsible to free the returned list using `thunar_g_list_free_full()` when no longer needed.

#### Parameters

file_list | a GList of ThunarFiles. |

#### Returns

the list of GFiles for `file_list` .

### thunar_file_is_desktop ()

    gboolean
    thunar_file_is_desktop (const ThunarFile *file);

Checks whether `file` refers to the users desktop directory.

#### Parameters

file | a ThunarFile. |

#### Returns

`TRUE` if `file` is the users desktop directory.

### thunar_file_get_metadata_setting ()

    const gchar *
    thunar_file_get_metadata_setting (ThunarFile *file,
                                      const gchar *setting_name);

Gets the stored value of the metadata setting `setting_name` for `file` . Returns `NULL` if there is no stored setting.

#### Parameters

file | a ThunarFile instance. |
setting_name | the name of the setting to get |

#### Returns

the stored value of the setting for `file` , or `NULL`.

[transfer none]

### thunar_file_set_metadata_setting ()

    void
    thunar_file_set_metadata_setting (ThunarFile *file,
                                      const gchar *setting_name,
                                      const gchar *setting_value,
                                      gboolean async);

Sets the setting `setting_name` of `file` to `setting_value` and stores it in the `file` s metadata.

#### Parameters

file | a ThunarFile instance. |
setting_name | the name of the setting to set |
setting_value | the value to set |
async | whether g_file_set_attributes_async or g_file_set_attributes_from_info should be used |

### thunar_file_clear_metadata_setting ()

    void
    thunar_file_clear_metadata_setting (ThunarFile *file,
                                        const gchar *setting_name);

Clear the metadata setting `setting_name` of `file`

#### Parameters

file | a ThunarFile instance. |
setting_name | the name of the setting to clear |

### thunar_file_clear_directory_specific_settings ()

    void
    thunar_file_clear_directory_specific_settings
                                   (ThunarFile *file);

Clears all directory specific settings stored in the metadata of the folder represented by `file`

#### Parameters

file | a ThunarFile instance. |

### thunar_file_has_directory_specific_settings ()

    gboolean
    thunar_file_has_directory_specific_settings
                                   (ThunarFile *file);

Checks whether `file` has any directory specific settings stored in its metadata.

#### Parameters

file | a ThunarFile instance. |

#### Returns

`TRUE` if `file` has any directory specific settings stored in its metadata, and `FALSE` otherwise

### thunar_file_is_root()

    #define thunar_file_is_root(file) (thunar_g_file_is_root (thunar_file_get_file (file)))

Checks whether `file` refers to the root directory.

#### Parameters

file | a ThunarFile. |

#### Returns

`TRUE` if `file` is the root directory.

### thunar_file_has_parent()

    #define thunar_file_has_parent(file) (!thunar_file_is_root (THUNAR_FILE ((file))))

Checks whether it is possible to determine the parent ThunarFile for `file` .

#### Parameters

file | a ThunarFile instance. |

#### Returns

whether `file` has a parent.

### thunar_file_dup_uri()

    #define thunar_file_dup_uri(file) (g_file_get_uri (thunar_file_get_file (file)))

Returns the URI for the `file` . The caller is responsible to free the returned string when no longer needed.

#### Parameters

file | a ThunarFile instance. |

#### Returns

the URI for `file` .

### thunar_file_has_uri_scheme()

    #define thunar_file_has_uri_scheme(file, uri_scheme) (g_file_has_uri_scheme (thunar_file_get_file (file), (uri_scheme)))

Checks whether the URI scheme of the file matches `uri_scheme` .

#### Parameters

file | a ThunarFile instance. |
uri_scheme | a URI scheme string. |

#### Returns

TRUE, if the schemes match, FALSE otherwise.

### thunar_file_changed()

    #define             thunar_file_changed(file)

Emits the ::changed signal on `file` . This function is meant to be called by derived classes whenever they notice changes to the `file` .

#### Parameters

file | a ThunarFile instance. |

## Types and Values

### enum ThunarFileDateType

The various dates that can be queried about a ThunarFile. Note, that not all ThunarFile implementations support all types listed above. See the documentation of the `thunar_file_get_date()` method for details.

#### Members

THUNAR_FILE_DATE_ACCESSED | date of last access to the file. |
THUNAR_FILE_DATE_CHANGED | date of last change to the file meta data or the content. |
THUNAR_FILE_DATE_CREATED | date of file creation. |
THUNAR_FILE_DATE_MODIFIED | date of last modification of the file's content. |
THUNAR_FILE_DATE_DELETED | date of file deletion. |
THUNAR_FILE_RECENCY |  |

### enum ThunarFileIconState

The various file icon states that are used within the file manager views.

#### Members

THUNAR_FILE_ICON_STATE_DEFAULT | the default icon for the file. |
THUNAR_FILE_ICON_STATE_DROP | the drop accept icon for the file. |
THUNAR_FILE_ICON_STATE_OPEN | the folder is expanded. |

### enum ThunarFileThumbState

The state of the thumbnailing for a given ThunarFile.

#### Members

THUNAR_FILE_THUMB_STATE_UNKNOWN | unknown whether there's a thumbnail. |
THUNAR_FILE_THUMB_STATE_NONE | no thumbnail is available. |
THUNAR_FILE_THUMB_STATE_READY | a thumbnail is available. |
THUNAR_FILE_THUMB_STATE_LOADING | a thumbnail is being generated. |

### THUNAR_FILE_EMBLEM_NAME_SYMBOLIC_LINK

    #define THUNAR_FILE_EMBLEM_NAME_SYMBOLIC_LINK "emblem-symbolic-link"

### THUNAR_FILE_EMBLEM_NAME_CANT_READ

    #define THUNAR_FILE_EMBLEM_NAME_CANT_READ     "emblem-noread"

### THUNAR_FILE_EMBLEM_NAME_CANT_WRITE

    #define THUNAR_FILE_EMBLEM_NAME_CANT_WRITE    "emblem-nowrite"

### THUNAR_FILE_EMBLEM_NAME_DESKTOP

    #define THUNAR_FILE_EMBLEM_NAME_DESKTOP       "emblem-desktop"

## Signal Details

### The `“destroy”` signal

    void
    user_function (ThunarFile *file,
                   gpointer    user_data)

Emitted when the system notices that the `file` was destroyed.

#### Parameters

file | the ThunarFile instance. |
user_data | user data set when the signal handler was connected. |

Flags: No Hooks