Thumbnail

Enumerations

enum  Elm_Thumb_Animation_Setting {
  ELM_THUMB_ANIMATION_START = 0,
  ELM_THUMB_ANIMATION_LOOP,
  ELM_THUMB_ANIMATION_STOP
}
 Used to set if a video thumbnail is animating or not. More...

Functions

Eina_Bool elm_need_ethumb (void)
 Request that your elementary application needs ethumb.
Evas_Object * elm_thumb_add (Evas_Object *parent)
 Add a new thumb object to the parent.
void elm_thumb_reload (Evas_Object *obj)
 Reload thumbnail if it was generated before.
void elm_thumb_file_set (Evas_Object *obj, const char *file, const char *key)
 Set the file that will be used as thumbnail source.
void elm_thumb_file_get (const Evas_Object *obj, const char **file, const char **key)
 Get the image or video path and key used to generate the thumbnail.
void elm_thumb_path_get (const Evas_Object *obj, const char **file, const char **key)
 Get the path and key to the image or video thumbnail generated by ethumb.
void elm_thumb_animate_set (Evas_Object *obj, Elm_Thumb_Animation_Setting s)
 Set the animation state for the thumb object.
Elm_Thumb_Animation_Setting elm_thumb_animate_get (const Evas_Object *obj)
 Get the animation state for the thumb object.
void * elm_thumb_ethumb_client_get (void)
 Get the ethumb_client handle so custom configuration can be made.
Eina_Bool elm_thumb_ethumb_client_connected_get (void)
 Get the ethumb_client connection state.
Eina_Bool elm_thumb_editable_set (Evas_Object *obj, Eina_Bool edit)
 Make the thumbnail 'editable'.
Eina_Bool elm_thumb_editable_get (const Evas_Object *obj)
 Make the thumbnail 'editable'.

Detailed Description

thumb_inheritance_tree.png
preview-00.png

A thumbnail object is used for displaying the thumbnail of an image or video. You must have compiled Elementary with Ethumb_Client support. Also, Ethumb's DBus service must be present and auto-activated in order to have thumbnails generated. You must also have a session bus, not a system one.

Once the thumbnail object becomes visible, it will check if there is a previously generated thumbnail image for the file set on it. If not, it will start generating this thumbnail.

Different configuration settings will cause different thumbnails to be generated even on the same file.

Generated thumbnails are stored under $HOME/.thumbnails/. Check Ethumb's documentation to change this path, and to see other configuration options.

This widget emits the following signals:

  • "clicked" - This is called when a user has clicked the thumbnail object without dragging it around.
  • "clicked,double" - This is called when a user has double-clicked the thumbnail object.
  • "press" - This is called when a user has pressed down over the thumbnail object.
  • "generate,start" - The thumbnail generation has started.
  • "generate,stop" - The generation process has stopped.
  • "generate,error" - The thumbnail generation failed.
  • "load,error" - The thumbnail image loading failed.

Available styles:

  • "default"
  • "noframe"

An example of use of thumbnail:


Enumeration Type Documentation

Used to set if a video thumbnail is animating or not.

Enumerator:
ELM_THUMB_ANIMATION_START 

Play animation once.

ELM_THUMB_ANIMATION_LOOP 

Keep playing animation until stop is requested.

ELM_THUMB_ANIMATION_STOP 

Stop playing the animation.


Function Documentation

Eina_Bool elm_need_ethumb ( void  )

Request that your elementary application needs ethumb.

This initializes the Ethumb library when called and if support exists it returns EINA_TRUE, otherwise returns EINA_FALSE. This must be called before any other function that deals with elm_thumb objects or ethumb_client instances.

Examples:
fileselector_example.c, and thumb_example_01.c.
Evas_Object* elm_thumb_add ( Evas_Object *  parent)

Add a new thumb object to the parent.

Parameters:
parentThe parent object.
Returns:
The new object or NULL if it cannot be created.
See also:
elm_thumb_file_set()
elm_thumb_ethumb_client_get()
Elm_Thumb_Animation_Setting elm_thumb_animate_get ( const Evas_Object *  obj)

Get the animation state for the thumb object.

Parameters:
objThe thumb object.
Returns:
getting The animation setting or ELM_THUMB_ANIMATION_LAST, on errors.
See also:
elm_thumb_animate_set()
void elm_thumb_animate_set ( Evas_Object *  obj,
Elm_Thumb_Animation_Setting  s 
)

