From 5d737dba931023484daf228e47aed08a82bccb21 Mon Sep 17 00:00:00 2001 From: "yigang.jing" Date: Mon, 24 Dec 2012 14:34:51 +0800 Subject: [PATCH] Remove Download item in Storage according to UI guide. Change-Id: If05be47d5a0f9791f4a2bd117bbddf9ce5176dab --- setting-storage/include/setting-storage.h | 14 +-- setting-storage/src/setting-storage-main.c | 137 +++++++---------------------- 2 files changed, 36 insertions(+), 115 deletions(-) diff --git a/setting-storage/include/setting-storage.h b/setting-storage/include/setting-storage.h index b08bb88..242889f 100755 --- a/setting-storage/include/setting-storage.h +++ b/setting-storage/include/setting-storage.h @@ -38,8 +38,9 @@ #include #include #include +#include -#define SUPPORT_SD_CARD_FORMAT 0 +#define SUPPORT_SD_CARD_FORMAT 1 #define SETTING_STORAGE_PROGRESSBAR_TIMEOUT 10 #define SETTING_STORAGE_POPUP_TIMER 2 @@ -64,7 +65,6 @@ #define SETTING_STORAGE_AUDIO_STR "IDS_COM_BODY_AUDIO" #define SETTING_STORAGE_PICS_STR "IDS_ST_BODY_PICTURES_VIDEOS" -#define SETTING_STORAGE_DOWNS_STR "IDS_ST_BODY_DOWNLOADS" #define SETTING_STORAGE_MISCES_STR "IDS_ST_BODY_MISCELLANEOUS_FILES" #define SETTING_STORAGE_AVAIL_STR "IDS_ST_BODY_AVAILABLE" #define SETTING_STORAGE_FORMAT_STR "IDS_ST_BODY_FORMAT_USB_STORAGE" @@ -74,7 +74,6 @@ #define SETTING_STORAGE_APPS_ICON_PATH SETTING_ICON_PATH"/A01-1_icon_color_applications.png" #define SETTING_STORAGE_PICS_ICON_PATH SETTING_ICON_PATH"/A01-1_icon_color_pictures.png" -#define SETTING_STORAGE_DOWNS_ICON_PATH SETTING_ICON_PATH"/A01-1_icon_color_downloads.png" #define SETTING_STORAGE_AUDIO_ICON_PATH SETTING_ICON_PATH"/A01-1_icon_color_Audio.png" #define SETTING_STORAGE_MISCES_ICON_PATH SETTING_ICON_PATH"/A01-1_icon_color_miscellaneous_files.png" #define SETTING_STORAGE_AVAIL_ICON_PATH SETTING_ICON_PATH"/A01-1_icon_color_available.png" @@ -84,12 +83,6 @@ #define SETTING_STORAGE_ICON_HEIGHT ((int)16 * WIDGET_SCALE_FACTOR) #define SETTING_STORAGE_OPT_USR_PATH "/opt/usr" -#define SETTING_STORAGE_MEDIA_PATH "/opt/usr/media" -#define SETTING_STORAGE_PICTURES_PATH "/opt/usr/media/Images" -#define SETTING_STORAGE_VIDEOS_PATH "/opt/usr/media/Videos" -#define SETTING_STORAGE_CAMERA_PATH "/opt/usr/media/Camera" -#define SETTING_STORAGE_DOWNLOADS_PATH "/opt/usr/media/Downloads" -#define SETTING_STORAGE_AUDIO_PATH "/opt/usr/media/Sounds" #define SETTING_STORAGE_MMC_PATH "/opt/storage/sdcard" #define SETTING_STORAGE_MMC_PARENT_PATH "/opt/storage/sdcard/.." @@ -112,7 +105,6 @@ typedef enum { SETTING_STORAGE_SLEEP = -1, SETTING_STORAGE_REUPDATE = 0, SETTING_STORAGE_PICTURES_VIDEO = 1, - SETTING_STORAGE_DOWNLOADS, SETTING_STORAGE_AUDIO, SETTING_STORAGE_MISCELLANEOUS, SETTING_STORAGE_APPLICATIONS, @@ -181,14 +173,12 @@ struct _SettingStorageUG { Setting_Storage_Status internal_status; Setting_Storage_Status apps_status; Setting_Storage_Status pics_videos_status; - Setting_Storage_Status downloads_status; Setting_Storage_Status audio_status; Setting_Storage_Status others_status; Setting_GenGroupItem_Data *internal; Setting_GenGroupItem_Data *apps; Setting_GenGroupItem_Data *pics_videos; - Setting_GenGroupItem_Data *downloads; Setting_GenGroupItem_Data *audio; Setting_GenGroupItem_Data *others; Setting_GenGroupItem_Data *avail; diff --git a/setting-storage/src/setting-storage-main.c b/setting-storage/src/setting-storage-main.c index 68b66aa..18c92e0 100755 --- a/setting-storage/src/setting-storage-main.c +++ b/setting-storage/src/setting-storage-main.c @@ -80,9 +80,9 @@ static Evas_Object *__gl_content_get(void *data, Evas_Object *obj, const char *p } float temp_size = 0.0; - /* use size (applications + picture/videos + downloads + audio + miscellaneous + available) as 100% */ + /* use size (applications + picture/videos + audio + miscellaneous + available) as 100% */ double total_size = ad->apps_status.dTotal + ad->pics_videos_status.dTotal + - ad->downloads_status.dTotal + ad->audio_status.dTotal + + + ad->audio_status.dTotal + ad->others_status.dTotal + ad->internal_status.dAvail; if (!safeStrCmp(part, "elm.icon")){ @@ -122,19 +122,6 @@ static Evas_Object *__gl_content_get(void *data, Evas_Object *obj, const char *p elm_box_pack_end(status_box, pics); } - /* downloads */ - unsigned int downloads_size = 0; - temp_size = ((float)ad->downloads_status.dTotal / total_size) * width; - if (temp_size < 1 && temp_size > 0) { - downloads_size = 1; - } else { - downloads_size = (unsigned int)temp_size; - } - if (downloads_size > 0) { - Evas_Object *downs = __setting_storage_main_image_add(evas, SETTING_STORAGE_DOWNS_ICON_PATH, downloads_size, height); - elm_box_pack_end(status_box, downs); - } - /* audio */ unsigned int audio_size = 0; temp_size = ((float)ad->audio_status.dTotal / total_size) * width; @@ -169,7 +156,7 @@ static Evas_Object *__gl_content_get(void *data, Evas_Object *obj, const char *p } else { avail_size = (unsigned int)temp_size; - int sum = apps_size + pics_videos_size + downloads_size + audio_size + others_size; + int sum = apps_size + pics_videos_size + audio_size + others_size; if ((sum + avail_size) > width) { avail_size = width - sum; } @@ -321,47 +308,6 @@ static double __setting_storage_main_pictures_videos_status_get() return total_size; } -static double __setting_storage_main_downloads_status_get() -{ - SETTING_TRACE_BEGIN; - - double total_size = 0.0; - - int ret = MEDIA_CONTENT_ERROR_NONE; - filter_h filter = NULL; - - /*Set Filter*/ - char *condition = "MEDIA_PATH LIKE \'/opt/usr/media/Downloads/%%\'"; - - ret = media_filter_create(&filter); - if(ret != MEDIA_CONTENT_ERROR_NONE) { - SETTING_TRACE("Fail to create filter"); - return total_size; - } - - ret = media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT); - if(ret != MEDIA_CONTENT_ERROR_NONE) { - media_filter_destroy(filter); - SETTING_TRACE("Fail to set condition"); - return total_size; - } - - ret = media_info_foreach_media_from_db(filter, __setting_storage_main_media_item_cb, &total_size); - if(ret != MEDIA_CONTENT_ERROR_NONE) { - media_filter_destroy(filter); - SETTING_TRACE("Fail to get media"); - return total_size; - } - - ret = media_filter_destroy(filter); - if (ret != MEDIA_CONTENT_ERROR_NONE) { - SETTING_TRACE_ERROR("destroy filter failed\n\n"); - return total_size; - } - - return total_size; -} - static double __setting_storage_main_audio_status_get() { SETTING_TRACE_BEGIN; @@ -615,8 +561,6 @@ static void __setting_storage_main_Gendial_mouse_up_cb(void *data, Evas_Object * &setting_view_storage_default_storage, ad); } else if (!safeStrCmp(SETTING_STORAGE_PICS_STR, list_item->keyStr)) { __setting_storage_main_app_launch("org.tizen.gallery"); - } else if (!safeStrCmp(SETTING_STORAGE_DOWNS_STR, list_item->keyStr)) { - __setting_storage_main_app_launch("org.tizen.download-manager"); } else if (!safeStrCmp(SETTING_STORAGE_AUDIO_STR, list_item->keyStr)) { __setting_storage_main_app_launch("org.tizen.music-player"); } else if (!safeStrCmp(SETTING_STORAGE_MISCES_STR, list_item->keyStr)) { @@ -866,18 +810,20 @@ static void __setting_storage_main_sd_card_mount_unmount(void *data) } #if SUPPORT_SD_CARD_FORMAT -static void __setting_storage_main_sd_card_format_cb(int val, void *data) +static void __setting_storage_main_sd_card_scan_cb(media_content_error_e err, void *data) { SETTING_TRACE_BEGIN; setting_retm_if(data == NULL, "Data parameter is NULL"); SettingStorageUG *ad = (SettingStorageUG *) data; + SETTING_TRACE("scan_cb result = %d", err); + if (ad->popup) { evas_object_del(ad->popup); ad->popup = NULL; } - if (val == SETTING_STORAGE_SYSMAN_REQUEST_SUCCESS) { + if (err == MEDIA_CONTENT_ERROR_NONE) { ad->popup = setting_create_popup_without_btn(ad, ad->win_get, NULL, _("IDS_COM_POP_SUCCESS"), __setting_storage_status_sd_card_popup_format_response_cb, SETTING_STORAGE_POPUP_TIMER, FALSE, FALSE); @@ -889,6 +835,30 @@ static void __setting_storage_main_sd_card_format_cb(int val, void *data) } } +static void __setting_storage_main_sd_card_format_cb(int val, void *data) +{ + SETTING_TRACE_BEGIN; + setting_retm_if(data == NULL, "Data parameter is NULL"); + SettingStorageUG *ad = (SettingStorageUG *) data; + + if (val == SETTING_STORAGE_SYSMAN_REQUEST_SUCCESS) { + int ret = media_content_scan_folder(SETTING_STORAGE_MMC_PATH, __setting_storage_main_sd_card_scan_cb, ad); + + if(ret != MEDIA_CONTENT_ERROR_NONE) { + SETTING_TRACE_ERROR("Fail to media_content_scan_file : %d", ret); + return; + } + } else { + if (ad->popup) { + evas_object_del(ad->popup); + ad->popup = NULL; + } + ad->popup = setting_create_popup_without_btn(ad, ad->win_get, NULL, _("IDS_COM_POP_FAILED"), + __setting_storage_status_sd_card_popup_response_cb, + SETTING_STORAGE_POPUP_TIMER, FALSE, FALSE); + } +} + static void __setting_storage_main_sd_card_format_popup_yes(void *data) { SETTING_TRACE_BEGIN; @@ -902,9 +872,9 @@ static void __setting_storage_main_sd_card_format_popup_yes(void *data) /* Show Formatting..... popup */ ad->popup = setting_create_popup_with_progressbar(ad, ad->win_get, - "list_process", _("IDS_ST_POP_MSG_FORMATTING"), - NULL, __setting_storage_status_sd_card_popup_response_cb, - SETTING_STORAGE_PROGRESSBAR_TIMEOUT, TRUE, TRUE); + "pending_list", NULL, + NULL, NULL, + 0, TRUE, TRUE); int ret = __setting_storage_main_mmc_content_init(ad, __setting_storage_main_sd_card_format_cb); if (ret == SETTING_RETURN_FAIL) { @@ -1298,12 +1268,6 @@ void __setting_storage_main_pipe_cb(void *data, void *buffer, unsigned int nbyte __setting_storage_main_genlist_update(ad->pics_videos, ad->pics_videos_status); } break; - case SETTING_STORAGE_DOWNLOADS: - { - ad->downloads_status.dTotal = update_info->total_size; - __setting_storage_main_genlist_update(ad->downloads, ad->downloads_status); - } - break; case SETTING_STORAGE_AUDIO: { ad->audio_status.dTotal = update_info->total_size; @@ -1381,20 +1345,6 @@ static void *__setting_storage_main_thread_start_routine(void *data) ecore_pipe_write(ad->pipe, &pics_videos_info, sizeof(pics_videos_info)); } break; - case SETTING_STORAGE_DOWNLOADS: - { - /* get downloads info */ - double downloads_size = __setting_storage_main_downloads_status_get(); - SETTING_TRACE("downloads_size = %f", downloads_size); - - Update_Info downloads_info; - memset(&downloads_info, 0, sizeof(Update_Info)); - downloads_info.type = SETTING_STORAGE_DOWNLOADS; - downloads_info.total_size = downloads_size; - if (ad->pipe) - ecore_pipe_write(ad->pipe, &downloads_info, sizeof(downloads_info)); - } - break; case SETTING_STORAGE_AUDIO: { /* get audio info */ @@ -1476,9 +1426,6 @@ static void __setting_storage_main_init(void *data) ad->pics_videos_status.dAvail = 0.0; ad->pics_videos_status.dTotal= 0.0; - ad->downloads_status.dAvail = 0.0; - ad->downloads_status.dTotal= 0.0; - ad->audio_status.dAvail = 0.0; ad->audio_status.dTotal= 0.0; @@ -1597,22 +1544,6 @@ static int setting_storage_main_create(void *cb) return SETTING_RETURN_FAIL; } - /* Downloads */ - ad->downloads = setting_create_Gendial_field_def(ad->genlist, &(ad->itc_2text_1icon_3), - __setting_storage_main_Gendial_mouse_up_cb, - ad, SWALLOW_Type_INVALID, SETTING_STORAGE_DOWNS_ICON_PATH, - NULL, 0, SETTING_STORAGE_DOWNS_STR, - _("IDS_ST_HEADER_PLEASE_WAIT"), NULL); - if (ad->downloads) { - ad->downloads->userdata = ad; - if (is_emulator) { - elm_genlist_item_select_mode_set(ad->downloads->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - } - } else { - SETTING_TRACE_ERROR("ad->downloads is NULL"); - return SETTING_RETURN_FAIL; - } - /* Audio */ ad->audio = setting_create_Gendial_field_def(ad->genlist, &(ad->itc_2text_1icon_3), __setting_storage_main_Gendial_mouse_up_cb, -- 2.7.4