mate-desktop 1.29.2
Library with common API for various MATE modules
Loading...
Searching...
No Matches
mate-desktop-thumbnail.h File Reference
View source
#include <glib.h>
#include <glib-object.h>
#include <time.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
Include dependency graph for mate-desktop-thumbnail.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  _MateDesktopThumbnailFactory
 
struct  _MateDesktopThumbnailFactoryClass
 

Macros

#define MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY   (mate_desktop_thumbnail_factory_get_type ())
 
#define MATE_DESKTOP_THUMBNAIL_FACTORY(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, MateDesktopThumbnailFactory))
 
#define MATE_DESKTOP_THUMBNAIL_FACTORY_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, MateDesktopThumbnailFactoryClass))
 
#define MATE_DESKTOP_IS_THUMBNAIL_FACTORY(obj)   (G_TYPE_INSTANCE_CHECK_TYPE ((obj), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY))
 
#define MATE_DESKTOP_IS_THUMBNAIL_FACTORY_CLASS(klass)   (G_TYPE_CLASS_CHECK_CLASS_TYPE ((klass), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY))
 

Typedefs

typedef struct _MateDesktopThumbnailFactory MateDesktopThumbnailFactory
 
typedef struct _MateDesktopThumbnailFactoryClass MateDesktopThumbnailFactoryClass
 
typedef struct _MateDesktopThumbnailFactoryPrivate MateDesktopThumbnailFactoryPrivate
 

Enumerations

enum  MateDesktopThumbnailSize { MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL , MATE_DESKTOP_THUMBNAIL_SIZE_LARGE }
 

Functions

GType mate_desktop_thumbnail_factory_get_type (void)
 
MateDesktopThumbnailFactory * mate_desktop_thumbnail_factory_new (MateDesktopThumbnailSize size)
 mate_desktop_thumbnail_factory_new: @size: The thumbnail size to use
 
char * mate_desktop_thumbnail_factory_lookup (MateDesktopThumbnailFactory *factory, const char *uri, time_t mtime)
 mate_desktop_thumbnail_factory_lookup: @factory: a MateDesktopThumbnailFactory @uri: the uri of a file @mtime: the mtime of the file
 
gboolean mate_desktop_thumbnail_factory_has_valid_failed_thumbnail (MateDesktopThumbnailFactory *factory, const char *uri, time_t mtime)
 mate_desktop_thumbnail_factory_has_valid_failed_thumbnail: @factory: a MateDesktopThumbnailFactory @uri: the uri of a file @mtime: the mtime of the file
 
gboolean mate_desktop_thumbnail_factory_can_thumbnail (MateDesktopThumbnailFactory *factory, const char *uri, const char *mime_type, time_t mtime)
 mate_desktop_thumbnail_factory_can_thumbnail: @factory: a MateDesktopThumbnailFactory @uri: the uri of a file @mime_type: the mime type of the file @mtime: the mtime of the file
 
GdkPixbuf * mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory *factory, const char *uri, const char *mime_type)
 mate_desktop_thumbnail_factory_generate_thumbnail: @factory: a MateDesktopThumbnailFactory @uri: the uri of a file @mime_type: the mime type of the file
 
void mate_desktop_thumbnail_factory_save_thumbnail (MateDesktopThumbnailFactory *factory, GdkPixbuf *thumbnail, const char *uri, time_t original_mtime)
 mate_desktop_thumbnail_factory_save_thumbnail: @factory: a MateDesktopThumbnailFactory @thumbnail: the thumbnail as a pixbuf @uri: the uri of a file @original_mtime: the modification time of the original file
 
void mate_desktop_thumbnail_factory_create_failed_thumbnail (MateDesktopThumbnailFactory *factory, const char *uri, time_t mtime)
 mate_desktop_thumbnail_factory_create_failed_thumbnail: @factory: a MateDesktopThumbnailFactory @uri: the uri of a file @mtime: the modification time of the file
 
gboolean mate_desktop_thumbnail_has_uri (GdkPixbuf *pixbuf, const char *uri)
 mate_desktop_thumbnail_has_uri: @pixbuf: an loaded thumbnail pixbuf @uri: a uri
 
gboolean mate_desktop_thumbnail_is_valid (GdkPixbuf *pixbuf, const char *uri, time_t mtime)
 mate_desktop_thumbnail_is_valid: @pixbuf: an loaded thumbnail #GdkPixbuf @uri: a uri @mtime: the mtime
 
