TizenRefApp-6122 [Call UI] Implement language change feature 53/65753/3
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Fri, 8 Apr 2016 13:55:32 +0000 (16:55 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Tue, 12 Apr 2016 09:56:42 +0000 (12:56 +0300)
Change-Id: I7f7dd4e43a2a741d42f44fa3ffd68b8ef98daa5a

18 files changed:
inc/callui-common.h
inc/callui-view-manager.h
inc/callui.h
src/callui-action-bar.c
src/callui-common.c
src/callui-view-callend.c
src/callui-view-circle.c
src/callui-view-dialing.c
src/callui-view-elements.c
src/callui-view-incoming-call-noti.c
src/callui-view-incoming-call.c
src/callui-view-manager.c
src/callui-view-multi-call-conf.c
src/callui-view-multi-call-list.c
src/callui-view-multi-call-split.c
src/callui-view-quickpanel.c
src/callui-view-single-call.c
src/callui.c

index 3d3d517..144f155 100644 (file)
@@ -281,13 +281,20 @@ char *_callui_common_get_time_string(struct tm *time);
 struct tm *_callui_common_get_current_time_diff_in_tm(long time);
 
 /**
- * @brief Set the text for an object's part, marking it as translatable for call app domain
- * @param[in] obj              Evas object containing the text part
- * @param[in] part             name of the part to set
- * @param[in] text             the original, non-translated text to set
+ * @brief Set the text for an object's part, marking it translatable for call app domain
+ * @param[in] obj                      Evas object containing the text part
+ * @param[in] part                     name of the part to set
+ * @param[in] ids_string       IDS string to for text part
  */
 void _callui_common_eo_txt_part_set_translatable_text(Evas_Object *obj,
                const char *part,
                const char *ids_string);
 
-#endif //__CALLUI_COMMON_H_
+/**
+ * @brief Set the text to Eas_object marking it translatable for call app domain
+ * @param[in] obj                      Evas object to set text
+ * @param[in] ids_string       IDS string to set into the object
+ */
+void _callui_common_eo_set_translatable_text(Evas_Object *obj, const char *ids_string);
+
+#endif /*__CALLUI_COMMON_H_ */
index 2c791aa..1dea706 100644 (file)
@@ -38,25 +38,26 @@ typedef enum {
        VIEW_TYPE_MAX                                   /**< Max view count*/
 } callui_view_type_e;
 
-struct _view_data;
-
-typedef callui_result_e (*create_cb) (struct _view_data *view_data, void *appdata);
-typedef callui_result_e (*update_cb) (struct _view_data *view_data);
-typedef callui_result_e (*destroy_cb) (struct _view_data *view_data);
+typedef enum {
+       CALLUI_UF_LANG_CHANGE   = 0x01,
+       CALLUI_UF_DATA_REFRESH  = 0x02
+} callui_update_type_e;
 
+struct _view_data;
 typedef struct appdata callui_app_data_t;
 
 struct _view_data {
-       create_cb onCreate;
-       update_cb onUpdate;
-       destroy_cb onDestroy;
+       callui_result_e (*create) (struct _view_data *view_data, void *appdata);
+       callui_result_e (*update) (struct _view_data *view_data);
+       callui_result_e (*destroy) (struct _view_data *view_data);
+       callui_result_e (*pause) (struct _view_data *view_data);
+       callui_result_e (*resume) (struct _view_data *view_data);
 
        callui_app_data_t *ad;
-
        Evas_Object *contents;
-
        Ecore_Timer *call_duration_timer;
        struct tm *call_duration_tm;
+       int update_flags;
 };
 typedef struct _view_data call_view_data_base_t;
 
@@ -104,4 +105,31 @@ callui_result_e _callui_vm_auto_change_view(callui_vm_h vm);
  */
 callui_view_type_e _callui_vm_get_cur_view_type(callui_vm_h vm);
 
+/**
+ * @brief Pause view manager
+ *
+ * @param[in]  vm              View manager handler
+ *
+ * @return result CALLUI_RESULT_OK on success
+ */
+callui_result_e _callui_vm_pause(callui_vm_h vm);
+
+/**
+ * @brief Resume from pause view manager
+ *
+ * @param[in]  vm              View manager handler
+ *
+ * @return result CALLUI_RESULT_OK on success
+ */
+callui_result_e _callui_vm_resume(callui_vm_h vm);
+
+/**
+ * @brief Notify view manager that it is needed to update language
+ *
+ * @param[in]  vm              View manager handler
+ *
+ * @return result CALLUI_RESULT_OK on success
+ */
+callui_result_e _callui_vm_update_language(callui_vm_h vm);
+
 #endif /* __CALLUI_VIEW_MANAGER_H__ */
index ad0a814..823041c 100755 (executable)
@@ -19,6 +19,7 @@
 #define __CALLUI_H_
 
 #include <Elementary.h>
+#include <app_common.h>
 
 #include "callui-view-manager.h"
 #include "callui-lock-manager.h"
 #include "callui-view-quickpanel.h"
 #include "callui-action-bar.h"
 
+#define APP_HANDLERS_COUNT 1
+
 struct appdata {
        Evas_Object *win;
-       Evas_Object *win_conformant;
-       Evas_Object *nf;
        Evas_Object *main_ly;
 
        callui_qp_mc_h qp_minicontrol;
@@ -65,6 +66,9 @@ struct appdata {
        callui_sound_manager_h sound_manager;
 
        callui_call_state_data_t *end_call_data;
+
+       app_event_handler_h app_event_handlers[APP_HANDLERS_COUNT];
+
 };
 
 callui_app_data_t *_callui_get_app_data();
index 042ac13..48ee60b 100644 (file)
@@ -406,7 +406,7 @@ static Evas_Object *__create_action_button(
                CALLUI_RETURN_NULL_IF_FAIL(res == CALLUI_RESULT_OK);
        }
 
-       elm_object_domain_translatable_text_set(btn, CALLUI_TEXT_DOMAIN, btn_params[type].txt);
+       _callui_common_eo_set_translatable_text(btn, btn_params[type].txt);
        evas_object_smart_callback_add(btn, "clicked", btn_params[type].click_cb_func, action_bar->ad);
        elm_object_part_content_set(parent, btn_params[type].part, btn);
        evas_object_show(btn);
@@ -553,12 +553,21 @@ void _callui_action_bar_destroy(callui_action_bar_h action_bar)
        free(action_bar);
 }
 
+static void __update_btns_txt(callui_action_bar_h action_bar)
+{
+       int i = 0;
+       for (; i < ACTION_BTN_TYPE_MAX; i++) {
+               _callui_common_eo_set_translatable_text(action_bar->buttons[i], btn_params[i].txt);
+       }
+}
+
 void _callui_action_bar_show(callui_action_bar_h action_bar)
 {
        CALLUI_RETURN_IF_FAIL(action_bar);
 
        Evas_Object *parent = action_bar->ad->main_ly;
 
+       __update_btns_txt(action_bar);
        elm_object_part_content_set(parent, PART_SWALLOW_ACTION_BAR, action_bar->main_layout);
        evas_object_show(action_bar->main_layout);
 }
index c7f831e..2ada450 100755 (executable)
@@ -563,13 +563,13 @@ void _callui_common_reset_main_ly_text_fields(Evas_Object *contents)
        CALLUI_RETURN_IF_FAIL(contents);
        Evas_Object *caller_info = NULL;
 
-       edje_object_part_text_set(_EDJ(contents), "call_txt_status", "");
-       edje_object_part_text_set(_EDJ(contents), "txt_timer", "");
+       elm_object_part_text_set(contents, "call_txt_status", "");
+       elm_object_part_text_set(contents, "txt_timer", "");
 
        caller_info = elm_object_part_content_get(contents, "caller_info");
        if (caller_info) {
-               edje_object_part_text_set(_EDJ(caller_info), "txt_call_name", "");
-               edje_object_part_text_set(_EDJ(caller_info), "txt_phone_num", "");
+               elm_object_part_text_set(caller_info, "txt_call_name", "");
+               elm_object_part_text_set(caller_info, "txt_phone_num", "");
        }
 }
 
@@ -889,7 +889,7 @@ void _callui_common_set_call_duration_time(struct tm *cur_time,
        CALLUI_RETURN_IF_FAIL(part);
 
        char *tmp = _callui_common_get_time_string(cur_time);
-       elm_object_part_text_set(obj, part, _(tmp));
+       elm_object_part_text_set(obj, part, tmp);
        free(tmp);
 }
 
@@ -953,3 +953,12 @@ void _callui_common_eo_txt_part_set_translatable_text(Evas_Object *obj,
 
        elm_object_domain_translatable_part_text_set(obj, part, CALLUI_TEXT_DOMAIN, ids_string);
 }
