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, cancellable)

create_failed_thumbnail_async (uri, original_mtime, cancellable, callback, *user_data)

create_failed_thumbnail_finish (result)

generate_thumbnail (uri, mime_type, cancellable)

generate_thumbnail_async (uri, mime_type, cancellable, callback, *user_data)

generate_thumbnail_finish (result)

has_valid_failed_thumbnail (uri, mtime)

lookup (uri, mtime)

save_thumbnail (thumbnail, uri, original_mtime, cancellable)

save_thumbnail_async (thumbnail, uri, original_mtime, cancellable, callback, *user_data)

save_thumbnail_finish (result)

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, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

True if everything went fine; False if there was an error.

Return type:

bool

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.

create_failed_thumbnail_async(uri, original_mtime, cancellable, callback, *user_data)
Parameters:
  • uri (str) – the uri of a file

  • original_mtime (int) – the modification time of the original file

  • cancellable (Gio.Cancellable or None) – a Cancellable object

  • callback (Gio.AsyncReadyCallback or None) – a function that will be called when the task has ended

  • user_data (object or None) – user data

Asynchronous version of GnomeDesktop.DesktopThumbnailFactory.create_failed_thumbnail()

New in version 43.0.

create_failed_thumbnail_finish(result)
Parameters:

result (Gio.AsyncResult) – the result of the operation

Raises:

GLib.Error

Returns:

True if the operation was correct; False if there was an error

Return type:

bool

generate_thumbnail(uri, mime_type, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

thumbnail pixbuf if thumbnailing succeeded, None otherwise and error will be set

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

generate_thumbnail_async(uri, mime_type, cancellable, callback, *user_data)
Parameters:

Asynchronous version of GnomeDesktop.DesktopThumbnailFactory.generate_thumbnail()

New in version 43.0.

generate_thumbnail_finish(result)
Parameters:

result (Gio.AsyncResult) – the result of the operation

Raises:

GLib.Error

Returns:

thumbnail pixbuf if thumbnailing succeeded, None otherwise.

Return type:

GdkPixbuf.Pixbuf

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, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

True if everything went fine; False if there was an error.

Return type:

bool

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.

save_thumbnail_async(thumbnail, uri, original_mtime, cancellable, callback, *user_data)
Parameters:

Asynchronous version of GnomeDesktop.DesktopThumbnailFactory.save_thumbnail()

New in version 43.0.

save_thumbnail_finish(result)
Parameters:

result (Gio.AsyncResult) – the result of the operation

Raises:

GLib.Error

Returns:

True if the operation was correct; False if there was an error

Return type:

bool