};
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
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
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;
}
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);
}
* @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");
this = (storage_view*) user_data;
DBG("value: %d", state);
+
+ if(dev!=STORAGE_DEV_EXT_SDCARD || !primary)
+ {
+ return;
+ }
switch (state)
{