+
+void _callui_common_eo_set_translatable_text(Evas_Object *obj, const char *ids_string)
+{
+       CALLUI_RETURN_IF_FAIL(obj);
+       CALLUI_RETURN_IF_FAIL(ids_string);
+
+       elm_object_domain_translatable_text_set(obj, CALLUI_TEXT_DOMAIN, ids_string);
+
+}
index 02c851e..b930b97 100644 (file)
@@ -85,9 +85,8 @@ callui_view_callend_h _callui_view_callend_new()
        callui_view_callend_h callend_view = calloc(1, sizeof(_callui_view_callend_t));
        CALLUI_RETURN_NULL_IF_FAIL(callend_view);
 
-       callend_view->base_view.onCreate = __callui_view_callend_oncreate;
-       callend_view->base_view.onUpdate = NULL;
-       callend_view->base_view.onDestroy = __callui_view_callend_ondestroy;
+       callend_view->base_view.create = __callui_view_callend_oncreate;
+       callend_view->base_view.destroy = __callui_view_callend_ondestroy;
 
        return callend_view;
 }
index 50d5d01..edcfa21 100755 (executable)
@@ -385,7 +385,8 @@ callui_result_e _callui_view_circle_create_reject_layout(callui_app_data_t *ad,
 
        elm_object_signal_emit(lock_reject, "outer_circle,hide", "outer-circle");
 
-       elm_object_part_text_set(lock_reject, "reject_text", _("IDS_CALL_BUTTON_REJECT"));
+       _callui_common_eo_txt_part_set_translatable_text(lock_reject,
+                       "reject_text", "IDS_CALL_BUTTON_REJECT");
 
        evas_object_data_set(lock_reject, CALLUI_CIRCLE_LAYOUT_DATA, vd);
 
@@ -444,7 +445,8 @@ callui_result_e _callui_view_circle_create_accept_layout(callui_app_data_t *ad,
 
        evas_object_data_set(lock_accept, CALLUI_CIRCLE_LAYOUT_DATA, vd);
 
-       elm_object_part_text_set(lock_accept, "accept_text", _("IDS_CALL_BUTTON_ACCEPT"));
+       _callui_common_eo_txt_part_set_translatable_text(lock_accept,
+                       "accept_text", "IDS_CALL_BUTTON_ACCEPT");
        evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MOUSE_DOWN, __callui_view_circle_mouse_down_cb, ad);
        evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MOUSE_MOVE, __callui_view_circle_mouse_move_cb, ad);
        evas_object_event_callback_add(lock_accept, EVAS_CALLBACK_MOUSE_UP, __callui_view_circle_mouse_up_cb, ad);
index e1c5afa..bc22457 100644 (file)
@@ -48,9 +48,9 @@ callui_view_dialing_h _callui_dialing_view_dialing_new()
        callui_view_dialing_h dialing_view = calloc(1, sizeof(_callui_view_dialing_t));
        CALLUI_RETURN_NULL_IF_FAIL(dialing_view);
 
-       dialing_view->base_view.onCreate = __callui_view_dialing_oncreate;
-       dialing_view->base_view.onUpdate = __callui_view_dialing_onupdate;
-       dialing_view->base_view.onDestroy = __callui_view_dialing_ondestroy;
+       dialing_view->base_view.create = __callui_view_dialing_oncreate;
+       dialing_view->base_view.update = __callui_view_dialing_onupdate;
+       dialing_view->base_view.destroy = __callui_view_dialing_ondestroy;
 
        return dialing_view;
 }
@@ -159,7 +159,7 @@ static callui_result_e __update_displayed_data(callui_view_dialing_h vd)
        }
 
        if (now_call_data->is_emergency) {
-               call_name = _("IDS_COM_BODY_EMERGENCY_NUMBER");
+               call_name = "IDS_COM_BODY_EMERGENCY_NUMBER";
                disp_number = "";
        }
 
@@ -175,7 +175,7 @@ static callui_result_e __update_displayed_data(callui_view_dialing_h vd)
                elm_object_signal_emit(vd->caller_info, "2line", "caller_name");
        }
 
