update the opensource license file
[apps/core/preloaded/settings.git] / src / setting.c
old mode 100644 (file)
new mode 100755 (executable)
index 3e36bce..797841e
 /*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.0 (the "License");
-  * you may not use this file except in compliance with the License.
-  * You may obtain a copy of the License at
-  *
-  *     http://www.tizenopensource.org/license
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
+ * setting
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <setting.h>
+#include <app.h>
 
-#include <aul.h>
-#include <Ecore_X.h>
 #include <appcore-common.h>
-#include <ewk_main.h>
-
-#include "setting.h"
+#include <Ecore_X.h>
+#include <sensor.h>
+#include <aul.h>
+#include "setting-common-plugin.h"
+#include "setting-main.h"
+#include <elm_object.h>
+#include <appsvc.h>
+#include <EWebKit2.h>
+#include <nfc.h>
+#include <signal.h>
 
 extern void setting_update_gl_item(void* data);
 
-static int vconf_key_change_event_listen(struct _vconf_key_change_event* me,void* data);
-static int vconf_key_change_event_unlisten(struct _vconf_key_change_event* me,void* data);
+#define KEY_END "XF86Stop"
+#define SUPPORT_UG_MESSAGE
+
+int g_geometry_x, g_geometry_y, g_geometry_w, g_geometry_h;
+
+void termination_handler(int signum)
+{
+       SETTING_TRACE_BEGIN;
+       SETTING_TRACE(">>>>>>>>>>> SIGTERM >>>>>>>>>>>>>>> SETTING");
+
+       elm_exit();
+}
+
+static void __main_motion_sensor_cb( unsigned long long timestamp, void *data)
+{
+       /* The code 'return ;' will be deleted after the defect of elm_genlist_item_top_show() is fixed */
+
+       setting_retm_if(NULL == data, "NULL == data");
+       setting_main_appdata *ad = (setting_main_appdata *) data;
+
+       SETTING_TRACE(">>>>>>>Double tap event detected");
+       //If it is in UG mode, Setting just send the event to the loaded UG
+
+       if (ad->isInUGMode && ad->ug) {
+       #ifdef SUPPORT_UG_MESSAGE
+               SETTING_TRACE(">>>>>>>Send event to UG");
+
+               service_h svc;
+               if(service_create(&svc))
+                       return;
+
+               service_add_extra_data(svc, "Detected", "Double_tap_event");
+               if (ug_send_message(ad->ug, svc) != 0) {
+                       SETTING_TRACE_ERROR("call ug_send_message fail");
+               }
+
+               service_destroy(svc);
+       #else
+               //Methord: instead of send message to UG and its sub-UGs,
+               //1.To get the layout of UG ,and then
+               //2.To get the naviframe of the layout, and then,
+               //3.To get the toppest item  of naviframe, and then
+               //4.To get the content of naviframe toppest item,that is content
+               //5.content ia mainly a genlist,but it is not fixed,it maybe a conformant or another layout
+               //  if it is a genlist,directly show its top item
+               //  if it is a conformant or another layout,to get all of its sub-objects,then ask turnly
+               //     whether it is a genlist,if it is(some sub-object), topply show it.
+               //That's all
+               Evas_Object *layout = (Evas_Object *)ug_get_layout(ad->ug);
+               if (layout) {
+                       Evas_Object *genlist = NULL;
+                       Evas_Object *navi_bar = elm_object_part_content_get(layout, "elm.swallow.content");
+                       Elm_Object_Item *item = elm_naviframe_top_item_get(navi_bar);
+                       Evas_Object *content = elm_object_item_content_get(item);
+                       //SETTING_TRACE("content:%p", content);
+
+                       const char *type = elm_object_widget_type_get(content);
+                       //SETTING_TRACE("content type:%s", type);
+                       if (0 == safeStrCmp(type, "genlist")) {
+                               genlist = content;
+                       } else if (NULL != type) {//type="layout","conformant" etc..
+                               //layout
+                               //genlist = elm_object_part_content_get(content, "elm.swallow.contents");
+                               const Eina_List *subobjs = elm_widget_sub_object_list_get(content);
+                               ret_if(!subobjs);
+                               Evas_Object *subobj;
+                               const Eina_List *l;
+
+                               //just only search the first objects level
+                               EINA_LIST_FOREACH(subobjs, l, subobj) {
+                                       if (!subobj) continue;
+                                       type = elm_object_widget_type_get(subobj);
+                                       if (0 == safeStrCmp(type, "genlist")) {
+                                               genlist = subobj;
+                                               Elm_Object_Item *first_item = elm_genlist_first_item_get(genlist);
+                                               if (first_item) {
+                                                       elm_genlist_item_show(first_item, ELM_GENLIST_ITEM_SCROLLTO_TOP);
+                                               }
+                                       }
+                               }
+                               return;//to return,because for this case,we need special process.
+                       } else {
+                               //keep genlist to be NULL.
+                       }
+                       if (genlist && 0 == safeStrCmp(elm_object_widget_type_get(genlist), "genlist")) {
+                               SETTING_TRACE("Get the genlist:%p", genlist);
+                               Elm_Object_Item *first_item = elm_genlist_first_item_get(genlist);
+                               if (first_item) {
+                                       elm_genlist_item_show(first_item, ELM_GENLIST_ITEM_SCROLLTO_TOP);
+                               }
+                       }
+               }
+       #endif
+       } else {
+               setting_go_to_navibar_list_top(ad->navibar_main);
+       }
+}
+
+/**
+* The event process when hard key is pressed.
+*/
+#if DISABLED_CODE
+static int setting_main_keydown_cb(void *data, int type, void *event)
+{
+       SETTING_TRACE_BEGIN;
+
+       static int s_count = 0;
+       Ecore_Event_Key *ev = event;
+#if APPLIED_BACK_KEY_UG
+       if (!safeStrCmp(ev->keyname, KEY_END)) {
+               Evas_Object *popup = get_toppest_popup_window(ad->evas);
+               if (popup) {
+                       /* "progressbar"ÀàÐ͵Äpopup, ²»×÷´¦Àí */
+                       Evas_Object *content = elm_object_content_get(popup);
+                       const char *type = elm_widget_type_get(content);
+                       if (type && !safeStrCmp(type, "progressbar")) {
+                               SETTING_TRACE_DEBUG ("Found popup[%p], but it respresent a progress bar, so skip it.", popup);
+                       } else {
+                               evas_object_smart_callback_call(popup, "timeout", NULL);
+                       }
+               }
+               return;
+       }
+
+       if (ad->isInUGMode) {   /* have some ug being loaded, it was reset to be FALSE in  setting_main_destroy_ug_cb() */
+               SETTING_TRACE("Send UG_KEY_EVENT_END to ug");
+               ug_send_key_event(UG_KEY_EVENT_END);
+       } else {
+               if (elm_naviframe_top_item_get(ad->navibar_main)
+                   == elm_naviframe_bottom_item_get(ad->navibar_main)) {
+                       SETTING_TRACE("To exit Setting App");
+                       elm_exit();
+               } else {
+                       SETTING_TRACE("To pre-view of Setting App");
+                       elm_naviframe_item_pop(ad->navibar_main);
+               }
+       }
+}
+#else
+       if (ev && !safeStrCmp(ev->keyname, KEY_END)) {
+               /* do nothing except exit */
+               SETTING_TRACE("before --- elm_exit ");
+
+               elm_exit();
+               s_count = s_count + 1;
+               SETTING_TRACE("after --- elm_exit = %d ", s_count);
+       }
+#endif
+       SETTING_TRACE_END;
+       return 1;
+}
+#endif
+
+#if LOW_BATTERY_DO_NOTHING
+
+/*  in case of low battery, don't terminate itself.*/
+
+/**
+* The event process when battery becomes low.
+*/
+static void setting_main_low_battery_cb(void *data)
+{
+       SETTING_TRACE_BEGIN;
+       setting_main_appdata *ad = data;
+
+       if (ad->ug)
+               ug_send_event(UG_EVENT_LOW_BATTERY);
+}
+#endif
+
+#if SUPPORT_APP_ROATION
+
+/**
+* To active rotation effect in Setting App
+*/
+static void setting_main_rotate(app_device_orientation_e m, void *data)
+{
+       SETTING_TRACE_BEGIN;
+       setting_main_appdata *ad = data;
+
+       if (ad == NULL || ad->win_main == NULL)
+               return;
+
+#if 0
+                               int value = 0;
+                               vconf_get_bool
+                                   (VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, &value);
+                               // true  : aoto rotation OFF
+                               // false : auto rotation ON
+                               value = !value;
+#else
+       //int hold_flag = 0;
+       //vconf_get_bool (VCONFKEY_SETAPPL_ROTATE_HOLD_BOOL, &hold_flag);
+       //SETTING_TRACE("hold_flag:%d", hold_flag);
+       //if (hold_flag)
+       //{
+               //do nothing..
+       //      return;
+       //}
+
+       int value = 0;
+       vconf_get_bool (VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &value);
+
+       if (value == 0)
+               m = 0;
+
+       elm_win_rotation_with_resize_set(ad->win_main, m);
+
+       /////Send the rotation event to UGs..
+       enum ug_event event = UG_EVENT_ROTATE_PORTRAIT;
+       switch (m) {
+       case APP_DEVICE_ORIENTATION_0:
+               event = UG_EVENT_ROTATE_PORTRAIT;
+               break;
+       case APP_DEVICE_ORIENTATION_180:
+               event = UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN;
+               break;
+       case APP_DEVICE_ORIENTATION_90:
+               event = UG_EVENT_ROTATE_LANDSCAPE;
+               break;
+       case APP_DEVICE_ORIENTATION_270:
+               event = UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN;
+               break;
+       default:
+               return;
+       }
+       ug_send_event(event);
+       //elm_win_rotation_get
+#endif
+
+}
+static void _rot_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       SETTING_TRACE_BEGIN;
+       setting_main_appdata *ad = (setting_main_appdata *)data;
+       if (ad == NULL || ad->win_main == NULL )
+               return;
+       int change_ang = elm_win_rotation_get(ad->win_main);
+       SETTING_TRACE("....change_ang:%d",change_ang);
+       SETTING_TRACE("current_rotation:%d",ad->current_rotation);
+       //Send the rotation event to UGs..
+       enum ug_event event = UG_EVENT_ROTATE_PORTRAIT;
+       switch (change_ang) {
+       case APP_DEVICE_ORIENTATION_0:
+               event = UG_EVENT_ROTATE_PORTRAIT;
+               break;
+       case APP_DEVICE_ORIENTATION_180:
+               event = UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN;
+               break;
+       case APP_DEVICE_ORIENTATION_270:
+               event = UG_EVENT_ROTATE_LANDSCAPE;
+               break;
+       case APP_DEVICE_ORIENTATION_90:
+               event = UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN;
+               break;
+       default:
+               return;
+       }
+       SETTING_TRACE("diff:%d",elm_win_rotation_get(ad->win_main) - ad->current_rotation);
+
+       if (change_ang != ad->current_rotation)
+       {
+               ug_send_event(event);
+               ad->current_rotation = change_ang;
+       }
+}
+#endif
 
 /**
 * The event process when region is changes.
 */
