[TSAM-12352] Added remaining space check for copy operation in time view 49/108549/1
authorRahul Dadhich <r.dadhich@samsung.com>
Thu, 5 Jan 2017 04:46:48 +0000 (10:16 +0530)
committerRahul Dadhich <r.dadhich@samsung.com>
Thu, 5 Jan 2017 04:47:23 +0000 (20:47 -0800)
Change-Id: I4c625eff229d08d4cd38c79b6627d76bce98b284
Signed-off-by: Rahul Dadhich <r.dadhich@samsung.com>
inc/util/gl-util.h
src/2dview/gl-timeline.c

index 1d816d7..2149b9f 100644 (file)
@@ -222,6 +222,8 @@ extern "C" {
        char *_gl_get_camera_folder_path_internal(void);
        char *_gl_get_camera_folder_path_external(void);
        char *_gl_get_downloads_folder_path(void);
+       void _gl_get_total_space_required(void *data,
+                                                                         unsigned long long *total_space);
 
 #ifdef __cplusplus
 }
index 21b0846..68eb7ce 100644 (file)
@@ -1962,6 +1962,27 @@ int __gl_timeline_move_copy(void *data)
         * 'move_album_id == NULL' is new album case,
         * other move/save to some existed album.
         */
+
+       unsigned long long free_size =
+                       gl_fs_get_free_space(GL_STORE_T_PHONE);
+       gl_dbg("Free space is %lld", free_size);
+
+       if (free_size == 0) {
+               gl_dbgW("Low memory.");
+               gl_popup_create_popup(ad, GL_POPUP_ALBUM_MEMORY_FULL,
+                               GL_DEVICE_MEMORY_FULL);
+               goto GL_FAILED;
+       }
+       unsigned long long total_space = 0;
+       _gl_get_total_space_required(ad, &total_space);
+       gl_dbgW("Total space required is : %lld .", total_space);
+       if (total_space > free_size) {
+               gl_dbgW("Low memory.");
+               gl_popup_create_popup(ad, GL_POPUP_ALBUM_MEMORY_FULL,
+                               GL_DEVICE_MEMORY_FULL);
+               goto GL_FAILED;
+       }
+
        if (ad->albuminfo.path == NULL) {
                gl_dbg("New album");
                if (gl_make_new_album(ad->albuminfo.new_name) == false) {