-       _callui_show_caller_info_status(ad, _("IDS_CALL_POP_DIALLING"));
+       _callui_show_caller_info_status(ad, "IDS_CALL_POP_DIALLING");
 
        if (now_call_data->is_emergency == EINA_TRUE) {
                elm_object_signal_emit(vd->caller_info, "set_emergency_mode", "");
index e9648b9..c3b2f0d 100755 (executable)
@@ -170,29 +170,23 @@ Evas_Object *_callui_create_thumbnail_with_size(Evas_Object *parent, const char
 /* Caller info name or number*/
 void _callui_show_caller_info_name(void *data, const char *name)
 {
-       Evas_Object *layout = NULL;
-
-       layout = __callui_get_caller_info_layout(data);
-       edje_object_part_text_set(_EDJ(layout), "txt_call_name", name);
+       Evas_Object *layout = __callui_get_caller_info_layout(data);
+       _callui_common_eo_txt_part_set_translatable_text(layout, "txt_call_name", name);
 }
 
 /* Caller info number */
 void _callui_show_caller_info_number(void *data, const char *number)
 {
-       Evas_Object *layout = NULL;
-
-       layout = __callui_get_caller_info_layout(data);
-       edje_object_part_text_set(_EDJ(layout), "txt_phone_num", number);
+       Evas_Object *layout = __callui_get_caller_info_layout(data);
+       elm_object_part_text_set(layout, "txt_phone_num", number);
 }
 
 /* Caller info status*/
 Evas_Object *_callui_show_caller_info_status(void *data, const char *status)
 {
-       Evas_Object *layout = NULL;
-
        callui_app_data_t *ad = (callui_app_data_t *)data;
-       layout = elm_object_part_content_get(ad->main_ly, "elm.swallow.content");
-       edje_object_part_text_set(_EDJ(layout), "call_txt_status", status);
+       Evas_Object *layout = elm_object_part_content_get(ad->main_ly, "elm.swallow.content");
+       _callui_common_eo_txt_part_set_translatable_text(layout, "call_txt_status", status);
 
        return layout;
 }
@@ -725,17 +719,17 @@ void _callui_load_bluetooth_popup(callui_app_data_t *ad)
        evas_object_size_hint_weight_set(ad->bt_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
        elm_object_domain_translatable_part_text_set(ad->bt_popup, "title,text", CALLUI_TEXT_DOMAIN, "IDS_CALL_HEADER_TURN_ON_BLUETOOTH_ABB");
-       elm_object_text_set(ad->bt_popup, _("IDS_CALL_POP_TO_SWITCH_TO_USING_YOUR_BLUETOOTH_DEVICE_BLUETOOTH_WILL_BE_TURNED_ON"));
+       _callui_common_eo_set_translatable_text(ad->bt_popup, "IDS_CALL_POP_TO_SWITCH_TO_USING_YOUR_BLUETOOTH_DEVICE_BLUETOOTH_WILL_BE_TURNED_ON");
 
        btn_cancel = elm_button_add(ad->bt_popup);
        elm_object_style_set(btn_cancel, "popup");
-       elm_object_text_set(btn_cancel, _("IDS_COM_SK_CANCEL"));
+       _callui_common_eo_set_translatable_text(btn_cancel, "IDS_COM_SK_CANCEL");
        elm_object_part_content_set(ad->bt_popup, "button1", btn_cancel);
        evas_object_smart_callback_add(btn_cancel, "clicked", __callui_bt_popup_cancel_btn_cb, ad);
 
        btn_ok = elm_button_add(ad->bt_popup);
        elm_object_style_set(btn_ok, "popup");
-       elm_object_text_set(btn_ok, _("IDS_COM_SK_OK"));
+       _callui_common_eo_set_translatable_text(btn_ok, "IDS_COM_SK_OK");
        elm_object_part_content_set(ad->bt_popup, "button2", btn_ok);
        evas_object_smart_callback_add(btn_ok, "clicked", __callui_bt_popup_ok_btn_cb, ad);
 
@@ -779,7 +773,7 @@ int _callui_create_reject_msg_button(void *app_data, Evas_Object *parent, const
        CALLUI_RETURN_VALUE_IF_FAIL(msg_button, CALLUI_RESULT_ALLOCATION_FAIL);
 
        elm_object_style_set(msg_button, "default");
-       elm_object_text_set(msg_button,  _("IDS_CALL_BUTTON_COMPOSE_MESSAGE_TO_SEND_ABB"));
+       _callui_common_eo_set_translatable_text(msg_button,  "IDS_CALL_BUTTON_COMPOSE_MESSAGE_TO_SEND_ABB");
        evas_object_smart_callback_add(msg_button, "clicked", __callui_create_new_msg_btn_click_cb, app_data);
        elm_object_part_content_set(parent, part, msg_button);
        evas_object_show(msg_button);
index 5fa0f72..69d46cb 100644 (file)
@@ -81,9 +81,9 @@ callui_view_incoming_call_noti_h _callui_view_incoming_call_noti_new()
        callui_view_incoming_call_noti_h incoming_call_noti = calloc(1, sizeof(_callui_view_incoming_call_noti_t));
        CALLUI_RETURN_NULL_IF_FAIL(incoming_call_noti);
 
-       incoming_call_noti->base_view.onCreate = __callui_view_incoming_call_noti_oncreate;
-       incoming_call_noti->base_view.onUpdate = __callui_view_incoming_call_noti_onupdate;
-       incoming_call_noti->base_view.onDestroy = __callui_view_incoming_call_noti_ondestroy;
+       incoming_call_noti->base_view.create = __callui_view_incoming_call_noti_oncreate;
+       incoming_call_noti->base_view.update = __callui_view_incoming_call_noti_onupdate;
+       incoming_call_noti->base_view.destroy = __callui_view_incoming_call_noti_ondestroy;
 
        return incoming_call_noti;
 }
@@ -448,7 +448,8 @@ static callui_result_e __update_displayed_data(callui_view_incoming_call_noti_h
 
        if (!(call_name && call_name[0] != '\0') && !(call_number && call_number[0] != '\0')) {
                elm_object_signal_emit(vd->base_view.contents, "big_buttons", "main_active_noti_call");
-               elm_object_part_text_set(vd->base_view.contents, "text.contact_name", _("IDS_CALL_BODY_UNKNOWN"));
+               _callui_common_eo_txt_part_set_translatable_text(vd->base_view.contents,
+                               "text.contact_name", "IDS_CALL_BODY_UNKNOWN");
        } else if (!(call_name && call_name[0] != '\0')) {
                elm_object_signal_emit(vd->base_view.contents, "small_buttons", "main_active_noti_call");
                elm_object_part_text_set(vd->base_view.contents, "text.contact_name", call_number);
index 173cc39..f324606 100644 (file)
@@ -101,9 +101,9 @@ callui_view_incoming_call_h _callui_view_incoming_call_new()
        callui_view_incoming_call_h incoming_lock_view = calloc(1, sizeof(_callui_view_incoming_call_t));
        CALLUI_RETURN_NULL_IF_FAIL(incoming_lock_view);
 
-       incoming_lock_view->base_view.onCreate = __callui_view_incoming_call_oncreate;
-       incoming_lock_view->base_view.onUpdate = __callui_view_incoming_call_onupdate;
-       incoming_lock_view->base_view.onDestroy = __callui_view_incoming_call_ondestroy;
+       incoming_lock_view->base_view.create = __callui_view_incoming_call_oncreate;
+       incoming_lock_view->base_view.update = __callui_view_incoming_call_onupdate;
+       incoming_lock_view->base_view.destroy = __callui_view_incoming_call_ondestroy;
 
        return incoming_lock_view;
 }
@@ -760,7 +760,8 @@ static void __create_reject_msg_layout(callui_view_incoming_call_h vd)
        evas_object_event_callback_add(reject_msg_bg, EVAS_CALLBACK_MOUSE_MOVE, __reject_msg_bg_mouse_move_cb, vd);
        evas_object_event_callback_add(reject_msg_bg, EVAS_CALLBACK_MOUSE_UP, __reject_msg_bg_mouse_up_cb, vd);
 
-       elm_object_part_text_set(vd->reject_msg_layout, "reject_msg_text", _("IDS_VCALL_BUTTON2_REJECT_CALL_WITH_MESSAGE"));
+       _callui_common_eo_txt_part_set_translatable_text(vd->reject_msg_layout,
+                       "reject_msg_text", "IDS_VCALL_BUTTON2_REJECT_CALL_WITH_MESSAGE");
 
        elm_object_signal_emit(vd->reject_msg_layout, "show-up-arrow", "reject_msg");
        evas_object_data_set(vd->reject_msg_layout, CALLUI_REJ_MSG_LIST_OPEN_STATUS_KEY, (const void *)EINA_FALSE);
@@ -783,7 +784,7 @@ static callui_result_e __create_main_content(callui_view_incoming_call_h vd)
        CALLUI_RETURN_VALUE_IF_FAIL(vd->caller_info, CALLUI_RESULT_ALLOCATION_FAIL);
        elm_object_part_content_set(vd->base_view.contents, "caller_info", vd->caller_info);
 
-       _callui_show_caller_info_status(ad, _("IDS_CALL_BODY_INCOMING_CALL"));
+       _callui_show_caller_info_status(ad, "IDS_CALL_BODY_INCOMING_CALL");
 
        callui_result_e res = _callui_view_circle_create_accept_layout(ad, vd, vd->base_view.contents);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
index f148e1b..093259c 100644 (file)
@@ -38,6 +38,7 @@ struct _callui_vm {
        callui_app_data_t *ad;
 
        bool is_conf_call_ended;
+       bool is_paused;
 };
 typedef struct _callui_vm callui_vm_t;
 
@@ -48,6 +49,7 @@ static callui_result_e __destroy_cur_view(callui_vm_h vm);
 static callui_result_e __create_update_view(callui_vm_h vm, callui_view_type_e type);
 static call_view_data_base_t *__allocate_view(callui_view_type_e view_type);
 static callui_result_e __change_view(callui_vm_h vm, callui_view_type_e type);
+static void __update_cur_view(callui_vm_h vm);
 static callui_result_e __auto_change_view(callui_vm_h vm, callui_call_state_data_t *call_data);
 static void __call_state_event_cb(void *user_data,
                callui_call_event_type_e call_event_type,
@@ -214,6 +216,7 @@ static callui_result_e __callui_vm_init(callui_vm_h vm, callui_app_data_t *ad)
 {
        vm->cur_view_type = VIEW_TYPE_UNDEFINED;
        vm->ad = ad;
+       vm->is_paused = true;
 
        callui_result_e res = _callui_stp_add_call_state_event_cb(ad->state_provider, __call_state_event_cb, vm);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
@@ -245,6 +248,7 @@ callui_vm_h _callui_vm_create(callui_app_data_t *ad)
        if (res != CALLUI_RESULT_OK) {
                FREE(vm);
        }
+
        return vm;
 }
 
@@ -273,10 +277,10 @@ static callui_result_e __destroy_cur_view(callui_vm_h vm)
        call_view_data_base_t *view = vm->cur_view;
 
        CALLUI_RETURN_VALUE_IF_FAIL(view, CALLUI_RESULT_FAIL);
-       CALLUI_RETURN_VALUE_IF_FAIL(view->onDestroy, CALLUI_RESULT_FAIL);
+       CALLUI_RETURN_VALUE_IF_FAIL(view->destroy, CALLUI_RESULT_FAIL);
 
-       if (view->onDestroy) {
-               res = view->onDestroy(view);
+       if (view->destroy) {
+               res = view->destroy(view);
        }
 
        vm->cur_view = NULL;
@@ -296,25 +300,26 @@ static callui_result_e __create_update_view(callui_vm_h vm, callui_view_type_e t
                view = __allocate_view(type);
                CALLUI_RETURN_VALUE_IF_FAIL(view, CALLUI_RESULT_FAIL);
 
-               if (!view->onCreate) {
-                       err("Create callback is NULL");
+               if (!view->create) {
+                       err("create() is NULL");
                        free(view);
                        return CALLUI_RESULT_FAIL;
                }
 
-               res = view->onCreate(view, vm->ad);
+               res = view->create(view, vm->ad);
 
                if (res != CALLUI_RESULT_OK) {
-                       err("onCreate callback failed! res[%d]", res);
+                       err("create() failed! res[%d]", res);
                        free(view);
                        return CALLUI_RESULT_FAIL;
                }
                vm->cur_view = view;
 
        } else {
-               dbg("Try update view [%d]", type);
-               CALLUI_RETURN_VALUE_IF_FAIL(view->onUpdate, CALLUI_RESULT_OK);
-               view->onUpdate(view);
+               vm->cur_view->update_flags |= CALLUI_UF_DATA_REFRESH;
+               if (!vm->is_paused) {
+                       __update_cur_view(vm);
+               }
        }
        return CALLUI_RESULT_OK;
 }
@@ -327,7 +332,6 @@ static callui_result_e __change_view(callui_vm_h vm, callui_view_type_e type)
                err("Invalid view type [%d]", type);
                return CALLUI_RESULT_INVALID_PARAM;
        }
-
        info("Change view: [%d] -> [%d]", vm->cur_view_type, type);
 
        callui_result_e res;
@@ -373,3 +377,61 @@ callui_result_e _callui_vm_auto_change_view(callui_vm_h vm)
 
        return __auto_change_view(vm, NULL);
 }
+
+static void __update_cur_view(callui_vm_h vm)
+{
+       call_view_data_base_t *cur_view = vm->cur_view;
+
+       if (cur_view->update && cur_view->update_flags) {
+               cur_view->update(vm->cur_view);
+               cur_view->update_flags = 0;
+       }
+}
+
+callui_result_e _callui_vm_pause(callui_vm_h vm)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(vm, CALLUI_RESULT_INVALID_PARAM);
+       CALLUI_RETURN_VALUE_IF_FAIL(!vm->is_paused, CALLUI_RESULT_FAIL);
+
+       vm->is_paused = true;
+
+       call_view_data_base_t *cur_view = vm->cur_view;
+
+       if (cur_view && cur_view->pause) {
+               cur_view->pause(vm->cur_view);
+       }
+
+       return CALLUI_RESULT_OK;
+}
+
+callui_result_e _callui_vm_resume(callui_vm_h vm)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(vm, CALLUI_RESULT_INVALID_PARAM);
+       CALLUI_RETURN_VALUE_IF_FAIL(vm->is_paused, CALLUI_RESULT_FAIL);
+
+       vm->is_paused = false;
+
+       call_view_data_base_t *cur_view = vm->cur_view;
+       if (cur_view && cur_view->resume) {
+               cur_view->resume(vm->cur_view);
+       }
+       __update_cur_view(vm);
+
+       return CALLUI_RESULT_OK;
+}
+
+callui_result_e _callui_vm_update_language(callui_vm_h vm)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(vm, CALLUI_RESULT_INVALID_PARAM);
+
+       call_view_data_base_t *cur_view = vm->cur_view;
+
+       if (cur_view) {
+               cur_view->update_flags |= CALLUI_UF_LANG_CHANGE;
+               if (!vm->is_paused) {
+                       __update_cur_view(vm);
+               }
+       }
+
+       return CALLUI_RESULT_OK;
+}
index d65476b..7c9f57a 100755 (executable)
@@ -57,9 +57,9 @@ callui_view_mc_conf_h _callui_view_multi_call_conf_new()
        callui_view_mc_conf_h mc_list_conf = calloc(1, sizeof(_callui_view_mc_conf_t));
        CALLUI_RETURN_NULL_IF_FAIL(mc_list_conf);
 
-       mc_list_conf->base_view.onCreate = __callui_view_multi_call_conf_oncreate;
-       mc_list_conf->base_view.onUpdate = __callui_view_multi_call_conf_onupdate;
-       mc_list_conf->base_view.onDestroy = __callui_view_multi_call_conf_ondestroy;
+       mc_list_conf->base_view.create = __callui_view_multi_call_conf_oncreate;
+       mc_list_conf->base_view.update = __callui_view_multi_call_conf_onupdate;
+       mc_list_conf->base_view.destroy = __callui_view_multi_call_conf_ondestroy;
 
        return mc_list_conf;
 }