-static int setting_main_region_changed_cb(void *data)
+static void setting_main_region_changed_cb(void *data)
 {
        setting_main_appdata *ad = data;
 
        if (ad->ug)
                ug_send_event(UG_EVENT_REGION_CHANGE);
-
-       return 0;
 }
 
 /**
@@ -47,6 +318,16 @@ static void setting_main_del_win(void *data, Evas_Object *obj, void *event)
        elm_exit();
 }
 
+void profile_changed_cb(void *data, Evas_Object * obj, void *event)
+{
+       const char *profile = elm_config_profile_get();
+
+       if (strcmp(profile, "desktop") == 0)
+               elm_win_indicator_mode_set (obj, ELM_WIN_INDICATOR_HIDE);
+       else
+               elm_win_indicator_mode_set (obj, ELM_WIN_INDICATOR_SHOW);
+}
+
 /**
 * To create a win object, the win is shared between the App and all its UGs
 */
@@ -56,12 +337,13 @@ static Evas_Object *setting_main_create_win(const char *name)
        Evas_Object *eo;
        int w, h;
 
-       eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+       //eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+       eo = elm_win_util_standard_add(name, name);
        if (eo) {
                elm_win_title_set(eo, name);
-               elm_win_borderless_set(eo, EINA_TRUE);
-               evas_object_smart_callback_add(eo, "delete,request",
-                                              setting_main_del_win, NULL);
+               evas_object_smart_callback_add(eo, "delete,request", setting_main_del_win, NULL);
+               evas_object_smart_callback_add(eo, "profile,changed", profile_changed_cb, NULL);
+               //elm_win_conformant_set(eo, EINA_TRUE);
                ecore_x_window_size_get(ecore_x_window_root_first_get(),
                                        &w, &h);
                evas_object_resize(eo, w, h);
@@ -73,59 +355,107 @@ static Evas_Object *setting_main_create_win(const char *name)
 /**
 * exceptional process, reset the env vars by Setting vconf VCONFKEY_LANGSET
 */
-static int setting_main_lang_changed_cb(void *data)
+static void setting_main_lang_changed_cb(void *data)
 {
        SETTING_TRACE_BEGIN;
        setting_main_appdata *ad = data;
 
-       int r = appcore_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR);
-       if(r == -1) {
-               SETTING_TRACE_ERROR("call appcore_set_i18n failed");
+       char* str = NULL;
+       if (ad->data_wifi) {
+           str = (char *)get_pa_Wi_Fi_on_off_str();
+               if ( ! str) str = g_strdup("err");
+           ad->data_wifi->sub_desc = str;
        }
-
-       if (ad->data_wifi)
-       {
-           ad->data_wifi->sub_desc = (char *)g_strdup(get_pa_Wi_Fi_on_off_str());
+       if (ad->data_bt) {
+           str = (char *)g_strdup(get_BT_on_off_str());
+               if ( ! str) str = g_strdup("err");
+           ad->data_bt->sub_desc = str;
        }
-       if (ad->data_bt)
-       {
-           ad->data_bt->sub_desc = (char *)g_strdup(get_BT_on_off_str());
+       if (ad->data_nfc) {
+           str = (char *)g_strdup(get_NFC_on_off_str());
+               if ( ! str) str = g_strdup("err");
+           ad->data_nfc->sub_desc = str;
        }
-       if (ad->data_mobileApp)
-       {
-           ad->data_mobileApp->sub_desc = (char *)g_strdup(get_Mobile_AP_on_off_str());
+       if (ad->data_bright) {
+               str = (char*)g_strdup(get_brightness_mode_str());
+               if ( ! str) str = g_strdup("err");
+               ad->data_bright->sub_desc = str;
        }
-       if (ad->data_usbcon)
-       {
-           ad->data_usbcon->sub_desc = get_pa_usb_connect_mode_str();
+
+       if (ad->data_moreConnect) {
+               char sub_text[MAX_COMMON_BUFFER_LEN] = {0, };
+               int idx = 0;
+               while (idx < MAX_MORE_MENU_NUM && ad->more_connective_menus[idx])
+               {
+                       if (idx != 0)
+                       {
+                               safeStrNCat(sub_text, ", ", MAX_COMMON_BUFFER_LEN);
+                       }
+                       safeStrNCat(sub_text, _(ad->more_connective_menus[idx]), MAX_COMMON_BUFFER_LEN);
+                       idx++;
+               }
+               ad->data_moreConnect->sub_desc = g_strdup(sub_text);
        }
-       if (ad->data_theme)
-       {
-           ad->data_theme->sub_desc = get_pa_theme_name_str();
+
+       if (ad->data_moreSystem) {
+               char sub_text[MAX_COMMON_BUFFER_LEN] = {0, };
+               int idx = 0;
+               while (idx < MAX_MORE_MENU_NUM && ad->more_system_menus[idx])
+               {
+                       if (idx != 0)
+                       {
+                               safeStrNCat(sub_text, ", ", MAX_COMMON_BUFFER_LEN);
+                       }
+                       safeStrNCat(sub_text, _(ad->more_system_menus[idx]), MAX_COMMON_BUFFER_LEN);
+                       idx++;
+               }
+               ad->data_moreSystem->sub_desc = g_strdup(sub_text);
        }
 
        if (ad->main_genlist) elm_genlist_realized_items_update(ad->main_genlist);
        if (ad->genlist_load) elm_genlist_realized_items_update(ad->genlist_load);
 
        Elm_Object_Item *navi_it = NULL;
+#if SUPPORT_MORE_ITEM_FUNCTION
+       navi_it = elm_naviframe_top_item_get(ad->navibar_main);
+       if (navi_it) elm_object_item_text_set(navi_it, _(KeyStr_MoreSystem));
+#endif
+
        navi_it = elm_naviframe_bottom_item_get(ad->navibar_main);
        if (navi_it)
                elm_object_item_text_set(navi_it, _("IDS_COM_BODY_SETTINGS"));
 
        if (ad->edit_item)
        {
+#if SUPPORT_BOTTOM_BTNS
                elm_object_item_text_set(ad->edit_item, _(EDIT_PREFERRED_STR));
+#else
+               Evas_Object *eo_btn = elm_object_item_part_content_get(ad->edit_item, "object");
+               setting_retm_if(eo_btn == NULL, "get eo_lbtn failed");
+               elm_object_text_set(eo_btn, _(EDIT_PREFERRED_STR));
+#endif
        }
 
+       if (ad->segment_all)
+               elm_object_item_text_set(ad->segment_all, _(ALL_STR));
+       if (ad->segment_preferred)
+               elm_object_item_text_set(ad->segment_preferred, _(PREFERRED_STR));
+
+       // set toolbar text
+       char tmp_text[MAX_DISPLAY_NAME_LEN_ON_UI + 1] = {0,};
+       if (MAIN_PROFILE_ALL == ad->profile_type) {
+               snprintf(tmp_text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s", _(PREFERRED_STR));
+       } else if (MAIN_PROFILE_PREFERRED == ad->profile_type) {
+               snprintf(tmp_text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s", _(ALL_STR));
+       } else {
+               /* do nothing */
+       }
+       Evas_Object *btn = elm_object_item_part_content_get(navi_it, "toolbar_button1");
+       elm_object_text_set(btn, tmp_text);
 
-       if (ad->segment_all) elm_object_item_text_set(ad->segment_all, _(ALL_STR));
-       if (ad->segment_preferred) elm_object_item_text_set(ad->segment_preferred,
-                                          _(PREFERRED_STR));
 
        if (ad->ug)
                ug_send_event(UG_EVENT_LANG_CHANGE);
-
-       return SETTING_RETURN_SUCCESS;
 }
 
 /**
@@ -138,63 +468,82 @@ static void setting_other_vconf_change_cb(keynode_t *key, void *data)
 
        Setting_GenGroupItem_Data* item_to_update = NULL;
        char *vconf_name = vconf_keynode_get_name(key);
-       SETTING_TRACE("the value of [ %s ] just changed", vconf_name);
+       //SETTING_TRACE("the value of [ %s ] just changed", vconf_name);
 
-       if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_USB_MODE_INT)) {
-               item_to_update = ad->data_usbcon;
-               retm_if(!item_to_update, "ad->data_usbcon is NULL");
-
-               item_to_update->sub_desc = get_pa_usb_connect_mode_str();
-               if (ad->bAppPause || ad->ug) {
-                       ad->updateItems[GL_ITEM_USB] = EINA_TRUE;
-               } else { // app is not in pause without ug
-                       elm_object_item_data_set(item_to_update->item, item_to_update);
-                       elm_genlist_item_update(item_to_update->item);
-               }
+       if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_WIDGET_THEME_STR)) {
                return;
-       } else if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_WIDGET_THEME_STR)) {
-               item_to_update = ad->data_theme;
-               retm_if(!item_to_update, "ad->data_theme is NULL");
+       } else if (!safeStrCmp(vconf_name, VCONFKEY_TELEPHONY_FLIGHT_MODE)) {
+               item_to_update = ad->data_flight;
+               retm_if(!item_to_update, "ad->data_flight is NULL");
 
-               item_to_update->sub_desc = get_pa_theme_name_str();
-               if (ad->bAppPause || ad->ug) {
-                       ad->updateItems[GL_ITEM_THEME] = EINA_TRUE;
-               } else { // app is not in pause without ug
-                       elm_object_item_data_set(item_to_update->item, item_to_update);
-                       elm_genlist_item_update(item_to_update->item);
+               int status = 0;
+               vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &status);
+               item_to_update->chk_status = status;
+               //do not need delay for checks
+               elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
+
+               //Flight mode is ON : Network menu dimmed
+               if (ad->data_network)
+               {
+                       if (status)
+                       {
+                               setting_disable_genlist_item(ad->data_network->item);
+                       }
+                       else
+                       {
+                               setting_enable_genlist_item(ad->data_network->item);
+                       }
                }
                return;
-       } else if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL)) {
+       } else if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL)) {
                item_to_update = ad->data_rotationMode;
                retm_if(!item_to_update, "ad->data_rotationMode is NULL");
 
                int status = 0;
-               vconf_get_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, &status);
+               vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &status);
+
                item_to_update->chk_status = status;
-               if (ad->bAppPause || ad->ug) {
-                       ad->updateItems[GL_ITEM_ROTATION] = EINA_TRUE;
-               } else { // app is not in pause without ug
-                       elm_check_state_set(item_to_update->eo_check, status);
+               //do not need delay for checks
+               elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
+               SETTING_TRACE("item_to_update->chk_status:%d", item_to_update->chk_status);
+               if (item_to_update->chk_status) //rotation function is not blocked
+               {
+                       SETTING_TRACE("Rotation function is on, it is necessary to adjust the device orientation");
+                       //int mode = APP_DEVICE_ORIENTATION_0;
+                       //mode = app_get_device_orientation();
+                       //elm_win_rotation_with_resize_set(ad->win_main, mode);
                }
+
                return;
-       } else if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL)) {
-               item_to_update = ad->data_roaming;
-               retm_if(!item_to_update, "ad->data_roaming is NULL");
+       } else if (!safeStrCmp(vconf_name, VCONFKEY_NFC_STATE)) {
+               SETTING_TRACE_DEBUG("%s updated", vconf_name);
+               item_to_update = ad->data_nfc;
+               retm_if(!item_to_update, "ad->data_nfc is NULL");
 
                int status = 0;
-               vconf_get_bool(VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL, &status);
+               vconf_get_bool(VCONFKEY_NFC_STATE, &status);
+
+               item_to_update->swallow_type = SWALLOW_Type_1ICON_1RADIO;
                item_to_update->chk_status = status;
+               //do not need delay for checks
+               elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
+               SETTING_TRACE("item_to_update->chk_status:%d", item_to_update->chk_status);
+
+               //item_to_update->sub_desc = (char *)g_strdup(get_NFC_on_off_str());
+               //SETTING_TRACE_DEBUG("%s", item_to_update->sub_desc);
+
                if (ad->bAppPause || ad->ug) {
-                       ad->updateItems[GL_ITEM_ROAMING] = EINA_TRUE;
+                       ad->updateItems[GL_ITEM_NFC] = EINA_TRUE;
                } else { // app is not in pause without ug
-                       elm_check_state_set(item_to_update->eo_check, status);
+                       elm_object_item_data_set(item_to_update->item, item_to_update);
+                       elm_genlist_item_update(item_to_update->item);
                }
-               return;
        }
 }
 
 /**
 * the event process when int VCONFS changes
+* @todo code clean - it has big if-else structure
 */
 static void setting_int_vconf_change_cb(keynode_t *key, void *data)
 {
@@ -203,50 +552,83 @@ static void setting_int_vconf_change_cb(keynode_t *key, void *data)
 
        int status = vconf_keynode_get_int(key);
        char *vconf_name = vconf_keynode_get_name(key);
+       SETTING_TRACE("Enter %s(%s=%d)", __FUNCTION__, vconf_name, status);
 
-       char *pa_wifi_device = NULL;
-       Setting_GenGroupItem_Data *item_to_update = NULL;
+       Setting_GenGroupItem_Data* item_to_update = NULL;
 
        if (!safeStrCmp(vconf_name, VCONFKEY_WIFI_STATE)) {
+       // do handling in case of VCONFKEY_WIFI_STATE
                item_to_update = ad->data_wifi;
                retm_if(!item_to_update, "ad->data_wifi is NULL");
 
                switch (status) {
                case VCONFKEY_WIFI_OFF:
-                       item_to_update->sub_desc = (char *)g_strdup(_("IDS_COM_BODY_OFF_M_STATUS"));
+                       //item_to_update->sub_desc = (char *)g_strdup(_("IDS_COM_BODY_OFF_M_STATUS"));
+
+                       item_to_update->chk_status = EINA_FALSE;
                        break;
 
                case VCONFKEY_WIFI_UNCONNECTED:
                case VCONFKEY_WIFI_CONNECTED:
                case VCONFKEY_WIFI_TRANSFER:
-                       pa_wifi_device = vconf_get_str(VCONFKEY_WIFI_CONNECTED_AP_NAME);
-                       if (NULL != pa_wifi_device && '\0' != pa_wifi_device[0]) {
-                               item_to_update->sub_desc = (char *)g_strdup(pa_wifi_device);
-                       } else {
-                               item_to_update->sub_desc = (char *)g_strdup(_("IDS_COM_BODY_ON_M_STATUS"));
-                       }
-                       FREE(pa_wifi_device);
+                       //pa_wifi_device = vconf_get_str(VCONFKEY_WIFI_CONNECTED_AP_NAME);
+                       //if (NULL != pa_wifi_device && '\0' != pa_wifi_device[0]) {
+                       //      item_to_update->sub_desc = (char *)g_strdup(pa_wifi_device);
+                       //} else {
+                       //      item_to_update->sub_desc = (char *)g_strdup(_("IDS_COM_BODY_ON_M_STATUS"));
+                       //}
+                       //FREE(pa_wifi_device);
+
+                       item_to_update->chk_status = EINA_TRUE;
                        break;
                default:
                        SETTING_TRACE_ERROR("Invalid wifi status!");
                        return;
                }
 
+               item_to_update->swallow_type = SWALLOW_Type_1ICON_1RADIO;
+               elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
+
                if (ad->bAppPause || ad->ug) {
                        ad->updateItems[GL_ITEM_WIFI] = EINA_TRUE;
                } else { // app is not in pause without ug
                        elm_object_item_data_set(item_to_update->item, item_to_update);
                        elm_genlist_item_update(item_to_update->item);
                }
+       }
+       else if (!safeStrCmp(vconf_name, VCONFKEY_CALL_STATE)) {
+       // do handling in case of VCONFKEY_CALL_STATE
+               // In call situation : Wi-fi / Tethering / Network menu dimmed
+               // --                                   Only Wi-fi should be dimmed (2013.04.04) --
+               if (VCONFKEY_CALL_OFF != status)
+               {
+                       if (ad->data_network)
+                               setting_disable_genlist_item(ad->data_network->item);
+               }
+               else
+               {
+                       if (ad->data_network)
+                               setting_enable_genlist_item(ad->data_network->item);
+               }
+
        } else if (!safeStrCmp(vconf_name, VCONFKEY_BT_STATUS)) {
+       // do handling in case of VCONFKEY_BT_STATUS
                item_to_update = ad->data_bt;
                retm_if(!item_to_update, "ad->data_bt is NULL");
-
+/*
                if (FALSE == status) {
-                       item_to_update->sub_desc = (char *)g_strdup(_("IDS_COM_BODY_OFF_M_STATUS"));
+               //      item_to_update->sub_desc = (char *)g_strdup(_("IDS_COM_BODY_OFF_M_STATUS"));
+
+                       item_to_update->chk_status = EINA_FALSE;
                } else {
-                       item_to_update->sub_desc = (char *)g_strdup(_("IDS_COM_BODY_ON_M_STATUS"));
+                       //item_to_update->sub_desc = (char *)g_strdup(_("IDS_COM_BODY_ON_M_STATUS"));
+
+                       item_to_update->chk_status = EINA_TRUE;
                }
+*/
+               item_to_update->swallow_type = SWALLOW_Type_1ICON_1RADIO;
+               item_to_update->chk_status = status;
+               elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
 
                if (ad->bAppPause || ad->ug) {
                        ad->updateItems[GL_ITEM_BT] = EINA_TRUE;
@@ -254,25 +636,27 @@ static void setting_int_vconf_change_cb(keynode_t *key, void *data)
                        elm_object_item_data_set(item_to_update->item, item_to_update);
                        elm_genlist_item_update(item_to_update->item);
                }
-       } else if (!safeStrCmp(vconf_name, VCONFKEY_MOBILE_HOTSPOT_MODE)) {
-               item_to_update = ad->data_mobileApp;
-               retm_if(!item_to_update, "ad->data_mobileApp is NULL");
-
-               /* For other vconfs */
-               if (FALSE == status) {
-                       item_to_update->sub_desc = (char *)g_strdup(_("IDS_COM_BODY_OFF_M_STATUS"));
+       } else if (!safeStrCmp(vconf_name, VCONFKEY_SYSMAN_BATTERY_STATUS_LOW)) {
+               if (status <= VCONFKEY_SYSMAN_BAT_CRITICAL_LOW) {
+                       if (ad->data_bright) {
+                               setting_disable_genlist_item(ad->data_bright->item);
+                       }
                } else {
-                       item_to_update->sub_desc = (char *)g_strdup(_("IDS_COM_BODY_ON_M_STATUS"));
-               }
+                       if (ad->data_bright) {
+                               setting_enable_genlist_item(ad->data_bright->item);
+                       }
 
-               if (ad->bAppPause || ad->ug) {
-                       ad->updateItems[GL_ITEM_MAP] = EINA_TRUE;
-               } else { // app is not in pause without ug
-                       elm_object_item_data_set(item_to_update->item, item_to_update);
-                       elm_genlist_item_update(item_to_update->item);
+               }
+       }else if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT)) {
+               //update directly
+               if (ad->data_bright)
+               {
+                       ad->data_bright->sub_desc = (char *)g_strdup(get_brightness_mode_str());
+                       elm_object_item_data_set(ad->data_bright->item, ad->data_bright);
+                       elm_genlist_item_update(ad->data_bright->item);
                }
        } else {
-                       SETTING_TRACE_ERROR("vconf_name is bad[%s]", vconf_name);
+               SETTING_TRACE_ERROR("vconf_name is bad[%s]", vconf_name);
        }
 
        return;
@@ -289,7 +673,7 @@ static void setting_string_vconf_change_cb(keynode_t *key, void *data)
 
        char *value = vconf_keynode_get_str(key);
        char *vconf_name = vconf_keynode_get_name(key);
-       Setting_GenGroupItem_Data *item_to_update = NULL;
+       Setting_GenGroupItem_Dataitem_to_update = NULL;
 
        if (!safeStrCmp(vconf_name, VCONFKEY_WIFI_CONNECTED_AP_NAME)) {
                int status;
@@ -303,8 +687,12 @@ static void setting_string_vconf_change_cb(keynode_t *key, void *data)
                SETTING_TRACE("status:%d", status);
                switch (status) {
                case VCONFKEY_WIFI_OFF:
-                       item_to_update->sub_desc =
-                               (char *)g_strdup(_("IDS_COM_BODY_OFF_M_STATUS"));
+                       //item_to_update->sub_desc =
+                       //      (char *)g_strdup(setting_gettext ("IDS_COM_BODY_OFF_M_STATUS"));
+
+                       item_to_update->chk_status = EINA_FALSE;
+                       item_to_update->swallow_type = SWALLOW_Type_1ICON_1RADIO;
+                       elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
                        break;
 
                case VCONFKEY_WIFI_UNCONNECTED:
@@ -312,11 +700,15 @@ static void setting_string_vconf_change_cb(keynode_t *key, void *data)
                case VCONFKEY_WIFI_TRANSFER:
                        if (NULL != value && '\0' != value[0]) {
                                SETTING_TRACE("wifi_device:%s", value);
-                               item_to_update->sub_desc = (char *)g_strdup(value);
+                               //item_to_update->sub_desc = (char *)g_strdup(value);
                        } else {
-                               item_to_update->sub_desc =
-                                       (char *) g_strdup(_("IDS_COM_BODY_ON_M_STATUS"));
+                               //item_to_update->sub_desc =
+                               //      (char *) g_strdup(setting_gettext ("IDS_COM_BODY_ON_M_STATUS"));
                        }
+
+                       item_to_update->chk_status = EINA_TRUE;
+                       item_to_update->swallow_type = SWALLOW_Type_1ICON_1RADIO;
+                       elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
                        break;
                default:
                        SETTING_TRACE_ERROR("Invalid wifi status!");
@@ -331,61 +723,6 @@ static void setting_string_vconf_change_cb(keynode_t *key, void *data)
        } // vconf_name == VCONFKEY_WIFI_CONNECTED_AP_NAME
 }
 
-static int vconf_key_change_event_listen(struct _vconf_key_change_event* me, void* data)
-{
-       SETTING_TRACE_BEGIN;
-       me->in_key[0] = VCONFKEY_BT_STATUS;
-       me->cb[0] = setting_int_vconf_change_cb;
-
-       me->in_key[1] = VCONFKEY_WIFI_STATE,
-       me->cb[1] = setting_int_vconf_change_cb;
-
-       me->in_key[2] = VCONFKEY_WIFI_CONNECTED_AP_NAME,
-       me->cb[2] = setting_string_vconf_change_cb;
-
-       me->in_key[3] = VCONFKEY_MOBILE_HOTSPOT_MODE,
-       me->cb[3] = setting_int_vconf_change_cb;
-
-       me->in_key[4] = VCONFKEY_SETAPPL_USB_MODE_INT,
-       me->cb[4] = setting_other_vconf_change_cb;
-
-       me->in_key[5] = VCONFKEY_SETAPPL_WIDGET_THEME_STR,
-       me->cb[5] = setting_other_vconf_change_cb;
-
-       me->in_key[6] = VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL,
-       me->cb[6] = setting_other_vconf_change_cb;
-
-       me->in_key[7] = VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL,
-       me->cb[7] = setting_other_vconf_change_cb;
-
-       // notify key event
-       int i, ret;
-       for(i=0;i<VCONF_KEY_EVENT_ARR_SIZE; i++)
-       {
-               if (me->in_key[i] != NULL && me->cb[i] != NULL) {
-                       ret = vconf_notify_key_changed(me->in_key[i], me->cb[i], data);
-                       if(ret < 0)
-                               SETTING_TRACE_ERROR(" %dth : %s notifications Failed(%d)",i, (char *)me->in_key[i], ret);
-               }
-       }
-       SETTING_TRACE_END;
-       return 0;
-}
-
-static int vconf_key_change_event_unlisten(struct _vconf_key_change_event* me,void* data)
-{
-       SETTING_TRACE_BEGIN;
-       // notify key event
-       int i, ret;
-       for(i=0;i<VCONF_KEY_EVENT_ARR_SIZE ; i++) {
-               if (me->in_key[i] != NULL && me->cb[i] != NULL) {
-                       ret = vconf_ignore_key_changed(me->in_key[i], me->cb[i]);
-               }
-       }
-       SETTING_TRACE_END;
-       return 0;
-}
-
 
 /**
 * Do the process which cost much time
@@ -396,45 +733,42 @@ static Eina_Bool setting_on_idle_lazy(void *data)
        setting_main_appdata *ad = data;
 
        /* A. add system event callback */
-       appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, setting_main_lang_changed_cb, ad);
-       appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, setting_main_region_changed_cb, ad);
-
-       return FALSE;
-}
+       if (sensor_create(&ad->sf_handle) != SENSOR_ERROR_NONE) {
+               SETTING_TRACE_ERROR("sensor attach fail");
+       }
 
-static int __setting_main_other_app_dead_cb(int pid, void *data)
-{
-       SETTING_TRACE_BEGIN;
-       setting_retvm_if(NULL == data, -1, "data is NULL");
-       setting_main_appdata *ad = (setting_main_appdata *) data;
+       if (sensor_motion_doubletap_set_cb(ad->sf_handle, __main_motion_sensor_cb, ad) != SENSOR_ERROR_NONE) {
+               SETTING_TRACE("sensor_motion_doubletap_set_cb fail to gather data");
+       }
 
-       if (ad->isInUGMode && ad->ug) {
-               bundle *b = NULL;
-               b = bundle_create();
-               setting_retvm_if(NULL == b, -1, "b is NULL");
-
-               char pid_str[SETTING_MAX_PID_LEN] = {0,};
-               snprintf(pid_str, SETTING_MAX_PID_LEN, "%d", pid);
-               bundle_add(b, "DEADPID", pid_str);
-               if (ug_send_message(ad->ug, b) != 0) {
-                       SETTING_TRACE_ERROR("call ug_send_message fail");
-               }
-               bundle_free(b);
+       if (sensor_start(ad->sf_handle, SENSOR_MOTION_DOUBLETAP) != SENSOR_ERROR_NONE) {
+               SETTING_TRACE_ERROR("sensor_start fail");
        }
-       return 0;
+
+#if SUPPORT_APP_ROATION
+       evas_object_geometry_get(ad->win_main, &g_geometry_x, &g_geometry_y, &g_geometry_w, &g_geometry_h);
+#endif
+
+       return FALSE;
 }
 
 /**
 * The function is called to create Setting view widgets
 */
-static int setting_main_app_create(void *data)
+static bool setting_main_app_create(void *data)
 {
        SETTING_TRACE_BEGIN;
-
-       ewk_init();
-
+       //fprintf(stderr, "[TIME] 3. it taked %d msec from main to setting_main_app_create \n", appcore_measure_time());
+       //SETTING_TRACE("[TIME] 3. it taked %d msec from main to setting_main_app_create ", appcore_measure_time());
+       //appcore_measure_start();
        setting_main_appdata *ad = data;
 
+       // registering sigterm
+       if (signal(SIGTERM, termination_handler) == SIG_IGN)
+       {
+               signal(SIGTERM, SIG_IGN);
+       }
+
        ad->data_roaming_popup = NULL;
 
        /* create window */
@@ -443,18 +777,43 @@ static int setting_main_app_create(void *data)
        evas_object_show(ad->win_main);
        UG_INIT_EFL(ad->win_main, UG_OPT_INDICATOR_ENABLE);
        ad->evas = evas_object_evas_get(ad->win_main);
+       ad->current_rotation = elm_win_rotation_get(ad->win_main);
+       SETTING_TRACE("ad->current_rotation:%d",ad->current_rotation);
+       if (elm_win_wm_rotation_supported_get(ad->win_main))
+       {
+               int rots[4] = { 0, 90, 180, 270 };  // rotation value that app may want
+               elm_win_wm_rotation_available_rotations_set(ad->win_main, &rots, 4);
+       }
+       evas_object_smart_callback_add(ad->win_main, "wm,rotation,changed", _rot_changed_cb, ad);
 
        /* load config file */
        int cfg_operation_ret = setting_cfg_init();
+       //PLUGIN_INIT(ad);
 
        elm_theme_extension_add(NULL, SETTING_THEME_EDJ_NAME);
+#if SUPPORT_LCD_TIMEOUT_KEEPING
+       /* to keep according with each other */
+       int origin_backlight_value;
+       if (0 !=
+           vconf_get_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL,
+                         &origin_backlight_value)) {
+               /* error handle.. */
+               vconf_set_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 30);
+               origin_backlight_value = 30;
+       }
+       /* to set intial value */
+       vconf_set_int(VCONFKEY_LCD_TIMEOUT_NORMAL_BACKUP,
+                     origin_backlight_value);
+
+       /* Firstly, Setting is running in foreground, LCD_TIMEOUT must be 600s(/10m) */
+       vconf_set_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 600);
+#endif
 
        elm_win_indicator_mode_set(ad->win_main, ELM_WIN_INDICATOR_SHOW);
 
        setting_view_create(&setting_view_main, ad);
        setting_view_node_table_register(&setting_view_main, NULL);
-       setting_view_node_table_register(&setting_view_more_menu,
-                                        &setting_view_main);
+       setting_view_node_table_register(&setting_view_more_menu, &setting_view_main);
 
        /* error handling */
        if (Cfg_Error_Type_Sucess != cfg_operation_ret) {
@@ -499,15 +858,16 @@ static int setting_main_app_create(void *data)
                                break;
                        }
                }
-               setting_create_popup_without_btn(ad, ad->win_main, (char *)notifyStr, NULL, NULL, 10);
+               setting_create_popup_without_btn(ad, ad->win_main, NULL, (char *)notifyStr, NULL, 10, FALSE, FALSE);
                return SETTING_RETURN_FAIL;
        }
+       //fprintf(stderr, "[TIME] 4. setting_main_app_create taked %d msec \n", appcore_measure_time());
+       //SETTING_TRACE("[TIME] 4. setting_main_app_create taked %d msec ", appcore_measure_time());
+       //appcore_measure_start();
 
-       aul_listen_app_dead_signal(__setting_main_other_app_dead_cb, ad);
-       ad->vk_events.listen = vconf_key_change_event_listen;
-       ad->vk_events.unlisten = vconf_key_change_event_unlisten;
-
-       return 0;
+       // set default local automatically
+       set_defaultLangICU();
+       return true;
 }
 
 /**
@@ -517,7 +877,10 @@ static int setting_main_app_terminate(void *data)
 {
        SETTING_TRACE_BEGIN;
        setting_main_appdata *ad = data;
+       //vconf_set_bool (VCONFKEY_SETAPPL_ROTATE_HOLD_BOOL, FALSE);
+
        setting_cfg_exit();
+       clear_system_service_data();
 
        ug_destroy_all();
        ad->ug = NULL;
@@ -525,8 +888,20 @@ static int setting_main_app_terminate(void *data)
        SETTING_TRACE("%s*** SETTING APPLICATION CLOSED ***%s",
                      SETTING_FONT_BGREEN, SETTING_FONT_BLACK);
 
-       ad->vk_events.unlisten(&(ad->vk_events), data);
+       DEREGISTER_VCONFS(ad->listened_list);
 
+       if (sensor_motion_doubletap_unset_cb(ad->sf_handle) != SENSOR_ERROR_NONE) {
+               SETTING_TRACE("sensor_motion_doubletap_unset_cb fail to gather data");
+       }
+       sensor_stop(ad->sf_handle, SENSOR_MOTION_DOUBLETAP);
+       sensor_destroy(ad->sf_handle);
+
+#if SUPPORT_LCD_TIMEOUT_KEEPING
+       /* once Setting is not running, LCD_TIMEOUT must be backuped */
+       int back_value = 0;
+       vconf_get_int(VCONFKEY_LCD_TIMEOUT_NORMAL_BACKUP, &back_value);
+       vconf_set_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, back_value);
+#endif
        setting_view_destroy(&setting_view_more_menu, ad);
        setting_view_destroy(&setting_view_main, ad);
        SETTING_TRACE("!!! After setting_view_destroy");
