2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
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 <app_control.h>
18 #include <Elementary.h>
20 #include <ui-gadget.h>
22 #include "attach_panel.h"
23 #include "attach_panel_internal.h"
25 #include "content_list.h"
30 void _content_list_send_message(Eina_List *list, const char *key, const char *value, int is_ug)
32 content_s *content_info = NULL;
33 app_control_h app_control = NULL;
34 const Eina_List *l = NULL;
36 int ret = APP_CONTROL_ERROR_NONE;
42 ret = app_control_create(&app_control);
43 ret_if(APP_CONTROL_ERROR_NONE != ret);
45 ret = app_control_add_extra_data(app_control, "__CALLER_PANEL__", "attach-panel");
46 if (APP_CONTROL_ERROR_NONE != ret) {
47 _E("Fail to add extra data(__CALLER_PANEL__)");
48 app_control_destroy(app_control);
52 ret = app_control_add_extra_data(app_control, key, value);
53 if (APP_CONTROL_ERROR_NONE != ret) {
54 _E("Fail to add extra data(%s)", key);
55 app_control_destroy(app_control);
59 EINA_LIST_FOREACH(list, l, content_info) {
60 continue_if(!content_info);
61 if (!content_info->content) {
62 _D("ug is not created yet");
65 innate_content_s *innate_content_info = content_info->innate_content_info;
66 continue_if(!innate_content_info);
68 if (is_ug == innate_content_info->is_ug) {
69 ui_gadget_h ui_gadget = NULL;
71 ui_gadget = evas_object_data_get(content_info->content, DATA_KEY_UG);
73 _D("Fail to get the ui gadget");
76 ug_send_message(ui_gadget, app_control);
80 ret = app_control_destroy(app_control);
81 ret_if(APP_CONTROL_ERROR_NONE != ret);
86 void _content_list_send_message_to_content(Eina_List *list, const char *key, const char *value, int cur_page_no)
88 content_s *content_info = NULL;
89 app_control_h app_control = NULL;
90 ui_gadget_h ui_gadget = NULL;
92 int ret = APP_CONTROL_ERROR_NONE;
98 content_info = eina_list_nth(list, cur_page_no);
99 ret_if(!content_info);
101 if (!content_info->innate_content_info->is_ug) {
102 _D("this page did not need to send message");
106 ret = app_control_create(&app_control);
107 ret_if(APP_CONTROL_ERROR_NONE != ret);
109 ret = app_control_add_extra_data(app_control, "__CALLER_PANEL__", "attach-panel");
110 if (APP_CONTROL_ERROR_NONE != ret) {
111 _E("Fail to add extra data(__CALLER_PANEL__)");
112 app_control_destroy(app_control);
116 ret = app_control_add_extra_data(app_control, key, value);
117 if (APP_CONTROL_ERROR_NONE != ret) {
118 _E("Fail to add extra data(%s)", key);
119 app_control_destroy(app_control);
123 ui_gadget = evas_object_data_get(content_info->content, DATA_KEY_UG);
125 _D("Fail to get the ui gadget");
126 app_control_destroy(app_control);
129 ug_send_message(ui_gadget, app_control);
131 ret = app_control_destroy(app_control);
132 ret_if(APP_CONTROL_ERROR_NONE != ret);
137 void _content_list_set_pause(Eina_List *list, int is_ug)
139 content_s *content_info = NULL;
140 const Eina_List *l = NULL;
144 EINA_LIST_FOREACH(list, l, content_info) {
145 continue_if(!content_info);
146 innate_content_s *innate_content_info = content_info->innate_content_info;
147 continue_if(!innate_content_info);
148 if (is_ug == innate_content_info->is_ug) {
149 ui_gadget_h ui_gadget = NULL;
151 ui_gadget = evas_object_data_get(content_info->content, DATA_KEY_UG);
153 _D("Fail to get the ui gadget");
156 ug_pause_ug(ui_gadget);
163 void _content_list_set_resume(Eina_List *list, int is_ug)
165 content_s *content_info = NULL;
166 const Eina_List *l = NULL;
170 EINA_LIST_FOREACH(list, l, content_info) {
171 continue_if(!content_info);
172 innate_content_s *innate_content_info = content_info->innate_content_info;
173 continue_if(!innate_content_info);
174 if (is_ug == innate_content_info->is_ug) {
175 ui_gadget_h ui_gadget = NULL;
177 ui_gadget = evas_object_data_get(content_info->content, DATA_KEY_UG);
179 _D("Fail to get the ui gadget");
182 ug_resume_ug(ui_gadget);