From: Nibha Sharma Date: Mon, 11 Jul 2016 03:04:56 +0000 (+0900) Subject: [TBT][SD-Card][Non-ACR][TSAM-6296][Changes done as per developer comment] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F20%2F79320%2F4;p=test%2Ftct%2Fnative%2Fbehavior.git [TBT][SD-Card][Non-ACR][TSAM-6296][Changes done as per developer comment] Change-Id: I7cf2a1b5547d840e4e55aced87b5f069a54db87e Signed-off-by: Nibha Sharma --- diff --git a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk index 65698c9..dd95d71 100644 Binary files a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk differ diff --git a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk index 64e7a93..a00f29d 100644 Binary files a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk differ diff --git a/tbtcoreapp/src/view/tbt-storage-view.c b/tbtcoreapp/src/view/tbt-storage-view.c index 801606c..e60dd60 100644 --- a/tbtcoreapp/src/view/tbt-storage-view.c +++ b/tbtcoreapp/src/view/tbt-storage-view.c @@ -43,11 +43,12 @@ struct _storage_view }; static void _app_destroy_cb(void* this); -static void _storage_state_changed_cb(int storage_id, storage_state_e state, void *user_data); +static void _storage_state_changed_cb(int storage_id,storage_dev_e dev, storage_state_e state,const char *fstype, const char *fsuuid, const char *mountpath,bool primary, int flags, void *user_data); bool storage_device_supported_cb_p(int storage_id, storage_type_e type, storage_state_e state, const char *path, void *user_data); -static int StorageID = -1; static bool is_not_supported = false; +static bool is_external = false; + /** * @function get_storage_error @@ -83,26 +84,25 @@ char* get_storage_type_error(int ret) return err_msg; } - - /** -* @function storage_device_supported_cb_p -* @description callback for supported devices -* @parameter storage_id : storage id, type : storage type, state : state, path : storage path, user_data : user data passed to callback -* @return bool +* @function storage_device_supported_cb_p +* @description callback for supported devices +* @parameter storage_id : storage id, type : storage type, state : state, path : storage path, user_data : user data passed to callback +* @return bool */ bool storage_device_supported_cb_p(int storage_id, storage_type_e type, storage_state_e state, const char *path, void *user_data) { - storage_view *this = NULL; - this = (storage_view*) user_data; - if(type == STORAGE_TYPE_EXTERNAL) - { - StorageID=storage_id; + storage_view *this = NULL; + this = (storage_view*) user_data; + if(type == STORAGE_TYPE_EXTERNAL) + { + is_external = true; return false; - } + } return true; } + /** * @function storage_view_add * @since_tizen 3.0 @@ -127,28 +127,29 @@ storage_view *storage_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object common_view_add(navi, tbt_info, item, this->view, _app_destroy_cb, this); RETVM_IF(NULL == this->view, NULL, "navi is null"); - ret = storage_foreach_device_supported(storage_device_supported_cb_p, this); - RETVM_IF(ret != STORAGE_ERROR_NONE && ret != STORAGE_ERROR_NOT_SUPPORTED, NULL, "storage_foreach_device_supported failed : %s", get_storage_type_error(ret)); - if(ret == STORAGE_ERROR_NOT_SUPPORTED) - { - is_not_supported = true; - Evas_Object *popup = ui_utils_popup_add(this->view->navi, "Message"); - elm_object_text_set(popup, "Storage is not supported"); - RETVM_IF(!this->view, NULL,"Storage is not supported"); - } - - if(StorageID<0) - { - DBG("There is no external storage"); - return NULL; - } - ret = storage_set_state_changed_cb(StorageID, _storage_state_changed_cb, this); - RETVM_IF(ret != STORAGE_ERROR_NONE, NULL, "storage_set_state_changed_cb failed : %s", get_storage_type_error(ret)); - this->info_label = ui_utils_label_add(this->view->layout, "Please Change SD Card state[Remove/Insert]"); elm_label_line_wrap_set(this->info_label, ELM_WRAP_WORD); - - elm_object_part_content_set(this->view->layout, "info_text", this->info_label); + + ret = storage_foreach_device_supported(storage_device_supported_cb_p, this); + RETVM_IF(ret != STORAGE_ERROR_NONE && ret != STORAGE_ERROR_NOT_SUPPORTED, NULL, "storage_foreach_device_supported failed : %s", get_storage_type_error(ret)); + if(ret == STORAGE_ERROR_NOT_SUPPORTED) + { + is_not_supported = true; + Evas_Object *popup = ui_utils_popup_add(this->view->navi, "Message"); + elm_object_text_set(popup, "Storage is not supported"); + RETVM_IF(!this->view, NULL,"Storage is not supported"); + } + + if(is_external == false) + { + ui_utils_label_set_text(this->info_label, "Please insert SDCard", "left"); + elm_object_part_content_set(this->view->layout, "info_text", this->info_label); + + } + ret = storage_set_changed_cb(STORAGE_TYPE_EXTERNAL, _storage_state_changed_cb, this); + RETVM_IF(ret != STORAGE_ERROR_NONE, NULL, "storage_set_changed_cb failed : %s", get_storage_type_error(ret)); + + elm_object_part_content_set(this->view->layout, "info_text", this->info_label); return this; } @@ -170,17 +171,16 @@ static void _app_destroy_cb(void* this) view = (storage_view*)this; RETM_IF(NULL == view, "view is NULL"); - if(is_not_supported == true) - { - view->view->tbt_info->result = TBT_INFO_RESULT_NOT_SUPPORTED; - elm_genlist_item_update(view->view->item); - } + if(is_not_supported == true) + { + view->view->tbt_info->result = TBT_INFO_RESULT_NOT_SUPPORTED; + elm_genlist_item_update(view->view->item); + } + + is_external = false; + int ret = storage_unset_changed_cb(STORAGE_TYPE_EXTERNAL, _storage_state_changed_cb); + RETM_IF(ret != STORAGE_ERROR_NONE, "storage_unset_changed_cb fail > Error = %s", get_storage_type_error(ret)); - if(StorageID >=0) - { - int ret = storage_unset_state_changed_cb( StorageID, _storage_state_changed_cb); - RETM_IF(ret != STORAGE_ERROR_NONE, "storage_unset_state_changed_cb fail > Error = %s", get_storage_type_error(ret)); - } SAFE_DELETE(view->view); SAFE_DELETE(view); } @@ -193,7 +193,7 @@ static void _app_destroy_cb(void* this) * @parameter int storage_id, storage_state_e state, void *user_data * @return void */ -static void _storage_state_changed_cb(int storage_id, storage_state_e state, void *user_data) +static void _storage_state_changed_cb(int storage_id,storage_dev_e dev, storage_state_e state,const char *fstype, const char *fsuuid, const char *mountpath,bool primary, int flags, void *user_data) { RETM_IF(NULL == user_data, "user_data is null"); @@ -202,6 +202,11 @@ static void _storage_state_changed_cb(int storage_id, storage_state_e state, voi this = (storage_view*) user_data; DBG("value: %d", state); + + if(dev!=STORAGE_DEV_EXT_SDCARD || !primary) + { + return; + } switch (state) {