@@ -535,7 +910,6 @@ static int setting_main_app_terminate(void *data)
                ad->win_main = NULL;
        }
 
-       ewk_shutdown();
        SETTING_TRACE_END;
        return 0;
 }
@@ -543,7 +917,7 @@ static int setting_main_app_terminate(void *data)
 /**
 * The function is called when Setting begins run in background from forground
 */
-static int setting_main_app_pause(void *data)
+static void setting_main_app_pause(void *data)
 {
        SETTING_TRACE_BEGIN;
        setting_main_appdata *ad = data;
@@ -552,77 +926,192 @@ static int setting_main_app_pause(void *data)
        if (ad->ug)
                ug_pause();
 
-       return 0;
+#if SUPPORT_LCD_TIMEOUT_KEEPING
+       /* once Setting is running in background, LCD_TIMEOUT must be backuped */
+       int back_value = 0;
+       vconf_get_int(VCONFKEY_LCD_TIMEOUT_NORMAL_BACKUP, &back_value);
+       vconf_set_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, back_value);
+#endif
+
+       sensor_stop(ad->sf_handle, SENSOR_MOTION_DOUBLETAP);
+
 }
 
 /**
 * The function is called when Setting begins run in forground from background
 */
-static int setting_main_app_resume(void *data)
+static void setting_main_app_resume(void *data)
 {
        SETTING_TRACE_BEGIN;
        setting_main_appdata *ad = data;
 
+       if (sensor_start(ad->sf_handle, SENSOR_MOTION_DOUBLETAP) != SENSOR_ERROR_NONE) {
+               SETTING_TRACE_ERROR("sf_start fail");
+       }
+
        if (ad->ug)
                ug_resume();
 
+#if SUPPORT_LCD_TIMEOUT_KEEPING
+       /* once Setting is running in foreground, LCD_TIMEOUT must be reset to 600 */
+       vconf_set_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 600);
+#endif
+
        // update main genlist in resuming app.
        ad->bAppPause = EINA_FALSE;
