From 6151ed4c66187a774b1d7786fe3fa3792d0216d4 Mon Sep 17 00:00:00 2001 From: Sunyeop Hwang Date: Fri, 7 Dec 2012 14:13:40 +0900 Subject: [PATCH] Apply new winset at date and time for supporting setupwizard Change-Id: I2521017159583d613c203812408e6618580a36f6 --- setting-time/src/setting-time-main.c | 113 +++++++++++++++++++++++++++++------ 1 file changed, 96 insertions(+), 17 deletions(-) diff --git a/setting-time/src/setting-time-main.c b/setting-time/src/setting-time-main.c index 92caaae..ba12d4f 100755 --- a/setting-time/src/setting-time-main.c +++ b/setting-time/src/setting-time-main.c @@ -464,6 +464,50 @@ static void __setting_time_main_exp_cb(void *data, Evas_Object *obj, } } +/** + * layyout create - remove a conformant + */ +Evas_Object *setting_create_win_layout2(Evas_Object *win_layout, + Evas_Object *win_obj) +{ + Evas_Object *layout = NULL; + //Evas_Object *conform = elm_conformant_add(win_obj); + /* Base Layout */ + layout = elm_layout_add(win_obj); + setting_retvm_if(layout == NULL, FALSE, "layout == NULL"); + + elm_layout_theme_set(layout, "layout", "application", "default"); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win_obj, layout); + //elm_win_resize_object_add(win_obj, conform); + //elm_object_content_set(conform, layout); + + Evas_Object *bg = setting_create_bg(layout, win_obj, "group_list"); + elm_object_part_content_set(layout, "elm.swallow.bg", bg); + evas_object_show(layout); + //evas_object_show(conform); + return layout; +} + + + +Evas_Object *setting_create_layout_navi_bar2(Evas_Object *win_layout, Evas_Object *win_obj, char *title_str, char *lbutton_str, char *rbutton_str, char *mbutton_str, setting_call_back_func lbutton_click_cb, setting_call_back_func rbutton_click_cb, setting_call_back_func mbutton_click_cb, void *cb_data, Evas_Object *eo_view, /*any container obj constructed on any evas obj */ + Evas_Object **navi_bar, + Evas_Object **titleobj) +{ + + Evas_Object *layout = setting_create_win_layout2(win_layout, win_obj); + *navi_bar = setting_create_navi_bar(layout); + + setting_create_navi_bar_buttons(title_str, + lbutton_str, rbutton_str, mbutton_str, + lbutton_click_cb, rbutton_click_cb, + mbutton_click_cb, cb_data, eo_view /*content */ , + *navi_bar, NULL); + return layout; +} + static int setting_time_main_create(void *cb) { SETTING_TRACE_BEGIN; @@ -503,7 +547,7 @@ static int setting_time_main_create(void *cb) same_flag = TRUE; } - Evas_Object *controllbar = NULL; + //Evas_Object *controllbar = NULL; scroller = elm_genlist_add(ad->win_main_layout); elm_object_style_set(scroller, "dialogue"); @@ -516,28 +560,50 @@ static int setting_time_main_create(void *cb) elm_genlist_clear(scroller); ad->ly_main = - setting_create_layout_navi_bar(ad->win_main_layout, + setting_create_layout_navi_bar2(ad->win_main_layout, ad->win_get, title, NULL, NULL, NULL, NULL, NULL, NULL, ad, scroller, &ad->navi_bar, - &controllbar); + NULL); + /* left button */ + Evas_Object *lbtn_obj = elm_button_add(ad->win_main_layout); + if(lbtn_obj == NULL) + return SETTING_DRAW_ERR_FAIL_SCROLLER; + + Evas_Object *licon_obj = elm_icon_add(ad->win_main_layout); + if(licon_obj == NULL) + return SETTING_DRAW_ERR_FAIL_SCROLLER; + elm_icon_file_set(licon_obj, IMG_PREVIOUS, NULL); - elm_toolbar_item_append(controllbar, IMG_PREVIOUS, l_btn, l_button_cb, ad); - elm_object_item_disabled_set(elm_toolbar_item_append(controllbar, NULL, "", NULL, NULL), EINA_TRUE); - elm_object_item_disabled_set(elm_toolbar_item_append(controllbar, NULL, "", NULL, NULL), EINA_TRUE); - elm_toolbar_item_append(controllbar, IMG_NEXT, r_btn, r_button_cb, ad); + elm_object_style_set(lbtn_obj, "naviframe/toolbar/default"); + elm_object_text_set(lbtn_obj, l_btn); + elm_object_part_content_set(lbtn_obj, "elm.swallow.content", licon_obj); + evas_object_smart_callback_add(lbtn_obj, "clicked", l_button_cb, ad); - if (same_flag) { - setting_time_main_controlbar_lbtn_label_set(controllbar, - lbtn_str); - } - if (lbtn_str) { - G_FREE(lbtn_str); - } + /* right button */ + Evas_Object *rbtn_obj = elm_button_add(ad->win_main_layout); + if(rbtn_obj == NULL) + return SETTING_DRAW_ERR_FAIL_SCROLLER; + + Evas_Object *ricon_obj = elm_icon_add(ad->win_main_layout); + if(ricon_obj == NULL) + return SETTING_DRAW_ERR_FAIL_SCROLLER; + elm_icon_file_set(ricon_obj, IMG_NEXT, NULL); + elm_object_style_set(rbtn_obj, "naviframe/toolbar/default"); + elm_object_text_set(rbtn_obj, r_btn); + elm_object_part_content_set(rbtn_obj, "elm.swallow.content", ricon_obj); + evas_object_smart_callback_add(rbtn_obj, "clicked", r_button_cb, ad); + + Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar); + if(navi_it) + { + elm_object_item_part_content_set(navi_it, "toolbar_button1", lbtn_obj); + elm_object_item_part_content_set(navi_it, "toolbar_button2", rbtn_obj); + } } else { l_btn = _("IDS_COM_BODY_BACK"); title = _("IDS_ST_BODY_DATE_AND_TIME"); @@ -597,7 +663,16 @@ static int setting_time_main_create(void *cb) // 2.to set current time int t_uptime = 0; FILE *fp = fopen("/proc/uptime", "r"); - fscanf(fp, "%d", &t_uptime); + if (fp) { + if (!fscanf(fp, "%d", &t_uptime)) { + SETTING_TRACE_ERROR("fscanf error"); + } + fclose(fp); + fp = NULL; + } else { + SETTING_TRACE_ERROR("fopen error"); + } + SETTING_TRACE("t_nitz:%d, t_offset:%d, t_uptime:%d", t_nitz, t_offset, t_uptime); time_t t_current = t_nitz + t_uptime - t_offset; SETTING_TRACE("t_current:%d", t_current); @@ -651,9 +726,13 @@ static int setting_time_main_create(void *cb) if (ret) { SETTING_TRACE(">>>>>> RESULT : %s", get_city_name_result()); } - char* cityname_id = get_city_name_result(); + char* cityname_id = _(get_city_name_result()); + SETTING_TRACE("cityname_id:%s", cityname_id); + if (cityname_id && 0 != safeStrCmp(cityname_id, "NULL")) + ret = snprintf(time_zone_sub_str, CITY_BUF_SIZE + GMT_BUF_SIZE + 2, "%s, GMT %s", cityname_id, _(str_buf)); + else + ret = snprintf(time_zone_sub_str, CITY_BUF_SIZE + GMT_BUF_SIZE + 2, "%s, GMT +09", _("IDS_WCL_BODY_CITYNAME_SEOUL")); - ret = snprintf(time_zone_sub_str, CITY_BUF_SIZE + GMT_BUF_SIZE + 2, "%s, GMT %s", _(cityname_id), _(str_buf)); FREE(pa_city); FREE(pa_timezone); retv_if(ret < 0, 0); -- 2.7.4