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 void __setting_fileview_policy_navigation_decide(void *data, Evas_Object *webview, void *event_info)
46 setting_retm_if(data == NULL, "data is NULL");
47 setting_retm_if(event_info == NULL, "event_info is NULL");
49 /*SettingFileviewUG *ad = (SettingFileviewUG *)data; */
51 /* open url in local window */
52 Ewk_Policy_Decision *policy_decision = (Ewk_Policy_Decision *)event_info;
54 char *url = (char *)ewk_policy_decision_url_get(policy_decision);
55 char *scheme = (char *)ewk_policy_decision_scheme_get(policy_decision);
56 SETTING_TRACE("url : %s", url);
57 SETTING_TRACE("scheme : %s", scheme);
59 /* if not launch broswer, do not call ewk_policy_decision_ignore */
60 /*ewk_policy_decision_ignore(policy_decision); */
63 static int setting_fileview_create(void *cb)
66 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
68 SettingFileviewUG *ad = (SettingFileviewUG *) cb;
70 Evas_Object *scroller = NULL;
72 ad->ly_main = setting_create_layout_navi_bar_scroller(ad->win_main_layout,
74 _(ad->input_title),/*_("IDS_ST_BODY_OPEN_SOURCE_LICENCES"), */
75 _("IDS_ST_BUTTON_BACK"),
77 setting_fileview_click_back_cb,
83 Evas *evas = evas_object_evas_get(ad->win_get);
84 Evas_Object *webview = ewk_view_add(evas);
88 SETTING_TRACE("ad->input_file:%s", ad->input_file);
89 ewk_view_url_set(ad->webkit, ad->input_file);
91 elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_FALSE);
92 elm_object_content_set(scroller, ad->webkit);
94 elm_access_object_register(ad->webkit, ad->win_get);
95 evas_object_show(ad->webkit);
96 ad->scroller = scroller;
98 evas_object_smart_callback_add(ad->webkit, "policy,navigation,decide", __setting_fileview_policy_navigation_decide, ad);
101 if (app_control_create(&svc)) {
102 return SETTING_RETURN_FAIL;
105 setting_view_fileview_main.is_create = 1;
106 app_control_destroy(svc);
108 return SETTING_RETURN_SUCCESS;
111 static int setting_fileview_destroy(void *cb)
115 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
116 SettingFileviewUG *ad = (SettingFileviewUG *) cb;
117 evas_object_smart_callback_del(ad->webkit, "policy,navigation,decide", __setting_fileview_policy_navigation_decide);
121 elm_object_content_unset(ad->webkit);
122 evas_object_del(ad->webkit);
127 evas_object_del(ad->scroller);
131 if (ad->ly_main != NULL) {
132 evas_object_del(ad->ly_main);
134 setting_view_fileview_main.is_create = 0;
137 return SETTING_RETURN_SUCCESS;
140 static int setting_fileview_update(void *cb)
143 SettingFileviewUG *ad = (SettingFileviewUG *) cb;
145 if (ad->ly_main != NULL) {
146 evas_object_show(ad->ly_main);
148 return SETTING_RETURN_SUCCESS;
152 static int setting_fileview_cleanup(void *cb)
155 SettingFileviewUG *ad = (SettingFileviewUG *) cb;
157 if (ad->ly_main != NULL) {
158 evas_object_hide(ad->ly_main);
160 return SETTING_RETURN_SUCCESS;
163 /* ***************************************************
167 ***************************************************/
170 setting_fileview_click_back_cb(void *data, Evas_Object *obj,
174 setting_retm_if(data == NULL, " Data parameter is NULL");
176 SettingFileviewUG *ad = (SettingFileviewUG *) data;
177 /* Send destroy request */
178 ug_destroy_me(ad->ug);