[TBT][SD-Card][Non-ACR][TSAM-6296][Changes done as per developer comment] 20/79320/4
authorNibha Sharma <nibha.sharma@samsung.com>
Mon, 11 Jul 2016 03:04:56 +0000 (12:04 +0900)
committerNibha Sharma <nibha.sharma@samsung.com>
Mon, 11 Jul 2016 06:33:07 +0000 (15:33 +0900)
Change-Id: I7cf2a1b5547d840e4e55aced87b5f069a54db87e
Signed-off-by: Nibha Sharma <nibha.sharma@samsung.com>
release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk
release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk
tbtcoreapp/src/view/tbt-storage-view.c

index 65698c93bb6b84d40e9436c70255b1c578a8158f..dd95d7143c5eb0752e8a9a999ee2b448c6659b00 100644 (file)
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
index 64e7a936437f61a3a7df9a501dd169970953a471..a00f29d2bc4b86828ba7a1676a889dbd1d24dedb 100644 (file)
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
index 801606cb43284a94a800cc78e7d43ab859bda161..e60dd604e0e1f48d4f828f801599a868012b26ee 100644 (file)
@@ -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) 
        {