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-privacy.h>
24 #define UG_MODULE_API __attribute__ ((visibility("default")))
27 static void setting_privacy_ug_cb_resize(void *data, Evas *e,
28 Evas_Object *obj, void *event_info)
30 SettingPrivacyUG *ad = (SettingPrivacyUG *) data;
31 setting_view_update(&setting_view_privacy_service, ad);
34 setting_view *__get_privacy_view_to_load(void *data, service_h service)
37 setting_retvm_if((!data), NULL, "data is NULL");
38 SettingPrivacyUG *privacyUG = (SettingPrivacyUG *)data;
40 setting_view_node_table_intialize();
42 // service OK, but there's no argument
43 char *category = NULL;
44 service_get_extra_data(service, "privacy_category", &category);
46 if(0 == safeStrCmp(category, "service"))
48 setting_view_node_table_register(&setting_view_privacy_service, NULL);
49 return &setting_view_privacy_service;
57 static void *setting_privacy_ug_on_create(ui_gadget_h ug,
58 enum ug_mode mode, service_h service,
62 setting_retvm_if((!priv), NULL, "!priv");
63 SettingPrivacyUG *privacyUG = priv;
65 privacyUG->bundle_data = service;
66 setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR);
68 /* register view node table */
69 //setting_view_node_table_intialize();
70 //setting_view_node_table_register(&setting_view_privacy_main, NULL);
72 privacyUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug);
73 privacyUG->win_get = (Evas_Object *) ug_get_window();
75 evas_object_show(privacyUG->win_main_layout);
76 privacyUG->evas = evas_object_evas_get(privacyUG->win_main_layout);
78 setting_retvm_if(privacyUG->win_main_layout == NULL, NULL,
79 "cannot get main window ");
82 privacyUG->bg = elm_bg_add(privacyUG->win_get);
83 elm_object_style_set(privacyUG->bg, "dialogue_field");
84 evas_object_size_hint_weight_set(privacyUG->bg, EVAS_HINT_EXPAND,
87 privacyUG->view_to_load = __get_privacy_view_to_load(privacyUG, service);
88 setting_retvm_if(NULL == privacyUG->view_to_load, NULL, "NULL == fontUG->view_to_load");
91 setting_view_node_set_cur_view(privacyUG->view_to_load);
92 setting_view_create(privacyUG->view_to_load, (void *)privacyUG);
93 evas_object_event_callback_add(privacyUG->win_main_layout,
95 setting_privacy_ug_cb_resize, privacyUG);
97 //----------------------------------------------------------------
100 //----------------------------------------------------------------
101 setting_create_Gendial_itc("dialogue/2text.3", &(privacyUG->itc_2text_2));
103 return privacyUG->ly_main;
106 static void setting_privacy_ug_on_start(ui_gadget_h ug, service_h service,
111 static void setting_privacy_ug_on_pause(ui_gadget_h ug, service_h service,
116 static void setting_privacy_ug_on_resume(ui_gadget_h ug, service_h service,
121 static void setting_privacy_ug_on_destroy(ui_gadget_h ug, service_h service,
125 setting_retm_if((!priv), "!priv");
126 SettingPrivacyUG *privacyUG = priv;
127 evas_object_event_callback_del(privacyUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_privacy_ug_cb_resize); //fix flash issue for gallery
130 evas_object_del(privacyUG->bg);
132 privacyUG->bg = NULL;
134 // called when this shared gadget is terminated. similar with app_exit
135 setting_view_destroy(&setting_view_privacy_service, privacyUG);
137 if (NULL != ug_get_layout(privacyUG->ug)) {
138 evas_object_hide((Evas_Object *) ug_get_layout(privacyUG->ug));
139 evas_object_del((Evas_Object *) ug_get_layout(privacyUG->ug));
143 static void setting_privacy_ug_on_message(ui_gadget_h ug, service_h msg,
144 service_h service, void *priv)
149 static void setting_privacy_ug_on_event(ui_gadget_h ug,
150 enum ug_event event, service_h service,
155 case UG_EVENT_LOW_MEMORY:
157 case UG_EVENT_LOW_BATTERY:
159 case UG_EVENT_LANG_CHANGE:
161 case UG_EVENT_ROTATE_PORTRAIT:
163 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
165 case UG_EVENT_ROTATE_LANDSCAPE:
167 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
169 case UG_EVENT_REGION_CHANGE:
176 static void setting_privacy_ug_on_key_event(ui_gadget_h ug,
177 enum ug_key_event event,
178 service_h service, void *priv)
181 SettingPrivacyUG *ad = (SettingPrivacyUG *) priv;
184 case UG_KEY_EVENT_END:
186 if (elm_naviframe_top_item_get(ad->navi_bar) ==
187 elm_naviframe_bottom_item_get(ad->
192 setting_view_cb_at_endKey(ad);
201 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
204 SettingPrivacyUG *privacyUG = calloc(1, sizeof(SettingPrivacyUG));
205 setting_retvm_if(!privacyUG, -1, "Create SettingPrivacyUG obj failed");
207 ops->create = setting_privacy_ug_on_create;
208 ops->start = setting_privacy_ug_on_start;
209 ops->pause = setting_privacy_ug_on_pause;
210 ops->resume = setting_privacy_ug_on_resume;
211 ops->destroy = setting_privacy_ug_on_destroy;
212 ops->message = setting_privacy_ug_on_message;
213 ops->event = setting_privacy_ug_on_event;
214 ops->key_event = setting_privacy_ug_on_key_event;
215 ops->priv = privacyUG;
216 ops->opt = UG_OPT_INDICATOR_ENABLE;
220 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
223 struct SettingPrivacyUG *privacyUG;
224 setting_retm_if(!ops, "ops == NULL");
226 privacyUG = ops->priv;
232 /* ***************************************************
236 ** **************************************************/
239 * Reset function to 'reset' the settings of the UG, it will be invoked by 'Reset' UG