-       if(!ad->ug) {
+       if(!ad->ug) {   // top-level view is not on UG
                SETTING_TRACE("update main genlist in resuming app without UG");
-               setting_update_gl_item(ad);
+               setting_update_gl_item(ad);     // update genlist sub-texts
        }
-
-       return 0;
 }
 
 /**
-* The function is called by app-fwk after app_create. It always do the process which cost much time.
-*/
-static int setting_main_app_reset(bundle *b, void *data)
+ * The function is called by app-fwk after app_create. It always do the process which cost much time.
+ */
+static void setting_main_app_reset(service_h service, void *data)
 {
-
        SETTING_TRACE_BEGIN;
        setting_main_appdata *ad = data;
 
-       ecore_idler_add(setting_on_idle_lazy, ad);
+       int value = 0;
+       vconf_get_bool (VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &value);
+       SETTING_TRACE("value:%d", value);
+       if (value) //rotation function is not blocked
+       {
+               SETTING_TRACE("Rotation function is on, it is necessary to adjust the device orientation");
+               //int mode = APP_DEVICE_ORIENTATION_0;
+               //mode = app_get_device_orientation();
+               //elm_win_rotation_with_resize_set(ad->win_main, mode);
+       }
+
+       vconf_callback_fn cb = NULL;
+
+       cb = setting_int_vconf_change_cb;
+       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_BT_STATUS, cb, data);
+       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_WIFI_STATE, cb, ad);
+       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_CALL_STATE, cb, ad);
+
+       //do need to disable 'Brightness' menu,just disable sub-items in 'Brightness' menu
+       //REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, cb, ad);
+       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, cb, data);
+
+       cb = setting_string_vconf_change_cb;
+       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_WIFI_CONNECTED_AP_NAME, cb, ad);
 
