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.
23 *@defgroup setting-memory
24 *UG creation code for setting-memory
27 #include <setting-memory.h>
30 #define UG_MODULE_API __attribute__ ((visibility("default")))
33 static void setting_memory_ug_cb_resize(void *data, Evas *e, Evas_Object *obj,
36 SettingMemoryUG *ad = (SettingMemoryUG *) data;
37 setting_view_update(&setting_view_memory_default_memory, ad);
40 static void *setting_memory_ug_on_create(ui_gadget_h ug,
41 enum ug_mode mode, service_h service,
45 setting_retvm_if((!priv), NULL, "!priv");
47 SettingMemoryUG *memoryUG = priv;
50 memoryUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug);
51 memoryUG->win_get = (Evas_Object *) ug_get_window();
52 evas_object_show(memoryUG->win_main_layout);
53 memoryUG->evas = evas_object_evas_get(memoryUG->win_main_layout);
55 setting_retvm_if(memoryUG->win_main_layout == NULL, NULL,
56 "cannot get main window ");
58 /* register view node table */
59 setting_view_node_table_intialize();
61 setting_view_node_table_register(&setting_view_memory_default_memory, NULL);
63 setting_create_Gendial_itc("dialogue/1text.1icon.2",
64 &(memoryUG->itc_1text_1icon_2));
65 setting_create_Gendial_itc("dialogue/title",
66 &(memoryUG->itc_group_item));
67 setting_create_Gendial_itc("dialogue/1text", &(memoryUG->itc_1text));
68 setting_create_Gendial_itc("1text.1icon.2",
69 &(memoryUG->itc_1text_1icon));
70 setting_create_Gendial_itc("select_all", &(memoryUG->itc_sel_all));
72 setting_create_Gendial_itc("dialogue/2text.3/expandable",
73 &(memoryUG->itc_2text_3_parent));
74 setting_create_Gendial_itc("dialogue/1text.1icon/expandable2",
75 &(memoryUG->itc_1icon_1text_sub));
76 setting_create_Gendial_itc("dialogue/2text.2",
77 &(memoryUG->itc_2text_2));
79 memoryUG->itc_seperator.item_style = "dialogue/separator";
80 memoryUG->itc_seperator.func.text_get = NULL;
81 memoryUG->itc_seperator.func.content_get = NULL;
82 memoryUG->itc_seperator.func.state_get = NULL;
83 memoryUG->itc_seperator.func.del = NULL;
85 SETTING_TRACE_DEBUG("[DBG] set current view");
87 /* creating a view. */
88 setting_view_node_set_cur_view(&setting_view_memory_default_memory);
89 setting_view_create(&setting_view_memory_default_memory, (void *)memoryUG);
90 evas_object_event_callback_add(memoryUG->win_main_layout,
92 setting_memory_ug_cb_resize, memoryUG);
93 return memoryUG->ly_main;
96 static void setting_memory_ug_on_start(ui_gadget_h ug, service_h service,
101 static void setting_memory_ug_on_pause(ui_gadget_h ug, service_h service,
106 static void setting_memory_ug_on_resume(ui_gadget_h ug, service_h service,
110 setting_retm_if((!ug || !priv), "!ug || !priv");
111 //SettingMemoryUG *ad = priv;
113 // Need to update the mem. status view in resuming the view
118 static void setting_memory_ug_on_destroy(ui_gadget_h ug, service_h service,
122 setting_retm_if((!priv), "!priv");
123 SettingMemoryUG *memoryUG = priv;
125 evas_object_event_callback_del(memoryUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_memory_ug_cb_resize); /* fix flash issue for gallery */
128 /* delete the allocated objects. */
130 if (TRUE == setting_view_memory_default_memory.is_create) {
131 setting_view_destroy(&setting_view_memory_default_memory, memoryUG);
134 if (NULL != ug_get_layout(memoryUG->ug)) {
135 evas_object_hide((Evas_Object *) ug_get_layout(memoryUG->ug));
136 evas_object_del((Evas_Object *) ug_get_layout(memoryUG->ug));
142 static void setting_memory_ug_on_message(ui_gadget_h ug, service_h msg,
143 service_h service, void *priv)
148 static void setting_memory_ug_on_event(ui_gadget_h ug,
149 enum ug_event event, service_h service,
154 case UG_EVENT_LOW_MEMORY:
156 case UG_EVENT_LOW_BATTERY:
158 case UG_EVENT_LANG_CHANGE:
160 case UG_EVENT_ROTATE_PORTRAIT:
162 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
164 case UG_EVENT_ROTATE_LANDSCAPE:
166 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
168 case UG_EVENT_REGION_CHANGE:
175 static void setting_memory_ug_on_key_event(ui_gadget_h ug,
176 enum ug_key_event event,
177 service_h service, void *priv)
182 SettingMemoryUG *ad = (SettingMemoryUG *) priv;
185 case UG_KEY_EVENT_END:
187 if (ad->wait_timer) {
188 ecore_timer_del(ad->wait_timer);
189 ad->wait_timer = NULL;
192 if (ad->progress_bar_timer) {
193 ecore_timer_del(ad->progress_bar_timer);
194 ad->progress_bar_timer = NULL;
196 if (ad->popup_timer) {
197 ecore_timer_del(ad->popup_timer);
198 ad->popup_timer = NULL;
201 if (elm_naviframe_top_item_get(ad->navi_bar) ==
202 elm_naviframe_bottom_item_get(ad->navi_bar)) {
205 /* elm_naviframe_item_pop(ad->navi_bar); */
206 setting_view_cb_at_endKey(ad);
216 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
219 SettingMemoryUG *memoryUG = calloc(1, sizeof(SettingMemoryUG));
220 setting_retvm_if(!memoryUG, -1, "Create SettingMemoryUG obj failed");
222 ops->create = setting_memory_ug_on_create;
223 ops->start = setting_memory_ug_on_start;
224 ops->pause = setting_memory_ug_on_pause;
225 ops->resume = setting_memory_ug_on_resume;
226 ops->destroy = setting_memory_ug_on_destroy;
227 ops->message = setting_memory_ug_on_message;
228 ops->event = setting_memory_ug_on_event;
229 ops->key_event = setting_memory_ug_on_key_event;
230 ops->priv = memoryUG;
231 ops->opt = UG_OPT_INDICATOR_ENABLE;
236 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
239 struct SettingMemoryUG *memoryUG;
240 setting_retm_if(!ops, "ops == NULL");
242 memoryUG = ops->priv;
248 * Reset function to 'reset' the settings of the UG, it will be invoked by 'Reset' UG
253 UG_MODULE_API int setting_plugin_reset(service_h service, void *priv)
257 #if SUPPORT_RUN_SYSTEM_COMMAND
258 ret += excuteCmd(SETTING_POSTINST_FILE, 1, "memory");
260 int value = SETTING_DEF_MEMORY_PHONE;
261 ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_WAP_INT, value);
262 ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT, value);
263 ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_CAMERA_INT, value);
265 ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_VOICE_RECORDER_INT, value);
266 ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_FM_RADIO_INT, value);
267 ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_ALL_SHARE_INT, value);
268 ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_ADOBE_AIR_INT, value);
269 ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_DVB_H_INT, value);