From 62c65dd9718977362eb8265c7a913c298079592b Mon Sep 17 00:00:00 2001 From: Jing Yigang Date: Tue, 28 Aug 2012 11:12:11 +0800 Subject: [PATCH] [Bug] Adjust items in setting > storage according to GUI. Change-Id: I345e60385cdae97382227f1f206de981e9d4143f --- setting-storage/include/setting-storage.h | 3 +- setting-storage/src/setting-storage-main.c | 55 ++++++++++++++++-------------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/setting-storage/include/setting-storage.h b/setting-storage/include/setting-storage.h index 6ac71e8..f44b128 100755 --- a/setting-storage/include/setting-storage.h +++ b/setting-storage/include/setting-storage.h @@ -83,7 +83,7 @@ struct _SettingStorageUG { Elm_Genlist_Item_Class itc_seperator; Elm_Genlist_Item_Class itc_2text_1icon_3; Elm_Genlist_Item_Class itc_1text; - Elm_Genlist_Item_Class itc_1icon; + Elm_Genlist_Item_Class itc_2text_1icon_4; Setting_Storage_Status internal_status; Setting_Storage_Status apps_status; @@ -92,7 +92,6 @@ struct _SettingStorageUG { Setting_Storage_Status others_status; Setting_GenGroupItem_Data *internal; - Setting_GenGroupItem_Data *total; Setting_GenGroupItem_Data *apps; Setting_GenGroupItem_Data *pics_videos; Setting_GenGroupItem_Data *downloads; diff --git a/setting-storage/src/setting-storage-main.c b/setting-storage/src/setting-storage-main.c index c86fee1..1993e6e 100755 --- a/setting-storage/src/setting-storage-main.c +++ b/setting-storage/src/setting-storage-main.c @@ -58,8 +58,8 @@ setting_view setting_view_storage_main = { #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" -#define SETTING_STORAGE_ICON_WIDTH ((int)660 * WIDGET_SCALE_FACTOR) -#define SETTING_STORAGE_ICON_HEIGHT ((int)68 * WIDGET_SCALE_FACTOR) +#define SETTING_STORAGE_ICON_WIDTH ((int)640 * WIDGET_SCALE_FACTOR) +#define SETTING_STORAGE_ICON_HEIGHT ((int)16 * WIDGET_SCALE_FACTOR) #define SETTING_STORAGE_OPT_PATH "/opt" #define SETTING_STORAGE_MEDIA_PATH "/opt/media" @@ -67,6 +67,17 @@ setting_view setting_view_storage_main = { #define SETTING_STORAGE_VIDEOS_PATH "/opt/media/Videos" #define SETTING_STORAGE_DOWNLOADS_PATH "/opt/media/Downloads" +static char *__gl_text_get(void *data, Evas_Object *obj, const char *part) +{ + retv_if(!data, NULL); + Setting_GenGroupItem_Data *item_data = data; + + if (!safeStrCmp(part, "elm.text.1")) { + return (char *)g_strdup(item_data->keyStr); + } + return NULL; +} + static Evas_Object *__gl_content_get(void *data, Evas_Object *obj, const char *part) { retv_if(!data, NULL); @@ -196,7 +207,10 @@ static void __gl_del(void *data, Evas_Object *obj) { /* SETTING_TRACE_BEGIN; */ Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) data; - FREE(item_data); + if (item_data) { + G_FREE(item_data->keyStr); + FREE(item_data); + } } static int __setting_storage_main_fs_stat(double *total, double *avail, const char *path) @@ -575,11 +589,11 @@ static int setting_storage_main_create(void *cb) SETTING_STORAGE_INTERNAL_STORAGE_STR, NULL); - ad->itc_1icon.item_style = "dialogue/1icon"; - ad->itc_1icon.func.text_get = NULL; - ad->itc_1icon.func.content_get = __gl_content_get; - ad->itc_1icon.func.state_get = NULL; - ad->itc_1icon.func.del = __gl_del; + ad->itc_2text_1icon_4.item_style = "dialogue/2text.1icon.4"; + ad->itc_2text_1icon_4.func.text_get = __gl_text_get; + ad->itc_2text_1icon_4.func.content_get = __gl_content_get; + ad->itc_2text_1icon_4.func.state_get = NULL; + ad->itc_2text_1icon_4.func.del = __gl_del; __setting_storage_main_internal_storage_status_get(ad); @@ -587,13 +601,19 @@ static int setting_storage_main_create(void *cb) __setting_storage_main_downloads_status_get(ad); + /* Total space */ + char total_desc[SETTING_STORAGE_MAX_STR_LEN + 1] = {0,}; + ret = __setting_storage_status_size_transition(ad->internal_status.dTotal, total_desc); + setting_retvm_if(ret == SETTING_RETURN_FAIL, SETTING_RETURN_FAIL, "failed to transform") + /* status */ ad->internal = (Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data)); setting_retvm_if(!ad->internal, SETTING_RETURN_FAIL, "calloc failed"); if (ad->internal) { ad->internal->userdata = ad; - ad->internal->item = elm_genlist_item_append(ad->genlist, &(ad->itc_1icon), ad->internal, NULL, + ad->internal->keyStr = (char *)g_strdup(total_desc); + ad->internal->item = elm_genlist_item_append(ad->genlist, &(ad->itc_2text_1icon_4), ad->internal, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_select_mode_set(ad->internal->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } else { @@ -601,23 +621,6 @@ static int setting_storage_main_create(void *cb) return SETTING_RETURN_FAIL; } - /* Total space */ - char total_desc[SETTING_STORAGE_MAX_STR_LEN + 1] = {0,}; - ret = __setting_storage_status_size_transition(ad->internal_status.dTotal, total_desc); - setting_retvm_if(ret == SETTING_RETURN_FAIL, SETTING_RETURN_FAIL, "failed to transform") - - ad->total = setting_create_Gendial_field_def(ad->genlist, &(ad->itc_2text_2), NULL, - ad, SWALLOW_Type_INVALID, NULL, - NULL, 0, "IDS_ST_BODY_TOTAL_SPACE", - total_desc, NULL); - if (ad->total) { - ad->total->userdata = ad; - elm_genlist_item_select_mode_set(ad->total->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - } else { - SETTING_TRACE_ERROR("ad->total is NULL"); - return SETTING_RETURN_FAIL; - } - /* Applications */ ad->apps_status.dTotal = 230.45 * 1024 * 1024; /* for test*/ char apps_desc[SETTING_STORAGE_MAX_STR_LEN + 1] = {0,}; -- 2.7.4