[TSAM-8956] Corrected the language change issue 83/92483/1
authorRahul Dadhich <r.dadhich@samsung.com>
Mon, 17 Oct 2016 06:57:22 +0000 (12:27 +0530)
committerRahul Dadhich <r.dadhich@samsung.com>
Mon, 17 Oct 2016 06:57:22 +0000 (12:27 +0530)
Change-Id: If17e4d007bb52b649cdbeff83c02df5adcdddb67
Signed-off-by: Rahul Dadhich <r.dadhich@samsung.com>
inc/util/gl-util.h
src/data/gl-data.c
src/util/gl-util.c

index 57e4d4acfb5084b206bc0d132d2aae4f8ac503be..9489f61a34ebb43de0c787b22628f8f3a0d35a83 100755 (executable)
@@ -228,6 +228,9 @@ char *_gl_get_directory_path(int storage_directory_type);
 char *_gl_get_root_directory_path(int storage_type);
 void _gl_set_launch_state_preference(void *data);
 bool _gl_get_launch_state_preference();
+char * _gl_get_camera_folder_path_internal(void);
+char * _gl_get_camera_folder_path_external(void);
+char *_gl_get_downloads_folder_path(void);
 
 #ifdef __cplusplus
 }
index aa94a9f6c09b02e803ea1d0c69781663549d00d9..2ab60f7803bf519f1cad43ed63f30338f6872102 100644 (file)
@@ -429,44 +429,24 @@ bool _gl_data_is_camera_album(gl_album_s *album)
 {
        GL_CHECK_FALSE(album);
        GL_CHECK_FALSE(album->display_name);
-
-#define GL_DCIM "DCIM"
        /* Name is 'Camera' folder locates in Phone */
        if (!g_strcmp0(album->display_name, GL_STR_ALBUM_CAMERA)) {
-               char *parent_path = (char *)calloc(1, GL_DIR_PATH_LEN_MAX);
-               GL_CHECK_FALSE(parent_path);
-
                char *root = NULL;
                if (album->type == GL_STORE_T_PHONE) {
-                       root = _gl_get_root_directory_path(STORAGE_TYPE_INTERNAL);
+                       root = _gl_get_camera_folder_path_internal();
                } else {
-                       root = _gl_get_root_directory_path(STORAGE_TYPE_EXTERNAL);
+                       root = _gl_get_camera_folder_path_external();
                }
 
                if (!root) {
-                       GL_GFREE(parent_path);
-                       return false;
-               }
-               gl_sdbg("Full path: %s", album->path);
-               _gl_data_util_get_file_dir_name(album->path, NULL, NULL,
-                                               parent_path);
-               gl_sdbg("Parent path: %s.", parent_path);
-
-               char *dcim_path = g_strdup_printf("%s/%s", root, GL_DCIM);
-               if (dcim_path == NULL) {
-                       GL_GFREE(parent_path);
                        return false;
                }
                /* And parent folder is Phone root path, it's default folder */
-               bool ret = false;
-               ret = !g_strcmp0(dcim_path, parent_path);
-
-               GL_GFREE(root);
-               GL_GFREE(parent_path);
-               GL_GFREE(dcim_path);
-               return ret;
+               if (!g_strcmp0(root, album->path)) {
+                       GL_GFREE(root);
+                       return true;
+               }
        }
-
        return false;
 }
 
index b34a18da34942d72f78e7af417aa7de933ac9cb5..3c83f72d15e158418e0681764996bba4bbeb335d 100644 (file)
@@ -47,6 +47,9 @@
 #include "gl-thumbs.h"
 #include "gl-data.h"
 
+static int __externalStorageId = -1;
+static int __internalStorageId = 0;
+
 #define GL_FILE_COPY_BUF_MAX 16384
 /* Time for displaying progressbar UI compeletely */
 #define GL_TIMER_INTERVAL_PBAR_SHOWED 0.5
@@ -107,6 +110,7 @@ bool __gl_util_get_supported_storages_callback(int storageId, storage_type_e typ
 
        gl_appdata *ad = (gl_appdata *)data;
        if (type == STORAGE_TYPE_EXTERNAL) {
+               __externalStorageId = storageId;
                ad->maininfo.externalStorageId = storageId;
                return false;
        }
@@ -2134,6 +2138,40 @@ char *_gl_get_edje_path(void)
        return strdup(edj_path);
 }
 
+static char *__gl_get_folder_path(int storage_id, int directory)
+{
+       char *path = NULL;
+               if (storage_id != -1) {
+                       char *path_camera = NULL;
+                       storage_get_directory(storage_id, directory, &path_camera);
+                       if (path_camera) {
+                               path = strdup(path_camera);
+                               GL_FREEIF(path_camera);
+                       } else {
+                               path = strdup("");
+                       }
+               } else {
+                       path = strdup("");
+               }
+               return path;
+}
+
+char * _gl_get_camera_folder_path_internal(void)
+{
+       return __gl_get_folder_path(__internalStorageId, STORAGE_DIRECTORY_CAMERA);
+}
+
+char * _gl_get_camera_folder_path_external(void)
+{
+       return __gl_get_folder_path(__externalStorageId, STORAGE_DIRECTORY_CAMERA);
+}
+
+char *_gl_get_downloads_folder_path(void)
+{
+       return __gl_get_folder_path(__internalStorageId, STORAGE_DIRECTORY_DOWNLOADS);
+}
+
+
 char *_gl_get_directory_path(int storage_directory_type)
 {
        char *path = NULL;