GnomeDesktopThumbnailFactory

GnomeDesktopThumbnailFactory

Synopsis

enum                GnomeDesktopThumbnailSize;
struct              GnomeDesktopThumbnailFactory;
struct              GnomeDesktopThumbnailFactoryClass;
GnomeDesktopThumbnailFactory * gnome_desktop_thumbnail_factory_new
                                                        (GnomeDesktopThumbnailSize size);
char *              gnome_desktop_thumbnail_factory_lookup
                                                        (GnomeDesktopThumbnailFactory *factory,
                                                         const char *uri,
                                                         time_t mtime);
gboolean            gnome_desktop_thumbnail_factory_has_valid_failed_thumbnail
                                                        (GnomeDesktopThumbnailFactory *factory,
                                                         const char *uri,
                                                         time_t mtime);
gboolean            gnome_desktop_thumbnail_factory_can_thumbnail
                                                        (GnomeDesktopThumbnailFactory *factory,
                                                         const char *uri,
                                                         const char *mime_type,
                                                         time_t mtime);
GdkPixbuf *         gnome_desktop_thumbnail_factory_generate_thumbnail
                                                        (GnomeDesktopThumbnailFactory *factory,
                                                         const char *uri,
                                                         const char *mime_type);
void                gnome_desktop_thumbnail_factory_save_thumbnail
                                                        (GnomeDesktopThumbnailFactory *factory,
                                                         GdkPixbuf *thumbnail,
                                                         const char *uri,
                                                         time_t original_mtime);
void                gnome_desktop_thumbnail_factory_create_failed_thumbnail
                                                        (GnomeDesktopThumbnailFactory *factory,
                                                         const char *uri,
                                                         time_t mtime);
gboolean            gnome_desktop_thumbnail_has_uri     (GdkPixbuf *pixbuf,
                                                         const char *uri);
gboolean            gnome_desktop_thumbnail_is_valid    (GdkPixbuf *pixbuf,
                                                         const char *uri,
                                                         time_t mtime);
char *              gnome_desktop_thumbnail_md5         (const char *uri);
char *              gnome_desktop_thumbnail_path_for_uri
                                                        (const char *uri,
                                                         GnomeDesktopThumbnailSize size);
GdkPixbuf *         gnome_desktop_thumbnail_scale_down_pixbuf
                                                        (GdkPixbuf *pixbuf,
                                                         int dest_width,
                                                         int dest_height);
                    GnomeDesktopThumbnailFactoryPrivate;

Object Hierarchy

  GObject
   +----GnomeDesktopThumbnailFactory

Description

Details

enum GnomeDesktopThumbnailSize

typedef enum {
  GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL,
  GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE
} GnomeDesktopThumbnailSize;

GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL

GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE


struct GnomeDesktopThumbnailFactory

struct GnomeDesktopThumbnailFactory;


struct GnomeDesktopThumbnailFactoryClass

struct GnomeDesktopThumbnailFactoryClass {
	GObjectClass parent;
};


gnome_desktop_thumbnail_factory_new ()

GnomeDesktopThumbnailFactory * gnome_desktop_thumbnail_factory_new
                                                        (GnomeDesktopThumbnailSize size);

Creates a new GnomeDesktopThumbnailFactory.

This function must be called on the main thread.

size :

The thumbnail size to use

Returns :

a new GnomeDesktopThumbnailFactory

Since 2.2


gnome_desktop_thumbnail_factory_lookup ()

char *              gnome_desktop_thumbnail_factory_lookup
                                                        (GnomeDesktopThumbnailFactory *factory,
                                                         const char *uri,
                                                         time_t mtime);

Tries to locate an existing thumbnail for the file specified.

Usage of this function is threadsafe.

factory :

a GnomeDesktopThumbnailFactory

uri :

the uri of a file

mtime :

the mtime of the file

Returns :

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

Since 2.2


gnome_desktop_thumbnail_factory_has_valid_failed_thumbnail ()

