From: Sunyeop Hwang Date: Thu, 7 Feb 2013 08:12:24 +0000 (+0900) Subject: Remove sub text of wifi, bt and nfc menu X-Git-Tag: accepted/tizen_2.1/20130425.022820~31^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=f56d74d8849c01e8be2de6c2a2d10352cf0b8a09;p=apps%2Fcore%2Fpreloaded%2Fsettings.git Remove sub text of wifi, bt and nfc menu Change-Id: I93f2e4b80a5f7db169c977c5ba31bd62ad01c8c2 --- diff --git a/packaging/org.tizen.setting.spec b/packaging/org.tizen.setting.spec index b9e35fc..911f586 100755 --- a/packaging/org.tizen.setting.spec +++ b/packaging/org.tizen.setting.spec @@ -62,6 +62,7 @@ BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(capi-system-system-settings) BuildRequires: pkgconfig(capi-network-wifi) BuildRequires: pkgconfig(capi-network-bluetooth) +BuildRequires: pkgconfig(capi-network-tethering) BuildRequires: pkgconfig(capi-network-nfc) BuildRequires: pkgconfig(ecore-evas) BuildRequires: pkgconfig(pkgmgr) diff --git a/setting-common/include/setting-common-data-type.h b/setting-common/include/setting-common-data-type.h index d023704..7cc3dc9 100755 --- a/setting-common/include/setting-common-data-type.h +++ b/setting-common/include/setting-common-data-type.h @@ -189,6 +189,7 @@ typedef enum _SWALLOW_Type { SWALLOW_Type_1CHECKICON = 4, SWALLOW_Type_1RADIO = 5, SWALLOW_Type_1TOGGLE = 6, + SWALLOW_Type_1ICON_1PROCESS, SWALLOW_Type_MULTILINE_1TOGGLE, SWALLOW_Type_1ICON_1IMAGE, @@ -228,8 +229,8 @@ typedef enum _POPUP_BTN_RESPONSE_TYPE{ } POPUP_BTN_RESPONSE_TYPE; typedef enum { - SETTING_GROUP_STYLE_NONE = -1, - SETTING_GROUP_STYLE_TOP = 0, + SETTING_GROUP_STYLE_NONE = 0, + SETTING_GROUP_STYLE_TOP, SETTING_GROUP_STYLE_CENTER, SETTING_GROUP_STYLE_BOTTOM } setting_group_style; diff --git a/setting-common/src/setting-common-draw-genlist.c b/setting-common/src/setting-common-draw-genlist.c index 0a4f4c7..d2f351e 100755 --- a/setting-common/src/setting-common-draw-genlist.c +++ b/setting-common/src/setting-common-draw-genlist.c @@ -796,11 +796,13 @@ static __Content_Drawer __cd_left[SWALLOW_Type_MAX] = { //left part object of the type {SWALLOW_Type_1ICON_1RADIO, __add_left_default}, + {SWALLOW_Type_1ICON_1PROCESS, __add_left_default}, {SWALLOW_Type_1RADIO_1PROCESS, __add_radio}, }; static __Content_Drawer __cd_right[SWALLOW_Type_MAX] = { //right part object of the type {SWALLOW_Type_1ICON_1RADIO, __add_toggle}, + {SWALLOW_Type_1ICON_1PROCESS, __add_process}, {SWALLOW_Type_1RADIO_1PROCESS, __add_process}, }; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cac53ea..97388b8 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,6 +14,7 @@ pkg_check_modules(pkgs_main REQUIRED appsvc libxml-2.0 capi-system-system-settings capi-network-wifi + capi-network-tethering capi-network-bluetooth capi-network-nfc dbus-glib-1 ewebkit2 diff --git a/src/setting-main.c b/src/setting-main.c index 61f31f4..7d442d6 100755 --- a/src/setting-main.c +++ b/src/setting-main.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -376,9 +377,9 @@ static Setting_GenGroupItem_Data * __wifi_handler(void* data, char* keyStr, char int value, err; setting_get_int_slp_key(INT_SLP_SETTING_WIFI_STATUS, &value, &err); - char* pa_wifi = get_pa_Wi_Fi_on_off_str(); + //char* pa_wifi = get_pa_Wi_Fi_on_off_str(); ad->data_wifi = setting_create_Gendial_field_groupitem(genlist, - &(ad->itc[GENDIAL_Type_2text_2icon_3]), + &(ad->itc[GENDIAL_Type_1text_2icon]), NULL, setting_main_click_list_ex_ug_cb, ug_args, @@ -387,10 +388,12 @@ static Setting_GenGroupItem_Data * __wifi_handler(void* data, char* keyStr, char NULL, value, keyStr, - pa_wifi, + NULL, setting_main_click_list_wifi_mode_cb); __BACK_POINTER_SET(ad->data_wifi); - G_FREE(pa_wifi); + if(ad->data_wifi) + ad->data_wifi->userdata = ad; + //G_FREE(pa_wifi); return ad->data_wifi; } @@ -402,7 +405,7 @@ static Setting_GenGroupItem_Data * __bluetooth_handler(void* data, char* keyStr, setting_get_int_slp_key(INT_SLP_SETTING_BT_STATUS, &value, &err); ad->data_bt = setting_create_Gendial_field_groupitem(genlist, - &(ad->itc[GENDIAL_Type_2text_2icon_3]), + &(ad->itc[GENDIAL_Type_1text_2icon]), NULL, setting_main_click_list_ex_ug_cb, ug_args, @@ -411,10 +414,11 @@ static Setting_GenGroupItem_Data * __bluetooth_handler(void* data, char* keyStr, NULL, value, keyStr, - get_BT_on_off_str - (), + NULL, setting_main_click_list_bt_mode_cb); __BACK_POINTER_SET(ad->data_bt); + if(ad->data_bt) + ad->data_bt->userdata = ad; return ad->data_bt; } @@ -464,7 +468,7 @@ static Setting_GenGroupItem_Data * __nfc_handler(void* data, char* keyStr, char* setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_STATUS, &value, &err); ad->data_nfc = setting_create_Gendial_field_groupitem(genlist, - &(ad->itc[GENDIAL_Type_2text_2icon_3]), + &(ad->itc[GENDIAL_Type_1text_2icon]), NULL, setting_main_click_list_ex_ug_cb, ug_args, @@ -473,9 +477,11 @@ static Setting_GenGroupItem_Data * __nfc_handler(void* data, char* keyStr, char* NULL, value, keyStr, - get_NFC_on_off_str(), + NULL, setting_main_click_list_nfc_mode_cb); __BACK_POINTER_SET(ad->data_nfc); + if(ad->data_nfc) + ad->data_nfc->userdata = ad; #if DISABLED_CODE setting_create_Gendial_field_def(genlist, &itc_multiline_text, NULL, @@ -2341,77 +2347,241 @@ void __alternate_flight_mode(Evas_Object *check) SETTING_TRACE_END; } -void __alternate_wifi_mode(Evas_Object *check) +static void __tethering_disabled_cb(tethering_error_e error, tethering_type_e type, tethering_disabled_cause_e code, void *data) { - SETTING_TRACE_BEGIN; int ret; - Eina_Bool status = elm_check_state_get(check); - SETTING_TRACE("wifi mode status : %d", status); + + if (data) { + tethering_h th = (tethering_h)data; + tethering_destroy(th); + } ret = wifi_initialize(); setting_retm_if(ret < 0, "*** [ERR] wifi_initialize() ***"); - - if (status) { - ret = wifi_activate(NULL, NULL); - setting_retm_if(ret < 0, - "*** [ERR] wifi_activate() ***"); - } else { - ret = wifi_deactivate(NULL, NULL); - setting_retm_if(ret < 0, - "*** [ERR] wifi_deactivate() ***"); + ret = wifi_activate(NULL, NULL); + if (ret < 0) { + wifi_deinitialize(); } + setting_retm_if(ret < 0, "*** [ERR] wifi_activate() ***"); + ret = wifi_deinitialize(); setting_retm_if(ret < 0, "*** [ERR] wifi_deinitialize() ***"); +} + +static void __tethering_turn_off_resp_cb(void *data, Evas_Object *obj, void *event_info) +{ + setting_retm_if(NULL == obj, "NULL == obj"); + int response_type = btn_type(obj); + Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data; + + if (g_main_ad) + { + evas_object_del(g_main_ad->popup); + g_main_ad->popup = NULL; + } + if (POPUP_RESPONSE_OK == response_type) + { + tethering_h th = NULL; + tethering_error_e ret = TETHERING_ERROR_NONE; + + ret = tethering_create(&th); + if (ret != TETHERING_ERROR_NONE) { + list_item->swallow_type = SWALLOW_Type_1ICON_1RADIO; + list_item->chk_status = EINA_FALSE; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + } + + ret = tethering_set_disabled_cb(th, TETHERING_TYPE_WIFI, __tethering_disabled_cb, th); + if (ret != TETHERING_ERROR_NONE) { + list_item->swallow_type = SWALLOW_Type_1ICON_1RADIO; + list_item->chk_status = EINA_FALSE; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + + tethering_destroy(th); + return; + } + + tethering_disable(th, TETHERING_TYPE_WIFI); + } + else if (POPUP_RESPONSE_CANCEL == response_type) + { + list_item->swallow_type = SWALLOW_Type_1ICON_1RADIO; + list_item->chk_status = EINA_FALSE; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + } +} + +void __alternate_wifi_mode(Setting_GenGroupItem_Data *list_item, Evas_Object *check) +{ + SETTING_TRACE_BEGIN; + int ret; + Eina_Bool status = elm_check_state_get(check); + SETTING_TRACE("wifi mode status : %d", status); + + int value, err; + + if (tethering_is_enabled(NULL, TETHERING_TYPE_WIFI) == TRUE) { + list_item->swallow_type = SWALLOW_Type_1ICON_1PROCESS; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + + g_main_ad->popup = setting_create_popup_with_btn(list_item, + g_main_ad->win_main, NULL, + _("Connecting Wi-Fi will turn off Mobile hotspot. Continue?"), + __tethering_turn_off_resp_cb, + 0, 2, _("IDS_COM_SK_OK"), _("IDS_COM_SK_CANCEL")); + } else { + ret = wifi_initialize(); + if (ret < 0) { + setting_get_int_slp_key(INT_SLP_SETTING_WIFI_STATUS, &value, &err); + list_item->chk_status = value; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + } + setting_retm_if(ret < 0, "*** [ERR] wifi_initialize() ***"); + + if (status) { + ret = wifi_activate(NULL, NULL); + if (ret < 0) { + setting_get_int_slp_key(INT_SLP_SETTING_WIFI_STATUS, &value, &err); + list_item->chk_status = value; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + wifi_deinitialize(); + } + setting_retm_if(ret < 0, "*** [ERR] wifi_activate() ***"); + } else { + ret = wifi_deactivate(NULL, NULL); + if (ret < 0) { + setting_get_int_slp_key(INT_SLP_SETTING_WIFI_STATUS, &value, &err); + list_item->chk_status = value; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + wifi_deinitialize(); + } + setting_retm_if(ret < 0, "*** [ERR] wifi_deactivate() ***"); + } + + ret = wifi_deinitialize(); + if (ret < 0) { + setting_get_int_slp_key(INT_SLP_SETTING_WIFI_STATUS, &value, &err); + list_item->chk_status = value; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + } + setting_retm_if(ret < 0, "*** [ERR] wifi_deinitialize() ***"); + + list_item->swallow_type = SWALLOW_Type_1ICON_1PROCESS; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + + } SETTING_TRACE_END; } -void __alternate_bt_mode(Evas_Object *check) +void __alternate_bt_mode(Setting_GenGroupItem_Data *list_item, Evas_Object *check) { SETTING_TRACE_BEGIN; int ret; Eina_Bool status = elm_check_state_get(check); SETTING_TRACE("bt mode status : %d", status); + int value, err; + ret = bt_initialize(); + if (ret < 0) { + setting_get_int_slp_key(INT_SLP_SETTING_BT_STATUS, &value, &err); + list_item->chk_status = value; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + } setting_retm_if(ret < 0, "*** [ERR] bt_initialize() ***"); if (status) { ret = bt_adapter_enable(); - setting_retm_if(ret < 0, - "*** [ERR] bt_adapter_enable() ***"); + if (ret < 0) { + setting_get_int_slp_key(INT_SLP_SETTING_BT_STATUS, &value, &err); + list_item->chk_status = value; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + bt_deinitialize(); + } + setting_retm_if(ret < 0, "*** [ERR] bt_adapter_enable() ***"); } else { ret = bt_adapter_disable(); - setting_retm_if(ret < 0, - "*** [ERR] bt_adapter_disable() ***"); + if (ret < 0) { + setting_get_int_slp_key(INT_SLP_SETTING_BT_STATUS, &value, &err); + list_item->chk_status = value; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + bt_deinitialize(); + } + setting_retm_if(ret < 0, "*** [ERR] bt_adapter_disable() ***"); } ret = bt_deinitialize(); + if (ret < 0) { + setting_get_int_slp_key(INT_SLP_SETTING_BT_STATUS, &value, &err); + list_item->chk_status = value; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + } setting_retm_if(ret < 0, "*** [ERR] bt_deinitialize() ***"); + list_item->swallow_type = SWALLOW_Type_1ICON_1PROCESS; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + SETTING_TRACE_END; } -void __alternate_nfc_mode(Evas_Object *check) +void __alternate_nfc_mode(Setting_GenGroupItem_Data *list_item, Evas_Object *check) { SETTING_TRACE_BEGIN; int ret; Eina_Bool status = elm_check_state_get(check); SETTING_TRACE("nfc mode status : %d", status); + int value, err; + ret = nfc_manager_initialize(NULL, NULL); + if (ret < 0) { + setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_STATUS, &value, &err); + list_item->chk_status = value; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + } setting_retm_if(ret < 0, "*** [ERR] nfc_manager_initialize() ***"); - ret = nfc_manager_set_activation(status, NULL, NULL); - setting_retm_if(ret < 0, - "*** [ERR] nfc_manager_set_activation() ***"); + if (ret < 0) { + setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_STATUS, &value, &err); + list_item->chk_status = value; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + nfc_manager_deinitialize(); + } + setting_retm_if(ret < 0, "*** [ERR] nfc_manager_set_activation() ***"); ret = nfc_manager_deinitialize(); + if (ret < 0) { + setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_STATUS, &value, &err); + list_item->chk_status = value; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + } setting_retm_if(ret < 0, "*** [ERR] nfc_manager_deinitialize() ***"); + list_item->swallow_type = SWALLOW_Type_1ICON_1PROCESS; + elm_object_item_data_set(list_item->item, list_item); + elm_genlist_item_update(list_item->item); + SETTING_TRACE_END; } @@ -2547,7 +2717,7 @@ setting_main_click_list_wifi_mode_cb(void *data, Evas_Object *obj, SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr), list_item->chk_status); - __alternate_wifi_mode(obj); + __alternate_wifi_mode(list_item, obj); SETTING_TRACE_END; } @@ -2566,7 +2736,7 @@ setting_main_click_list_bt_mode_cb(void *data, Evas_Object *obj, SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr), list_item->chk_status); - __alternate_bt_mode(obj); + __alternate_bt_mode(list_item, obj); SETTING_TRACE_END; } @@ -2585,7 +2755,7 @@ setting_main_click_list_nfc_mode_cb(void *data, Evas_Object *obj, SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr), list_item->chk_status); - __alternate_nfc_mode(obj); + __alternate_nfc_mode(list_item, obj); SETTING_TRACE_END; } diff --git a/src/setting.c b/src/setting.c index de28fff..160ca25 100755 --- a/src/setting.c +++ b/src/setting.c @@ -488,13 +488,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; @@ -518,10 +519,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; @@ -529,7 +528,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; @@ -537,13 +536,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; @@ -552,6 +551,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) { @@ -580,19 +580,21 @@ static void setting_int_vconf_change_cb(keynode_t *key, void *data) } } 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); @@ -653,10 +655,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; @@ -665,13 +668,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: