summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshivamv <shivam.v2@samsung.com>2023-02-07 17:16:28 +0530
committershivamv <shivam.v2@samsung.com>2023-02-08 13:27:27 +0530
commit2b230d3e835ffd8e884d44486df1ddc2eae2c15c (patch)
treee4bbc5e1dece98c7c4d3b649341d173b970fbd77
parent21f4245188a7dd2e93e616b1e3646999b4d80a2f (diff)
downloadattach-panel-document-tizen_8.0.tar.gz
attach-panel-document-tizen_8.0.tar.bz2
attach-panel-document-tizen_8.0.zip
Change-Id: I275d9b74b2cd49eefa655ac5bc82d3574fc2229f Signed-off-by: shivamv <shivam.v2@samsung.com>
-rwxr-xr-x[-rw-r--r--]include/doc-data-type.h3
-rwxr-xr-x[-rw-r--r--]include/doc-data-util.h1
-rwxr-xr-x[-rw-r--r--]src/doc-data-type.c1
-rwxr-xr-x[-rw-r--r--]src/doc-data-util.c25
-rwxr-xr-x[-rw-r--r--]src/doc-local-data.c27
5 files changed, 34 insertions, 23 deletions
diff --git a/include/doc-data-type.h b/include/doc-data-type.h
index b5c9519..09acdd2 100644..100755
--- a/include/doc-data-type.h
+++ b/include/doc-data-type.h
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <eina_list.h>
#include <media_content.h>
+#include <storage.h>
#define DOC_FREEIF(ptr) \
do { \
@@ -83,7 +84,7 @@ struct _doc_media_t {
time_t mtime; /*modified time */
char *display_name; /*item name */
int mode; /* Show icon indicates different camera shot mode */
- media_content_storage_e storage_type; /* Storage type got from DB */
+ storage_type_e storage_type; /* Storage type got from DB */
bool b_create_thumb; /* Request DB to create thumbnail */
};
diff --git a/include/doc-data-util.h b/include/doc-data-util.h
index d89bc89..41bd084 100644..100755
--- a/include/doc-data-util.h
+++ b/include/doc-data-util.h
@@ -21,6 +21,7 @@
#include <glib.h>
#include <string.h>
#include <media_content.h>
+#include <storage.h>
#include "doc-debug.h"
#include "doc-strings.h"
#include "doc-data-type.h"
diff --git a/src/doc-data-type.c b/src/doc-data-type.c
index 43fb99e..730fae3 100644..100755
--- a/src/doc-data-type.c
+++ b/src/doc-data-type.c
@@ -27,7 +27,6 @@ static int _doc_data_type_free_media(doc_media_s ** item)
/* For local medias */
if (tmp_item->media_h) {
if (tmp_item->b_create_thumb) {
- media_info_cancel_thumbnail(tmp_item->media_h);
tmp_item->b_create_thumb = false;
}
media_info_destroy(tmp_item->media_h);
diff --git a/src/doc-data-util.c b/src/doc-data-util.c
index 082d5a0..ac8e7be 100644..100755
--- a/src/doc-data-util.c
+++ b/src/doc-data-util.c
@@ -176,7 +176,6 @@ bool doc_data_util_clone_media(media_info_h media, doc_media_s ** pitem,
item = (doc_media_s *) calloc(1, sizeof(doc_media_s));
DOC_CHECK_FALSE(item);
item->gtype = DOC_TYPE_MEDIA;
- media_content_storage_e storage_type = 0;
if (media_info_clone(&(item->media_h), media) !=
MEDIA_CONTENT_ERROR_NONE) {
@@ -222,18 +221,24 @@ bool doc_data_util_clone_media(media_info_h media, doc_media_s ** pitem,
goto DOC_DATA_UTIL_FAILED;
} */
- if (media_info_get_storage_type(media, &storage_type) !=
- MEDIA_CONTENT_ERROR_NONE) {
+ char* root_directory_path;
+ if (storage_get_root_directory(0, &root_directory_path) == STORAGE_ERROR_NONE) // '0' is root path of media storage.
+ {
+ if (strncmp(item->file_url, root_directory_path, strlen(root_directory_path)) == 0) /* The device's internal storage */
+ {
+ item->storage_type = DOC_PHONE;
+ }
+ else /* The device's external storage */
+ {
+ item->storage_type = DOC_MMC;
+ }
+ }
+ else
+ {
doc_dbgE("Get storage type failed!");
goto DOC_DATA_UTIL_FAILED;
}
- if (storage_type == MEDIA_CONTENT_STORAGE_INTERNAL) { /* The device's internal storage */
- item->storage_type = DOC_PHONE;
- } else if (storage_type == MEDIA_CONTENT_STORAGE_EXTERNAL) { /* The device's external storage */
- item->storage_type = DOC_MMC;
- } else {
- doc_dbgE("Undefined mode[%d]!", storage_type);
- }
+ DOC_FREEIF(root_directory_path);
*pitem = item;
return true;
diff --git a/src/doc-local-data.c b/src/doc-local-data.c
index dcf618b..f20b424 100644..100755
--- a/src/doc-local-data.c
+++ b/src/doc-local-data.c
@@ -17,6 +17,7 @@
#include <stdio.h>
#include <media_content.h>
#include <media_info.h>
+#include <storage.h>
#include <glib.h>
#include <string.h>
#include "doc-data-util.h"
@@ -57,20 +58,24 @@ static bool _doc_local_data_clone_folder(media_folder_h folder,
goto DOC_LOCAL_FAILED;
}
- media_content_storage_e storage_type;
- if (media_folder_get_storage_type(folder, &storage_type) !=
- MEDIA_CONTENT_ERROR_NONE) {
+ char* root_directory_path;
+ if (storage_get_root_directory(0, &root_directory_path) == STORAGE_ERROR_NONE) // '0' is root path of media storage.
+ {
+ if (strncmp(tmp_folder->path, root_directory_path, strlen(root_directory_path)) == 0) /* The device's internal storage */
+ {
+ tmp_folder->type = DOC_PHONE;
+ }
+ else /* The device's external storage */
+ {
+ tmp_folder->type = DOC_MMC;
+ }
+ }
+ else
+ {
doc_dbgE("Get storage type failed!");
goto DOC_LOCAL_FAILED;
}
-
- if (storage_type == MEDIA_CONTENT_STORAGE_INTERNAL) { /* The device's internal storage */
- tmp_folder->type = DOC_PHONE;
- } else if (storage_type == MEDIA_CONTENT_STORAGE_EXTERNAL) { /* The device's external storage */
- tmp_folder->type = DOC_MMC;
- } else {
- doc_dbgE("Undefined mode[%d]!", storage_type);
- }
+ DOC_FREEIF(root_directory_path);
if (media_folder_get_name(folder, &(tmp_folder->display_name)) !=
MEDIA_CONTENT_ERROR_NONE) {