@@ -113,11 +113,37 @@ static callui_result_e __callui_view_multi_call_conf_oncreate(call_view_data_bas
        return __update_displayed_data(vd);
 }
 
+static callui_result_e __update_nonetranslatable_elements(callui_view_mc_conf_h vd)
+{
+       char buf[CALLUI_BUF_MEMBER_SIZE] = { 0 };
+       callui_app_data_t *ad = vd->base_view.ad;
+
+       const callui_call_state_data_t *call_data =
+                       _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+       if (!call_data) {
+               call_data = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_HELD);
+       }
+       CALLUI_RETURN_VALUE_IF_FAIL(call_data, CALLUI_RESULT_FAIL);
+
+       char *status = _("IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB");
+       snprintf(buf, CALLUI_BUF_MEMBER_SIZE, status, call_data->conf_member_count);
+       _callui_show_caller_info_number(ad, buf);
+
+       return CALLUI_RESULT_OK;
+}
+
 static callui_result_e __callui_view_multi_call_conf_onupdate(call_view_data_base_t *view_data)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
-       return __update_displayed_data((callui_view_mc_conf_h)view_data);
+       callui_view_mc_conf_h vd = (callui_view_mc_conf_h)view_data;
+       callui_result_e res = CALLUI_RESULT_FAIL;
+       if (vd->base_view.update_flags & CALLUI_UF_DATA_REFRESH) {
+               res = __update_displayed_data(vd);
+       } else if (vd->base_view.update_flags & CALLUI_UF_LANG_CHANGE) {
+               res = __update_nonetranslatable_elements(vd);
+       }
+       return res;
 }
 
 static Eina_Bool __call_duration_timer_cb(void* data)
@@ -149,7 +175,6 @@ static callui_result_e __update_displayed_data(callui_view_mc_conf_h vd)
        callui_app_data_t *ad = vd->base_view.ad;
 
        char buf[CALLUI_BUF_MEMBER_SIZE] = { 0 };
-       char status_txt[CALLUI_BUF_STATUS_SIZE] = { 0 };
 
        Eina_Bool is_held = EINA_FALSE;
 
@@ -166,9 +191,7 @@ static callui_result_e __update_displayed_data(callui_view_mc_conf_h vd)
 
        if (is_held) {
                elm_object_signal_emit(vd->caller_info, "hide,arrow", "");
-
-               snprintf(status_txt, sizeof(status_txt), _("IDS_CALL_BODY_ON_HOLD_ABB"));
-               _callui_show_caller_info_status(ad, status_txt);
+               _callui_show_caller_info_status(ad, "IDS_CALL_BODY_ON_HOLD_ABB");
 
        } else {
                elm_object_signal_emit(vd->caller_info, "show,arrow", "");
@@ -183,7 +206,8 @@ static callui_result_e __update_displayed_data(callui_view_mc_conf_h vd)
        }
 
        elm_object_signal_emit(vd->caller_info, "set_conference_mode", "");
-       _callui_show_caller_info_name(ad, _("IDS_CALL_BODY_CONFERENCE"));
+       _callui_show_caller_info_name(ad, "IDS_CALL_BODY_CONFERENCE");
+
        char *status = _("IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB");
        snprintf(buf, CALLUI_BUF_MEMBER_SIZE, status, call_data->conf_member_count);
        _callui_show_caller_info_number(ad, buf);
index aa04410..c5845ed 100755 (executable)
@@ -65,9 +65,9 @@ callui_view_mc_list_h _callui_view_multi_call_list_new()
        callui_view_mc_list_h mc_list_view = calloc(1, sizeof(_callui_view_mc_list_t));
        CALLUI_RETURN_NULL_IF_FAIL(mc_list_view);
 
-       mc_list_view->base_view.onCreate = __callui_view_multi_call_list_oncreate;
-       mc_list_view->base_view.onUpdate = __callui_view_multi_call_list_onupdate;
-       mc_list_view->base_view.onDestroy = __callui_view_multi_call_list_ondestroy;
+       mc_list_view->base_view.create = __callui_view_multi_call_list_oncreate;
+       mc_list_view->base_view.update = __callui_view_multi_call_list_onupdate;
+       mc_list_view->base_view.destroy = __callui_view_multi_call_list_ondestroy;
 
        return mc_list_view;
 }
@@ -193,7 +193,7 @@ static callui_result_e __create_main_content(callui_view_mc_list_h vd)
        Evas_Object *back_btn = elm_button_add(vd->base_view.contents);
        CALLUI_RETURN_VALUE_IF_FAIL(back_btn, CALLUI_RESULT_ALLOCATION_FAIL);
        elm_object_style_set(back_btn, "bottom");
-       elm_object_text_set(back_btn, _("IDS_CALL_BUTTON_RETURN_TO_CALL_SCREEN_ABB"));
+       _callui_common_eo_set_translatable_text(back_btn, "IDS_CALL_BUTTON_RETURN_TO_CALL_SCREEN_ABB");
        elm_object_part_content_set(vd->base_view.contents, "bottom_btn", back_btn);
        evas_object_smart_callback_add(back_btn, "clicked", __back_btn_click_cb, ad);
        evas_object_show(back_btn);
index 512d94d..9f6bd89 100755 (executable)
@@ -42,6 +42,8 @@ static callui_result_e _callui_view_multi_call_split_oncreate(call_view_data_bas
 static callui_result_e _callui_view_multi_call_split_onupdate(call_view_data_base_t *view_data);
 static callui_result_e _callui_view_multi_call_split_ondestroy(call_view_data_base_t *view_data);
 
+static callui_result_e __update_nonetranslatable_elements(callui_view_mc_split_h vd);
+
 static callui_result_e __create_main_content(callui_view_mc_split_h vd);
 static callui_result_e __update_displayed_data(callui_view_mc_split_h vd);
 
@@ -69,13 +71,39 @@ callui_view_mc_split_h _callui_view_multi_call_split_new()
        callui_view_mc_split_h mc_split_view = calloc(1, sizeof(_callui_view_mc_split_t));
        CALLUI_RETURN_NULL_IF_FAIL(mc_split_view);
 
-       mc_split_view->base_view.onCreate = _callui_view_multi_call_split_oncreate;
-       mc_split_view->base_view.onUpdate = _callui_view_multi_call_split_onupdate;
-       mc_split_view->base_view.onDestroy = _callui_view_multi_call_split_ondestroy;
+       mc_split_view->base_view.create = _callui_view_multi_call_split_oncreate;
+       mc_split_view->base_view.update = _callui_view_multi_call_split_onupdate;
+       mc_split_view->base_view.destroy = _callui_view_multi_call_split_ondestroy;
 
        return mc_split_view;
 }
 