char * mate_desktop_thumbnail_path_for_uri (const char *uri, MateDesktopThumbnailSize size)
 mate_desktop_thumbnail_path_for_uri: @uri: an uri @size: a thumbnail size
 

Macro Definition Documentation

◆ MATE_DESKTOP_IS_THUMBNAIL_FACTORY

#define MATE_DESKTOP_IS_THUMBNAIL_FACTORY (   obj)    (G_TYPE_INSTANCE_CHECK_TYPE ((obj), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY))

◆ MATE_DESKTOP_IS_THUMBNAIL_FACTORY_CLASS

#define MATE_DESKTOP_IS_THUMBNAIL_FACTORY_CLASS (   klass)    (G_TYPE_CLASS_CHECK_CLASS_TYPE ((klass), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY))

◆ MATE_DESKTOP_THUMBNAIL_FACTORY

#define MATE_DESKTOP_THUMBNAIL_FACTORY (   obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, MateDesktopThumbnailFactory))

◆ MATE_DESKTOP_THUMBNAIL_FACTORY_CLASS

#define MATE_DESKTOP_THUMBNAIL_FACTORY_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, MateDesktopThumbnailFactoryClass))

◆ MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY

#define MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY   (mate_desktop_thumbnail_factory_get_type ())

Typedef Documentation

◆ MateDesktopThumbnailFactory

◆ MateDesktopThumbnailFactoryClass

◆ MateDesktopThumbnailFactoryPrivate

Enumeration Type Documentation

◆ MateDesktopThumbnailSize

Enumerator
MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL 
MATE_DESKTOP_THUMBNAIL_SIZE_LARGE 

Function Documentation

◆ mate_desktop_thumbnail_factory_can_thumbnail()

gboolean mate_desktop_thumbnail_factory_can_thumbnail ( MateDesktopThumbnailFactory *  factory,
const char *  uri,
const char *  mime_type,
time_t  mtime 
)

mate_desktop_thumbnail_factory_can_thumbnail: @factory: a MateDesktopThumbnailFactory @uri: the uri of a file @mime_type: the mime type of the file @mtime: the mtime of the file

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

Usage of this function is threadsafe.

Return value: TRUE if the file can be thumbnailed.

Since: 2.2

References _MateDesktopThumbnailFactoryPrivate::lock, mate_desktop_thumbnail_factory_has_valid_failed_thumbnail(), mate_desktop_thumbnail_factory_is_disabled(), _MateDesktopThumbnailFactoryPrivate::mime_types_map, _MateDesktopThumbnailFactory::priv, Thumbnailer, and thumbnailer_try_exec().

Here is the call graph for this function:

◆ mate_desktop_thumbnail_factory_create_failed_thumbnail()

void mate_desktop_thumbnail_factory_create_failed_thumbnail ( MateDesktopThumbnailFactory *  factory,
const char *  uri,
time_t  mtime 
)

mate_desktop_thumbnail_factory_create_failed_thumbnail: @factory: a MateDesktopThumbnailFactory @uri: the uri of a file @mtime: 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.

Since: 2.2

References make_failed_thumbnail(), save_thumbnail(), and thumbnail_failed_path().

Referenced by create_thumbnail_for_filename().

Here is the call graph for this function:

◆ mate_desktop_thumbnail_factory_generate_thumbnail()

GdkPixbuf * mate_desktop_thumbnail_factory_generate_thumbnail ( MateDesktopThumbnailFactory *  factory,
const char *  uri,
const char *  mime_type 
)

mate_desktop_thumbnail_factory_generate_thumbnail: @factory: a MateDesktopThumbnailFactory @uri: the uri of a file @mime_type: the mime type of the file

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.

Return value: (transfer full): thumbnail pixbuf if thumbnailing succeeded, NULL otherwise.

Since: 2.2

References expand_thumbnailing_script(), get_preview_thumbnail(), _MateDesktopThumbnailFactoryPrivate::lock, mate_desktop_thumbnail_factory_is_disabled(), MATE_DESKTOP_THUMBNAIL_SIZE_LARGE, _MateDesktopThumbnailFactoryPrivate::mime_types_map, _MateDesktopThumbnailFactory::priv, _MateDesktopThumbnailFactoryPrivate::size, and Thumbnailer.

