## thunar-gio-extensions

thunar-gio-extensions

## Functions

GFile * | thunar_g_file_new_for_home ()
GFile * | thunar_g_file_new_for_root ()
GFile * | thunar_g_file_new_for_recent ()
GFile * | thunar_g_file_new_for_trash ()
GFile * | thunar_g_file_new_for_desktop ()
GFile * | thunar_g_file_new_for_computer ()
GFile * | thunar_g_file_new_for_network ()
GFile * | thunar_g_file_new_for_bookmarks ()
GFile * | thunar_g_file_resolve_symlink ()
gboolean | thunar_g_file_is_root ()
gboolean | thunar_g_file_is_trashed ()
gboolean | thunar_g_file_is_in_recent ()
gboolean | thunar_g_file_is_home ()
gboolean | thunar_g_file_is_trash ()
gboolean | thunar_g_file_is_recent ()
gboolean | thunar_g_file_is_computer ()
gboolean | thunar_g_file_is_network ()
GKeyFile * | thunar_g_file_query_key_file ()
gboolean | thunar_g_file_write_key_file ()
gchar * | thunar_g_file_get_location ()
const gchar * | thunar_g_file_guess_device_type ()
gchar * | thunar_g_file_get_display_name ()
gchar * | thunar_g_file_get_display_name_remote ()
gboolean | thunar_g_vfs_is_uri_scheme_supported ()
gboolean | thunar_g_file_get_free_space ()
gchar * | thunar_g_file_get_free_space_string ()
gboolean | thunar_g_file_copy ()
gboolean | thunar_g_file_compare_contents ()
GList * | thunar_g_file_list_new_from_string ()
gchar ** | thunar_g_file_list_to_stringv ()
GList * | thunar_g_file_list_get_parents ()
gboolean | thunar_g_file_is_descendant ()
#define | thunar_g_list_append_deep()
#define | thunar_g_list_prepend_deep()
gboolean | thunar_g_app_info_launch ()
gboolean | thunar_g_app_info_should_show ()
gboolean | thunar_g_vfs_metadata_is_supported ()
gboolean | thunar_g_file_is_on_local_device ()
gboolean | thunar_g_file_set_executable_flags ()
gboolean | thunar_g_file_is_in_xdg_data_dir ()
gboolean | thunar_g_file_is_desktop_file ()
char * | thunar_g_file_get_link_path_for_symlink ()
void | thunar_g_file_set_metadata_setting ()
void | thunar_g_file_clear_metadata_setting ()
gchar * | thunar_g_file_get_metadata_setting ()
char * | thunar_g_file_get_content_type ()

## Types and Values

#define | THUNAR_METADATA_STRING_DELIMETER
enum | ThunarGType
#define | THUNAR_TYPE_G_FILE_HASH_TABLE
#define | thunar_g_list_copy_deep
#define | thunar_g_list_free_full

## Description

## Functions

### thunar_g_file_new_for_home ()

    GFile *
    thunar_g_file_new_for_home (void);

### thunar_g_file_new_for_root ()

    GFile *
    thunar_g_file_new_for_root (void);

### thunar_g_file_new_for_recent ()

    GFile *
    thunar_g_file_new_for_recent (void);

### thunar_g_file_new_for_trash ()

    GFile *
    thunar_g_file_new_for_trash (void);

### thunar_g_file_new_for_desktop ()

    GFile *
    thunar_g_file_new_for_desktop (void);

### thunar_g_file_new_for_computer ()

    GFile *
    thunar_g_file_new_for_computer (void);

### thunar_g_file_new_for_network ()

    GFile *
    thunar_g_file_new_for_network (void);

### thunar_g_file_new_for_bookmarks ()

    GFile *
    thunar_g_file_new_for_bookmarks (void);

### thunar_g_file_resolve_symlink ()

    GFile *
    thunar_g_file_resolve_symlink (GFile *file);

Returns the resolved symlink target of `file` as a new GFile. If `file` is not a symlink, `file` will just be returned

#### Parameters

file | a GFile |

#### Returns

A GFile on success and `NULL` on failure.

[nullable][transfer full]

### thunar_g_file_is_root ()

    gboolean
    thunar_g_file_is_root (GFile *file);

### thunar_g_file_is_trashed ()

    gboolean
    thunar_g_file_is_trashed (GFile *file);

### thunar_g_file_is_in_recent ()

    gboolean
    thunar_g_file_is_in_recent (GFile *file);

### thunar_g_file_is_home ()

    gboolean
    thunar_g_file_is_home (GFile *file);

### thunar_g_file_is_trash ()

    gboolean
    thunar_g_file_is_trash (GFile *file);

### thunar_g_file_is_recent ()

    gboolean
    thunar_g_file_is_recent (GFile *file);

### thunar_g_file_is_computer ()

    gboolean
    thunar_g_file_is_computer (GFile *file);