Set the animation state for the thumb object.

If its content is an animated video, you may start/stop the animation or tell it to play continuously and looping.

Parameters:
objThe thumb object.
sThe animation setting.
See also:
elm_thumb_file_set()

References ELM_THUMB_ANIMATION_LOOP, ELM_THUMB_ANIMATION_START, and ELM_THUMB_ANIMATION_STOP.

Eina_Bool elm_thumb_editable_get ( const Evas_Object *  obj)

Make the thumbnail 'editable'.

Parameters:
objThumb object.
Returns:
Editability.

This means the thumbnail is a valid drag target for drag and drop, and can be cut or pasted too.

See also:
elm_thumb_editable_set()
Eina_Bool elm_thumb_editable_set ( Evas_Object *  obj,
Eina_Bool  edit 
)

Make the thumbnail 'editable'.

Parameters:
objThumb object.
editTurn on or off editability. Default is EINA_FALSE.

This means the thumbnail is a valid drag target for drag and drop, and can be cut or pasted too.

See also:
elm_thumb_editable_get()

References ELM_SEL_FORMAT_IMAGE.

Eina_Bool elm_thumb_ethumb_client_connected_get ( void  )

Get the ethumb_client connection state.

Returns:
EINA_TRUE if the client is connected to the server or EINA_FALSE otherwise.

Referenced by elm_icon_thumb_set().

void* elm_thumb_ethumb_client_get ( void  )

Get the ethumb_client handle so custom configuration can be made.

Returns:
Ethumb_Client instance or NULL.

This must be called before the objects are created to be sure no object is visible and no generation started.

Example of usage:

 #include <Elementary.h>
 #ifndef ELM_LIB_QUICKLAUNCH
 EAPI_MAIN int
 elm_main(int argc, char **argv)
 {
    Ethumb_Client *client;

    elm_need_ethumb();

    // ... your code

    client = elm_thumb_ethumb_client_get();
    if (!client)
      {
         ERR("could not get ethumb_client");
         return 1;
      }
    ethumb_client_size_set(client, 100, 100);
    ethumb_client_crop_align_set(client, 0.5, 0.5);
    // ... your code

    // Create elm_thumb objects here

    elm_run();
    elm_shutdown();
    return 0;
 }
 #endif
 ELM_MAIN()
Note:
There's only one client handle for Ethumb, so once a configuration change is done to it, any other request for thumbnails (for any thumbnail object) will use that configuration. Thus, this configuration is global.
void elm_thumb_file_get ( const Evas_Object *  obj,
const char **  file,
const char **  key 
)

Get the image or video path and key used to generate the thumbnail.

Parameters:
objThe thumb object.
filePointer to filename.
keyPointer to key.
See also:
elm_thumb_file_set()
elm_thumb_path_get()
void elm_thumb_file_set ( Evas_Object *  obj,
const char *  file,
const char *  key 
)

Set the file that will be used as thumbnail source.

Parameters:
objThe thumb object.
fileThe path to file that will be used as thumbnail source.
keyThe key used in case of an EET file.

The file can be an image or a video (in that case, acceptable extensions are: avi, mp4, ogv, mov, mpg and wmv). To start the video animation, use the function elm_thumb_animate().

See also:
elm_thumb_file_get()
elm_thumb_reload()
elm_thumb_animate()
void elm_thumb_path_get ( const Evas_Object *  obj,
const char **  file,
const char **  key 
)

Get the path and key to the image or video thumbnail generated by ethumb.

One just needs to make sure that the thumbnail was generated before getting its path; otherwise, the path will be NULL. One way to do that is by asking for the path when/after the "generate,stop" smart callback is called.

Parameters:
objThe thumb object.
filePointer to thumb path.
keyPointer to thumb key.
See also:
elm_thumb_file_get()
void elm_thumb_reload ( Evas_Object *  obj)

Reload thumbnail if it was generated before.

Parameters:
objThe thumb object to reload

This is useful if the ethumb client configuration changed, like its size, aspect or any other property one set in the handle returned by elm_thumb_ethumb_client_get().

If the options didn't change, the thumbnail won't be generated again, but the old one will still be used.

See also:
elm_thumb_file_set()