## FmMimeType

FmMimeType — Extended MIME types support.

## Functions

FmMimeType * | fm_mime_type_from_file_name ()
FmMimeType * | fm_mime_type_from_native_file ()
FmMimeType * | fm_mime_type_from_name ()
FmMimeType * | fm_mime_type_ref ()
void | fm_mime_type_unref ()
FmIcon * | fm_mime_type_get_icon ()
const char * | fm_mime_type_get_desc ()
const GList * | fm_mime_type_get_thumbnailers ()
GList * | fm_mime_type_get_thumbnailers_list ()
void | fm_mime_type_add_thumbnailer ()
void | fm_mime_type_remove_thumbnailer ()

## Description

`include` : libfm/fm.h

## Functions

### 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.

#### Parameters

ufile_name | file name to guess |

#### 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. If file does not exist then returns `NULL`.

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.

#### Parameters

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_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.

#### Parameters

type | MIME type name |

#### Returns

a FmMimeType object.

[transfer full]

Since: 0.1.0

### fm_mime_type_ref ()

    FmMimeType *
    fm_mime_type_ref (FmMimeType *mime_type);

Increments reference count on `mime_type` .

#### Parameters

mime_type | a FmMimeType descriptor |

#### Returns

`mime_type` .

Since: 0.1.0

### fm_mime_type_unref ()

    void
    fm_mime_type_unref (gpointer mime_type_);

Decrements reference count on `mime_type_` .

#### Parameters

mime_type_ | a FmMimeType descriptor |

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.

#### Parameters

mime_type | a FmMimeType descriptor |

#### Returns

icon.

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.

#### Parameters

mime_type | a FmMimeType descriptor |

#### Returns

MIME type name.

Since: 0.1.0

### fm_mime_type_get_thumbnailers ()

    const GList *
    fm_mime_type_get_thumbnailers (FmMimeType *mime_type);

`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.

#### Parameters

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.

#### Parameters

mime_type | a FmMimeType descriptor |

#### Returns

the list.

[transfer full][element-type FmThumbnailer]

Since: 1.2.0

### 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` .

#### Parameters

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

Since: 1.0.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` .

#### Parameters

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

Since: 1.0.0