tizen 2.3.1 release
[apps/home/settings.git] / src / setting-handler.c
1 #include <setting-handler.h>
2 #include <setting-helper.h>
3
4 #include <wifi.h>
5 /*#include <nfc.h> */
6 #include <bluetooth.h>
7 #include <dbus/dbus.h>
8
9 static Setting_GenGroupItem_Data *__flightmode_handler(void *data, char *keyStr, char *icon_path, char *ug_name, Evas_Object *genlist, Elm_Object_Item *parent)
10 {
11         /*SETTING_TRACE_BEGIN; */
12         /* NOT UG --> it's just UI drawing */
13
14         setting_main_appdata *ad = (setting_main_appdata *)data;
15         int value, err;
16         setting_get_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE, &value, &err);
17
18         /* create flight_mode */
19         ad->data_flight = setting_create_Gendial_field_groupitem(genlist,
20                                                                  &(ad->itc[GENDIAL_Type_1text_1icon_2]),
21                                                                  parent,
22                                                                  setting_main_click_Gendial_list_flight_mode_cb,
23                                                                  ad,
24                                                                  SWALLOW_Type_1ICON_1RADIO,
25                                                                  icon_path,
26                                                                  NULL,
27                                                                  value,
28                                                                  keyStr,
29                                                                  NULL,
30                                                                  setting_main_click_list_flight_mode_cb);
31         __BACK_POINTER_SET(ad->data_flight);
32
33         return ad->data_flight;
34 }
35
36 static Setting_GenGroupItem_Data *__netrestrictionmode_handler(void *data, char *keyStr, char *icon_path, char *ug_name, Evas_Object *genlist, Elm_Object_Item *parent)
37 {
38         /*SETTING_TRACE_BEGIN; */
39         /* NOT UG --> it's just UI drawing */
40
41         setting_main_appdata    *ad = (setting_main_appdata *)data;
42         int                                             value, err;
43
44         setting_get_bool_slp_key(BOOL_SLP_SETTING_NET_RESTRICTION_MODE, &value, &err);
45
46         /* create restriction mode */
47         ad->data_netrestrictionmode = setting_create_Gendial_field_groupitem(genlist,
48                                                                              &(ad->itc[GENDIAL_Type_1text_2icon]),
49                                                                              parent,
50                                                                              setting_main_click_list_net_restriction_mode_cb,
51                                                                              ad,
52                                                                              SWALLOW_Type_1ICON_1RADIO,
53                                                                              IMG_NetRestrictionMode,
54                                                                              NULL,
55                                                                              value,
56                                                                              keyStr,
57                                                                              NULL,
58                                                                              setting_main_click_list_check_net_restriction_mode_cb);
59         __BACK_POINTER_SET(ad->data_netrestrictionmode);
60
61         if (ad->data_wifi) {
62                 if (value == 1)
63                         setting_disable_genlist_item(ad->data_wifi->item);
64         }
65
66         return ad->data_netrestrictionmode;
67 }
68
69 static Setting_GenGroupItem_Data *__wifi_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
70 {
71         /*SETTING_TRACE_BEGIN; */
72         setting_main_appdata *ad = (setting_main_appdata *)data;
73
74         int err;
75         int value = -1;
76         setting_get_int_slp_key(INT_SLP_SETTING_WIFI_STATUS, &value, &err);
77
78         preference_set_boolean(WIFI_LAST_ON_OFF_STATE, (value ? 1 : 0));
79         ad->data_wifi = setting_create_Gendial_field_groupitem(genlist,
80
81                                                                /*&(ad->itc[GENDIAL_Type_1text_2icon_divider]), */
82                                                                & (ad->itc[GENDIAL_Type_1text_1icon_2]),
83                                                                parent,
84                                                                setting_main_click_list_ex_ug_cb,
85                                                                ug_args,
86                                                                SWALLOW_Type_1ICON_1RADIO,
87                                                                icon_path,
88                                                                NULL,
89                                                                value,
90                                                                keyStr,
91                                                                NULL,
92                                                                setting_main_click_list_wifi_mode_cb);
93         __BACK_POINTER_SET(ad->data_wifi);
94         if (ad->data_wifi) {
95                 ad->data_wifi->userdata = ad;
96         }
97
98         return ad->data_wifi;
99 }
100
101 static Setting_GenGroupItem_Data *__bluetooth_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
102 {
103         /*SETTING_TRACE_BEGIN; */
104         setting_main_appdata *ad = (setting_main_appdata *)data;
105         int value, err;
106         setting_get_int_slp_key(INT_SLP_SETTING_BT_STATUS, &value, &err);
107
108         ad->data_bt = setting_create_Gendial_field_groupitem(genlist,
109                                                              /*&(ad->itc[GENDIAL_Type_1text_2icon_divider]), */
110                                                              & (ad->itc[GENDIAL_Type_1text_1icon_2]),
111                                                              parent,
112                                                              setting_main_click_list_ex_ug_cb,
113                                                              ug_args,
114                                                              SWALLOW_Type_1ICON_1RADIO,
115                                                              icon_path,
116                                                              NULL,
117                                                              value,
118                                                              keyStr,
119                                                              NULL,
120                                                              setting_main_click_list_bt_mode_cb);
121         __BACK_POINTER_SET(ad->data_bt);
122         if (ad->data_bt) {
123                 ad->data_bt->userdata = ad;
124         }
125
126         return ad->data_bt;
127 }
128
129 static Setting_GenGroupItem_Data *__mobileap_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
130 {
131         /*SETTING_TRACE_BEGIN; */
132         setting_main_appdata *ad = (setting_main_appdata *)data;
133
134         ad->data_mobileApp = setting_create_Gendial_field_groupitem(genlist,
135                                                                     &(ad->itc[GENDIAL_Type_1text_1icon_2]),
136                                                                     parent,
137                                                                     setting_main_click_list_ex_ug_cb,
138                                                                     ug_args,
139                                                                     SWALLOW_Type_INVALID,
140                                                                     icon_path,
141                                                                     NULL,
142                                                                     0,
143                                                                     keyStr,
144                                                                     NULL,
145                                                                     NULL);
146         __BACK_POINTER_SET(ad->data_mobileApp);
147         if (ad->data_mobileApp) {
148                 ad->data_mobileApp->userdata = ad;
149         }
150
151         return ad->data_mobileApp;
152 }
153
154 static Setting_GenGroupItem_Data *__allshare_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
155 {
156         /*SETTING_TRACE_BEGIN; */
157         setting_main_appdata *ad = (setting_main_appdata *)data;
158
159         Setting_GenGroupItem_Data *obj = setting_create_Gendial_field_groupitem(genlist,
160                                                                                 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
161                                                                                 parent,
162                                                                                 setting_main_click_list_default_ug_cb,
163                                                                                 ad,
164                                                                                 SWALLOW_Type_INVALID,
165                                                                                 icon_path,
166                                                                                 NULL, 0,
167                                                                                 keyStr,
168                                                                                 NULL,
169                                                                                 NULL);
170         return obj;
171 }
172
173 static Setting_GenGroupItem_Data *__network_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
174 {
175         /*SETTING_TRACE_BEGIN; */
176         setting_main_appdata *ad = (setting_main_appdata *)data;
177
178         ad->data_network = setting_create_Gendial_field_groupitem(genlist,
179                                                                   &(ad->itc[GENDIAL_Type_1text_1icon_2]),
180                                                                   parent,
181                                                                   setting_main_click_list_network_ug_cb,
182                                                                   ad,
183                                                                   SWALLOW_Type_INVALID,
184                                                                   icon_path,
185                                                                   NULL, 0,
186                                                                   keyStr,
187                                                                   NULL,
188                                                                   NULL);
189
190         int flight_mode = 0;
191         vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_mode);
192         if (flight_mode) {
193                 if (ad->data_network) setting_disable_genlist_item(ad->data_network->item);
194         }
195
196         __BACK_POINTER_SET(ad->data_network);
197         return ad->data_network;
198 }
199
200 #if SUPPORT_NFC
201 static Setting_GenGroupItem_Data *__nfc_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
202 {
203         /*SETTING_TRACE_BEGIN; */
204         if (!is_NFC_feature_supported()) {
205                 SETTING_TRACE("!is_NFC_feature_supported");
206                 return NULL;
207         }
208         setting_main_appdata *ad = (setting_main_appdata *)data;
209
210         int value, err;
211         setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_STATUS, &value, &err);
212
213         ad->data_nfc = setting_create_Gendial_field_groupitem(genlist,
214                                                               &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
215                                                               /*&(ad->itc[GENDIAL_Type_1text_2icon]), */
216                                                               parent,
217                                                               setting_main_click_list_ex_ug_cb,
218                                                               ug_args,
219                                                               SWALLOW_Type_1ICON_1RADIO,
220                                                               icon_path,
221                                                               NULL,
222                                                               value,
223                                                               keyStr,
224                                                               NULL,
225                                                               setting_main_click_list_nfc_mode_cb);
226         __BACK_POINTER_SET(ad->data_nfc);
227         if (ad->data_nfc) {
228                 ad->data_nfc->userdata = ad;
229         }
230
231         return ad->data_nfc;
232 }
233 #endif
234
235 static Setting_GenGroupItem_Data *__adjust_screen_tone_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
236 {
237         SETTING_TRACE_BEGIN;
238         setting_main_appdata *ad = (setting_main_appdata *)data;
239         Setting_GenGroupItem_Data *obj = NULL;
240
241         int value = 0;
242         vconf_get_bool(VCONFKEY_SETAPPL_BOOL_AUTO_ADJUST_SCREEN_TONE, &value);
243         obj = setting_create_Gendial_field_groupitem(genlist,
244                                                      &(ad->itc[GENDIAL_Type_1text_2icon]),
245                                                      parent,
246                                                      setting_main_display_list_cb,
247                                                      ad,
248                                                      SWALLOW_Type_1ICON_1RADIO,
249                                                      icon_path,
250                                                      NULL,
251                                                      value,
252                                                      keyStr,
253                                                      NULL,
254                                                      setting_main_display_auto_adjust_chk_btn_cb);
255
256         if (obj) {
257                 __BACK_POINTER_SET(obj);
258                 obj->userdata = ad;
259                 ad->data_screentone = obj;
260         }
261         return obj;
262 }
263
264 static Setting_GenGroupItem_Data *__landscape_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
265 {
266         SETTING_TRACE_BEGIN;
267         setting_main_appdata *ad = (setting_main_appdata *)data;
268         Setting_GenGroupItem_Data *obj = NULL;
269
270         int value = 0;
271         vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &value);
272         obj = setting_create_Gendial_field_groupitem(genlist,
273                                                      &(ad->itc[GENDIAL_Type_1text_2icon]),
274                                                      parent,
275                                                      setting_main_display_list_cb,
276                                                      ad,
277                                                      SWALLOW_Type_1ICON_1RADIO,
278                                                      icon_path,
279                                                      NULL,
280                                                      value,
281                                                      keyStr,
282                                                      NULL,
283                                                      setting_main_display_auto_rotate_chk_btn_cb);
284
285         if (obj) {
286                 __BACK_POINTER_SET(obj);
287                 obj->userdata = ad;
288                 ad->data_landscape = obj;
289         }
290         return obj;
291
292
293
294 }
295
296
297 static Setting_GenGroupItem_Data *__multiwindow_mode_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
298 {
299         SETTING_TRACE_BEGIN;
300         setting_main_appdata *ad = (setting_main_appdata *)data;
301         Setting_GenGroupItem_Data *obj = NULL;
302
303         int value;
304         int ret = vconf_get_bool(VCONFKEY_QUICKSETTING_MULTIWINDOW_ENABLED, &value);
305         if (ret != 0) {
306                 SETTING_TRACE_ERROR("get multi-window vconf failed");
307                 value = 0;
308         }
309         SETTING_TRACE("multi-window vconf value=%d\n", value);
310         obj =
311             setting_create_Gendial_field_groupitem(genlist,
312                                                    &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
313                                                    parent,
314                                                    setting_main_click_list_ex_ug_cb,
315                                                    ug_args,
316                                                    SWALLOW_Type_1ICON_1RADIO,
317                                                    icon_path,
318                                                    NULL,
319                                                    value,
320                                                    keyStr,
321                                                    NULL,
322                                                    setting_main_list_mouse_up_cb);
323
324         if (obj) {
325                 __BACK_POINTER_SET(obj);
326                 obj->userdata = ad;
327                 ad->data_multi_window = obj;
328         }
329         return obj;
330 }
331
332
333 static Setting_GenGroupItem_Data *__brightness_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
334 {
335         SETTING_TRACE_BEGIN;
336         setting_main_appdata *ad = (setting_main_appdata *)data;
337         Setting_GenGroupItem_Data *obj = NULL;
338
339         char *pa_bright = get_brightness_mode_str();
340         obj =
341             setting_create_Gendial_field_groupitem(genlist,
342                                                    &(ad->itc[GENDIAL_Type_1icon_2text]),
343                                                    parent,
344                                                    setting_main_click_list_ex_ug_cb,
345                                                    ug_args,
346                                                    SWALLOW_Type_INVALID,
347                                                    icon_path,
348                                                    NULL,
349                                                    0,
350                                                    keyStr,
351                                                    pa_bright,
352                                                    NULL);
353
354         if (obj) {
355                 __BACK_POINTER_SET(obj);
356                 obj->userdata = ad;
357                 ad->data_bright = obj;
358         }
359         return obj;
360 }
361
362 #if SUPPORT_BLOCKINGMODE
363 static Setting_GenGroupItem_Data *__blocking_mode_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
364 {
365         SETTING_TRACE_BEGIN;
366         setting_main_appdata *ad = (setting_main_appdata *)data;
367         Setting_GenGroupItem_Data *obj = NULL;
368
369         int value;
370         int ret = vconf_get_bool(VCONFKEY_SETAPPL_BLOCKINGMODE_BLOCKINGMODE, &value);
371         if (ret != 0) {
372                 SETTING_TRACE_ERROR("get vconf failed");
373                 value = 1;
374         }
375         obj =  setting_create_Gendial_field_groupitem(genlist,
376                                                       &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
377                                                       /*&(ad->itc[GENDIAL_Type_1text_2icon]), */
378                                                       parent,
379                                                       setting_main_click_list_ex_ug_cb,
380                                                       ug_args,
381                                                       SWALLOW_Type_1ICON_1RADIO,
382                                                       icon_path,
383                                                       NULL,
384                                                       value,
385                                                       keyStr,
386                                                       NULL,
387                                                       setting_main_list_mouse_up_cb);
388         if (obj) {
389                 __BACK_POINTER_SET(obj);
390                 obj->userdata = ad;
391                 ad->data_blocking = obj;
392         }
393         return obj;
394
395 }
396 #endif
397
398 static Setting_GenGroupItem_Data *__personal_mode_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
399 {
400         SETTING_TRACE_BEGIN;
401         setting_main_appdata *ad = (setting_main_appdata *)data;
402         Setting_GenGroupItem_Data *obj = NULL;
403
404         int value;
405         int ret = vconf_get_bool(VCONFKEY_SETAPPL_PERSONAL_MODE_STATUS_BOOL, &value);
406         if (ret != 0) {
407                 SETTING_TRACE_ERROR("get vconf failed");
408                 value = 0;
409         }
410         obj =  setting_create_Gendial_field_groupitem(genlist,
411                                                       &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
412                                                       /*&(ad->itc[GENDIAL_Type_1text_2icon]), */
413                                                       parent,
414                                                       setting_main_click_list_ex_personal_mode_cb,
415                                                       ug_args,
416                                                       SWALLOW_Type_1ICON_1RADIO,
417                                                       icon_path,
418                                                       NULL,
419                                                       value,
420                                                       keyStr,
421                                                       NULL,
422                                                       setting_main_list_mouse_up_cb);
423         if (obj) {
424                 __BACK_POINTER_SET(obj);
425                 obj->userdata = ad;
426                 ad->data_personalpage = obj;
427         }
428         return obj;
429 }
430
431
432
433 static Setting_GenGroupItem_Data *__hightouch_sens_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
434 {
435         SETTING_TRACE_BEGIN;
436         setting_main_appdata *ad = (setting_main_appdata *)data;
437         Setting_GenGroupItem_Data *obj = NULL;
438
439         int value = 0;
440         int entouch = display_get_enhanced_touch();
441         if (1 == entouch) {
442                 /*enhanced status ON */
443                 value = 1;
444         } else {
445                 value = 0;
446         }
447         vconf_set_bool(VCONFKEY_SETAPPL_ENHANCED_TOUCH, value); /*sync to vconf */
448
449         /* create high touch sensitivity */
450         obj = setting_create_Gendial_field_groupitem(genlist,
451                                                      &(ad->itc[GENDIAL_Type_1text_2icon]),
452                                                      parent,
453                                                      setting_main_mouse_up_Gendial_list_sensitivity_cb,
454                                                      ad,
455                                                      SWALLOW_Type_1ICON_1RADIO,
456                                                      icon_path,
457                                                      NULL,
458                                                      value,
459                                                      KeyStr_HighTouchSens,
460                                                      NULL,
461                                                      setting_main_high_touch_sens_chk_btn_cb);
462
463         if (obj) {
464                 __BACK_POINTER_SET(obj);
465                 obj->userdata = ad;
466                 ad->data_high_touch_sensitivity = obj;
467         }
468
469         return obj;
470 }
471
472 /*__screen_mode_handler */
473 static Setting_GenGroupItem_Data *__screen_mode_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
474 {
475         SETTING_TRACE_BEGIN;
476         setting_main_appdata *ad = (setting_main_appdata *)data;
477
478         mainlist_entry *entry =  settinig_drawer_hash_find(ad, keyStr);
479
480         Setting_GenGroupItem_Data *item_data = NULL;
481         if (entry) {
482                 item_data = entry->ui_handler(ad, keyStr, icon_path, ug_args, genlist, parent);
483                 entry->item_data = item_data;
484         }
485
486         char *pa_screenmode = get_pa_screen_mode_str();
487
488         Setting_GenGroupItem_Data *obj = NULL;
489         obj =
490             setting_create_Gendial_field_groupitem(genlist,
491                                                    &(ad->itc[GENDIAL_Type_1icon_2text]),
492                                                    parent,
493                                                    setting_main_click_list_ex_ug_cb,
494                                                    ug_args,
495                                                    SWALLOW_Type_INVALID,
496                                                    icon_path,
497                                                    NULL,
498                                                    0,
499                                                    keyStr,
500                                                    pa_screenmode,
501                                                    NULL);
502         G_FREE(pa_screenmode);
503         __BACK_POINTER_SET(obj);
504         if (obj) {
505                 obj->userdata = ad;
506                 ad->data_screenmode = obj;
507         }
508
509         return obj;
510 }
511
512
513
514
515 static Setting_GenGroupItem_Data *__battery_percent_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
516 {
517         SETTING_TRACE_BEGIN;
518         setting_main_appdata *ad = (setting_main_appdata *)data;
519         Setting_GenGroupItem_Data *obj = NULL;
520
521         int value = 0;
522         vconf_get_bool(VCONFKEY_SETAPPL_BATTERY_PERCENTAGE_BOOL, &value);
523         obj = setting_create_Gendial_field_groupitem(genlist,
524                                                      &(ad->itc[GENDIAL_Type_1text_2icon]),
525                                                      parent,
526                                                      setting_main_display_list_cb,
527                                                      ad,
528                                                      SWALLOW_Type_1ICON_1RADIO,
529                                                      icon_path,
530                                                      NULL,
531                                                      value,
532                                                      keyStr,
533                                                      NULL,
534                                                      setting_main_display_battery_chk_btn_cb);
535         __BACK_POINTER_SET(obj);
536         if (obj) {
537                 obj->userdata = ad;
538                 ad->data_battery = obj;
539         }
540
541         return obj;
542 }
543
544 static Setting_GenGroupItem_Data *__backlight_time_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
545 {
546         SETTING_TRACE_BEGIN;
547         setting_main_appdata *ad = (setting_main_appdata *)data;
548         Setting_GenGroupItem_Data *obj = NULL;
549
550         char *pa_backlight = get_pa_backlight_time_str();
551         obj = setting_create_Gendial_field_groupitem(genlist,
552                                                      &(ad->itc[GENDIAL_Type_1icon_2text]),
553                                                      parent,
554                                                      setting_main_click_list_ex_ug_cb,
555                                                      ug_args,
556                                                      SWALLOW_Type_INVALID,
557                                                      icon_path,
558                                                      NULL,
559                                                      0,
560                                                      keyStr,
561                                                      pa_backlight,
562                                                      NULL);
563         G_FREE(pa_backlight);
564         __BACK_POINTER_SET(obj);
565         if (obj) {
566                 obj->userdata = ad;
567                 ad->data_backlight = obj;
568         }
569
570         return obj;
571 }
572
573 static Setting_GenGroupItem_Data *__nearby_device_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
574 {
575         SETTING_TRACE_BEGIN;
576         setting_main_appdata *ad = (setting_main_appdata *)data;
577         Setting_GenGroupItem_Data *obj = NULL;
578
579         Cfg_Item_State state = Cfg_Item_Error;
580         Setting_Cfg_Node_T *pnode = get_cfg_node_by_keystr(_(keyStr));
581         if (pnode && pnode->tfunc && pnode->tfunc->get_item_state) {
582                 pnode->tfunc->get_item_state(&state, NULL);
583         }
584
585         obj = setting_create_Gendial_field_groupitem(genlist,
586                                                      &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
587                                                      /*&(ad->itc[GENDIAL_Type_1text_2icon]), */
588                                                      parent,
589                                                      setting_main_click_list_ex_ug_cb,
590                                                      ug_args,
591                                                      SWALLOW_Type_1ICON_1RADIO,
592                                                      icon_path,
593                                                      NULL,
594                                                      state,
595                                                      keyStr,
596                                                      NULL,
597                                                      setting_main_click_list_nearby_devices_cb);
598         __BACK_POINTER_SET(obj);
599         if (obj) {
600                 obj->userdata = ad;
601
602                 ad->data_nearby_devices = obj;
603         }
604
605         return obj;
606 }
607
608 static Setting_GenGroupItem_Data *__developer_option_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
609 {
610         SETTING_TRACE_BEGIN;
611         setting_main_appdata *ad = (setting_main_appdata *)data;
612         Setting_GenGroupItem_Data *obj = NULL;
613 #ifdef BINARY_RELEASE_TYPE_ENG
614         /*for eng binary: always show <developer option>*/
615         obj = setting_create_Gendial_field_groupitem(genlist,
616                                                      &(ad->itc[GENDIAL_Type_1text_1icon_2]),
617                                                      parent,
618                                                      setting_main_click_list_ex_ug_cb,
619                                                      ug_args,
620                                                      SWALLOW_Type_INVALID,
621                                                      icon_path,
622                                                      NULL, 0,
623                                                      keyStr,
624                                                      NULL,
625                                                      NULL);
626
627 #else
628         /*for user binary: need to check develop_option_state vconf value*/
629         int dev_op_state = 0;
630         int ret = 0;
631         ret = vconf_get_bool(VCONFKEY_SETAPPL_DEVELOPER_OPTION_STATE, &dev_op_state);
632         if (ret != 0) {
633                 SETTING_TRACE_ERROR("Failed to ger vconf value %d", ret);
634         }
635         if (dev_op_state) {
636                 obj = setting_create_Gendial_field_groupitem(genlist,
637                                                              &(ad->itc[GENDIAL_Type_1text_1icon_2]),
638                                                              parent,
639                                                              setting_main_click_list_ex_ug_cb,
640                                                              ug_args,
641                                                              SWALLOW_Type_INVALID,
642                                                              icon_path,
643                                                              NULL, 0,
644                                                              keyStr,
645                                                              NULL,
646                                                              NULL);
647         } else {
648                 SETTING_TRACE("dev_op_state is 0");
649         }
650 #endif
651         return obj;
652 }
653
654
655 static Setting_GenGroupItem_Data *__joyn_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
656 {
657         SETTING_TRACE_BEGIN;
658         setting_main_appdata *ad = (setting_main_appdata *)data;
659         if (vcui_doc_rcs_get_install_status() == EINA_TRUE) {
660                 ad->data_joyn  = setting_create_Gendial_field_groupitem(genlist,
661                                                                         &(ad->itc[GENDIAL_Type_1text_1icon_2]),
662                                                                         parent,
663                                                                         setting_main_click_list_ex_ug_cb,
664                                                                         ug_args,
665                                                                         SWALLOW_Type_INVALID,
666                                                                         icon_path,
667                                                                         NULL, 0,
668                                                                         keyStr,
669                                                                         NULL,
670                                                                         NULL);
671                 __BACK_POINTER_SET(ad->data_joyn);
672                 if (ad->data_joyn) {
673                         ad->data_joyn->userdata = ad;
674                 }
675                 return ad->data_joyn;
676         } else {
677                 SETTING_TRACE("Joyn account is NOT available");
678         }
679         return NULL;
680 }
681
682 #if SUPPORT_NFC
683 static Setting_GenGroupItem_Data *__sbeam_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
684 {
685         /*SETTING_TRACE_BEGIN; */
686         if (!is_NFC_feature_supported()) {
687                 SETTING_TRACE("!is_NFC_feature_supported");
688                 return NULL;
689         }
690         setting_main_appdata *ad = (setting_main_appdata *)data;
691
692
693         int value, err;
694         setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_SBEAM, &value, &err);
695
696         ad->data_sbeam = setting_create_Gendial_field_groupitem(genlist,
697                                                                 &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
698                                                                 /*&(ad->itc[GENDIAL_Type_1text_2icon]), */
699                                                                 parent,
700                                                                 setting_main_click_list_ex_ug_cb,
701                                                                 ug_args,
702                                                                 SWALLOW_Type_1ICON_1RADIO,
703                                                                 icon_path,
704                                                                 NULL,
705                                                                 value,
706                                                                 keyStr,
707                                                                 NULL,
708                                                                 setting_main_click_list_sbeam_mode_cb);
709         __BACK_POINTER_SET(ad->data_sbeam);
710         if (ad->data_sbeam) {
711                 ad->data_sbeam->userdata = ad;
712         }
713
714         return ad->data_sbeam;
715 }
716 #endif
717
718 static Setting_GenGroupItem_Data *__default_handler(void *data, char *keyStr, char *icon_path, char *ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
719 {
720         /*SETTING_TRACE_BEGIN; */
721         setting_main_appdata *ad = (setting_main_appdata *)data;
722         Setting_GenGroupItem_Data *obj = setting_create_Gendial_field_groupitem(genlist,
723                                                                                 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
724                                                                                 parent,
725                                                                                 setting_main_click_list_ex_ug_cb,
726                                                                                 ug_args,
727                                                                                 SWALLOW_Type_INVALID,
728                                                                                 icon_path,
729                                                                                 NULL, 0,
730                                                                                 keyStr,
731                                                                                 NULL,
732                                                                                 NULL);
733
734         return obj;
735 }
736
737 static Setting_GenGroupItem_Data *__powersaving_handler(void *data, char *keyStr, char *icon_path, char *ug_name, Evas_Object *genlist, Elm_Object_Item *parent)
738 {
739         /* NOT UG --> it's just UI drawing */
740         setting_main_appdata *ad = (setting_main_appdata *)data;
741
742         Setting_GenGroupItem_Data *item_data = NULL;
743
744 #if SUPPORT_POWERSAVING
745         int value;
746         int ret = vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_SYSMODE_STATUS, &value);
747         if (ret != 0) {
748                 SETTING_TRACE_ERROR("get vconf failed");
749                 value = 1;
750         }
751         ad->data_powersaving =  setting_create_Gendial_field_groupitem(genlist,
752                                                                        &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
753                                                                        /*&(ad->itc[GENDIAL_Type_1text_2icon]), */
754                                                                        parent,
755                                                                        setting_main_click_list_ex_ug_cb,
756                                                                        ug_name,
757                                                                        SWALLOW_Type_1ICON_1RADIO,
758                                                                        icon_path,
759                                                                        NULL,
760                                                                        value,
761                                                                        keyStr,
762                                                                        NULL,
763                                                                        setting_main_list_mouse_up_cb);
764         __BACK_POINTER_SET(ad->data_powersaving);
765         item_data = ad->data_powersaving;
766 #endif
767
768 #if SUPPORT_PSMODE
769         ad->data_powersaving =  setting_create_Gendial_field_groupitem(genlist,
770                                                                        &(ad->itc[GENDIAL_Type_1text_1icon_2]),
771                                                                        parent,
772                                                                        setting_main_click_list_ex_ug_cb,
773                                                                        ug_name,
774                                                                        SWALLOW_Type_INVALID,
775                                                                        icon_path,
776                                                                        NULL,
777                                                                        0,
778                                                                        keyStr,
779                                                                        NULL,
780                                                                        NULL);
781         __BACK_POINTER_SET(ad->data_powersaving);
782         item_data = ad->data_powersaving;
783         int flight_key;
784         int ret = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_key);
785         if (ret != 0) {
786                 SETTING_TRACE_ERROR("get vconf failed");
787                 flight_key = 1;
788         }
789
790         if (ad->data_powersaving) {
791                 if (flight_key) {
792                         setting_disable_genlist_item(ad->data_powersaving->item);
793                 }
794         }
795 #endif
796         return item_data;
797 }
798
799 static Setting_GenGroupItem_Data *__driving_handler(void *data, char *keyStr, char *icon_path, char *ug_name, Evas_Object *genlist, Elm_Object_Item *parent)
800 {
801         /* NOT UG --> it's just UI drawing */
802
803         setting_main_appdata *ad = (setting_main_appdata *)data;
804         int value;
805         int ret = vconf_get_bool(VCONFKEY_SETAPPL_DM_DRIVING_MODE, &value);
806         if (ret != 0) {
807                 SETTING_TRACE_ERROR("get vconf failed");
808                 value = 1;
809         }
810         ad->data_driving =  setting_create_Gendial_field_groupitem(genlist,
811                                                                    &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
812                                                                    /*&(ad->itc[GENDIAL_Type_1text_2icon]), */
813                                                                    parent,
814                                                                    setting_main_click_list_ex_ug_cb,
815                                                                    ug_name,
816                                                                    SWALLOW_Type_1ICON_1RADIO,
817                                                                    icon_path,
818                                                                    NULL,
819                                                                    value,
820                                                                    keyStr,
821                                                                    NULL,
822                                                                    setting_main_list_mouse_up_cb);
823         __BACK_POINTER_SET(ad->data_driving);
824         return ad->data_driving;
825 }
826
827 /*//////////////////////////////////////////////////////////////////////////////////////////// */
828 /* list handler */
829 static mainlist_entry mainlist_table[] = {
830         {KeyStr_FlightMode,     __default_handler, UG_HANDLE, NULL},                    /* 0 --> NOT UG */
831         {KeyStr_NetRestrictionMode,     __netrestrictionmode_handler, UI_PROC, NULL},   /* 0 --> NOT UG */
832         {KeyStr_WiFi,                   __default_handler, UI_PROC, NULL},                              /* 1 --> UG */
833         {KeyStr_Bluetooth,              __default_handler, UI_PROC, NULL},
834         {KeyStr_MobileAP,               __mobileap_handler, UG_HANDLE, NULL},                   /* 1 --> UG */
835         {KeyStr_AllShare,               __allshare_handler, UI_PROC, NULL},                     /* NOT UG */
836         {KeyStr_Location,               __default_handler, UI_PROC, NULL},                              /* 1 --> UG */
837         {KeyStr_Network,                __default_handler, UG_HANDLE, NULL},                            /* 1 --> UG */
838 #if SUPPORT_NFC
839         {KeyStr_NFC,                    __nfc_handler, UG_HANDLE, NULL},                                        /* 1 --> UG */
840         {KeyStr_SBeam,                  __sbeam_handler, UG_HANDLE, NULL},                              /* 1 --> UG */
841 #endif
842         {KeyStr_Powersaving,            __powersaving_handler, UI_PROC, NULL},                          /* 1 --> UG */
843         {keystr_Drivingmode,            __driving_handler, UI_PROC, NULL},                              /* 1 --> UG */
844         {KeyStr_Joyn,                   __joyn_handler, UI_PROC, NULL},
845         {KeyStr_DeveloperOption, __developer_option_handler, UI_PROC, NULL},
846         {KeyStr_BacklightTime, __backlight_time_handler, UI_PROC, NULL},
847         {KeyStr_BatteryPercent, __battery_percent_handler, UG_HANDLE, NULL},
848         {Keystr_ScreenMode, __screen_mode_handler, UG_HANDLE, NULL},
849         {KeyStr_HighTouchSens, __default_handler, UI_PROC, NULL},
850         /*{KeyStr_Guestmode, __guest_mode_handler,UI_PROC, NULL}, */
851         {keystr_Personalmode, __personal_mode_handler, UI_PROC, NULL},
852 #if SUPPORT_BLOCKINGMODE
853         {keystr_Blockingmode, __blocking_mode_handler, UI_PROC, NULL},
854 #endif
855         {KeyStr_Brightness, __brightness_handler, UI_PROC, NULL},
856         {KeyStr_MultiWindowMode, __multiwindow_mode_handler, UI_PROC, NULL},
857         {KeyStr_Landscape, __landscape_handler, UG_HANDLE, NULL},
858         {KeyStr_AdjustScreenTone, __adjust_screen_tone_handler, UI_PROC, NULL},
859         {"Default",                     __default_handler, DEFAULT_UI, NULL},                           /* 1 --> UG */
860
861         /*-------------------------------------------------------------- */
862         {NULL, NULL, ERROR_STATE, NULL},
863 };
864
865 /*----------------------------------------------------------------------------------------- */
866 /* hash table utility */
867 static void __list_hash_free_cb(void *obj)
868 {
869         SETTING_TRACE_BEGIN;
870         /*const char *name = key; */
871         /*const char *number = data; */
872         /*printf("%s: %s\n", name, number); */
873
874 }
875
876 /* hash table utility */
877 void settinig_drawer_hash_init(void *cb)
878 {
879         SETTING_TRACE_BEGIN;
880
881         setting_main_appdata *ad = (setting_main_appdata *) cb;
882         eina_init();
883
884         mainlist_entry *pnode = NULL;
885         ad->main_list_hash = eina_hash_string_superfast_new(__list_hash_free_cb);
886
887         for (pnode = &mainlist_table[0]; pnode->title != NULL; pnode++) {
888                 eina_hash_add(ad->main_list_hash , pnode->title, pnode);
889                 /*SETTING_TRACE("init and add data to hash : %s ", pnode->title); */
890         }
891 }
892
893 /* hash table utility */
894 mainlist_entry *settinig_drawer_hash_find(void *cb, char *search_str)
895 {
896         /*SETTING_TRACE_BEGIN; */
897         /*SETTING_TRACE("------------------ HASH SEARCH ----------------------, %s", search_str); */
898         setting_main_appdata *ad = (setting_main_appdata *) cb;
899         mainlist_entry *pnode = NULL;
900
901         pnode = eina_hash_find(ad->main_list_hash, search_str);
902         return pnode;   /* statically allocated */
903 }
904 /*----------------------------------------------------------------------------------------- */
905
906
907 /* ***************************************************
908  *
909  *call back func
910  *
911  ***************************************************/
912
913
914 /* obj is the layout clicked */
915 void
916 setting_main_click_list_item_ug_cb(void *data, Evas_Object *obj,
917                                    char *ug_to_load, app_control_h svc,
918                                    struct ug_cbs *cbs)
919 {
920         SETTING_TRACE_BEGIN;
921         setting_main_appdata *ad = (setting_main_appdata *) data;
922         if (!ug_to_load) {
923                 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
924                 return;
925         }
926         SETTING_TRACE("to create libug-%s.so", ug_to_load);
927         elm_object_tree_focus_allow_set(ad->ly_main, EINA_FALSE);
928
929         /*setting_conformant_keypad_state(ad->win_main, TRUE); */
930         ad->ug = setting_ug_create(NULL, ug_to_load, UG_MODE_FULLVIEW, svc, cbs);
931         if (ad->ug) {
932                 ad->isInUGMode = TRUE;
933         } else {
934                 elm_object_tree_focus_allow_set(ad->ly_main, EINA_TRUE);
935                 evas_object_show(ad->ly_main);
936                 /*don't going to access globle var errno */
937                 /*SETTING_TRACE_ERROR("errno:%d", errno); */
938                 /*SETTING_TRACE_ERROR("Failed to load /usr/ug/lib/libug-%s.so", ug_to_load); */
939                 /*SETTING_TRACE_ERROR("Failed to load lib-%s.so", ug_to_load); */
940                 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
941         }
942 }
943
944 void /* obj is the layout clicked */
945 setting_main_click_grid_item_ug_cb(void *data, Evas_Object *obj,
946                                    char *ug_to_load, app_control_h svc,
947                                    struct ug_cbs *cbs)
948 {
949         SETTING_TRACE_BEGIN;
950         setting_main_appdata *ad = (setting_main_appdata *) data;
951         if (!ug_to_load) {
952                 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
953                 return;
954         }
955
956         SETTING_TRACE("to create libug-%s.so", ug_to_load);
957         elm_object_tree_focus_allow_set(ad->ly_main, EINA_FALSE);
958
959         /*setting_conformant_keypad_state(ad->win_main, TRUE); */
960         ad->ug = setting_ug_create(NULL, ug_to_load, UG_MODE_FULLVIEW, svc, cbs);
961         if (ad->ug) {
962                 ad->isInUGMode = TRUE;
963         } else {
964                 elm_object_tree_focus_allow_set(ad->ly_main, EINA_TRUE);
965                 evas_object_show(ad->ly_main);
966
967                 SETTING_TRACE_ERROR("errno:%d", errno);
968         }
969         /*SETTING_TRACE_END; */
970 }
971
972 void setting_main_click_list_default_ug_cb(void *data, Evas_Object *obj, void *event_info)
973 {
974         setting_main_appdata *ad = data;
975         setting_create_simple_popup(ad, ad->win_main, NULL,
976                                     NO_UG_FOUND_MSG);
977 }
978
979 void setting_main_click_list_usb_cb(void *data, Evas_Object *obj, void *event_info)
980 {
981         SETTING_TRACE_BEGIN;
982         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
983
984         int err;
985         int value = -1;
986         char *str_text = USB_NEED_OFF;
987
988         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
989
990         setting_get_int_slp_key(INT_SLP_SETTING_MOBILE_AP_STATUS, &value, &err);
991         if (err != 0) {
992                 SETTING_TRACE_ERROR("FAIL: VCONFKEY_MOBILE_HOTSPOT_MODE may not exist\n");
993                 setting_main_click_list_ex_ug_cb(data, obj, item);
994                 return;
995         }
996
997         /* If mobile hotspot is on, going USB utilties is blocked by a popup*/
998         if (value & VCONFKEY_MOBILE_HOTSPOT_MODE_USB) {
999                 elm_genlist_item_selected_set(item, EINA_FALSE);
1000                 setting_create_simple_popup(g_main_ad, g_main_ad->win_main, NULL, str_text);
1001         } else {
1002                 setting_main_click_list_ex_ug_cb(data, obj, item);
1003         }
1004 }
1005
1006 void setting_main_kies_via_wifi_care_resp_cb(void *data, Evas_Object *obj,
1007                                              void *event_info)
1008 {
1009         SETTING_TRACE_BEGIN;
1010         setting_retm_if(NULL == data, "NULL == data");
1011         setting_main_appdata *ad = g_main_ad;
1012         int response_type = btn_type(obj);
1013
1014         if (POPUP_RESPONSE_OK == response_type) {
1015                 /* do  nothing.. */
1016                 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
1017                 setting_retm_if(!cbs, "calloc failed");
1018                 cbs->layout_cb = setting_main_layout_ug_cb;
1019                 cbs->result_cb = setting_main_result_ug_cb;
1020                 cbs->destroy_cb = setting_main_destroy_ug_cb;
1021                 cbs->priv = (void *)ad;
1022
1023                 char *path = get_ug_path_from_ug_args(data);
1024                 app_control_h svc = get_bundle_from_ug_args(data);
1025                 setting_main_click_list_item_ug_cb(ad, obj, path, svc, cbs);
1026                 if (path) {
1027                         FREE(path);
1028                 }
1029                 if (cbs) {
1030                         FREE(cbs);
1031                 }
1032                 path = NULL;
1033                 cbs = NULL;
1034                 app_control_destroy(svc);
1035         } else if (POPUP_RESPONSE_CANCEL == response_type) {
1036                 SETTING_TRACE(" cancel - do nothing ");
1037         } else {
1038                 SETTING_TRACE(" NOT REACHABLE -- response_type : %d", response_type);
1039         }
1040         evas_object_del(ad->popup_kies_via_wifi);
1041         ad->popup_kies_via_wifi = NULL;
1042 }
1043 void setting_main_kies_via_wifi_warn_resp_cb(void *data, Evas_Object *obj,
1044                                              void *event_info)
1045 {
1046         setting_retm_if(NULL == data, "NULL == data");
1047         setting_main_appdata *ad = g_main_ad;
1048         evas_object_del(ad->popup_kies_via_wifi);
1049         ad->popup_kies_via_wifi = NULL;
1050 }
1051
1052
1053
1054
1055 void setting_main_click_list_ex_personal_mode_cb(void *data, Evas_Object *obj,
1056                                                  void *event_info)
1057 {
1058         SETTING_TRACE_BEGIN;
1059         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1060         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1061
1062         elm_genlist_item_selected_set(item, EINA_FALSE);
1063
1064         bool is_running = FALSE;
1065         app_manager_is_running("org.tizen.setting.personal", &is_running);
1066         if (!is_running) {
1067                 elm_object_tree_focus_allow_set(g_main_ad->ly_main, EINA_FALSE);
1068                 app_control_h svc;
1069                 if (app_control_create(&svc)) {
1070                         /*FREE(cbs); */
1071                         return;
1072                 }
1073                 app_control_set_app_id(svc, "org.tizen.setting.personal");
1074                 app_control_set_window(svc, elm_win_xwindow_get(g_main_ad->win_main));
1075                 app_control_set_operation(svc, APP_CONTROL_OPERATION_DEFAULT);
1076                 app_control_send_launch_request(svc, NULL, NULL);
1077                 app_control_destroy(svc);
1078         }
1079 }
1080
1081 void setting_main_click_list_ex_ug_cb(void *data, Evas_Object *obj,
1082                                       void *event_info)
1083 {
1084         SETTING_TRACE_BEGIN;
1085         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1086         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1087
1088         elm_genlist_item_selected_set(item, EINA_FALSE);
1089
1090
1091         SETTING_TRACE("g_main_ad->isInUGMode:%d", g_main_ad->isInUGMode);
1092         SETTING_TRACE("g_main_ad->ug:%p", g_main_ad->ug);
1093         if (g_main_ad->isInUGMode && g_main_ad->ug) {
1094                 SETTING_TRACE
1095                 ("[ad->ug non-NULL]skip genlist click event!!");
1096
1097                 /*SETTING_TRACE_END; */
1098                 return;
1099         }
1100
1101         setting_main_appdata *ad = g_main_ad;
1102
1103         /*  if UG is created by Setting app, setting_main_click_list_ex_ug_cb is diabled. */
1104         if (ad->isInUGMode) {
1105                 SETTING_TRACE("isInUGMode : TRUE - another UG is running now.");
1106                 ad->isInUGMode = FALSE;
1107                 /*SETTING_TRACE_END; */
1108                 return;
1109         } else {
1110                 SETTING_TRACE
1111                 ("isInUGMode : FALSE - another UG is NOT running now.")
1112         }
1113
1114         Setting_GenGroupItem_Data *selected_item_data =
1115             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1116         setting_main_click_list_item_reset_data(ad, obj);
1117         const char *item_name = _(selected_item_data->keyStr);
1118         SETTING_TRACE("item_name:%s", item_name);
1119         ret_if(!item_name);
1120
1121         if (!safeStrCmp(KeyStr_KeisOverWifi, selected_item_data->keyStr)) {
1122                 int status = VCONFKEY_MOBEX_ENGINE_STATUS_NOT_CONNECT;
1123                 int methord = VCONFKEY_MOBEX_ENGIN_NONE;
1124                 vconf_get_int(VCONFKEY_MOBEX_ENGINE_STATUS_INT, &status);
1125                 vconf_get_int(VCONFKEY_MOBEX_ENGINE_CONNECTION_METHOD_INT, &methord);
1126
1127                 if (status != VCONFKEY_MOBEX_ENGINE_STATUS_NOT_CONNECT
1128                     && methord == VCONFKEY_MOBEX_ENGIN_USB) {
1129                         ad->popup_kies_via_wifi =
1130                             setting_create_popup_with_btn(data, ad->win_main,
1131                                                           NULL, Kies_Warrning_Str,
1132                                                           setting_main_kies_via_wifi_warn_resp_cb,
1133                                                           0, 1, "IDS_COM_SK_OK");
1134                 } else {
1135                         ad->popup_kies_via_wifi = setting_create_popup_with_btn(data,
1136                                                                                 ad->win_main,
1137                                                                                 NULL, _(Kies_Caring_Str),
1138                                                                                 setting_main_kies_via_wifi_care_resp_cb,
1139                                                                                 0, 2, "IDS_COM_SK_OK", "IDS_COM_SK_CANCEL");
1140                 }
1141                 return;
1142         }
1143
1144
1145         if (safeStrCmp(selected_item_data->keyStr, KeyStr_MoreDisplay) == 0) {
1146                 return;
1147         }
1148
1149         if (!safeStrCmp(selected_item_data->keyStr, KeyStr_Call)
1150             || !safeStrCmp(selected_item_data->keyStr, keystr_Blockingmode)
1151             || !safeStrCmp(selected_item_data->keyStr, keystr_Drivingmode)
1152             || !safeStrCmp(selected_item_data->keyStr, KeyStr_SimMgr)
1153             || !safeStrCmp(selected_item_data->keyStr, KeyStr_WiFi)
1154             || !safeStrCmp(selected_item_data->keyStr, KeyStr_Location)
1155             || !safeStrCmp(selected_item_data->keyStr, KeyStr_Bluetooth)
1156             || !safeStrCmp(selected_item_data->keyStr, KeyStr_MobileAP)
1157             || !safeStrCmp(selected_item_data->keyStr, KeyStr_WiFiDirect)
1158             || !safeStrCmp(selected_item_data->keyStr, KeyStr_Wallpaper)
1159            ) {
1160                 if (app_launcher(data) == 0) {
1161                         ad->event_freeze_timer = ecore_timer_add(1, setting_main_freeze_event_timer_cb, ad);
1162                         evas_object_freeze_events_set(ad->navibar_main, EINA_TRUE);
1163                 }
1164                 int click_times = setting_cfg_get_click_times(selected_item_data->keyStr);
1165                 setting_cfg_set_click_times(selected_item_data->keyStr, ++click_times);
1166                 return;
1167         }
1168
1169         /*special checking: */
1170         /*1.powersaving cannot work when Flightmode on */
1171         if (safeStrCmp(selected_item_data->keyStr, KeyStr_Powersaving) == 0) {
1172                 int status = 0;
1173                 vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &status);
1174                 if (status) {
1175                         setting_create_simple_popup(NULL, ad->win_main,
1176                                                     NULL, "IDS_IM_POP_THIS_FEATURE_IS_NOT_AVAILABLE_WHILE_FLIGHT_MODE_IS_ON");
1177                         return;
1178                 }
1179         }
1180
1181         /*2.Quick command cannot work when TTS on */
1182         int tts_state = 0;
1183         vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &tts_state);
1184         if (tts_state) {
1185                 if (!safeStrCmp(selected_item_data->keyStr, KeyStr_QUICK_CMD)) {
1186                         char noti_str[MAX_SPECIALIZITION_LEN + 1] = { 0, };
1187                         snprintf(noti_str, sizeof(noti_str), _(FEATURE_UNAVALIABLE_WHILE_TTS_ON), _(KeyStr_QUICK_CMD));
1188                         setting_create_popup_without_btn(NULL, ad->win_main, NULL, _(noti_str),
1189                                                          NULL, 0.0, TRUE, FALSE);
1190                         return;
1191                 }
1192         }
1193
1194         struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
1195         setting_retm_if(!cbs, "calloc failed");
1196         cbs->layout_cb = setting_main_layout_ug_cb;
1197         cbs->result_cb = setting_main_result_ug_cb;
1198         cbs->destroy_cb = setting_main_destroy_ug_cb;
1199         cbs->priv = (void *)ad;
1200
1201         char *path = get_ug_path_from_ug_args(data);
1202         app_control_h svc = get_bundle_from_ug_args(data);
1203         setting_main_click_list_item_ug_cb(ad, obj, path, svc, cbs);
1204         if (path) {
1205                 FREE(path);
1206         }
1207         if (cbs) {
1208                 FREE(cbs);
1209         }
1210         path = NULL;
1211         cbs = NULL;
1212         app_control_destroy(svc);
1213
1214 }
1215
1216 #if SUPPORT_BLOCKINGMODE
1217 static void
1218 ___blocking_mode_resp_cb(void *data, Evas_Object *obj, void *event_info)
1219 {
1220         SETTING_TRACE_BEGIN;
1221         setting_retm_if(obj == NULL, "obj parameter is NULL");
1222         setting_retm_if(data == NULL, "Data parameter is NULL");
1223         int reposnse_type = btn_type(obj);
1224         if (g_main_ad->popup_blocking_mode) {
1225                 evas_object_del(g_main_ad->popup_blocking_mode);
1226                 g_main_ad->popup_blocking_mode = NULL;
1227         }
1228         switch (reposnse_type) {
1229                 case POPUP_RESPONSE_OK: {
1230                                 if (g_main_ad->isInUGMode && g_main_ad->ug) {
1231                                         SETTING_TRACE("[ad->ug non-NULL]skip genlist click event!!");
1232
1233                                         return;
1234                                 }
1235
1236                                 setting_main_appdata *ad = g_main_ad;
1237
1238                                 /*  if UG is created by Setting app, setting_main_click_list_ex_ug_cb is diabled. */
1239                                 if (ad->isInUGMode) {
1240                                         SETTING_TRACE("isInUGMode : TRUE - another UG is running now.");
1241                                         ad->isInUGMode = FALSE;
1242                                         return;
1243                                 } else {
1244                                         SETTING_TRACE
1245                                         ("isInUGMode : FALSE - another UG is NOT running now.")
1246                                 }
1247
1248                                 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1249                                 SETTING_TRACE("process item [%s]", list_item->keyStr);
1250                                 list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
1251
1252                                 if (!list_item->chk_status) {
1253                                         vconf_set_bool(VCONFKEY_SETAPPL_BLOCKINGMODE_BLOCKINGMODE, !list_item->chk_status);
1254                                 }
1255
1256                                 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
1257                                 setting_retm_if(!cbs, "calloc failed");
1258                                 cbs->layout_cb = setting_main_layout_ug_cb;
1259                                 cbs->result_cb = setting_main_result_ug_cb;
1260                                 cbs->destroy_cb = setting_main_destroy_ug_cb;
1261                                 cbs->priv = (void *)ad;
1262                                 char *ug_args = NULL;
1263
1264                                 char *keyStr = NULL;
1265                                 int i, j;
1266
1267                                 for (i = 0; i < setting_cfg_get_category_length(); i++) {
1268                                         for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
1269                                                 keyStr = setting_cfg_get_keyname_idx(i, j);
1270                                                 if (!safeStrCmp(keystr_Blockingmode, keyStr)) {
1271                                                         ug_args = setting_cfg_get_ug_args_idx(i, j);
1272                                                         break;
1273                                                 }
1274                                         }
1275                                 }
1276
1277                                 if (ug_args) {
1278                                         setting_create_quickpannel_notification("setting-blockingmode-efl",
1279                                                                                 NOTIFICATION_TYPE_ONGOING,
1280                                                                                 NOTIFICATION_LY_ONGOING_EVENT,
1281                                                                                 "IDS_ST_BODY_BLOCKING_MODE",
1282                                                                                 "IDS_ST_BODY_BLOCKING_MODE_IS_ENABLED",
1283                                                                                 IMG_BlockingMode, &ad->noti_id);
1284                                         char *path = get_ug_path_from_ug_args(ug_args);
1285                                         app_control_h svc = get_bundle_from_ug_args(ug_args);
1286                                         setting_main_click_list_item_ug_cb(ad, obj, path, svc, cbs);
1287                                         FREE(path);
1288                                         app_control_destroy(svc);
1289                                 } else {
1290                                         SETTING_TRACE("blocking mode not found");
1291                                 }
1292                                 FREE(cbs);
1293
1294                         }
1295                 default:
1296                         break;
1297         }
1298 }
1299 #endif
1300
1301 #if SUPPORT_DRIVINGMODE
1302 static void
1303 ___driving_mode_resp_cb(void *data, Evas_Object *obj, void *event_info)
1304 {
1305         SETTING_TRACE_BEGIN;
1306         setting_retm_if(obj == NULL, "obj parameter is NULL");
1307         setting_retm_if(data == NULL, "Data parameter is NULL");
1308         int reposnse_type = btn_type(obj);
1309         if (g_main_ad->driving_mode_popup) {
1310                 evas_object_del(g_main_ad->driving_mode_popup);
1311                 g_main_ad->driving_mode_popup = NULL;
1312         }
1313         switch (reposnse_type) {
1314                 case POPUP_RESPONSE_OK: {
1315                                 if (g_main_ad->isInUGMode && g_main_ad->ug) {
1316                                         SETTING_TRACE("[ad->ug non-NULL]skip genlist click event!!");
1317
1318                                         return;
1319                                 }
1320
1321                                 setting_main_appdata *ad = g_main_ad;
1322
1323                                 /*  if UG is created by Setting app, setting_main_click_list_ex_ug_cb is diabled. */
1324                                 if (ad->isInUGMode) {
1325                                         SETTING_TRACE("isInUGMode : TRUE - another UG is running now.");
1326                                         ad->isInUGMode = FALSE;
1327                                         return;
1328                                 } else {
1329                                         SETTING_TRACE
1330                                         ("isInUGMode : FALSE - another UG is NOT running now.");
1331                                 }
1332
1333                                 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1334                                 if (list_item && list_item->keyStr) {
1335                                         SETTING_TRACE("process item [%s]", list_item->keyStr);
1336                                 }
1337                                 list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
1338
1339                                 if (!list_item->chk_status) {
1340                                         vconf_set_bool(VCONFKEY_SETAPPL_DRIVINGMODE_DRIVINGMODE, !list_item->chk_status);
1341                                 }
1342
1343                                 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
1344                                 setting_retm_if(!cbs, "calloc failed");
1345                                 cbs->layout_cb = setting_main_layout_ug_cb;
1346                                 cbs->result_cb = setting_main_result_ug_cb;
1347                                 cbs->destroy_cb = setting_main_destroy_ug_cb;
1348                                 cbs->priv = (void *)ad;
1349                                 char *ug_args = NULL;
1350
1351                                 char *keyStr = NULL;
1352                                 int i, j;
1353
1354                                 for (i = 0; i < setting_cfg_get_category_length(); i++) {
1355                                         for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
1356                                                 keyStr = setting_cfg_get_keyname_idx(i, j);
1357                                                 if (!safeStrCmp(keystr_Drivingmode, keyStr)) {
1358                                                         ug_args = setting_cfg_get_ug_args_idx(i, j);
1359                                                         break;
1360                                                 }
1361                                         }
1362                                 }
1363
1364                                 if (ug_args) {
1365                                         /*__driving_mode_create_noti(ad,"IDS_ST_BODY_INCOMING_CALLS_AND_NEW_NOTIFICATIONS_WILL_BE_READ_OUT_AUTOMATICALLY"); */
1366                                         setting_create_quickpannel_notification("setting-drivingmode-efl",
1367                                                                                 NOTIFICATION_TYPE_ONGOING,
1368                                                                                 NOTIFICATION_LY_ONGOING_EVENT,
1369                                                                                 keystr_Drivingmode,
1370                                                                                 "IDS_ST_BODY_INCOMING_CALLS_AND_NEW_NOTIFICATIONS_WILL_BE_READ_OUT_AUTOMATICALLY",
1371                                                                                 IMG_DrivingMode, &ad->noti_id);
1372
1373                                         char *path = get_ug_path_from_ug_args(ug_args);
1374                                         app_control_h svc = get_bundle_from_ug_args(ug_args);
1375                                         setting_main_click_list_item_ug_cb(ad, obj, path, svc, cbs);
1376                                         FREE(path);
1377                                         app_control_destroy(svc);
1378                                 } else {
1379                                         SETTING_TRACE("driving mode not found");
1380                                 }
1381                                 FREE(cbs);
1382
1383                         }
1384                 default:
1385                         break;
1386         }
1387 }
1388 #endif
1389
1390
1391 /**
1392  * toggle cb
1393  */
1394 static void __personal_mode_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
1395 {
1396         SETTING_TRACE_BEGIN;
1397         ret_if(!user_data);
1398
1399         Setting_GenGroupItem_Data *item = (Setting_GenGroupItem_Data *)user_data;
1400
1401         /* Rollback toggle before applying */
1402         int status = 0;
1403         vconf_get_bool(VCONFKEY_SETAPPL_PERSONAL_MODE_STATUS_BOOL, &status);
1404         item->chk_status = status;
1405         elm_check_state_set(item->eo_check, item->chk_status);
1406 }
1407
1408 void setting_main_list_mouse_up_cb(void *data, Evas_Object *eo,
1409                                    void *event_info)
1410 {
1411         /*SETTING_TRACE_BEGIN; */
1412         retm_if(data == NULL, "Data parameter is NULL");
1413         Setting_GenGroupItem_Data *list_item =
1414             (Setting_GenGroupItem_Data *) data;
1415         SETTING_TRACE("process item [%s]", list_item->keyStr);
1416         list_item->chk_status = elm_check_state_get(eo);        /* for update new state */
1417
1418         SETTING_TRACE("change radio[%s], status is:%d", _(list_item->keyStr),
1419                       list_item->chk_status);
1420         setting_main_appdata *ad = g_main_ad;
1421
1422         if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
1423                 int err;
1424                 if (elm_check_state_get(eo)) {
1425                         setting_set_bool_slp_key
1426                         (BOOL_SLP_SETTING_USE_PACKET_DATA,
1427                          SETTING_ON_OFF_BTN_ON, &err);
1428                 } else {
1429                         setting_set_bool_slp_key
1430                         (BOOL_SLP_SETTING_USE_PACKET_DATA,
1431                          SETTING_ON_OFF_BTN_OFF, &err);
1432                 }
1433 #if SUPPORT_DRIVINGMODE
1434         } else if (!safeStrCmp(keystr_Drivingmode, list_item->keyStr)) {
1435                 /*if set on, need to add popup */
1436                 if (list_item->chk_status) {
1437                         if (!check_drivingmode_sub_item()) {
1438                                 g_main_ad->driving_mode_popup = setting_create_popup_with_btn(list_item, ad->win_main,
1439                                                                                               NULL, "IDS_ST_POP_TO_ENABLE_HANDS_FREE_MODE_ENABLE_AT_LEAST_ONE_RELEVANT_FUNCTION",
1440                                                                                               ___driving_mode_resp_cb, 0,
1441                                                                                               2, "IDS_COM_SK_OK", "IDS_COM_SK_CANCEL");
1442                                 list_item->chk_status = !list_item->chk_status;
1443                                 elm_genlist_item_update(list_item->item);
1444                                 return;
1445                         }
1446                 } else {
1447                         /* */
1448                 }
1449                 vconf_set_bool(VCONFKEY_SETAPPL_DRIVINGMODE_DRIVINGMODE, list_item->chk_status);
1450
1451                 /* call the set_state */
1452                 Setting_Cfg_Node_T *pnode = get_cfg_node_by_keystr(_(list_item->keyStr));
1453                 if (pnode && pnode->tfunc && pnode->tfunc->set_item_state) {
1454                         pnode->tfunc->set_item_state(list_item->chk_status, NULL, ad);
1455                 }
1456 #endif
1457 #if SUPPORT_BLOCKINGMODE
1458         } else if (!safeStrCmp(keystr_Blockingmode, list_item->keyStr)) {
1459
1460                 if (list_item->chk_status) {
1461                         if (!check_blockingmode_sub_item()) {
1462                                 g_main_ad->popup_blocking_mode = setting_create_popup_with_btn(ad, ad->win_main,
1463                                                                                                NULL, "IDS_ST_BODY_TO_ENABLE_BLOCKING_MODE_ENABLE_AT_LEAST_ONE_OPTION",
1464                                                                                                ___blocking_mode_resp_cb, 0,
1465                                                                                                2, "IDS_COM_SK_OK", "IDS_COM_SK_CANCEL");
1466                                 list_item->chk_status = !list_item->chk_status;
1467                                 elm_genlist_item_update(list_item->item);
1468                                 return;
1469                         }
1470                 } else {
1471                         vconf_set_bool(VCONFKEY_SETAPPL_BLOCKINGMODE_INCOMINGCALL, FALSE);
1472                         vconf_set_bool(VCONFKEY_SETAPPL_BLOCKINGMODE_NOTIFICATIONS, FALSE);
1473                         vconf_set_bool(VCONFKEY_SETAPPL_BLOCKINGMODE_ALARM_AND_TIMER, FALSE);
1474                         vconf_set_bool(VCONFKEY_SETAPPL_BLOCKINGMODE_LED_INDICATOR, FALSE);
1475                 }
1476                 vconf_set_bool(VCONFKEY_SETAPPL_BLOCKINGMODE_BLOCKINGMODE, list_item->chk_status);
1477
1478                 Setting_Cfg_Node_T *pnode = get_cfg_node_by_keystr(_(list_item->keyStr));
1479
1480                 if (pnode && pnode->tfunc && pnode->tfunc->set_item_state) {
1481                         pnode->tfunc->set_item_state(list_item->chk_status, NULL, ad);
1482                 }
1483 #endif
1484 #if SUPPORT_PERSONALPAGE
1485         } else if (!safeStrCmp(keystr_Personalmode, list_item->keyStr)) {
1486                 /*personalmode_toggle_set_state(list_item->chk_status, NULL, ad); */
1487                 if (Cfg_Item_Error == list_item->chk_status) return;
1488
1489                 bool is_running = FALSE;
1490                 app_manager_is_running("org.tizen.setting.personal", &is_running);
1491                 if (!is_running) {
1492                         elm_object_tree_focus_allow_set(ad->ly_main, EINA_FALSE);
1493                         app_control_h svc;
1494                         if (app_control_create(&svc)) {
1495                                 return;
1496                         }
1497                         /* verify current key */
1498                         app_control_add_extra_data(svc, "viewtype", "unlock_method");
1499                         app_control_set_app_id(svc, "org.tizen.setting.personal");
1500                         app_control_set_window(svc, elm_win_xwindow_get(ad->win_main));
1501                         app_control_set_operation(svc, APP_CONTROL_OPERATION_DEFAULT);
1502                         app_control_send_launch_request(svc, __personal_mode_cb, ad->data_temp);
1503                         app_control_destroy(svc);
1504                 }
1505 #endif
1506
1507 #if SUPPORT_GUESTMODE
1508         } else if (!safeStrCmp(KeyStr_Guestmode, list_item->keyStr)) {
1509                 vconf_set_bool(VCONFKEY_SETAPPL_GM_GUEST_MODE, list_item->chk_status);
1510 #endif
1511
1512 #if SUPPORT_POWERSAVING
1513         } else if (!safeStrCmp(KeyStr_Powersaving, list_item->keyStr)) {
1514                 if (list_item->chk_status) {
1515                         if (!check_powersaving_sub_item()) {
1516                                 setting_create_popup_without_btn(ad, ad->win_main, NULL,
1517                                                                  "IDS_ST_BODY_TO_ENABLE_POWER_SAVING_MODE_ENABLE_AT_LEAST_ONE_FUNCTION",
1518                                                                  NULL, POPUP_INTERVAL, FALSE, FALSE);
1519                                 list_item->chk_status = !list_item->chk_status;
1520                         }
1521                 }
1522                 vconf_set_bool(VCONFKEY_SETAPPL_PWRSV_SYSMODE_STATUS, list_item->chk_status);
1523                 vconf_set_int(VCONFKEY_SETAPPL_PSMODE, list_item->chk_status);
1524         } else if (!safeStrCmp(KeyStr_MultiWindowMode, list_item->keyStr)) {
1525                 /*Multi window toggle action */
1526                 /*elm_genlist_item_update(list_item->item); */
1527                 int ret = vconf_set_bool(VCONFKEY_QUICKSETTING_MULTIWINDOW_ENABLED, list_item->chk_status);
1528                 if (ret != 0) {
1529                         SETTING_TRACE_ERROR("Set multi window vconf failed.");
1530                 }
1531 #endif
1532         }
1533         return;
1534 }
1535
1536
1537
1538
1539 static void ___wifi_activated_cb(wifi_error_e result, void *user_data)
1540 {
1541         SETTING_TRACE_BEGIN;
1542         if (result == WIFI_ERROR_NONE) {
1543                 SETTING_TRACE("Wi-Fi Activation Succeeded");
1544         } else {
1545                 SETTING_TRACE("Wi-Fi Activation Failed! error : %d", result);
1546         }
1547
1548         (void)wifi_deinitialize();
1549 }
1550
1551 #if SUPPORT_TETHERING
1552 static void __tethering_disabled_cb(tethering_error_e error, tethering_type_e type, tethering_disabled_cause_e code, void *data)
1553 {
1554         int ret;
1555
1556         if (data) {
1557                 tethering_h th = (tethering_h)data;
1558                 tethering_destroy(th);
1559         }
1560
1561         ret = wifi_initialize();
1562         setting_retm_if(ret < 0, "*** [ERR] wifi_initialize() ***");
1563
1564         ret = wifi_activate(___wifi_activated_cb, NULL);
1565         if (ret < 0) {
1566                 SETTING_TRACE_ERROR("*** [ERR] wifi_activate() ***");
1567                 (void)wifi_deinitialize();
1568                 return;
1569         }
1570 }
1571 #endif
1572
1573 static Eina_Bool __wifi_timeout(void *data)
1574 {
1575         /*SETTING_TRACE_BEGIN; */
1576         retvm_if(!data, ECORE_CALLBACK_CANCEL, "Invalid argument: data is NULL");
1577         Setting_GenGroupItem_Data *list_item = data;
1578         int status, err;
1579         setting_get_int_slp_key(INT_SLP_SETTING_WIFI_STATUS, &status, &err);
1580         SETTING_TRACE("value:%d", status);
1581
1582         int i;
1583         for (i = VIEW_All_List; i < VIEW_Max; i++) {
1584                 list_item = g_main_ad->gl_data_item[i][GL_WiFi];
1585                 if (list_item) {
1586                         list_item->chk_status = status;
1587                         list_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
1588                         elm_object_item_data_set(list_item->item, list_item);
1589                         elm_genlist_item_update(list_item->item);
1590                         setting_main_appdata *ad = list_item->userdata;
1591                         ad->wifi_timer = NULL;
1592                 }
1593         }
1594
1595         return ECORE_CALLBACK_CANCEL;
1596 }
1597
1598 static void __tethering_turn_off_resp_cb(void *data, Evas_Object *obj, void *event_info)
1599 {
1600         setting_retm_if(NULL == obj, "NULL == obj");
1601         int response_type = btn_type(obj);
1602         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data;
1603
1604         if (g_main_ad) {
1605                 evas_object_del(g_main_ad->popup_wifi_mode);
1606                 g_main_ad->popup_wifi_mode = NULL;
1607         }
1608
1609         int i = 0;
1610         Setting_GenGroupItem_Data *update_item = NULL;
1611         if (POPUP_RESPONSE_OK == response_type) {
1612                 /*add timeout strategy.. */
1613                 ret_if(!list_item->userdata);
1614                 setting_main_appdata *ad = list_item->userdata;
1615                 if (ad->wifi_timer) {
1616                         ecore_timer_del(ad->wifi_timer);
1617                         ad->wifi_timer = NULL;
1618                 }
1619                 ad->wifi_timer = ecore_timer_add(5.0, (Ecore_Task_Cb) __wifi_timeout, list_item);
1620
1621 #if SUPPORT_TETHERING
1622                 int type = tethering_is_enabled(NULL, TETHERING_TYPE_WIFI) ? TETHERING_TYPE_WIFI : TETHERING_TYPE_WIFI_AP;
1623
1624                 tethering_h th = NULL;
1625                 tethering_error_e ret = TETHERING_ERROR_NONE;
1626
1627                 ret = tethering_create(&th);
1628                 if (ret != TETHERING_ERROR_NONE) {
1629                         for (i = VIEW_All_List; i < VIEW_Max; i++) {
1630                                 update_item = ad->gl_data_item[i][GL_WiFi];
1631                                 if (update_item) {
1632                                         update_item->chk_status = EINA_FALSE;
1633                                         update_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
1634                                         elm_object_item_data_set(update_item->item, update_item);
1635                                         elm_genlist_item_update(update_item->item);
1636                                 }
1637                         }
1638                 }
1639
1640                 ret = tethering_set_disabled_cb(th, type, __tethering_disabled_cb, th);
1641                 if (ret != TETHERING_ERROR_NONE) {
1642                         for (i = VIEW_All_List; i < VIEW_Max; i++) {
1643                                 update_item = ad->gl_data_item[i][GL_WiFi];
1644                                 if (update_item) {
1645                                         update_item->chk_status = EINA_FALSE;
1646                                         update_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
1647                                         elm_object_item_data_set(update_item->item, update_item);
1648                                         elm_genlist_item_update(update_item->item);
1649                                 }
1650                         }
1651
1652                         tethering_destroy(th);
1653                         return;
1654                 }
1655
1656                 (void) tethering_disable(th, type);
1657 #endif
1658         } else if (POPUP_RESPONSE_CANCEL == response_type) {
1659                 for (i = VIEW_All_List; i < VIEW_Max; i++) {
1660                         update_item = g_main_ad->gl_data_item[i][GL_WiFi];
1661                         if (update_item) {
1662                                 update_item->chk_status = EINA_FALSE;
1663                                 update_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
1664                                 elm_object_item_data_set(update_item->item, update_item);
1665                                 elm_genlist_item_update(update_item->item);
1666                         }
1667                 }
1668         }
1669 }
1670
1671
1672 void __alternate_wifi_mode(Setting_GenGroupItem_Data *list_item, Evas_Object *check)
1673 {
1674         /*SETTING_TRACE_BEGIN; */
1675         /*int ret; */
1676         Eina_Bool status =  elm_check_state_get(check);
1677         SETTING_TRACE("wifi mode status : %d", status);
1678
1679         /*int value, err; */
1680         int i = 0;
1681         Setting_GenGroupItem_Data *item_to_update = NULL;
1682
1683 #if SUPPORT_TETHERING
1684         if (tethering_is_enabled(NULL, TETHERING_TYPE_WIFI)
1685             || tethering_is_enabled(NULL, TETHERING_TYPE_WIFI_AP)) {
1686                 for (i = VIEW_All_List; i < VIEW_Max; i++) {
1687                         item_to_update = g_main_ad->gl_data_item[i][GL_WiFi];
1688                         if (item_to_update) {
1689                                 item_to_update->swallow_type = SWALLOW_Type_1ICON_1PROCESS;
1690                                 elm_object_item_data_set(item_to_update->item, item_to_update);
1691                                 elm_genlist_item_fields_update(item_to_update->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
1692                         }
1693                 }
1694
1695                 g_main_ad->popup_wifi_mode = setting_create_popup_with_btn(list_item,
1696                                                                            g_main_ad->win_main, NULL,
1697                                                                            "IDS_MOBILEAP_POP_TURNING_ON_WI_FI_WILL_DISABLE_MOBILE_HOTSPOT_CONTINUE_Q_VZW",
1698                                                                            __tethering_turn_off_resp_cb,
1699                                                                            0, 2, "IDS_COM_SK_OK", "IDS_COM_SK_CANCEL");
1700         } else
1701 #endif
1702         {
1703                 int wifi_state = VCONFKEY_WIFI_OFF;
1704                 vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
1705                 DBusMessageIter iter;
1706                 DBusMessage *message = NULL;
1707                 DBusConnection *connection = NULL;
1708                 SETTING_TRACE("status:%d", status);
1709                 if (status) {
1710                         if (wifi_state != VCONFKEY_WIFI_OFF) {
1711                                 /* Wi-Fi is enabled */
1712                                 SETTING_TRACE("Wi-Fi is already enabled");
1713                                 return ;
1714                         }
1715                         connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
1716                         if (connection == NULL) {
1717                                 SETTING_TRACE_ERROR("Failed to get system bus");
1718                                 return;
1719                         }
1720
1721                         message = dbus_message_new_method_call(NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH,
1722                                                                NETCONFIG_WIFI_INTERFACE, "LoadDriver");
1723                         if (message == NULL) {
1724                                 SETTING_TRACE_ERROR("Failed DBus method call");
1725                                 dbus_connection_unref(connection);
1726                                 return ;
1727                         }
1728
1729                         g_main_ad->wifi_op = OP_WIFI_TURNING_ON;
1730
1731                         dbus_message_iter_init_append(message, &iter);
1732                         dbus_bool_t val = FALSE;
1733                         dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &val);
1734
1735                         dbus_connection_send_with_reply(connection, message, NULL, 10000);
1736
1737                         dbus_message_unref(message);
1738                         dbus_connection_unref(connection);
1739
1740                 } else {
1741                         if (wifi_state == VCONFKEY_WIFI_OFF) {
1742                                 /* Wi-Fi is disabled */
1743                                 SETTING_TRACE("Wi-Fi is already disabled");
1744                                 return ;
1745                         }
1746
1747                         connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
1748                         if (connection == NULL) {
1749                                 SETTING_TRACE_ERROR("Failed to get system bus");
1750                                 return;
1751                         }
1752
1753                         message = dbus_message_new_method_call(NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH,
1754                                                                NETCONFIG_WIFI_INTERFACE, "RemoveDriver");
1755                         if (message == NULL) {
1756                                 SETTING_TRACE_ERROR("Failed DBus method call");
1757                                 dbus_connection_unref(connection);
1758                                 return;
1759                         }
1760                         g_main_ad->wifi_op = OP_WIFI_TURNING_OFF;
1761
1762                         dbus_connection_send_with_reply(connection, message, NULL, 10000);
1763
1764                         dbus_message_unref(message);
1765                         dbus_connection_unref(connection);
1766
1767                 }
1768
1769                 for (i = VIEW_All_List; i < VIEW_Max; i++) {
1770                         item_to_update = g_main_ad->gl_data_item[i][GL_WiFi];
1771                         if (item_to_update) {
1772                                 item_to_update->swallow_type = SWALLOW_Type_1ICON_1PROCESS;
1773                                 elm_object_item_data_set(item_to_update->item, item_to_update);
1774                                 elm_genlist_item_fields_update(item_to_update->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
1775
1776                         }
1777                 }
1778
1779                 /*add timeout strategy.. */
1780                 ret_if(!list_item->userdata);
1781                 setting_main_appdata *ad = list_item->userdata;
1782                 if (ad->wifi_timer) {
1783                         ecore_timer_del(ad->wifi_timer);
1784                         ad->wifi_timer = NULL;
1785                 }
1786                 ad->wifi_timer = ecore_timer_add(5.0, (Ecore_Task_Cb) __wifi_timeout, list_item);
1787         }
1788 }
1789
1790 static Eina_Bool __bt_timeout(void *data)
1791 {
1792         /*SETTING_TRACE_BEGIN; */
1793         retvm_if(!data, ECORE_CALLBACK_CANCEL, "Invalid argument: data is NULL");
1794         int status, err;
1795         setting_get_bool_slp_key(INT_SLP_SETTING_BT_STATUS, &status, &err);
1796         SETTING_TRACE("value:%d", status);
1797
1798         setting_main_appdata *ad = data;
1799         Setting_GenGroupItem_Data *item_to_update;
1800         int i;
1801         for (i = VIEW_All_List; i < VIEW_Max; i++) {
1802                 item_to_update = ad->gl_data_item[i][GL_BT];
1803                 SETTING_TRACE("[%d]item_to_update:%p", i, item_to_update);
1804                 if (item_to_update) {
1805                         item_to_update->chk_status = status;
1806                         item_to_update->swallow_type = SWALLOW_Type_1ICON_1RADIO;
1807                         elm_object_item_data_set(item_to_update->item, item_to_update);
1808                         /*elm_genlist_item_fields_update(item_to_update->item, "*", ELM_GENLIST_ITEM_FIELD_STATE); */
1809                         elm_genlist_item_update(item_to_update->item);
1810                 }
1811         }
1812
1813
1814         ad->bt_timer = NULL;
1815         return ECORE_CALLBACK_CANCEL;
1816 }
1817
1818 void __alternate_bt_mode(Setting_GenGroupItem_Data *list_item, Evas_Object *check)
1819 {
1820         /*SETTING_TRACE_BEGIN; */
1821         int ret;
1822         Eina_Bool status =  elm_check_state_get(check);
1823         SETTING_TRACE("bt mode status : %d", status);
1824
1825         bt_adapter_state_e value;
1826         ret = bt_initialize();
1827         if (bt_adapter_get_state(&value) != BT_ERROR_NONE) {
1828                 SETTING_TRACE_ERROR("bt_adapter_get_state() failed ");
1829                 return;
1830         }
1831
1832         setting_main_appdata *ad = g_main_ad;
1833
1834         if (status == value) {
1835                 SETTING_TRACE("status == value");
1836                 int i;
1837                 for (i = VIEW_All_List; i < VIEW_Max; i++) {
1838                         setting_force_update_gl_item_chk_status(ad->gl_data_item[i][GL_BT], value);
1839                 }
1840                 return;
1841         }
1842         do {
1843                 /*add timeout strategy.. */
1844                 Setting_GenGroupItem_Data *item_to_update;
1845                 int i;
1846                 for (i = VIEW_All_List; i < VIEW_Max; i++) {
1847                         item_to_update = ad->gl_data_item[i][GL_BT];
1848                         SETTING_TRACE("[%d]item_to_update:%p", i, item_to_update);
1849                         if (item_to_update) {
1850                                 item_to_update->swallow_type = SWALLOW_Type_1ICON_1PROCESS;
1851                                 elm_object_item_data_set(item_to_update->item, item_to_update);
1852                                 /*elm_genlist_item_update(list_item->item); */
1853                                 elm_genlist_item_fields_update(item_to_update->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
1854                         }
1855                 }
1856                 SETTING_TRACE("1111");
1857                 if (ad->bt_timer) {
1858                         ecore_timer_del(ad->bt_timer);
1859                         ad->bt_timer = NULL;
1860                 }
1861                 ad->bt_timer = ecore_timer_add(5.0, (Ecore_Task_Cb) __bt_timeout, ad);
1862
1863                 if (ret < 0) {
1864                         break;
1865                 }
1866                 status ? (ret = bt_adapter_enable()) : (ret = bt_adapter_disable());
1867                 if (ret < 0) {
1868                         break;
1869                 }
1870                 ret = bt_deinitialize();
1871                 if (ret < 0) {
1872                         break;
1873                 }
1874
1875                 return;
1876         } while (0);
1877
1878         int err;
1879         int val = 0;
1880         setting_get_int_slp_key(INT_SLP_SETTING_BT_STATUS, &val, &err);
1881         setting_force_update_gl_item_chk_status(list_item, val);
1882 }
1883
1884 static Eina_Bool __nfc_timeout(void *data)
1885 {
1886         /*SETTING_TRACE_BEGIN; */
1887         retvm_if(!data, ECORE_CALLBACK_CANCEL, "Invalid argument: data is NULL");
1888         setting_main_appdata *ad = data;
1889         Setting_GenGroupItem_Data *list_item = NULL;
1890         int status, err;
1891         setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_STATUS, &status, &err);
1892         SETTING_TRACE("value:%d", status);
1893
1894
1895         int i;
1896         for (i = VIEW_All_List; i < VIEW_Max; i++) {
1897                 list_item = ad->gl_data_item[i][GL_NFC];
1898                 if (list_item) {
1899                         list_item->chk_status = status;
1900                         list_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
1901                         elm_object_item_data_set(list_item->item, list_item);
1902                         elm_genlist_item_update(list_item->item);
1903                 }
1904                 /* disable sbeam */
1905                 list_item = ad->gl_data_item[i][GL_SBeam];
1906                 setting_genlist_item_disabled_set(list_item, 0);
1907         }
1908
1909
1910         ad->nfc_timer = NULL;
1911         return ECORE_CALLBACK_CANCEL;
1912 }
1913
1914 #if SUPPORT_NFC
1915 static void __nfc_activation_completed_cb(nfc_error_e error, void *data)
1916 {
1917         SETTING_TRACE_BEGIN;
1918         setting_main_appdata *ad = data;
1919         if (error == NFC_ERROR_NONE) {
1920                 Setting_GenGroupItem_Data *list_item;
1921                 int status;
1922                 vconf_get_bool(VCONFKEY_NFC_STATE, &status);
1923                 SETTING_TRACE("value:%d", status);
1924
1925                 int i;
1926                 for (i = VIEW_All_List; i < VIEW_Max; i++) {
1927                         list_item = ad->gl_data_item[i][GL_NFC];
1928                         if (list_item) {
1929                                 list_item->chk_status = status;
1930                                 list_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
1931                                 elm_object_item_data_set(list_item->item, list_item);
1932                                 elm_genlist_item_fields_update(list_item->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
1933                         }
1934                 }
1935
1936
1937                 if (nfc_manager_deinitialize() != NFC_ERROR_NONE) {
1938                         SETTING_TRACE_ERROR("failed on nfc_manager_deinitialize");
1939                 }
1940                 /* error - none */
1941                 ad->nfc_try_activate_running = EINA_FALSE;
1942                 /*SETTING_TRACE("nfc_try_activate_running - FALSE"); */
1943
1944                 Evas_Object *old_list = elm_object_part_content_get(ad->ly_topview, "content");
1945                 if (old_list == ad->search_genlist) {
1946                         SETTING_TRACE("Already be in search mode");
1947                         elm_genlist_realized_items_update(ad->search_genlist);
1948                 }
1949
1950                 /* enable sbeam */
1951                 Setting_GenGroupItem_Data *item_to_update;
1952                 for (i = VIEW_All_List; i < VIEW_Max; i++) {
1953                         item_to_update = ad->gl_data_item[i][GL_SBeam];
1954                         setting_genlist_item_disabled_set(item_to_update, 0);
1955                 }
1956         }
1957
1958 }
1959
1960 void setting_alternate_nfc_mode(Setting_GenGroupItem_Data *list_item, Eina_Bool status)
1961 {
1962         SETTING_TRACE_BEGIN;
1963         setting_main_appdata *ad = g_main_ad;
1964         int ret = 0;
1965         SETTING_TRACE(".......nfc mode status : %d", status);
1966         SETTING_TRACE("nfc_manager_is_activated:%d", nfc_manager_is_activated());
1967
1968         if (status == nfc_manager_is_activated()) {
1969                 return;
1970         }
1971
1972         ad->nfc_try_activate_running = EINA_TRUE;
1973         /*SETTING_TRACE("nfc_try_activate_running - TRUE"); */
1974
1975         /* disable sbeam */
1976         Setting_GenGroupItem_Data *item_to_update;
1977         int i;
1978         /* disable sbeam */
1979         for (i = VIEW_All_List; i < VIEW_Max; i++) {
1980                 item_to_update = ad->gl_data_item[i][GL_SBeam];
1981                 setting_genlist_item_disabled_set(item_to_update, 1);
1982         }
1983
1984         ret = nfc_manager_initialize(NULL, NULL);
1985         if (ret != NFC_ERROR_NONE) {
1986                 /*init error */
1987                 SETTING_TRACE_ERROR("failed on nfc_manager_initialize");
1988                 goto error_handle;
1989         }
1990         ret = nfc_manager_set_activation(status, __nfc_activation_completed_cb, ad);
1991         if (ret != NFC_ERROR_NONE) {
1992                 /*active error */
1993                 SETTING_TRACE_ERROR("failed on nfc_manager_set_activation");
1994                 goto error_handle;
1995         }
1996
1997         for (i = 0; i < VIEW_Max; i++) {
1998                 item_to_update = ad->gl_data_item[i][GL_NFC];
1999                 if (item_to_update) {
2000                         item_to_update->swallow_type = SWALLOW_Type_1ICON_1PROCESS;
2001                         elm_object_item_data_set(item_to_update->item, item_to_update);
2002                         elm_genlist_item_fields_update(item_to_update->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
2003
2004                 }
2005         }
2006         /*add timeout strategy.. */
2007         if (ad->nfc_timer) {
2008                 ecore_timer_del(ad->nfc_timer);
2009                 ad->nfc_timer = NULL;
2010         }
2011         ad->nfc_timer = ecore_timer_add(5.0, (Ecore_Task_Cb) __nfc_timeout, ad);
2012         return;
2013
2014 error_handle:
2015         ad->nfc_try_activate_running = EINA_TRUE;
2016         int state, err;
2017         setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_STATUS, &state, &err);
2018         SETTING_TRACE("value:%d", state);
2019         for (i = VIEW_All_List; i < VIEW_Max; i++) {
2020                 /* disable sbeam */
2021                 item_to_update = ad->gl_data_item[i][GL_SBeam];
2022                 setting_genlist_item_disabled_set(item_to_update, 0);
2023
2024                 item_to_update = ad->gl_data_item[i][GL_NFC];
2025                 if (item_to_update) {
2026                         item_to_update->chk_status = state;
2027                         item_to_update->swallow_type = SWALLOW_Type_1ICON_1RADIO;
2028                         elm_object_item_data_set(item_to_update->item, item_to_update);
2029                         elm_genlist_item_update(item_to_update->item);
2030                 }
2031         }
2032 }
2033
2034 static void __nfc_activation_completed_cb_when_enbale_sbeam(nfc_error_e error, void *data)
2035 {
2036         SETTING_TRACE_BEGIN;
2037         setting_main_appdata *ad = g_main_ad;
2038         int ret;
2039         if (error == NFC_ERROR_NONE) {
2040                 Setting_GenGroupItem_Data *list_item;
2041                 int status;
2042                 vconf_get_bool(VCONFKEY_NFC_STATE, &status);
2043                 SETTING_TRACE("value:%d", status);
2044
2045
2046                 Evas_Object *old_list = elm_object_part_content_get(ad->ly_topview, "content");
2047                 if (old_list == ad->search_genlist) {
2048                         SETTING_TRACE("Already be in search mode");
2049                         elm_genlist_realized_items_update(ad->search_genlist);
2050                 }
2051
2052
2053                 ret = nfc_manager_deinitialize();
2054                 if (ret < 0) {
2055                         vconf_get_bool(VCONFKEY_NFC_STATE, &status);
2056                         SETTING_TRACE_DEBUG("nfc status : %d", status);
2057                         if (!status) {
2058                                 vconf_set_bool(VCONFKEY_NFC_SBEAM, !status);
2059                         }
2060                 }
2061                 int i;
2062                 for (i = VIEW_All_List; i < VIEW_Max; i++) {
2063                         list_item = ad->gl_data_item[i][GL_NFC];
2064                         if (list_item) {
2065                                 list_item->chk_status = status;
2066                                 list_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
2067                                 elm_object_item_data_set(list_item->item, list_item);
2068                                 elm_genlist_item_fields_update(list_item->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
2069                         }
2070                         /* enable sbeam */
2071                         setting_genlist_item_disabled_set(list_item, 0);
2072                 }
2073         } else {
2074                 SETTING_TRACE("error code %d", error);
2075         }
2076
2077 }
2078
2079 void setting_alternate_sbeam_mode(Setting_GenGroupItem_Data *list_item, Eina_Bool status)
2080 {
2081         /*SETTING_TRACE_BEGIN; */
2082         setting_main_appdata *ad = g_main_ad;
2083         /*Eina_Bool status =  elm_check_state_get(check); */
2084         SETTING_TRACE("wifi mode status : %d", status);
2085
2086         vconf_set_bool(VCONFKEY_NFC_SBEAM, status);
2087
2088         if (status) {
2089                 int nfc_status = 0;
2090                 vconf_get_bool(VCONFKEY_NFC_STATE, &nfc_status);
2091                 if (!nfc_status) {
2092                         bool is_nfc_exist = FALSE;
2093                         Setting_GenGroupItem_Data *item_to_update;
2094                         int i;
2095                         for (i = VIEW_All_List; i < VIEW_Max; i++) {
2096                                 item_to_update = ad->gl_data_item[i][GL_NFC];
2097                                 if (!item_to_update) continue;
2098                                 setting_genlist_item_disabled_set(item_to_update, 1);
2099
2100                                 is_nfc_exist = TRUE;
2101                         }
2102                         if (is_nfc_exist) {
2103                                 /*try to open nfc */
2104                                 int ret;
2105                                 ret = nfc_manager_initialize(NULL, NULL);
2106                                 if (ret < 0) {
2107                                         vconf_get_bool(VCONFKEY_NFC_STATE, &nfc_status);
2108                                         SETTING_TRACE_DEBUG("nfc status : %d", nfc_status);
2109                                         if (!nfc_status) {
2110                                                 vconf_set_bool(VCONFKEY_NFC_SBEAM, !status);
2111                                         }
2112                                 }
2113                                 setting_retm_if(ret < 0, "*** [ERR] nfc_manager_initialize() ***");
2114
2115                                 ret = nfc_manager_set_activation(!nfc_status, __nfc_activation_completed_cb_when_enbale_sbeam, ad);
2116                                 if (ret < 0) {
2117                                         vconf_get_bool(VCONFKEY_NFC_STATE, &nfc_status);
2118                                         SETTING_TRACE_DEBUG("nfc status : %d", nfc_status);
2119                                         if (!nfc_status) {
2120                                                 vconf_set_bool(VCONFKEY_NFC_SBEAM, !status);
2121                                         }
2122                                 }
2123                                 setting_retm_if(ret < 0, "*** [ERR] nfc_manager_set_activation() ***");
2124
2125                                 for (i = VIEW_All_List; i < VIEW_Max; i++) {
2126                                         item_to_update = ad->gl_data_item[i][GL_NFC];
2127                                         if (item_to_update && item_to_update->item) {
2128                                                 item_to_update->swallow_type = SWALLOW_Type_1ICON_1PROCESS;
2129                                                 elm_object_item_data_set(item_to_update->item, item_to_update);
2130                                                 elm_genlist_item_fields_update(item_to_update->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
2131                                         }
2132                                 }
2133                                 /*add timeout strategy.. */
2134                                 if (ad->nfc_timer) {
2135                                         ecore_timer_del(ad->nfc_timer);
2136                                         ad->nfc_timer = NULL;
2137                                 }
2138                                 ad->nfc_timer = ecore_timer_add(5.0, (Ecore_Task_Cb) __nfc_timeout, ad);
2139
2140                         }
2141
2142                 }
2143         }
2144 }
2145 #endif
2146
2147 void setting_main_click_list_network_ug_cb(void *data, Evas_Object *obj, void *event_info)
2148 {
2149         SETTING_TRACE_BEGIN;
2150         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2151         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2152
2153         elm_genlist_item_selected_set(item, EINA_FALSE);
2154
2155         if (g_main_ad->isInUGMode && g_main_ad->ug) {
2156                 SETTING_TRACE
2157                 ("[ad->ug non-NULL]skip genlist click event!!");
2158
2159                 /*SETTING_TRACE_END; */
2160                 return;
2161         }
2162
2163         int flight_mode = 0;
2164         vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_mode);
2165         if (flight_mode) {
2166                 setting_create_simple_popup(NULL, g_main_ad->win_main,
2167                                             NULL, "IDS_IM_POP_THIS_FEATURE_IS_NOT_AVAILABLE_WHILE_FLIGHT_MODE_IS_ON");
2168                 return;
2169         }
2170
2171         setting_main_appdata *ad = g_main_ad;
2172         setting_main_click_list_item_reset_data(ad, obj);
2173
2174         int err = 0;
2175         int value;
2176         setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err);
2177         SETTING_TRACE("value:%d", value);
2178         switch (value) {
2179                 case VCONFKEY_TELEPHONY_SIM_INSERTED: {
2180                                 struct ug_cbs *cbs =
2181                                     (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
2182                                 setting_retm_if(!cbs, "calloc failed");
2183                                 cbs->layout_cb = setting_main_layout_ug_cb;
2184                                 cbs->result_cb = setting_main_result_ug_cb;
2185                                 cbs->destroy_cb = setting_main_destroy_ug_cb;
2186                                 cbs->priv = (void *)ad;
2187                                 setting_main_click_list_item_ug_cb(ad, obj,
2188                                                                    "setting-network-efl",
2189                                                                    NULL, cbs);
2190                                 FREE(cbs);
2191                                 break;
2192                         }
2193                 case VCONFKEY_TELEPHONY_SIM_NOT_PRESENT:
2194                         setting_create_simple_popup(NULL, ad->win_main,
2195                                                     NULL, "IDS_ST_POP_INSERT_SIM_CARD_TO_ACCESS_NETWORK_SERVICES");
2196                         SETTING_TRACE("%s*** [ERR] No SIM. sim_slot_type=%d ***%s",
2197                                       SETTING_FONT_RED, value, SETTING_FONT_BLACK);
2198                         return;
2199                         break;
2200                 case VCONFKEY_TELEPHONY_SIM_CARD_ERROR:
2201                 case VCONFKEY_TELEPHONY_SIM_UNKNOWN:
2202                         setting_create_simple_popup(NULL, ad->win_main,
2203                                                     NULL, "IDS_ST_POP_INSERT_SIM_CARD_TO_ACCESS_NETWORK_SERVICES");
2204                         SETTING_TRACE("%s*** [ERR] Invalid SIM. sim_slot_type=%d ***%s",
2205                                       SETTING_FONT_RED, value, SETTING_FONT_BLACK);
2206                         return;
2207                         break;
2208                 default:
2209                         break;
2210         }
2211
2212 }
2213
2214
2215 void setting_main_tapi_event_cb(TapiHandle *handle, int result, void *data, void *user_data)
2216 {
2217         SETTING_TRACE_BEGIN;
2218         ret_if(!user_data);
2219         setting_main_appdata *ad = user_data;
2220         ad->b_fm_requesting = FALSE;
2221         SETTING_TRACE("result:%d", result);
2222
2223         int err = 0;
2224         switch (result) {
2225                 case TAPI_POWER_FLIGHT_MODE_RESP_ON:
2226
2227                         setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE,
2228                                                  SETTING_ON_OFF_BTN_ON, &err);
2229
2230                         /*If Setting has validate operation (fm_waiting_op == FM_LEAVE) to process, process it. */
2231                         /*Otherwise, do nothing */
2232                         if (FM_LEAVE == ad->fm_waiting_op) {
2233                                 /*Send the latest operation */
2234                                 ad->fm_waiting_op = FM_INVALID;
2235                                 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE, setting_main_tapi_event_cb, ad);
2236                                 setting_retm_if(err != TAPI_API_SUCCESS,
2237                                                 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
2238
2239                                 /*sucessfully sent, */
2240                                 ad->b_fm_requesting = TRUE;
2241
2242                         }
2243                         break;
2244
2245                 case TAPI_POWER_FLIGHT_MODE_RESP_OFF:
2246
2247                         setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE,
2248                                                  SETTING_ON_OFF_BTN_OFF, &err);
2249
2250                         /*If Setting has validate operation (here, fm_waiting_op == FM_ENTER) to process,process it. */
2251                         /*Otherwise, do nothing */
2252                         if (FM_ENTER == ad->fm_waiting_op) {
2253                                 /*Send the latest operation */
2254                                 ad->fm_waiting_op = FM_INVALID;
2255                                 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER, setting_main_tapi_event_cb, ad);
2256                                 setting_retm_if(err != TAPI_API_SUCCESS,
2257                                                 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
2258
2259                                 /*sucessfully sent, */
2260                                 ad->b_fm_requesting = TRUE;
2261                         }
2262
2263                         break;
2264
2265                 case TAPI_POWER_FLIGHT_MODE_RESP_FAIL:
2266                         /*Setting has a validate operation to process, Send the operation request */
2267                         if (FM_ENTER == ad->fm_waiting_op) {
2268                                 ad->fm_waiting_op = FM_INVALID;
2269                                 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER, setting_main_tapi_event_cb, ad);
2270
2271                                 setting_retm_if(err != TAPI_API_SUCCESS,
2272                                                 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
2273                                 ad->b_fm_requesting = TRUE;
2274                         } else if (FM_LEAVE == ad->fm_waiting_op) {
2275                                 ad->fm_waiting_op = FM_INVALID;
2276                                 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE, setting_main_tapi_event_cb, ad);
2277
2278                                 setting_retm_if(err != TAPI_API_SUCCESS,
2279                                                 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
2280                                 ad->b_fm_requesting = TRUE;
2281                         } else { /*Current requset is the last one, Setting needs to notify user */
2282                                 setting_create_popup_without_btn(ad, ad->win_main,
2283                                                                  "IDS_COM_POP_ERROR",
2284                                                                  "IDS_ST_POP_UNABLE_TO_TURN_ON_FLIGHT_MODE_VODA",
2285                                                                  NULL, POPUP_INTERVAL,
2286                                                                  FALSE, FALSE);
2287
2288                                 /*It is need to rollback the status, */
2289                                 Setting_GenGroupItem_Data *item_to_update;
2290                                 int i;
2291                                 for (i = VIEW_All_List; i < VIEW_Max; i++) {
2292                                         item_to_update = ad->gl_data_item[i][GL_FlightMode];
2293                                         if (item_to_update) {
2294                                                 setting_update_gl_item_chk_status(item_to_update, !(item_to_update->chk_status));
2295                                         }
2296                                 }
2297
2298                                 return;
2299                         }
2300
2301                         /*sucessfully sent, */
2302                         ad->b_fm_requesting = TRUE;
2303
2304                         break;
2305
2306                 case TAPI_POWER_FLIGHT_MODE_RESP_MAX:
2307                         setting_create_popup_without_btn(ad, ad->win_main,
2308                                                          "IDS_COM_POP_ERROR",
2309                                                          "IDS_COM_POP_UNEXPECTED_ERROR",
2310                                                          NULL, POPUP_INTERVAL, FALSE, FALSE);
2311
2312                         /*It is need to rollback the status, */
2313                         Setting_GenGroupItem_Data *item_to_update;
2314                         int i;
2315                         for (i = VIEW_All_List; i < VIEW_Max; i++) {
2316                                 item_to_update = ad->gl_data_item[i][GL_FlightMode];
2317                                 if (item_to_update) {
2318                                         setting_update_gl_item_chk_status(item_to_update, !(item_to_update->chk_status));
2319                                 }
2320                         }
2321                         break;
2322                 default:
2323                         /* do nothing */
2324                         break;
2325         }
2326         return;
2327 }
2328
2329 void setting_main_alternate_flight_mode(int status)
2330 {
2331         SETTING_TRACE_BEGIN;
2332         setting_main_appdata *ad = g_main_ad;
2333         int ret;
2334         /*Check whether some requestion is processing by TAPI */
2335         if (ad->b_fm_requesting) {
2336                 /*Do nothing, just mark the lastest operation.. */
2337                 SETTING_TRACE("Some requestion is processing by TAPI, wait to process");
2338                 ad->fm_waiting_op = status ? FM_ENTER : FM_LEAVE;
2339                 return;
2340         }
2341
2342         /*otherwise, invalid waiting operation and send requsetion to TAPI: */
2343         ad->fm_waiting_op = FM_INVALID;
2344         if (status) {
2345                 ret = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER, setting_main_tapi_event_cb, ad);
2346                 setting_retm_if(ret != TAPI_API_SUCCESS,
2347                                 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
2348         } else {
2349                 ret = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE, setting_main_tapi_event_cb, ad);
2350                 setting_retm_if(ret != TAPI_API_SUCCESS,
2351                                 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
2352         }
2353
2354         /*sucessfully sent, */
2355         ad->b_fm_requesting = TRUE;
2356 }
2357
2358
2359 void setting_flightmode_turn_on_resp_cb(void *data, Evas_Object *obj, void *event_info)
2360 {
2361         setting_retm_if(NULL == obj, "NULL == obj");
2362         /*setting_retm_if(NULL == data, "NULL == data"); */
2363         SETTING_TRACE_BEGIN;
2364         int response_type = btn_type(obj);
2365         /*Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data; */
2366
2367         if (g_main_ad) {
2368                 evas_object_del(g_main_ad->popup_flight_mode);
2369                 g_main_ad->popup_flight_mode = NULL;
2370
2371                 if (POPUP_RESPONSE_OK == response_type) {
2372                         setting_update_gl_item_chk_status(g_main_ad->data_flight, EINA_TRUE);
2373                         setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_All_List][GL_FlightMode], EINA_TRUE);
2374                         setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_Common][GL_FlightMode], EINA_TRUE);
2375                         setting_main_alternate_flight_mode(1);
2376
2377                         int firewall_state;
2378                         vconf_get_bool(VCONFKEY_SETAPPL_FIREWALL_KEY, &firewall_state);
2379                         if (firewall_state) {
2380                                 setting_remove_quickpannel_notification("setting-firewall-efl", NOTIFICATION_TYPE_ONGOING, &g_main_ad->noti_id);
2381                         }
2382                 } else if (POPUP_RESPONSE_CANCEL == response_type) {
2383                         setting_update_gl_item_chk_status(g_main_ad->data_flight, EINA_FALSE);
2384                         setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_All_List][GL_FlightMode], EINA_FALSE);
2385                         setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_Common][GL_FlightMode], EINA_FALSE);
2386                 }
2387         }
2388 }
2389
2390 void setting_flightmode_turn_off_resp_cb(void *data, Evas_Object *obj, void *event_info)
2391 {
2392         setting_retm_if(NULL == obj, "NULL == obj");
2393         /*setting_retm_if(NULL == data, "NULL == data"); */
2394         SETTING_TRACE_BEGIN;
2395         int response_type = btn_type(obj);
2396         /*Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data; */
2397
2398         if (g_main_ad) {
2399                 evas_object_del(g_main_ad->popup_flight_mode);
2400                 g_main_ad->popup_flight_mode = NULL;
2401         }
2402
2403         if (POPUP_RESPONSE_OK == response_type) {
2404                 setting_update_gl_item_chk_status(g_main_ad->data_flight, EINA_FALSE);
2405                 setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_All_List][GL_FlightMode], EINA_FALSE);
2406                 setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_Common][GL_FlightMode], EINA_FALSE);
2407                 setting_main_alternate_flight_mode(0);
2408
2409                 int firewall_state;
2410                 vconf_get_bool(VCONFKEY_SETAPPL_FIREWALL_KEY, &firewall_state);
2411                 if (firewall_state) {
2412                         setting_create_quickpannel_notification("setting-firewall-efl",
2413                                                                 NOTIFICATION_TYPE_ONGOING,
2414                                                                 NOTIFICATION_LY_ONGOING_EVENT,
2415                                                                 "IDS_ST_BODY_FIREWALL_ENABLED_ABB",
2416                                                                 "IDS_ST_BODY_CONFIGURE_FIREWALL_SETTINGS",
2417                                                                 IMG_Firewall, &g_main_ad->noti_id);
2418                 }
2419
2420                 /*remove quickpannel warning */
2421                 /*setting_remove_quickpannel_notification("setting-flightmode-efl", NOTIFICATION_TYPE_ONGOING, &g_main_ad->flight_noti_id); */
2422         } else if (POPUP_RESPONSE_CANCEL == response_type) {
2423                 setting_update_gl_item_chk_status(g_main_ad->data_flight, EINA_TRUE);
2424                 setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_All_List][GL_FlightMode], EINA_TRUE);
2425                 setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_Common][GL_FlightMode], EINA_TRUE);
2426         }
2427 }
2428
2429
2430 /**
2431  * genlist touch cb
2432  */
2433 void setting_main_click_Gendial_list_flight_mode_cb(void *data, Evas_Object *obj, void *event_info)
2434 {
2435         /* error check */
2436         setting_retm_if(data == NULL, "Data parameter is NULL");
2437
2438         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2439         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2440         elm_genlist_item_selected_set(item, 0);
2441         Setting_GenGroupItem_Data *list_item =
2442             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2443         int old_status = list_item->chk_status;/*elm_check_state_get(list_item->eo_check); */
2444
2445         if (!g_main_ad) {
2446                 return;
2447         }
2448
2449         /* new status */
2450         if (!old_status) {
2451                 g_main_ad->popup_flight_mode = setting_create_popup_with_btn(list_item,
2452                                                                              g_main_ad->win_main, "IDS_ST_POP_ENABLE_FLIGHT_MODE"/*KeyStr_FlightMode*/,
2453                                                                              ENABLE_FLIGHT_MODE_MSG,
2454                                                                              setting_flightmode_turn_on_resp_cb,
2455                                                                              0, 2, "IDS_ST_BUTTON_ENABLE", "IDS_COM_SK_CANCEL");
2456         } else {
2457                 g_main_ad->popup_flight_mode = setting_create_popup_with_btn(list_item,
2458                                                                              g_main_ad->win_main, KeyStr_FlightMode,
2459                                                                              "IDS_COM_POP_FLIGHT_MODE_WILL_BE_DISABLED",
2460                                                                              setting_flightmode_turn_off_resp_cb,
2461                                                                              0, 2, "IDS_COM_SK_OK", "IDS_COM_SK_CANCEL");
2462         }
2463 }
2464
2465 void setting_main_click_Gendial_list_multi_window_mode_cb(void *data, Evas_Object *obj, void *event_info)
2466 {
2467         SETTING_TRACE_BEGIN;
2468         setting_retm_if(data == NULL, "Data parameter is NULL");
2469
2470         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2471         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2472         elm_genlist_item_selected_set(item, 0);
2473         Setting_GenGroupItem_Data *list_item =
2474             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2475         int new_status = !list_item->chk_status;
2476         setting_update_gl_item_chk_status(list_item, new_status);
2477         int ret = vconf_set_bool(VCONFKEY_QUICKSETTING_MULTIWINDOW_ENABLED, new_status);
2478         if (ret != 0) {
2479                 SETTING_TRACE_ERROR("Set multi window vconf failed.");
2480         }
2481 }
2482
2483 void
2484 setting_main_mouse_up_Gendial_list_sensitivity_cb(void *data, Evas_Object *obj,
2485                                                   void *event_info)
2486 {
2487         /* error check */
2488         setting_retm_if(data == NULL, "Data parameter is NULL");
2489
2490         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2491         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2492         elm_genlist_item_selected_set(item, 0);
2493         Setting_GenGroupItem_Data *list_item =
2494             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2495
2496         if (!safeStrCmp(KeyStr_HighTouchSens, list_item->keyStr)) {
2497                 display_set_enhanced_touch(!list_item->chk_status);
2498
2499                 int status = display_get_enhanced_touch();
2500                 SETTING_TRACE("display_get_enhanced_touch():%d", status);
2501                 if (status >= 0) {
2502                         vconf_set_bool(VCONFKEY_SETAPPL_ENHANCED_TOUCH, (1 == status)); /*sync to vconf */
2503                 } else {
2504                         setting_create_simple_popup(NULL, g_main_ad->win_main,
2505                                                     NULL, "IDS_COM_POP_UNEXPECTED_ERROR");
2506                 }
2507         }
2508
2509 }
2510
2511 void setting_main_high_touch_sens_chk_btn_cb(void *data, Evas_Object *obj, void *event_info)
2512 {
2513         /*SETTING_TRACE_BEGIN; */
2514         /* error check */
2515         retm_if(data == NULL, "Data parameter is NULL");
2516         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
2517
2518         list_item->chk_status = elm_check_state_get(obj);       /*  for genlist update status */
2519         display_set_enhanced_touch(list_item->chk_status);
2520
2521         int status = display_get_enhanced_touch();
2522         SETTING_TRACE("display_get_enhanced_touch():%d", status);
2523         if (status >= 0) {
2524                 vconf_set_bool(VCONFKEY_SETAPPL_ENHANCED_TOUCH, (1 == status)); /*sync to vconf */
2525         } else {
2526                 setting_create_simple_popup(NULL, g_main_ad->win_main,
2527                                             NULL, "IDS_COM_POP_UNEXPECTED_ERROR");
2528                 /*rollback status */
2529                 int i;
2530                 for (i = VIEW_All_List; i < VIEW_Max; i++) {
2531                         setting_force_update_gl_item_chk_status(g_main_ad->gl_data_item[i][GL_TouchSens], !(list_item->chk_status));
2532                 }
2533         }
2534
2535 }
2536
2537 /**
2538  * toggle cb for flight-mode
2539  */
2540 void setting_main_click_list_flight_mode_cb(void *data, Evas_Object *obj,
2541                                             void *event_info)
2542 {
2543         /*SETTING_TRACE_BEGIN; */
2544         retm_if(data == NULL, "Data parameter is NULL");
2545         Setting_GenGroupItem_Data *list_item =
2546             (Setting_GenGroupItem_Data *) data;
2547         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
2548         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2549                       list_item->chk_status);
2550
2551         if (g_main_ad) {
2552                 if (list_item->chk_status) {
2553                         g_main_ad->popup_flight_mode = setting_create_popup_with_btn(list_item,
2554                                         g_main_ad->win_main, "IDS_ST_POP_ENABLE_FLIGHT_MODE"/*KeyStr_FlightMode*/,
2555                                         ENABLE_FLIGHT_MODE_MSG,
2556                                         setting_flightmode_turn_on_resp_cb,
2557                                         0, 2, "IDS_ST_BUTTON_ENABLE", "IDS_COM_SK_CANCEL");
2558                 } else {
2559                         /*setting_main_alternate_flight_mode(list_item->chk_status); */
2560                         g_main_ad->popup_flight_mode = setting_create_popup_with_btn(list_item,
2561                                         g_main_ad->win_main, KeyStr_FlightMode,
2562                                         "IDS_COM_POP_FLIGHT_MODE_WILL_BE_DISABLED",
2563                                         setting_flightmode_turn_off_resp_cb,
2564                                         0, 2, "IDS_COM_SK_OK", "IDS_COM_SK_CANCEL");
2565                 }
2566         }
2567 }
2568
2569 /**
2570  * genlist touch cb for network restriction mode
2571  */
2572 void
2573 setting_main_click_list_net_restriction_mode_cb(void *data, Evas_Object *obj, void *event_info)
2574 {
2575         /* error check */
2576         setting_retm_if(data == NULL, "Data parameter is NULL");
2577         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2578         setting_main_appdata    *ad = g_main_ad;
2579
2580         Elm_Object_Item *item = (Elm_Object_Item *)event_info;
2581         elm_genlist_item_selected_set(item, 0);
2582         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)elm_object_item_data_get(item);
2583         int             old_status = list_item->chk_status;
2584
2585         if (!old_status) {
2586                 /* Off -> On */
2587                 ad->popup_net_restriction_mode = setting_create_popup_with_btn(NULL,
2588                                                                                ad->win_main,
2589                                                                                "IDS_ST_HEADER_NETWORK_RESTRICTION_MODE_ABB_JPN",
2590                                                                                "IDS_QP_POP_IN_NETWORK_RESTRICTION_MODE_YOU_CAN_USE_ALL_YOUR_APPLICATIONS_WITHOUT_CONNECTING_TO_THE_NETWORK_YOU_CAN_ALSO_RECEIVE_CALLS_AND_SMS_MESSAGES_MSG_JPN" ,
2591                                                                                setting_main_net_restriction_mode_turn_on_resp_cb,
2592                                                                                0,       /* timer */
2593                                                                                2,       /* button count */
2594                                                                                "IDS_COM_SK_OK",
2595                                                                                "IDS_COM_SK_CANCEL");
2596         } else {
2597                 /* On -> Off */
2598                 ad->popup_net_restriction_mode = setting_create_popup_with_btn(NULL,
2599                                                                                ad->win_main,
2600                                                                                "IDS_ST_HEADER_NETWORK_RESTRICTION_MODE_ABB_JPN",
2601                                                                                "IDS_QP_POP_NETWORK_RESTRICTION_MODE_WILL_BE_DISABLED_JPN",
2602                                                                                setting_main_net_restriction_mode_turn_off_resp_cb,
2603                                                                                0,       /* timer */
2604                                                                                2,       /* button count */
2605                                                                                "IDS_COM_SK_OK",
2606                                                                                "IDS_COM_SK_CANCEL");
2607         }
2608
2609         return;
2610 }
2611
2612 /**
2613  * check(on/off) cb for network restriction mode
2614  */
2615 void
2616 setting_main_click_list_check_net_restriction_mode_cb(void *data, Evas_Object *obj, void *event_info)
2617 {
2618         retm_if(data == NULL, "Data parameter is NULL");
2619
2620         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data;
2621         setting_main_appdata    *ad = g_main_ad;
2622
2623         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
2624         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr), list_item->chk_status);
2625
2626         if (list_item->chk_status) {
2627                 /* Off -> On */
2628                 ad->popup_net_restriction_mode = setting_create_popup_with_btn(NULL,
2629                                                                                ad->win_main,
2630                                                                                "IDS_ST_HEADER_NETWORK_RESTRICTION_MODE_ABB_JPN",
2631                                                                                "IDS_QP_POP_IN_NETWORK_RESTRICTION_MODE_YOU_CAN_USE_ALL_YOUR_APPLICATIONS_WITHOUT_CONNECTING_TO_THE_NETWORK_YOU_CAN_ALSO_RECEIVE_CALLS_AND_SMS_MESSAGES_MSG_JPN",
2632                                                                                setting_main_net_restriction_mode_turn_on_resp_cb,
2633                                                                                0,       /* timer */
2634                                                                                2,       /* button count */
2635                                                                                "IDS_COM_SK_OK",
2636                                                                                "IDS_COM_SK_CANCEL");
2637         } else {
2638                 /* On -> Off */
2639                 ad->popup_net_restriction_mode = setting_create_popup_with_btn(NULL,
2640                                                                                ad->win_main,
2641                                                                                "IDS_ST_HEADER_NETWORK_RESTRICTION_MODE_ABB_JPN",
2642                                                                                "IDS_QP_POP_NETWORK_RESTRICTION_MODE_WILL_BE_DISABLED_JPN",
2643                                                                                setting_main_net_restriction_mode_turn_off_resp_cb,
2644                                                                                0,       /* timer */
2645                                                                                2,       /* button count */
2646                                                                                "IDS_COM_SK_OK",
2647                                                                                "IDS_COM_SK_CANCEL");
2648         }
2649         return;
2650 }
2651
2652 /**
2653  * turn on popup cb for network restriction mode
2654  */
2655 void
2656 setting_main_net_restriction_mode_turn_on_resp_cb(void *data, Evas_Object *obj, void *event_info)
2657 {
2658         SETTING_TRACE_BEGIN;
2659
2660         /* error check */
2661         setting_retm_if(NULL == obj, "NULL == obj");
2662         int             response_type = btn_type(obj);
2663         setting_main_appdata *ad = g_main_ad;
2664         int             status, err = 0;
2665
2666         if (ad == NULL)
2667                 return;
2668
2669         if (ad->popup_net_restriction_mode) {
2670                 evas_object_del(ad->popup_net_restriction_mode);
2671                 ad->popup_net_restriction_mode = NULL;
2672         }
2673
2674
2675         if (response_type == POPUP_RESPONSE_OK) {
2676                 status = EINA_TRUE;
2677                 setting_set_bool_slp_key(BOOL_SLP_SETTING_NET_RESTRICTION_MODE, SETTING_ON_OFF_BTN_ON, &err);
2678         } else if (response_type == POPUP_RESPONSE_CANCEL) {
2679                 setting_get_bool_slp_key(BOOL_SLP_SETTING_NET_RESTRICTION_MODE, &status, &err);
2680         }
2681
2682         Setting_GenGroupItem_Data *item_to_update;
2683         int i;
2684         for (i = VIEW_All_List; i < VIEW_Max; i++) {
2685                 item_to_update = ad->gl_data_item[i][GL_NetRestriction];
2686                 setting_update_gl_item_chk_status(item_to_update, status);
2687         }
2688
2689         Evas_Object *old_list = elm_object_part_content_get(ad->ly_topview, "content");
2690         if (old_list == ad->search_genlist) {
2691                 SETTING_TRACE("Already be in search mode");
2692                 elm_genlist_realized_items_update(ad->search_genlist);
2693         }
2694
2695         return;
2696 }
2697
2698 /**
2699  * turn off popup cb for network restriction mode
2700  */
2701 void
2702 setting_main_net_restriction_mode_turn_off_resp_cb(void *data, Evas_Object *obj, void *event_info)
2703 {
2704         SETTING_TRACE_BEGIN;
2705
2706         /* error check */
2707         setting_retm_if(NULL == obj, "NULL == obj");
2708
2709         int             response_type = btn_type(obj);
2710         setting_main_appdata *ad = g_main_ad;
2711         int             status, err = 0;
2712
2713         if (ad == NULL)
2714                 return;
2715
2716         if (ad->popup_net_restriction_mode) {
2717                 evas_object_del(ad->popup_net_restriction_mode);
2718                 ad->popup_net_restriction_mode = NULL;
2719         }
2720
2721         if (response_type == POPUP_RESPONSE_OK) {
2722                 status = EINA_FALSE;
2723                 setting_set_bool_slp_key(BOOL_SLP_SETTING_NET_RESTRICTION_MODE, SETTING_ON_OFF_BTN_OFF, &err);
2724                 SETTING_TRACE("BOOL_SLP_SETTING_NET_RESTRICTION_MODE - off");
2725         } else if (response_type == POPUP_RESPONSE_CANCEL) {
2726                 setting_get_bool_slp_key(BOOL_SLP_SETTING_NET_RESTRICTION_MODE, &status, &err);
2727
2728                 SETTING_TRACE("BOOL_SLP_SETTING_NET_RESTRICTION_MODE - update UI by getting vconf");
2729         }
2730         Setting_GenGroupItem_Data *item_to_update;
2731         int i;
2732         for (i = VIEW_All_List; i < VIEW_Max; i++) {
2733                 item_to_update = ad->gl_data_item[i][GL_NetRestriction];
2734                 setting_update_gl_item_chk_status(item_to_update, status);
2735         }
2736
2737         Evas_Object *old_list = elm_object_part_content_get(ad->ly_topview, "content");
2738         if (old_list == ad->search_genlist) {
2739                 SETTING_TRACE("Already be in search mode");
2740                 elm_genlist_realized_items_update(ad->search_genlist);
2741         }
2742
2743         return;
2744 }
2745
2746 /**
2747  * toggle cb
2748  */
2749 void setting_main_click_list_wifi_mode_cb(void *data, Evas_Object *obj,
2750                                           void *event_info)
2751 {
2752         /*SETTING_TRACE_BEGIN; */
2753         retm_if(data == NULL, "Data parameter is NULL");
2754         Setting_GenGroupItem_Data *list_item =
2755             (Setting_GenGroupItem_Data *) data;
2756         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
2757         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2758                       list_item->chk_status);
2759
2760         __alternate_wifi_mode(list_item, obj);
2761 }
2762
2763 void setting_main_click_list_motion_cb(void *data, Evas_Object *obj,
2764                                        void *event_info)
2765 {
2766         /*SETTING_TRACE_BEGIN; */
2767         retm_if(data == NULL, "Data parameter is NULL");
2768         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
2769         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
2770         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2771                       list_item->chk_status);
2772
2773         int err = 0;
2774         int ret = setting_set_bool_slp_key(BOOL_SLP_SETTING_MOTION_ACTIVATION, list_item->chk_status, &err);
2775         if (0 != ret) { /*rollback */
2776                 setting_update_gl_item_chk_status(list_item, !(list_item->chk_status));
2777                 return;
2778         }
2779
2780         /* If motion activation changes to OFF when screen lock type is motion unlock, screen lock type should be set SWIPE automatically */
2781         if (!list_item->chk_status) {
2782                 int screen_lock_type = 0;
2783                 vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &screen_lock_type);
2784                 if (screen_lock_type == SETTING_SCREEN_LOCK_TYPE_MOTION)
2785                         vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE);
2786         }
2787 }
2788
2789 void setting_main_click_list_nearby_devices_cb(void *data, Evas_Object *obj,
2790                                                void *event_info)
2791 {
2792         /*SETTING_TRACE_BEGIN; */
2793         retm_if(data == NULL, "Data parameter is NULL");
2794         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
2795         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
2796         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr), list_item->chk_status);
2797
2798         int chk_status = list_item->chk_status;
2799
2800         if (chk_status) {
2801                 /*to turn on */
2802                 /*app_launcher("setting-allshare-efl|mode:on"); */
2803                 /*rollback first */
2804                 setting_update_gl_item_chk_status(list_item, VCONFKEY_ALLSHARE_DISABLE);
2805
2806                 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
2807                 setting_retm_if(!cbs, "calloc failed");
2808                 cbs->layout_cb = setting_main_layout_ug_cb;
2809                 cbs->result_cb = setting_main_result_ug_cb;
2810                 cbs->destroy_cb = setting_main_destroy_ug_cb;
2811                 cbs->priv = (void *)g_main_ad;
2812
2813                 app_control_h svc = NULL;
2814                 app_control_create(&svc);
2815                 app_control_add_extra_data(svc, "mode", "on");
2816                 setting_main_click_list_item_ug_cb(g_main_ad, obj, "setting-allshare-efl", svc, cbs);
2817                 if (cbs) {
2818                         FREE(cbs);
2819                 }
2820                 cbs = NULL;
2821                 app_control_destroy(svc);
2822         } else {
2823                 /*to turn off */
2824                 int ret = 0;
2825                 ret = vconf_set_int(VCONFKEY_ALLSHARE_STATUS, VCONFKEY_ALLSHARE_DISABLE);
2826                 if (0 != ret) { /*rollback */
2827                         setting_update_gl_item_chk_status(list_item, VCONFKEY_ALLSHARE_ENABLE);
2828                         return;
2829                 }
2830         }
2831 }
2832
2833 /**
2834  * toggle cb
2835  */
2836 void setting_main_click_list_bt_mode_cb(void *data, Evas_Object *obj,
2837                                         void *event_info)
2838 {
2839         retm_if(data == NULL, "Data parameter is NULL");
2840         Setting_GenGroupItem_Data *list_item =
2841             (Setting_GenGroupItem_Data *) data;
2842         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
2843         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2844                       list_item->chk_status);
2845
2846         __alternate_bt_mode(list_item, obj);
2847 }
2848
2849 #if SUPPORT_NFC
2850 /**
2851  * toggle cb
2852  */
2853 void setting_main_click_list_nfc_mode_cb(void *data, Evas_Object *obj,
2854                                          void *event_info)
2855 {
2856         retm_if(data == NULL, "Data parameter is NULL");
2857         Setting_GenGroupItem_Data *list_item =
2858             (Setting_GenGroupItem_Data *) data;
2859         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
2860         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2861                       list_item->chk_status);
2862
2863         Eina_Bool status =  elm_check_state_get(obj);
2864         setting_alternate_nfc_mode(list_item, status);
2865 }
2866
2867 /**
2868  * toggle cb
2869  */
2870 void setting_main_click_list_sbeam_mode_cb(void *data, Evas_Object *obj,
2871                                            void *event_info)
2872 {
2873         retm_if(data == NULL, "Data parameter is NULL");
2874         setting_main_appdata *ad = g_main_ad;
2875         Setting_GenGroupItem_Data *list_item =
2876             (Setting_GenGroupItem_Data *) data;
2877         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
2878         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2879                       list_item->chk_status);
2880
2881         if (ad->nfc_try_activate_running) {
2882                 SETTING_TRACE("CHECK : nfc state update is in progress. DON'T DO ANY MORE !!!!!!!!!!!!!!!!!!!!!!!");
2883                 elm_check_state_set(obj, !list_item->chk_status);
2884                 /* roll back */
2885                 return;
2886         } else {
2887                 SETTING_TRACE("CHECK : nfc state update is NOT in progress. - GO AHEAD !!!");
2888                 Eina_Bool status =  elm_check_state_get(obj);
2889                 setting_alternate_sbeam_mode(list_item, status);
2890         }
2891 }
2892 #endif
2893
2894 void setting_main_display_auto_adjust_chk_btn_cb(void *data, Evas_Object *obj, void *event_info)
2895 {
2896         SETTING_TRACE_BEGIN;
2897         /* error check */
2898         retm_if(data == NULL, "Data parameter is NULL");
2899         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
2900
2901         list_item->chk_status = elm_check_state_get(obj);       /*  for genlist update status */
2902         vconf_set_bool(VCONFKEY_SETAPPL_LCD_AUTO_DISPLAY_ADJUSTMENT, list_item->chk_status);
2903         /*setting_display_set_auto_adjust_tone(list_item->chk_status); //todo:copy it from display */
2904 }
2905
2906 void setting_main_display_auto_rotate_chk_btn_cb(void *data, Evas_Object *obj, void *event_info)
2907 {
2908         SETTING_TRACE_BEGIN;
2909         /* error check */
2910         retm_if(data == NULL, "Data parameter is NULL");
2911         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
2912         setting_main_appdata *ad = g_main_ad;
2913
2914         list_item->chk_status = elm_check_state_get(obj);       /*  for genlist update status */
2915
2916         if (list_item->chk_status == 1) {
2917                 int angle = elm_win_rotation_get(ad->win_main);
2918                 elm_win_rotation_with_resize_set(ad->win_main, angle);
2919         } else {
2920                 elm_win_rotation_with_resize_set(ad->win_main, 0);
2921         }
2922
2923         vconf_set_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, list_item->chk_status);
2924 }
2925
2926
2927 void setting_main_display_battery_chk_btn_cb(void *data, Evas_Object *obj,
2928                                              void *event_info)
2929 {
2930         SETTING_TRACE_BEGIN;
2931         /* error check */
2932         retm_if(data == NULL, "Data parameter is NULL");
2933         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
2934
2935         list_item->chk_status = elm_check_state_get(obj);       /*  for genlist update status */
2936         vconf_set_bool(VCONFKEY_SETAPPL_BATTERY_PERCENTAGE_BOOL, list_item->chk_status);
2937 }
2938
2939 void setting_main_display_list_cb(void *data, Evas_Object *obj, void *event_info)
2940 {
2941         /* error check */
2942         setting_retm_if(data == NULL, "Data parameter is NULL");
2943
2944         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2945         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2946         elm_genlist_item_selected_set(item, 0);
2947         Setting_GenGroupItem_Data *list_item =
2948             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2949
2950         setting_main_appdata *ad = data;
2951
2952         SETTING_TRACE("clicking item[%s]", _(list_item->keyStr));
2953         if (!safeStrCmp(KeyStr_BatteryPercent, list_item->keyStr)) {
2954                 setting_update_gl_item_chk_status(list_item, !list_item->chk_status);
2955                 vconf_set_bool(VCONFKEY_SETAPPL_BATTERY_PERCENTAGE_BOOL, list_item->chk_status);
2956         }
2957 #if SUPPORT_AUTO_ADJUST_SCREEN_TONE
2958         else if (!safeStrCmp(KeyStr_AdjustScreenTone, list_item->keyStr)) {
2959                 setting_update_gl_item_chk_status(list_item, !list_item->chk_status);
2960                 vconf_set_bool(VCONFKEY_SETAPPL_LCD_AUTO_DISPLAY_ADJUSTMENT, list_item->chk_status);
2961
2962         }
2963 #endif
2964         else if (!safeStrCmp(KeyStr_Landscape, list_item->keyStr)) {
2965                 setting_update_gl_item_chk_status(list_item, !list_item->chk_status);
2966                 if (list_item->chk_status == 1) {
2967                         int angle = elm_win_rotation_get(ad->win_main);
2968                         elm_win_rotation_with_resize_set(ad->win_main, angle);
2969                 } else {
2970                         elm_win_rotation_with_resize_set(ad->win_main, 0);
2971                 }
2972
2973                 vconf_set_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, list_item->chk_status);
2974         }
2975 }
2976