-       ad->vk_events.listen(&(ad->vk_events), data);
+       cb = setting_other_vconf_change_cb;
+       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_SETAPPL_USB_MODE_INT, cb, ad);
+       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_SETAPPL_WIDGET_THEME_STR, cb, ad);
+
+       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_TELEPHONY_FLIGHT_MODE, cb, ad);
+       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, cb, ad);
+       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_NFC_STATE, cb, ad);
 
        if (ad->win_main)
                elm_win_activate(ad->win_main);
 
-       return 0;
+       ecore_idler_add(setting_on_idle_lazy, ad);
+
+       int flight_mode = 0;
+       vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_mode);
+       if (flight_mode)
+       {
+               if (ad->data_network) setting_disable_genlist_item(ad->data_network->item);
+       }
+
+       int call_status = VCONFKEY_CALL_OFF;
+       vconf_get_int(VCONFKEY_CALL_STATE, &call_status);
+       if (VCONFKEY_CALL_OFF != call_status)
+       {
+               if (ad->data_network) setting_disable_genlist_item(ad->data_network->item);
+               if (ad->data_wifi) setting_disable_genlist_item(ad->data_wifi->item);
+               //if (ad->data_mobileApp) setting_disable_genlist_item(ad->data_mobileApp->item);
+       }
+
+       /* for jumping view */
+       service_get_extra_data(service, "view_to_jump", &(ad->view_to_jump));
+       if(ad->view_to_jump)
+       {
+               SETTING_TRACE_DEBUG("view to jump is %s", ad->view_to_jump);
+               /* Jumping */
+               if(!safeStrCmp(ad->view_to_jump, KeyStr_Sounds))
+               {
+
+                       SETTING_TRACE_DEBUG("Kill launched ug.");
+                       if(ad->isInUGMode == TRUE && (safeStrCmp(ad->cur_loaded_ug, "setting-profile-efl") != 0))
+                       {
+                               ug_destroy_all();
+                               ad->ug = NULL;
+                       }
+                       if(ad->isInUGMode == TRUE && (safeStrCmp(ad->cur_loaded_ug, "setting-profile-efl") == 0))
+                       {
+                               return;
+                       }
+
+                       struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
+                       setting_retm_if(!cbs, "calloc failed");
+                       cbs->layout_cb = setting_main_layout_ug_cb;
+                       cbs->result_cb = setting_main_result_ug_cb;
+                       cbs->destroy_cb = setting_main_destroy_ug_cb;
+                       cbs->priv = (void *)ad;
+
+                       SETTING_TRACE_DEBUG("call setting-profile-efl ug");
+                       ad->ug = ug_create(NULL, "setting-profile-efl", UG_MODE_FULLVIEW, 0, cbs);
+                       if (ad->ug) {
+                               ad->isInUGMode = TRUE;
+                               memset(ad->cur_loaded_ug, 0x00, MAX_DISPLAY_NAME_LEN_ON_UI);
+                               safeCopyStr(ad->cur_loaded_ug, "setting-profile-efl", MAX_DISPLAY_NAME_LEN_ON_UI);
+                       } else {
+                               evas_object_show(ad->ly_main);
+
+                               SETTING_TRACE_ERROR("errno:%d", errno);
+                               setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
+                       }
+                       if (cbs)
+                               FREE(cbs);
+                       cbs = NULL;
+                       ad->view_to_jump = NULL;
+               }
+       }
+       else
+       {
+               SETTING_TRACE_DEBUG("No need to jump view. Draw main.");
+       }
 }
 