### thunar_g_file_is_network ()

    gboolean
    thunar_g_file_is_network (GFile *file);

### thunar_g_file_query_key_file ()

    GKeyFile *
    thunar_g_file_query_key_file (GFile *file,
                                  GCancellable *cancellable,
                                  GError **error);

### thunar_g_file_write_key_file ()

    gboolean
    thunar_g_file_write_key_file (GFile *file,
                                  GKeyFile *key_file,
                                  GCancellable *cancellable,
                                  GError **error);

### thunar_g_file_get_location ()

    gchar *
    thunar_g_file_get_location (GFile *file);

### thunar_g_file_guess_device_type ()

    const gchar *
    thunar_g_file_guess_device_type (GFile *file);

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

#### Parameters

file | a GFile instance. |

### thunar_g_file_get_display_name ()

    gchar *
    thunar_g_file_get_display_name (GFile *file);

### thunar_g_file_get_display_name_remote ()

    gchar *
    thunar_g_file_get_display_name_remote (GFile *file);

### thunar_g_vfs_is_uri_scheme_supported ()

    gboolean
    thunar_g_vfs_is_uri_scheme_supported (const gchar *scheme);

### thunar_g_file_get_free_space ()

    gboolean
    thunar_g_file_get_free_space (GFile *file,
                                  guint64 *fs_free_return,
                                  guint64 *fs_size_return);

Determines the amount of free space of the volume on which `file` resides. Returns `TRUE` if the amount of free space was determined successfully and placed into `free_space_return` , else `FALSE` will be returned.

#### Parameters

file | a GFile instance. |
fs_free_return | return location for the amount of free space or `NULL`. |
fs_size_return | return location for the total volume size. |

#### Returns

`TRUE` if successfull, else `FALSE`.

### thunar_g_file_get_free_space_string ()

    gchar *
    thunar_g_file_get_free_space_string (GFile *file,
                                         gboolean file_size_binary);

### thunar_g_file_copy ()

    gboolean
    thunar_g_file_copy (GFile *source,
                        GFile *destination,
                        GFileCopyFlags flags,
                        gboolean use_partial,
                        GCancellable *cancellable,
                        GFileProgressCallback progress_callback,
                        gpointer progress_callback_data,
                        GError **error);

Calls `g_file_copy()` if `use_partial` is not enabled. If enabled, copies files to *.partial~ first and then renames *.partial~ into its original name.

#### Parameters

source | input GFile |
destination | destination GFile |
flags | set of GFileCopyFlags |
use_partial | option to use *.partial~ |
cancellable | optional GCancellable object. | [nullable]
progress_callback | function to callback with progress information. | [nullable][scope call]
progress_callback_data | user data to pass to `progress_callback` . | [clousure]
error | GError to set on error. | [nullable]

#### Returns

`TRUE` on success, `FALSE` otherwise.

### thunar_g_file_compare_contents ()

    gboolean
    thunar_g_file_compare_contents (GFile *file_a,
                                    GFile *file_b,
                                    GCancellable *cancellable,
                                    GError **error);

Compares the contents of `file_a` and `file_b` .

#### Parameters

file_a | a GFile |
file_b | a GFile |
cancellable | optional GCancellable object. | [nullalble]
error | optional GError. | [nullalble]

#### Returns

`TRUE` if the files match, `FALSE` if not.

### thunar_g_file_list_new_from_string ()

    GList *
    thunar_g_file_list_new_from_string (const gchar *string);

Splits an URI list conforming to the text/uri-list mime type defined in RFC 2483 into individual URIs, discarding any comments and whitespace. The resulting list will hold one GFile for each URI.

If `string` contains no URIs, this function will return `NULL`.

#### Parameters

string | a string representation of an URI list. |

#### Returns

the list of GFiles or `NULL`.

### thunar_g_file_list_to_stringv ()

    gchar **
    thunar_g_file_list_to_stringv (GList *list);

Free the returned value using `g_strfreev()` when you are done with it. Useful for gtk_selection_data_set_uris.

#### Parameters

list | a list of GFiles. |

#### Returns

and array of uris.

### thunar_g_file_list_get_parents ()

    GList *
    thunar_g_file_list_get_parents (GList *list);

Collects all parent folders of the passed files If multiple files share the same parent, the parent will only be added once to the returned list. Each list element of the returned list needs to be freed with `g_object_unref()` after use.

#### Parameters

list | a list of GFiles. |

#### Returns

A list of GFiles of all parent folders. Free the returned list with calling `g_object_unref()` on each element

### thunar_g_file_is_descendant ()

    gboolean
    thunar_g_file_is_descendant (GFile *descendant,
                                 GFile *ancestor);

Check if `descendant` is a subdirectory of `ancestor` . `descendant` == `ancestor` also counts.

#### Parameters

