ThunarVfsMimeInfo

## ThunarVfsMimeInfo ThunarVfsMimeInfo — Represents a MIME type in the system. |

## Synopsis

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

                        ThunarVfsMimeInfo;
    ThunarVfsMimeInfo * thunar_vfs_mime_info_new            (const gchar *name,
                                                             gssize len);
    ThunarVfsMimeInfo * thunar_vfs_mime_info_ref            (ThunarVfsMimeInfo *info);
    void                thunar_vfs_mime_info_unref          (ThunarVfsMimeInfo *info);
    const gchar *       thunar_vfs_mime_info_get_comment    (ThunarVfsMimeInfo *info);
    const gchar *       thunar_vfs_mime_info_get_name       (const ThunarVfsMimeInfo *info);
    gchar *             thunar_vfs_mime_info_get_media      (const ThunarVfsMimeInfo *info);
    gchar *             thunar_vfs_mime_info_get_subtype    (const ThunarVfsMimeInfo *info);
    guint               thunar_vfs_mime_info_hash           (gconstpointer info);
    gboolean            thunar_vfs_mime_info_equal          (gconstpointer a,
                                                             gconstpointer b);
    const gchar *       thunar_vfs_mime_info_lookup_icon_name
                                                            (ThunarVfsMimeInfo *info,
                                                             GtkIconTheme *icon_theme);
    void                thunar_vfs_mime_info_list_free      (GList *info_list);

## Description

## Details

### ThunarVfsMimeInfo

    typedef struct {
    } ThunarVfsMimeInfo;

The ThunarVfsMimeInfo struct contains private data only, and should be accessed using the functions below.

### thunar_vfs_mime_info_new ()

    ThunarVfsMimeInfo * thunar_vfs_mime_info_new            (const gchar *name,
                                                             gssize len);

Allocates a new ThunarVfsMimeInfo object with an initial reference count of one and sets it to the given `name`.

Note that no checking is performed on the given `name`. You should not normally use this function, but use `thunar_vfs_mime_database_get_info()` instead.

In addition, if you allocate ThunarVfsMimeInfos using this function, you cannot mix them with the objects allocated in a ThunarVfsMimeDatabase, because the ThunarVfsMimeDatabase and associated functions assume that ThunarVfsMimeInfo objects are unique.

`name` : | the mime type name.
`len` : | the length of `name` or `-1` if zero-terminated.
Returns : | the newly allocated ThunarVfsMimeInfo.

### thunar_vfs_mime_info_ref ()

    ThunarVfsMimeInfo * thunar_vfs_mime_info_ref            (ThunarVfsMimeInfo *info);

Increments the reference count on `info` and returns the reference to `info`.

`info` : | a ThunarVfsMimeInfo.
Returns : | a reference to `info`.

### thunar_vfs_mime_info_unref ()

    void                thunar_vfs_mime_info_unref          (ThunarVfsMimeInfo *info);

Decrements the reference count on `info` and releases the resources allocated for `info` once the reference count drops to zero.

`info` : | a ThunarVfsMimeInfo.

### thunar_vfs_mime_info_get_comment ()

    const gchar *       thunar_vfs_mime_info_get_comment    (ThunarVfsMimeInfo *info);

Determines the description for the given `info`.

Note that this method MUST NOT be called from threads other than the main thread, because it's not thread-safe!

`info` : | a ThunarVfsMimeInfo.
Returns : | the comment associated with the `info` or the empty string if no comment was provided.

### thunar_vfs_mime_info_get_name ()

    const gchar *       thunar_vfs_mime_info_get_name       (const ThunarVfsMimeInfo *info);

Returns the full qualified name of the MIME type described by the `info` object.

`info` : | a ThunarVfsMimeInfo.
Returns : | the name of `info`.

### thunar_vfs_mime_info_get_media ()

    gchar *             thunar_vfs_mime_info_get_media      (const ThunarVfsMimeInfo *info);

Returns the media portion of the MIME type, e.g. if your ThunarVfsMimeInfo instance refers to "text/plain", invoking this method will return "text".

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

`info` : | a ThunarVfsMimeInfo.
Returns : | the media portion of the MIME type.

### thunar_vfs_mime_info_get_subtype ()

    gchar *             thunar_vfs_mime_info_get_subtype    (const ThunarVfsMimeInfo *info);

Returns the subtype portion of the MIME type, e.g. if `info` refers to "application/octect-stream", this method will return "octect-stream".

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

`info` : | a ThunarVfsMimeInfo.
Returns : | the subtype portion of `info`.

### thunar_vfs_mime_info_hash ()

    guint               thunar_vfs_mime_info_hash           (gconstpointer info);

Calculates a hash value for `info`.

`info` : | a ThunarVfsMimeInfo.
Returns : | a hash value for `info`.

### thunar_vfs_mime_info_equal ()

    gboolean            thunar_vfs_mime_info_equal          (gconstpointer a,
                                                             gconstpointer b);

Compares `a` and `b` and returns `TRUE` if both are equal.

`a` : | a ThunarVfsMimeInfo.
`b` : | a ThunarVfsMimeInfo.
Returns : | `TRUE` if `a` and `b` are equal.

### thunar_vfs_mime_info_lookup_icon_name ()

    const gchar *       thunar_vfs_mime_info_lookup_icon_name
                                                            (ThunarVfsMimeInfo *info,
                                                             GtkIconTheme *icon_theme);

Tries to determine the name of a suitable icon for `info` in `icon_theme`. The returned icon name can then be used in calls to `gtk_icon_theme_lookup_icon()` or `gtk_icon_theme_load_icon()`.

The returned icon name is owned by `info` and MUST NOT be freed by the caller.

Note that this method MUST NOT be called from threads other than the main thread, because it's not thread-safe!

`info` : | a ThunarVfsMimeInfo.
`icon_theme` : | the GtkIconTheme on which to perform the lookup.
Returns : | a suitable icon name for `info` in `icon_theme`.

### thunar_vfs_mime_info_list_free ()

    void                thunar_vfs_mime_info_list_free      (GList *info_list);

Frees the list and all ThunarVfsMimeInfos contained within the list.

`info_list` : | a GList of ThunarVfsMimeInfos

## See Also

ThunarVfsMimeDatabase