+static callui_result_e __update_nonetranslatable_elements(callui_view_mc_split_h vd)
+{
+       callui_app_data_t *ad = vd->base_view.ad;
+
+       const callui_call_state_data_t *active = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+       CALLUI_RETURN_VALUE_IF_FAIL(active, CALLUI_RESULT_FAIL);
+
+       const callui_call_state_data_t *held = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_HELD);
+       CALLUI_RETURN_VALUE_IF_FAIL(held, CALLUI_RESULT_FAIL);
+
+       char buffer[BUF_SIZE] = { 0 };
+       const char *fmt = _("IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB");
+
+       if (held->conf_member_count > 1) {
+               snprintf(buffer, BUF_SIZE, fmt, held->conf_member_count);
+               elm_object_part_text_set(vd->hold_layout, PART_TEXT_SUB, buffer);
+       }
+
+       if (active->conf_member_count > 1) {
+               snprintf(buffer, BUF_SIZE, fmt, active->conf_member_count);
+               elm_object_part_text_set(vd->active_layout, PART_TEXT_SUB, buffer);
+       }
+
+       return CALLUI_RESULT_OK;
+}
+
 static callui_result_e _callui_view_multi_call_split_oncreate(call_view_data_base_t *view_data, void *appdata)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
@@ -99,11 +127,16 @@ static callui_result_e _callui_view_multi_call_split_onupdate(call_view_data_bas
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
        callui_view_mc_split_h vd = (callui_view_mc_split_h)view_data;
-       callui_app_data_t *ad = vd->base_view.ad;
 
-       _callui_lock_manager_start(ad->lock_handle);
+       _callui_lock_manager_start(vd->base_view.ad->lock_handle);
 
-       return  __update_displayed_data(vd);
+       callui_result_e res = CALLUI_RESULT_FAIL;
+       if (vd->base_view.update_flags & CALLUI_UF_DATA_REFRESH) {
+               res = __update_displayed_data(vd);
+       } else if (vd->base_view.update_flags & CALLUI_UF_LANG_CHANGE) {
+               res = __update_nonetranslatable_elements(vd);
+       }
+       return res;
 }
 
 static callui_result_e _callui_view_multi_call_split_ondestroy(call_view_data_base_t *view_data)
@@ -167,7 +200,7 @@ static Evas_Object *__create_merge_swap_btn(Evas_Object *parent, const char *nam
        Evas_Object *layout = elm_layout_add(parent);
        elm_layout_file_set(layout, EDJ_NAME, name);
 
-       elm_object_part_text_set(layout, MERGE_SWAP_BTN_PART_TEXT, text);
+       _callui_common_eo_txt_part_set_translatable_text(layout, MERGE_SWAP_BTN_PART_TEXT, text);
 
        return layout;
 }