-/**
- * argv[1] != 0 --> Setting app UI
- * argv[1] == 0 --> SMC test mode
- */
 int main(int argc, char *argv[])
 {
        int r = 0;
        setting_main_appdata ad;
 
-       if (!isEmulBin()) {
-               setenv("ELM_ENGINE", "gl", 1);
-       }
+       elm_init(argc, argv);
+#if SUPPORT_GL_ENGINE
+       // opengl_x11 or software_x11
+       elm_config_preferred_engine_set("software_x11");
+#endif
+
+       //fprintf(stderr, "[TIME] 1. aul_launch -> main :: Setting main : %d msec \n", appcore_measure_time_from("APP_START_TIME"));
+       //SETTING_TRACE("[TIME] 1. aul_launch -> main :: Setting main : %d msec ", appcore_measure_time_from("APP_START_TIME"));
+       //appcore_measure_start();
 
-       struct appcore_ops ops = {
+       app_event_callback_s ops = {
                .create = setting_main_app_create,
                .terminate = setting_main_app_terminate,
                .pause = setting_main_app_pause,
                .resume = setting_main_app_resume,
-               .reset = setting_main_app_reset,
+               .service = setting_main_app_reset,
+               .low_battery = setting_main_low_battery_cb,
+               .language_changed = setting_main_lang_changed_cb,
+               .region_format_changed = setting_main_region_changed_cb,
+               .device_orientation = NULL,
        };
 
-       memset(&ad, 0x0, sizeof(setting_main_appdata));
-       ops.data = &ad;
 
-       setting_main_lang_changed_cb(&ad);
+       memset(&ad, 0x00, sizeof(setting_main_appdata));
 
-       ecore_main_loop_glib_integrate();
-       r = appcore_efl_main(SETTING_PACKAGE, &argc, &argv, &ops);
+       //fprintf(stderr, "[TIME] 2. main : %d msec \n", appcore_measure_time());
+       //SETTING_TRACE("[TIME] 2. main : %d msec ", appcore_measure_time());
+       //appcore_measure_start();
+       r = app_efl_main(&argc, &argv, &ops, &ad);
        retv_if(r == -1, -1);
 
        return 0;