remove fatal to fail popup, show only one file that not in db
authorJisung Ahn <jcastle.ahn@samsung.com>
Mon, 1 Apr 2013 05:48:28 +0000 (14:48 +0900)
committerJisung Ahn <jcastle.ahn@samsung.com>
Mon, 1 Apr 2013 07:55:27 +0000 (16:55 +0900)
Change-Id: I5a0d8d5c7523914814a68ea4a0caa6f5330f7752

main/src/control/ivug-parameter.c
medialist/src/ivug-medialist.c

index 61a01bc..7cef9d3 100755 (executable)
@@ -419,6 +419,13 @@ ivug_param_create_from_bundle(service_h service)
                data->view_by = IVUG_VIEW_BY_INVAILD;
        }
 
+       media_handle file_handle = ivug_db_get_file_handle(data->filepath);
+       if(file_handle == NULL)
+       {
+               MSG_IVUG_ERROR("Current File = %s is not in DB", data->filepath);
+               data->view_by = IVUG_VIEW_BY_FILE;
+       }
+
 //parse image index at album
        char* val = NULL;
 
@@ -485,19 +492,28 @@ ivug_param_create_from_bundle(service_h service)
                **********************************
 */
                // Get album id from file path.
-               media_handle m_handle = ivug_db_get_folder_handle(ecore_file_dir_get(data->filepath));
-               if(m_handle == NULL)
-               {
-                       MSG_IVUG_ERROR("View by Folder. but media handle is NULL" );
-                       ivug_param_delete(data);
-                       return NULL;
-               }
+               char *dir = ivug_get_directory(data->filepath);
+               media_handle m_handle = ivug_db_get_folder_handle(dir);
+               free(dir);
 
-               data->album_id = ivug_db_get_folder_id(m_handle);
+               if(data->album_id == INVALID_UUID)
+               {
+                       if(m_handle == NULL)
+                       {
+                               MSG_IVUG_ERROR("View by Folder. but media handle is NULL" );
+                               //ivug_param_delete(data);
+                               //return NULL;
+                               data->view_by = IVUG_VIEW_BY_DIRECTORY; // check manually
+                       }
+                       else
+                       {
+                               data->album_id = ivug_db_get_folder_id(m_handle);
 
-               ivug_db_destroy_folder_handle(m_handle);
+                               ivug_db_destroy_folder_handle(m_handle);
 
-               MSG_IVUG_HIGH("Get Album ID(%s) from file %s", uuid_getchar(data->album_id), data->filepath);
+                               MSG_IVUG_HIGH("Get Album ID(%s) from file %s", uuid_getchar(data->album_id), data->filepath);
+                       }
+               }
        }
 
        service_get_extra_data (service, IVUG_BUNDLE_KEY_MEDIA_TYPE, &val);
@@ -678,6 +694,7 @@ Filter_struct *ivug_param_create_filter(const ivug_parameter *param)
        IV_ASSERT(filter_str != NULL);
 
        media_handle handle = NULL;
+       char *dir = NULL;
 
        if ( param->view_by == IVUG_VIEW_BY_DIRECTORY )
        {
@@ -741,8 +758,10 @@ Filter_struct *ivug_param_create_filter(const ivug_parameter *param)
                case IVUG_VIEW_BY_FOLDER:
                        if(param->album_id == NULL)
                        {
-                               handle = ivug_db_get_folder_handle(ecore_file_dir_get(param->filepath));
+                               dir = ivug_get_directory(param->filepath);
+                               handle = ivug_db_get_folder_handle(dir);
                                filter->album_id = ivug_db_get_folder_id(handle);
+                               free(dir);
                        }
                        else
                        {
index 9fcb73e..f0b8950 100755 (executable)
@@ -433,7 +433,7 @@ Media_Item *ivug_medialist_load(Media_List *mList, const Filter_struct *filter)
 
                if ( _mList->count == 0 )
                {
-                       MSG_SDATA_FATAL("No file founded");
+                       MSG_SDATA_ERROR("No file founded");
                        return NULL;
                }
 
@@ -461,7 +461,7 @@ Media_Item *ivug_medialist_load(Media_List *mList, const Filter_struct *filter)
                _mList->count = ivug_list_get_item_cnt(filter);
                if ( _mList->count == 0 )
                {
-                       MSG_SDATA_FATAL("No file founded");
+                       MSG_SDATA_ERROR("No file founded");
                        return NULL;
                }
                PERF_CHECK_BEGIN(LVL3, "MediaList - load all block");