4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
6 * Contact: MyoungJune Park <mj2004.park@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
21 #include <setting-fileview-main.h>
23 #define SETTING_FILEVIEW_LEN 20
25 static int setting_fileview_create(void *cb);
26 static int setting_fileview_destroy(void *cb);
27 static int setting_fileview_update(void *cb);
28 static int setting_fileview_cleanup(void *cb);
30 setting_view setting_view_fileview_main = {
31 .create = setting_fileview_create,
32 .destroy = setting_fileview_destroy,
33 .update = setting_fileview_update,
34 .cleanup = setting_fileview_cleanup,
37 /* ***************************************************
41 ***************************************************/
43 static Eina_Bool __web_on_idle(void *data)
46 SettingFileviewUG *ad = (SettingFileviewUG *) data;
47 if (ad->progress_bar) {
48 evas_object_del(ad->progress_bar);
49 ad->progress_bar = NULL;
54 static void __setting_fileview_policy_navigation_decide(void *data, Evas_Object *webview, void *event_info)
57 setting_retm_if(data == NULL, "data is NULL");
58 setting_retm_if(event_info == NULL, "event_info is NULL");
60 //SettingFileviewUG *ad = (SettingFileviewUG *)data;
62 // open url in local window
63 Ewk_Policy_Decision *policy_decision = (Ewk_Policy_Decision *)event_info;
65 char *url = (char *)ewk_policy_decision_url_get(policy_decision);
66 char *scheme = (char *)ewk_policy_decision_scheme_get(policy_decision);
67 SETTING_TRACE("url : %s", url);
68 SETTING_TRACE("scheme : %s", scheme);
70 /* if not launch broswer, do not call ewk_policy_decision_ignore */
71 //ewk_policy_decision_ignore(policy_decision);
74 static int setting_fileview_create(void *cb)
77 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
79 SettingFileviewUG *ad = (SettingFileviewUG *) cb;
81 Evas_Object *scroller;
82 //ad->progress_bar = setting_create_popup_with_progressbar(ad, ad->win_get, "pending_list", NULL, NULL, NULL, 0, TRUE, TRUE);
84 ad->ly_main = setting_create_layout_navi_bar_scroller(ad->win_main_layout,
86 _(ad->input_title),//_("IDS_ST_BODY_OPEN_SOURCE_LICENCES"),
87 _("IDS_COM_BODY_BACK"),
89 setting_fileview_click_back_cb,
93 Evas *evas = evas_object_evas_get(ad->win_get);
94 Evas_Object *webview = ewk_view_add(evas);
97 SETTING_TRACE("ad->input_file:%s", ad->input_file);
98 ewk_view_url_set(webview, ad->input_file);
100 elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_FALSE);
102 elm_object_content_set(scroller, webview);
103 evas_object_show(webview);
104 //ecore_idler_add(__web_on_idle, ad);
106 evas_object_smart_callback_add(webview, "policy,navigation,decide", __setting_fileview_policy_navigation_decide, ad);
109 if (service_create(&svc)) {
110 return SETTING_RETURN_FAIL;
113 setting_view_fileview_main.is_create = 1;
115 return SETTING_RETURN_SUCCESS;
118 static int setting_fileview_destroy(void *cb)
122 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
123 SettingFileviewUG *ad = (SettingFileviewUG *) cb;
124 evas_object_smart_callback_del(ad->webkit, "policy,navigation,decide", __setting_fileview_policy_navigation_decide);
127 evas_object_del(ad->webkit);
131 if (ad->progress_bar) {
132 evas_object_del(ad->progress_bar);
133 ad->progress_bar = NULL;
136 if (ad->ly_main != NULL) {
137 evas_object_del(ad->ly_main);
139 setting_view_fileview_main.is_create = 0;
142 return SETTING_RETURN_SUCCESS;
145 static int setting_fileview_update(void *cb)
148 SettingFileviewUG *ad = (SettingFileviewUG *) cb;
150 if (ad->ly_main != NULL) {
151 evas_object_show(ad->ly_main);
153 return SETTING_RETURN_SUCCESS;
157 static int setting_fileview_cleanup(void *cb)
160 SettingFileviewUG *ad = (SettingFileviewUG *) cb;
162 if (ad->ly_main != NULL) {
163 evas_object_hide(ad->ly_main);
165 return SETTING_RETURN_SUCCESS;
168 /* ***************************************************
172 ***************************************************/
175 setting_fileview_click_back_cb(void *data, Evas_Object *obj,
179 setting_retm_if(data == NULL, " Data parameter is NULL");
181 SettingFileviewUG *ad = (SettingFileviewUG *) data;
182 /* Send destroy request */
183 ug_destroy_me(ad->ug);