diff options
author | Irfan Abdul <irfan.abdul@samsung.com> | 2016-11-29 16:52:16 +0530 |
---|---|---|
committer | Irfan Abdul <irfan.abdul@samsung.com> | 2016-11-29 16:52:16 +0530 |
commit | deee7231aa138e1199880d71951afb7f1bcab4fe (patch) | |
tree | c9d724a68c1f611f9c5662ba7b14191ffce4fca3 | |
parent | 9cbffa7e5289e8f4d52b00e28422cf07d3eb93ea (diff) | |
download | timer-deee7231aa138e1199880d71951afb7f1bcab4fe.tar.gz timer-deee7231aa138e1199880d71951afb7f1bcab4fe.tar.bz2 timer-deee7231aa138e1199880d71951afb7f1bcab4fe.zip |
[Timer] removing edje calls and replacing elm callssubmit/tizen_3.0/20161130.063206
Change-Id: I64c54ab31bc830eaf0cbccf04dda7fed5aa65311
-rwxr-xr-x | src/main.c | 107 |
1 files changed, 53 insertions, 54 deletions
@@ -66,7 +66,7 @@ static void _tr_zoomin_del_cb(void *data, Elm_Transit *transit) elm_transit_del(ad->tr); ad->tr = NULL; } - edje_object_signal_emit(_EDJ(ad->ly_main), "progressbar.show", "*"); + elm_object_signal_emit(ad->ly_main, "progressbar.show", "*"); } static Eina_Bool __progressbar_hide_cb(void *data) @@ -77,7 +77,7 @@ static Eina_Bool __progressbar_hide_cb(void *data) struct appdata *ad = (struct appdata *)data; - edje_object_signal_emit(_EDJ(ad->ly_main), "progressbar.hide", "*"); + elm_object_signal_emit(ad->ly_main, "progressbar.hide", "*"); return ECORE_CALLBACK_CANCEL; } @@ -95,7 +95,7 @@ static void _tmr_progressbar_transit_hide(void *data) ad->tr = elm_transit_add(); TMR_INFO("_tmr_progressbar_transit_hide"); - edje_object_signal_emit(_EDJ(ad->ly_main), "progressbar.show", "*"); + elm_object_signal_emit(ad->ly_main, "progressbar.show", "*"); if (ad->tr != NULL) { Evas_Object *indicator = elm_object_part_content_get(ad->conform, "elm.swallow.circle"); @@ -233,23 +233,23 @@ static Eina_Bool _tmr_view_change_to_timeset_cb(void *data) ad->restart_flag = EINA_FALSE; _tmr_get_start_time(ad); - edje_object_signal_emit(_EDJ(ad->ly_main), "progressbar.hide", "*"); + elm_object_signal_emit(ad->ly_main, "progressbar.hide", "*"); elm_scroller_page_show(ad->scroller, 0, 0); evas_object_show(ad->hour_spinner); evas_object_show(ad->min_spinner); evas_object_show(ad->sec_spinner); - edje_object_signal_emit(_EDJ(ad->ly_main), "timer,cancel", "*"); + elm_object_signal_emit(ad->ly_main, "timer,cancel", "*"); memset(text, 0, sizeof(text)); - edje_object_signal_emit(_EDJ(ad->ly_main), "rbutton,reset", "*"); + elm_object_signal_emit(ad->ly_main, "rbutton,reset", "*"); snprintf(text, sizeof(text), S_(STRING_TMR_RESET)); _tmr_string_to_upper(text); elm_object_translatable_part_text_set(ad->ly_main, "rbutton", text); TMR_INFO("Top button changed to RESET"); _tmr_timepicker_time_update(ad); - edje_object_signal_emit(_EDJ(ad->progress), "default", ""); + elm_object_signal_emit(ad->progress, "default", ""); TMR_INFO("progressbar hide"); return ECORE_CALLBACK_CANCEL; @@ -284,7 +284,7 @@ static void _tmr_set_start_time(struct appdata *ad) Evas_Object *load_edj(Evas_Object * parent, const char *file, const char *group) { _TMR_ENTER_; - Evas_Object *eo; + Evas_Object *eo = NULL; int r; eo = elm_layout_add(parent); if (eo) { @@ -480,7 +480,7 @@ static void _tmr_keypad_activated_cb(void *data, Evas_Object * obj, void *event_ struct appdata *ad = (struct appdata *)data; TMR_INFO("keypad on"); - edje_object_signal_emit(_EDJ(ad->timepicker), "keypad,on", ""); + elm_object_signal_emit(ad->timepicker, "keypad,on", ""); } static void _tmr_keypad_dismissed_cb(void *data, Evas_Object * obj, void *event_info) @@ -491,7 +491,7 @@ static void _tmr_keypad_dismissed_cb(void *data, Evas_Object * obj, void *event_ struct appdata *ad = (struct appdata *)data; TMR_INFO("keypad off"); - edje_object_signal_emit(_EDJ(ad->timepicker), "keypad,off", ""); + elm_object_signal_emit(ad->timepicker, "keypad,off", ""); } static void _panel_timeset_add(void *data) @@ -639,11 +639,11 @@ static void _tmr_button_state_update(void *data) if (ad->hour == 0 && ad->min == 0 && ad->sec == 0) { elm_object_disabled_set(ad->eo_btn_lft, EINA_TRUE); TMR_INFO("btn disable"); - edje_object_signal_emit(_EDJ(ad->ly_main), "rbutton,hide", "*"); + elm_object_signal_emit(ad->ly_main, "rbutton,hide", "*"); } else { elm_object_disabled_set(ad->eo_btn_lft, EINA_FALSE); TMR_INFO("btn enable"); - edje_object_signal_emit(_EDJ(ad->ly_main), "rbutton,show", "*"); + elm_object_signal_emit(ad->ly_main, "rbutton,show", "*"); } } static void _tmr_timepicker_time_update(void *data) @@ -678,13 +678,13 @@ static void _tmr_set_time_number(struct appdata *ad, int min, int sec) _TMR_ENTER_; double r, g, b, a = 0; if (min >= 60) - edje_object_signal_emit(_EDJ(ad->progress), "with,hour", ""); + elm_object_signal_emit(ad->progress, "with,hour", ""); else - edje_object_signal_emit(_EDJ(ad->progress), "without,hour", ""); + elm_object_signal_emit(ad->progress, "without,hour", ""); if (min == 0 && sec < 6) { - edje_object_signal_emit(_EDJ(ad->progress), "alert", ""); + elm_object_signal_emit(ad->progress, "alert", ""); //todo: //edje_color_class_get("AO0181", &r, &g, &b, &a, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); r = 216.75; @@ -725,19 +725,19 @@ static void _tmr_set_time_number(struct appdata *ad, int min, int sec) snprintf(buf, sizeof(buf), "%s%s", zero, buf_hour); else snprintf(buf, sizeof(buf), "%s", buf_hour); - edje_object_part_text_set(_EDJ(ad->progress), "hour", buf); + elm_object_part_text_set(ad->progress, "hour", buf); if (min%60 < 10) snprintf(buf, sizeof(buf), "%s%s", zero, buf_min); else snprintf(buf, sizeof(buf), "%s", buf_min); - edje_object_part_text_set(_EDJ(ad->progress), "min", buf); + elm_object_part_text_set(ad->progress, "min", buf); if (sec < 10) snprintf(buf, sizeof(buf), "%s%s", zero, buf_sec); else snprintf(buf, sizeof(buf), "%s", buf_sec); - edje_object_part_text_set(_EDJ(ad->progress), "sec", buf); + elm_object_part_text_set(ad->progress, "sec", buf); free(buf_sec); free(buf_min); free(buf_hour); @@ -825,13 +825,13 @@ void _tmr_btn_update(struct appdata *ad) if (ad->cur_state == TMR_STATE_TYPE_START) { memset(text, 0, sizeof(text)); - edje_object_signal_emit(_EDJ(ad->ly_main), "rbutton,cancel", "*"); + elm_object_signal_emit(ad->ly_main, "rbutton,cancel", "*"); snprintf(text, sizeof(text), S_(STRING_TMR_CANCEL)); _tmr_string_to_upper(text); elm_object_translatable_part_text_set(ad->ly_main, "rbutton", text); memset(text, 0, sizeof(text)); - edje_object_signal_emit(_EDJ(ad->ly_main), "lbutton,pause", "*"); + elm_object_signal_emit(ad->ly_main, "lbutton,pause", "*"); snprintf(text, sizeof(text), S_(STRING_TMR_PAUSE)); _tmr_string_to_upper(text); elm_object_translatable_part_text_set(ad->ly_main, "lbutton", text); @@ -839,13 +839,13 @@ void _tmr_btn_update(struct appdata *ad) if (ad->cur_state == TMR_STATE_TYPE_STOP) { memset(text, 0, sizeof(text)); - edje_object_signal_emit(_EDJ(ad->ly_main), "rbutton,cancel", "*"); + elm_object_signal_emit(ad->ly_main, "rbutton,cancel", "*"); snprintf(text, sizeof(text), S_(STRING_TMR_CANCEL)); _tmr_string_to_upper(text); elm_object_translatable_part_text_set(ad->ly_main, "rbutton", text); memset(text, 0, sizeof(text)); - edje_object_signal_emit(_EDJ(ad->ly_main), "lbutton,resume", "*"); + elm_object_signal_emit(ad->ly_main, "lbutton,resume", "*"); snprintf(text, sizeof(text), S_(STRING_TMR_RESUME)); _tmr_string_to_upper(text); elm_object_translatable_part_text_set(ad->ly_main, "lbutton", text); @@ -1002,7 +1002,7 @@ static void _tmr_stop_cb(void *data) ad->start_systime = ad->current_systime; TMR_INFO("cancel alarm"); memset(text, 0, sizeof(text)); - edje_object_signal_emit(_EDJ(ad->ly_main), "lbutton,resume", "*"); + elm_object_signal_emit(ad->ly_main, "lbutton,resume", "*"); snprintf(text, sizeof(text), S_(STRING_TMR_RESUME)); _tmr_string_to_upper(text); elm_object_translatable_part_text_set(ad->ly_main, "lbutton", text); @@ -1059,7 +1059,7 @@ static void _tmr_reset_cb(void *data) free(ad->time_string); ad->time_string = NULL; } - edje_object_signal_emit(_EDJ(ad->progress), "default", ""); + elm_object_signal_emit(ad->progress, "default", ""); } static Eina_Bool _tmr_start_delay_cb(void *data) @@ -1071,10 +1071,10 @@ static Eina_Bool _tmr_start_delay_cb(void *data) struct appdata *ad = (struct appdata *)data; char text[256] = { 0 }; TMR_INFO("_tmr_start_delay_cb enter"); - edje_object_signal_emit(_EDJ(ad->ly_main), "timer,started", ""); + elm_object_signal_emit(ad->ly_main, "timer,started", ""); memset(text, 0, sizeof(text)); - edje_object_signal_emit(_EDJ(ad->ly_main), "rbutton,cancel", "*"); + elm_object_signal_emit(ad->ly_main, "rbutton,cancel", "*"); snprintf(text, sizeof(text), S_(STRING_TMR_CANCEL)); _tmr_string_to_upper(text); elm_object_translatable_part_text_set(ad->ly_main, "rbutton", text); @@ -1103,7 +1103,7 @@ static Eina_Bool _tmr_reset_delay_cb(void *data) struct appdata *ad = (struct appdata *)data; char text[256] = { 0 }; memset(text, 0, sizeof(text)); - edje_object_signal_emit(_EDJ(ad->ly_main), "rbutton,reset", "*"); + elm_object_signal_emit(ad->ly_main, "rbutton,reset", "*"); snprintf(text, sizeof(text), S_(STRING_TMR_RESET)); _tmr_string_to_upper(text); elm_object_translatable_part_text_set(ad->ly_main, "rbutton", text); @@ -1146,8 +1146,8 @@ static void _tmr_rbtn_cb_ex(void *data, Evas_Object *obj, const char *emission, TMR_ERR("now timer is reseting"); return; } - edje_object_signal_emit(_EDJ(ad->ly_main), "timer,cancel", "*"); - edje_object_signal_emit(elm_layout_edje_get(ad->ly_main), "progressbar.hide", "*"); + elm_object_signal_emit(ad->ly_main, "timer,cancel", "*"); + elm_object_signal_emit(ad->ly_main, "progressbar.hide", "*"); _tmr_progressbar_transit_hide(ad); TMR_INFO("progressbar hide"); ad->reset_delaying = EINA_TRUE; @@ -1194,10 +1194,10 @@ static void _tmr_startbtn_cb_ex(void *data, Evas_Object * obj, void *event_info) eext_circle_object_value_min_max_set(ad->progressbar, 0.0, ad->due_time.tv_sec); eext_circle_object_value_set(ad->progressbar, (ad->due_time.tv_sec+1)); - edje_object_signal_emit(_EDJ(ad->ly_main), "timer,started", ""); - edje_object_signal_emit(_EDJ(ad->ly_main), "rbutton,show", "*"); + elm_object_signal_emit(ad->ly_main, "timer,started", ""); + elm_object_signal_emit(ad->ly_main, "rbutton,show", "*"); memset(text1, 0, sizeof(text1)); - edje_object_signal_emit(_EDJ(ad->ly_main), "rbutton,cancel", "*"); + elm_object_signal_emit(ad->ly_main, "rbutton,cancel", "*"); snprintf(text1, sizeof(text1), S_(STRING_TMR_CANCEL)); _tmr_string_to_upper(text1); elm_object_translatable_part_text_set(ad->ly_main, "rbutton", text1); @@ -1220,10 +1220,10 @@ static void _tmr_startbtn_cb_ex(void *data, Evas_Object * obj, void *event_info) b = 89.25; a = 255; eext_circle_object_item_color_set(ad->progressbar, "bg", r, g, b, a); - edje_object_signal_emit(_EDJ(ad->ly_main), "progressbar.show", "*"); + elm_object_signal_emit(ad->ly_main, "progressbar.show", "*"); memset(text2, 0, sizeof(text2)); - edje_object_signal_emit(_EDJ(ad->ly_main), "lbutton,pause", "*"); + elm_object_signal_emit(ad->ly_main, "lbutton,pause", "*"); snprintf(text2, sizeof(text2), S_(STRING_TMR_PAUSE)); _tmr_string_to_upper(text2); elm_object_translatable_part_text_set(ad->ly_main, "lbutton", text2); @@ -1244,7 +1244,7 @@ void _tmr_lbtn_cb_ex(void *data, Evas_Object *obj, const char *emission, const c TMR_INFO("cur_state = %d", ad->cur_state); if (ad->cur_state == TMR_STATE_TYPE_STOP) { - edje_object_signal_emit(_EDJ(ad->ly_main), "timer,started", ""); + elm_object_signal_emit(ad->ly_main, "timer,started", ""); int ret = feedback_play(FEEDBACK_PATTERN_TAP); if (ret != FEEDBACK_ERROR_NONE) @@ -1252,13 +1252,13 @@ void _tmr_lbtn_cb_ex(void *data, Evas_Object *obj, const char *emission, const c memset(text1, 0, sizeof(text1)); - edje_object_signal_emit(_EDJ(ad->ly_main), "rbutton,cancel", "*"); + elm_object_signal_emit(ad->ly_main, "rbutton,cancel", "*"); snprintf(text1, sizeof(text1), S_(STRING_TMR_CANCEL)); _tmr_string_to_upper(text1); elm_object_translatable_part_text_set(ad->ly_main, "rbutton", text1); memset(text2, 0, sizeof(text2)); - edje_object_signal_emit(_EDJ(ad->ly_main), "lbutton,pause", "*"); + elm_object_signal_emit(ad->ly_main, "lbutton,pause", "*"); snprintf(text2, sizeof(text2), S_(STRING_TMR_PAUSE)); _tmr_string_to_upper(text2); elm_object_translatable_part_text_set(ad->ly_main, "lbutton", text2); @@ -1288,7 +1288,7 @@ void _tmr_lbtn_cb_ex(void *data, Evas_Object *obj, const char *emission, const c TMR_INFO("sec = %d, usec = %d", ad->due_time.tv_sec, ad->due_time.tv_usec); - edje_object_signal_emit(_EDJ(ad->ly_main), "timer,stopped", ""); + elm_object_signal_emit(ad->ly_main, "timer,stopped", ""); _tmr_stop_cb(ad); } @@ -1480,7 +1480,12 @@ static void _layout_create(appdata_s *ad) int r, g, b, a = 0; char text[256] = { 0 }; main_get_resource_path(ad); + ad->ly_main = NULL; ad->ly_main = load_edj(ad->navi_bar, ad->timer_edj_path, GRP_MAIN_GEAR3_NEW); + if( ad->ly_main == NULL) { + _D("layout creation failed"); + return; + } evas_object_size_hint_weight_set(ad->ly_main, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); eext_object_event_callback_add(ad->ly_main, EEXT_CALLBACK_BACK, layout_back_cb, ad); evas_object_event_callback_add(ad->ly_main, EVAS_CALLBACK_RESIZE, _layout_resize_cb, ad); @@ -1506,8 +1511,8 @@ static void _layout_create(appdata_s *ad) _tmr_string_to_upper(text); elm_object_translatable_part_text_set(ad->ly_main, "rbutton", text); - TMR_INFO("Top button changed to RESET"); - edje_object_signal_callback_add(_EDJ(ad->ly_main), "rbutton,clicked", "edj", _tmr_rbtn_cb_ex, ad); + + elm_object_signal_callback_add(ad->ly_main, "rbutton,clicked", "edj", _tmr_rbtn_cb_ex, ad); /* Create Bottom Button */ ad->eo_btn_lft = elm_button_add(ad->ly_main); @@ -1519,27 +1524,21 @@ static void _layout_create(appdata_s *ad) evas_object_smart_callback_add(ad->eo_btn_lft, "clicked", _tmr_startbtn_cb_ex, ad); elm_object_part_content_set(ad->ly_main, "elm.swallow.button", ad->eo_btn_lft); evas_object_show(ad->eo_btn_lft); - memset(text, 0, sizeof(text)); snprintf(text, sizeof(text), S_(STRING_TMR_PAUSE)); _tmr_string_to_upper(text); elm_object_translatable_part_text_set(ad->ly_main, "lbutton", text); - - edje_object_signal_callback_add(_EDJ(ad->ly_main), "lbutton,clicked", "edj", _tmr_lbtn_cb_ex, ad); - - ad->ei_naviframe = - elm_naviframe_item_push(ad->navi_bar, NULL, NULL, NULL, ad->ly_main, NULL); + elm_object_signal_callback_add(ad->ly_main, "lbutton,clicked", "edj", _tmr_lbtn_cb_ex, ad); + ad->ei_naviframe = elm_naviframe_item_push(ad->navi_bar, NULL, NULL, NULL, ad->ly_main, NULL); elm_naviframe_item_title_enabled_set(ad->ei_naviframe, EINA_FALSE, EINA_FALSE); elm_naviframe_item_pop_cb_set(ad->ei_naviframe, _pop_cb, ad); - memset(text, 0, sizeof(text)); snprintf(text, sizeof(text), S_(STRING_TMR_TIMER)); elm_object_item_domain_translatable_text_set(ad->ei_naviframe, PACKAGE, text); evas_object_show(ad->ly_main); evas_object_show(ad->navi_bar); - - edje_object_signal_emit(_EDJ(ad->ly_main), "screen,init", "*"); - + elm_object_signal_emit(ad->ly_main, "screen,init", "*"); + TMR_INFO("return"); } static void _layout_destroy(appdata_s *ad) @@ -1678,7 +1677,7 @@ static void app_control(app_control_h service, void *data) ad->hour = ad->min/60; ad->min = ad->min%60; _tmr_set_start_time(ad); - edje_object_signal_emit(_EDJ(ad->ly_main), "timer,cancel", "*"); + elm_object_signal_emit(ad->ly_main, "timer,cancel", "*"); if (ad->cur_state == TMR_STATE_TYPE_STOP || ad->cur_state == TMR_STATE_TYPE_START) { _tmr_reset_cb(ad); _tmr_startbtn_cb_ex(ad, NULL, NULL); @@ -1803,10 +1802,10 @@ static void app_control(app_control_h service, void *data) return; } - edje_object_signal_emit(_EDJ(ad->ly_main), "timer,started", "*"); + elm_object_signal_emit(ad->ly_main, "timer,started", "*"); memset(text, 0, sizeof(text)); - edje_object_signal_emit(_EDJ(ad->ly_main), "rbutton,cancel", "*"); + elm_object_signal_emit(ad->ly_main, "rbutton,cancel", "*"); snprintf(text, sizeof(text), S_(STRING_TMR_CANCEL)); _tmr_string_to_upper(text); elm_object_translatable_part_text_set(ad->ly_main, "rbutton", text); @@ -1819,7 +1818,7 @@ static void app_control(app_control_h service, void *data) eext_circle_object_value_min_max_set(ad->progressbar, 0.0, start_sec); eext_circle_object_value_set(ad->progressbar, (ad->due_time.tv_sec+1)); - edje_object_signal_emit(_EDJ(ad->ly_main), "progressbar.show", "*"); + elm_object_signal_emit(ad->ly_main, "progressbar.show", "*"); TMR_INFO("progressbar show"); _tmr_start_cb(ad); } |