This patch make it possible to ask elm_thumb for the generated thumbnail

path.

By: Rafael Fonseca <rfonseca@profusion.mobi>



SVN revision: 49550
This commit is contained in:
Bruno Dilly 2010-06-06 22:15:27 +00:00
parent 8932085312
commit 37250a5ab6
2 changed files with 38 additions and 0 deletions

View File

@ -860,6 +860,7 @@ extern "C" {
EAPI Evas_Object *elm_thumb_add(Evas_Object *parent);
EAPI void elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key);
EAPI void elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key);
EAPI void elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key);
EAPI void elm_thumb_keep_aspect_set(Evas_Object *obj, Eina_Bool setting);
EAPI Eina_Bool elm_thumb_keep_aspect_get(const Evas_Object *obj);
EAPI void elm_thumb_align_set(Evas_Object *obj, float x_align, float y_align);

View File

@ -41,6 +41,11 @@ struct _Widget_Data
} children;
const char *file;
const char *key;
struct
{
const char *file;
const char *key;
} thumb;
Ecore_Event_Handler *eeh;
int id;
Elm_Thumb_Animation_Setting anim_setting;
@ -185,6 +190,8 @@ _finished_thumb(Widget_Data *wd, int id, const char *thumb_path, const char *thu
elm_widget_sub_object_add(wd->self, wd->children.view);
edje_object_part_swallow(wd->children.frm, "elm.swallow.content",
wd->children.view);
eina_stringshare_replace(&(wd->thumb.file), thumb_path);
eina_stringshare_replace(&(wd->thumb.key), thumb_key);
edje_object_signal_emit(wd->children.frm, EDJE_SIGNAL_GENERATE_STOP, "elm");
evas_object_smart_callback_call(wd->self, SIG_GENERATE_STOP, NULL);
return;
@ -484,6 +491,9 @@ elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key)
}
}
eina_stringshare_replace(&(wd->thumb.file), NULL);
eina_stringshare_replace(&(wd->thumb.key), NULL);
#ifdef HAVE_ELEMENTARY_ETHUMB
if ((file_replaced || key_replaced) && evas_object_visible_get(obj))
_thumb_show(wd);
@ -498,6 +508,7 @@ elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key)
* @param key Pointer to key.
*
* @see elm_thumb_file_set()
* @see elm_thumb_path_get()
* @see elm_thumb_animate()
*
* @ingroup Thumb
@ -513,6 +524,32 @@ elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key)
*key = wd->key;
}
/**
* Get the path and key to the image or video generated by ethumb.
*
* One just need 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.
*
* @param obj The thumb object.
* @param file Pointer to thumb path.
* @param key Pointer to thumb key.
*
* @see elm_thumb_file_get()
*
* @ingroup Thumb
*/
EAPI void
elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (file)
*file = wd->thumb.file;
if (key)
*key = wd->thumb.key;
}
/**
* 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