CafeDesktopThumbnailFactory: CAFE Desktop Library Reference Manual

## CafeDesktopThumbnailFactory CafeDesktopThumbnailFactory |

## Functions

CafeDesktopThumbnailFactory * | cafe_desktop_thumbnail_factory_new ()
char * | cafe_desktop_thumbnail_factory_lookup ()
gboolean | cafe_desktop_thumbnail_factory_has_valid_failed_thumbnail ()
gboolean | cafe_desktop_thumbnail_factory_can_thumbnail ()
GdkPixbuf * | cafe_desktop_thumbnail_factory_generate_thumbnail ()
void | cafe_desktop_thumbnail_factory_save_thumbnail ()
void | cafe_desktop_thumbnail_factory_create_failed_thumbnail ()

## Types and Values

struct | CafeDesktopThumbnailFactory
enum | CafeDesktopThumbnailSize

## Object Hierarchy

        GObject
        ╰── CafeDesktopThumbnailFactory

## Includes

    #include <cafe-thumbnail.h>

## Description

## Functions

### cafe_desktop_thumbnail_factory_new ()

    CafeDesktopThumbnailFactory *
    cafe_desktop_thumbnail_factory_new (CafeDesktopThumbnailSize size);

Creates a new CafeDesktopThumbnailFactory.

This function must be called on the main thread.

#### Parameters

size | The thumbnail size to use |

#### Returns

a new CafeDesktopThumbnailFactory

Since: 2.2

### cafe_desktop_thumbnail_factory_lookup ()

    char *
    cafe_desktop_thumbnail_factory_lookup (CafeDesktopThumbnailFactory *factory,
                                           const char *uri,
                                           time_t mtime);

Tries to locate an existing thumbnail for the file specified.

Usage of this function is threadsafe.

#### Parameters

factory | a CafeDesktopThumbnailFactory |
uri | the uri of a file |
mtime | the mtime of the file |

#### Returns

The absolute path of the thumbnail, or `NULL` if none exist.

[transfer full]

Since: 2.2

### cafe_desktop_thumbnail_factory_has_valid_failed_thumbnail ()

    gboolean
    cafe_desktop_thumbnail_factory_has_valid_failed_thumbnail
                                   (CafeDesktopThumbnailFactory *factory,
                                    const char *uri,
                                    time_t mtime);

Tries to locate an failed thumbnail for the file specified. Writing and looking for failed thumbnails is important to avoid to try to thumbnail e.g. broken images several times.

Usage of this function is threadsafe.

#### Parameters

factory | a CafeDesktopThumbnailFactory |
uri | the uri of a file |
mtime | the mtime of the file |

#### Returns

TRUE if there is a failed thumbnail for the file.

Since: 2.2

### cafe_desktop_thumbnail_factory_can_thumbnail ()

    gboolean
    cafe_desktop_thumbnail_factory_can_thumbnail
                                   (CafeDesktopThumbnailFactory *factory,
                                    const char *uri,
                                    const char *mime_type,
                                    time_t mtime);

Returns TRUE if this CafeDesktopThumbnail can (at least try) to thumbnail this file. Thumbnails or files with failed thumbnails won't be thumbnailed.

Usage of this function is threadsafe.

#### Parameters

factory | a CafeDesktopThumbnailFactory |
uri | the uri of a file |
mime_type | the mime type of the file |
mtime | the mtime of the file |

#### Returns

TRUE if the file can be thumbnailed.

Since: 2.2

### cafe_desktop_thumbnail_factory_generate_thumbnail ()

    GdkPixbuf *
    cafe_desktop_thumbnail_factory_generate_thumbnail
                                   (CafeDesktopThumbnailFactory *factory,
                                    const char *uri,
                                    const char *mime_type);

Tries to generate a thumbnail for the specified file. If it succeeds it returns a pixbuf that can be used as a thumbnail.

Usage of this function is threadsafe.

#### Parameters

factory | a CafeDesktopThumbnailFactory |
uri | the uri of a file |
mime_type | the mime type of the file |

#### Returns

thumbnail pixbuf if thumbnailing succeeded, `NULL` otherwise.

[transfer full]

Since: 2.2

### cafe_desktop_thumbnail_factory_save_thumbnail ()

    void
    cafe_desktop_thumbnail_factory_save_thumbnail
                                   (CafeDesktopThumbnailFactory *factory,
                                    GdkPixbuf *thumbnail,
                                    const char *uri,
                                    time_t original_mtime);

Saves `thumbnail` at the right place. If the save fails a failed thumbnail is written.

Usage of this function is threadsafe.

#### Parameters

factory | a CafeDesktopThumbnailFactory |
thumbnail | the thumbnail as a pixbuf |
uri | the uri of a file |
original_mtime | the modification time of the original file |

Since: 2.2

### cafe_desktop_thumbnail_factory_create_failed_thumbnail ()

    void
    cafe_desktop_thumbnail_factory_create_failed_thumbnail
                                   (CafeDesktopThumbnailFactory *factory,
                                    const char *uri,
                                    time_t mtime);

Creates a failed thumbnail for the file so that we don't try to re-thumbnail the file later.

Usage of this function is threadsafe.

#### Parameters

factory | a CafeDesktopThumbnailFactory |
uri | the uri of a file |
mtime | the modification time of the file |

Since: 2.2

## Types and Values

### struct CafeDesktopThumbnailFactory

    struct CafeDesktopThumbnailFactory;

### enum CafeDesktopThumbnailSize

#### Members

CAFE_DESKTOP_THUMBNAIL_SIZE_NORMAL |  |
CAFE_DESKTOP_THUMBNAIL_SIZE_LARGE |  |