gboolean            gnome_desktop_thumbnail_factory_has_valid_failed_thumbnail
                                                        (GnomeDesktopThumbnailFactory *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.

factory :

a GnomeDesktopThumbnailFactory

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


gnome_desktop_thumbnail_factory_can_thumbnail ()

gboolean            gnome_desktop_thumbnail_factory_can_thumbnail
                                                        (GnomeDesktopThumbnailFactory *factory,
                                                         const char *uri,
                                                         const char *mime_type,
                                                         time_t mtime);

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

Usage of this function is threadsafe.

factory :

a GnomeDesktopThumbnailFactory

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


gnome_desktop_thumbnail_factory_generate_thumbnail ()

GdkPixbuf *         gnome_desktop_thumbnail_factory_generate_thumbnail
                                                        (GnomeDesktopThumbnailFactory *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.

factory :

a GnomeDesktopThumbnailFactory

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


gnome_desktop_thumbnail_factory_save_thumbnail ()

void                gnome_desktop_thumbnail_factory_save_thumbnail
                                                        (GnomeDesktopThumbnailFactory *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.

factory :

a GnomeDesktopThumbnailFactory

thumbnail :

the thumbnail as a pixbuf

uri :

the uri of a file

original_mtime :

the modification time of the original file

Since 2.2


gnome_desktop_thumbnail_factory_create_failed_thumbnail ()

void                gnome_desktop_thumbnail_factory_create_failed_thumbnail
                                                        (GnomeDesktopThumbnailFactory *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.

factory :

a GnomeDesktopThumbnailFactory

uri :

the uri of a file

mtime :

the modification time of the file

Since 2.2


gnome_desktop_thumbnail_has_uri ()

gboolean            gnome_desktop_thumbnail_has_uri     (GdkPixbuf *pixbuf,
                                                         const char *uri);

Returns whether the thumbnail has the correct uri embedded in the Thumb::URI option in the png.

pixbuf :

an loaded thumbnail pixbuf

uri :

a uri

Returns :

TRUE if the thumbnail is for uri

Since 2.2


gnome_desktop_thumbnail_is_valid ()

gboolean            gnome_desktop_thumbnail_is_valid    (GdkPixbuf *pixbuf,
                                                         const char *uri,
                                                         time_t mtime);

Returns whether the thumbnail has the correct uri and mtime embedded in the png options.

pixbuf :

an loaded thumbnail GdkPixbuf

uri :

a uri

mtime :

the mtime

Returns :

TRUE if the thumbnail has the right uri and mtime

Since 2.2


gnome_desktop_thumbnail_md5 ()

char *              gnome_desktop_thumbnail_md5         (const char *uri);

Warning

gnome_desktop_thumbnail_md5 has been deprecated since version 2.22 and should not be used in newly-written code. Use GChecksum instead

Calculates the MD5 checksum of the uri. This can be useful if you want to manually handle thumbnail files.

uri :

an uri

Returns :

A string with the MD5 digest of the uri string.

Since 2.2


gnome_desktop_thumbnail_path_for_uri ()

char *              gnome_desktop_thumbnail_path_for_uri
                                                        (const char *uri,
                                                         GnomeDesktopThumbnailSize size);

Returns the filename that a thumbnail of size size for uri would have.

uri :

an uri

size :

a thumbnail size

Returns :

an absolute filename

Since 2.2


gnome_desktop_thumbnail_scale_down_pixbuf ()

GdkPixbuf *         gnome_desktop_thumbnail_scale_down_pixbuf
                                                        (GdkPixbuf *pixbuf,
                                                         int dest_width,
                                                         int dest_height);

Scales the pixbuf to the desired size. This function is a lot faster than gdk-pixbuf when scaling down by large amounts.

pixbuf :

a GdkPixbuf

dest_width :

the desired new width

dest_height :

the desired new height

Returns :

a scaled pixbuf. [transfer full]

Since 2.2


GnomeDesktopThumbnailFactoryPrivate

typedef struct _GnomeDesktopThumbnailFactoryPrivate GnomeDesktopThumbnailFactoryPrivate;