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