summaryrefslogtreecommitdiff
path: root/main/src/data/ivug-data-list.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/data/ivug-data-list.c')
-rwxr-xr-xmain/src/data/ivug-data-list.c282
1 files changed, 0 insertions, 282 deletions
diff --git a/main/src/data/ivug-data-list.c b/main/src/data/ivug-data-list.c
deleted file mode 100755
index 697b158..0000000
--- a/main/src/data/ivug-data-list.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include "ivug-main.h"
-#include "ivug-common.h"
-
-#include "ivug-data-priv.h"
-
-// List
-static int
-_ivug_list_count_cb(Mitem* item, void* user_data )
-{
- int *count = (int *)user_data;
-
- (*count)++;
-
- return 0;
-}
-
-//Eina List Function.
-static int
-_ivug_list_mitem_cb(Mitem* item, void* user_data )
-{
- IV_ASSERT(user_data != NULL);
- Eina_List **list = (Eina_List **)user_data;
-
- *list = eina_list_prepend(*list, item);
-
- return 0;
-}
-
-
-Eina_List *
-ivug_list_load_items(List_Filter *filter, int stp, int endp)
-{
- IV_ASSERT(filter != NULL);
-
- Eina_List *item_list = NULL;
-
- if (filter->view_by == IVUG_VIEW_BY_FILE)
- {
- Eina_List *list = NULL;
- Media_Data *mData = ivug_alloc_mediadata_from_filepath(filter->file_path);
-
- list = eina_list_append(list, mData);
- return list;
- }
-
-// TODO : Check idx validation.
- minfo_item_filter item_filter = {0, }; //create filter
-
- switch(filter->media_type)
- {
- case IVUG_MEDIA_TYPE_IMAGE:
- item_filter.file_type = MINFO_ITEM_IMAGE;
- break;
- case IVUG_MEDIA_TYPE_VIDEO:
- item_filter.file_type = MINFO_ITEM_VIDEO;
- break;
- case IVUG_MEDIA_TYPE_ALL:
- item_filter.file_type = MINFO_ITEM_IMAGE | MINFO_ITEM_VIDEO;
- break;
- default:
- MSG_SITEM_FATAL("Invalid media type : %d", filter->media_type);
- return NULL;
- break;
- }
-
- item_filter.favorite = MINFO_MEDIA_FAV_ALL;
-
- if(filter->view_by == IVUG_VIEW_BY_PLACES)
- {
- item_filter.sort_type = MINFO_MEDIA_SORT_BY_NAME_ASC;
- }
- else
- {
- item_filter.sort_type = MINFO_MEDIA_SORT_BY_DATE_DESC; //MINFO_MEDIA_SORT_BY_NAME_ASC; //minfo_media_sort_type
- }
-
- item_filter.start_pos = stp;
- item_filter.end_pos = endp;
- item_filter.with_meta = false;
-
- int ret = MB_SVC_ERROR_NONE;
-
- switch(filter->view_by)
- {
- case IVUG_VIEW_BY_FOLDER:
- ret = minfo_get_item_list(gGetMediaSVCHandle(), filter->album_id, item_filter, _ivug_list_mitem_cb, &item_list);
- break;
-
- case IVUG_VIEW_BY_ALL:
- ret = minfo_get_all_item_list(gGetMediaSVCHandle(), MINFO_CLUSTER_TYPE_LOCAL_ALL, item_filter, _ivug_list_mitem_cb, &item_list);
- break;
-
- case IVUG_VIEW_BY_PLACES:
- ret = minfo_get_geo_item_list(gGetMediaSVCHandle(), INVALID_UUID, MINFO_CLUSTER_TYPE_LOCAL_ALL, item_filter,
- filter->place.min_longitude, filter->place.max_longitude,
- filter->place.min_latitude, filter->place.max_latitude,
- _ivug_list_mitem_cb, &item_list); // NULL means query all folder
- break;
- default:
- MSG_SDATA_FATAL("Invalid Mode=%d", filter->view_by);
- return NULL;
- }
-
- if ( ret != MB_SVC_ERROR_NONE )
- {
- MSG_SDATA_ERROR("[%s] Error=%d VieBy=%d", __func__, ret, filter->view_by);
- return NULL;
- }
-
-// Creating media_list.
- Eina_List *slide_list = NULL;
-
- Eina_List *item;
- Mitem* mitem;
-
- Media_Data *mdata = NULL;
-
- EINA_LIST_FOREACH(item_list, item, mitem)
- {
- mdata = ivug_alloc_mediadata_from_mitem(mitem);
-
- IV_ASSERT(mdata != NULL);
-
- MSG_SDATA_LOW("Add Mdata. Mdata=0x%08x %s", mdata, mdata->filepath);
- slide_list = eina_list_prepend(slide_list, mdata);
- }
-
- EINA_LIST_FREE(item_list, mitem)
- {
- minfo_destroy_mtype_item(mitem);
- }
-
- eina_list_free(item_list);
-
- MSG_SDATA_HIGH("Item loaded(%d~%d)", stp, endp);
-
- return slide_list;
-}
-
-
-int
-ivug_list_get_item_cnt(List_Filter *filter)
-{
- IV_ASSERT(filter != NULL);
-
-// TODO : Check idx validation.
- minfo_item_filter item_filter = {0, }; //create filter
-
- switch(filter->media_type)
- {
- case IVUG_MEDIA_TYPE_IMAGE:
- item_filter.file_type = MINFO_ITEM_IMAGE;
- break;
- case IVUG_MEDIA_TYPE_VIDEO:
- item_filter.file_type = MINFO_ITEM_VIDEO;
- break;
- case IVUG_MEDIA_TYPE_ALL:
- item_filter.file_type = MINFO_ITEM_IMAGE | MINFO_ITEM_VIDEO;
- break;
- default:
- MSG_SITEM_FATAL("Invalid media type : %d", filter->media_type);
- return -1;
- break;
- }
-
- item_filter.favorite = MINFO_MEDIA_FAV_ALL;
-
- if(filter->view_by == IVUG_VIEW_BY_PLACES)
- {
- item_filter.sort_type = MINFO_MEDIA_SORT_BY_NAME_ASC;
- }
- else
- {
- item_filter.sort_type = MINFO_MEDIA_SORT_BY_DATE_DESC; //MINFO_MEDIA_SORT_BY_NAME_ASC; //minfo_media_sort_type
- }
-
- item_filter.start_pos = -1;
- item_filter.end_pos = -1;
- item_filter.with_meta = false;
-
- int ret = MB_SVC_ERROR_NONE;
-
- int count = 0;
-
- switch(filter->view_by)
- {
- case IVUG_VIEW_BY_ALL :
- ret = minfo_get_item_cnt(gGetMediaSVCHandle(), filter->album_id, item_filter, &count);
- if(ret < 0)
- {
- MSG_SDATA_ERROR("Error! AlbumUUID=%s Ret=%d", uuid_getchar(filter->album_id), ret );
- return -1;
- }
-
- MSG_SDATA_HIGH("IVUG_VIEW_BY_ALL. MediaType=%d Count=%d", filter->media_type, count);
- return count;
- break;
-
-/* minfo_get_geo_item_list doesn't provide minfo get count api */
-/* So get total count menually by list callback function */
- case IVUG_VIEW_BY_PLACES:
- ret = minfo_get_geo_item_list(gGetMediaSVCHandle(), INVALID_UUID, MINFO_CLUSTER_TYPE_LOCAL_ALL, item_filter,
- filter->place.min_longitude, filter->place.max_longitude,
- filter->place.min_latitude, filter->place.max_latitude,
- _ivug_list_count_cb, &count); // NULL means query all folder
-
- if (ret < 0)
- {
- MSG_SDATA_ERROR("minfo_get_geo_item_list ERROR");
- return -1;
- }
-
- MSG_SDATA_HIGH("IVUG_VIEW_BY_PLACES. Count=%d", count);
- return count;
-
- break;
- case IVUG_VIEW_BY_FOLDER:
- ret = minfo_get_item_cnt(gGetMediaSVCHandle(), filter->album_id, item_filter, &count);
- if(ret < 0)
- {
- MSG_SDATA_ERROR("Error! AlbumUUID=%s Ret=%d", uuid_getchar(filter->album_id), ret );
- return -1;
- }
- MSG_SDATA_HIGH("IVUG_VIEW_BY_FOLDER. Count=%d", count);
- return count;
-
- break;
-
- case IVUG_VIEW_BY_FILE:
- return 1; // item count is always 1 when by file
- break;
-
- default:
- MSG_SDATA_ERROR("Unhandled view_by : %d", filter->view_by);
- break;
- }
-
- return -1;
-}
-
-
-void ivug_list_delete_items(Eina_List *items)
-{
- Media_Data* mdata;
-
- if ( items == NULL )
- {
- MSG_SDATA_HIGH("Item list is NULL.");
- return;
- }
-
- MSG_SDATA_HIGH("Removing items");
-
- EINA_LIST_FREE(items, mdata)
- {
- if(mdata == NULL)
- {
- MSG_IVUG_ERROR("media list is NULL, can not free all media list");
- }
- else
- {
- ivug_free_mediadata(mdata);
- }
- }
-}