FmThumbnailRequest: Libfm Reference Manual

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

## Functions

void | (*FmThumbnailReadyCallback) ()
FmThumbnailRequest * | fm_thumbnail_request ()
void | fm_thumbnail_request_cancel ()
FmFileInfo * | fm_thumbnail_request_get_file_info ()
GdkPixbuf * | fm_thumbnail_request_get_pixbuf ()
guint | fm_thumbnail_request_get_size ()

## Types and Values

#define | FmThumbnailRequest

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

## Functions

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

#### Parameters

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

Since: 0.1.0

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

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

req | request descriptor |

#### Returns

size in pixels.

Since: 0.1.0

## Types and Values

### FmThumbnailRequest

    #define FmThumbnailRequest FmThumbnailLoader