X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fsetting.c;h=e9412a6b3d601539bdc94bae18f44e0ec02d9951;hb=2efbd1d3ac1e522d5435d974e7c94a972dc1ac5c;hp=ef4a776905034a1e646c87be5a7b82fe7e1c7f7b;hpb=e0eff2930a0adf2f416e830de4bfb64dac08757e;p=apps%2Fcore%2Fpreloaded%2Fsettings.git diff --git a/src/setting.c b/src/setting.c index ef4a776..e9412a6 100755 --- a/src/setting.c +++ b/src/setting.c @@ -1,22 +1,18 @@ /* * setting + * Copyright (c) 2012 Samsung Electronics Co., Ltd. * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); + * 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.apache.org/licenses/LICENSE-2.0 + * 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, + * 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 #include @@ -25,7 +21,7 @@ #include #include #include -#include "setting-plugin.h" +#include "setting-common-plugin.h" #include "setting-main.h" #include #include @@ -266,6 +262,41 @@ static void setting_main_rotate(app_device_orientation_e m, void *data) #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 /** @@ -478,9 +509,9 @@ static void setting_other_vconf_change_cb(keynode_t *key, void *data) 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); + //int mode = APP_DEVICE_ORIENTATION_0; + //mode = app_get_device_orientation(); + //elm_win_rotation_with_resize_set(ad->win_main, mode); } return; @@ -492,13 +523,14 @@ static void setting_other_vconf_change_cb(keynode_t *key, void *data) int status = 0; 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); + //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_NFC] = EINA_TRUE; @@ -522,10 +554,8 @@ static void setting_int_vconf_change_cb(keynode_t *key, void *data) 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; - if (!safeStrCmp(vconf_name, VCONFKEY_WIFI_STATE)) { // do handling in case of VCONFKEY_WIFI_STATE item_to_update = ad->data_wifi; @@ -533,7 +563,7 @@ static void setting_int_vconf_change_cb(keynode_t *key, void *data) 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; @@ -541,13 +571,13 @@ static void setting_int_vconf_change_cb(keynode_t *key, void *data) 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; @@ -556,6 +586,7 @@ static void setting_int_vconf_change_cb(keynode_t *key, void *data) 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) { @@ -567,36 +598,35 @@ static void setting_int_vconf_change_cb(keynode_t *key, void *data) } 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 + // 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); - if (ad->data_wifi) - setting_disable_genlist_item(ad->data_wifi->item); } else { if (ad->data_network) setting_enable_genlist_item(ad->data_network->item); - if (ad->data_wifi) - setting_enable_genlist_item(ad->data_wifi->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); @@ -657,10 +687,11 @@ 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(setting_gettext ("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; @@ -669,13 +700,14 @@ 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(setting_gettext ("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: @@ -745,6 +777,14 @@ static bool 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(); @@ -838,7 +878,7 @@ 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); - PLUGIN_FINI; + setting_cfg_exit(); clear_system_service_data(); @@ -939,9 +979,9 @@ static void setting_main_app_reset(service_h service, void *data) 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); + //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; @@ -1062,7 +1102,7 @@ int main(int argc, char *argv[]) .low_battery = setting_main_low_battery_cb, .language_changed = setting_main_lang_changed_cb, .region_format_changed = setting_main_region_changed_cb, - .device_orientation = setting_main_rotate, + .device_orientation = NULL, };