Fixed Storage API's 60/92260/5
authorbhutani.92 <bhutani.92@samsung.com>
Fri, 14 Oct 2016 07:38:18 +0000 (13:08 +0530)
committerRahul Dadhich <r.dadhich@samsung.com>
Fri, 14 Oct 2016 08:53:32 +0000 (01:53 -0700)
Change-Id: Ib51aedab35a08f27a62fd922b111342411648b05
Signed-off-by: bhutani.92 <bhutani.92@samsung.com>
src/common/mf-callback.c
src/common/mf-util.c

index f12f9f5..90abd2b 100755 (executable)
@@ -3881,7 +3881,7 @@ static void __mf_callback_mmc_removed(void *data, MF_STORAGE storage)
                ap->mf_MainWindow.pMmcRemovedPopup = NULL;
        }
        //mf_navi_bar_title_set(ap);
-       free(storage_loc);
+       SAFE_FREE_CHAR(storage_loc);
 }
 
 static void __mf_callback_storage_changed_cb(int storage_id,
@@ -3915,11 +3915,11 @@ static void __mf_callback_storage_changed_cb(int storage_id,
        if (STORAGE_STATE_MOUNTED == state) {
                mf_debug("Storage State Mounted");
                if (strstr(temp_path, "sdcard") && (ap->mf_Status.iStorageState & MYFILE_MMC)) {
-                       __mf_callback_mmc_connected(ap);
                        mf_set_usb_storage_id(storage_id);
+                       __mf_callback_mmc_connected(ap);
                } else if (strstr(temp_path, "usb") && (ap->mf_Status.iStorageState & MYFILE_OTG)) {
-                       mf_callback_otg_connected_cb(ap);
                        mf_set_otg_storage_id(storage_id);
+                       mf_callback_otg_connected_cb(ap);
                } else {
                        mf_debug("No external storage detected... Returning... [%d]", ap->mf_Status.iStorageState);
                }
index d2e5a3f..529e0ad 100755 (executable)
@@ -332,7 +332,6 @@ void mf_util_action_storage_insert(void *data, char *pItemLabel)
                } else if (!g_strcmp0(ap->mf_Status.path->str, OTG_FOLDER) && (ap->mf_Status.iStorageState & MYFILE_OTG) && !__mf_util_storage_exist_check(parent, MYFILE_OTG)) {
                        mf_view_item_append(parent, pNode, ap);
                }
-               free(STORAGE_PARENT);
        }
 }
 
@@ -2333,11 +2332,15 @@ void mf_set_otg_storage_id(int id)
        MF_CHECK(ap);
        ap->otg_id = id;
        if (id == -1) {
-               ap->otg_storage_path = "";
+               ap->otg_storage_path = strdup("");
+               ap->otg_parent_path = strdup("");
+               ap->otg_storage_name = strdup("");
        } else {
                char *path;
                storage_get_root_directory(id, &path);
                ap->otg_storage_path = strdup(path);
+               mf_file_attr_get_parent_path(path, &ap->otg_parent_path);
+               ap->otg_storage_name = strdup(mf_storage_file_get(path));
                free(path);
        }
        MF_TRACE_END
@@ -2350,11 +2353,15 @@ void mf_set_usb_storage_id(int id)
        MF_CHECK(ap);
        ap->mmc_id = id;
        if (id == -1) {
-               ap->mmc_storage_path = "";
+               ap->mmc_storage_path = strdup("");
+               ap->mmc_parent_path = strdup("");
+               ap->mmc_storage_name = strdup("");
        } else {
                char *path;
                storage_get_root_directory(id, &path);
                ap->mmc_storage_path = strdup(path);
+               mf_file_attr_get_parent_path(path, &ap->mmc_parent_path);
+               ap->mmc_storage_name = strdup(mf_storage_file_get(path));
                free(path);
        }
        MF_TRACE_END