Referenced by main().

Here is the call graph for this function:

◆ mate_desktop_thumbnail_factory_get_type()

GType mate_desktop_thumbnail_factory_get_type ( void  )

◆ mate_desktop_thumbnail_factory_has_valid_failed_thumbnail()

gboolean mate_desktop_thumbnail_factory_has_valid_failed_thumbnail ( MateDesktopThumbnailFactory *  factory,
const char *  uri,
time_t  mtime 
)

mate_desktop_thumbnail_factory_has_valid_failed_thumbnail: @factory: a MateDesktopThumbnailFactory @uri: the uri of a file @mtime: the mtime of the file

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.

Return value: TRUE if there is a failed thumbnail for the file.

Since: 2.2

References lookup_failed_thumbnail_path(), _MateDesktopThumbnailFactory::priv, and _MateDesktopThumbnailFactoryPrivate::size.

Referenced by mate_desktop_thumbnail_factory_can_thumbnail().

Here is the call graph for this function:

◆ mate_desktop_thumbnail_factory_lookup()

char * mate_desktop_thumbnail_factory_lookup ( MateDesktopThumbnailFactory *  factory,
const char *  uri,
time_t  mtime 
)

mate_desktop_thumbnail_factory_lookup: @factory: a MateDesktopThumbnailFactory @uri: the uri of a file @mtime: the mtime of the file

Tries to locate an existing thumbnail for the file specified.

Usage of this function is threadsafe.

Return value: (transfer full): The absolute path of the thumbnail, or NULL if none exist.

Since: 2.2

References lookup_thumbnail_path(), _MateDesktopThumbnailFactory::priv, and _MateDesktopThumbnailFactoryPrivate::size.

Referenced by create_thumbnail_for_filename().

Here is the call graph for this function:

◆ mate_desktop_thumbnail_factory_new()

MateDesktopThumbnailFactory * mate_desktop_thumbnail_factory_new ( MateDesktopThumbnailSize  size)

mate_desktop_thumbnail_factory_new: @size: The thumbnail size to use

Creates a new MateDesktopThumbnailFactory.

This function must be called on the main thread.

Return value: a new MateDesktopThumbnailFactory

Since: 2.2

References MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, _MateDesktopThumbnailFactory::priv, and _MateDesktopThumbnailFactoryPrivate::size.

Referenced by main().

◆ mate_desktop_thumbnail_factory_save_thumbnail()

void mate_desktop_thumbnail_factory_save_thumbnail ( MateDesktopThumbnailFactory *  factory,
GdkPixbuf *  thumbnail,
const char *  uri,
time_t  original_mtime 
)

mate_desktop_thumbnail_factory_save_thumbnail: @factory: a MateDesktopThumbnailFactory @thumbnail: the thumbnail as a pixbuf @uri: the uri of a file @original_mtime: 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.

Since: 2.2

References make_failed_thumbnail(), _MateDesktopThumbnailFactory::priv, save_thumbnail(), _MateDesktopThumbnailFactoryPrivate::size, thumbnail_failed_path(), and thumbnail_path().

Referenced by create_thumbnail_for_filename().

Here is the call graph for this function:

◆ mate_desktop_thumbnail_has_uri()

gboolean mate_desktop_thumbnail_has_uri ( GdkPixbuf *  pixbuf,
const char *  uri 
)

mate_desktop_thumbnail_has_uri: @pixbuf: an loaded thumbnail pixbuf @uri: a uri

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

Return value: TRUE if the thumbnail is for @uri

Since: 2.2

◆ mate_desktop_thumbnail_is_valid()

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

mate_desktop_thumbnail_is_valid: @pixbuf: an loaded thumbnail #GdkPixbuf @uri: a uri @mtime: the mtime

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

Return value: TRUE if the thumbnail has the right @uri and @mtime

Since: 2.2

Referenced by validate_thumbnail_path().

◆ mate_desktop_thumbnail_path_for_uri()

char * mate_desktop_thumbnail_path_for_uri ( const char *  uri,
MateDesktopThumbnailSize  size 
)

mate_desktop_thumbnail_path_for_uri: @uri: an uri @size: a thumbnail size

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

Return value: an absolute filename

Since: 2.2

References thumbnail_path().

Here is the call graph for this function: