## FmThumbnailRequest FmThumbnailRequest — A thumbnails cache loader and generator. |

## Synopsis

    void                (*FmThumbnailReadyCallback)         (FmThumbnailRequest *req,
                                                             gpointer data);
    #define             FmThumbnailRequest
    FmThumbnailRequest * fm_thumbnail_request               (FmFileInfo *src_file,
                                                             guint size,
                                                             FmThumbnailReadyCallback callback,
                                                             gpointer user_data);
    void                fm_thumbnail_request_cancel         (FmThumbnailRequest *req);
    FmFileInfo *        fm_thumbnail_request_get_file_info  (FmThumbnailRequest *req);
    GdkPixbuf *         fm_thumbnail_request_get_pixbuf     (FmThumbnailRequest *req);
    guint               fm_thumbnail_request_get_size       (FmThumbnailRequest *req);

## Description

`include`: libfm/fm-gtk.h

This API allows to generate thumbnails for files and save them on disk then use that cache next time to display them.

## Details

### FmThumbnailReadyCallback ()

    void                (*FmThumbnailReadyCallback)         (FmThumbnailRequest *req,
                                                             gpointer data);

The callback to requestor when thumbnail is ready. Note that this call is done outside of GTK loop so if the callback wants to use any GTK API it should call `gdk_threads_enter()` and `gdk_threads_leave()` for safety.

`req` : | request descriptor
`data` : | user data provided when request was made

Since 0.1.0

### FmThumbnailRequest

    #define FmThumbnailRequest FmThumbnailLoader

### fm_thumbnail_request ()

    FmThumbnailRequest * fm_thumbnail_request               (FmFileInfo *src_file,
                                                             guint size,
                                                             FmThumbnailReadyCallback callback,
                                                             gpointer user_data);

Schedules loading/generation of thumbnail for `src_file`. If the request isn't cancelled then ready thumbnail will be given to the requestor in `callback`. Returned descriptor can be used to cancel the job.

`src_file` : | an image file
`size` : | thumbnail size
`callback` : | callback to requestor
`user_data` : | data provided for `callback`
Returns : | request descriptor. [transfer none]

Since 0.1.0

### fm_thumbnail_request_cancel ()

    void                fm_thumbnail_request_cancel         (FmThumbnailRequest *req);

Cancels request. After return from this call the `req` becomes invalid and cannot be used. Caller will never get callback for cancelled request either.

`req` : | the request descriptor

Since 0.1.0

### fm_thumbnail_request_get_file_info ()

    FmFileInfo *        fm_thumbnail_request_get_file_info  (FmThumbnailRequest *req);

Retrieves file descriptor that request is for. Returned data are owned by `req` and should be not freed by caller.

`req` : | request descriptor
Returns : | file descriptor. [transfer none]

Since 0.1.0

### fm_thumbnail_request_get_pixbuf ()

    GdkPixbuf *         fm_thumbnail_request_get_pixbuf     (FmThumbnailRequest *req);

Retrieves loaded thumbnail. Returned data are owned by `req` and should be not freed by caller.

`req` : | request descriptor
Returns : | thumbnail. [transfer none]

Since 0.1.0

### fm_thumbnail_request_get_size ()

    guint               fm_thumbnail_request_get_size       (FmThumbnailRequest *req);

Retrieves thumbnail size that request is for.

`req` : | request descriptor
Returns : | size in pixels.

Since 0.1.0