Top | ![]() |
![]() |
![]() |
![]() |
void | (*FmThumbnailLoaderCallback) () |
void | fm_thumbnail_loader_cancel () |
GObject * | fm_thumbnail_loader_get_data () |
FmFileInfo * | fm_thumbnail_loader_get_file_info () |
guint | fm_thumbnail_loader_get_size () |
FmThumbnailLoader * | fm_thumbnail_loader_load () |
gboolean | fm_thumbnail_loader_set_backend () |
include
: libfm/fm.h
This API allows to generate thumbnails for files and save them on disk then use that cache next time to display them.
void (*FmThumbnailLoaderCallback) (FmThumbnailLoader *req
,gpointer data
);
The callback to requestor when thumbnail is ready.
Note that this call is done outside of GTK loop so if the callback
wants to use any GTK API it should call gdk_threads_enter()
and
gdk_threads_leave()
for safety.
Since: 1.2.0
void
fm_thumbnail_loader_cancel (FmThumbnailLoader *req
);
Cancels request. After return from this call the req
becomes invalid
and cannot be used. Caller will never get callback for cancelled
request either.
Since: 1.2.0
GObject *
fm_thumbnail_loader_get_data (FmThumbnailLoader *req
);
Retrieves loaded thumbnail. Returned data are owned by req
and should
be not freed by caller.
Since: 1.2.0
FmFileInfo *
fm_thumbnail_loader_get_file_info (FmThumbnailLoader *req
);
Retrieves file descriptor that request is for. Returned data are
owned by req
and should be not freed by caller.
Since: 1.2.0
guint
fm_thumbnail_loader_get_size (FmThumbnailLoader *req
);
Retrieves thumbnail size that request is for.
Since: 1.2.0
FmThumbnailLoader * fm_thumbnail_loader_load (FmFileInfo *src_file
,guint size
,FmThumbnailLoaderCallback callback
,gpointer user_data
);
Schedules loading/generation of thumbnail for src_file
. If the
request isn't cancelled then ready thumbnail will be given to the
requestor in callback
. Returned descriptor can be used to cancel
the job.
src_file |
an image file |
|
size |
thumbnail size |
|
callback |
callback to requestor |
|
user_data |
data provided for |
Since: 1.2.0
gboolean
fm_thumbnail_loader_set_backend (FmThumbnailLoaderBackend *_backend
);
Sets callbacks list for further usage by thumbnail loader. Callbacks
should implement operations with image representation for application
specific model. This function can be called only once per application
and every subsequent call will return FALSE
and change nothing.
Since: 1.2.0
struct FmThumbnailLoaderBackend { GObject* (*read_image_from_file)(const char* filename); GObject* (*read_image_from_stream)(GInputStream* stream, guint64 len, GCancellable* cancellable); gboolean (*write_image)(GObject* image, const char* filename); GObject* (*scale_image)(GObject* ori_pix, int new_width, int new_height); GObject* (*rotate_image)(GObject* image, int degree); int (*get_image_width)(GObject* image); int (*get_image_height)(GObject* image); char* (*get_image_text)(GObject* image, const char* key); gboolean (*set_image_text)(GObject* image, const char* key, const char* val); // const char* (*get_image_orientation)(GObject* image); // GObject* (*apply_orientation)(GObject* image); };
Abstract backend callbacks list.
callback to read image by file path |
||
callback to read image by opened GInputStream |
||
callback to write thumbnail file from image |
||
callback to change image sizes |
||
callback to change image orientation |
||
callback to retrieve width from image |
||
callback to retrieve height from image |
||
callback to retrieve custom attributes text from image |
||
callback to set custom attributes text into image |