descendant | a GFile that is a potential descendant of `ancestor` |
ancestor | a GFile |

#### Returns

`TRUE` if `descendant` is a subdirectory of `ancestor` .

### thunar_g_list_append_deep()

    #define thunar_g_list_append_deep(list, object) g_list_append (list, g_object_ref (G_OBJECT (object)))

### thunar_g_list_prepend_deep()

    #define thunar_g_list_prepend_deep(list, object) g_list_prepend (list, g_object_ref (G_OBJECT (object)))

### thunar_g_app_info_launch ()

    gboolean
    thunar_g_app_info_launch (GAppInfo *info,
                              GFile *working_directory,
                              GList *path_list,
                              GAppLaunchContext *context,
                              GError **error);

### thunar_g_app_info_should_show ()

    gboolean
    thunar_g_app_info_should_show (GAppInfo *info);

### thunar_g_vfs_metadata_is_supported ()

    gboolean
    thunar_g_vfs_metadata_is_supported (void);

### thunar_g_file_is_on_local_device ()

    gboolean
    thunar_g_file_is_on_local_device (GFile *file);

Tries to find if the `file` is on a local device or not. Local device if (all conditions should match):

- the file has a 'file' uri scheme.

- the file is located on devices not handled by the GVolumeMonitor (GVFS).

- the device is handled by GVolumeMonitor (GVFS) and cannot be unmounted (USB key/disk, fuse mounts, Samba shares, PTP devices).

The target `file` may not exist yet when this function is used, so recurse the parent directory, possibly reaching the root mountpoint.

This should be enough to determine if a `file` is on a local device or not.

#### Parameters

file | the source or target GFile to test. |

#### Returns

`TRUE` if GFile `file` is on a so-called local device.

### thunar_g_file_set_executable_flags ()

    gboolean
    thunar_g_file_set_executable_flags (GFile *file,
                                        GError **error);

Tries to set +x flag of the file for user, group and others

#### Parameters

file | the GFile for which execute flags should be set |

#### Returns

`TRUE` on sucess, `FALSE` on error

### thunar_g_file_is_in_xdg_data_dir ()

    gboolean
    thunar_g_file_is_in_xdg_data_dir (GFile *file);

Returns `TRUE` if `file` is located below one of the directories given in XDG_DATA_DIRS

#### Parameters

file | a GFile. |

#### Returns

`TRUE` if `file` is located inside a XDG_DATA_DIR

### thunar_g_file_is_desktop_file ()

    gboolean
    thunar_g_file_is_desktop_file (GFile *file);

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

#### Parameters

file | a GFile. |

#### Returns

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

### thunar_g_file_get_link_path_for_symlink ()

    char *
    thunar_g_file_get_link_path_for_symlink
                                   (GFile *file_to_link,
                                    GFile *symlink);

Method to build the link target path in order to link from `symlink` to `file_to_link` . The caller is responsible for freeing the string using `g_free()` when done.

#### Parameters

file_to_link | the GFile to which `symlink` will have to point |
symlink | a GFile representing the symlink |

#### Returns

The link path, or NULL on failure

### thunar_g_file_set_metadata_setting ()

    void
    thunar_g_file_set_metadata_setting (GFile *file,
                                        GFileInfo *info,
                                        ThunarGType type,
                                        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 GFile instance. |
info | Additional GFileInfo instance to update |
type | ThunarGType of the metadata |
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_g_file_clear_metadata_setting ()

    void
    thunar_g_file_clear_metadata_setting (GFile *file,
                                          GFileInfo *info,
                                          const gchar *setting_name);

### thunar_g_file_get_metadata_setting ()

    gchar *
    thunar_g_file_get_metadata_setting (GFile *file,
                                        GFileInfo *info,
                                        ThunarGType type,
                                        const gchar *setting_name);

### thunar_g_file_get_content_type ()

    char *
    thunar_g_file_get_content_type (GFile *file);

Gets the content type of the passed GFile. Will always return a valid string.

#### Parameters

file | GFile for which the content type will be returned |

#### Returns

The content type as gchar The returned string should be freed with `g_free()` when no longer needed.

[transfer full]

## Types and Values

### THUNAR_METADATA_STRING_DELIMETER

    #define THUNAR_METADATA_STRING_DELIMETER "|"

### enum ThunarGType

#### Members

THUNAR_GTYPE_STRING |  |
THUNAR_GTYPE_STRINGV |  |

### THUNAR_TYPE_G_FILE_HASH_TABLE

    #define THUNAR_TYPE_G_FILE_HASH_TABLE (thunar_g_file_hastable_get_type ())

Returns the type ID for GHashTables (used as a set) which is a boxed type.

### thunar_g_list_copy_deep

    #define thunar_g_list_copy_deep thunarx_file_info_list_copy

### thunar_g_list_free_full

    #define thunar_g_list_free_full thunarx_file_info_list_free