diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/attach-panel-document.c | 63 | ||||
-rw-r--r-- | src/doc-data-type.c | 22 | ||||
-rw-r--r-- | src/doc-data-util.c | 48 | ||||
-rw-r--r-- | src/doc-data.c | 22 | ||||
-rw-r--r-- | src/doc-db-update.c | 12 | ||||
-rw-r--r-- | src/doc-list.c | 184 | ||||
-rw-r--r-- | src/doc-local-data.c | 66 | ||||
-rw-r--r-- | src/doc-ui-util.c | 27 |
9 files changed, 191 insertions, 256 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7465c08..bfa8c05 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(ug-attach-panel-document C) -#SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(LIBDIR "${PREFIX1}/lib") SET(VERSION 0.0.1) @@ -19,7 +18,6 @@ SET(SRCS doc-ui-util.c ) - INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/) INCLUDE(FindPkgConfig) @@ -60,4 +58,3 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} "-ldl") # install binary INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR}) -#INSTALL(DIRECTORY ${ICONDIR} DESTINATION ${PREFIX1}/res/images/ug-attach-panel-document) diff --git a/src/attach-panel-document.c b/src/attach-panel-document.c index f9da8df..438d0cb 100644 --- a/src/attach-panel-document.c +++ b/src/attach-panel-document.c @@ -117,28 +117,10 @@ static int _doc_view_initialize(doc_ugdata *ugd) ugd->bg = _doc_create_bg(ugd->ly_main); DOC_CHECK_VAL(ugd->bg, -1); - /* Pack bg to swallow */ - elm_object_part_content_set(ugd->ly_main, "elm.swallow.bg", ugd->bg); - /* Navigation Bar */ ugd->naviframe = doc_ui_create_naviframe(ugd, ugd->ly_main); DOC_CHECK_VAL(ugd->naviframe, -1); - doc_dbgE("base view is pushed in the naviframe instead of content set"); - - - - ugd->nf_it = elm_naviframe_item_push(ugd->naviframe, "first naviframe bg", NULL, NULL, ugd->bg, NULL); - - - - if (ugd->nf_it != NULL) { - doc_dbgE("base view is push successfully in the nf"); - } else { - doc_dbgE("base view failed to push in nf "); - } - - /* List view and its layout */ if (_doc_create_main_view(ugd) != 0) { doc_dbgE("Creating list view and layout failed!"); @@ -202,7 +184,7 @@ static int _doc_close_view(doc_ugdata *ugd) ugd->th = NULL; } #ifdef _USE_HIDE_INDICATOR - _ge_ui_reset_indicator(ugd); + _doc_ui_reset_indicator(ugd); #endif /************* Free data **************/ @@ -278,7 +260,7 @@ static int _doc_parse_param(doc_ugdata *ugd, app_control_h service) #ifdef FEATURE_SIZE_CHECK char *total_size = NULL; - int ret = app_control_get_extra_data(service, "http://tizen.org/appcontrol/data/total_size", &(total_size)); + int ret = app_control_get_extra_data(service, APP_CONTROL_DATA_TOTAL_SIZE, &(total_size)); if (ret != APP_CONTROL_ERROR_NONE) { if(total_size) { ugd->limitsize = atol(total_size); @@ -564,9 +546,7 @@ static void _doc_message(ui_gadget_h ug, app_control_h msg, app_control_h servic if (display_mode) { if (!strcmp(display_mode, "single")) { doc_dbg("single_selection "); - if (ugd->nocontents) {//[ToDo] Really needed ?? - elm_gengrid_item_size_set(ugd->thumbs_d->genlist, win_w, win_h / 3); - } + ugd->attach_panel_display_mode = ATTACH_PANEL_HALF_MODE; ugd->file_select_mode = DOC_FILE_SELECT_T_ONE; ugd->b_multifile = false; @@ -576,11 +556,11 @@ static void _doc_message(ui_gadget_h ug, app_control_h msg, app_control_h servic elm_genlist_realized_items_update(ugd->thumbs_d->genlist); Eina_List *l = NULL; - doc_item *gitem = NULL; + doc_item *ditem = NULL; - EINA_LIST_FOREACH(ugd->thumbs_d->medias_elist, l, gitem) { - if (gitem) { - gitem->checked = false; + EINA_LIST_FOREACH(ugd->thumbs_d->medias_elist, l, ditem) { + if (ditem) { + ditem->checked = false; } } @@ -592,13 +572,7 @@ static void _doc_message(ui_gadget_h ug, app_control_h msg, app_control_h servic elm_naviframe_item_title_enabled_set(ugd->nf_it, EINA_FALSE, EINA_FALSE); } else if (display_mode && !strcmp(display_mode, "multiple")) { doc_dbg("multiple_selection"); - if (ugd->nocontents) { - if (ugd->rotate_mode == DOC_ROTATE_LANDSCAPE_UPSIDEDOWN || ugd->rotate_mode == DOC_ROTATE_LANDSCAPE) {//Chanadan:: Check for landscape behaviour for genlist - elm_gengrid_item_size_set(ugd->thumbs_d->genlist, win_h, LANDSCAPE_HEIGHT); - } else { - //elm_gengrid_item_size_set(ugd->thumbs_d->genlist, win_w, FULL_MODE_PORTRAIT_HEIGHT); - } - } + ugd->attach_panel_display_mode = ATTACH_PANEL_FULL_MODE; ugd->file_select_mode = DOC_FILE_SELECT_T_MULTIPLE; ugd->b_multifile = true; @@ -607,7 +581,6 @@ static void _doc_message(ui_gadget_h ug, app_control_h msg, app_control_h servic elm_genlist_realized_items_update(ugd->thumbs_d->genlist); - ugd->thumbs_d->tot_selected = 0; /*Update Title*/ elm_naviframe_item_title_enabled_set(ugd->nf_it, EINA_TRUE, EINA_FALSE); text = g_strdup_printf(pd_selected, ugd->thumbs_d->tot_selected); @@ -692,26 +665,6 @@ UG_ROTATE_EVENT: int win_h = 0; elm_win_screen_size_get(ugd->win, &win_x, &win_y, &win_w, &win_h); -// int size = (win_w / 4); -// int landscape_size = (win_h / 7); - - if (ugd->rotate_mode == DOC_ROTATE_LANDSCAPE_UPSIDEDOWN || ugd->rotate_mode == DOC_ROTATE_LANDSCAPE) { - if (ugd->nocontents) { - elm_gengrid_item_size_set(ugd->thumbs_d->genlist, win_h, LANDSCAPE_HEIGHT); - } else { - //elm_gengrid_item_size_set(ugd->thumbs_d->genlist, landscape_size, landscape_size); - } - } else { - if (ugd->nocontents) { - if (ugd->attach_panel_display_mode == ATTACH_PANEL_FULL_MODE) { - elm_gengrid_item_size_set(ugd->thumbs_d->genlist, win_w, FULL_MODE_PORTRAIT_HEIGHT); - } else { - elm_gengrid_item_size_set(ugd->thumbs_d->genlist, win_w, HALF_MODE_PORTRAIT_HEIGHT); - } - } else { - //elm_gengrid_item_size_set(ugd->thumbs_d->genlist, size, size); - } - } } /** diff --git a/src/doc-data-type.c b/src/doc-data-type.c index 7031779..9dc4893 100644 --- a/src/doc-data-type.c +++ b/src/doc-data-type.c @@ -43,28 +43,28 @@ static int _doc_data_type_free_media(doc_media_s **item) return 0; } -static int _doc_data_type_free_album(doc_folder_s **album) +static int _doc_data_type_free_folder(doc_folder_s **folder) { - DOC_CHECK_VAL(album, -1); - DOC_CHECK_VAL(*album, -1); - doc_folder_s *tmp_album = *album; + DOC_CHECK_VAL(folder, -1); + DOC_CHECK_VAL(*folder, -1); + doc_folder_s *tmp_folder = *folder; - DOC_FREEIF(tmp_album->uuid); - DOC_FREEIF(tmp_album->display_name); - DOC_FREEIF(tmp_album->path); - DOC_FREE(tmp_album); - *album = NULL; + DOC_FREEIF(tmp_folder->uuid); + DOC_FREEIF(tmp_folder->display_name); + DOC_FREEIF(tmp_folder->path); + DOC_FREE(tmp_folder); + *folder = NULL; return 0; } -int doc_data_type_free_geitem(void **item) +int doc_data_type_free_item(void **item) { DOC_CHECK_VAL(item, -1); DOC_CHECK_VAL(*item, -1); int ret = -1; if (((doc_folder_s *)*item)->gtype == DOC_TYPE_FOLDER) { - ret = _doc_data_type_free_album((doc_folder_s **)item); + ret = _doc_data_type_free_folder((doc_folder_s **)item); } else if (((doc_media_s *)*item)->gtype == DOC_TYPE_MEDIA || ((doc_media_s *)*item)->gtype == DOC_TYPE_WEB_MEDIA) { ret = _doc_data_type_free_media((doc_media_s **)item); diff --git a/src/doc-data-util.c b/src/doc-data-util.c index 406f50a..5fd0f3e 100644 --- a/src/doc-data-util.c +++ b/src/doc-data-util.c @@ -18,26 +18,26 @@ #include "doc-data-util.h" /* -* create a gitem +* create a doc_item */ -doc_item *doc_data_util_calloc_geitem(void) +doc_item *doc_data_util_calloc_item(void) { - doc_item *gitem = (doc_item*)calloc(1, sizeof(doc_item)); - DOC_CHECK_NULL(gitem); - return gitem; + doc_item *ditem = (doc_item*)calloc(1, sizeof(doc_item)); + DOC_CHECK_NULL(ditem); + return ditem; } /* * destroy a doc_item */ -static int _doc_data_util_free_geitem(doc_item* gitem) +static int _doc_data_util_free_item(doc_item* ditem) { - if (gitem) { - if (gitem->item) { - doc_data_type_free_geitem((void **)&(gitem->item)); - gitem->item = NULL; + if (ditem) { + if (ditem->item) { + doc_data_type_free_item((void **)&(ditem->item)); + ditem->item = NULL; } - DOC_FREE(gitem); + DOC_FREE(ditem); } return 0; } @@ -50,7 +50,7 @@ int doc_data_util_free_mtype_items(Eina_List **elist) doc_dbg("Clear Mitems list."); EINA_LIST_FREE(*elist, current) { if (current) { - doc_data_type_free_geitem((void **)¤t); + doc_data_type_free_item((void **)¤t); current = NULL; } } @@ -61,27 +61,27 @@ int doc_data_util_free_mtype_items(Eina_List **elist) return 0; } -int doc_data_util_free_item(doc_item *gitem) +int doc_data_util_free_item(doc_item *item) { - DOC_CHECK_VAL(gitem, -1); + DOC_CHECK_VAL(item, -1); - _doc_data_util_free_geitem(gitem); + _doc_data_util_free_item(item); return 0; } /* -* Create a gitem for selected item +* Create a doc_item for selected item */ -doc_sel_item_s* doc_data_util_new_sel_item(doc_item *gitem) +doc_sel_item_s* doc_data_util_new_sel_item(doc_item *ditem) { - DOC_CHECK_NULL(gitem); - DOC_CHECK_NULL(gitem->item); + DOC_CHECK_NULL(ditem); + DOC_CHECK_NULL(ditem->item); doc_sel_item_s *item = (doc_sel_item_s *)calloc(1, sizeof(doc_sel_item_s)); DOC_CHECK_NULL(item); - item->uuid = strdup(gitem->item->uuid); - item->file_url = strdup(gitem->item->file_url); - item->store_type = gitem->store_type; - item->sequence = gitem->sequence; + item->uuid = strdup(ditem->item->uuid); + item->file_url = strdup(ditem->item->file_url); + item->store_type = ditem->store_type; + item->sequence = ditem->sequence; return item; } @@ -228,7 +228,7 @@ bool doc_data_util_clone_media(media_info_h media, doc_media_s **pitem, DOC_DATA_UTIL_FAILED: - doc_data_type_free_geitem((void **)(&item)); + doc_data_type_free_item((void **)(&item)); return false; } diff --git a/src/doc-data.c b/src/doc-data.c index d843af6..080c32d 100644 --- a/src/doc-data.c +++ b/src/doc-data.c @@ -134,31 +134,31 @@ int doc_data_get_media_data(doc_ugdata *ugd, int type, int start_pos, if ((err == 0) && (itemlist != NULL)) { doc_media_s *item = NULL; - doc_item* gitem = NULL; + doc_item* ditem = NULL; EINA_LIST_FREE(itemlist, item) { if (item == NULL || item->uuid == NULL) { doc_dbgE("Invalid item!"); continue; } - gitem = doc_data_util_calloc_geitem(); - if (gitem == NULL) { - doc_dbgE("doc_data_util_calloc_geitem() failed"); - doc_data_type_free_geitem((void **)&item); + ditem = doc_data_util_calloc_item(); + if (ditem == NULL) { + doc_dbgE("doc_data_util_calloc_item() failed"); + doc_data_type_free_item((void **)&item); continue; } - gitem->item = item; - gitem->ugd = ugd; - gitem->store_type = type; + ditem->item = item; + ditem->ugd = ugd; + ditem->store_type = type; *pmedias_elist = eina_list_append(*pmedias_elist, - gitem); + ditem); if (restore_cb && sel_id) { - restore_cb(sel_id, gitem); + restore_cb(sel_id, ditem); } item = NULL; - gitem = NULL; + ditem = NULL; } } else { /* Free Mitems */ diff --git a/src/doc-db-update.c b/src/doc-db-update.c index c983834..0641b24 100644 --- a/src/doc-db-update.c +++ b/src/doc-db-update.c @@ -106,13 +106,13 @@ static int _doc_db_update_op(media_content_error_e error, int pid, !strcmp(path, DOC_ROOT_PATH_MMC)) { doc_dbg("MMC insert or remove!"); } else if (path) { - doc_folder_s *album = NULL; - doc_local_data_get_folder_by_path(path, &album); - if (!album) { + doc_folder_s *folder = NULL; + doc_local_data_get_folder_by_path(path, &folder); + if (!folder) { return -1; } else { - doc_data_type_free_geitem((void **)&album); - doc_dbgW("Updated album contains images"); + doc_data_type_free_item((void **)&folder); + doc_dbgW("Updated folder contains document"); } } else { return -1; @@ -172,7 +172,7 @@ bool doc_db_update_finalize(doc_ugdata *ugd) ret = media_content_unset_db_updated_cb(); if (ret != MEDIA_CONTENT_ERROR_NONE) { - doc_dbgE("UNSet db updated cb failed[%d]!", ret); + doc_dbgE("Unset db updated cb failed[%d]!", ret); } DOC_CHECK_FALSE(ugd); diff --git a/src/doc-list.c b/src/doc-list.c index 8208169..5d330cf 100644 --- a/src/doc-list.c +++ b/src/doc-list.c @@ -72,7 +72,7 @@ static Eina_Bool _data_list_back_cb(void *data, Elm_Object_Item *it) DOC_CHECK_FALSE(data); doc_ugdata *ugd = (doc_ugdata *)data; Eina_List *l = NULL; - doc_item *gitem = NULL; + doc_item *item = NULL; void *pop_cb = evas_object_data_get(ugd->naviframe, DOC_NAVIFRAME_POP_CB_KEY); @@ -100,9 +100,9 @@ static Eina_Bool _data_list_back_cb(void *data, Elm_Object_Item *it) doc_dbg("ug_destroy_me"); } - EINA_LIST_FOREACH(ugd->thumbs_d->medias_elist, l, gitem) { - if (gitem) { - gitem->checked = false; + EINA_LIST_FOREACH(ugd->thumbs_d->medias_elist, l, item) { + if (item) { + item->checked = false; } } @@ -200,11 +200,11 @@ static void _doc_list_check_state_changed_cb(void *data, Evas_Object *obj, void { DOC_CHECK(obj); DOC_CHECK(data); - doc_item *gitem = (doc_item *)data; - DOC_CHECK(gitem->item); - DOC_CHECK(gitem->item->file_url); - DOC_CHECK(gitem->ugd); - doc_ugdata *ugd = gitem->ugd; + doc_item *item = (doc_item *)data; + DOC_CHECK(item->item); + DOC_CHECK(item->item->file_url); + DOC_CHECK(item->ugd); + doc_ugdata *ugd = item->ugd; DOC_CHECK(ugd->service); DOC_CHECK(ugd->thumbs_d); Eina_List *l = NULL; @@ -212,14 +212,14 @@ static void _doc_list_check_state_changed_cb(void *data, Evas_Object *obj, void doc_sel_item_s *sit1 = NULL; Eina_Bool state = elm_check_state_get(obj); - sit = doc_data_util_new_sel_item(gitem); + sit = doc_data_util_new_sel_item(item); DOC_CHECK(sit); #ifdef FEATURE_SIZE_CHECK struct stat stFileInfo; stat(sit->file_url, &stFileInfo); #endif if (state == EINA_TRUE) { - if (!g_strcmp0(gitem->item->thumb_url, DEFAULT_THUMBNAIL)) { + if (!g_strcmp0(item->item->thumb_url, DEFAULT_THUMBNAIL)) { elm_check_state_set(obj, EINA_FALSE); char *pStrWarning = g_strdup_printf( DOC_STR_UNSUPPORTED_FILE); @@ -228,7 +228,7 @@ static void _doc_list_check_state_changed_cb(void *data, Evas_Object *obj, void doc_data_util_free_sel_item(sit); return; } - if ((ugd->max_count != -1) && (gitem->ugd->thumbs_d->tot_selected + 1 > ugd->max_count)) { + if ((ugd->max_count != -1) && (item->ugd->thumbs_d->tot_selected + 1 > ugd->max_count)) { elm_check_state_set(obj, EINA_FALSE); char *noti_str = DOC_STR_MAX_PICTURES_SELECTED; char *pStrWarning = g_strdup_printf( @@ -242,7 +242,7 @@ static void _doc_list_check_state_changed_cb(void *data, Evas_Object *obj, void #ifdef FEATURE_SIZE_CHECK if (ugd->limitsize > 0 && ugd->selsize + stFileInfo.st_size > ugd->limitsize) { elm_check_state_set(obj, EINA_FALSE); - notification_status_message_post("maximum of 2MB can be selected"); + notification_status_message_post("Maximum Selection Exceeded."); doc_data_util_free_sel_item(sit); return; } @@ -253,7 +253,7 @@ static void _doc_list_check_state_changed_cb(void *data, Evas_Object *obj, void #ifdef FEATURE_SIZE_CHECK ugd->selsize += stFileInfo.st_size; #endif - gitem->checked = TRUE; + item->checked = TRUE; } else { doc_sdbg("remove Path: %s", sit->file_url); EINA_LIST_FOREACH(ugd->selected_elist, l, sit1) { @@ -266,7 +266,7 @@ static void _doc_list_check_state_changed_cb(void *data, Evas_Object *obj, void #ifdef FEATURE_SIZE_CHECK ugd->selsize -= stFileInfo.st_size; #endif - gitem->checked = FALSE; + item->checked = FALSE; doc_data_util_free_sel_item(sit); } @@ -745,24 +745,24 @@ const char* _document_file_attr_get_default_icon_by_type(fsFileType ftype) static Evas_Object* _doc_list_item_content_get(void *data, Evas_Object *obj, const char *part) { - doc_item *gitem = NULL; + doc_item *item = NULL; if (strlen(part) <= 0) { doc_dbgE("part length <= 0"); return NULL; } - gitem = (doc_item*)data; - DOC_CHECK_NULL(gitem->item); - DOC_CHECK_NULL(gitem->ugd); - doc_ugdata *ugd = gitem->ugd; + item = (doc_item*)data; + DOC_CHECK_NULL(item->item); + DOC_CHECK_NULL(item->ugd); + doc_ugdata *ugd = item->ugd; DOC_CHECK_NULL(ugd->thumbs_d); Evas_Object *layout = NULL; if (!g_strcmp0(part, "elm.swallow.icon")) { fsFileType type = FILE_TYPE_NONE; - _document_file_category(gitem->item->file_url, &type); + _document_file_category(item->item->file_url, &type); const char *thumb = _document_file_attr_get_default_icon_by_type(type); layout = _doc_list_show_thumb(obj, thumb); @@ -776,10 +776,10 @@ static Evas_Object* _doc_list_item_content_get(void *data, Evas_Object *obj, con evas_object_propagate_events_set(ck, EINA_FALSE); evas_object_repeat_events_set(ck, EINA_FALSE); - elm_check_state_set(ck, gitem->checked); + elm_check_state_set(ck, item->checked); ugd->thumbs_d->check = ck; evas_object_smart_callback_add(ck, "changed", - _doc_list_check_state_changed_cb, gitem); + _doc_list_check_state_changed_cb, item); evas_object_show(ck); return ck; @@ -790,26 +790,26 @@ static Evas_Object* _doc_list_item_content_get(void *data, Evas_Object *obj, con static char* _doc_list_text_get_cb(void *data, Evas_Object *obj, const char *part) { - doc_item *gitem = (doc_item*)data; - DOC_CHECK_NULL(gitem->item); - DOC_CHECK_NULL(gitem->ugd); - doc_ugdata *ugd = gitem->ugd; + doc_item *ditem = (doc_item*)data; + DOC_CHECK_NULL(ditem->item); + DOC_CHECK_NULL(ditem->ugd); + doc_ugdata *ugd = ditem->ugd; DOC_CHECK_NULL(ugd->thumbs_d); - return strdup(gitem->item->display_name); + return strdup(ditem->item->display_name); } -static int _doc_list_select_one(doc_item *gitem, char *file_url) +static int _doc_list_select_one(doc_item *ditem, char *file_url) { DOC_CHECK_VAL(file_url, -1); - DOC_CHECK_VAL(gitem, -1); - doc_ugdata *ugd = (doc_ugdata *)gitem->ugd; + DOC_CHECK_VAL(ditem, -1); + doc_ugdata *ugd = (doc_ugdata *)ditem->ugd; DOC_CHECK_VAL(ugd, -1); doc_sdbg("Service add:%s", file_url); int ret = -1; - if (!g_strcmp0(gitem->item->thumb_url, DEFAULT_THUMBNAIL)) { + if (!g_strcmp0(ditem->item->thumb_url, DEFAULT_THUMBNAIL)) { char *pStrWarning = g_strdup_printf(DOC_STR_UNSUPPORTED_FILE); notification_status_message_post(pStrWarning); DOC_FREE(pStrWarning); @@ -853,10 +853,10 @@ static void _doc_list_item_sel_cb(void *data, Evas_Object *obj, void *ei) { DOC_CHECK(data); - doc_item *gitem = (doc_item*)data; - DOC_CHECK(gitem->item); - DOC_CHECK(gitem->ugd); - doc_ugdata *ugd = gitem->ugd; + doc_item *ditem = (doc_item*)data; + DOC_CHECK(ditem->item); + DOC_CHECK(ditem->ugd); + doc_ugdata *ugd = ditem->ugd; char *pd_selected = DOC_STR_PD_SELECTED; char *text = NULL; Evas_Object *btn = NULL; @@ -867,7 +867,7 @@ static void _doc_list_item_sel_cb(void *data, Evas_Object *obj, void *ei) elm_genlist_item_selected_set(ei, EINA_FALSE); if (ugd->file_select_mode == DOC_FILE_SELECT_T_ONE) { - int ret = _doc_list_select_one(gitem, gitem->item->file_url); + int ret = _doc_list_select_one(ditem, ditem->item->file_url); if (ret != 0) { doc_dbgE("Data Transfer Failed."); @@ -878,14 +878,14 @@ static void _doc_list_item_sel_cb(void *data, Evas_Object *obj, void *ei) Eina_Bool bl = elm_check_state_get(ck); if (bl == EINA_FALSE) { - if (!g_strcmp0(gitem->item->thumb_url, DEFAULT_THUMBNAIL)) { + if (!g_strcmp0(ditem->item->thumb_url, DEFAULT_THUMBNAIL)) { char *pStrWarning = g_strdup_printf( DOC_STR_UNSUPPORTED_FILE); notification_status_message_post(pStrWarning); DOC_FREE(pStrWarning); return; } - if ((ugd->max_count != -1) && (gitem->ugd->thumbs_d->tot_selected + 1 > ugd->max_count)) { + if ((ugd->max_count != -1) && (ditem->ugd->thumbs_d->tot_selected + 1 > ugd->max_count)) { char *noti_str = DOC_STR_MAX_PICTURES_SELECTED; char *pStrWarning = g_strdup_printf(noti_str, ugd->max_count); @@ -893,7 +893,7 @@ static void _doc_list_item_sel_cb(void *data, Evas_Object *obj, void *ei) DOC_FREE(pStrWarning); return; } - sit = doc_data_util_new_sel_item(gitem); + sit = doc_data_util_new_sel_item(ditem); if (!sit) { doc_dbgE("Invalid select item"); return; @@ -902,21 +902,21 @@ static void _doc_list_item_sel_cb(void *data, Evas_Object *obj, void *ei) struct stat stFileInfo; stat(sit->file_url, &stFileInfo); if (ugd->limitsize > 0 && ugd->selsize + stFileInfo.st_size > ugd->limitsize) { - notification_status_message_post("maximum of 2MB can be selected"); + notification_status_message_post("Maximum Selection Exceeded."); doc_data_util_free_sel_item(sit); return; } #endif - doc_sdbg("append Path: %s", sit->file_url); + doc_sdbg("Append path: %s", sit->file_url); ugd->selected_elist = eina_list_append(ugd->selected_elist, sit); elm_check_state_set(ck, EINA_TRUE); - gitem->ugd->thumbs_d->tot_selected++; + ditem->ugd->thumbs_d->tot_selected++; #ifdef FEATURE_SIZE_CHECK ugd->selsize += stFileInfo.st_size; #endif - gitem->checked = TRUE; + ditem->checked = TRUE; } else { - sit = doc_data_util_new_sel_item(gitem); + sit = doc_data_util_new_sel_item(ditem); if (!sit) { doc_dbgE("Invalid select item"); return; @@ -933,11 +933,11 @@ static void _doc_list_item_sel_cb(void *data, Evas_Object *obj, void *ei) } } elm_check_state_set(ck, EINA_FALSE); - gitem->ugd->thumbs_d->tot_selected--; + ditem->ugd->thumbs_d->tot_selected--; #ifdef FEATURE_SIZE_CHECK ugd->selsize -= stFileInfo.st_size; #endif - gitem->checked = FALSE; + ditem->checked = FALSE; doc_data_util_free_sel_item(sit); } @@ -952,9 +952,9 @@ static void _doc_list_item_sel_cb(void *data, Evas_Object *obj, void *ei) elm_object_disabled_set(btn, EINA_FALSE); } - if (gitem->ugd->thumbs_d->tot_selected >= 0) { - text = g_strdup_printf(pd_selected, gitem->ugd->thumbs_d->tot_selected); - elm_object_item_text_set(gitem->ugd->nf_it, text); + if (ditem->ugd->thumbs_d->tot_selected >= 0) { + text = g_strdup_printf(pd_selected, ditem->ugd->thumbs_d->tot_selected); + elm_object_item_text_set(ditem->ugd->nf_it, text); } } } @@ -963,7 +963,7 @@ static void _doc_list_navi_cancel_cb(void *data, Evas_Object *obj, void *ei) { doc_ugdata *app_data = (doc_ugdata *)data; Eina_List *l = NULL; - doc_item *gitem = NULL; + doc_item *ditem = NULL; if (app_data->is_attach_panel && (app_data->attach_panel_display_mode == ATTACH_PANEL_FULL_MODE)) { @@ -979,9 +979,9 @@ static void _doc_list_navi_cancel_cb(void *data, Evas_Object *obj, void *ei) app_control_destroy(app_control); } - EINA_LIST_FOREACH(app_data->thumbs_d->medias_elist, l, gitem) { - if (gitem) { - gitem->checked = false; + EINA_LIST_FOREACH(app_data->thumbs_d->medias_elist, l, ditem) { + if (ditem) { + ditem->checked = false; } } @@ -1012,6 +1012,10 @@ static void _doc_list_move_stop_cb(void *data, Evas_Object *obj, void *ei) int ret; elm_scroller_region_get(obj, &x, &y, &w, &h); + if (ugd->thumbs_d) { + ugd->thumbs_d->tot_selected = 0; + } + app_control_h app_control = NULL; ret = app_control_create(&app_control); if (ret == APP_CONTROL_ERROR_NONE) { @@ -1087,7 +1091,7 @@ int doc_update_genlist(doc_ugdata *ugd) int ret = 0; int i = 0; - doc_item* gitem = NULL; + doc_item* ditem = NULL; int item_cnt = 0; char *pd_selected = DOC_STR_PD_SELECTED; doc_sel_item_s *sit = NULL; @@ -1120,7 +1124,7 @@ int doc_update_genlist(doc_ugdata *ugd) } ugd->thumbs_d->medias_cnt = eina_list_count(ugd->thumbs_d->medias_elist); - doc_dbg("Grid view updated media count: %d", ugd->thumbs_d->medias_cnt); + doc_dbg("List view updated media count: %d", ugd->thumbs_d->medias_cnt); if (ugd->thumbs_d->medias_cnt == 0) { @@ -1129,13 +1133,13 @@ int doc_update_genlist(doc_ugdata *ugd) EINA_LIST_FOREACH(ugd->selected_elist, l, sit) { bool flag = false; for (i = 0; i < ugd->thumbs_d->medias_cnt; i++) { - gitem = eina_list_nth(ugd->thumbs_d->medias_elist, i); - if (gitem == NULL || gitem->item == NULL || - gitem->item->uuid == NULL) { - doc_dbgE("Invalid gitem!"); + ditem = eina_list_nth(ugd->thumbs_d->medias_elist, i); + if (ditem == NULL || ditem->item == NULL || + ditem->item->uuid == NULL) { + doc_dbgE("Invalid ditem!"); continue; } - if (sit && strcmp(sit->file_url, gitem->item->file_url) == 0) { + if (sit && strcmp(sit->file_url, ditem->item->file_url) == 0) { flag = true; break; } @@ -1155,40 +1159,40 @@ int doc_update_genlist(doc_ugdata *ugd) } for (i = 0; i < ugd->thumbs_d->medias_cnt; i++) { - gitem = eina_list_nth(ugd->thumbs_d->medias_elist, i); - if (gitem == NULL || gitem->item == NULL || - gitem->item->uuid == NULL) { - doc_dbgE("Invalid gitem!"); + ditem = eina_list_nth(ugd->thumbs_d->medias_elist, i); + if (ditem == NULL || ditem->item == NULL || + ditem->item->uuid == NULL) { + doc_dbgE("Invalid ditem!"); continue; } - if (!gitem->item->file_url) { + if (!ditem->item->file_url) { doc_dbgE("file_url is invalid!"); - doc_del_media_data_by_id(ugd, gitem->item->uuid); - doc_data_util_free_item(gitem); + doc_del_media_data_by_id(ugd, ditem->item->uuid); + doc_data_util_free_item(ditem); ugd->thumbs_d->medias_cnt--; i--; - gitem = NULL; + ditem = NULL; continue; } if (ugd->selected_elist) { EINA_LIST_FOREACH(ugd->selected_elist, l, sit) { - if (sit && strcmp(sit->file_url, gitem->item->file_url) == 0) { - gitem->checked = true; + if (sit && strcmp(sit->file_url, ditem->item->file_url) == 0) { + ditem->checked = true; ugd->thumbs_d->tot_selected++; } } } - gitem->ugd = ugd; - gitem->elm_item = elm_genlist_item_append(ugd->thumbs_d->genlist, + ditem->ugd = ugd; + ditem->elm_item = elm_genlist_item_append(ugd->thumbs_d->genlist, ugd->thumbs_d->gic, - gitem, NULL, ELM_GENLIST_ITEM_NONE, _doc_list_item_sel_cb, - gitem); + ditem, NULL, ELM_GENLIST_ITEM_NONE, _doc_list_item_sel_cb, + ditem); item_cnt++; - gitem->sequence = item_cnt + 1; + ditem->sequence = item_cnt + 1; evas_object_show(ugd->thumbs_d->genlist); @@ -1230,7 +1234,7 @@ int doc_create_genlist(doc_ugdata *ugd) doc_dbgE("!!!!! List view !!!!!!!! is pushed in the naviframe"); int i = 0; - doc_item* gitem = NULL; + doc_item* ditem = NULL; int item_cnt = 0; int ret = -1; @@ -1300,31 +1304,31 @@ int doc_create_genlist(doc_ugdata *ugd) if (ugd->thumbs_d->medias_cnt > 0) { for (i = 0; i < ugd->thumbs_d->medias_cnt; i++) { - gitem = eina_list_nth(ugd->thumbs_d->medias_elist, i); - if (gitem == NULL || gitem->item == NULL || - gitem->item->uuid == NULL) { - doc_dbgE("Invalid gitem!"); + ditem = eina_list_nth(ugd->thumbs_d->medias_elist, i); + if (ditem == NULL || ditem->item == NULL || + ditem->item->uuid == NULL) { + doc_dbgE("Invalid doc item!"); continue; } - if (!gitem->item->file_url) { + if (!ditem->item->file_url) { doc_dbgE("file_url is invalid!"); - doc_del_media_data_by_id(ugd, gitem->item->uuid); - doc_data_util_free_item(gitem); + doc_del_media_data_by_id(ugd, ditem->item->uuid); + doc_data_util_free_item(ditem); ugd->thumbs_d->medias_cnt--; i--; - gitem = NULL; + ditem = NULL; continue; } - gitem->ugd = ugd; - gitem->elm_item = elm_genlist_item_append(genlist, + ditem->ugd = ugd; + ditem->elm_item = elm_genlist_item_append(genlist, ugd->thumbs_d->gic, - gitem, NULL, ELM_GENLIST_ITEM_NONE, _doc_list_item_sel_cb, - gitem); + ditem, NULL, ELM_GENLIST_ITEM_NONE, _doc_list_item_sel_cb, + ditem); item_cnt++; - gitem->sequence = item_cnt + 1; + ditem->sequence = item_cnt + 1; evas_object_show(genlist); diff --git a/src/doc-local-data.c b/src/doc-local-data.c index 04c990a..5550d82 100644 --- a/src/doc-local-data.c +++ b/src/doc-local-data.c @@ -25,31 +25,31 @@ #include "doc-debug.h" -static bool _doc_local_data_clone_album(media_folder_h folder, bool b_path, - doc_folder_s **palbum) +static bool _doc_local_data_clone_folder(media_folder_h folder, bool b_path, + doc_folder_s **pfolder) { DOC_CHECK_FALSE(folder); - DOC_CHECK_FALSE(palbum); - doc_folder_s *album = NULL; + DOC_CHECK_FALSE(pfolder); + doc_folder_s *tmp_folder = NULL; - album = (doc_folder_s *)calloc(1, sizeof(doc_folder_s)); - if (album == NULL) { + tmp_folder = (doc_folder_s *)calloc(1, sizeof(doc_folder_s)); + if (tmp_folder == NULL) { doc_dbgE("Failed to calloc!"); return false; } - album->gtype = DOC_TYPE_FOLDER; + tmp_folder->gtype = DOC_TYPE_FOLDER; if (b_path) { - if (media_folder_get_path(folder, &(album->path)) != MEDIA_CONTENT_ERROR_NONE) { + if (media_folder_get_path(folder, &(tmp_folder->path)) != MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get folder path failed!"); goto DOC_LOCAL_FAILED; } } - if (media_folder_get_folder_id(folder, &(album->uuid)) != MEDIA_CONTENT_ERROR_NONE) { + if (media_folder_get_folder_id(folder, &(tmp_folder->uuid)) != MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get folder id failed!"); goto DOC_LOCAL_FAILED; } - if (media_folder_get_modified_time(folder, &(album->mtime)) != MEDIA_CONTENT_ERROR_NONE) { + if (media_folder_get_modified_time(folder, &(tmp_folder->mtime)) != MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get modified time failed!"); goto DOC_LOCAL_FAILED; } @@ -61,25 +61,25 @@ static bool _doc_local_data_clone_album(media_folder_h folder, bool b_path, } if (storage_type == MEDIA_CONTENT_STORAGE_INTERNAL) { /* The device's internal storage */ - album->type = DOC_PHONE; + tmp_folder->type = DOC_PHONE; } else if (storage_type == MEDIA_CONTENT_STORAGE_EXTERNAL) { /* The device's external storage */ - album->type = DOC_MMC; + tmp_folder->type = DOC_MMC; } else { doc_dbgE("Undefined mode[%d]!", storage_type); } - if (media_folder_get_name(folder, &(album->display_name)) != MEDIA_CONTENT_ERROR_NONE) { + if (media_folder_get_name(folder, &(tmp_folder->display_name)) != MEDIA_CONTENT_ERROR_NONE) { doc_dbgE("Get folder name failed!"); goto DOC_LOCAL_FAILED; } - *palbum = album; + *pfolder = tmp_folder; return true; DOC_LOCAL_FAILED: - doc_data_type_free_geitem((void **)(&album)); - *palbum = NULL; + doc_data_type_free_item((void **)(&tmp_folder)); + *pfolder = NULL; return false; } @@ -129,7 +129,7 @@ int doc_local_data_disconnect(void) } } -static bool _doc_local_data_get_album_list_cb(media_folder_h folder, +static bool _doc_local_data_get_folder_list_cb(media_folder_h folder, void *data) { DOC_CHECK_FALSE(data); @@ -137,7 +137,7 @@ static bool _doc_local_data_get_album_list_cb(media_folder_h folder, DOC_CHECK_FALSE(tmp_data->userdata); DOC_CHECK_FALSE(folder); Eina_List **elist = (Eina_List **)(tmp_data->userdata); - doc_folder_s *album = NULL; + doc_folder_s *tmp_folder = NULL; char *path = NULL; if (media_folder_get_path(folder, &path) != MEDIA_CONTENT_ERROR_NONE) { @@ -146,7 +146,7 @@ static bool _doc_local_data_get_album_list_cb(media_folder_h folder, } DOC_CHECK_FALSE(path); - if (tmp_data->list_type != DOC_ALBUM_LIST_PATH) { + if (tmp_data->list_type != DOC_FOLDER_LIST_PATH) { if (!g_strcmp0(DOC_CAMERA_PATH_PHONE, path) || !g_strcmp0(DOC_CAMERA_PATH_MMC, path) || !g_strcmp0(DOC_DOWNLOADS_PATH, path)) { @@ -156,19 +156,19 @@ static bool _doc_local_data_get_album_list_cb(media_folder_h folder, } } - _doc_local_data_clone_album(folder, false, &album); - if (album == NULL) { + _doc_local_data_clone_folder(folder, false, &tmp_folder); + if (tmp_folder == NULL) { DOC_FREE(path); - doc_dbgE("Failed clone album!"); + doc_dbgE("Failed clone folder!"); return false; } - album->path = path; + tmp_folder->path = path; - *elist = eina_list_append(*elist, album); + *elist = eina_list_append(*elist, tmp_folder); return true; } -static int _doc_local_data_get_album_list(doc_filter_s *condition, Eina_List **elilst) +static int _doc_local_data_get_folder_list(doc_filter_s *condition, Eina_List **elilst) { DOC_CHECK_VAL(elilst, -1); DOC_CHECK_VAL(condition, -1); @@ -184,13 +184,13 @@ static int _doc_local_data_get_album_list(doc_filter_s *condition, Eina_List **e doc_transfer_data_s tran_data; memset(&tran_data, 0x00, sizeof(doc_transfer_data_s)); tran_data.userdata = (void **)elilst; - tran_data.album_id = NULL; + tran_data.folder_id = NULL; tran_data.with_meta = false; tran_data.list_type = condition->list_type; doc_dbg("Get folders--start"); ret = media_folder_foreach_folder_from_db(filter, - _doc_local_data_get_album_list_cb, + _doc_local_data_get_folder_list_cb, &tran_data); doc_dbg("Get folders--over"); @@ -226,14 +226,14 @@ int doc_local_data_get_folder_by_path(char *path, doc_folder_s **folder) condition.offset = -1; condition.count = -1; condition.with_meta = false; - condition.list_type = DOC_ALBUM_LIST_PATH; + condition.list_type = DOC_FOLDER_LIST_PATH; snprintf(condition.cond, CONDITION_LENGTH, "%s AND %s=\'%s\'", - DOC_CONDITION_IMAGE_VIDEO, FOLDER_PATH, path); + DOC_CONDITION_LOCAL_DOCUMENT, FOLDER_PATH, path); - ret = _doc_local_data_get_album_list(&condition, &list); + ret = _doc_local_data_get_folder_list(&condition, &list); if (ret != 0 || NULL == list) { - doc_dbgE("Failed to get album list[%d]!", ret); + doc_dbgE("Failed to get folder list[%d]!", ret); ret = -1; } else if (NULL != list) { *folder = eina_list_nth(list, 0); @@ -248,7 +248,7 @@ int doc_local_data_get_folder_by_path(char *path, doc_folder_s **folder) for (; i < len; i++) { _item = eina_list_nth(list, i); - doc_data_type_free_geitem((void **)(&_item)); + doc_data_type_free_item((void **)(&_item)); } eina_list_free(list); @@ -301,7 +301,7 @@ int doc_local_data_get_all_folders_media_list(doc_filter_s *condition, doc_transfer_data_s tran_data; memset(&tran_data, 0x00, sizeof(doc_transfer_data_s)); tran_data.userdata = (void **)elist; - tran_data.album_id = NULL; + tran_data.folder_id = NULL; tran_data.with_meta = condition->with_meta; doc_dbg("Get all medias--start"); diff --git a/src/doc-ui-util.c b/src/doc-ui-util.c index dd4ddf9..c54323b 100644 --- a/src/doc-ui-util.c +++ b/src/doc-ui-util.c @@ -47,25 +47,6 @@ Evas_Object* doc_ui_load_edj(Evas_Object *parent, const char *file, const char * return eo; } -//[ToDo] Check for NoContent -Evas_Object* ge_ui_create_nocontents(doc_ugdata* ugd) -{ - DOC_CHECK_NULL(ugd); - Evas_Object *layout = NULL; - char label_str[DOC_NOCONTENTS_LABEL_LEN_MAX] = {0,}; - snprintf(label_str, sizeof(label_str), - "%s", (char*)DOC_STR_NO_ITEMS); - - doc_dbg("\nNocontents label: %s", label_str); - /* Full nocontents view layout */ - layout = elm_layout_add(ugd->naviframe); - DOC_CHECK_NULL(layout); - elm_layout_theme_set(layout, "layout", "nocontents", "text"); - elm_object_part_text_set(layout, "elm.text", label_str); - - return layout; -} - Evas_Object *doc_ui_create_main_ly(Evas_Object *parent) { DOC_CHECK_NULL(parent); @@ -115,7 +96,7 @@ Evas_Object* doc_ui_create_naviframe(doc_ugdata *ugd, Evas_Object *parent) } //[ToDo] Check for scroller -int _ge_ui_reset_scroller_pos(Evas_Object *obj) +static int _doc_ui_reset_scroller_pos(Evas_Object *obj) { DOC_CHECK_VAL(obj, -1); evas_object_data_set(obj, "prev_scroller_x", (void *)0); @@ -125,7 +106,7 @@ int _ge_ui_reset_scroller_pos(Evas_Object *obj) return 0; } -int _ge_ui_del_scroller_pos(Evas_Object *obj) +static int _doc_ui_del_scroller_pos(Evas_Object *obj) { DOC_CHECK_VAL(obj, -1); evas_object_data_del(obj, "prev_scroller_x"); @@ -135,7 +116,7 @@ int _ge_ui_del_scroller_pos(Evas_Object *obj) return 0; } -int _ge_ui_save_scroller_pos(Evas_Object *obj) +static int _doc_ui_save_scroller_pos(Evas_Object *obj) { DOC_CHECK_VAL(obj, -1); Evas_Coord x = 0; @@ -152,7 +133,7 @@ int _ge_ui_save_scroller_pos(Evas_Object *obj) return 0; } -int _ge_ui_restore_scroller_pos(Evas_Object *obj) +static int _doc_ui_restore_scroller_pos(Evas_Object *obj) { DOC_CHECK_VAL(obj, -1); Evas_Coord x = 0; |