Merge "fix bug : N_SE-3819, update default memory after removing sd card" into 2...
[apps/core/preloaded/settings.git] / setting-reset / src / setting-reset-settings.c
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  */
21 #include <setting-cfg.h>
22 #include <setting-reset-settings.h>
23 #include <heynoti.h>
24 #include <Ecore_X.h>
25 #include <utilX.h>
26
27 #define RESULT_FONT_SIZE 28//18
28 #define ITEM_NAME_FONT_SIZE 35//22
29
30 static int setting_reset_settings_create(void *cb);
31 static int setting_reset_settings_destroy(void *cb);
32 static int setting_reset_settings_update(void *cb);
33 static int setting_reset_settings_cleanup(void *cb);
34
35 setting_view setting_view_reset_settings = {
36         .create = setting_reset_settings_create,
37         .destroy = setting_reset_settings_destroy,
38         .update = setting_reset_settings_update,
39         .cleanup = setting_reset_settings_cleanup,
40 };
41
42 static void setting_reset_settings_click_softkey_reset_cb(void *data,
43                                                       Evas_Object *obj,
44                                                       void *event_info);
45 static void setting_reset_settings_click_softkey_cancel_cb(void *data,
46                                                        Evas_Object *obj,
47                                                        void *event_info);
48
49 static bool setting_reset_settings_create_password_sg(void *data);
50 static void setting_reset_settings_check_state(Setting_Done_List_Data *list_data);
51 static void setting_reset_settings_result_password_ug_cb(ui_gadget_h ug,
52                                                      service_h result,
53                                                      void *priv);
54
55 /* ***************************************************
56  *
57  *basic func
58  *
59  ***************************************************/
60 static char *__result_gl_text_get(void *data, Evas_Object *obj,
61                                    const char *part)
62 {
63         retv_if(!data, NULL);
64         Setting_GenGroupItem_Data *item_data =
65             (Setting_GenGroupItem_Data *) data;
66         //SETTING_TRACE("part:%s", part);
67
68         if (!safeStrCmp(part, "elm.text.1")) {  /* title */
69                 char label[HELP_MSG_BUFF_SIZE + 1] = { 0, };
70                 if (item_data->keyStr)
71                 {
72                         const char *key = setting_customize_text(_(item_data->keyStr), ITEM_NAME_FONT_SIZE, NULL, NULL);
73                         safeStrNCat(label, key,HELP_MSG_BUFF_SIZE);
74                         FREE(key);
75                 }
76                 if (item_data->sub_desc)
77                 {
78                         safeStrNCat(label, ": ",HELP_MSG_BUFF_SIZE);
79                         const char *sub_desc = setting_customize_text(_(item_data->sub_desc), RESULT_FONT_SIZE, NULL, NULL);
80                         safeStrNCat(label, sub_desc,HELP_MSG_BUFF_SIZE);
81                         FREE(sub_desc);
82                 }
83                 return (char *)g_strdup(label);
84         }
85         return NULL;
86 }
87 #if SIMPLY_SUPPORT_ALL_RESET
88 static void __processing_popup_response_cb(void *data, Evas_Object *obj,
89                                      void *event_info)
90 {
91         ret_if(!data);
92         SettingResetUG *ad = data;
93         setting_reset_special_process(ad);
94         if (obj) {
95                 evas_object_del(obj);
96                 obj = NULL;
97         }
98         ad->notify= NULL;
99
100         // key ungrab: after showing the result popup
101         Ecore_X_Display *disp = ecore_x_display_get();
102         Ecore_X_Window xwin = elm_win_xwindow_get((Evas_Object*)ug_get_window());
103         int ret = utilx_ungrab_key(disp, xwin, KEY_HOME);
104         if (ret) {
105                 SETTING_TRACE_ERROR("KEY_HOME ungrab error ret[%d]", ret);
106         }
107 }
108 #endif
109 #if SIMPLY_SUPPORT_ALL_RESET
110 bool __reset_all_idler(void *data)
111 {
112         SETTING_TRACE_BEGIN;
113         retv_if(!data, FALSE);
114         SettingResetUG *ad = data;
115
116         int i = 0;
117         int j = 0;
118         int idx = 0;
119         const char *result_str = RESET_SUCESS_STR;
120         char ug_file[PATH_MAX + 1];
121         char *path = NULL;
122         service_h svc;
123         int ret = -1;
124         char *ug_args;
125         char *item_name;
126
127         for (; i < setting_cfg_get_category_length(); i++) {
128                 //SETTING_TRACE("group is:%s", _(setting_cfg_get_category_name(i)));
129
130                 result_str = RESET_SUCESS_STR;
131                 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
132                         /*SETTING_TRACE("i:%d\tj:%d", i, j);*/
133                         if (Cfg_Item_unResetable ==
134                             setting_cfg_get_resetable_flag_idx(i, j))
135                         {
136                                 //SETTING_TRACE("process %s:%s skipped",_(item_name), ug_args);
137                                 continue;
138                         }
139                         ug_args = setting_cfg_get_ug_args_idx(i, j);
140                         item_name = setting_cfg_get_keyname_idx(i, j);
141                         if (item_name)
142                                 SETTING_TRACE(">>> process %s:%s",_(item_name), ug_args);
143
144                         idx++;
145                         if (NULL == ug_args) /*special process*/
146                         {
147                                 ret = -1;
148                                 if (!safeStrCmp(KeyStr_FlightMode, item_name)) {
149                                         //Invoke aync API and ignore the response message
150                                         ret = setting_reset_flight_mode();
151                                 } else if (!safeStrCmp(KeyStr_Landscape, item_name)) {
152                                         ret = setting_reset_rotation_lock();
153                                 }
154                                 //..
155                                 if (0 > ret)
156                                 {
157                                         result_str = RESET_FAILED_STR;
158                                 }
159
160
161                         }
162                         else
163                         {
164                                 path = get_ug_path_from_ug_args((void *)ug_args);
165                                 svc = get_bundle_from_ug_args((void *)ug_args);
166
167                                 if (snprintf(ug_file, PATH_MAX, "%s/libug-%s.so", SETTING_UG_PATH, path) < 0)
168                                         return FALSE;
169
170                                 ret = setting_invoke_reset_function(ug_file, svc, NULL);
171                                 //SETTING_TRACE("load %s[plugin_ret:%d]", ug_file, ret);
172
173                                 if (OPERATE_LIB_SUCESS > ret)
174                                 {
175                                         result_str = RESET_FAILED_STR;
176
177                                 }
178
179                                 service_destroy(svc);
180                                 FREE(path);
181                                 memset(ug_file, 0, PATH_MAX);
182                         }
183                         SETTING_TRACE("process %s:%s %s",_(item_name), ug_args, _(result_str));
184                 }
185         }
186
187         //list_data->cur_item_num = idx;
188         SETTING_TRACE_DEBUG("Reset totally %d items. result_str:%s", idx, result_str);
189         //setting_create_popup_with_notitle(NULL, ad->win_get, _(result_str));
190         elm_popup_desc_set(ad->notify, _(result_str));
191         elm_popup_mode_set(ad->notify, POPUP_INTERVAL);
192         elm_popup_timeout_set(ad->notify, 2);
193
194         if (ad->reset_all_idler) {
195                 ecore_idler_del(ad->reset_all_idler);
196                 ad->reset_all_idler = NULL;
197         }
198         return FALSE;
199 }
200 #endif
201 #if SIMPLY_SUPPORT_ALL_RESET
202 static void __reset_all_button_cb(void *data, Evas_Object *obj, void *event_info)
203 {
204         SETTING_TRACE_BEGIN;
205         ret_if(!data);
206         Setting_GenGroupItem_Data *item_Data = data;
207         ret_if(!item_Data->userdata);
208         SettingResetUG *ad = item_Data->userdata;
209
210
211         char pw_pass[SETTING_STR_SLP_LEN] = { 0, };
212         int err = 0;
213
214         /*  Check Password Setting status */
215         int ret =
216             setting_get_string_slp_key(STR_SLP_LIST_PHONE_PASSWORD,
217                                        pw_pass, &err);
218         SETTING_TRACE("pw_pass:%s", pw_pass);
219         if (SETTING_RETURN_SUCCESS == ret && '\0' != pw_pass[0]) {
220                 setting_reset_settings_create_password_sg(ad);
221                 return;
222         }
223
224         // key grab: before showing processing popup
225         Ecore_X_Display *disp = ecore_x_display_get();
226         Ecore_X_Window xwin = elm_win_xwindow_get((Evas_Object*)ug_get_window());
227         ret = utilx_grab_key(disp, xwin, KEY_HOME, TOP_POSITION_GRAB);
228         if (ret) {
229                 SETTING_TRACE_ERROR("KEY_HOME grab error ret[%d]", ret);
230         }
231
232         ad->notify =
233                 setting_create_popup_without_btn(ad, ad->win_get, NULL, _("IDS_COM_POP_PROCESSING"), __processing_popup_response_cb, 0, 1, 1);
234         if (ad->reset_all_idler) {
235                 ecore_idler_del(ad->reset_all_idler);
236                 ad->reset_all_idler = NULL;
237         }
238
239         ad->reset_all_idler =
240             ecore_idler_add((Ecore_Task_Cb) __reset_all_idler, ad);
241 }
242 #endif
243 static int setting_reset_settings_create(void *cb)
244 {
245         SETTING_TRACE_BEGIN;
246         /* error check */
247         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
248
249         SettingResetUG *ad = (SettingResetUG *) cb;
250         Evas_Object *scroller = NULL;
251         Evas_Object *controllbar = NULL;
252
253         Evas_Object *view_layout = elm_layout_add(ad->win_main_layout);
254         elm_layout_file_set(view_layout, SETTING_THEME_EDJ_NAME,
255                             "selinfo_bottom");
256         evas_object_size_hint_weight_set(view_layout, EVAS_HINT_EXPAND, 0.0);
257
258         /*  Evas_Object * win_layout, Evas_Object * win_obj */
259         setting_push_layout_navi_bar(_(RESET_SETTINGS_STR),
260                                    _("IDS_COM_BODY_RESET"),
261                                    _("IDS_COM_SK_CANCEL"), NULL,
262                                    setting_reset_settings_click_softkey_reset_cb,
263                                    setting_reset_settings_click_softkey_cancel_cb,
264                                    NULL, ad, view_layout, ad->navi_bar,
265                                    &controllbar);
266         //elm_controlbar_item_disabled_set(elm_controlbar_last_item_get
267         //                               (controllbar), EINA_TRUE);
268
269         /* ******************************************create frame */
270         Setting_Done_List_Data *list_data = &(ad->list_data);   /* define a handle */
271         int idx = 0;
272         list_data->win_main = ad->win_main_layout;
273         list_data->UG_data = ad;
274         list_data->ly_parent = view_layout;
275         list_data->controllbar = controllbar;
276         list_data->select_all_checked = EINA_FALSE;
277
278         char *ug_args;
279         char *item_name;
280
281         int i = 0;
282         int j = 0;
283
284         for (; i < setting_cfg_get_category_length(); i++) {
285                 SETTING_TRACE("group is:%s", _(setting_cfg_get_category_name(i)));
286
287                 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
288                         /*SETTING_TRACE("i:%d\tj:%d", i, j);*/
289                         if (Cfg_Item_unResetable ==
290                             setting_cfg_get_resetable_flag_idx(i, j))
291                         {
292                             continue;
293                         }
294                         list_data->chk_items[idx].ug_args = ug_args =
295                                         setting_cfg_get_ug_args_idx(i, j);
296                         list_data->chk_items[idx].item_name = item_name =
297                                         setting_cfg_get_keyname_idx(i, j);
298
299                         SETTING_TRACE("process %s:\t%s",_(item_name), ug_args);
300                         idx++;
301                 }
302         }
303
304         list_data->cur_item_num = idx;
305         SETTING_TRACE("list_data->cur_item_num:%d", list_data->cur_item_num);
306         scroller = setting_create_done_list(list_data);
307         elm_object_part_content_set(view_layout, "elm.swallow.contents", scroller);
308
309         ad->view_layout = view_layout;
310         ad->controllbar = controllbar;
311         /* *******************************************update info */
312
313         setting_view_reset_settings.is_create = 1;
314         ad->itc_1text.func.text_get = __result_gl_text_get;
315         return SETTING_RETURN_SUCCESS;
316 }
317
318 static int setting_reset_settings_destroy(void *cb)
319 {
320         SETTING_TRACE_BEGIN;
321         /* error check */
322         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
323
324         SettingResetUG *ad = (SettingResetUG *) cb;
325
326         if (ad->list_data.selInfoPop) {
327                 evas_object_del(ad->list_data.selInfoPop);
328                 ad->list_data.selInfoPop = NULL;
329         }
330         if (ad->notify) {
331                 evas_object_del(ad->notify);
332                 ad->notify = NULL;
333         }
334         if (ad->old_notify) {
335                 evas_object_del(ad->old_notify);
336                 ad->old_notify = NULL;
337         }
338         if (ad->pop)
339         {
340                 evas_object_del(ad->pop);
341                 ad->pop = NULL;
342         }
343         if (ad->pop_progress)
344         {
345                 evas_object_del(ad->pop_progress);
346                 ad->pop_progress = NULL;
347         }
348
349         if (ad->ask_popup)
350         {
351                 evas_object_del(ad->ask_popup);
352                 ad->ask_popup = NULL;
353         }
354         if (ad->animator)
355         {
356                 ecore_animator_del(ad->animator);
357                 ad->animator = NULL;
358         }
359
360         if (ad->reset_all_idler) {
361                 ecore_idler_del(ad->reset_all_idler);
362                 ad->reset_all_idler = NULL;
363         }
364
365         elm_naviframe_item_pop(ad->navi_bar);
366         setting_view_reset_settings.is_create = 0;
367
368         return SETTING_RETURN_SUCCESS;
369 }
370
371 static int setting_reset_settings_update(void *cb)
372 {
373         SETTING_TRACE_BEGIN;
374
375         return SETTING_RETURN_SUCCESS;
376 }
377
378 static int setting_reset_settings_cleanup(void *cb)
379 {
380         SETTING_TRACE_BEGIN;
381         /* error check */
382         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
383
384         //SettingResetUG *ad = (SettingResetUG *) cb;
385
386         setting_reset_settings_destroy(cb);
387
388         return SETTING_RETURN_SUCCESS;
389 }
390
391 /* ***************************************************
392  *
393  *general func
394  *
395  ***************************************************/
396
397 static void __reset_an_item(Setting_Done_List_Data *list_data,
398                                 const char *item_name,
399                                 const char *ug_args)
400 {
401         SettingResetUG *ad = (SettingResetUG *) list_data->UG_data;
402         if(ad == NULL)
403                 return;
404
405         Evas_Object *genlist = elm_object_content_get(ad->notify);
406         Setting_GenGroupItem_Data *item_data = NULL;
407         const char *result_str = RESET_SUCESS_STR;
408         if (NULL == ug_args) /*special process*/
409         {
410                 int ret = -1;
411                 if (!safeStrCmp(KeyStr_FlightMode, item_name)) {
412                         //Invoke aync API and ignore the response message
413                         ret = setting_reset_flight_mode();
414                 } else if (!safeStrCmp(KeyStr_Landscape, item_name)) {
415                         ret = setting_reset_rotation_lock();
416                 }
417                 //..
418                 if (0 > ret)
419                 {
420                         result_str = VCONF_RESET_FAILED_STR;
421                 }
422
423                 item_data = setting_create_Gendial_field_def(genlist, &(ad->itc_1text),
424                                                  NULL, ad,
425                                                  SWALLOW_Type_LAYOUT_SPECIALIZTION,
426                                                  NULL, NULL, 0,
427                                                  (char *)item_name,
428                                                  (char *)result_str, NULL);
429
430         } else
431         {
432                 char *path = get_ug_path_from_ug_args((void *)ug_args);
433                 service_h svc = get_bundle_from_ug_args((void *)ug_args);
434                 char ug_file[PATH_MAX];
435                 if (snprintf(ug_file, PATH_MAX,
436                         "%s/libug-%s.so", SETTING_UG_PATH, path) < 0) return;
437
438                 int plugin_ret = setting_invoke_reset_function(ug_file, svc, NULL);
439                 SETTING_TRACE("load %s[plugin_ret:%d]", ug_file, plugin_ret);
440
441                 if (LOAD_LIB_FAILED == plugin_ret) // -1
442                 {
443                         result_str = LOAD_LIB_FAILED_STR;
444
445                 } else if (UNDEFINED_LIB_SYMBOL == plugin_ret) // -2
446                 {
447                         result_str = UNDEFINE_STR;
448                 } else if (OPERATE_LIB_SUCESS <= plugin_ret){ // 0
449                         result_str = RESET_SUCESS_STR;
450
451                 } else {
452                         result_str = RESET_FAILED_STR;
453                 }
454
455                 service_destroy(svc);
456                 if (path){
457                         FREE(path);
458                         path = NULL;
459                 }
460
461                 item_data = setting_create_Gendial_field_def(genlist, &(ad->itc_1text),
462                                                  NULL, ad,
463                                                  SWALLOW_Type_LAYOUT_SPECIALIZTION,
464                                                  NULL, NULL, 0,
465                                                  (char *)item_name,
466                                                  (char *)result_str, NULL);
467         }
468
469         if (item_data)
470                 elm_genlist_item_show(item_data->item, ELM_GENLIST_ITEM_SCROLLTO_IN);//show the last item
471         else
472                 SETTING_TRACE_ERROR("error : item_data is NULL");
473 }
474
475 static Eina_Bool __reset_animator_cb(void *data)
476 {
477         SettingResetUG *ad = (SettingResetUG *) data;
478
479         SETTING_TRACE("Processing the %dth of %d",
480                       ad->gl_index, ad->list_data.cur_item_num);
481         if (ad->gl_index >=  ad->list_data.cur_item_num) {
482                 ecore_animator_del(ad->animator);
483                 ad->animator = NULL;
484                 if (ad->pop_progress) {
485                         evas_object_del(ad->pop_progress);
486                         ad->pop_progress = NULL;
487                 }
488
489                 return ECORE_CALLBACK_CANCEL;
490         }
491         if (ad->list_data.chk_items[ad->gl_index].data_GenItem->chk_status) {
492                 __reset_an_item(&(ad->list_data),
493                                 ad->list_data.chk_items[ad->gl_index].item_name,
494                                 ad->list_data.chk_items[ad->gl_index].ug_args);
495
496                 /*unselect item*/
497                 elm_check_state_set(ad->list_data.chk_items[ad->gl_index].data_GenItem->eo_check, 0);
498                 ad->list_data.chk_items[ad->gl_index].data_GenItem->chk_status = 0;
499         }
500
501         ad->gl_index++;
502         return ECORE_CALLBACK_RENEW;
503 }
504
505
506 static void setting_reset_settings_check_state(Setting_Done_List_Data *list_data)
507 {
508         /* reset */
509         SETTING_TRACE_DEBUG("********resetting*******");
510
511         SettingResetUG *ad = (SettingResetUG *) list_data->UG_data;
512
513         //some item must have been selected, or else cannot go into setting_reset_check_state()
514         ad->notify = elm_popup_add(ad->win_get);
515         elm_object_style_set(ad->notify,"menustyle");
516         elm_object_part_text_set(ad->notify, "title,text", _(RESET_RESULT_STR));
517         evas_object_size_hint_weight_set(ad->notify,
518                                 EVAS_HINT_EXPAND,
519                                 EVAS_HINT_EXPAND);
520         Evas_Object *btn = setting_create_button(ad->notify, _("IDS_COM_SK_OK"), NULL, setting_reset_result_popup_resp_cb, ad);
521         elm_object_part_content_set(ad->notify, "button1", btn);
522
523         Evas_Object *genlist = elm_genlist_add(ad->notify);
524         elm_object_style_set(genlist, "dialogue");
525         evas_object_size_hint_weight_set(genlist,
526                                 EVAS_HINT_EXPAND,
527                                 EVAS_HINT_EXPAND);
528         evas_object_size_hint_align_set(genlist,
529                                 EVAS_HINT_FILL,
530                                 EVAS_HINT_FILL);
531
532         elm_object_content_set(ad->notify, genlist);
533         evas_object_show(ad->notify);
534
535         ad->pop_progress = setting_create_popup_with_progressbar(ad, ad->win_get,
536                                  "list_process",
537                                  NULL, NULL, NULL, 0, 1, 1);
538
539         ad->gl_index = 0;
540         ad->animator = ecore_animator_add(__reset_animator_cb, ad);
541
542         /* reset sel_all item */
543         elm_check_state_set(list_data->select_all_checkbox, 0);
544         list_data->select_all_checked = EINA_FALSE;
545
546 }
547
548 static void
549 setting_reset_settings_result_password_ug_cb(ui_gadget_h ug, service_h result,
550                                          void *priv)
551 {
552         SETTING_TRACE_BEGIN;
553         /* error check */
554         retm_if(priv == NULL, "Data parameter is NULL");
555
556         SettingResetUG *ad = (SettingResetUG *) priv;
557
558         char *ret_str = NULL;
559
560         service_get_extra_data(result, "result", &ret_str);
561
562         retm_if(ret_str == NULL, "result paremeter is NULL");
563         SETTING_TRACE("result:%s", ret_str);
564
565         if (ret_str) {
566                 if (0 == safeStrCmp("Cancel", ret_str)) {
567                         /* Do not reset */
568                 }
569                 else if (0 == safeStrCmp("SETTING_PW_TYPE_RESET", ret_str)) {
570                         /*  Reset */
571 #if SIMPLY_SUPPORT_ALL_RESET
572                         ad->notify =
573                                 setting_create_popup_witout_btn(ad, ad->win_get, _("IDS_COM_POP_PROCESSING"), NULL, __processing_popup_response_cb, 0);
574                         if (ad->reset_all_idler) {
575                                 ecore_idler_del(ad->reset_all_idler);
576                                 ad->reset_all_idler = NULL;
577                         }
578                         ad->reset_all_idler =
579                             ecore_idler_add((Ecore_Task_Cb) __reset_all_idler, ad);
580 #else
581                         /* if return value from passwordUG, create popup for resetting. */
582                         setting_reset_settings_check_state(&(ad->list_data));
583 #endif
584                 }
585         }
586 }
587
588 static void
589 setting_reset_settings_layout_ug_cb(ui_gadget_h ug, enum ug_mode mode,
590                                 void *priv)
591 {
592         SettingResetUG *ad = (SettingResetUG *) priv;
593         Evas_Object *base;
594
595         if (!priv)
596                 return;
597         SETTING_TRACE_BEGIN;
598
599         base = (Evas_Object *) ug_get_layout(ug);
600         if (!base)
601                 return;
602
603         switch (mode) {
604         case UG_MODE_FULLVIEW:
605                 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
606                                                  EVAS_HINT_EXPAND);
607                 elm_win_resize_object_add(ad->win_get, base);
608                 evas_object_show(base);
609                 break;
610         default:
611                 break;
612         }
613         SETTING_TRACE_END;
614 }
615
616 static void setting_reset_settings_destroy_password_ug_cb(ui_gadget_h ug,
617                                                       void *priv)
618 {
619         SETTING_TRACE_BEGIN;
620         ret_if(!priv);
621         SettingResetUG *ad = (SettingResetUG *) priv;
622         if (ug) {
623                 ug_destroy(ug);
624                 ad->ug_loading = NULL;
625         }
626
627 }
628
629 static bool setting_reset_settings_create_password_sg(void *data)
630 {
631         SETTING_TRACE_BEGIN;
632         /* error check */
633         retv_if(data == NULL, FALSE);
634
635         SettingResetUG *ad = (SettingResetUG *) data;
636
637         struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
638         if (!cbs)
639                 return FALSE;
640         cbs->layout_cb = setting_reset_settings_layout_ug_cb;
641         cbs->result_cb = setting_reset_settings_result_password_ug_cb;
642         cbs->destroy_cb = setting_reset_settings_destroy_password_ug_cb;
643         cbs->priv = (void *)ad;
644
645         service_h svc;
646         if (service_create(&svc)) {
647                 FREE(cbs);
648                 return FALSE;
649         }
650
651         service_add_extra_data(svc, "viewtype", "SETTING_PW_TYPE_RESET");
652
653         ad->ug_loading =
654             ug_create(ad->ug, "setting-password-efl", UG_MODE_FULLVIEW, svc, cbs);
655         if (NULL == ad->ug_loading) {   /* error handling */
656         }
657
658         service_destroy(svc);
659         FREE(cbs);
660
661         return TRUE;
662 }
663
664 /* ***************************************************
665  *
666  *call back func
667  *
668  ***************************************************/
669
670 static void
671 setting_reset_settings_click_softkey_cancel_cb(void *data, Evas_Object *obj,
672                                            void *event_info)
673 {
674         SETTING_TRACE_BEGIN;
675         /* error check */
676         retm_if(data == NULL, "Data parameter is NULL");
677
678         SettingResetUG *ad = (SettingResetUG *) data;
679
680         setting_view_change(&setting_view_reset_settings, &setting_view_reset_main, ad);
681 }
682
683 static void
684 setting_reset_settings_click_softkey_reset_cb(void *data, Evas_Object *obj,
685                                           void *event_info)
686 {
687         SETTING_TRACE_BEGIN;
688         /* error check */
689         retm_if(data == NULL, "Data parameter is NULL");
690
691         SettingResetUG *ad = (SettingResetUG *) data;
692         int screen_lock_type = 0;
693
694         //every time clicking 'Reset' button, restore following VCONFs
695         vconf_set_bool(VCONFKEY_SETAPPL_FONT_CHANGED, FALSE);
696
697         if (ad->list_data.selInfoPop) {
698                 evas_object_del(ad->list_data.selInfoPop);
699                 ad->list_data.selInfoPop = NULL;
700         }
701
702         if (!setting_done_list_is_some_item_selected(&(ad->list_data))) {
703                 setting_create_simple_popup(NULL, ad->win_get, NULL, "No item selected");
704         } else {
705 #if SUPPORT_SECURITY
706                 vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &screen_lock_type);
707                 if(screen_lock_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD
708                         || screen_lock_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD)
709                 {
710                         setting_reset_settings_create_password_sg(ad);
711                 }
712                 else
713                 {
714 #endif
715                         setting_reset_settings_check_state(&(ad->list_data));
716 #if SUPPORT_SECURITY
717                 }
718 #endif
719         }
720 }