2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (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://www.tizenopensource.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.
18 #define UG_MODULE_API __attribute__ ((visibility("default")))
26 #include "email-debug.h"
27 #include "email-setting.h"
28 #include "email-setting-utils.h"
29 #include "email-view-setting.h"
30 #include "email-view-sp-select.h"
31 #include "email-view-account-edit.h"
32 #include "email-view-account-setup.h"
33 #include "email-view-manual-setup.h"
34 #include "email-view-mailbox-mapping.h"
35 #include "email-view-account-options.h"
36 #include "email-view-initial.h"
37 #include "email-view-sync-schedule.h"
38 #include "email-view-sync-setup.h"
40 static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv);
41 static void on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv);
42 static void on_key_event(ui_gadget_h ug, enum ug_key_event event, service_h service, void *priv);
43 static void on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv);
44 static void on_destroy(ui_gadget_h ug, service_h service, void *priv);
45 static void on_resume(ui_gadget_h ug, service_h service, void *priv);
46 static void on_pause(ui_gadget_h ug, service_h service, void *priv);
47 static void on_start(ui_gadget_h ug, service_h service, void *priv);
49 static void _init_data(struct ug_data *ugd);
50 static void _couple_data(struct ug_data *ugd, Viewtype t, struct viewdata *vd);
51 static void _dbus_receiver_setup(struct ug_data *ugd);
52 static void _remove_dbus_receiver(struct ug_data *ugd);
53 static int _account_init(struct ug_data *ugd);
54 static int _account_finalize(EmailSettingUGD *ugd);
55 static int _parse_option(service_h service, struct ug_data *ugd);
56 static void _dispatch_view(struct ug_data *ugd);
57 static void _create_navigationbar(struct ug_data *ugd);
58 static Evas_Object *_create_layout(Evas_Object *parent, struct ug_data *ugd);
60 static void _layout_block_cb(ui_gadget_h ug, enum ug_mode mode, void *priv);
61 static void _result_block_cb(ui_gadget_h ug, service_h service, void *priv);
62 static void _destroy_block_cb(ui_gadget_h ug, void *priv);
64 static void _popup_ok_cb(void *data, Evas_Object *obj, void *event_info);
67 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
74 ugd = calloc(1, sizeof(struct ug_data));
78 ops->create = on_create;
79 ops->start = on_start;
80 ops->pause = on_pause;
81 ops->resume = on_resume;
82 ops->destroy = on_destroy;
83 ops->message = on_message;
84 ops->event = on_event;
85 ops->key_event = on_key_event;
87 ops->opt = UG_OPT_INDICATOR_ENABLE;
92 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
105 UG_MODULE_API int setting_plugin_reset(service_h service, void *priv)
110 static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv)
122 parent = ug_get_window();
127 ugd->evas = evas_object_evas_get(ugd->win);
129 bindtextdomain(PACKAGE, LOCALEDIR);
131 ugd->block_cbs.layout_cb = _layout_block_cb;
132 ugd->block_cbs.result_cb = _result_block_cb;
133 ugd->block_cbs.destroy_cb = _destroy_block_cb;
134 ugd->block_cbs.priv = (void *)ugd;
136 /* Init Setting View Data */
140 _dbus_receiver_setup(ugd);
142 /* theme extension */
143 ugd->theme = elm_theme_new();
144 elm_theme_ref_set(ugd->theme, NULL);
145 /*elm_theme_extension_add(ugd->theme, EV_BLOCK_THEME_PATH); //Use block theme*/
147 ugd->layout_main = _create_layout(parent, ugd);
148 _create_navigationbar(ugd);
149 ugd->base = ugd->layout_main;
150 elm_win_indicator_mode_set(ugd->win, ELM_WIN_INDICATOR_SHOW);
152 return ugd->layout_main;
155 static void on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv)
159 case UG_EVENT_LOW_MEMORY:
161 case UG_EVENT_LOW_BATTERY:
163 case UG_EVENT_LANG_CHANGE:
165 case UG_EVENT_ROTATE_PORTRAIT:
167 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
169 case UG_EVENT_ROTATE_LANDSCAPE:
171 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
173 case UG_EVENT_REGION_CHANGE:
181 static void on_key_event(ui_gadget_h ug, enum ug_key_event event, service_h service, void *priv)
188 EmailSettingUGD *ugd;
192 case UG_KEY_EVENT_END:
193 ugd->end_key_event = 1;
195 if (elm_naviframe_top_item_get(ugd->navi_bar) == elm_naviframe_bottom_item_get(ugd->navi_bar)) {
196 if (ugd->popup_one != NULL || ugd->popup_validate != NULL) {
197 if (ugd->popup_one) {
198 evas_object_del(ugd->popup_one);
199 ugd->popup_one = NULL;
202 if (ugd->popup_validate) {
203 evas_object_del(ugd->popup_validate);
204 ugd->popup_validate = NULL;
206 ugd->cancel_event = 1;
207 email_engine_stop_working(ugd->account_id, ugd->handle);
213 if (ugd->popup_one != NULL || ugd->popup_validate != NULL) {
214 if (ugd->popup_one) {
215 evas_object_del(ugd->popup_one);
216 ugd->popup_one = NULL;
219 if (ugd->popup_validate) {
220 evas_object_del(ugd->popup_validate);
221 ugd->popup_validate = NULL;
223 ugd->cancel_event = 1;
224 email_engine_stop_working(ugd->account_id, ugd->handle);
227 if (ugd->change_view_ing == 0)
228 setting_change_view(VIEW_BACK, ugd);
238 static void on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv)
244 static void on_destroy(ui_gadget_h ug, service_h service, void *priv)
247 EmailSettingUGD *ugd;
248 struct viewdata *vd = NULL;
255 evas_object_del(ugd->base);
258 if (ugd->popup_one) {
259 evas_object_del(ugd->popup_one);
260 ugd->popup_one = NULL;
263 if (ugd->popup_validate) {
264 evas_object_del(ugd->popup_validate);
265 ugd->popup_validate = NULL;
268 if (ugd->password_timer) {
269 ecore_timer_del(ugd->password_timer);
270 ugd->password_timer = NULL;
273 if (ugd->focus_timer) {
274 ecore_timer_del(ugd->focus_timer);
275 ugd->focus_timer = NULL;
278 if (ugd->preset_vc_timer) {
279 ecore_timer_del(ugd->preset_vc_timer);
280 ugd->preset_vc_timer = NULL;
283 if (ugd->other_vc_timer) {
284 ecore_timer_del(ugd->other_vc_timer);
285 ugd->other_vc_timer = NULL;
288 if (ugd->edit_vc_timer) {
289 ecore_timer_del(ugd->edit_vc_timer);
290 ugd->edit_vc_timer = NULL;
293 if (ugd->del_timer) {
294 ecore_timer_del(ugd->del_timer);
295 ugd->del_timer = NULL;
298 setting_free_sp_desc(ugd);
300 /* theme extension */
301 /*elm_theme_extension_del(ugd->theme, EV_BLOCK_THEME_PATH);*/
302 elm_theme_free(ugd->theme);
304 /* Free Viewdata's memory */
305 for (i = VIEW_SETTING; i < VIEW_END; i++) {
308 debug_log("Memory Free");
313 email_engine_finalize();
314 r = _account_finalize(ugd);
315 _remove_dbus_receiver(ugd);
318 static void on_resume(ui_gadget_h ug, service_h service, void *priv)
334 static void on_pause(ui_gadget_h ug, service_h service, void *priv)
350 static void on_start(ui_gadget_h ug, service_h service, void *priv)
360 /* Init Email Service */
361 if (!email_engine_initialize()) {
362 Evas_Object *popup = elm_popup_add(ugd->layout_main);
363 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
364 elm_object_part_text_set(popup, "title,text", dgettext("sys_string", "IDS_COM_POP_WARNING"));
365 elm_object_text_set(popup, _("IDS_EMAIL_POP_FAILED_TO_START_EMAIL_APPLICATION"));
367 Evas_Object *btn1 = elm_button_add(popup);
368 elm_object_style_set(btn1, "popup_button/default");
369 elm_object_text_set(btn1, dgettext("sys_string", "IDS_COM_SK_OK"));
370 elm_object_part_content_set(popup, "button1", btn1);
371 evas_object_smart_callback_add(btn1, "clicked", _popup_ok_cb, ugd);
372 evas_object_show(popup);
376 /* Init Emf Account */
377 if (!_account_init(ugd)) {
378 debug_log("Failed to get account list");
381 /* create xml tree */
382 setting_free_sp_desc(ugd);
384 xmlDocPtr xml_source = setting_create_xml_tree(SP_XML_PATH);
386 Evas_Object *popup = elm_popup_add(ugd->layout_main);
387 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
388 elm_object_part_text_set(popup, "title,text", dgettext("sys_string", "IDS_COM_POP_WARNING"));
389 elm_object_text_set(popup, N_("Failed to parse resource XML"));
391 Evas_Object *btn1 = elm_button_add(popup);
392 elm_object_style_set(btn1, "popup_button/default");
393 elm_object_text_set(btn1, dgettext("sys_string", "IDS_COM_SK_OK"));
394 elm_object_part_content_set(popup, "button1", btn1);
395 evas_object_smart_callback_add(btn1, "clicked", _popup_ok_cb, ugd);
396 evas_object_show(popup);
399 ugd->xml_source = xml_source;
401 /* traverse xml tree */
403 root= xmlDocGetRootElement(xml_source);
404 int sp_count = xmlChildElementCount(root);
405 ugd->sp_list_len = sp_count;
406 debug_log("Count of SP list:%d", sp_count);
408 ugd->sp_list = (EmailSpDesc *)calloc(sp_count, sizeof(EmailSpDesc));
409 setting_traverse_xml_node(root, 0, (void *)ugd, 1);
410 setting_dump_sp_desc(ugd);
412 setting_cleanup_xml_parser(xml_source);
414 if (!_parse_option(service, ugd)) {
423 static void _init_data(struct ug_data *ugd)
426 struct viewdata *view_setting = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
427 struct viewdata *view_sp_select = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
428 struct viewdata *view_account_setup = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
429 struct viewdata *view_manual_setup = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
430 struct viewdata *view_account_edit = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
431 struct viewdata *view_mailbox_mapping = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
432 struct viewdata *view_account_options = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
433 struct viewdata *view_initial_access = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
434 struct viewdata *view_sync_schedule = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
435 struct viewdata *view_sync_setup = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
437 setting_init_setting_view(view_setting);
438 setting_init_sp_select_view(view_sp_select);
439 setting_init_account_setup_view(view_account_setup);
440 setting_init_manual_setup_view(view_manual_setup);
441 setting_init_account_edit_view(view_account_edit);
442 setting_init_mailbox_mapping_view(view_mailbox_mapping);
443 setting_init_account_options_view(view_account_options);
444 setting_init_initial_access_view(view_initial_access);
445 setting_init_sync_schedule_view(view_sync_schedule);
446 setting_init_sync_setup_view(view_sync_setup);
450 _couple_data(ugd, VIEW_SETTING, view_setting);
451 _couple_data(ugd, VIEW_SP_SELECT, view_sp_select);
452 _couple_data(ugd, VIEW_ACCOUNT_SETUP, view_account_setup);
453 _couple_data(ugd, VIEW_MANUAL_SETUP, view_manual_setup);
454 _couple_data(ugd, VIEW_ACCOUNT_EDIT, view_account_edit);
455 _couple_data(ugd, VIEW_MAILBOX_MAPPING, view_mailbox_mapping);
456 _couple_data(ugd, VIEW_ACCOUNT_OPTIONS, view_account_options);
457 _couple_data(ugd, VIEW_INITIAL_ACCESS, view_initial_access);
458 _couple_data(ugd, VIEW_SYNC_SCHEDULE, view_sync_schedule);
459 _couple_data(ugd, VIEW_SYNC_SETUP, view_sync_setup);
461 /* add more views... */
464 static void _couple_data(struct ug_data *ugd, Viewtype t, struct viewdata *vd)
467 debug_log("View type number%d", t);
472 static void _dbus_receiver_setup(struct ug_data *ugd)
477 debug_log("ugd == NULL");
481 int ret = e_dbus_init();
482 debug_log("ret: %d", ret);
486 if (ugd->dbus_conn == NULL) {
488 dbus_error_init(&derror);
489 ugd->dbus_conn = e_dbus_bus_get(DBUS_BUS_SYSTEM);
491 if (ugd->dbus_conn == NULL) {
492 debug_log("e_dbus_bus_get return NULL");
496 if (e_dbus_request_name(ugd->dbus_conn, "User.Email.StorageChange", 0, NULL, NULL) == NULL) {
497 debug_critical("Failed to e_dbus_request_name()");
501 if (ugd->signal_handler_storage != NULL) {
502 debug_log("_g_setting_signal_handler_storage != NULL");
505 ugd->signal_handler_storage = e_dbus_signal_handler_add(ugd->dbus_conn, NULL,
506 "/User/Email/StorageChange",
507 "User.Email.StorageChange", "email",
508 setting_edbus_event_receive,
509 (struct ug_data *)ugd);
511 if (ugd->signal_handler_storage == NULL) {
512 debug_log("Failed to e_dbus_signal_handler_add()");
517 if (e_dbus_request_name(ugd->dbus_conn, "User.Email.NetworkStatus", 0, NULL, NULL) == NULL) {
518 debug_critical("Failed to e_dbus_request_name()");
521 if (ugd->signal_handler_network != NULL) {
522 debug_log("_g_setting_signal_handler_network != NULL");
524 ugd->signal_handler_network = e_dbus_signal_handler_add(ugd->dbus_conn, NULL,
525 "/User/Email/NetworkStatus",
526 "User.Email.NetworkStatus", "email",
527 setting_edbus_event_receive,
528 (struct ug_data *)ugd);
530 if (ugd->signal_handler_network == NULL) {
531 debug_critical("Failed to e_dbus_signal_handler_add()");
537 static void _remove_dbus_receiver(struct ug_data *ugd)
542 debug_log("ugd == NULL");
546 if (ugd->signal_handler_storage != NULL) {
547 e_dbus_signal_handler_del(ugd->dbus_conn, ugd->signal_handler_storage);
548 ugd->signal_handler_storage = NULL;
551 if (ugd->signal_handler_network != NULL) {
552 e_dbus_signal_handler_del(ugd->dbus_conn, ugd->signal_handler_network);
553 ugd->signal_handler_network = NULL;
556 if (e_dbus_release_name(ugd->dbus_conn, "User.Email.StorageChange", NULL, NULL) == NULL) {
557 debug_critical("e_dbus_release_name to failed");
560 if (e_dbus_release_name(ugd->dbus_conn, "User.Email.NetworkStatus", NULL, NULL) == NULL) {
561 debug_critical("e_dbus_release_name to failed");
564 if (ugd->dbus_conn != NULL) {
565 /*e_dbus_connection_close(ugd->dbus_conn);*/
566 ugd->dbus_conn = NULL;
570 static int _account_init(struct ug_data *ugd)
575 /* Get Email Account List Info */
576 ugd->account_list = NULL;
577 if (!email_engine_get_account_list(&ugd->account_count, &ugd->account_list)) {
581 for (i = 0; i < ugd->account_count; i++) {
582 debug_log("*************Sending Option Details*************");
583 debug_log("Acct Id : %d", ugd->account_list[i].account_id);
584 debug_log("Email Addr : %s", ugd->account_list[i].user_email_address);
585 debug_log("1.Priority : %d", ugd->account_list[i].options.priority);
586 debug_log("2.Keep a copy : %d", ugd->account_list[i].options.keep_local_copy);
587 debug_log("3.Reply with body : %d", ugd->account_list[i].options.reply_with_body);
588 debug_log("4.Forward with files : %d", ugd->account_list[i].options.forward_with_files);
589 debug_log("5.Get read report : %d", ugd->account_list[i].options.req_read_receipt);
590 debug_log("6.Get delivery report: %d", ugd->account_list[i].options.req_delivery_receipt);
591 debug_log("7.Add my namecard : %d", ugd->account_list[i].options.add_myname_card);
592 debug_log("8.Add signature : %d", ugd->account_list[i].options.add_signature);
598 static int _account_finalize(EmailSettingUGD *ugd)
603 /* Free Account List Info */
604 if (ugd->account_list != NULL) {
605 r = email_engine_free_account_list(&(ugd->account_list), ugd->account_count);
606 retv_if(r == FALSE, -1);
608 ugd->account_list = NULL;
613 static int _parse_option(service_h service, struct ug_data *ugd)
618 debug_log("service is NULL");
623 char *operation = NULL;
624 ret = service_get_operation(service, &operation);
625 debug_log("service_get_operation: %d", ret);
626 debug_log("operation = %s", operation);
630 if (g_strcmp0(operation, ACCOUNT_OPERATION_SIGNIN) == 0) {
631 char *email_sp = NULL;
632 debug_log("Operation ACCOUNT_OPERATION_SIGNIN");
633 service_get_extra_data(service, /*ACCOUNT_DATA_SERVICE_PROVIDER*/ "http://tizen.org/account/data/service_provider", &email_sp);
638 debug_log("SP:%s", email_sp);
640 if (ugd->start_view_type)
641 g_free(ugd->start_view_type);
643 ugd->start_view_type = g_strdup(EMAIL_BUNDLE_VAL_VIEW_ACCOUNT_ADD);
645 EmailSpDesc *desc = NULL;
646 if (g_strcmp0(email_sp, "gmail") == 0)
647 desc = setting_find_sp_desc("Gmail", ugd);
648 else if (g_strcmp0(email_sp, "msn") == 0)
649 desc = setting_find_sp_desc("Hotmail", ugd);
654 ugd->account_info = desc;
656 ugd->account_info = NULL;
661 } else if (g_strcmp0(operation, ACCOUNT_OPERATION_VIEW) == 0) {
662 char *account_id = NULL;
663 char *username = NULL;
664 debug_log("Operation ACCOUNT_OPERATION_VIEW");
666 service_get_extra_data(service, ACCOUNT_DATA_ID, &account_id);
667 service_get_extra_data(service, ACCOUNT_DATA_USERNAME, &username);
673 int my_account_id = 0;
674 my_account_id = atoi(account_id);
676 debug_log("MY_ACCOUNT_ID:%d", my_account_id);
678 if (ugd->start_view_type)
679 g_free(ugd->start_view_type);
681 ugd->start_view_type = g_strdup(EMAIL_BUNDLE_VAL_VIEW_ACCOUNT_EDIT);
685 if (ugd->account_list == NULL || ugd->account_count == 0) {
686 debug_critical("account info is @niL");
687 Evas_Object *popup = elm_popup_add(ugd->layout_main);
688 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
689 elm_object_part_text_set(popup, "title,text", dgettext("sys_string", "IDS_COM_POP_WARNING"));
690 elm_object_text_set(popup, _("IDS_EMAIL_POP_ACCOUNT_LIST_NOT_FOUND"));
692 Evas_Object *btn1 = elm_button_add(popup);
693 elm_object_style_set(btn1, "popup_button/default");
694 elm_object_text_set(btn1, dgettext("sys_string", "IDS_COM_SK_OK"));
695 elm_object_part_content_set(popup, "button1", btn1);
696 evas_object_smart_callback_add(btn1, "clicked", _popup_ok_cb, ugd);
697 evas_object_show(popup);
701 for (i = 0; i < ugd->account_count; i++) {
702 if (ugd->account_list[i].account_svc_id == my_account_id) {
703 ugd->account_id = ugd->account_list[i].account_id;
704 debug_log("ACCOUNT_ID:%d", ugd->account_id);
713 service_get_extra_data(service, EMAIL_BUNDLE_KEY_VIEW_TYPE, &(ugd->start_view_type));
714 debug_log("VIEW TYPE:%s", ugd->start_view_type);
716 if (strcmp(ugd->start_view_type, EMAIL_BUNDLE_VAL_VIEW_ACCOUNT_EDIT) == 0) {
717 /* account edit view */
719 int my_account_id = 0;
720 service_get_extra_data(service, EMAIL_BUNDLE_KEY_ACCOUNT_ID, &str);
721 my_account_id = atoi(str);
723 debug_log("MY_ACCOUNT_ID:%d", my_account_id);
727 if (ugd->account_list == NULL || ugd->account_count == 0) {
728 debug_critical("account info is @niL");
729 Evas_Object *popup = elm_popup_add(ugd->layout_main);
730 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
731 elm_object_part_text_set(popup, "title,text", dgettext("sys_string", "IDS_COM_POP_WARNING"));
732 elm_object_text_set(popup, _("IDS_EMAIL_POP_ACCOUNT_LIST_NOT_FOUND"));
734 Evas_Object *btn1 = elm_button_add(popup);
735 elm_object_style_set(btn1, "popup_button/default");
736 elm_object_text_set(btn1, dgettext("sys_string", "IDS_COM_SK_OK"));
737 elm_object_part_content_set(popup, "button1", btn1);
738 evas_object_smart_callback_add(btn1, "clicked", _popup_ok_cb, ugd);
739 evas_object_show(popup);
743 for (i = 0; i < ugd->account_count; i++) {
744 if (ugd->account_list[i].account_svc_id == my_account_id) {
745 ugd->account_id = ugd->account_list[i].account_id;
746 debug_log("ACCOUNT_ID:%d", ugd->account_id);
749 } else if (strcmp(ugd->start_view_type, EMAIL_BUNDLE_VAL_VIEW_ACCOUNT_ADD) == 0) {
750 /* account add view */
751 char *account_name = NULL;
752 service_get_extra_data(service, EMAIL_BUNDLE_KEY_ESP_NAME, &account_name);
753 debug_log("Account name:%s", account_name);
755 EmailSpDesc *desc = NULL;
756 if (g_strcmp0(account_name, "gmail") == 0)
757 desc = setting_find_sp_desc("Gmail", ugd);
758 else if (g_strcmp0(account_name, "msn") == 0)
759 desc = setting_find_sp_desc("Hotmail", ugd);
764 ugd->account_info = desc;
766 ugd->account_info = NULL;
768 g_free(account_name);
775 static void _dispatch_view(struct ug_data *ugd)
779 if (ugd->start_view_type) {
780 if (!strcmp(ugd->start_view_type, EMAIL_BUNDLE_VAL_VIEW_SETTING_MAIN)) {
781 debug_log("Setting mail is up");
782 setting_change_view(VIEW_SETTING, ugd);
783 } else if (!strcmp(ugd->start_view_type, EMAIL_BUNDLE_VAL_VIEW_FIRST_SETUP)) {
784 debug_log("Setup wizard is up");
785 setting_change_view(VIEW_INITIAL_ACCESS, ugd);
786 } else if (!strcmp(ugd->start_view_type, EMAIL_BUNDLE_VAL_VIEW_ACCOUNT_EDIT)) {
787 debug_log("Edit view is up");
788 setting_change_view(VIEW_SYNC_SCHEDULE, ugd);
789 } else if (!strcmp(ugd->start_view_type, EMAIL_BUNDLE_VAL_VIEW_ACCOUNT_ADD)) {
790 debug_log("Add view is up");
791 setting_change_view(VIEW_ACCOUNT_SETUP, ugd);
792 } else if (!strcmp(ugd->start_view_type, EMAIL_BUNDLE_VAL_VIEW_SELECT_ACCOUNT)) {
793 debug_log("select account view is up");
794 setting_change_view(VIEW_SP_SELECT, ugd);
796 setting_change_view(VIEW_SETTING, ugd);
799 debug_log("No service value!");
800 setting_change_view(VIEW_SETTING, ugd);
805 static void _create_navigationbar(struct ug_data *ugd)
808 ugd->navi_bar = elm_naviframe_add(ugd->layout_main);
810 elm_object_part_content_set(ugd->layout_main, "elm.swallow.content", ugd->navi_bar);
811 evas_object_show(ugd->navi_bar);
814 static Evas_Object *_create_layout(Evas_Object *parent, struct ug_data *ugd)
819 ugd->bg = elm_bg_add(ugd->win);
820 evas_object_size_hint_weight_set(ugd->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
821 elm_win_resize_object_add(ugd->win, ugd->bg);
822 /*elm_object_theme_set(ugd->bg, ugd->theme);*/
823 evas_object_show(ugd->bg);
825 base = elm_layout_add(parent);
827 debug_log("base == NULL");
831 elm_layout_theme_set(base, "layout", "application", "default");
832 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
833 evas_object_show(base);
835 elm_object_style_set(ugd->bg, "group_list");
836 elm_object_part_content_set(base, "elm.swallow.bg", ugd->bg);
841 static void _layout_block_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
844 EmailSettingUGD *ugd;
850 ugd = (EmailSettingUGD *)priv;
852 base = ug_get_layout(ug);
857 case UG_MODE_FULLVIEW:
858 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
859 evas_object_show(base);
866 static void _result_block_cb(ui_gadget_h ug, service_h service, void *priv)
869 EmailSettingUGD *ugd;
874 ugd = (EmailSettingUGD *)priv;
879 static void _destroy_block_cb(ui_gadget_h ug, void *priv)
882 EmailSettingUGD *ugd;
887 ugd = (EmailSettingUGD *)priv;
889 if (ug == ugd->ug_block) {
890 ug_destroy(ugd->ug_block);
891 ugd->ug_block = NULL;
897 static void _popup_ok_cb(void *data, Evas_Object *obj, void *event_info)
902 debug_log("data is NULL");
907 evas_object_del(obj);
909 EmailSettingUGD *ugd = (EmailSettingUGD *)data;
910 ug_destroy_me(ugd->ug);