2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "animated_image.h"
19 static int quickpanel_animated_image_init(void *data);
20 static int quickpanel_animated_image_fini(void *data);
21 static int quickpanel_animated_image_suspend(void *data);
22 static int quickpanel_animated_image_resume(void *data);
24 QP_Module animated_image = {
25 .name = "animated_image",
26 .init = quickpanel_animated_image_init,
27 .fini = quickpanel_animated_image_fini,
28 .suspend = quickpanel_animated_image_suspend,
29 .resume = quickpanel_animated_image_resume,
34 static Eina_List *g_animated_image_list = NULL;
36 static void _animated_image_list_add(Evas_Object *image)
38 retif(image == NULL, ,"invalid parameter");
40 g_animated_image_list = eina_list_append(g_animated_image_list, image);
43 static void _animated_image_play(Eina_Bool on)
45 const Eina_List *l = NULL;
46 const Eina_List *ln = NULL;
47 Evas_Object *entry_obj = NULL;
49 retif(g_animated_image_list == NULL, ,"list is empty");
51 EINA_LIST_FOREACH_SAFE(g_animated_image_list, l, ln, entry_obj) {
52 if (entry_obj == NULL) continue;
54 if (on == EINA_TRUE) {
55 if (elm_image_animated_play_get(entry_obj) == EINA_FALSE) {
56 elm_image_animated_play_set(entry_obj, EINA_TRUE);
59 if (elm_image_animated_play_get(entry_obj) == EINA_TRUE) {
60 elm_image_animated_play_set(entry_obj, EINA_FALSE);
66 static void _animated_image_deleted_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
68 retif(obj == NULL, , "obj is NULL");
69 retif(g_animated_image_list == NULL, , "list is empty");
71 g_animated_image_list = eina_list_remove(g_animated_image_list, obj);
74 HAPI void quickpanel_animated_image_add(Evas_Object *image) {
75 retif(image == NULL, , "image is NULL");
77 if (elm_image_animated_available_get(image) == EINA_TRUE) {
78 elm_image_animated_set(image, EINA_TRUE);
79 if (quickpanel_is_suspended() == 0) {
80 elm_image_animated_play_set(image, EINA_TRUE);
82 elm_image_animated_play_set(image, EINA_FALSE);
84 _animated_image_list_add(image);
85 evas_object_event_callback_add(image, EVAS_CALLBACK_DEL, _animated_image_deleted_cb, NULL);
89 /*****************************************************************************
93 *****************************************************************************/
94 static int quickpanel_animated_image_init(void *data)
99 static int quickpanel_animated_image_fini(void *data)
104 static int quickpanel_animated_image_suspend(void *data)
106 struct appdata *ad = data;
107 retif(ad == NULL, QP_FAIL, "Invalid parameter!");
109 INFO("animated image going to be suspened");
110 _animated_image_play(EINA_FALSE);
115 static int quickpanel_animated_image_resume(void *data)
117 struct appdata *ad = data;
118 retif(ad == NULL, QP_FAIL, "Invalid parameter!");
120 INFO("animated image going to be resumed");
121 _animated_image_play(EINA_TRUE);