seoz pushed a commit to branch master. http://git.enlightenment.org/core/elementary.git/commit/?id=fc931d97fdfec95c0d6b814c68f24ab18c09f4cb
commit fc931d97fdfec95c0d6b814c68f24ab18c09f4cb Author: Daniel Juyung Seo <seojuyu...@gmail.com> Date: Wed Oct 2 15:22:27 2013 +0900 test_icon_animated.c: Internal code refactoring. 1. remove unnecessary calls. 2. added elm_policy_set. 3. changed internal callback function name. 4. cleaned up print out message. 5. added helper label for users. --- src/bin/test_icon_animated.c | 45 +++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/bin/test_icon_animated.c b/src/bin/test_icon_animated.c index 446b464..fcb8bb2 100644 --- a/src/bin/test_icon_animated.c +++ b/src/bin/test_icon_animated.c @@ -4,47 +4,54 @@ #include <Elementary.h> #ifndef ELM_LIB_QUICKLAUNCH static void -icon_clicked(void *data , Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +_icon_clicked_cb(void *data , Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { - Evas_Object *ic; - ic = data; - Eina_Bool rec; - rec = elm_image_animated_play_get(ic); - rec = !rec; - printf("clicked!rec =%d\n",rec); - elm_image_animated_play_set(ic, rec); + Evas_Object *ic = data; + Eina_Bool play = EINA_FALSE; + + play = !elm_image_animated_play_get(ic); + printf("image clicked! play = %d\n", play); + elm_image_animated_play_set(ic, play); } void test_icon_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { - Evas_Object *win, *ic; + Evas_Object *win, *bx, *lbl, *ic; char buf[PATH_MAX]; + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + win = elm_win_add(NULL, "icon-animated-gif", ELM_WIN_BASIC); elm_win_title_set(win, "Icon Animated Gif"); elm_win_autodel_set(win, EINA_TRUE); - elm_win_alpha_set(win, EINA_TRUE); + evas_object_show(win); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + lbl = elm_label_add(bx); + elm_object_text_set(lbl, "Clicking the image will play/pause animation."); + elm_box_pack_end(bx, lbl); + evas_object_show(lbl); ic = elm_icon_add(win); snprintf(buf, sizeof(buf), "%s/images/animated_logo.gif", elm_app_data_dir_get()); elm_image_file_set(ic, buf, NULL); if (elm_image_animated_available_get(ic)) { - printf("============Support animator==============\n"); + printf("animation is available for this image.\n"); elm_image_animated_set(ic, EINA_TRUE); elm_image_animated_play_set(ic, EINA_TRUE); } - elm_image_resizable_set(ic, 0, 0); - elm_image_no_scale_set(ic, 1); + elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE); evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_fill_set(ic, 0.5, 0.5); - elm_win_resize_object_add(win, ic); + evas_object_size_hint_fill_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, ic); evas_object_show(ic); - evas_object_smart_callback_add(ic, "clicked", icon_clicked, ic); - - evas_object_resize(win, 200, 200); - evas_object_show(win); + evas_object_smart_callback_add(ic, "clicked", _icon_clicked_cb, ic); } #endif --