GnomeDesktop.DesktopThumbnailFactory

g GObject.Object GObject.Object GnomeDesktop.DesktopThumbnailFactory GnomeDesktop.DesktopThumbnailFactory GObject.Object->GnomeDesktop.DesktopThumbnailFactory

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
class new (size)
  can_thumbnail (uri, mime_type, mtime)
  create_failed_thumbnail (uri, mtime)
  generate_thumbnail (uri, mime_type)
  has_valid_failed_thumbnail (uri, mtime)
  lookup (uri, mtime)
  save_thumbnail (thumbnail, uri, original_mtime)

Virtual Methods

Inherited:GObject.Object (7)

Properties

None

Signals

Inherited:GObject.Object (1)

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent GObject.Object r  

Class Details

class GnomeDesktop.DesktopThumbnailFactory(**kwargs)
Bases:GObject.Object
Abstract:No
Structure:GnomeDesktop.DesktopThumbnailFactoryClass
classmethod new(size)
Parameters:size (GnomeDesktop.DesktopThumbnailSize) – The thumbnail size to use
Returns:a new GnomeDesktop.DesktopThumbnailFactory
Return type:GnomeDesktop.DesktopThumbnailFactory

Creates a new GnomeDesktop.DesktopThumbnailFactory.

This function must be called on the main thread and is non-blocking.

New in version 2.2.

can_thumbnail(uri, mime_type, mtime)
Parameters:
  • uri (str) – the uri of a file
  • mime_type (str) – the mime type of the file
  • mtime (int) – the mtime of the file
Returns:

True if the file can be thumbnailed.

Return type:

bool

Returns True if this GnomeDesktop.DesktopThumbnailFactory can (at least try) to thumbnail this file. Thumbnails or files with failed thumbnails won’t be thumbnailed.

Usage of this function is threadsafe and does blocking I/O.

New in version 2.2.

create_failed_thumbnail(uri, mtime)
Parameters:
  • uri (str) – the uri of a file
  • mtime (int) – the modification time of the file

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 and does blocking I/O.

New in version 2.2.

generate_thumbnail(uri, mime_type)
Parameters:
  • uri (str) – the uri of a file
  • mime_type (str) – the mime type of the file
Returns:

thumbnail pixbuf if thumbnailing succeeded, None otherwise.

Return type:

GdkPixbuf.Pixbuf

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 and does blocking I/O.

New in version 2.2.

has_valid_failed_thumbnail(uri, mtime)
Parameters:
  • uri (str) – the uri of a file
  • mtime (int) – the mtime of the file
Returns:

True if there is a failed thumbnail for the file.

Return type:

bool

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 and does blocking I/O.

New in version 2.2.

lookup(uri, mtime)
Parameters:
  • uri (str) – the uri of a file
  • mtime (int) – the mtime of the file
Returns:

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

Return type:

str

Tries to locate an existing thumbnail for the file specified.

Usage of this function is threadsafe and does blocking I/O.

New in version 2.2.

save_thumbnail(thumbnail, uri, original_mtime)
Parameters:
  • thumbnail (GdkPixbuf.Pixbuf) – the thumbnail as a pixbuf
  • uri (str) – the uri of a file
  • original_mtime (int) – the modification time of the original file

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

Usage of this function is threadsafe and does blocking I/O.

New in version 2.2.