@@ -204,7 +237,8 @@ static void __fill_conference_layout(Evas_Object *parent, const callui_call_stat
        Evas_Object *thumbnail = _callui_create_thumbnail(parent, NULL, CONFERENCE_THUMBNAIL_138);
        elm_object_part_content_set(parent, PART_SWALLOW_CALLER_ID, thumbnail);
 
-       elm_object_part_text_set(parent, PART_TEXT_MAIN, _("IDS_CALL_BODY_CONFERENCE"));
+       _callui_common_eo_txt_part_set_translatable_text(parent,
+                       PART_TEXT_MAIN, "IDS_CALL_BODY_CONFERENCE");
 
        char buffer[BUF_SIZE] = { 0 };
        const char *fmt = _("IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB");
@@ -214,14 +248,16 @@ static void __fill_conference_layout(Evas_Object *parent, const callui_call_stat
 
 static void __set_hold_info(Evas_Object *parent, Evas_Object *content)
 {
-       elm_object_part_text_set(content, PART_TEXT_STATUS, _("IDS_CALL_BODY_ON_HOLD_ABB"));
+       _callui_common_eo_txt_part_set_translatable_text(content,
+                       PART_TEXT_STATUS, "IDS_CALL_BODY_ON_HOLD_ABB");
 
        elm_object_part_content_set(parent, PART_SWALLOW_HOLD_INFO, content);
 }
 
 static void __set_active_info(Evas_Object *parent, Evas_Object *content, callui_app_data_t *ad)
 {
-       elm_object_part_text_set(content, PART_TEXT_STATUS, _("IDS_CALL_BODY_CONNECTED_M_STATUS_ABB"));
+       _callui_common_eo_txt_part_set_translatable_text(content,
+                       PART_TEXT_STATUS, "IDS_CALL_BODY_CONNECTED_M_STATUS_ABB");
 
        elm_object_part_content_set(parent, PART_SWALLOW_ACTIVE_INFO, content);
 
@@ -241,12 +277,12 @@ static void __set_active_info(Evas_Object *parent, Evas_Object *content, callui_
 
 static callui_result_e __create_merge_swap_btns(Evas_Object *parent, callui_app_data_t *ad)
 {
-       Evas_Object *merge = __create_merge_swap_btn(parent, GROUP_MERGE_BTN, _("IDS_CALL_BODY_MERGE_T_CALL"));
+       Evas_Object *merge = __create_merge_swap_btn(parent, GROUP_MERGE_BTN, "IDS_CALL_BODY_MERGE_T_CALL");
        CALLUI_RETURN_VALUE_IF_FAIL(merge, CALLUI_RESULT_ALLOCATION_FAIL);
        elm_object_part_content_set(parent, PART_SWALLOW_MERGE, merge);
        elm_object_signal_callback_add(merge, "mouse,clicked,*", "*", __merge_btn_click_cb, ad);
 
-       Evas_Object *swap = __create_merge_swap_btn(parent, GROUP_SWAP_BTN, _("IDS_CALL_SK_MULTICALL_SWAP"));
+       Evas_Object *swap = __create_merge_swap_btn(parent, GROUP_SWAP_BTN, "IDS_CALL_SK_MULTICALL_SWAP");
        CALLUI_RETURN_VALUE_IF_FAIL(merge, CALLUI_RESULT_ALLOCATION_FAIL);
        elm_object_part_content_set(parent, PART_SWALLOW_SWAP, swap);
        elm_object_signal_callback_add(swap, "mouse,clicked,*", "*", __swap_btn_click_cb, ad);
index 48842ca..814838b 100755 (executable)
@@ -329,14 +329,15 @@ static void __update_caller_info(Evas_Object *eo, const callui_call_state_data_t
 
        if (strlen(call_name) == 0) {
                if (strlen(call_number) == 0) {
-                       edje_object_part_text_set(_EDJ(eo), "txt_call_name", _("IDS_CALL_BODY_UNKNOWN"));
+                       _callui_common_eo_txt_part_set_translatable_text(eo,
+                                       "txt_call_name", "IDS_CALL_BODY_UNKNOWN");
                } else {
-                       edje_object_part_text_set(_EDJ(eo), "txt_call_name", call_number);
+                       elm_object_part_text_set(eo, "txt_call_name", call_number);
                }
        } else {
                char *convert_text = evas_textblock_text_utf8_to_markup(NULL, call_name);
                if (convert_text) {
-                       edje_object_part_text_set(_EDJ(eo), "txt_call_name", convert_text);
+                       elm_object_part_text_set(eo, "txt_call_name", convert_text);
                        free(convert_text);
                        convert_text = NULL;
                } else {
@@ -673,7 +674,8 @@ static void __update_text_components(char *txt_status, int count, Evas_Object *e
                elm_object_part_text_set(eo, "txt_timer", txt_status);
        }
        if (count > 1) {
-               elm_object_part_text_set(eo, "txt_call_name", _("IDS_CALL_OPT_CONFERENCE_CALL"));
+               _callui_common_eo_txt_part_set_translatable_text(eo,
+                               "txt_call_name", "IDS_CALL_OPT_CONFERENCE_CALL");
        }
 }
 
index 2f4198f..38c5420 100644 (file)
@@ -54,9 +54,9 @@ call_view_single_call_h _callui_view_single_call_new()
        call_view_single_call_h single_call_view = calloc(1, sizeof(_call_view_single_call_t));
        CALLUI_RETURN_NULL_IF_FAIL(single_call_view);
 
-       single_call_view->base_view.onCreate = __callui_view_single_call_oncreate;
-       single_call_view->base_view.onUpdate = __callui_view_single_call_onupdate;
-       single_call_view->base_view.onDestroy = __callui_view_single_call_ondestroy;
+       single_call_view->base_view.create = __callui_view_single_call_oncreate;
+       single_call_view->base_view.update = __callui_view_single_call_onupdate;
+       single_call_view->base_view.destroy = __callui_view_single_call_ondestroy;
 
        return single_call_view;
 }
@@ -161,7 +161,6 @@ static callui_result_e __update_displayed_data(call_view_single_call_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
        const char *file_path = NULL;
-       char status_txt[VIEW_SINGLE_CALL_STATUS_TXT_LEN] = { 0 };
 
        Eina_Bool is_held = EINA_FALSE;
 
@@ -187,8 +186,7 @@ static callui_result_e __update_displayed_data(call_view_single_call_h vd)
        }
 
        if (is_held) {
-               snprintf(status_txt, sizeof(status_txt), _("IDS_CALL_BODY_ON_HOLD_ABB"));
-               _callui_show_caller_info_status(ad, status_txt);
+               _callui_show_caller_info_status(ad, "IDS_CALL_BODY_ON_HOLD_ABB");
        } else {
                vd->base_view.call_duration_tm = _callui_stp_get_call_duration(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
                CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.call_duration_tm, CALLUI_RESULT_ALLOCATION_FAIL);
index a39a358..5b2f49e 100755 (executable)
  *
  */
 
-#include <app_control.h>
 #include <app.h>
-#include <glib-object.h>
 #include <vconf.h>
 #include <vconf-keys.h>
 #include <bluetooth.h>
-#include <device/display.h>
-#include <device/callback.h>
-#include <sys/socket.h>
-#include <sys/un.h>
+#include <system_settings.h>
 
 #include "callui.h"
 #include "callui-debug.h"
 
 #define EARSET_KEY_LONG_PRESS_TIMEOUT  1.0
 
-static bool _callui_app_create_layout(void *data);
-static Eina_Bool __callui_app_win_hard_key_down_cb(void *data, int type, void *event);
-static Eina_Bool __callui_app_win_hard_key_up_cb(void *data, int type, void *event);
+static bool __app_create(void *data);
+static void __app_terminate(void *data);
+static void __app_pause(void *data);
+static void __app_resume(void *data);
+static void __app_service(app_control_h app_control, void *data);
+static void __app_lang_changed_cb(app_event_info_h event_info, void *user_data);
+
+static bool __app_init(callui_app_data_t *ad);
 static bool __app_deinit(callui_app_data_t *ad);
+
+static bool __create_main_gui_elem(callui_app_data_t *ad);
+static Evas_Object *__create_main_window(callui_app_data_t *ad);
+static Evas_Object *__create_conformant(Evas_Object *win);
+static Evas_Object *__create_main_layout(Evas_Object *conf);
+
+static void __init_app_event_handlers(callui_app_data_t *ad);
+
+static void __main_win_delete_request_cb(void *data, Evas_Object *obj, void *event_info);
+
+static Eina_Bool __hard_key_down_cb(void *data, int type, void *event);
+static Eina_Bool __hard_key_up_cb(void *data, int type, void *event);
+
 static void __audio_state_changed_cb(void *user_data,
                callui_audio_state_type_e audio_state);
 static void __call_state_change_cb(void *user_data,
@@ -49,9 +62,19 @@ static void __call_state_change_cb(void *user_data,
                callui_sim_slot_type_e sim_type,
                void *event_info);
 
+static void __process_outgoing_call(callui_app_data_t *ad, const char *number);
+static void __process_incoming_call(callui_app_data_t *ad);
+
+static void __reset_state_params(callui_app_data_t *ad);
+static void __add_ecore_event_key_handlers(callui_app_data_t *ad);
+static void __remove_ecore_event_key_handlers(callui_app_data_t *ad);
+static void __set_main_win_key_grab(callui_app_data_t *ad);
+static void __unset_main_win_key_grab(callui_app_data_t *ad);
+static void __set_text_classes_params();
+
 static callui_app_data_t g_ad;
 
-static void __callui_app_win_key_grab(callui_app_data_t *ad)
+static void __set_main_win_key_grab(callui_app_data_t *ad)
 {
        int result = 0;
        result = elm_win_keygrab_set(ad->win, CALLUI_KEY_MEDIA, 0, 0, 0, ELM_WIN_KEYGRAB_EXCLUSIVE);
@@ -66,14 +89,38 @@ static void __callui_app_win_key_grab(callui_app_data_t *ad)
        if (!result) {
                dbg("KEY_POWER key grab failed");
        }
+}
 
-       if (ad->downkey_handler == NULL)
-               ad->downkey_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, __callui_app_win_hard_key_down_cb, ad);
-       if (ad->upkey_handler == NULL)
-               ad->upkey_handler = ecore_event_handler_add(ECORE_EVENT_KEY_UP, __callui_app_win_hard_key_up_cb, ad);
+static void __unset_main_win_key_grab(callui_app_data_t *ad)
+{
+       elm_win_keygrab_unset(ad->win, CALLUI_KEY_SELECT, 0, 0);
+       elm_win_keygrab_unset(ad->win, CALLUI_KEY_POWER, 0, 0);
+       elm_win_keygrab_unset(ad->win, CALLUI_KEY_MEDIA, 0, 0);
+}
+
+static void __add_ecore_event_key_handlers(callui_app_data_t *ad)
+{
+       if (!ad->downkey_handler) {
+               ad->downkey_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, __hard_key_down_cb, ad);
+       }
+       if (!ad->upkey_handler) {
+               ad->upkey_handler = ecore_event_handler_add(ECORE_EVENT_KEY_UP, __hard_key_up_cb, ad);
+       }
 }
 
-static void __callui_process_incoming_call(callui_app_data_t *ad)
+static void __remove_ecore_event_key_handlers(callui_app_data_t *ad)
+{
+       if (ad->downkey_handler) {
+               ecore_event_handler_del(ad->downkey_handler);
+               ad->downkey_handler = NULL;
+       }
+       if (ad->upkey_handler) {
+               ecore_event_handler_del(ad->upkey_handler);
+               ad->upkey_handler = NULL;
+       }
+}
+
+static void __process_incoming_call(callui_app_data_t *ad)
 {
        CALLUI_RETURN_IF_FAIL(ad);
 
@@ -96,7 +143,7 @@ static void __callui_process_incoming_call(callui_app_data_t *ad)
        _callui_vm_change_view(ad->view_manager, type);
 }
 
-static void __callui_process_outgoing_call(callui_app_data_t *ad, char *number)
+static void __process_outgoing_call(callui_app_data_t *ad, const char *number)
 {
        CALLUI_RETURN_IF_FAIL(ad);
        sec_dbg("Number is (%s)", number);
@@ -173,7 +220,7 @@ static void __call_state_change_cb(void *user_data,
        }
 }
 
-static void __callui_call_list_init(callui_app_data_t *ad)
+static void __reset_state_params(callui_app_data_t *ad)
 {
        dbg("..");
        CALLUI_RETURN_IF_FAIL(ad);
@@ -186,79 +233,23 @@ static void __callui_call_list_init(callui_app_data_t *ad)
 }
 
 
-static void __callui_bt_init()
+static void __bt_init()
 {
-       int ret = BT_ERROR_NONE;
-       ret = bt_initialize();
+       int ret = bt_initialize();
        if (BT_ERROR_NONE != ret) {
                err("bt_init() failed [%d]", ret);
-               return;
        }
 }
 
-static gboolean __callui_init_sys_api(callui_app_data_t *ad)
-{
-       dbg("..");
-
-       __callui_bt_init();
-
-       return true;
-}
-
-static void __callui_win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
-{
-       /* To make your application go to background,
-               Call the elm_win_lower() instead
-               Evas_Object *win = (Evas_Object *) data;
-               elm_win_lower(win); */
-       elm_exit();
-}
-
-static Evas_Object *__callui_create_main_win(callui_app_data_t *ad)
+static void __bt_deinit()
 {
-       dbg("Create window");
-       Evas_Object *eo = elm_win_add(NULL, PACKAGE, ELM_WIN_NOTIFICATION);
-       elm_win_aux_hint_add(eo, "wm.policy.win.user.geometry", "1");
-       elm_win_fullscreen_set(eo, EINA_FALSE);
-       elm_win_alpha_set(eo, EINA_TRUE);
-
-       if (eo) {
-               elm_win_title_set(eo, PACKAGE);
-               evas_object_smart_callback_add(eo, "delete,request", __callui_win_delete_request_cb, NULL);
-               elm_win_screen_size_get(eo, NULL, NULL, &ad->root_w, &ad->root_h);
-
-               dbg("root_w = %d, root_h = %d..", ad->root_w, ad->root_h);
-               evas_object_resize(eo, ad->root_w, ELM_SCALE_SIZE(MTLOCK_ACTIVE_NOTI_CALL_HEIGHT));
-
-               elm_win_center(eo, EINA_FALSE, EINA_TRUE);
-               evas_object_move(eo, 0, 0);
-               elm_win_indicator_mode_set(eo, ELM_WIN_INDICATOR_SHOW);
-               elm_win_indicator_opacity_set(eo, ELM_WIN_INDICATOR_TRANSLUCENT);
-               elm_win_conformant_set(eo, EINA_TRUE);
-
-               ad->win_conformant = elm_conformant_add(eo);
-               elm_object_signal_emit(ad->win_conformant, "elm,state,indicator,overlap", "elm");
-               evas_object_size_hint_weight_set(ad->win_conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-               elm_win_resize_object_add(eo, ad->win_conformant);
-               evas_object_show(ad->win_conformant);
+       int ret = bt_deinitialize();
+       if (BT_ERROR_NONE != ret) {
+               err("bt_deinit() failed [%d]", ret);
        }
-
-       return eo;
 }
 
-static Evas_Object *__callui_create_base_layout(callui_app_data_t *ad)
-{
-       dbg("..");
-       CALLUI_RETURN_VALUE_IF_FAIL(ad, NULL);
-       Evas_Object *ly = NULL;
-
-       ly = _callui_load_edj(ad->win_conformant, EDJ_NAME,  "app_main_ly");
-       evas_object_show(ly);
-
-       return ly;
-}
-
-static void __callui_app_text_classes_set()
+static void __set_text_classes_params()
 {
        edje_text_class_set("ATO001", "R", 40);
        edje_text_class_set("ATO002", "R", 64);
@@ -281,29 +272,36 @@ static void __callui_app_text_classes_set()
        edje_text_class_set("ATO017", "R", 30);
 }
 
-static bool _callui_app_create(void *data)
+static void __init_app_event_handlers(callui_app_data_t *ad)
 {
-       CALLUI_RETURN_VALUE_IF_FAIL(data, false);
-
-       callui_app_data_t *ad = data;
-
-       elm_app_base_scale_set(2.6);
-
-       elm_config_accel_preference_set("3d");
+       app_event_type_e events[APP_HANDLERS_COUNT] = {
+                       APP_EVENT_LANGUAGE_CHANGED
+       };
+
+       app_event_cb cbs[APP_HANDLERS_COUNT] = {
+                       __app_lang_changed_cb
+       };
+
+       int i = 0;
+       for (; i < APP_HANDLERS_COUNT; ++i) {
+               int res = ui_app_add_event_handler(&ad->app_event_handlers[i], events[i], cbs[i], ad);
+               if (res != APP_ERROR_NONE) {
+                       warn("ui_app_add_event_handler(%d) failed. res[%d]", events[i], res);
+                       ad->app_event_handlers[i] = NULL;
+               }
+       }
+}
 
+static bool __app_init(callui_app_data_t *ad)
+{
        _callui_common_dvc_control_lcd_state(LCD_OFF_SLEEP_LOCK);
 
-       int ret = __callui_init_sys_api(ad);
-       if (!ret) {
-               err("__callui_init_sys_api failed");
-               return false;
-       }
+       __init_app_event_handlers(ad);
+
+       __bt_init();
 
        ad->call_manager = _callui_manager_create();
-       if (!ad->call_manager) {
-               err("_callui_manager_create() failed");
-               return __app_deinit(ad);
-       }
+       CALLUI_RETURN_VALUE_IF_FAIL(ad->call_manager, __app_deinit(ad));
 
        ad->state_provider = _callui_manager_get_state_provider(ad->call_manager);
        ad->sound_manager = _callui_manager_get_sound_manager(ad->call_manager);
@@ -311,77 +309,124 @@ static bool _callui_app_create(void *data)
        _callui_stp_add_call_state_event_cb(ad->state_provider, __call_state_change_cb, ad);
        _callui_sdm_add_audio_state_changed_cb(ad->sound_manager, __audio_state_changed_cb, ad);
 
-       if (!_callui_app_create_layout(ad)) {
-               err("_callui_app_create_layout() failed");
-               return __app_deinit(ad);
-       }
+       CALLUI_RETURN_VALUE_IF_FAIL(__create_main_gui_elem(ad), __app_deinit(ad));
 
        ad->view_manager = _callui_vm_create(ad);
-       if (!ad->view_manager) {
-               err("_callui_vm_create() failed");
-               return __app_deinit(ad);
-       }
+       CALLUI_RETURN_VALUE_IF_FAIL(ad->view_manager, __app_deinit(ad));
 
        ad->action_bar = _callui_action_bar_create(ad);
-       if (!ad->action_bar) {
-               err("_callui_action_bar_create() failed");
-               return __app_deinit(ad);
-       }
+       CALLUI_RETURN_VALUE_IF_FAIL(ad->action_bar, __app_deinit(ad));
 
        ad->keypad = _callui_keypad_create(ad);
-       if (!ad->keypad) {
-               err("_callui_keypad_create() failed");
-               return __app_deinit(ad);
-       }
+       CALLUI_RETURN_VALUE_IF_FAIL(ad->keypad, __app_deinit(ad));
 
        ad->lock_handle = _callui_lock_manager_create();
-       if (!ad->lock_handle) {
-               err("_callui_lock_manager_create() failed");
-               return __app_deinit(ad);
-       }
+       CALLUI_RETURN_VALUE_IF_FAIL(ad->lock_handle, __app_deinit(ad));
 
        ad->qp_minicontrol =_callui_qp_mc_create(ad);
-       if (!ad->qp_minicontrol) {
-               err("_callui_qp_mc_create() failed");
-               return __app_deinit(ad);
-       }
+       CALLUI_RETURN_VALUE_IF_FAIL(ad->qp_minicontrol, __app_deinit(ad));
+
+       __set_main_win_key_grab(ad);
+
+       __add_ecore_event_key_handlers(ad);
+
+       __set_text_classes_params();
 
        elm_theme_extension_add(NULL, CALL_THEME);
 
        return true;
 }
 
-static bool _callui_app_create_layout(void *data)
+static bool __app_create(void *data)
 {
-       callui_app_data_t *ad = data;
+       CALLUI_RETURN_VALUE_IF_FAIL(data, false);
 
-       ad->win = __callui_create_main_win(ad);
-       if (ad->win == NULL) {
-               err("__callui_create_main_win failed");
-               return false;
-       }
-       ad->main_ly = __callui_create_base_layout(ad);
-       if (ad->main_ly == NULL) {
-               err("__callui_create_base_layout failed");
-               return false;
+       elm_app_base_scale_set(2.6);
+
+       elm_config_accel_preference_set("3d");
+
+       return __app_init(data);
+}
+
+static void __app_lang_changed_cb(app_event_info_h event_info, void *user_data)
+{
+       char *language;
+       int r = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &language);
+       if (r == SYSTEM_SETTINGS_ERROR_NONE) {
+               dbg("language: %s", language);
+               elm_language_set(language);
+               free(language);
        }
-       elm_object_content_set(ad->win_conformant, ad->main_ly);
 
-       __callui_app_text_classes_set();
+       CALLUI_RETURN_IF_FAIL(user_data);
+       callui_app_data_t *ad = user_data;
 
-       __callui_app_win_key_grab(ad);
+       _callui_vm_update_language(ad->view_manager);
+}
 
-       return true;
+static void __main_win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       elm_exit();
 }
 
-static void __callui_bt_deinit()
+static Evas_Object *__create_main_window(callui_app_data_t *ad)
 {
-       int ret = BT_ERROR_NONE;
-       ret = bt_deinitialize();
-       if (BT_ERROR_NONE != ret) {
-               err("bt_deinit() failed [%d]", ret);
-               return;
-       }
+       Evas_Object *eo = elm_win_add(NULL, PACKAGE, ELM_WIN_NOTIFICATION);
+       CALLUI_RETURN_NULL_IF_FAIL(eo);
+
+       elm_win_aux_hint_add(eo, "wm.policy.win.user.geometry", "1");
+       elm_win_fullscreen_set(eo, EINA_FALSE);
+       elm_win_alpha_set(eo, EINA_TRUE);
+
+       elm_win_title_set(eo, PACKAGE);
+       evas_object_smart_callback_add(eo, "delete,request", __main_win_delete_request_cb, NULL);
+
+       elm_win_screen_size_get(eo, NULL, NULL, &ad->root_w, &ad->root_h);
+       evas_object_resize(eo, ad->root_w, ELM_SCALE_SIZE(MTLOCK_ACTIVE_NOTI_CALL_HEIGHT));
+
+       elm_win_center(eo, EINA_FALSE, EINA_TRUE);
+       evas_object_move(eo, 0, 0);
+       elm_win_indicator_mode_set(eo, ELM_WIN_INDICATOR_SHOW);
+       elm_win_indicator_opacity_set(eo, ELM_WIN_INDICATOR_TRANSLUCENT);
+       elm_win_conformant_set(eo, EINA_TRUE);
+
+       return eo;
+}
+
+static Evas_Object *__create_conformant(Evas_Object *win)
+{
+       Evas_Object *win_conformant = elm_conformant_add(win);
+       CALLUI_RETURN_NULL_IF_FAIL(win_conformant);
+
+       elm_object_signal_emit(win_conformant, "elm,state,indicator,overlap", "elm");
+       evas_object_size_hint_weight_set(win_conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(win, win_conformant);
+       evas_object_show(win_conformant);
+
+       return win_conformant;
+}
+
+static Evas_Object *__create_main_layout(Evas_Object *conf)
+{
+       Evas_Object *layout = _callui_load_edj(conf, EDJ_NAME,  "app_main_ly");
+       elm_object_content_set(conf, layout);
+       evas_object_show(layout);
+
+       return layout;
+}
+
+static bool __create_main_gui_elem(callui_app_data_t *ad)
+{
+       ad->win = __create_main_window(ad);
+       CALLUI_RETURN_VALUE_IF_FAIL(ad->win, false)
+
+       Evas_Object *conf = __create_conformant(ad->win);
+       CALLUI_RETURN_VALUE_IF_FAIL(conf, false);
+
+       ad->main_ly = __create_main_layout(conf);
+       CALLUI_RETURN_VALUE_IF_FAIL(ad->main_ly, false);
+
+       return true;
 }
 
 static bool __app_deinit(callui_app_data_t *ad)
@@ -389,18 +434,9 @@ static bool __app_deinit(callui_app_data_t *ad)
        _callui_stp_remove_call_state_event_cb(ad->state_provider, __call_state_change_cb, ad);
        _callui_sdm_remove_audio_state_changed_cb(ad->sound_manager, __audio_state_changed_cb, ad);
 
-       if (ad->downkey_handler) {
-               ecore_event_handler_del(ad->downkey_handler);
-               ad->downkey_handler = NULL;
-       }
-       if (ad->upkey_handler) {
-               ecore_event_handler_del(ad->upkey_handler);
-               ad->upkey_handler = NULL;
-       }
+       __remove_ecore_event_key_handlers(ad);
 
-       elm_win_keygrab_unset(ad->win, CALLUI_KEY_SELECT, 0, 0);
-       elm_win_keygrab_unset(ad->win, CALLUI_KEY_POWER, 0, 0);
-       elm_win_keygrab_unset(ad->win, CALLUI_KEY_MEDIA, 0, 0);
+       __unset_main_win_key_grab(ad);
 
        if (ad->view_manager) {
                _callui_vm_destroy(ad->view_manager);
@@ -434,34 +470,44 @@ static bool __app_deinit(callui_app_data_t *ad)
 
        free(ad->end_call_data);
 
-       __callui_bt_deinit();
+       __bt_deinit();
 
        return false;
 }
 
-static void _callui_app_terminate(void *data)
+static void __app_terminate(void *data)
 {
        __app_deinit(data);
 }
 
-static void _callui_app_pause(void *data)
+static void __app_pause(void *data)
 {
        dbg("..");
+
        _callui_common_unset_lock_state_changed_cb();
+
+       callui_app_data_t *ad = data;
+
+       _callui_vm_pause(ad->view_manager);
 }
 
-static void _callui_app_resume(void *data)
+static void __app_resume(void *data)
 {
        dbg("..");
+
        callui_app_data_t *ad = data;
+
        _callui_common_set_lock_state_changed_cb();
+
        if (ad->start_lock_manager_on_resume) {
                ad->start_lock_manager_on_resume = false;
                _callui_lock_manager_start(ad->lock_handle);
        }
+
+       _callui_vm_resume(ad->view_manager);
 }
 
-static void _callui_app_service(app_control_h app_control, void *data)
+static void __app_service(app_control_h app_control, void *data)
 {
        dbg("..");
        callui_app_data_t *ad = data;
@@ -473,7 +519,7 @@ static void _callui_app_service(app_control_h app_control, void *data)
        if (_callui_vm_get_cur_view_type(ad->view_manager) == VIEW_TYPE_UNDEFINED
                        && !ad->waiting_dialing) {
                err("VIEW_TYPE_UNDEFINED. Clear data");
-               __callui_call_list_init(ad);
+               __reset_state_params(ad);
                _callui_common_dvc_control_lcd_state(LCD_OFF_SLEEP_LOCK);
        }
 
@@ -503,7 +549,7 @@ static void _callui_app_service(app_control_h app_control, void *data)
                                err("handle val is NULL");
                                return;
                        }
-                       __callui_process_incoming_call(ad);
+                       __process_incoming_call(ad);
                } else {
                        tmp = (char *)uri_bundle + 4;
                        sec_dbg("number: [%s]", tmp);
@@ -511,7 +557,7 @@ static void _callui_app_service(app_control_h app_control, void *data)
                                sec_dbg("number: [%s]", tmp);
                                evas_object_resize(ad->win, ad->root_w, ad->root_h);
                                if (!ad->waiting_dialing) {
-                                       __callui_process_outgoing_call(ad, tmp);
+                                       __process_outgoing_call(ad, tmp);
                                }
                        } else {
                                err("number val is NULL");
@@ -540,36 +586,7 @@ static void _callui_app_service(app_control_h app_control, void *data)
        free(uri_bundle);
 }
 
-callui_app_data_t *_callui_get_app_data()
-{
-       return &g_ad;
-}
-
-CALLUI_EXPORT_API int main(int argc, char *argv[])
-{
-       dbg("..");
-       ui_app_lifecycle_callback_s event_callback = {0,};
-
-       event_callback.create = _callui_app_create;
-       event_callback.terminate = _callui_app_terminate;
-       event_callback.pause = _callui_app_pause;
-       event_callback.resume = _callui_app_resume;
-       event_callback.app_control = _callui_app_service;
-
-       memset(&g_ad, 0x0, sizeof(callui_app_data_t));
-
-       int ret = APP_ERROR_NONE;
-
-       ret = ui_app_main(argc, argv, &event_callback, &g_ad);
-       if (ret != APP_ERROR_NONE) {
-               err("ui_app_main() is failed. err = %d", ret);
-       }
-
-        return ret;
-}
-
-
-static Eina_Bool __callui_app_win_hard_key_up_cb(void *data, int type, void *event)
+static Eina_Bool __hard_key_up_cb(void *data, int type, void *event)
 {
        dbg("..");
 
@@ -717,7 +734,7 @@ static Eina_Bool __callui_app_win_hard_key_up_cb(void *data, int type, void *eve
        return EINA_FALSE;
 }
 
-static Eina_Bool __callui_app_win_earset_key_longpress_timer_cb(void *data)
+static Eina_Bool __earset_key_longpress_timer_cb(void *data)
 {
        dbg("..");
 
@@ -728,7 +745,7 @@ static Eina_Bool __callui_app_win_earset_key_longpress_timer_cb(void *data)
        return ECORE_CALLBACK_CANCEL;
 }
 
-static Eina_Bool __callui_app_win_hard_key_down_cb(void *data, int type, void *event)
+static Eina_Bool __hard_key_down_cb(void *data, int type, void *event)
 {
        dbg("..");
 
@@ -746,10 +763,36 @@ static Eina_Bool __callui_app_win_hard_key_down_cb(void *data, int type, void *e
        }
 
        if (!strcmp(ev->keyname, CALLUI_KEY_MEDIA)) {
-               ad->earset_key_longpress_timer = ecore_timer_add(EARSET_KEY_LONG_PRESS_TIMEOUT, __callui_app_win_earset_key_longpress_timer_cb, ad);
+               ad->earset_key_longpress_timer = ecore_timer_add(EARSET_KEY_LONG_PRESS_TIMEOUT,
+                               __earset_key_longpress_timer_cb, ad);
        } else if (!strcmp(ev->keyname, CALLUI_KEY_SELECT)) {
                /*todo*/
        }
        dbg("End..");
        return EINA_FALSE;
 }
+
+callui_app_data_t *_callui_get_app_data()
+{
+       return &g_ad;
+}
+
+CALLUI_EXPORT_API int main(int argc, char *argv[])
+{
+       dbg("..");
+       ui_app_lifecycle_callback_s event_callback = {0,};
+
+       event_callback.create = __app_create;
+       event_callback.terminate = __app_terminate;
+       event_callback.pause = __app_pause;
+       event_callback.resume = __app_resume;
+       event_callback.app_control = __app_service;
+
+       memset(&g_ad, 0x0, sizeof(callui_app_data_t));
+
+       int res = ui_app_main(argc, argv, &event_callback, &g_ad);
+       if (res != APP_ERROR_NONE) {
+               err("ui_app_main() is failed. res[%d]", res);
+       }
+       return res;
+}