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 static int setting_fileview_create(void *cb);
24 static int setting_fileview_destroy(void *cb);
25 static int setting_fileview_update(void *cb);
26 static int setting_fileview_cleanup(void *cb);
28 setting_view setting_view_fileview_main = {
29 .create = setting_fileview_create,
30 .destroy = setting_fileview_destroy,
31 .update = setting_fileview_update,
32 .cleanup = setting_fileview_cleanup,
35 /* ***************************************************
39 ***************************************************/
41 static Eina_Bool __web_on_idle(void *data)
44 SettingFileviewUG *ad = (SettingFileviewUG *) data;
45 if (ad->progress_bar) {
46 evas_object_del(ad->progress_bar);
47 ad->progress_bar = NULL;
52 static void __setting_fileview_policy_navigation_decide(void *data, Evas_Object *webview, void *event_info)
55 setting_retm_if(data == NULL, "data is NULL");
56 setting_retm_if(event_info == NULL, "event_info is NULL");
58 SettingFileviewUG *ad = (SettingFileviewUG *)data;
60 Ewk_Policy_Decision *policy_decision = (Ewk_Policy_Decision *)event_info;
61 ewk_policy_decision_ignore(policy_decision);
63 char *url = (char *)ewk_policy_decision_url_get(policy_decision);
64 char *scheme = (char *)ewk_policy_decision_scheme_get(policy_decision);
65 SETTING_TRACE("url : %s", url);
66 SETTING_TRACE("scheme : %s", scheme);
69 service_h service = NULL;
70 ret = service_create(&service);
71 setting_retm_if(service == NULL, "service is NULL");
73 ret = service_set_operation(service, SERVICE_OPERATION_VIEW);
74 ret = service_set_uri(service, url);
75 ret = service_send_launch_request(service, NULL, NULL);
76 ret = service_destroy(service);
80 static int setting_fileview_create(void *cb)
83 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
85 SettingFileviewUG *ad = (SettingFileviewUG *) cb;
87 Evas_Object *scroller;
88 //ad->progress_bar = setting_create_popup_with_progressbar(ad, ad->win_get, "pending_list", NULL, NULL, NULL, 0, TRUE, TRUE);
90 ad->ly_main = setting_create_layout_navi_bar_scroller(ad->win_main_layout,
92 _(ad->input_title),//_("IDS_ST_BODY_OPEN_SOURCE_LICENCES"),
93 _("IDS_COM_BODY_BACK"),
95 setting_fileview_click_back_cb,
99 //Evas *evas = evas_object_evas_get(ad->win_get);
100 //Evas_Object *webview = ewk_view_add(evas);
101 //ad->webkit = webview;
103 SETTING_TRACE("ad->input_file:%s", ad->input_file);
104 //ewk_view_uri_set(ad->webkit, ad->input_file);
106 elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_FALSE);
108 //elm_object_content_set(scroller, ad->webkit);
109 //evas_object_show(ad->webkit);
110 //ecore_idler_add(__web_on_idle, ad);
112 //evas_object_smart_callback_add(ad->webkit, "policy,navigation,decide", __setting_fileview_policy_navigation_decide, ad);
114 setting_view_fileview_main.is_create = 1;
116 return SETTING_RETURN_SUCCESS;
119 static int setting_fileview_destroy(void *cb)
123 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
124 SettingFileviewUG *ad = (SettingFileviewUG *) cb;
125 //evas_object_smart_callback_del(ad->webkit, "policy,navigation,decide", __setting_fileview_policy_navigation_decide);
128 // evas_object_del(ad->webkit);
129 // ad->webkit = NULL;
132 if (ad->ly_main != NULL) {
133 evas_object_del(ad->ly_main);
135 setting_view_fileview_main.is_create = 0;
138 return SETTING_RETURN_SUCCESS;
141 static int setting_fileview_update(void *cb)
144 SettingFileviewUG *ad = (SettingFileviewUG *) cb;
146 if (ad->ly_main != NULL) {
147 evas_object_show(ad->ly_main);
149 return SETTING_RETURN_SUCCESS;
153 static int setting_fileview_cleanup(void *cb)
156 SettingFileviewUG *ad = (SettingFileviewUG *) cb;
158 if (ad->ly_main != NULL) {
159 evas_object_hide(ad->ly_main);
161 return SETTING_RETURN_SUCCESS;
164 /* ***************************************************
168 ***************************************************/
171 setting_fileview_click_back_cb(void *data, Evas_Object *obj,
175 setting_retm_if(data == NULL, " Data parameter is NULL");
177 SettingFileviewUG *ad = (SettingFileviewUG *) data;
178 /* Send destroy request */
179 ug_destroy_me(ad->ug);