FmMimeType

## FmMimeType FmMimeType — Extended MIME types support. |

## Synopsis

                        FmMimeType;
    void                fm_mime_type_add_thumbnailer        (FmMimeType *mime_type,
                                                             gpointer thumbnailer);
    FmMimeType *        fm_mime_type_from_file_name         (const char *ufile_name);
    FmMimeType *        fm_mime_type_from_name              (const char *type);
    FmMimeType *        fm_mime_type_from_native_file       (const char *file_path,
                                                             const char *base_name,
                                                             struct stat *pstat);
    const char *        fm_mime_type_get_desc               (FmMimeType *mime_type);
    FmIcon *            fm_mime_type_get_icon               (FmMimeType *mime_type);
    const GList *       fm_mime_type_get_thumbnailers       (FmMimeType *mime_type);
    GList *             fm_mime_type_get_thumbnailers_list  (FmMimeType *mime_type);
    FmMimeType *        fm_mime_type_ref                    (FmMimeType *mime_type);
    void                fm_mime_type_remove_thumbnailer     (FmMimeType *mime_type,
                                                             gpointer thumbnailer);
    void                fm_mime_type_unref                  (gpointer mime_type_);

## Description

`include`: libfm/fm.h

## Details

### FmMimeType

    typedef struct _FmMimeType FmMimeType;

### fm_mime_type_add_thumbnailer ()

    void                fm_mime_type_add_thumbnailer        (FmMimeType *mime_type,
                                                             gpointer thumbnailer);

Adds `thumbnailer` to list of thumbnailers associated with `mime_type`.

`mime_type` : | a FmMimeType descriptor
`thumbnailer` : | anonymous thumbnailer pointer

Since 1.0.0

### fm_mime_type_from_file_name ()

    FmMimeType *        fm_mime_type_from_file_name         (const char *ufile_name);

Finds FmMimeType descriptor guessing type from `ufile_name`.

Before 1.0.0 this API had name fm_mime_type_get_for_file_name.

`ufile_name` : | file name to guess
Returns : | a FmMimeType object. [transfer full]

Since 0.1.0

### fm_mime_type_from_name ()

    FmMimeType *        fm_mime_type_from_name              (const char *type);

Finds FmMimeType descriptor for `type`.

Before 1.0.0 this API had name fm_mime_type_get_for_type.

`type` : | MIME type name
Returns : | a FmMimeType object. [transfer full]

Since 0.1.0

### fm_mime_type_from_native_file ()

    FmMimeType *        fm_mime_type_from_native_file       (const char *file_path,
                                                             const char *base_name,
                                                             struct stat *pstat);

Finds FmMimeType descriptor for provided data.

Before 1.0.0 this API had name fm_mime_type_get_for_native_file.

Note that this call does I/O and therefore can block.

`file_path` : | full path to file
`base_name` : | file basename
`pstat` : | file atrributes. [allow-none]
Returns : | a FmMimeType object. [transfer full]

Since 0.1.0

### fm_mime_type_get_desc ()

    const char *        fm_mime_type_get_desc               (FmMimeType *mime_type);

Retrieves human-readable description of MIME type. Returned data are owned by `mime_type` and should be not freed by caller.

`mime_type` : | a FmMimeType descriptor
Returns : | MIME type name.

Since 0.1.0

### fm_mime_type_get_icon ()

    FmIcon *            fm_mime_type_get_icon               (FmMimeType *mime_type);

Retrieves icon associated with `mime_type`. Returned data are owned by `mime_type` and should be not freed by caller.

`mime_type` : | a FmMimeType descriptor
Returns : | icon.

Since 0.1.0

### fm_mime_type_get_thumbnailers ()

    const GList *       fm_mime_type_get_thumbnailers       (FmMimeType *mime_type);

### Warning

`fm_mime_type_get_thumbnailers` has been deprecated since version 1.2.0 and should not be used in newly-written code. Use `fm_mime_type_get_thumbnailers_list()` instead.

Retrieves list of thumbnailers associated with `mime_type`. Returned data are owned by `mime_type` and should be not altered by caller.

`mime_type` : | a FmMimeType descriptor
Returns : | the list. [element-type gpointer][transfer none]

Since 1.0.0

### fm_mime_type_get_thumbnailers_list ()

    GList *             fm_mime_type_get_thumbnailers_list  (FmMimeType *mime_type);

Retrieves list of thumbnailers associated with `mime_type`. Returned data should be freed after usage.

`mime_type` : | a FmMimeType descriptor
Returns : | the list. [transfer full][element-type FmThumbnailer]

Since 1.2.0

### fm_mime_type_ref ()

    FmMimeType *        fm_mime_type_ref                    (FmMimeType *mime_type);

Increments reference count on `mime_type`.

`mime_type` : | a FmMimeType descriptor
Returns : | `mime_type`.

Since 0.1.0

### fm_mime_type_remove_thumbnailer ()

    void                fm_mime_type_remove_thumbnailer     (FmMimeType *mime_type,
                                                             gpointer thumbnailer);

Removes `thumbnailer` from list of thumbnailers associated with `mime_type`.

`mime_type` : | a FmMimeType descriptor
`thumbnailer` : | anonymous thumbnailer pointer

Since 1.0.0

### fm_mime_type_unref ()

    void                fm_mime_type_unref                  (gpointer mime_type_);

Decrements reference count on `mime_type_`.

`mime_type_` : | a FmMimeType descriptor

Since 0.1.0