2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <ui-gadget.h>
20 #include <ui-gadget-module.h>
21 #include <sound_manager.h>
22 #include <system_info.h>
25 #include "msg-ui-thread-main.h"
26 #include "msg-ui-common-utility.h"
28 static void __msg_ui_popup_warning(Evas_Object *parent, const char *msg);
29 static service_h __msg_ui_parse_sms_uri(service_h service, const char *uri);
30 static service_h __msg_ui_parse_mmsto_uri(service_h service, const char *uri);
31 static service_h __msg_ui_parse_file_uri(service_h service, const char *uri);
32 static service_h __get_service_with_new_msg(struct appdata *ad);
33 static service_h __get_service_with_msg_id(struct appdata *ad, service_h service);
35 void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv);
36 void result_cb(ui_gadget_h ug, service_h result, void *priv);
37 void destroy_cb(ui_gadget_h ug, void *priv);
39 struct appdata *gAppData = NULL;
41 static void win_del(void *data, Evas_Object *obj, void *event)
46 static void main_quit_cb(void *data, Evas_Object *obj, void *event_info)
51 static void lang_changed(void *data)
54 struct appdata *ad = data;
56 ug_send_event(UG_EVENT_LANG_CHANGE);
58 msg_ui_thread_lang_changed(ad->thread_data);
61 static void low_battery_cb(void *data)
65 ug_send_event(UG_EVENT_LOW_BATTERY);
68 static void region_changed_cb(void *data)
72 ug_send_event(UG_EVENT_REGION_CHANGE);
75 static void rotation_changed_cb(void *data, Evas_Object *obj, void *event)
79 struct appdata *ad = data;
81 int rot = THREAD_ROTATE_ANGLE_UNKNOWN;
82 int changed_rotation = elm_win_rotation_get(obj);
84 if(changed_rotation != ad->cur_rotation) {
85 D_MSG("current rotation [%d], changed rotation [%d]", ad->cur_rotation, changed_rotation);
86 ad->cur_rotation = changed_rotation;
88 switch (changed_rotation) {
90 rot = THREAD_ROTATE_ANGLE_PORTRAIT;
91 ret = ug_send_event(UG_EVENT_ROTATE_PORTRAIT);
94 rot = THREAD_ROTATE_ANGLE_LANDSCAPE_UPSIDEDOWN;
95 ret = ug_send_event(UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN);
98 rot = THREAD_ROTATE_ANGLE_PORTRAIT_UPSIDEDOWN;
99 ret = ug_send_event(UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN);
102 rot = THREAD_ROTATE_ANGLE_LANDSCAPE;
103 ret = ug_send_event(UG_EVENT_ROTATE_LANDSCAPE);
106 rot = THREAD_ROTATE_ANGLE_UNKNOWN;
112 msg_ui_thread_rotation_set(ad->thread_data, rot);
117 static void _block_clicked_cb(void *data, Evas_Object *obj, void *event_info)
119 evas_object_del(obj);
123 static void __msg_ui_popup_warning(Evas_Object *parent, const char *msg)
127 MSG_UI_RET_IF(MSG_UI_LEVEL_ASSERT, parent == NULL || msg == NULL);
129 Evas_Object *layout, *pu;
131 evas_object_show(parent);
133 layout = elm_layout_add(parent);
134 elm_layout_theme_set(layout, "layout", "application", "default");
135 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
136 elm_win_resize_object_add(parent, layout);
137 evas_object_show(layout);
139 pu = elm_popup_add(layout);
140 MSG_UI_RETM_IF(MSG_UI_LEVEL_ASSERT, pu == NULL, "Cannot add popup object\n");
141 evas_object_size_hint_weight_set(pu, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
142 evas_object_smart_callback_add(pu , "block,clicked", _block_clicked_cb, NULL);
144 elm_object_text_set(pu, msg);
145 elm_popup_timeout_set(pu, 2);
146 evas_object_smart_callback_add(pu, "timeout", main_quit_cb, NULL);
147 evas_object_show(pu);
152 static service_h __msg_ui_parse_sms_uri(service_h service, const char *uri)
156 char *content = NULL;
157 char *recipient = NULL;
159 char *body_text = NULL;
161 service_h svc_handle = NULL;
163 if (service_create(&svc_handle) < 0 || svc_handle == NULL) {
164 D_EMSG("service_create() is failed !!");
168 char *scheme = g_strdup(uri);
171 strtok_r(scheme, ":", &content);
174 if (g_ascii_isdigit(content[0]) || (content[0] == '+' && g_ascii_isdigit(content[1]))) {
175 recipient = strtok_r(NULL, "?", &content);
177 D_MSG("APPSVC RECIPIENT = [%s]", recipient);
178 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_TO, recipient);
182 if (g_str_has_prefix(content, MSG_BUNDLE_VALUE_BODY_URI)) {
183 tmp = strtok_r(NULL, "=", &content);
185 if (content && strlen(content)) {
186 char *unescape_string = g_uri_unescape_string(content, NULL);
187 if (unescape_string) {
188 D_MSG("APPSVC BODY = [%s]", unescape_string);
189 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_BODY, unescape_string);
190 free(unescape_string);
199 service_get_extra_data(service, SERVICE_DATA_TO, &recipient);
200 D_MSG("APPSVC RECIPIENT = [%s]", recipient);
201 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_TO, recipient);
205 service_get_extra_data(service, SERVICE_DATA_TEXT, &body_text);
207 D_MSG("APPSVC BODY_TEXT = [%s]", body_text);
208 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_BODY, body_text);
215 static service_h __msg_ui_parse_mmsto_uri(service_h service, const char *uri)
219 char *content = NULL;
220 char *recipient = NULL;
221 char *body_text = NULL;
222 char *subject = NULL;
223 char *attachment = NULL;
226 service_h svc_handle = NULL;
228 if (service_create(&svc_handle) < 0 || svc_handle == NULL) {
229 D_EMSG("service_create() is failed !!");
233 char *scheme = g_strdup(uri);
236 strtok_r(scheme, ":", &content);
239 if (g_ascii_isdigit(content[0]) || (content[0] == '+' && g_ascii_isdigit(content[1]))) {
240 recipient = strtok_r(NULL, "?", &content);
241 cc = strtok_r(NULL, "&", &content);
243 strtok_r(NULL, "=", &cc);
245 D_MSG("APPSVC RECIPIENT = [%s]", recipient);
246 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_TO, recipient);
251 service_get_extra_data(service, SERVICE_DATA_TO, &recipient);
252 D_MSG("APPSVC RECIPIENT = [%s]", recipient);
253 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_TO, recipient);
257 service_get_extra_data(service, SERVICE_DATA_TEXT, &body_text);
259 D_MSG("APPSVC BODY_TEXT = [%s]", body_text);
260 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_BODY, body_text);
264 service_get_extra_data(service, SERVICE_DATA_SUBJECT, &subject);
266 D_MSG("APPSVC SUBJECT = [%s]", subject);
267 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_SUBJECT, subject);
271 service_get_extra_data(service, MSG_BUNDLE_KEY_ATTACHFILE, &attachment);
273 D_MSG("APPSVC ATTACHMENT = [%s]", attachment);
274 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_ATTACHFILE, attachment);
282 static service_h __msg_ui_parse_file_uri(service_h service, const char *uri)
286 char *content = NULL;
287 char attachment[DEF_IMG_PATH_LEN] = {0, };
291 service_h svc_handle = NULL;
293 if (service_create(&svc_handle) < 0 || svc_handle == NULL) {
294 D_EMSG("service_create() is failed !!");
298 char *scheme = g_strdup(uri);
301 strtok_r(scheme, ":", &content);
302 D_MSG("content = [%s]", content);
305 len = strlen(content) - 2;
307 D_EMSG("len is less than 0 !!");
308 service_destroy(svc_handle);
313 /* Remove '//' from content string */
314 for (i = 0; i < len; i++) {
315 attachment[i] = content[i+2];
318 if (attachment[0] != '\0') {
319 D_MSG("APPSVC ATTACHMENT = [%s]", attachment);
320 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_ATTACHFILE, attachment);
325 D_EMSG("scheme is NULL!!");
326 service_destroy(svc_handle);
335 static service_h __get_service_app_svc_op(const char *operation, service_h service)
339 if (service == NULL || operation == NULL)
343 char *recipient = NULL;
344 char *body_text = NULL;
345 char *attachment = NULL;
346 char *subject = NULL;
348 service_h svc_handle = NULL;
350 if (g_strcmp0(operation, SERVICE_OPERATION_SEND) == 0) {
351 service_get_uri(service, &uri);
352 D_MSG("APPSVC URI = [%s]", uri);
355 if (g_str_has_prefix(uri, MSG_BUNDLE_VALUE_MMSTO_URI)) { /* MMS URI */
356 svc_handle = __msg_ui_parse_mmsto_uri(service, uri);
357 } else if (g_str_has_prefix(uri, MSG_BUNDLE_VALUE_FILE_URI)) {
359 svc_handle = __msg_ui_parse_file_uri(service, uri);
360 if (svc_handle == NULL) {
364 } else if (g_str_has_prefix(uri, "/")) {
365 if (service_create(&svc_handle) < 0 || svc_handle == NULL) {
366 D_EMSG("service_create() is failed !!");
370 D_MSG("APPSVC ATTACHMENT = [%s]", uri);
371 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_ATTACHFILE, uri);
373 D_MSG("Not supported URI type");
377 if (service_create(&svc_handle) < 0 || svc_handle == NULL) {
378 D_EMSG("service_create() is failed !!");
382 /* Add recipient number */
383 service_get_extra_data(service, SERVICE_DATA_TO, &recipient);
385 D_MSG("APPSVC RECIPIENT = [%s]", recipient);
386 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_TO, recipient);
390 service_get_extra_data(service, SERVICE_DATA_TEXT, &body_text);
392 D_MSG("APPSVC BODY_TEXT = [%s]", body_text);
393 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_BODY, body_text);
397 service_get_extra_data(service, SERVICE_DATA_SUBJECT, &subject);
399 D_MSG("APPSVC SUBJECT = [%s]", subject);
400 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_SUBJECT, subject);
404 service_get_extra_data(service, MSG_BUNDLE_KEY_ATTACHFILE, &attachment);
406 D_MSG("APPSVC ATTACHMENT = [%s]", attachment);
407 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_ATTACHFILE, attachment);
411 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_TYPE, MSG_BUNDLE_VALUE_COMPOSE);
413 } else if (g_strcmp0(operation, SERVICE_OPERATION_SEND_TEXT) == 0) {
414 service_get_uri(service, &uri);
415 D_MSG("APPSVC URI = [%s]", uri);
418 if (g_str_has_prefix(uri, MSG_BUNDLE_VALUE_SMS_URI)) { /* SMS URI */
419 svc_handle = __msg_ui_parse_sms_uri(service, uri);
421 D_MSG("Not supported mime type");
425 if (service_create(&svc_handle) < 0 || svc_handle == NULL) {
426 D_EMSG("service_create() is failed !!");
431 service_get_extra_data(service, SERVICE_DATA_TEXT, &body_text);
433 D_MSG("APPSVC BODY_TEXT = [%s]", body_text);
434 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_BODY, body_text);
437 /* Add recipient number */
438 service_get_extra_data(service, SERVICE_DATA_TO, &recipient);
440 D_MSG("APPSVC RECIPIENT = [%s]", recipient);
441 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_TO, recipient);
445 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_TYPE, MSG_BUNDLE_VALUE_COMPOSE);
446 } else if (g_strcmp0(operation, SERVICE_OPERATION_DEFAULT) == 0) {
447 char *key_type = NULL;
449 service_get_extra_data(service, MSG_BUNDLE_KEY_TYPE, &key_type);
450 if (g_strcmp0(key_type, MSG_BUNDLE_VALUE_MSG_ID) == 0) {
451 msg_error_t err = MSG_SUCCESS;
452 msg_struct_t sort_rule_t = msg_create_struct(MSG_STRUCT_SORT_RULE);
453 msg_struct_list_s peerList;
454 bool oneThread = true;
456 msg_set_int_value(sort_rule_t, MSG_SORT_RULE_SORT_TYPE_INT, MSG_SORT_BY_READ_STATUS);
457 msg_set_bool_value(sort_rule_t, MSG_SORT_RULE_ACSCEND_BOOL, false);
459 err = msg_get_thread_view_list(gAppData->msgHandle, sort_rule_t, &peerList);
460 msg_release_struct(&sort_rule_t);
462 if (peerList.nCount > 1) {
464 msg_get_int_value(peerList.msg_struct_info[1], MSG_THREAD_UNREAD_COUNT_INT, &unreadCnt);
468 msg_release_list_struct(&peerList);
470 if (oneThread == true)
471 svc_handle = __get_service_with_msg_id(gAppData, service);
472 } else if (g_strcmp0(key_type, MSG_BUNDLE_VALUE_REPORT) == 0) {
473 svc_handle = __get_service_with_msg_id(gAppData, service);
474 } else if (g_strcmp0(key_type, MSG_BUNDLE_VALUE_BUBBLE) == 0) {
475 svc_handle = __get_service_with_msg_id(gAppData, service);
483 static service_h __get_service_with_new_msg(struct appdata *ad)
487 msg_error_t err = MSG_SUCCESS;
488 msg_struct_list_s peerList;
489 msg_struct_t sort_rule_t = msg_create_struct(MSG_STRUCT_SORT_RULE);
490 service_h svc_handle = NULL;
496 char buf[DEF_BUF_LEN_L] = {'0',};
497 char buf_contact[DEF_BUF_LEN] = {'0',};
499 msg_set_int_value(sort_rule_t, MSG_SORT_RULE_SORT_TYPE_INT, MSG_SORT_BY_THREAD_DATE);
500 msg_set_bool_value(sort_rule_t, MSG_SORT_RULE_ACSCEND_BOOL, false);
502 vconf_get_int(VCONFKEY_MESSAGE_RECV_SMS_STATE, &new_sms_cnt);
503 vconf_get_int(VCONFKEY_MESSAGE_RECV_MMS_STATE, &new_mms_cnt);
505 err = msg_get_thread_view_list(ad->msgHandle, sort_rule_t, &peerList);
506 if (err != MSG_SUCCESS) {
507 msg_release_struct(&sort_rule_t);
511 if (peerList.nCount <= 0) {
512 msg_release_list_struct(&peerList);
513 msg_release_struct(&sort_rule_t);
517 for (i=0; i<peerList.nCount; i++){
518 msg_get_int_value(peerList.msg_struct_info[i], MSG_THREAD_UNREAD_COUNT_INT, &unreadCnt);
523 if(i >= peerList.nCount) {
524 msg_release_list_struct(&peerList);
525 msg_release_struct(&sort_rule_t);
529 msg_get_int_value(peerList.msg_struct_info[i], MSG_THREAD_UNREAD_COUNT_INT, &unreadCnt);
530 if(unreadCnt == new_sms_cnt+new_mms_cnt){
531 if (service_create(&svc_handle) < 0 || svc_handle == NULL) {
532 D_EMSG("service_create() is failed !!");
533 msg_release_list_struct(&peerList);
534 msg_release_struct(&sort_rule_t);
538 msg_struct_list_s *addrList = NULL;
541 char strName[DEF_THREAD_NAME_LEN+1] = {0,};
542 char strNumber[DEF_THREAD_ADDR_LEN+1] = {0,};
544 msg_get_int_value(peerList.msg_struct_info[i], MSG_THREAD_ID_INT, &thread_id);
545 msg_get_list_handle(peerList.msg_struct_info[i], MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addrList);
547 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_TYPE, MSG_BUNDLE_VALUE_NEW_MSG);
548 snprintf(buf, DEF_BUF_LEN_L, "%d", thread_id);
549 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_THREAD_ID, buf);
550 msg_get_str_value(peerList.msg_struct_info[i], MSG_THREAD_NAME_STR, strName, DEF_THREAD_NAME_LEN);
551 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_THREAD_NAME, strName);
553 msg_get_str_value(addrList->msg_struct_info[0], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, DEF_THREAD_ADDR_LEN);
554 msg_get_int_value(addrList->msg_struct_info[0], MSG_ADDRESS_INFO_CONTACT_ID_INT, &contact_id);
556 snprintf(buf_contact, DEF_BUF_LEN, "%d", contact_id);
557 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_THREAD_ADDRESS, strNumber);
558 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_CONTACT_ID, buf_contact);
561 msg_release_struct(&sort_rule_t);
562 msg_release_list_struct(&peerList);
569 static service_h __get_service_with_msg_id(struct appdata *ad, service_h service)
573 service_h svc_handle = NULL;
575 if (service_create(&svc_handle) < 0 || svc_handle == NULL) {
576 D_EMSG("service_create() is failed !!");
581 char *msg_id_str = NULL;
582 service_get_extra_data(service, MSG_BUNDLE_KEY_MSG_ID, &msg_id_str);
585 service_destroy(svc_handle);
589 msg_id = atoi(msg_id_str);
592 service_destroy(svc_handle);
596 msg_struct_t msgInfo = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
597 msg_struct_t sendOpt = msg_create_struct(MSG_STRUCT_SENDOPT);
598 msg_error_t err = MSG_SUCCESS;
602 char buf_thread[DEF_BUF_LEN_S] = {0,};
603 char buf_storage[DEF_BUF_LEN_S] = {0,};
604 char buf_contact[DEF_BUF_LEN_S] = {0,};
606 msg_struct_list_s *addr_list = NULL;
607 char strNumber[DEF_THREAD_ADDR_LEN + 1] = {0,};
608 char strName[DEF_THREAD_NAME_LEN + 1] = {0,};
610 err = msg_get_message(ad->msgHandle, (msg_message_id_t)msg_id, msgInfo, sendOpt);
612 if (err != MSG_SUCCESS) {
613 service_destroy(svc_handle);
614 msg_release_struct(&msgInfo);
615 msg_release_struct(&sendOpt);
619 msg_get_int_value(msgInfo, MSG_MESSAGE_THREAD_ID_INT, &thread_id);
620 snprintf(buf_thread, sizeof(buf_thread), "%d", thread_id);
622 msg_get_list_handle(msgInfo, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list);
624 msg_get_str_value(addr_list->msg_struct_info[0], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, DEF_THREAD_ADDR_LEN);
625 msg_get_str_value(addr_list->msg_struct_info[0], MSG_ADDRESS_INFO_DISPLAYNAME_STR, strName, DEF_THREAD_NAME_LEN);
626 msg_get_int_value(addr_list->msg_struct_info[0], MSG_ADDRESS_INFO_CONTACT_ID_INT, &contact_id);
627 snprintf(buf_contact, sizeof(buf_contact), "%d", contact_id);
629 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_THREAD_ID, buf_thread);
630 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_THREAD_NAME, strName);
631 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_THREAD_ADDRESS, strNumber);
632 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_CONTACT_ID, buf_contact);
633 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_STORAGE_ID, buf_storage);
635 msg_release_struct(&msgInfo);
636 msg_release_struct(&sendOpt);
642 static Evas_Object* create_win(const char *name)
649 eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
651 elm_win_title_set(eo, name);
652 evas_object_smart_callback_add(eo, "delete,request", win_del, NULL);
653 ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
654 evas_object_resize(eo, w, h);
655 elm_win_conformant_set(eo, EINA_TRUE);
662 void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
674 base = ug_get_layout(ug);
682 case UG_MODE_FULLVIEW:
683 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
684 evas_object_show(base);
686 case UG_MODE_FRAMEVIEW:
694 void result_cb(ui_gadget_h ug, service_h result, void *priv)
698 MSG_UI_RET_IF(MSG_UI_LEVEL_ERR, !ug || !priv);
700 struct appdata *ad = priv;
702 PMSG_THREAD_DATA pData = (PMSG_THREAD_DATA)ad->thread_data;
703 PMSG_THREAD_LIST_DATA pListData = NULL;
705 char *str_result = NULL;
707 service_get_extra_data(result, MSG_BUNDLE_KEY_RESULT, &str_result);
709 if (!g_strcmp0(str_result, MSG_BUNDLE_VALUE_DEL_ALL))
710 msg_ui_destroy_composer_ug(ug, false);
716 pListData = msg_ui_thread_get_current_list();
718 if (!g_strcmp0(str_result, MSG_BUNDLE_VALUE_DEL_ALL)) {
719 elm_object_focus_set(pListData->genlist, EINA_TRUE);
720 msg_ui_destroy_composer_ug(ug, false);
725 service_get_extra_data(result, MSG_BUNDLE_KEY_MSG_ID, &buf);
726 if (buf && pListData->app_data_type != THREAD_LIST_APP_DATA_CONV) {
729 msg_ui_thread_list_msg_item_delete(pListData, del_id);
732 service_get_extra_data(result, MSG_BUNDLE_KEY_THREAD_ID, &buf);
733 if (buf && pListData->app_data_type != THREAD_LIST_APP_DATA_MSG) {
736 msg_ui_thread_list_item_delete(pListData, del_id);
739 if (pListData->item_cnt <= 0 && pListData->search_mode == THREAD_SEARCH_ON)
740 msg_ui_thread_cancel_search_mode(pListData);
742 if (pData->isRotate == true) {
743 if (!pData->split_data) {
744 msg_ui_thread_create_split_data();
745 msg_ui_thread_splitview_launch(pData, pData->split_data);
748 elm_object_part_content_set(pData->panes, "left", pData->layout_main);
749 elm_object_part_content_unset(pData->panes, "right");
750 elm_panes_content_left_size_set(pData->panes, 1.0);
753 pListData->sel_gen_item = NULL;
754 pListData->sel_thread_id = 0;
755 pListData->sel_msg_id = 0;
757 } else if (!g_strcmp0(str_result, MSG_BUNDLE_VALUE_DEL_BUBBLE)) {
758 service_get_extra_data(result, MSG_BUNDLE_KEY_THREAD_ID, &buf);
759 if (buf && pListData->app_data_type != THREAD_LIST_APP_DATA_MSG) {
761 thread_id = atoi(buf);
763 msg_ui_thread_list_item_update(pListData, thread_id);
765 } else if (!g_strcmp0(str_result, MSG_BUNDLE_VALUE_KEYPAD_SHOW)) {
766 pData->keypadIsShown = true;
767 if (pData->isRotate == true) {
768 elm_panes_content_left_size_set(pData->panes, 0.0);
769 elm_object_signal_emit(pData->panes, "elm,panes,unpair", "");
771 } else if (!g_strcmp0(str_result, MSG_BUNDLE_VALUE_KEYPAD_HIDE)) {
772 pData->keypadIsShown = false;
773 if (pData->isRotate == true) {
774 elm_panes_content_left_size_set(pData->panes, 0.4);
775 elm_object_signal_emit(pData->panes, "elm,panes,pair", "");
780 service_get_extra_data(result, MSG_BUNDLE_KEY_MSG_ID, &buf);
781 if (buf && pListData->app_data_type != THREAD_LIST_APP_DATA_CONV) {
782 update_id = atoi(buf);
784 msg_ui_thread_list_msg_item_update(pListData, update_id);
787 service_get_extra_data(result, MSG_BUNDLE_KEY_THREAD_ID, &buf);
788 if (buf && pListData->app_data_type != THREAD_LIST_APP_DATA_MSG) {
789 update_id = atoi(buf);
791 msg_ui_thread_list_item_update(pListData, update_id);
798 void destroy_cb(ui_gadget_h ug, void *priv)
802 MSG_UI_RET_IF(MSG_UI_LEVEL_ERR, !ug || !priv);
804 struct appdata *ad = (struct appdata *)priv;
805 int ug_type = msg_ui_get_composer_ug_type(ug);
806 PMSG_THREAD_LIST_DATA pListData = msg_ui_thread_get_current_list();
808 if (ad->layout_main) {
809 PMSG_THREAD_DATA pData = (PMSG_THREAD_DATA)ad->thread_data;
810 if (pListData == NULL) {
811 msg_ui_destroy_composer_ug(ug, false);
817 pData->keypadIsShown = false;
819 if (ug_type == MSG_COMPOSER_UG_TYPE_VIEWER) {
820 if (pData->isRotate == true) {
821 if (!pData->split_data) {
822 msg_ui_thread_create_split_data();
823 msg_ui_thread_splitview_launch(pData, pData->split_data);
826 if (pListData->search_mode == THREAD_SEARCH_ON)
827 msg_ui_thread_cancel_search_mode(pListData);
829 elm_win_lower(pData->win_main);
831 elm_object_part_content_set(pData->panes, "left", pData->layout_main);
832 elm_object_part_content_unset(pData->panes, "right");
833 elm_panes_content_left_size_set(pData->panes, 1.0);
836 pListData->view_mode = THREAD_NORMAL_VIEW;
838 msg_ui_destroy_composer_ug(ug, false);
840 msg_ui_destroy_composer_ug(ug, false);
845 int msg_ui_load_composer_ug(service_h svc_handle, MessageComposerUgType ug_type, bool isListItem)
850 return MSG_UI_RET_ERR;
852 ugdata *composer_data = NULL;
853 ui_gadget_h ug_h = NULL;
855 ugdata *exist_data = gAppData->composer_data;
856 PMSG_THREAD_LIST_DATA pListData = msg_ui_thread_get_current_list();
858 if (ug_type == MSG_COMPOSER_UG_TYPE_VIEWER) {
860 if (exist_data->ug_type == MSG_COMPOSER_UG_TYPE_VIEWER) {
864 exist_data = exist_data->next_ug;
867 if (exist_data && bReset) {
868 ug_send_message(exist_data->ug_h, svc_handle);
869 ug_h = exist_data->ug_h;
871 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_FROM, MSG_BUNDLE_VALUE_INTERNAL);
872 ug_h = ug_create(NULL, MSG_COMPOSER_UG_NAME, UG_MODE_FRAMEVIEW, svc_handle, &gAppData->cbs);
875 service_add_extra_data(svc_handle, MSG_BUNDLE_KEY_FROM, MSG_BUNDLE_VALUE_INTERNAL);
876 ug_h = ug_create(NULL, MSG_COMPOSER_UG_NAME, UG_MODE_FULLVIEW, svc_handle, &gAppData->cbs);
880 return MSG_UI_RET_ERR;
882 if (bReset == false) {
883 composer_data = (ugdata *)calloc(1, sizeof(ugdata));
884 composer_data->ug_h = ug_h;
885 composer_data->ug_type = ug_type;
887 exist_data = gAppData->composer_data;
890 if (exist_data->next_ug == NULL) {
891 exist_data->next_ug = composer_data;
892 composer_data->prev_ug = exist_data;
895 exist_data = exist_data->next_ug;
898 gAppData->composer_data = composer_data;
901 if (pListData && isListItem) {
902 composer_data->sel_gen_item = pListData->sel_gen_item;
903 composer_data->sel_thread_id = pListData->sel_thread_id;
904 composer_data->sel_msg_id = pListData->sel_msg_id;
906 } else if (exist_data && pListData && isListItem) {
907 exist_data->sel_gen_item = pListData->sel_gen_item;
908 exist_data->sel_thread_id = pListData->sel_thread_id;
909 exist_data->sel_msg_id = pListData->sel_msg_id;
912 if (ug_type == MSG_COMPOSER_UG_TYPE_VIEWER) {
913 PMSG_THREAD_DATA pData = (PMSG_THREAD_DATA)gAppData->thread_data;
914 Evas_Object * layout = (Evas_Object *)ug_get_layout(ug_h);
915 elm_object_part_content_set(pData->panes, "right", layout);
916 msg_ui_thread_destroy_split_data(pData->split_data);
918 if (pData->isRotate == false) {
919 elm_panes_content_left_size_set(pData->panes, 0.0);
920 evas_object_hide(pData->layout_main);
925 return MSG_UI_RET_SUCCESS;
928 Evas_Object *msg_ui_get_main_layout(void)
935 return gAppData->layout_main;
938 ugdata *msg_ui_get_composer_ug_data(ui_gadget_h ug)
941 ugdata *composer_data = NULL;
943 if (!gAppData || !gAppData->composer_data)
946 composer_data = gAppData->composer_data;
947 while (composer_data) {
948 if (composer_data->ug_h == ug)
949 return composer_data;
951 composer_data = composer_data->next_ug;
958 Evas_Object *msg_ui_get_composer_ug_viewer_layout(void)
961 ugdata *composer_data = NULL;
962 Evas_Object * layout = NULL;
964 if (!gAppData || !gAppData->composer_data)
967 composer_data = gAppData->composer_data;
968 while (composer_data) {
969 if (composer_data->ug_type == MSG_COMPOSER_UG_TYPE_VIEWER) {
970 layout = (Evas_Object *)ug_get_layout(composer_data->ug_h);
973 composer_data = composer_data->next_ug;
980 void msg_ui_destroy_composer_ug(ui_gadget_h ug, bool bDeleteAll)
983 ugdata *composer_data = NULL;
984 PMSG_THREAD_LIST_DATA pListData = NULL;
986 pListData = msg_ui_thread_get_current_list();
988 composer_data = gAppData->composer_data;
990 while (composer_data) {
991 if (composer_data->ug_h)
992 ug_destroy(composer_data->ug_h);
995 composer_data = composer_data->next_ug;
997 gAppData->composer_data = NULL;
999 while (composer_data) {
1003 if (ug == composer_data->ug_h) {
1005 if (pListData->genlist)
1006 elm_object_focus_set(pListData->genlist, EINA_TRUE);
1008 if ((pListData->sel_thread_id > 0) && (pListData->sel_thread_id == composer_data->sel_thread_id)) {
1009 int thread_id = pListData->sel_thread_id;
1011 pListData->sel_thread_id = 0;
1012 msg_ui_thread_list_item_update(pListData, thread_id);
1015 if ((pListData->sel_msg_id > 0) && (pListData->sel_msg_id == composer_data->sel_msg_id)) {
1016 int msg_id = pListData->sel_msg_id;
1018 pListData->sel_msg_id = 0;
1019 msg_ui_thread_list_msg_item_update(pListData, msg_id);
1022 if (pListData->sel_gen_item == composer_data->sel_gen_item)
1023 pListData->sel_gen_item = NULL;
1025 msg_ui_thread_set_title_unread_cnt(pListData);
1029 if (composer_data->prev_ug) {
1030 if (composer_data->next_ug)
1031 composer_data->prev_ug->next_ug = composer_data->next_ug;
1033 composer_data->prev_ug->next_ug = NULL;
1035 gAppData->composer_data = NULL;
1037 free(composer_data);
1040 composer_data = composer_data->next_ug;
1046 int msg_ui_get_composer_ug_type(ui_gadget_h ug)
1049 ugdata *composer_data = NULL;
1050 int ug_type = MSG_COMPOSER_UG_TYPE_NONE;
1052 if (!gAppData || !gAppData->composer_data)
1053 return MSG_COMPOSER_UG_TYPE_NONE;
1055 composer_data = gAppData->composer_data;
1056 while (composer_data) {
1057 if (composer_data->ug_h == ug) {
1058 ug_type = composer_data->ug_type;
1061 composer_data = composer_data->next_ug;
1068 static bool app_create(void *data)
1070 /* return TRUE : success, return FALSE : not to run main loop */
1074 MSG_UI_RETV_IF(MSG_UI_LEVEL_ERR, !data, MSG_UI_RET_ERR);
1076 struct appdata *ad = data;
1078 sound_manager_error_e snd_err = SOUND_MANAGER_ERROR_NONE;
1079 contacts_error_e ct_err = CONTACTS_ERROR_NONE;
1082 win = create_win(MESSAGE_PKGNAME);
1088 ad->bg = elm_bg_add(ad->win_main);
1089 evas_object_size_hint_weight_set(ad->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1090 elm_win_resize_object_add(ad->win_main, ad->bg);
1092 ad->conform = elm_conformant_add(win);
1093 if (ad->conform == NULL)
1096 evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1097 elm_win_resize_object_add(win, ad->conform);
1098 evas_object_show(ad->conform);
1100 snd_err = sound_manager_set_session_type(SOUND_SESSION_TYPE_SHARE);
1101 if (snd_err != SOUND_MANAGER_ERROR_NONE)
1102 D_MSG("sound_manager_set_session_type is failed, snd_err = [%d]", snd_err);
1104 ct_err = contacts_connect2();
1105 if (ct_err != CONTACTS_ERROR_NONE)
1106 D_EMSG("contacts_svc_connect2 failed : ct_err = [%d]", ct_err);
1108 UG_INIT_EFL(ad->win_main, UG_OPT_INDICATOR_ENABLE);
1109 elm_win_indicator_mode_set(ad->win_main, ELM_WIN_INDICATOR_SHOW);
1111 if(elm_win_wm_rotation_supported_get(ad->win_main)) {
1112 int rotation[4] = {0, 90, 180, 270};
1113 elm_win_wm_rotation_available_rotations_set(ad->win_main, rotation, 4);
1114 ad->cur_rotation = elm_win_rotation_get(ad->win_main);
1115 D_MSG("current rotation %d", ad->cur_rotation);
1116 evas_object_smart_callback_add(ad->win_main, "wm,rotation,changed", rotation_changed_cb, ad);
1119 ad->cbs.layout_cb = layout_cb;
1120 ad->cbs.result_cb = result_cb;
1121 ad->cbs.destroy_cb = destroy_cb;
1122 ad->cbs.priv = (void *)ad;
1124 gAppData = ad; // Set global app data pointer;
1130 static void app_terminate(void *data)
1134 MSG_UI_RETM_IF(MSG_UI_LEVEL_ERR, !data, "data is null");
1136 struct appdata *ad = data;
1138 contacts_error_e ct_err = CONTACTS_ERROR_NONE;
1142 ct_err = contacts_disconnect2();
1143 if (ct_err != CONTACTS_ERROR_NONE)
1144 D_EMSG("contacts_svc_disconnect2 failed : ct_err = [%d]", ct_err);
1146 if (ad->thread_data)
1147 msg_ui_thread_deinit_thread_data(ad->thread_data);
1149 if (ad->msgHandle) {
1150 err = msg_close_msg_handle(&ad->msgHandle);
1151 D_MSG("msg_close_msg_handle, ret = [%d]", err);
1157 static void app_pause(void *data)
1161 msg_ui_thread_set_app_state(MSG_UI_STATE_PAUSE);
1167 static void app_resume(void *data)
1170 msg_ui_thread_set_app_state(MSG_UI_STATE_RUNNING);
1177 static void app_service(service_h service, void *data)
1180 MSG_UI_RETM_IF(MSG_UI_LEVEL_ERR, !data, "data is NULL");
1182 struct appdata *ad = data;
1183 service_h svc_handle = NULL;
1184 msg_error_t err = MSG_SUCCESS;
1185 msg_handle_t msgHandle = NULL;
1186 bool isDefaultView = false;
1188 char *operation = NULL;
1189 char *cvalue = NULL;
1190 int ret = SYSTEM_INFO_ERROR_NONE;
1192 ret = system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &cvalue);
1193 if (ret == SYSTEM_INFO_ERROR_NONE && cvalue != NULL) {
1194 if (g_strcmp0(cvalue, "Emulator") == 0) {
1195 D_MSG("Not support in Emulator !!");
1201 int ret = service_create(&reply);
1202 if (ret != SERVICE_ERROR_NONE) {
1203 D_EMSG("service_create() is failed : ret = %d", ret);
1205 service_reply_to_launch_request(reply, service, SERVICE_RESULT_CANCELED);
1206 service_destroy(reply);
1209 /* Exit application because it is not supported in Emulator. */
1222 if (!ad->msgHandle) {
1223 err = msg_open_msg_handle(&msgHandle);
1224 if (err != MSG_SUCCESS) {
1225 MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "msg_open_msg_handle failed, Error=[%d]\n", err);
1226 __msg_ui_popup_warning(ad->win_main, dgettext("sys_string", "IDS_COM_POP_SERVICE_UNAVAILABLE"));
1229 ad->msgHandle = msgHandle;
1233 service_get_operation(service, &operation);
1235 svc_handle = __get_service_app_svc_op(operation, service);
1237 char *key_type = NULL;
1239 service_get_extra_data(service, MSG_BUNDLE_KEY_TYPE, &key_type);
1240 if (g_strcmp0(key_type, MSG_BUNDLE_VALUE_COMPOSE) == 0) {
1241 service_clone(&svc_handle, service);
1242 } else if (g_strcmp0(key_type, MSG_BUNDLE_VALUE_NEW_MSG) == 0) {
1243 svc_handle = __get_service_with_new_msg(ad);
1244 } else if (g_strcmp0(key_type, MSG_BUNDLE_VALUE_MSG_ID) == 0) {
1245 svc_handle = __get_service_with_msg_id(ad, service);
1246 } else if (g_strcmp0(key_type, MSG_BUNDLE_VALUE_REPORT) == 0) {
1247 svc_handle = __get_service_with_msg_id(ad, service);
1248 } else if (g_strcmp0(key_type, MSG_BUNDLE_VALUE_BUBBLE) == 0) {
1249 svc_handle = __get_service_with_msg_id(ad, service);
1251 char *mime_type = NULL;
1253 service_get_extra_data(service, AUL_K_MIME_TYPE, &mime_type);
1254 if (g_strcmp0(mime_type, MSG_BUNDLE_VALUE_SMS_URI) == 0)
1255 svc_handle = __msg_ui_parse_sms_uri(service, NULL);
1256 else if (g_strcmp0(mime_type, MSG_BUNDLE_VALUE_MMSTO_URI) == 0)
1257 svc_handle = __msg_ui_parse_mmsto_uri(service, NULL);
1259 isDefaultView = true;
1264 isDefaultView = true;
1269 service_get_extra_data(svc_handle, MSG_BUNDLE_KEY_STORAGE_ID, &buf);
1271 storge_id = atoi(buf);
1273 if (storge_id == MSG_STORAGE_SIM)
1274 isDefaultView = true;
1277 isDefaultView = true;
1280 if (isDefaultView) {
1281 MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "show DefaultView");
1282 if (ad->composer_data) {
1283 ugdata *composer_data = ad->composer_data;
1285 while (composer_data) {
1286 service_h composer_svc_handle = NULL;
1287 if (service_create(&composer_svc_handle) < 0 || composer_svc_handle == NULL)
1288 D_EMSG("service_create() is failed !!");
1290 composer_data = composer_data->next_ug;
1292 msg_ui_destroy_composer_ug(NULL, true);
1295 if (!ad->thread_data)
1296 ad->thread_data = msg_ui_thread_init_thread_data(ad);
1299 /*sim message viewer*/
1300 MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "show sim message viewer");
1302 if (!ad->layout_main) {
1303 ad->layout_main = msg_ui_thread_create_layout_main(ad->thread_data);
1304 evas_object_size_hint_weight_set(ad->layout_main, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1305 elm_object_content_set(ad->conform, ad->layout_main);
1307 PMSG_THREAD_DATA pData = (PMSG_THREAD_DATA)ad->thread_data;
1310 if (pData->detail_layout) {
1311 if (pData->isRotate == true)
1312 elm_object_item_del(elm_naviframe_top_item_get(pData->split_data->navi_frame));
1314 elm_object_item_del(elm_naviframe_top_item_get(pData->navi_frame));
1315 pData->detail_layout = NULL;
1318 for (i = MSG_THREAD_LIST_MAX_COUNT-1; i >= 0; i--) {
1319 if (pData->list_data[i] != NULL) {
1320 if (pData->list_data[i]->loaded_ug) {
1321 ug_destroy(pData->list_data[i]->loaded_ug);
1322 pData->list_data[i]->loaded_ug = NULL;
1324 elm_object_item_del(elm_naviframe_top_item_get(pData->navi_frame));
1325 elm_genlist_clear(pData->list_data[i]->genlist);
1326 msg_ui_thread_destroy_thread_list_data(pData->list_data[i]);
1330 if (pData->split_data)
1331 msg_ui_thread_destroy_split_data(pData->split_data);
1333 elm_win_conformant_set(ad->win_main, 1);
1337 PMSG_APP_THREAD_ADDR_INFO_S* addr_info = NULL;
1339 char* strNumber = NULL;
1340 char* strName = NULL;
1342 service_get_extra_data(service, MSG_BUNDLE_KEY_MSG_ID, &buf);
1348 addr_info = (PMSG_APP_THREAD_ADDR_INFO_S *)calloc(1, sizeof(PMSG_APP_THREAD_ADDR_INFO_S));
1349 addr_info[0] = (PMSG_APP_THREAD_ADDR_INFO_S)calloc(1, sizeof(MSG_APP_THREAD_ADDR_INFO_S));
1351 service_get_extra_data(svc_handle, MSG_BUNDLE_KEY_CONTACT_ID, &buf);
1353 addr_info[0]->contact_id = atoi(buf);
1357 service_get_extra_data(svc_handle, MSG_BUNDLE_KEY_THREAD_ADDRESS, &strNumber);
1358 if (strNumber && strlen(strNumber) > 0)
1359 strncpy(addr_info[0]->address, strNumber, DEF_THREAD_ADDR_LEN);
1361 strncpy(addr_info[0]->address, "", DEF_THREAD_ADDR_LEN);
1363 service_get_extra_data(svc_handle, MSG_BUNDLE_KEY_THREAD_NAME, &strName);
1364 if (strName && strlen(strName) > 0)
1365 strncpy(addr_info[0]->display_name, strName, DEF_THREAD_NAME_LEN);
1367 strncpy(addr_info[0]->display_name, "", DEF_THREAD_NAME_LEN);
1369 msg_update_read_status(ad->msgHandle, msg_id, true);
1370 msg_ui_thread_launch_msg_detail_view(NULL, msg_id, 1, addr_info);
1374 if (!ad->layout_main) {
1375 ad->layout_main = msg_ui_thread_create_layout_main(ad->thread_data);
1376 evas_object_size_hint_weight_set(ad->layout_main, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1377 elm_object_content_set(ad->conform, ad->layout_main);
1379 msg_ui_thread_load_thread_view(ad->thread_data, service);
1381 msg_ui_thread_reset_thread_view(ad->thread_data, service);
1385 MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "show app-service view");
1386 /* If message app is called by app-service to display composer view,
1387 * list view should be destroyed because previous screen should be displayed
1388 * when user tap back button.
1390 MessageComposerUgType ug_type = MSG_COMPOSER_UG_TYPE_NONE;
1392 if (operation != NULL) {
1394 PMSG_THREAD_DATA pData = (PMSG_THREAD_DATA)ad->thread_data;
1396 if (g_strcmp0(operation, SERVICE_OPERATION_SEND) == 0 ||
1397 g_strcmp0(operation, SERVICE_OPERATION_SEND_TEXT) == 0) {
1398 if (ad->layout_main) {
1400 /* content unset composer */
1401 if (elm_object_part_content_get(pData->panes, "right") != NULL)
1402 elm_object_part_content_unset(pData->panes, "right");
1404 for (i = MSG_THREAD_LIST_MAX_COUNT-1; i >= 0; i--) {
1405 if (pData->list_data[i] != NULL) {
1406 elm_object_item_del(elm_naviframe_top_item_get(pData->navi_frame));
1407 elm_genlist_clear(pData->list_data[i]->genlist);
1408 msg_ui_thread_destroy_thread_list_data(pData->list_data[i]);
1412 if (pData->split_data)
1413 msg_ui_thread_destroy_split_data(pData->split_data);
1415 evas_object_del(ad->layout_main);
1416 ad->layout_main = NULL;
1418 ug_type = MSG_COMPOSER_UG_TYPE_COMPOSER;
1419 } else if (g_strcmp0(operation, SERVICE_OPERATION_DEFAULT) == 0) {
1420 char *key_type = NULL;
1422 service_get_extra_data(service, MSG_BUNDLE_KEY_TYPE, &key_type);
1423 if (g_strcmp0(key_type, MSG_BUNDLE_VALUE_MSG_ID) == 0 || g_strcmp0(key_type, MSG_BUNDLE_VALUE_REPORT) == 0 || g_strcmp0(key_type, MSG_BUNDLE_VALUE_BUBBLE) == 0) {
1424 if (ad->layout_main) {
1426 /* content unset composer */
1427 if (elm_object_part_content_get(pData->panes, "right") != NULL)
1428 elm_object_part_content_unset(pData->panes, "right");
1430 for (i = MSG_THREAD_LIST_MAX_COUNT-1; i >= 0; i--) {
1431 if (pData->list_data[i] != NULL) {
1432 elm_object_item_del(elm_naviframe_top_item_get(pData->navi_frame));
1433 elm_genlist_clear(pData->list_data[i]->genlist);
1434 msg_ui_thread_destroy_thread_list_data(pData->list_data[i]);
1438 if (pData->split_data)
1439 msg_ui_thread_destroy_split_data(pData->split_data);
1441 evas_object_del(ad->layout_main);
1442 ad->layout_main = NULL;
1444 ug_type = MSG_COMPOSER_UG_TYPE_VIEWER;
1449 if (ad->composer_data) {
1450 ugdata *composer_data = ad->composer_data;
1452 while (composer_data) {
1453 service_h composer_svc_handle = NULL;
1454 if (service_create(&composer_svc_handle) < 0 || composer_svc_handle == NULL)
1455 D_EMSG("service_create() is failed !!");
1457 composer_data = composer_data->next_ug;
1459 msg_ui_destroy_composer_ug(NULL, true);
1462 ugdata *composer_data = NULL;
1464 composer_data = (ugdata*)calloc(1, sizeof(ugdata));
1465 composer_data->ug_h = ug_create(NULL, MSG_COMPOSER_UG_NAME, UG_MODE_FULLVIEW, svc_handle, &ad->cbs);
1466 composer_data->ug_type = ug_type;
1467 ad->composer_data = composer_data;
1471 service_destroy(svc_handle);
1474 evas_object_show(ad->win_main);
1475 elm_win_activate(ad->win_main);
1478 if (ad->layout_main == NULL && ad->composer_data == NULL)
1484 int main(int argc, char *argv[])
1489 memset(&ad, 0x0, sizeof(struct appdata));
1491 app_event_callback_s event_callback;
1493 event_callback.create = app_create;
1494 event_callback.terminate = app_terminate;
1495 event_callback.pause = app_pause;
1496 event_callback.resume = app_resume;
1497 event_callback.service = app_service;
1498 event_callback.low_memory = NULL;
1499 event_callback.low_battery = low_battery_cb;
1500 event_callback.language_changed = lang_changed;
1501 event_callback.device_orientation = NULL;
1502 event_callback.region_format_changed = region_changed_cb;
1505 return app_efl_main(&argc, &argv, &event_callback, &ad);