From f712fa32dacdee7d22bdcd7d4892fb0a873d255f Mon Sep 17 00:00:00 2001 From: Igor Nazarov Date: Mon, 29 Feb 2016 17:44:21 +0200 Subject: [PATCH] TizenRefApp-5869 [Email] Replace UG data types & parameter/variable/member names on correct for Mailbox module Change-Id: I06bdfcedc70c6f5b2559cf6e111347294fa9cb95 --- CMake/modules/email-mailbox-module/CMakeLists.txt | 2 +- .../modules/mailbox/inc/email-mailbox-item.h | 6 +- .../mailbox/inc/email-mailbox-list-other-items.h | 56 +- .../modules/mailbox/inc/email-mailbox-list.h | 56 +- ...ilbox-ug-util.h => email-mailbox-module-util.h} | 6 +- .../modules/mailbox/inc/email-mailbox-more-menu.h | 16 +- .../modules/mailbox/inc/email-mailbox-noti-mgr.h | 8 +- .../modules/mailbox/inc/email-mailbox-request.h | 12 +- .../modules/mailbox/inc/email-mailbox-search.h | 14 +- .../modules/mailbox/inc/email-mailbox-sync.h | 12 +- .../modules/mailbox/inc/email-mailbox-title.h | 28 +- .../modules/mailbox/inc/email-mailbox-toolbar.h | 4 +- .../modules/mailbox/inc/email-mailbox-util.h | 44 +- Project-Files/modules/mailbox/inc/email-mailbox.h | 50 +- .../modules/mailbox/src/email-mailbox-item.c | 30 +- .../mailbox/src/email-mailbox-list-other-items.c | 380 +++++----- .../modules/mailbox/src/email-mailbox-list.c | 710 +++++++++--------- ...ilbox-ug-util.c => email-mailbox-module-util.c} | 176 ++--- .../modules/mailbox/src/email-mailbox-more-menu.c | 274 +++---- .../modules/mailbox/src/email-mailbox-noti-mgr.c | 612 ++++++++-------- .../modules/mailbox/src/email-mailbox-request.c | 198 +++--- .../modules/mailbox/src/email-mailbox-search.c | 248 +++---- .../modules/mailbox/src/email-mailbox-sync.c | 74 +- .../modules/mailbox/src/email-mailbox-title.c | 326 ++++----- .../modules/mailbox/src/email-mailbox-toolbar.c | 104 +-- .../modules/mailbox/src/email-mailbox-util.c | 146 ++-- Project-Files/modules/mailbox/src/email-mailbox.c | 792 ++++++++++----------- 27 files changed, 2190 insertions(+), 2194 deletions(-) rename Project-Files/modules/mailbox/inc/{email-mailbox-ug-util.h => email-mailbox-module-util.h} (95%) rename Project-Files/modules/mailbox/src/{email-mailbox-ug-util.c => email-mailbox-module-util.c} (52%) diff --git a/CMake/modules/email-mailbox-module/CMakeLists.txt b/CMake/modules/email-mailbox-module/CMakeLists.txt index 613552e..40020c9 100644 --- a/CMake/modules/email-mailbox-module/CMakeLists.txt +++ b/CMake/modules/email-mailbox-module/CMakeLists.txt @@ -15,7 +15,7 @@ SET(SRCS ${CURRENT_SOURCE_DIR}/src/email-mailbox-sync.c ${CURRENT_SOURCE_DIR}/src/email-mailbox-title.c ${CURRENT_SOURCE_DIR}/src/email-mailbox-toolbar.c - ${CURRENT_SOURCE_DIR}/src/email-mailbox-ug-util.c + ${CURRENT_SOURCE_DIR}/src/email-mailbox-module-util.c ${CURRENT_SOURCE_DIR}/src/email-mailbox-util.c ) diff --git a/Project-Files/modules/mailbox/inc/email-mailbox-item.h b/Project-Files/modules/mailbox/inc/email-mailbox-item.h index 2e02572..55ca64e 100644 --- a/Project-Files/modules/mailbox/inc/email-mailbox-item.h +++ b/Project-Files/modules/mailbox/inc/email-mailbox-item.h @@ -34,14 +34,14 @@ typedef struct _MailboxSelectedList { */ typedef struct { Eina_List *requested_mail_list; - EmailMailboxUGD *mailbox_ugd; + EmailMailboxView *view; } edit_req_t; /** * @brief Provides process of mail move accordingly to Mailbox data source and destination - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_process_move_mail(EmailMailboxUGD *mailbox_ugd); +void mailbox_process_move_mail(EmailMailboxView *view); /** * @brief Ecore thread heavy callback that provides delete mails routine diff --git a/Project-Files/modules/mailbox/inc/email-mailbox-list-other-items.h b/Project-Files/modules/mailbox/inc/email-mailbox-list-other-items.h index 53f4e7d..4d65b62 100644 --- a/Project-Files/modules/mailbox/inc/email-mailbox-list-other-items.h +++ b/Project-Files/modules/mailbox/inc/email-mailbox-list-other-items.h @@ -25,89 +25,89 @@ void mailbox_free_other_item_class_data(); /** * @brief Provides adding the last updated time item to Mailbox viewer - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @param[in] show_directly» If TRUE immediately bring scroller to the item */ -void mailbox_last_updated_time_item_add(EmailMailboxUGD *mailbox_ugd, bool show_directly); +void mailbox_last_updated_time_item_add(EmailMailboxView *view, bool show_directly); /** * @brief Provides request from email service for last updated time with specified Mailbox ID and shows result in Mailbox viewer item * @param[in] mailbox_id» The Mailbox ID from email service - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_last_updated_time_item_update(int mailbox_id, EmailMailboxUGD *mailbox_ugd); +void mailbox_last_updated_time_item_update(int mailbox_id, EmailMailboxView *view); /** * @brief Free and release last updated time item from Mailbox viewer - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_last_updated_time_item_remove(EmailMailboxUGD *mailbox_ugd); +void mailbox_last_updated_time_item_remove(EmailMailboxView *view); /** * @brief Provides registration of callbacks for refresh operation in Mailbox viewer * @remark To genlist "edge,bottom" callback is added and gesture layout with flicks callbacks is added as well - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_refresh_flicks_cb_register(EmailMailboxUGD *mailbox_ugd); +void mailbox_refresh_flicks_cb_register(EmailMailboxView *view); /** * @brief When waiting for refresh for a new messages in Mailbox viewer the function provides appearance of progress item in Mailbox viewer - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_get_more_progress_item_add(EmailMailboxUGD *mailbox_ugd); +void mailbox_get_more_progress_item_add(EmailMailboxView *view); /** * @brief Free and release progress time item from Mailbox viewer - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_get_more_progress_item_remove(EmailMailboxUGD *mailbox_ugd); +void mailbox_get_more_progress_item_remove(EmailMailboxView *view); /** * @brief Provides adding the load more messages item to Mailbox viewer - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_load_more_messages_item_add(EmailMailboxUGD *mailbox_ugd); +void mailbox_load_more_messages_item_add(EmailMailboxView *view); /** * @brief Free and release load more messages item from Mailbox viewer - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_load_more_messages_item_remove(EmailMailboxUGD *mailbox_ugd); +void mailbox_load_more_messages_item_remove(EmailMailboxView *view); /** * @brief Provides functionality for send all messages from outbox in Mailbox viewer - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_send_all_btn_add(EmailMailboxUGD *mailbox_ugd); +void mailbox_send_all_btn_add(EmailMailboxView *view); /** * @brief Free and release functionality of send all messages from Mailbox viewer - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_send_all_btn_remove(EmailMailboxUGD *mailbox_ugd); +void mailbox_send_all_btn_remove(EmailMailboxView *view); /** * @brief Provides functionality for select all messages to Mailbox viewer - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_select_all_item_add(EmailMailboxUGD *mailbox_ugd); +void mailbox_select_all_item_add(EmailMailboxView *view); /** * @brief Free and release functionality for select all messages from Mailbox viewer - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_select_all_item_remove(EmailMailboxUGD *mailbox_ugd); +void mailbox_select_all_item_remove(EmailMailboxView *view); /** * @brief Provides adding the "no more emails" item to Mailbox viewer - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_no_more_emails_item_add(EmailMailboxUGD *mailbox_ugd); +void mailbox_no_more_emails_item_add(EmailMailboxView *view); /** * @brief Free and release for "no more emails" from Mailbox viewer - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_no_more_emails_item_remove(EmailMailboxUGD *mailbox_ugd); +void mailbox_no_more_emails_item_remove(EmailMailboxView *view); #endif /* __DEF_EMAIL_MAILBOX_LIST_OTHER_ITEMS_H_ */ diff --git a/Project-Files/modules/mailbox/inc/email-mailbox-list.h b/Project-Files/modules/mailbox/inc/email-mailbox-list.h index 9d279a3..6933eb7 100644 --- a/Project-Files/modules/mailbox/inc/email-mailbox-list.h +++ b/Project-Files/modules/mailbox/inc/email-mailbox-list.h @@ -20,9 +20,9 @@ /** * @brief Create content for Mailbox view - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_list_create_view(EmailMailboxUGD *mailbox_ugd); +void mailbox_list_create_view(EmailMailboxView *view); /** * @brief Show content of mail @@ -33,9 +33,9 @@ void mailbox_list_open_email_viewer(MailItemData *ld); /** * @brief System settings callback register * @remark Operation registers system accessibility for font size changes - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_list_system_settings_callback_register(EmailMailboxUGD *mailbox_ugd); +void mailbox_list_system_settings_callback_register(EmailMailboxView *view); /** * @brief System settings callback unregister @@ -46,40 +46,40 @@ void mailbox_list_system_settings_callback_unregister(); /** * @brief Refresh content of mail list in Mailbox * @remark Optionally search tag can be added - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @param[in] search_data Email search data */ -void mailbox_list_refresh(EmailMailboxUGD *mailbox_ugd, const email_search_data_t *search_data); +void mailbox_list_refresh(EmailMailboxView *view, const email_search_data_t *search_data); /** * @brief Insert item to Mailbox genlist * @param[in] ld Mail item data to attach - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_list_insert_mail_item(MailItemData *ld, EmailMailboxUGD *mailbox_ugd); +void mailbox_list_insert_mail_item(MailItemData *ld, EmailMailboxView *view); /** * @brief Insert item to Mailbox genlist used when needed check email if already consistent in Mailbox * @param[in] temp_ld Mail item data to attach - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_list_insert_mail_item_from_noti(MailItemData **temp_ld, EmailMailboxUGD *mailbox_ugd); +void mailbox_list_insert_mail_item_from_noti(MailItemData **temp_ld, EmailMailboxView *view); /** * @brief Remove email item from Mailbox genlist content - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @param[in] ld Mail item data to be removed */ -void mailbox_list_remove_mail_item(EmailMailboxUGD * mailbox_ugd, MailItemData * ld); +void mailbox_list_remove_mail_item(EmailMailboxView * view, MailItemData * ld); /** * @brief Provides creation of Mail Item data from email service received data * @param[in] mail_info Email mail list item data * @param[in] search_data Email Search data - * @param[in] mailbox_ugd Email Mailbox data + * @param[in] view Email Mailbox data * @return MailItemData structure or NULL if none or an error occurred */ -MailItemData *mailbox_list_make_mail_item_data(email_mail_list_item_t* mail_info, const email_search_data_t *search_data, EmailMailboxUGD *mailbox_ugd); +MailItemData *mailbox_list_make_mail_item_data(email_mail_list_item_t* mail_info, const email_search_data_t *search_data, EmailMailboxView *view); /** * @brief Get Mail Item data structure from Mail List by Mail ID @@ -105,27 +105,27 @@ void mailbox_list_free_mail_item_data(MailItemData *ld); /** * @brief Free all Mail Item data structures from Email Mailbox - * @param[in] mailbox_ugd Email Mailbox data + * @param[in] view Email Mailbox data */ -void mailbox_list_free_all_item_data(EmailMailboxUGD *mailbox_ugd); +void mailbox_list_free_all_item_data(EmailMailboxView *view); /** * @brief Remove an item class in a given Email Mailbox data. - * @param[in] mailbox_ugd Email Mailbox data + * @param[in] view Email Mailbox data */ -void mailbox_list_free_all_item_class_data(EmailMailboxUGD *mailbox_ugd); +void mailbox_list_free_all_item_class_data(EmailMailboxView *view); /** * @brief Provides selection functionality for content of Mailbox - * @param[in] mailbox_ugd Email Mailbox data + * @param[in] view Email Mailbox data */ -void mailbox_create_select_info(EmailMailboxUGD *mailbox_ugd); +void mailbox_create_select_info(EmailMailboxView *view); /** * @brief Updates select info - * @param[in] mailbox_ugd Email Mailbox data + * @param[in] view Email Mailbox data */ -void mailbox_update_select_info(EmailMailboxUGD *mailbox_ugd); +void mailbox_update_select_info(EmailMailboxView *view); /** * @brief Provides exit from edit mode @@ -135,16 +135,16 @@ void mailbox_exit_edit_mode(void *data); /** * @brief Clear edit mode content data - * @param[in] mailbox_ugd Email Mailbox data + * @param[in] view Email Mailbox data */ -void mailbox_clear_edit_mode_list(EmailMailboxUGD *mailbox_ugd); +void mailbox_clear_edit_mode_list(EmailMailboxView *view); /** * @brief The main purpose of this function is to remove from selected items list recieved Mail Item data and update recent of the list * @param[in] ld Mail Item data - * @param[in] mailbox_ugd Email Mailbox data + * @param[in] view Email Mailbox data */ -void mailbox_update_edit_list_view(MailItemData *ld, EmailMailboxUGD * mailbox_ugd); +void mailbox_update_edit_list_view(MailItemData *ld, EmailMailboxView * view); /** * @brief Remove all unnecessary items (prompts) from genlist content @@ -163,9 +163,9 @@ bool mailbox_check_searched_mail(int mail_id, void *data); /** * @brief Add thread queue job request to make remaining items from AddRemainingMailReq data - * @param[in] mailbox_ugd Email Mailbox data + * @param[in] view Email Mailbox data * @param[in] req Email AddRemainingMailReq data */ -void mailbox_list_make_remaining_items_in_thread(EmailMailboxUGD *mailbox_ugd, AddRemainingMailReqData *req); +void mailbox_list_make_remaining_items_in_thread(EmailMailboxView *view, AddRemainingMailReqData *req); #endif /* __DEF_EMAIL_MAILBOX_LIST_H_ */ diff --git a/Project-Files/modules/mailbox/inc/email-mailbox-ug-util.h b/Project-Files/modules/mailbox/inc/email-mailbox-module-util.h similarity index 95% rename from Project-Files/modules/mailbox/inc/email-mailbox-ug-util.h rename to Project-Files/modules/mailbox/inc/email-mailbox-module-util.h index bbd2d2e..a92b6e9 100644 --- a/Project-Files/modules/mailbox/inc/email-mailbox-ug-util.h +++ b/Project-Files/modules/mailbox/inc/email-mailbox-module-util.h @@ -15,8 +15,8 @@ * */ -#ifndef __DEF_EMAIL_MAILBOX_UG_UTIL_H_ -#define __DEF_EMAIL_MAILBOX_UG_UTIL_H_ +#ifndef __DEF_EMAIL_MAILBOX_MODULE_UTIL_H_ +#define __DEF_EMAIL_MAILBOX_MODULE_UTIL_H_ /** * @brief Creates Composer module from Mailbox view @@ -82,4 +82,4 @@ email_module_h mailbox_setting_module_create(void *data, email_module_type_e typ */ void mailbox_setting_module_destroy(void *priv, email_module_h module); -#endif /*__DEF_EMAIL_MAILBOX_UG_UTIL_H_*/ +#endif /*__DEF_EMAIL_MAILBOX_MODULE_UTIL_H_*/ diff --git a/Project-Files/modules/mailbox/inc/email-mailbox-more-menu.h b/Project-Files/modules/mailbox/inc/email-mailbox-more-menu.h index 33540ce..a3b499a 100644 --- a/Project-Files/modules/mailbox/inc/email-mailbox-more-menu.h +++ b/Project-Files/modules/mailbox/inc/email-mailbox-more-menu.h @@ -20,10 +20,10 @@ /** * @brief Creates the toolbar more button for Mailbox viewer - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @return Evas_Object instance with suitable more button, otherwise NULL */ -Evas_Object *mailbox_create_toolbar_more_btn(EmailMailboxUGD *mailbox_ugd); +Evas_Object *mailbox_create_toolbar_more_btn(EmailMailboxView *view); /** * @brief Delete emails from selected mail list in Email mailbox, at the end shows popup that deletion operation is done @@ -63,21 +63,21 @@ void mailbox_markread_mail(void *data); /** * @brief Creates floating button on Mailbox viewer to provide compose of new message - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_create_compose_btn(EmailMailboxUGD *mailbox_ugd); +void mailbox_create_compose_btn(EmailMailboxView *view); /** * @brief Show on Mailbox viewer previously created compose new message floating button - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_show_compose_btn(EmailMailboxUGD *mailbox_ugd); +void mailbox_show_compose_btn(EmailMailboxView *view); /** * @brief Hide compose new message floating button - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_hide_compose_btn(EmailMailboxUGD *mailbox_ugd); +void mailbox_hide_compose_btn(EmailMailboxView *view); #endif /* __DEF_EMAIL_MAILBOX_MORE_MENU_H_ */ diff --git a/Project-Files/modules/mailbox/inc/email-mailbox-noti-mgr.h b/Project-Files/modules/mailbox/inc/email-mailbox-noti-mgr.h index d3d5b55..fc480b3 100644 --- a/Project-Files/modules/mailbox/inc/email-mailbox-noti-mgr.h +++ b/Project-Files/modules/mailbox/inc/email-mailbox-noti-mgr.h @@ -31,9 +31,9 @@ typedef struct _noti_event { /** * @brief Initialize module notification system - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_setup_dbus_receiver(EmailMailboxUGD *mailbox_ugd); +void mailbox_setup_dbus_receiver(EmailMailboxView *view); /** * @brief Remove module notification system @@ -53,9 +53,9 @@ void mailbox_req_handle_list_free(); /** * @brief Remove and free sending mail list - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_sending_mail_list_free(EmailMailboxUGD *mailbox_ugd); +void mailbox_sending_mail_list_free(EmailMailboxView *view); /** * @brief Remove and free request account list diff --git a/Project-Files/modules/mailbox/inc/email-mailbox-request.h b/Project-Files/modules/mailbox/inc/email-mailbox-request.h index 3f352f4..42b0611 100644 --- a/Project-Files/modules/mailbox/inc/email-mailbox-request.h +++ b/Project-Files/modules/mailbox/inc/email-mailbox-request.h @@ -27,7 +27,7 @@ typedef struct { int account_id; int mailbox_type; char *msg_buf; - EmailMailboxUGD *mailbox_ugd; + EmailMailboxView *view; } DeleteMailReqData; /** @@ -37,7 +37,7 @@ typedef struct { int account_id; int mailbox_type; char *msg_buf; - EmailMailboxUGD *mailbox_ugd; + EmailMailboxView *view; } MoveMailReqData; /** @@ -51,7 +51,7 @@ typedef struct { email_mailbox_type_e mailbox_type; bool need_increase_mail_count; EmailMailboxMode mode; - EmailMailboxUGD *mailbox_ugd; + EmailMailboxView *view; } AddMailReqData; /** @@ -62,7 +62,7 @@ typedef struct add_remaining_mail_req_data { int start; int count; email_search_data_t *search_data; - EmailMailboxUGD *mailbox_ugd; + EmailMailboxView *view; } AddRemainingMailReqData; /** @@ -104,8 +104,8 @@ void mailbox_requests_cbs_unregister(); /** * @brief If in Mailbox exist request queue it cancle all requests - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_cancel_all_requests(EmailMailboxUGD *mailbox_ugd); +void mailbox_cancel_all_requests(EmailMailboxView *view); #endif /*_EMAIL_MAILBOX_REQUEST_H_*/ diff --git a/Project-Files/modules/mailbox/inc/email-mailbox-search.h b/Project-Files/modules/mailbox/inc/email-mailbox-search.h index 46d0e99..e953d5f 100644 --- a/Project-Files/modules/mailbox/inc/email-mailbox-search.h +++ b/Project-Files/modules/mailbox/inc/email-mailbox-search.h @@ -20,9 +20,9 @@ /** * @brief Cancel search mode in Mailbox and return to normal view - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_finish_search_mode(EmailMailboxUGD *mailbox_ugd); +void mailbox_finish_search_mode(EmailMailboxView *view); /** * @brief Free Email search data @@ -38,21 +38,21 @@ void _search_button_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, void *e /** * @brief Callback that provides click on search button - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @param[in] show_search_layout Bool value to define the search state */ -void mailbox_change_search_layout_state(EmailMailboxUGD *mailbox_ugd, bool show_search_layout); +void mailbox_change_search_layout_state(EmailMailboxView *view, bool show_search_layout); /** * @brief Create and initialize Email search data * @param[in] data User data (Email mailbox data) */ -email_search_data_t *mailbox_make_search_data(EmailMailboxUGD *mailbox_ugd); +email_search_data_t *mailbox_make_search_data(EmailMailboxView *view); /** * @brief Show search result - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -int mailbox_show_search_result(EmailMailboxUGD *mailbox_ugd); +int mailbox_show_search_result(EmailMailboxView *view); #endif /* __DEF_EMAIL_MAILBOX_SEARCH_H_ */ diff --git a/Project-Files/modules/mailbox/inc/email-mailbox-sync.h b/Project-Files/modules/mailbox/inc/email-mailbox-sync.h index db5bce5..48c615d 100644 --- a/Project-Files/modules/mailbox/inc/email-mailbox-sync.h +++ b/Project-Files/modules/mailbox/inc/email-mailbox-sync.h @@ -20,23 +20,23 @@ /** * @brief Provides synchronization for current Mailbox with email service - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @return TRUE on success or FALSE if none or an error occurred */ -bool mailbox_sync_current_mailbox(EmailMailboxUGD *mailbox_ugd); +bool mailbox_sync_current_mailbox(EmailMailboxView *view); /** * @brief Provides synchronization for more messages request from email service - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @return TRUE on success or FALSE if none or an error occurred */ -bool mailbox_sync_more_messages(EmailMailboxUGD *mailbox_ugd); +bool mailbox_sync_more_messages(EmailMailboxView *view); /** * @brief Cancel all synchronization processes email service - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_sync_cancel_all(EmailMailboxUGD *mailbox_ugd); +void mailbox_sync_cancel_all(EmailMailboxView *view); /** * @brief Provides synchronization for current folder diff --git a/Project-Files/modules/mailbox/inc/email-mailbox-title.h b/Project-Files/modules/mailbox/inc/email-mailbox-title.h index 4b4a6d4..5228c36 100644 --- a/Project-Files/modules/mailbox/inc/email-mailbox-title.h +++ b/Project-Files/modules/mailbox/inc/email-mailbox-title.h @@ -20,46 +20,46 @@ /** * @brief Pack title layout to Mailbox view content - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_view_title_pack(EmailMailboxUGD *mailbox_ugd); +void mailbox_view_title_pack(EmailMailboxView *view); /** * @brief Unpack title from Mailbox view - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_view_title_unpack(EmailMailboxUGD *mailbox_ugd); +void mailbox_view_title_unpack(EmailMailboxView *view); /** * @brief Updates title for Mailbox view - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_view_title_update_all(EmailMailboxUGD *mailbox_ugd); +void mailbox_view_title_update_all(EmailMailboxView *view); /** * @brief Apply updated title to Mailbox view - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_view_title_update_all_without_mailbox_change(EmailMailboxUGD *mailbox_ugd); +void mailbox_view_title_update_all_without_mailbox_change(EmailMailboxView *view); /** * @brief Update account name for Mailbox view title - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_view_title_update_account_name(EmailMailboxUGD *mailbox_ugd); +void mailbox_view_title_update_account_name(EmailMailboxView *view); /** * @brief Actual updates of mail count for Mailbox view title - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_view_title_update_mail_count(EmailMailboxUGD *mailbox_ugd); +void mailbox_view_title_update_mail_count(EmailMailboxView *view); /** * @brief Updates Mailbox view title for total and unread mails * @param[in] total_count Count of total mails * @param[in] unread_count Count of unread mails - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_view_title_increase_mail_count(int total_count, int unread_count, EmailMailboxUGD *mailbox_ugd); +void mailbox_view_title_increase_mail_count(int total_count, int unread_count, EmailMailboxView *view); #endif /* __DEF_EMAIL_MAILBOX_TITLE_H_ */ diff --git a/Project-Files/modules/mailbox/inc/email-mailbox-toolbar.h b/Project-Files/modules/mailbox/inc/email-mailbox-toolbar.h index f4d4c7d..c6693cd 100644 --- a/Project-Files/modules/mailbox/inc/email-mailbox-toolbar.h +++ b/Project-Files/modules/mailbox/inc/email-mailbox-toolbar.h @@ -20,8 +20,8 @@ /** * @brief Create toolbar control option for Mailbox view - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_toolbar_create(EmailMailboxUGD *mailbox_ugd); +void mailbox_toolbar_create(EmailMailboxView *view); #endif /* __DEF_EMAIL_MAILBOX_TOOLBAR_H_ */ diff --git a/Project-Files/modules/mailbox/inc/email-mailbox-util.h b/Project-Files/modules/mailbox/inc/email-mailbox-util.h index 14dc6bc..2b14cee 100644 --- a/Project-Files/modules/mailbox/inc/email-mailbox-util.h +++ b/Project-Files/modules/mailbox/inc/email-mailbox-util.h @@ -214,16 +214,16 @@ const char *email_get_mailbox_theme_path(); /** * @brief Clear Mailbox info data - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_clear_prev_mailbox_info(EmailMailboxUGD *mailbox_ugd); +void mailbox_clear_prev_mailbox_info(EmailMailboxView *view); /** * @brief Copies a byte string encoded to time format for last updated string * @param[in] last_update_time Structure represented time - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_set_last_updated_time(time_t last_update_time, EmailMailboxUGD *mailbox_ugd); +void mailbox_set_last_updated_time(time_t last_update_time, EmailMailboxView *view); /** * @brief Compare received Mail ID if exist in Mail item data @@ -235,17 +235,17 @@ int mailbox_compare_mailid_in_list(gconstpointer a, gconstpointer b); /** * @brief Creates popup with duration - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @param[in] title_text Title text * @param[in] contents_text Content body text * @param[in] timeout time duration * @return Evas_Object with suitable popup notification, otherwise NULL */ -Evas_Object *mailbox_create_timeout_popup(EmailMailboxUGD *mailbox_ugd, const char *title_text, const char *contents_text, double timeout); +Evas_Object *mailbox_create_timeout_popup(EmailMailboxView *view, const char *title_text, const char *contents_text, double timeout); /** * @brief Creates popup - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @param[in] title Title text * @param[in] content Content body text * @param[in] _response_cb Evas_Smart callback function for back button @@ -255,15 +255,15 @@ Evas_Object *mailbox_create_timeout_popup(EmailMailboxUGD *mailbox_ugd, const ch * @param[in] btn2_text String data for button #2 * @return Evas_Object with suitable popup notification, otherwise NULL */ -Evas_Object *mailbox_create_popup(EmailMailboxUGD *mailbox_ugd, const char *title, const char *content, Evas_Smart_Cb _response_cb, +Evas_Object *mailbox_create_popup(EmailMailboxView *view, const char *title, const char *content, Evas_Smart_Cb _response_cb, Evas_Smart_Cb btn1_response_cb, const char *btn1_text, Evas_Smart_Cb btn2_response_cb, const char *btn2_text); /** * @brief Creates error popup * @param[in] error_type Error type * @param[in] account_id Account ID - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_create_error_popup(int error_type, int account_id, EmailMailboxUGD *mailbox_ugd); +void mailbox_create_error_popup(int error_type, int account_id, EmailMailboxView *view); /** * @brief Creates password change popup @@ -274,46 +274,46 @@ void mailbox_create_password_changed_popup(void *data, int account_id); /** * @brief Check sort type validation - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_check_sort_type_validation(EmailMailboxUGD *mailbox_ugd); +void mailbox_check_sort_type_validation(EmailMailboxView *view); /** * @brief Add account color to Email settings data Mailbox Account list - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @param[in] account_id Account ID * @param[in] account_color Account color */ -void mailbox_account_color_list_add(EmailMailboxUGD *mailbox_ugd, int account_id, int account_color); +void mailbox_account_color_list_add(EmailMailboxView *view, int account_id, int account_color); /** * @brief Pass the elements of the Mailbox Account Color list and update color to appropriate account ID - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @param[in] account_id Account ID * @param[in] update_color Account color RGB type */ -void mailbox_account_color_list_update(EmailMailboxUGD *mailbox_ugd, int account_id, int update_color); +void mailbox_account_color_list_update(EmailMailboxView *view, int account_id, int update_color); /** * @brief Pass the elements of the Mailbox Account Color list and delete color from appropriate account ID - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @param[in] account_id Account ID */ -void mailbox_account_color_list_remove(EmailMailboxUGD *mailbox_ugd, int account_id); +void mailbox_account_color_list_remove(EmailMailboxView *view, int account_id); /** * @brief Pass the elements of the Mailbox Account Color list and return color for appropriate account ID - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @param[in] account_id Account ID * @return color for appropriate account ID, otherwise 0 */ -int mailbox_account_color_list_get_account_color(EmailMailboxUGD *mailbox_ugd, int account_id); +int mailbox_account_color_list_get_account_color(EmailMailboxView *view, int account_id); /** * @brief Free all elements from Mailbox Account Color list - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_account_color_list_free(EmailMailboxUGD *mailbox_ugd); +void mailbox_account_color_list_free(EmailMailboxView *view); /** * @brief Markup filter function for text inserted in the entry diff --git a/Project-Files/modules/mailbox/inc/email-mailbox.h b/Project-Files/modules/mailbox/inc/email-mailbox.h index 8ef6054..db9e5a9 100644 --- a/Project-Files/modules/mailbox/inc/email-mailbox.h +++ b/Project-Files/modules/mailbox/inc/email-mailbox.h @@ -96,12 +96,12 @@ typedef struct { int used_index; } EmailMailboxCheckCache; -typedef struct ug_data EmailMailboxUGD; +typedef struct _view_data EmailMailboxView; /** * @brief Email mailbox data */ -struct ug_data { +struct _view_data { email_view_t base; email_run_type_e run_type; @@ -238,7 +238,7 @@ struct ug_data { */ typedef struct { email_module_t base; - EmailMailboxUGD view; + EmailMailboxView view; Ecore_Thread *start_thread; volatile bool start_thread_done; @@ -251,7 +251,7 @@ typedef struct { * @brief Email group item data */ typedef struct { - EmailMailboxUGD *mailbox_ugd; + EmailMailboxView *view; gchar *group_title; int mail_count; @@ -265,7 +265,7 @@ typedef struct { * @brief Email mailbox mail item data */ typedef struct { - EmailMailboxUGD *mailbox_ugd; + EmailMailboxView *view; gchar *alias; gchar *sender; @@ -325,70 +325,70 @@ typedef struct { /** * @brief Request from email service update notification status for all accounts or to specified account ID - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_update_notifications_status(EmailMailboxUGD *mailbox_ugd); +void mailbox_update_notifications_status(EmailMailboxView *view); /** * @brief Create no content view with search mode or not. - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @param[in] search_mode If TRUE "search" layout will be used, if FALSE view will be hidden with "default" layout */ -void mailbox_create_no_contents_view(EmailMailboxUGD *mailbox_ugd, bool search_mode); +void mailbox_create_no_contents_view(EmailMailboxView *view, bool search_mode); /** * @brief Function provides show appearance to the no content view - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_show_no_contents_view(EmailMailboxUGD *mailbox_ugd); +void mailbox_show_no_contents_view(EmailMailboxView *view); /** * @brief Function hides no content view - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_hide_no_contents_view(EmailMailboxUGD *mailbox_ugd); +void mailbox_hide_no_contents_view(EmailMailboxView *view); /** * @brief Provides refresh for Mailbox including title or not - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @param[in] update_title If TRUE "title" will be updated, otherwise not */ -void mailbox_refresh_fullview(EmailMailboxUGD *mailbox_ugd, bool update_title); +void mailbox_refresh_fullview(EmailMailboxView *view, bool update_title); /** * @brief Provides removing the Mailbox button from naviframe - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_naviframe_mailbox_button_remove(EmailMailboxUGD *mailbox_ugd); +void mailbox_naviframe_mailbox_button_remove(EmailMailboxView *view); /** * @brief Provides adding the Mailbox button to naviframe - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data */ -void mailbox_naviframe_mailbox_button_add(EmailMailboxUGD *mailbox_ugd); +void mailbox_naviframe_mailbox_button_add(EmailMailboxView *view); /** * @brief Handles message from Viewer to open the next mail - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @return 0 on success, otherwise a negative error value */ -int mailbox_handle_next_msg_bundle(EmailMailboxUGD *mailbox_ugd, email_params_h msg); +int mailbox_handle_next_msg_bundle(EmailMailboxView *view, email_params_h msg); /** * @brief Handles message from Viewer to open the previous mail - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @return 0 on success, otherwise a negative error value */ -int mailbox_handle_prev_msg_bundle(EmailMailboxUGD *mailbox_ugd, email_params_h msg); +int mailbox_handle_prev_msg_bundle(EmailMailboxView *view, email_params_h msg); /** * @brief Provides functionality to open the Email viewer - * @param[in] mailbox_ugd Email mailbox data + * @param[in] view Email mailbox data * @param[in] account_id Account ID * @param[in] mailbox_id Mailbox ID * @param[in] mail_id Mail ID * @return 0 on success, otherwise a negative error value */ -int mailbox_open_email_viewer(EmailMailboxUGD *mailbox_ugd, int account_id, int mailbox_id, int mail_id); +int mailbox_open_email_viewer(EmailMailboxView *view, int account_id, int mailbox_id, int mail_id); #endif /* __DEF_EMAIL_MAILBOX_H_ */ diff --git a/Project-Files/modules/mailbox/src/email-mailbox-item.c b/Project-Files/modules/mailbox/src/email-mailbox-item.c index 27be4ae..687a2a0 100644 --- a/Project-Files/modules/mailbox/src/email-mailbox-item.c +++ b/Project-Files/modules/mailbox/src/email-mailbox-item.c @@ -21,14 +21,14 @@ #include "email-mailbox-list.h" #include "email-mailbox-sync.h" #include "email-mailbox-request.h" -#include "email-mailbox-ug-util.h" +#include "email-mailbox-module-util.h" #include "email-mailbox-util.h" -void mailbox_process_move_mail(EmailMailboxUGD *mailbox_ugd) +void mailbox_process_move_mail(EmailMailboxView *view) { debug_enter(); - int checked_count = eina_list_count(mailbox_ugd->selected_mail_list); + int checked_count = eina_list_count(view->selected_mail_list); int account_id = 0; int i = 0; @@ -47,34 +47,34 @@ void mailbox_process_move_mail(EmailMailboxUGD *mailbox_ugd) } for (i = 0; i < checked_count; i++) { - Eina_List *nth_list = eina_list_nth_list(mailbox_ugd->selected_mail_list, i); + Eina_List *nth_list = eina_list_nth_list(view->selected_mail_list, i); MailItemData *ld = eina_list_data_get(nth_list); if (account_id < 1) { account_id = ld->account_id; - mailbox_ugd->move_src_mailbox_id = ld->mailbox_id; + view->move_src_mailbox_id = ld->mailbox_id; } snprintf(selected_mail_list[i], MAIL_ID_SIZE, "%d", (int)ld->mail_id); } - mailbox_sync_cancel_all(mailbox_ugd); + mailbox_sync_cancel_all(view); - debug_log("account_id: %d, mailbox_id: %d", account_id, mailbox_ugd->move_src_mailbox_id); + debug_log("account_id: %d, mailbox_id: %d", account_id, view->move_src_mailbox_id); email_params_h params = NULL; if (email_params_create(¶ms) && email_params_add_int(params, EMAIL_BUNDLE_KEY_ACCOUNT_ID, account_id) && - email_params_add_int(params, EMAIL_BUNDLE_KEY_MAILBOX, mailbox_ugd->move_src_mailbox_id) && + email_params_add_int(params, EMAIL_BUNDLE_KEY_MAILBOX, view->move_src_mailbox_id) && email_params_add_int(params, EMAIL_BUNDLE_KEY_IS_MAILBOX_MOVE_MODE, 1) && email_params_add_int(params, EMAIL_BUNDLE_KEY_MAILBOX_MOVE_MODE, EMAIL_MOVE_VIEW_NORMAL) && - email_params_add_int(params, EMAIL_BUNDLE_KEY_IS_MAILBOX_EDIT_MODE, mailbox_ugd->b_editmode) && - email_params_add_int(params, EMAIL_BUNDLE_KEY_MOVE_SRC_MAILBOX_ID, mailbox_ugd->move_src_mailbox_id) && + email_params_add_int(params, EMAIL_BUNDLE_KEY_IS_MAILBOX_EDIT_MODE, view->b_editmode) && + email_params_add_int(params, EMAIL_BUNDLE_KEY_MOVE_SRC_MAILBOX_ID, view->move_src_mailbox_id) && email_params_add_str_array(params, EMAIL_BUNDLE_KEY_ARRAY_SELECTED_MAIL_IDS, (const char **)selected_mail_list, checked_count)) { - mailbox_ugd->account = mailbox_account_module_create(mailbox_ugd, EMAIL_MODULE_ACCOUNT, params); + view->account = mailbox_account_module_create(view, EMAIL_MODULE_ACCOUNT, params); } email_params_free(¶ms); @@ -95,7 +95,7 @@ void mailbox_process_delete_mail(void *data, Ecore_Thread *thd) DeleteRequestedMail *requested_mail = NULL; edit_req_t *req = (edit_req_t *)data; - EmailMailboxUGD *mailbox_ugd = req->mailbox_ugd; + EmailMailboxView *view = req->view; Eina_List *list = req->requested_mail_list; /*gotom_if(max_account_id < 0, CATCH_ERROR, "Invalid max_account_id(%d) was returned.", max_account_id);*/ @@ -163,7 +163,7 @@ void mailbox_process_delete_mail(void *data, Ecore_Thread *thd) result = email_delete_mail(trashbox_id, mail_ids, count, delete_option); if (result != EMAIL_ERROR_NONE) { debug_warning("email_delete_message mailbox_id(%d) count(%d)- err (%d)", - mailbox_ugd->mailbox_id, count, result); + view->mailbox_id, count, result); } } else { /* making dest folder - trash */ @@ -179,9 +179,9 @@ void mailbox_process_delete_mail(void *data, Ecore_Thread *thd) } if (result == EMAIL_ERROR_NONE) { - mailbox_ugd->need_deleted_noti = true; + view->need_deleted_noti = true; } else { - mailbox_ugd->need_deleted_noti = false; + view->need_deleted_noti = false; int ret = notification_status_message_post(email_get_email_string("IDS_EMAIL_POP_FAILED_TO_DELETE")); if (ret != NOTIFICATION_ERROR_NONE) { debug_log("fail to notification_status_message_post() : %d\n", ret); diff --git a/Project-Files/modules/mailbox/src/email-mailbox-list-other-items.c b/Project-Files/modules/mailbox/src/email-mailbox-list-other-items.c index a8a38ed..8075337 100644 --- a/Project-Files/modules/mailbox/src/email-mailbox-list-other-items.c +++ b/Project-Files/modules/mailbox/src/email-mailbox-list-other-items.c @@ -60,7 +60,7 @@ static Evas_Object *_get_more_progress_gl_content_get(void *data, Evas_Object *o static char *_load_more_messages_gl_text_get(void *data, Evas_Object *obj, const char *part); static Evas_Event_Flags _mailbox_gesture_flicks_abort_cb(void *data, void *event_info); static Evas_Event_Flags _mailbox_gesture_flicks_end_cb(void *data, void *event_info); -static void _mailbox_gesture_flick_to_load_more(EmailMailboxUGD *mailbox_ugd); +static void _mailbox_gesture_flick_to_load_more(EmailMailboxView *view); /* Select All item */ @@ -73,7 +73,7 @@ static char *_no_more_emails_gl_text_get(void *data, Evas_Object *obj, const cha /* Send All item */ static void _mailbox_send_outgoing_messages_thread_worker(void *data, Ecore_Thread *th); static void _mailbox_send_outgoing_messages_thread_finish(void *data, Ecore_Thread *th); -static GList *_mailbox_make_send_all_data_list(EmailMailboxUGD *mailbox_ugd); +static GList *_mailbox_make_send_all_data_list(EmailMailboxView *view); static void _mailbox_free_send_all_data_list(GList *send_all_list); /* @@ -82,9 +82,9 @@ static void _mailbox_free_send_all_data_list(GList *send_all_list); static char *_last_updated_time_gl_text_get(void *data, Evas_Object *obj, const char *part) { - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - if(mailbox_ugd->last_updated_time && !strcmp(part, "elm.text")) { - return strdup(mailbox_ugd->last_updated_time); + EmailMailboxView *view = (EmailMailboxView *)data; + if(view->last_updated_time && !strcmp(part, "elm.text")) { + return strdup(view->last_updated_time); } else return NULL; } @@ -94,15 +94,15 @@ static void _edge_bottom_cb(void *data, Evas_Object *obj, void *event_info) debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; /* should know the current mode, account id, and mailbox name. */ /* The view type is always DATE view. */ - debug_log("mailbox_ugd->mode(%d), mailbox_ugd->mailbox_type(%d) b_edge_bottom(%d)", mailbox_ugd->mode, mailbox_ugd->mailbox_type, mailbox_ugd->b_edge_bottom); + debug_log("view->mode(%d), view->mailbox_type(%d) b_edge_bottom(%d)", view->mode, view->mailbox_type, view->b_edge_bottom); - if (mailbox_ugd->b_edge_bottom == false) { - mailbox_ugd->b_edge_bottom = true; - debug_log("set b_edge_bottom as TRUE %d", mailbox_ugd->b_edge_bottom); + if (view->b_edge_bottom == false) { + view->b_edge_bottom = true; + debug_log("set b_edge_bottom as TRUE %d", view->b_edge_bottom); } debug_leave(); @@ -147,8 +147,8 @@ static char *_load_more_messages_gl_text_get(void *data, Evas_Object *obj, const static char *_select_all_item_gl_text_get(void *data, Evas_Object *obj, const char *part) { - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - if (!strcmp(part, "elm.text") && mailbox_ugd->b_editmode) { + EmailMailboxView *view = (EmailMailboxView *)data; + if (!strcmp(part, "elm.text") && view->b_editmode) { return strdup(_("IDS_EMAIL_HEADER_SELECT_ALL_ABB")); } else return NULL; @@ -161,15 +161,15 @@ static Evas_Object *_select_all_item_gl_content_get(void *data, Evas_Object *obj return NULL; } - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - debug_log("mailbox_ugd->b_editmode = %d", mailbox_ugd->b_editmode); - if (mailbox_ugd->b_editmode) { + EmailMailboxView *view = (EmailMailboxView *)data; + debug_log("view->b_editmode = %d", view->b_editmode); + if (view->b_editmode) { if (!strcmp(source, "elm.swallow.end")) { - mailbox_ugd->selectAll_check = elm_check_add(obj); - evas_object_propagate_events_set(mailbox_ugd->selectAll_check, EINA_FALSE); - elm_check_state_pointer_set(mailbox_ugd->selectAll_check, (Eina_Bool *)&mailbox_ugd->selectAll_chksel); - evas_object_smart_callback_add(mailbox_ugd->selectAll_check, "changed", _select_all_item_check_changed_cb, data); - return mailbox_ugd->selectAll_check; + view->selectAll_check = elm_check_add(obj); + evas_object_propagate_events_set(view->selectAll_check, EINA_FALSE); + elm_check_state_pointer_set(view->selectAll_check, (Eina_Bool *)&view->selectAll_chksel); + evas_object_smart_callback_add(view->selectAll_check, "changed", _select_all_item_check_changed_cb, data); + return view->selectAll_check; } } @@ -181,19 +181,19 @@ static void _select_all_item_check_changed_cb(void *data, Evas_Object *obj, void debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *) data; + EmailMailboxView *view = (EmailMailboxView *) data; Eina_Bool group_checked = EINA_FALSE; MailItemData *child_ld; if (obj == NULL) { - group_checked = mailbox_ugd->selectAll_chksel; + group_checked = view->selectAll_chksel; } else { group_checked = elm_check_state_get(obj); - mailbox_ugd->selectAll_chksel = group_checked; + view->selectAll_chksel = group_checked; } debug_log("group_checked = %d", group_checked); - Elm_Object_Item *next_item = elm_genlist_item_next_get(elm_genlist_first_item_get(mailbox_ugd->gl)); + Elm_Object_Item *next_item = elm_genlist_item_next_get(elm_genlist_first_item_get(view->gl)); while (next_item) { child_ld = (MailItemData *)elm_object_item_data_get(next_item); debug_log("executed elm_object_item_data_get()"); @@ -208,8 +208,8 @@ static void _select_all_item_check_changed_cb(void *data, Evas_Object *obj, void if (child_ld->mail_status == EMAIL_MAIL_STATUS_SENDING || child_ld->mail_status == EMAIL_MAIL_STATUS_SEND_WAIT) { debug_log("email being sent selected - unselect it(%d)", child_ld->mail_status); child_ld->checked = EINA_FALSE; - mailbox_ugd->selectAll_chksel = EINA_FALSE; - elm_check_state_set(mailbox_ugd->selectAll_check, mailbox_ugd->selectAll_chksel); + view->selectAll_chksel = EINA_FALSE; + elm_check_state_set(view->selectAll_check, view->selectAll_chksel); int ret = notification_status_message_post(email_get_email_string("IDS_EMAIL_TPOP_SENDING_EMAIL_ING")); if (ret != NOTIFICATION_ERROR_NONE) { debug_warning("notification_status_message_post() failed: %d", ret); @@ -218,18 +218,18 @@ static void _select_all_item_check_changed_cb(void *data, Evas_Object *obj, void } if (child_ld->checked) { - mailbox_ugd->selected_mail_list = eina_list_append(mailbox_ugd->selected_mail_list, child_ld); + view->selected_mail_list = eina_list_append(view->selected_mail_list, child_ld); } else { - mailbox_ugd->selected_mail_list = eina_list_remove(mailbox_ugd->selected_mail_list, child_ld); + view->selected_mail_list = eina_list_remove(view->selected_mail_list, child_ld); } } - elm_check_state_set(mailbox_ugd->selectAll_check, mailbox_ugd->selectAll_chksel); + elm_check_state_set(view->selectAll_check, view->selectAll_chksel); next_item = elm_genlist_item_next_get(next_item); /* ETC genlist items should be removed before entering edit mode. If normal case, below error case is not occurred. */ - if ((next_item == mailbox_ugd->load_more_messages_item) || (next_item == mailbox_ugd->no_more_emails_item) - || (next_item == mailbox_ugd->get_more_progress_item) - || (next_item == mailbox_ugd->last_updated_time_item)) { + if ((next_item == view->load_more_messages_item) || (next_item == view->no_more_emails_item) + || (next_item == view->get_more_progress_item) + || (next_item == view->last_updated_time_item)) { debug_error("ETC genlist item is inserted. It should not be included!!!!"); break; } @@ -237,12 +237,12 @@ static void _select_all_item_check_changed_cb(void *data, Evas_Object *obj, void Eina_List *l; Elm_Object_Item *it; - l = elm_genlist_realized_items_get(mailbox_ugd->gl); + l = elm_genlist_realized_items_get(view->gl); EINA_LIST_FREE(l, it) { child_ld = (MailItemData *)elm_object_item_data_get(it); elm_check_state_set(child_ld->check_btn, child_ld->checked); } - mailbox_create_select_info(mailbox_ugd); + mailbox_create_select_info(view); } /* @@ -294,11 +294,11 @@ void mailbox_free_other_item_class_data() elm_genlist_item_class_free(&itc_select_all); } -void mailbox_last_updated_time_item_add(EmailMailboxUGD *mailbox_ugd, bool show_directly) +void mailbox_last_updated_time_item_add(EmailMailboxView *view, bool show_directly) { debug_enter(); - mailbox_last_updated_time_item_remove(mailbox_ugd); + mailbox_last_updated_time_item_remove(view); itc_last_updated_time.item_style = "group_index"; itc_last_updated_time.func.text_get = _last_updated_time_gl_text_get; @@ -307,25 +307,25 @@ void mailbox_last_updated_time_item_add(EmailMailboxUGD *mailbox_ugd, bool show_ itc_last_updated_time.func.del = NULL; itc_last_updated_time.decorate_all_item_style = NULL; - elm_genlist_select_mode_set(mailbox_ugd->gl, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - mailbox_ugd->last_updated_time_item = elm_genlist_item_insert_before(mailbox_ugd->gl, + elm_genlist_select_mode_set(view->gl, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + view->last_updated_time_item = elm_genlist_item_insert_before(view->gl, &itc_last_updated_time, - mailbox_ugd, + view, NULL, - elm_genlist_first_item_get(mailbox_ugd->gl), + elm_genlist_first_item_get(view->gl), ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(mailbox_ugd->last_updated_time_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - elm_genlist_select_mode_set(mailbox_ugd->gl, ELM_OBJECT_SELECT_MODE_DEFAULT); + elm_genlist_item_select_mode_set(view->last_updated_time_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + elm_genlist_select_mode_set(view->gl, ELM_OBJECT_SELECT_MODE_DEFAULT); if (show_directly) - elm_genlist_item_show(mailbox_ugd->last_updated_time_item, ELM_GENLIST_ITEM_SCROLLTO_TOP); + elm_genlist_item_show(view->last_updated_time_item, ELM_GENLIST_ITEM_SCROLLTO_TOP); debug_leave(); } -void mailbox_last_updated_time_item_update(int mailbox_id, EmailMailboxUGD *mailbox_ugd) +void mailbox_last_updated_time_item_update(int mailbox_id, EmailMailboxView *view) { debug_enter(); @@ -333,43 +333,43 @@ void mailbox_last_updated_time_item_update(int mailbox_id, EmailMailboxUGD *mail int err = email_get_mailbox_by_mailbox_id(mailbox_id, &mailbox); if (err == EMAIL_ERROR_NONE && mailbox) { - mailbox_set_last_updated_time(mailbox->last_sync_time, mailbox_ugd); + mailbox_set_last_updated_time(mailbox->last_sync_time, view); } email_free_mailbox(&mailbox, 1); - if (mailbox_ugd->last_updated_time_item) - elm_genlist_item_update(mailbox_ugd->last_updated_time_item); + if (view->last_updated_time_item) + elm_genlist_item_update(view->last_updated_time_item); else { - mailbox_last_updated_time_item_add(mailbox_ugd, true); + mailbox_last_updated_time_item_add(view, true); } return; } -void mailbox_last_updated_time_item_remove(EmailMailboxUGD *mailbox_ugd) +void mailbox_last_updated_time_item_remove(EmailMailboxView *view) { debug_enter(); - if (mailbox_ugd && mailbox_ugd->last_updated_time_item) { - elm_object_item_del(mailbox_ugd->last_updated_time_item); - mailbox_ugd->last_updated_time_item = NULL; + if (view && view->last_updated_time_item) { + elm_object_item_del(view->last_updated_time_item); + view->last_updated_time_item = NULL; } } -void mailbox_refresh_flicks_cb_register(EmailMailboxUGD *mailbox_ugd) +void mailbox_refresh_flicks_cb_register(EmailMailboxView *view) { debug_enter(); - evas_object_smart_callback_add(mailbox_ugd->gl, "edge,bottom", _edge_bottom_cb, mailbox_ugd); - debug_log("_edge_bottom_cb() is registered in mailbox_ugd->gl(%p)", mailbox_ugd->gl); + evas_object_smart_callback_add(view->gl, "edge,bottom", _edge_bottom_cb, view); + debug_log("_edge_bottom_cb() is registered in view->gl(%p)", view->gl); - mailbox_ugd->gesture_ly = elm_gesture_layer_add(mailbox_ugd->gl); - if (mailbox_ugd->gesture_ly) { - elm_gesture_layer_attach(mailbox_ugd->gesture_ly, mailbox_ugd->gl); - elm_gesture_layer_cb_set(mailbox_ugd->gesture_ly, ELM_GESTURE_N_FLICKS, ELM_GESTURE_STATE_END, _mailbox_gesture_flicks_end_cb, mailbox_ugd); - elm_gesture_layer_cb_set(mailbox_ugd->gesture_ly, ELM_GESTURE_N_FLICKS, ELM_GESTURE_STATE_ABORT, _mailbox_gesture_flicks_abort_cb, mailbox_ugd); + view->gesture_ly = elm_gesture_layer_add(view->gl); + if (view->gesture_ly) { + elm_gesture_layer_attach(view->gesture_ly, view->gl); + elm_gesture_layer_cb_set(view->gesture_ly, ELM_GESTURE_N_FLICKS, ELM_GESTURE_STATE_END, _mailbox_gesture_flicks_end_cb, view); + elm_gesture_layer_cb_set(view->gesture_ly, ELM_GESTURE_N_FLICKS, ELM_GESTURE_STATE_ABORT, _mailbox_gesture_flicks_abort_cb, view); } else { - debug_warning("gesture layout INVALID!! gesture_ly(%p)", mailbox_ugd->gesture_ly); + debug_warning("gesture layout INVALID!! gesture_ly(%p)", view->gesture_ly); } } @@ -379,15 +379,15 @@ static Evas_Event_Flags _mailbox_gesture_flicks_end_cb(void *data, void *event_i retvm_if(!data, EVAS_EVENT_FLAG_NONE, "data == NULL"); retvm_if(!event_info, EVAS_EVENT_FLAG_NONE, "event_info == NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - retvm_if(!mailbox_ugd, EVAS_EVENT_FLAG_NONE, "mailbox_ugd == NULL"); + EmailMailboxView *view = (EmailMailboxView *)data; + retvm_if(!view, EVAS_EVENT_FLAG_NONE, "view == NULL"); Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info; - if (!mailbox_ugd->b_editmode && !mailbox_ugd->b_searchmode && !mailbox_ugd->only_local) { + if (!view->b_editmode && !view->b_searchmode && !view->only_local) { if ((p->angle > 20.0f && p->angle < 160.0f) || (p->angle > 200.0f && p->angle < 340.0f)) { return EVAS_EVENT_FLAG_NONE; } else if (p->angle > 340.0f || p->angle < 20.0f) { - _mailbox_gesture_flick_to_load_more(mailbox_ugd); + _mailbox_gesture_flick_to_load_more(view); } } @@ -395,36 +395,36 @@ static Evas_Event_Flags _mailbox_gesture_flicks_end_cb(void *data, void *event_i } -static void _mailbox_gesture_flick_to_load_more(EmailMailboxUGD *mailbox_ugd) +static void _mailbox_gesture_flick_to_load_more(EmailMailboxView *view) { debug_enter(); - int ncnt = g_list_length(mailbox_ugd->mail_list); - debug_log("mailbox_ugd->mode(%d), mailbox_ugd->mailbox_type(%d) b_edge_bottom(%d) sort_type(%d)", mailbox_ugd->mode, mailbox_ugd->mailbox_type, mailbox_ugd->b_edge_bottom, mailbox_ugd->sort_type); - if ((NULL != mailbox_ugd->load_more_messages_item) && (mailbox_ugd->b_edge_bottom == true || ncnt < 6) && (mailbox_ugd->b_enable_get_more == true)) { + int ncnt = g_list_length(view->mail_list); + debug_log("view->mode(%d), view->mailbox_type(%d) b_edge_bottom(%d) sort_type(%d)", view->mode, view->mailbox_type, view->b_edge_bottom, view->sort_type); + if ((NULL != view->load_more_messages_item) && (view->b_edge_bottom == true || ncnt < 6) && (view->b_enable_get_more == true)) { - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL && - (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_NONE || - mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX || - mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_SEARCH_RESULT || - mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED)) + if (view->mode == EMAIL_MAILBOX_MODE_ALL && + (view->mailbox_type == EMAIL_MAILBOX_TYPE_NONE || + view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX || + view->mailbox_type == EMAIL_MAILBOX_TYPE_SEARCH_RESULT || + view->mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED)) return; - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && - (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_NONE || - mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX || - mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_SEARCH_RESULT || - mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED)) + if (view->mode == EMAIL_MAILBOX_MODE_MAILBOX && + (view->mailbox_type == EMAIL_MAILBOX_TYPE_NONE || + view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX || + view->mailbox_type == EMAIL_MAILBOX_TYPE_SEARCH_RESULT || + view->mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED)) return; - if (mailbox_ugd->get_more_progress_item || mailbox_ugd->sort_type != EMAIL_SORT_DATE_RECENT) { + if (view->get_more_progress_item || view->sort_type != EMAIL_SORT_DATE_RECENT) { return; } - mailbox_sync_cancel_all(mailbox_ugd); - if (mailbox_sync_more_messages(mailbox_ugd)) { - mailbox_load_more_messages_item_remove(mailbox_ugd); - mailbox_no_more_emails_item_remove(mailbox_ugd); - mailbox_get_more_progress_item_add(mailbox_ugd); + mailbox_sync_cancel_all(view); + if (mailbox_sync_more_messages(view)) { + mailbox_load_more_messages_item_remove(view); + mailbox_no_more_emails_item_remove(view); + mailbox_get_more_progress_item_add(view); } } } @@ -435,17 +435,17 @@ static Evas_Event_Flags _mailbox_gesture_flicks_abort_cb(void *data, void *event retvm_if(!data, EVAS_EVENT_FLAG_NONE, "data == NULL"); retvm_if(!event_info, EVAS_EVENT_FLAG_NONE, "event_info == NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - retvm_if(!mailbox_ugd, EVAS_EVENT_FLAG_NONE, "mailbox_ugd == NULL"); + EmailMailboxView *view = (EmailMailboxView *)data; + retvm_if(!view, EVAS_EVENT_FLAG_NONE, "view == NULL"); Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info; - if (!mailbox_ugd->b_editmode && !mailbox_ugd->b_searchmode && !mailbox_ugd->only_local) { + if (!view->b_editmode && !view->b_searchmode && !view->only_local) { if ((p->angle > 20.0f && p->angle < 160.0f) || (p->angle > 200.0f && p->angle < 340.0f)) { return EVAS_EVENT_FLAG_NONE; } - if (mailbox_ugd->b_edge_bottom == true && (p->angle > 160.0f && p->angle < 200.0f)) { - mailbox_ugd->b_edge_bottom = false; + if (view->b_edge_bottom == true && (p->angle > 160.0f && p->angle < 200.0f)) { + view->b_edge_bottom = false; } } @@ -453,7 +453,7 @@ static Evas_Event_Flags _mailbox_gesture_flicks_abort_cb(void *data, void *event return EVAS_EVENT_FLAG_NONE; } -void mailbox_get_more_progress_item_add(EmailMailboxUGD *mailbox_ugd) +void mailbox_get_more_progress_item_add(EmailMailboxView *view) { debug_enter(); @@ -465,25 +465,25 @@ void mailbox_get_more_progress_item_add(EmailMailboxUGD *mailbox_ugd) email_account_t *account_list = NULL; email_mailbox_t *mailbox_list = NULL; - if (mailbox_ugd->get_more_progress_item) { - debug_log("more_progress is already created(%p)", mailbox_ugd->get_more_progress_item); + if (view->get_more_progress_item) { + debug_log("more_progress is already created(%p)", view->get_more_progress_item); return; } - if (mailbox_ugd->b_enable_get_more) { - mailbox_ugd->b_enable_get_more = false; - debug_log("_edge_bottom_cb() is unregistered in mailbox_ugd->gl(%p)", mailbox_ugd->gl); + if (view->b_enable_get_more) { + view->b_enable_get_more = false; + debug_log("_edge_bottom_cb() is unregistered in view->gl(%p)", view->gl); } - mailbox_ugd->total_mail_count = 0; - mailbox_ugd->unread_mail_count = 0; + view->total_mail_count = 0; + view->unread_mail_count = 0; - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL) { + if (view->mode == EMAIL_MAILBOX_MODE_ALL) { err = email_get_account_list(&account_list, &account_count); if (err == EMAIL_ERROR_NONE && account_list) { for (i = 0; i < account_count; i++) { - debug_log("account_id(%d), mailbox_type(%d)", account_list->account_id, mailbox_ugd->mailbox_type); - err = email_get_mailbox_by_mailbox_type(account_list->account_id, mailbox_ugd->mailbox_type, &mailbox_list); + debug_log("account_id(%d), mailbox_type(%d)", account_list->account_id, view->mailbox_type); + err = email_get_mailbox_by_mailbox_type(account_list->account_id, view->mailbox_type, &mailbox_list); if (err == EMAIL_ERROR_NONE && mailbox_list) { total_mail_count += mailbox_list->total_mail_count_on_local; unread_mail_count += mailbox_list->unread_count; @@ -497,9 +497,9 @@ void mailbox_get_more_progress_item_add(EmailMailboxUGD *mailbox_ugd) if (account_list) { email_free_account(&account_list, account_count); } - } else if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) { - debug_log("account_id(%d), mailbox_type(%d)", mailbox_ugd->account_id, mailbox_ugd->mailbox_type); - err = email_get_mailbox_by_mailbox_id(mailbox_ugd->mailbox_id, &mailbox_list); + } else if (view->mode == EMAIL_MAILBOX_MODE_MAILBOX) { + debug_log("account_id(%d), mailbox_type(%d)", view->account_id, view->mailbox_type); + err = email_get_mailbox_by_mailbox_id(view->mailbox_id, &mailbox_list); if (err == EMAIL_ERROR_NONE && mailbox_list) { total_mail_count = mailbox_list->total_mail_count_on_local; unread_mail_count = mailbox_list->unread_count; @@ -510,8 +510,8 @@ void mailbox_get_more_progress_item_add(EmailMailboxUGD *mailbox_ugd) } } - mailbox_ugd->total_mail_count = total_mail_count; - mailbox_ugd->unread_mail_count = unread_mail_count; + view->total_mail_count = total_mail_count; + view->unread_mail_count = unread_mail_count; itc_get_more_progress.item_style = "type1"; itc_get_more_progress.func.text_get = _get_more_progress_gl_text_get; @@ -520,41 +520,41 @@ void mailbox_get_more_progress_item_add(EmailMailboxUGD *mailbox_ugd) itc_get_more_progress.func.del = NULL; itc_get_more_progress.decorate_all_item_style = NULL; - mailbox_ugd->get_more_progress_item = elm_genlist_item_append(mailbox_ugd->gl, + view->get_more_progress_item = elm_genlist_item_append(view->gl, &itc_get_more_progress, - mailbox_ugd, + view, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(mailbox_ugd->get_more_progress_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - elm_genlist_item_bring_in(mailbox_ugd->get_more_progress_item, ELM_GENLIST_ITEM_SCROLLTO_IN); + elm_genlist_item_select_mode_set(view->get_more_progress_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + elm_genlist_item_bring_in(view->get_more_progress_item, ELM_GENLIST_ITEM_SCROLLTO_IN); - if (mailbox_ugd->b_enable_get_more == false) { - mailbox_ugd->b_enable_get_more = true; - debug_log("_edge_bottom_cb() is registered in mailbox_ugd->gl(%p)", mailbox_ugd->gl); + if (view->b_enable_get_more == false) { + view->b_enable_get_more = true; + debug_log("_edge_bottom_cb() is registered in view->gl(%p)", view->gl); } debug_leave(); } -void mailbox_get_more_progress_item_remove(EmailMailboxUGD *mailbox_ugd) +void mailbox_get_more_progress_item_remove(EmailMailboxView *view) { debug_enter(); - if (mailbox_ugd->get_more_progress_item) { - mailbox_ugd->b_edge_bottom = false; - elm_object_item_del(mailbox_ugd->get_more_progress_item); - mailbox_ugd->get_more_progress_item = NULL; + if (view->get_more_progress_item) { + view->b_edge_bottom = false; + elm_object_item_del(view->get_more_progress_item); + view->get_more_progress_item = NULL; } } -void mailbox_load_more_messages_item_add(EmailMailboxUGD *mailbox_ugd) +void mailbox_load_more_messages_item_add(EmailMailboxView *view) { debug_enter(); - if (mailbox_ugd->load_more_messages_item) { + if (view->load_more_messages_item) { debug_log("get_more_messages item already exist."); return; } @@ -566,26 +566,26 @@ void mailbox_load_more_messages_item_add(EmailMailboxUGD *mailbox_ugd) itc_load_more_messages.func.del = NULL; itc_load_more_messages.decorate_all_item_style = NULL; - mailbox_ugd->load_more_messages_item = elm_genlist_item_append(mailbox_ugd->gl, + view->load_more_messages_item = elm_genlist_item_append(view->gl, &itc_load_more_messages, - mailbox_ugd, + view, NULL, ELM_GENLIST_ITEM_NONE, - NULL, mailbox_ugd); + NULL, view); - elm_genlist_item_select_mode_set(mailbox_ugd->load_more_messages_item, ELM_OBJECT_SELECT_MODE_NONE); - mailbox_ugd->b_edge_bottom = false; + elm_genlist_item_select_mode_set(view->load_more_messages_item, ELM_OBJECT_SELECT_MODE_NONE); + view->b_edge_bottom = false; debug_leave(); } -void mailbox_load_more_messages_item_remove(EmailMailboxUGD *mailbox_ugd) +void mailbox_load_more_messages_item_remove(EmailMailboxView *view) { debug_enter(); - if (mailbox_ugd->load_more_messages_item) { - elm_object_item_del(mailbox_ugd->load_more_messages_item); - mailbox_ugd->load_more_messages_item = NULL; - mailbox_ugd->b_edge_bottom = false; + if (view->load_more_messages_item) { + elm_object_item_del(view->load_more_messages_item); + view->load_more_messages_item = NULL; + view->b_edge_bottom = false; } } @@ -595,23 +595,23 @@ static void _send_outgoing_messages_clicked_cb(void *data, Evas_Object *obj, voi retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; MailOutgoingListData *send_thread_data = MEM_ALLOC(send_thread_data, 1); - Eina_Bool is_disabled = elm_object_disabled_get(mailbox_ugd->outbox_send_all_btn); + Eina_Bool is_disabled = elm_object_disabled_get(view->outbox_send_all_btn); if (!is_disabled) { - elm_object_disabled_set(mailbox_ugd->outbox_send_all_btn, !is_disabled); + elm_object_disabled_set(view->outbox_send_all_btn, !is_disabled); } - mailbox_send_all_btn_remove(mailbox_ugd); + mailbox_send_all_btn_remove(view); int ret = notification_status_message_post(email_get_email_string("IDS_EMAIL_TPOP_SENDING_EMAILS_ING")); if (ret != NOTIFICATION_ERROR_NONE) { debug_log("notification_status_message_post() failed: %d", ret); } - send_thread_data->send_all_runned = &(mailbox_ugd->is_send_all_run); - send_thread_data->send_all_list = _mailbox_make_send_all_data_list(mailbox_ugd); + send_thread_data->send_all_runned = &(view->is_send_all_run); + send_thread_data->send_all_list = _mailbox_make_send_all_data_list(view); Ecore_Thread *th = ecore_thread_run(_mailbox_send_outgoing_messages_thread_worker, _mailbox_send_outgoing_messages_thread_finish, NULL, send_thread_data); if (!th) { debug_log("failed to start thread for sending outgoing mail"); @@ -620,17 +620,17 @@ static void _send_outgoing_messages_clicked_cb(void *data, Evas_Object *obj, voi debug_leave(); } -static GList *_mailbox_make_send_all_data_list(EmailMailboxUGD *mailbox_ugd) +static GList *_mailbox_make_send_all_data_list(EmailMailboxView *view) { debug_enter(); - if (!mailbox_ugd) { - debug_warning("mailbox_ugd is NULL"); + if (!view) { + debug_warning("view is NULL"); return NULL; } GList *send_all_list = NULL; - GList *cur = g_list_first(mailbox_ugd->mail_list); + GList *cur = g_list_first(view->mail_list); MailItemData *ld = NULL; for (; cur; cur = g_list_next(cur)) { ld = (MailItemData *)g_list_nth_data(cur, 0); @@ -738,49 +738,49 @@ Evas_Object *mailbox_create_toolbar_btn(Evas_Object *parent, const char *text, c return btn; } -void mailbox_send_all_btn_add(EmailMailboxUGD *mailbox_ugd) +void mailbox_send_all_btn_add(EmailMailboxView *view) { debug_enter(); - int mail_count = g_list_length(mailbox_ugd->g_sending_mail_list); - if (mailbox_ugd->is_send_all_run || mail_count != 0) { + int mail_count = g_list_length(view->g_sending_mail_list); + if (view->is_send_all_run || mail_count != 0) { debug_log("Send all is currently runned now"); return; } - if (mailbox_ugd->b_searchmode || mailbox_ugd->b_editmode) { - debug_log("Send all not needed: b_editmode [%d], b_searchmode [%d] ", mailbox_ugd->b_editmode, mailbox_ugd->b_searchmode); + if (view->b_searchmode || view->b_editmode) { + debug_log("Send all not needed: b_editmode [%d], b_searchmode [%d] ", view->b_editmode, view->b_searchmode); return; } - if (!mailbox_ugd->outbox_send_all_bar) { - mailbox_ugd->outbox_send_all_bar = elm_layout_add(mailbox_ugd->base.module->navi); - evas_object_show(mailbox_ugd->outbox_send_all_bar); - mailbox_ugd->outbox_send_all_btn = mailbox_create_toolbar_btn(mailbox_ugd->outbox_send_all_bar, _("IDS_EMAIL_BUTTON_SEND_ALL"), PACKAGE); - evas_object_smart_callback_add(mailbox_ugd->outbox_send_all_btn, "clicked", _send_outgoing_messages_clicked_cb, (void *)mailbox_ugd); + if (!view->outbox_send_all_bar) { + view->outbox_send_all_bar = elm_layout_add(view->base.module->navi); + evas_object_show(view->outbox_send_all_bar); + view->outbox_send_all_btn = mailbox_create_toolbar_btn(view->outbox_send_all_bar, _("IDS_EMAIL_BUTTON_SEND_ALL"), PACKAGE); + evas_object_smart_callback_add(view->outbox_send_all_btn, "clicked", _send_outgoing_messages_clicked_cb, (void *)view); - Eina_Bool is_disabled = elm_object_disabled_get(mailbox_ugd->outbox_send_all_btn); + Eina_Bool is_disabled = elm_object_disabled_get(view->outbox_send_all_btn); if (is_disabled) - elm_object_disabled_set(mailbox_ugd->outbox_send_all_btn, !is_disabled); + elm_object_disabled_set(view->outbox_send_all_btn, !is_disabled); - elm_layout_file_set(mailbox_ugd->outbox_send_all_bar, email_get_mailbox_theme_path(), "email/layout/send_all_bar"); - elm_layout_content_set(mailbox_ugd->outbox_send_all_bar, "send_all_bar_button", mailbox_ugd->outbox_send_all_btn); - elm_object_part_content_set(mailbox_ugd->content_layout, "send_all_bar", mailbox_ugd->outbox_send_all_bar); + elm_layout_file_set(view->outbox_send_all_bar, email_get_mailbox_theme_path(), "email/layout/send_all_bar"); + elm_layout_content_set(view->outbox_send_all_bar, "send_all_bar_button", view->outbox_send_all_btn); + elm_object_part_content_set(view->content_layout, "send_all_bar", view->outbox_send_all_bar); } debug_leave(); return; } -void mailbox_send_all_btn_remove(EmailMailboxUGD *mailbox_ugd) +void mailbox_send_all_btn_remove(EmailMailboxView *view) { debug_enter(); - if (mailbox_ugd->outbox_send_all_bar) { - elm_object_part_content_unset(mailbox_ugd->outbox_send_all_bar, "send_all_bar_button"); - DELETE_EVAS_OBJECT(mailbox_ugd->outbox_send_all_btn); - elm_object_part_content_unset(mailbox_ugd->content_layout, "send_all_bar"); - DELETE_EVAS_OBJECT(mailbox_ugd->outbox_send_all_bar); - mailbox_ugd->outbox_send_all_bar = NULL; + if (view->outbox_send_all_bar) { + elm_object_part_content_unset(view->outbox_send_all_bar, "send_all_bar_button"); + DELETE_EVAS_OBJECT(view->outbox_send_all_btn); + elm_object_part_content_unset(view->content_layout, "send_all_bar"); + DELETE_EVAS_OBJECT(view->outbox_send_all_bar); + view->outbox_send_all_bar = NULL; } debug_leave(); @@ -790,7 +790,7 @@ static void _select_all_item_clicked_cb(void *data, Evas_Object *obj, void *even { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; Elm_Object_Item *it = (Elm_Object_Item *)event_info; if (!event_info) { @@ -799,19 +799,19 @@ static void _select_all_item_clicked_cb(void *data, Evas_Object *obj, void *even } elm_genlist_item_selected_set((Elm_Object_Item *)it, EINA_FALSE); - if (mailbox_ugd->selectAll_chksel) { - mailbox_ugd->selectAll_chksel = EINA_FALSE; + if (view->selectAll_chksel) { + view->selectAll_chksel = EINA_FALSE; } else { - mailbox_ugd->selectAll_chksel = EINA_TRUE; + view->selectAll_chksel = EINA_TRUE; } _select_all_item_check_changed_cb(data, NULL, event_info); } -void mailbox_select_all_item_add(EmailMailboxUGD *mailbox_ugd) +void mailbox_select_all_item_add(EmailMailboxView *view) { debug_enter(); - mailbox_select_all_item_remove(mailbox_ugd); + mailbox_select_all_item_remove(view); itc_select_all.item_style = "group_index"; itc_select_all.func.text_get = _select_all_item_gl_text_get; @@ -821,31 +821,31 @@ void mailbox_select_all_item_add(EmailMailboxUGD *mailbox_ugd) itc_select_all.decorate_all_item_style = NULL; Evas_Coord scroll_x = 0, scroll_y = 0, scroll_w = 0, scroll_h = 0; - elm_scroller_region_get(mailbox_ugd->gl, &scroll_x, &scroll_y, &scroll_w, &scroll_h); + elm_scroller_region_get(view->gl, &scroll_x, &scroll_y, &scroll_w, &scroll_h); debug_log("scroll_x : %d scroll_y : %d scroll_w : %d scroll_h : %d", scroll_x, scroll_y, scroll_w, scroll_h); - mailbox_ugd->select_all_item = elm_genlist_item_insert_before(mailbox_ugd->gl, + view->select_all_item = elm_genlist_item_insert_before(view->gl, &itc_select_all, - mailbox_ugd, + view, NULL, - elm_genlist_first_item_get(mailbox_ugd->gl), + elm_genlist_first_item_get(view->gl), ELM_GENLIST_ITEM_NONE, _select_all_item_clicked_cb, - mailbox_ugd); + view); - if (scroll_y <= 0 || (mailbox_ugd->last_updated_time_item && scroll_y <= GROUP_INDEX_LIST_ITEM_HEIGHT)) { - elm_genlist_item_show(mailbox_ugd->select_all_item, ELM_GENLIST_ITEM_SCROLLTO_TOP); + if (scroll_y <= 0 || (view->last_updated_time_item && scroll_y <= GROUP_INDEX_LIST_ITEM_HEIGHT)) { + elm_genlist_item_show(view->select_all_item, ELM_GENLIST_ITEM_SCROLLTO_TOP); } debug_leave(); } -void mailbox_select_all_item_remove(EmailMailboxUGD *mailbox_ugd) +void mailbox_select_all_item_remove(EmailMailboxView *view) { debug_enter(); - if (mailbox_ugd && mailbox_ugd->select_all_item) { - elm_object_item_del(mailbox_ugd->select_all_item); - mailbox_ugd->select_all_item = NULL; + if (view && view->select_all_item) { + elm_object_item_del(view->select_all_item); + view->select_all_item = NULL; debug_log("select_all_item is removed"); } } @@ -860,16 +860,16 @@ static char *_no_more_emails_gl_text_get(void *data, Evas_Object *obj, const cha return NULL; } -void mailbox_no_more_emails_item_add(EmailMailboxUGD *mailbox_ugd) +void mailbox_no_more_emails_item_add(EmailMailboxView *view) { debug_enter(); - if (mailbox_ugd->no_more_emails_item) { + if (view->no_more_emails_item) { debug_log("no_more_emails_item item already exist."); return; } - if (mailbox_ugd->b_editmode) { + if (view->b_editmode) { debug_log("In case of edit mode, no_more_emails_item item is not needed."); return; } @@ -881,24 +881,24 @@ void mailbox_no_more_emails_item_add(EmailMailboxUGD *mailbox_ugd) itc_no_more_emails.func.del = NULL; itc_no_more_emails.decorate_all_item_style = NULL; - mailbox_ugd->no_more_emails_item = elm_genlist_item_append(mailbox_ugd->gl, + view->no_more_emails_item = elm_genlist_item_append(view->gl, &itc_no_more_emails, - mailbox_ugd, + view, NULL, ELM_GENLIST_ITEM_NONE, - NULL, mailbox_ugd); + NULL, view); - elm_genlist_item_select_mode_set(mailbox_ugd->no_more_emails_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + elm_genlist_item_select_mode_set(view->no_more_emails_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); debug_leave(); } -void mailbox_no_more_emails_item_remove(EmailMailboxUGD *mailbox_ugd) +void mailbox_no_more_emails_item_remove(EmailMailboxView *view) { debug_enter(); - if (mailbox_ugd->no_more_emails_item) { - elm_object_item_del(mailbox_ugd->no_more_emails_item); - mailbox_ugd->no_more_emails_item = NULL; + if (view->no_more_emails_item) { + elm_object_item_del(view->no_more_emails_item); + view->no_more_emails_item = NULL; } } diff --git a/Project-Files/modules/mailbox/src/email-mailbox-list.c b/Project-Files/modules/mailbox/src/email-mailbox-list.c index bbed9f1..2f0f9d3 100644 --- a/Project-Files/modules/mailbox/src/email-mailbox-list.c +++ b/Project-Files/modules/mailbox/src/email-mailbox-list.c @@ -31,7 +31,7 @@ #include "email-mailbox-noti-mgr.h" #include "email-mailbox-request.h" #include "email-mailbox-title.h" -#include "email-mailbox-ug-util.h" +#include "email-mailbox-module-util.h" #include "email-mailbox-util.h" #include "email-mailbox-more-menu.h" @@ -84,18 +84,18 @@ static void _mail_item_important_status_changed_cb(void *data, Evas_Object *obj, static void _mail_item_data_insert_search_tag(char *dest, int dest_len, const char *src, const char *key); static void _mail_item_data_list_free(GList **mail_item_data_list); -static void _mail_item_class_update(EmailMailboxUGD *mailbox_ugd); +static void _mail_item_class_update(EmailMailboxView *view); static void _mailbox_star_ly_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _mailbox_select_checkbox_ly_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); /* insert mail item data into list */ -static void _insert_mail_item_to_list(EmailMailboxUGD *mailbox_ugd, MailItemData *ld); -static void _insert_mail_item_to_list_from_noti(EmailMailboxUGD *mailbox_ugd, MailItemData *ld, MailItemData *prev, MailItemData *next); +static void _insert_mail_item_to_list(EmailMailboxView *view, MailItemData *ld); +static void _insert_mail_item_to_list_from_noti(EmailMailboxView *view, MailItemData *ld, MailItemData *prev, MailItemData *next); static gint _compare_mail_item_order(gconstpointer a, gconstpointer b); /* get mail list */ -static email_mail_list_item_t *_mailbox_get_mail_list(EmailMailboxUGD *mailbox_ugd, const email_search_data_t *search_data, int *mail_count); +static email_mail_list_item_t *_mailbox_get_mail_list(EmailMailboxView *view, const email_search_data_t *search_data, int *mail_count); static email_mail_list_item_t *_mailbox_get_mail_list_by_mailbox_id(int account_id, int mailbox_id, int sort_type, int thread_id, const email_search_data_t *search_data, int *mail_count); static email_mail_list_item_t *_mailbox_get_mail_list_by_mailbox_type(int account_id, int mailbox_type, int sort_type, int thread_id, const email_search_data_t *search_data, int *mail_count); static email_mail_list_item_t *_mailbox_get_priority_sender_mail_list(int sort_type, int thread_id, const email_search_data_t *search_data, int *mail_count); @@ -106,10 +106,10 @@ static void _add_search_data_into_filter_list(const email_search_data_t *search_ static void _make_sorting_rule_list(email_sort_type_e sort_type, int account_id, email_list_sorting_rule_t *sorting_rule_list); /* mail list */ -static void _mailbox_make_list(EmailMailboxUGD *mailbox_ugd, const email_search_data_t *search_data); -static void _mailbox_make_remaining_items(EmailMailboxUGD *mailbox_ugd, const email_search_data_t *search_data, +static void _mailbox_make_list(EmailMailboxView *view, const email_search_data_t *search_data); +static void _mailbox_make_remaining_items(EmailMailboxView *view, const email_search_data_t *search_data, email_mail_list_item_t *mail_list, int mail_count); -static void _mailbox_clear_list(EmailMailboxUGD *mailbox_ugd); +static void _mailbox_clear_list(EmailMailboxView *view); static void _mailbox_free_req_data(AddRemainingMailReqData **req); static email_search_data_t *_clone_search_data(const email_search_data_t *search_data); @@ -126,7 +126,7 @@ static void _mailbox_check_cache_init(EmailMailboxCheckCache *cache, const char static void _mailbox_check_cache_free(EmailMailboxCheckCache *cache); static Evas_Object *_mailbox_check_cache_get_obj(EmailMailboxCheckCache *cache, Evas_Object *parent); static void _mailbox_check_cache_release_obj(EmailMailboxCheckCache *cache, Evas_Object *obj); -static void _mailbox_list_insert_n_mails(EmailMailboxUGD *mailbox_ugd, email_mail_list_item_t* mail_list, int count, const email_search_data_t *search_data); +static void _mailbox_list_insert_n_mails(EmailMailboxView *view, email_mail_list_item_t* mail_list, int count, const email_search_data_t *search_data); /* * Definition for static functions */ @@ -179,10 +179,10 @@ static void _pressed_item_cb(void *data, Evas_Object *obj, void *event_info) static void _mailbox_gl_free_cb(void *data, Evas *e, Evas_Object *o, void *info) { - EmailMailboxUGD *mailbox_ugd = data; + EmailMailboxView *view = data; - _mailbox_check_cache_free(&mailbox_ugd->star_check_cache); - _mailbox_check_cache_free(&mailbox_ugd->select_check_cache); + _mailbox_check_cache_free(&view->star_check_cache); + _mailbox_check_cache_free(&view->select_check_cache); } static Evas_Object *_mail_item_gl_account_colorbar_add(Evas_Object *parent, MailItemData *ld) @@ -193,7 +193,7 @@ static Evas_Object *_mail_item_gl_account_colorbar_add(Evas_Object *parent, Mail Evas_Object *account_colorbar = evas_object_rectangle_add(evas_object_evas_get(parent)); evas_object_size_hint_fill_set(account_colorbar, EVAS_HINT_FILL, EVAS_HINT_FILL); - int account_color = mailbox_account_color_list_get_account_color(ld->mailbox_ugd, ld->account_id); + int account_color = mailbox_account_color_list_get_account_color(ld->view, ld->account_id); int r = R_MASKING(account_color); int g = G_MASKING(account_color); int b = B_MASKING(account_color); @@ -213,7 +213,7 @@ static Evas_Object *_mail_item_gl_select_checkbox_add(Evas_Object *parent, MailI evas_object_size_hint_weight_set(select_checkbox_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_layout_file_set(select_checkbox_ly, email_get_mailbox_theme_path(), "email/layout/select.icon"); - Evas_Object *select_checkbox = _mailbox_check_cache_get_obj(&ld->mailbox_ugd->select_check_cache, parent); + Evas_Object *select_checkbox = _mailbox_check_cache_get_obj(&ld->view->select_check_cache, parent); elm_check_state_set(select_checkbox, ld->checked); evas_object_smart_callback_add(select_checkbox, "changed", _mail_item_check_changed_cb, ld); @@ -236,7 +236,7 @@ static Evas_Object *_mail_item_gl_star_checkbox_add(Evas_Object *parent, MailIte evas_object_size_hint_weight_set(star_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_layout_file_set(star_ly, email_get_mailbox_theme_path(), "email/layout/star.icon"); - Evas_Object *star_checkbox = _mailbox_check_cache_get_obj(&ld->mailbox_ugd->star_check_cache, parent); + Evas_Object *star_checkbox = _mailbox_check_cache_get_obj(&ld->view->star_check_cache, parent); if (ld->flag_type == EMAIL_FLAG_FLAGED) { elm_check_state_set(star_checkbox, EINA_TRUE); @@ -244,7 +244,7 @@ static Evas_Object *_mail_item_gl_star_checkbox_add(Evas_Object *parent, MailIte elm_check_state_set(star_checkbox, EINA_FALSE); } - if (!ld->mailbox_ugd->b_editmode) { + if (!ld->view->b_editmode) { evas_object_freeze_events_set(star_checkbox, EINA_FALSE); evas_object_smart_callback_add(star_checkbox, "changed", _mail_item_important_status_changed_cb, ld); } else { @@ -370,8 +370,8 @@ static char *_mail_item_gl_text_get(void *data, Evas_Object *obj, const char *pa retvm_if(!data, NULL, "data is NULL"); MailItemData *ld = (MailItemData *)data; - EmailMailboxUGD *mailbox_ugd = ld->mailbox_ugd; - retvm_if(!mailbox_ugd, NULL, "mailbox_ugd is NULL"); + EmailMailboxView *view = ld->view; + retvm_if(!view, NULL, "view is NULL"); if (!strcmp(part, "email.data.text")) { return _mail_item_gl_time_stamp_text_add(ld); @@ -390,29 +390,29 @@ static Evas_Object *_mail_item_gl_content_get(void *data, Evas_Object *obj, cons retvm_if(!data, NULL, "data is NULL"); MailItemData *ld = (MailItemData *)data; - EmailMailboxUGD *mailbox_ugd = ld->mailbox_ugd; - retvm_if(!mailbox_ugd, NULL, "mailbox_ugd is NULL"); + EmailMailboxView *view = ld->view; + retvm_if(!view, NULL, "view is NULL"); - if (!strcmp(part, "select_checkbox_icon") && (mailbox_ugd->b_editmode == true)) { + if (!strcmp(part, "select_checkbox_icon") && (view->b_editmode == true)) { return _mail_item_gl_select_checkbox_add(obj, ld); } - if (!strcmp(part, "account_colorbar") && mailbox_ugd && ld->account_id > 0 && mailbox_ugd->account_count > 1 && (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL + if (!strcmp(part, "account_colorbar") && view && ld->account_id > 0 && view->account_count > 1 && (view->mode == EMAIL_MAILBOX_MODE_ALL #ifndef _FEATURE_PRIORITY_SENDER_DISABLE_ - || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER + || view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER #endif )) { return _mail_item_gl_account_colorbar_add(obj, ld); } - if (!strcmp(part, "email.star.icon") && (mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX && ld->mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_DRAFT)) { + if (!strcmp(part, "email.star.icon") && (view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX && ld->view->mailbox_type != EMAIL_MAILBOX_TYPE_DRAFT)) { return _mail_item_gl_star_checkbox_add(obj, ld); } - if (!strcmp(part, "email.status.icon") && (ld->reply_flag || ld->forward_flag || (ld->is_priority_sender_mail && (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL - || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX + if (!strcmp(part, "email.status.icon") && (ld->reply_flag || ld->forward_flag || (ld->is_priority_sender_mail && (view->mode == EMAIL_MAILBOX_MODE_ALL + || view->mode == EMAIL_MAILBOX_MODE_MAILBOX #ifndef _FEATURE_PRIORITY_SENDER_DISABLE_ - || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER + || view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER #endif )))) { return _mail_item_gl_status_icons_add(obj, ld); @@ -434,15 +434,15 @@ static void _mail_item_gl_selected_cb(void *data, Evas_Object *obj, void *event_ MailItemData *ld = elm_object_item_data_get(it); retm_if(!ld, "ld is NULL"); - retm_if(!ld->mailbox_ugd, "ld->mailbox_ugd == NULL"); + retm_if(!ld->view, "ld->view == NULL"); elm_genlist_item_selected_set((Elm_Object_Item *)it, EINA_FALSE); - if (ld->mailbox_ugd->b_editmode) { + if (ld->view->b_editmode) { _mail_item_check_changed_cb(ld, obj, NULL); return; } - DELETE_EVAS_OBJECT(ld->mailbox_ugd->more_ctxpopup); + DELETE_EVAS_OBJECT(ld->view->more_ctxpopup); - mailbox_sync_cancel_all(ld->mailbox_ugd); + mailbox_sync_cancel_all(ld->view); int id = ld->mail_id; email_mailbox_t *mbox = NULL; int e = email_get_mailbox_by_mailbox_id(ld->mailbox_id, &mbox); @@ -453,8 +453,8 @@ static void _mail_item_gl_selected_cb(void *data, Evas_Object *obj, void *event_ } if (mbox->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT && email_engine_check_body_download(ld->mail_id)) { - if (ld->mailbox_ugd->composer) { - debug_log("Composer UG is already launched"); + if (ld->view->composer) { + debug_log("Composer module is already launched"); return; } @@ -466,7 +466,7 @@ static void _mail_item_gl_selected_cb(void *data, Evas_Object *obj, void *event_ email_params_add_int(params, EMAIL_BUNDLE_KEY_MAILBOX, ld->mailbox_id) && email_params_add_int(params, EMAIL_BUNDLE_KEY_MAIL_ID, id)) { - ld->mailbox_ugd->composer = mailbox_composer_module_create(ld->mailbox_ugd, EMAIL_MODULE_COMPOSER, params); + ld->view->composer = mailbox_composer_module_create(ld->view, EMAIL_MODULE_COMPOSER, params); } email_params_free(¶ms); @@ -504,54 +504,54 @@ static void _mail_item_check_process_change(MailItemData *ld) { debug_enter(); - EmailMailboxUGD *mailbox_ugd = ld->mailbox_ugd; + EmailMailboxView *view = ld->view; if (ld->checked) { - mailbox_ugd->selected_mail_list = eina_list_append(mailbox_ugd->selected_mail_list, ld); + view->selected_mail_list = eina_list_append(view->selected_mail_list, ld); } else { - mailbox_ugd->selected_mail_list = eina_list_remove(mailbox_ugd->selected_mail_list, ld); + view->selected_mail_list = eina_list_remove(view->selected_mail_list, ld); } - int cnt = eina_list_count(mailbox_ugd->selected_mail_list); + int cnt = eina_list_count(view->selected_mail_list); debug_log("list count = %d", cnt); - if (!mailbox_ugd->b_editmode) { + if (!view->b_editmode) { debug_log("Enter edit mode.[%d]", cnt); - if (cnt == 1 && !mailbox_ugd->b_editmode) { - debug_log("mailbox_ugd->selected_mail_list has something wrong.[%d]", cnt); - mailbox_ugd->selected_mail_list = eina_list_free(mailbox_ugd->selected_mail_list); - mailbox_ugd->selected_mail_list = NULL; + if (cnt == 1 && !view->b_editmode) { + debug_log("view->selected_mail_list has something wrong.[%d]", cnt); + view->selected_mail_list = eina_list_free(view->selected_mail_list); + view->selected_mail_list = NULL; if (ld->checked) { - mailbox_ugd->selected_mail_list = eina_list_append(mailbox_ugd->selected_mail_list, ld); + view->selected_mail_list = eina_list_append(view->selected_mail_list, ld); } } - mailbox_ugd->b_editmode = true; + view->b_editmode = true; - mailbox_sync_cancel_all(mailbox_ugd); - if ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL - || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { - mailbox_send_all_btn_remove(mailbox_ugd); + mailbox_sync_cancel_all(view); + if ((view->mode == EMAIL_MAILBOX_MODE_ALL + || view->mode == EMAIL_MAILBOX_MODE_MAILBOX) + && view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { + mailbox_send_all_btn_remove(view); } - mailbox_change_search_layout_state(mailbox_ugd, false); + mailbox_change_search_layout_state(view, false); - mailbox_create_select_info(mailbox_ugd); - mailbox_toolbar_create(mailbox_ugd); - } else if (true == mailbox_ugd->b_editmode) { + mailbox_create_select_info(view); + mailbox_toolbar_create(view); + } else if (true == view->b_editmode) { debug_log("Update edit mode"); - mailbox_update_select_info(mailbox_ugd); + mailbox_update_select_info(view); } /* Update Select All Checkbox */ - int checked_count = eina_list_count(mailbox_ugd->selected_mail_list); - int total_count = elm_genlist_items_count(mailbox_ugd->gl); + int checked_count = eina_list_count(view->selected_mail_list); + int total_count = elm_genlist_items_count(view->gl); if (checked_count == (total_count-1)) { - mailbox_ugd->selectAll_chksel = EINA_TRUE; - elm_check_state_set(mailbox_ugd->selectAll_check, mailbox_ugd->selectAll_chksel); - } else if (mailbox_ugd->selectAll_chksel) { - mailbox_ugd->selectAll_chksel = EINA_FALSE; - elm_check_state_set(mailbox_ugd->selectAll_check, mailbox_ugd->selectAll_chksel); + view->selectAll_chksel = EINA_TRUE; + elm_check_state_set(view->selectAll_check, view->selectAll_chksel); + } else if (view->selectAll_chksel) { + view->selectAll_chksel = EINA_FALSE; + elm_check_state_set(view->selectAll_check, view->selectAll_chksel); } } @@ -565,15 +565,15 @@ static void _mail_item_important_status_changed_cb(void *data, Evas_Object *obj, retm_if(!ld, "ld is NULL"); retm_if(!ld->check_favorite_btn, "ld->check_favorite_btn is NULL"); - ld->mailbox_ugd->important_list = g_list_prepend(ld->mailbox_ugd->important_list, + ld->view->important_list = g_list_prepend(ld->view->important_list, GINT_TO_POINTER(ld->mail_id)); count = 1; - if (ld->mailbox_ugd->important_list) { + if (ld->view->important_list) { int mail_ids[count]; memset(mail_ids, 0, sizeof(mail_ids)); int i = 0; - GList *cur = g_list_first(ld->mailbox_ugd->important_list); + GList *cur = g_list_first(ld->view->important_list); for ( ; i < count; ++i, cur = g_list_next(cur)) { mail_ids[i] = (int)(ptrdiff_t)g_list_nth_data(cur, 0); } @@ -583,8 +583,8 @@ static void _mail_item_important_status_changed_cb(void *data, Evas_Object *obj, debug_warning("_mail_item_important_status_changed_cb account_id(%d) count(%d)- err (%d)", ld->account_id, count, e); } - g_list_free(ld->mailbox_ugd->important_list); - ld->mailbox_ugd->important_list = NULL; + g_list_free(ld->view->important_list); + ld->view->important_list = NULL; } } @@ -646,16 +646,16 @@ static void _mail_item_data_list_free(GList **mail_item_data_list) *mail_item_data_list = NULL; } -static void _mail_item_class_update(EmailMailboxUGD *mailbox_ugd) +static void _mail_item_class_update(EmailMailboxView *view) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd is NULL"); + retm_if(!view, "view is NULL"); - mailbox_ugd->itc.item_style = "email_mailbox"; - mailbox_ugd->itc.func.text_get = _mail_item_gl_text_get; - mailbox_ugd->itc.func.content_get = _mail_item_gl_content_get; - mailbox_ugd->itc.func.state_get = NULL; - mailbox_ugd->itc.func.del = NULL; + view->itc.item_style = "email_mailbox"; + view->itc.func.text_get = _mail_item_gl_text_get; + view->itc.func.content_get = _mail_item_gl_content_get; + view->itc.func.state_get = NULL; + view->itc.func.del = NULL; debug_leave(); @@ -668,7 +668,7 @@ static void _mailbox_star_ly_del_cb(void *data, Evas *e, Evas_Object *obj, void evas_object_smart_callback_del(ld->check_favorite_btn, "changed", _mail_item_important_status_changed_cb); - _mailbox_check_cache_release_obj(&ld->mailbox_ugd->star_check_cache, ld->check_favorite_btn); + _mailbox_check_cache_release_obj(&ld->view->star_check_cache, ld->check_favorite_btn); ld->check_favorite_btn = NULL; } @@ -679,46 +679,46 @@ static void _mailbox_select_checkbox_ly_del_cb(void *data, Evas *e, Evas_Object evas_object_smart_callback_del(ld->check_btn, "changed", _mail_item_check_changed_cb); - _mailbox_check_cache_release_obj(&ld->mailbox_ugd->select_check_cache, ld->check_btn); + _mailbox_check_cache_release_obj(&ld->view->select_check_cache, ld->check_btn); ld->check_btn = NULL; } -static void _insert_mail_item_to_list(EmailMailboxUGD *mailbox_ugd, MailItemData *ld) +static void _insert_mail_item_to_list(EmailMailboxView *view, MailItemData *ld) { debug_enter(); /* insert normal item */ - if (mailbox_ugd->get_more_progress_item != NULL) { - ld->item = elm_genlist_item_insert_before(mailbox_ugd->gl, - &mailbox_ugd->itc, + if (view->get_more_progress_item != NULL) { + ld->item = elm_genlist_item_insert_before(view->gl, + &view->itc, ld, NULL, - mailbox_ugd->get_more_progress_item, + view->get_more_progress_item, ELM_GENLIST_ITEM_NONE, _mail_item_gl_selected_cb, NULL); - } else if (mailbox_ugd->load_more_messages_item != NULL) { - ld->item = elm_genlist_item_insert_before(mailbox_ugd->gl, - &mailbox_ugd->itc, + } else if (view->load_more_messages_item != NULL) { + ld->item = elm_genlist_item_insert_before(view->gl, + &view->itc, ld, NULL, - mailbox_ugd->load_more_messages_item, + view->load_more_messages_item, ELM_GENLIST_ITEM_NONE, _mail_item_gl_selected_cb, NULL); - } else if (mailbox_ugd->no_more_emails_item != NULL) { - ld->item = elm_genlist_item_insert_before(mailbox_ugd->gl, - &mailbox_ugd->itc, + } else if (view->no_more_emails_item != NULL) { + ld->item = elm_genlist_item_insert_before(view->gl, + &view->itc, ld, NULL, - mailbox_ugd->no_more_emails_item, + view->no_more_emails_item, ELM_GENLIST_ITEM_NONE, _mail_item_gl_selected_cb, NULL); } else { - ld->item = elm_genlist_item_append(mailbox_ugd->gl, - &mailbox_ugd->itc, + ld->item = elm_genlist_item_append(view->gl, + &view->itc, ld, NULL, ELM_GENLIST_ITEM_NONE, @@ -728,31 +728,31 @@ static void _insert_mail_item_to_list(EmailMailboxUGD *mailbox_ugd, MailItemData debug_leave(); } -static void _insert_mail_item_to_list_from_noti(EmailMailboxUGD *mailbox_ugd, MailItemData *ld, MailItemData *prev, MailItemData *next) +static void _insert_mail_item_to_list_from_noti(EmailMailboxView *view, MailItemData *ld, MailItemData *prev, MailItemData *next) { debug_enter(); debug_secure_trace("prev->title: [%s], next->title: [%s]", prev ? prev->title : "NULL", next ? next->title : "NULL"); if (!prev) { - if (mailbox_ugd->last_updated_time_item) { - ld->item = elm_genlist_item_insert_after(mailbox_ugd->gl, - &mailbox_ugd->itc, + if (view->last_updated_time_item) { + ld->item = elm_genlist_item_insert_after(view->gl, + &view->itc, ld, NULL, - mailbox_ugd->last_updated_time_item, + view->last_updated_time_item, ELM_GENLIST_ITEM_NONE, _mail_item_gl_selected_cb, NULL); - } else if (mailbox_ugd->select_all_item) { - ld->item = elm_genlist_item_insert_after(mailbox_ugd->gl, - &mailbox_ugd->itc, + } else if (view->select_all_item) { + ld->item = elm_genlist_item_insert_after(view->gl, + &view->itc, ld, NULL, - mailbox_ugd->select_all_item, + view->select_all_item, ELM_GENLIST_ITEM_NONE, _mail_item_gl_selected_cb, NULL); } else { - ld->item = elm_genlist_item_prepend(mailbox_ugd->gl, - &mailbox_ugd->itc, + ld->item = elm_genlist_item_prepend(view->gl, + &view->itc, ld, NULL, ELM_GENLIST_ITEM_NONE, @@ -762,8 +762,8 @@ static void _insert_mail_item_to_list_from_noti(EmailMailboxUGD *mailbox_ugd, Ma elm_genlist_item_show(ld->item, ELM_GENLIST_ITEM_SCROLLTO_TOP); } } else { - ld->item = elm_genlist_item_insert_after(mailbox_ugd->gl, - &mailbox_ugd->itc, + ld->item = elm_genlist_item_insert_after(view->gl, + &view->itc, ld, NULL, prev->item, @@ -780,9 +780,9 @@ gint _compare_mail_item_order(gconstpointer a, gconstpointer b) return 0; MailItemData *first_item = (MailItemData *)a; MailItemData *second_item = (MailItemData *)b; - EmailMailboxUGD *mailbox_ugd = first_item->mailbox_ugd; + EmailMailboxView *view = first_item->view; - int sort_type = mailbox_ugd->sort_type; + int sort_type = view->sort_type; switch (sort_type) { case EMAIL_SORT_DATE_RECENT: @@ -936,47 +936,47 @@ gint _compare_mail_item_order(gconstpointer a, gconstpointer b) return ret; } -static email_mail_list_item_t *_mailbox_get_mail_list(EmailMailboxUGD *mailbox_ugd, const email_search_data_t *search_data, int *mail_count) +static email_mail_list_item_t *_mailbox_get_mail_list(EmailMailboxView *view, const email_search_data_t *search_data, int *mail_count) { debug_enter(); email_mail_list_item_t *mail_data = NULL; int mailbox_type = EMAIL_MAILBOX_TYPE_NONE; - if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_NONE) + if (view->mailbox_type == EMAIL_MAILBOX_TYPE_NONE) mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; else - mailbox_type = mailbox_ugd->mailbox_type; + mailbox_type = view->mailbox_type; - if (mailbox_ugd->b_searchmode) { - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL) { + if (view->b_searchmode) { + if (view->mode == EMAIL_MAILBOX_MODE_ALL) { if (mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED) - mail_data = _mailbox_get_favourite_mail_list(mailbox_ugd->sort_type, EMAIL_GET_MAIL_NORMAL, search_data, mail_count); + mail_data = _mailbox_get_favourite_mail_list(view->sort_type, EMAIL_GET_MAIL_NORMAL, search_data, mail_count); else mail_data = _mailbox_get_mail_list_by_mailbox_type(0, mailbox_type, EMAIL_SORT_DATE_RECENT, EMAIL_GET_MAIL_NORMAL, search_data, mail_count); } #ifndef _FEATURE_PRIORITY_SENDER_DISABLE_ - else if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { + else if (view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { mail_data = _mailbox_get_priority_sender_mail_list(EMAIL_SORT_DATE_RECENT, EMAIL_GET_MAIL_NORMAL, search_data, mail_count); } #endif else { - mail_data = _mailbox_get_mail_list_by_mailbox_id(mailbox_ugd->account_id, mailbox_ugd->mailbox_id, EMAIL_SORT_DATE_RECENT, EMAIL_GET_MAIL_NORMAL, search_data, mail_count); + mail_data = _mailbox_get_mail_list_by_mailbox_id(view->account_id, view->mailbox_id, EMAIL_SORT_DATE_RECENT, EMAIL_GET_MAIL_NORMAL, search_data, mail_count); } } else { - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL) { + if (view->mode == EMAIL_MAILBOX_MODE_ALL) { if (mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED) - mail_data = _mailbox_get_favourite_mail_list(mailbox_ugd->sort_type, EMAIL_GET_MAIL_NORMAL, NULL, mail_count); + mail_data = _mailbox_get_favourite_mail_list(view->sort_type, EMAIL_GET_MAIL_NORMAL, NULL, mail_count); else - mail_data = _mailbox_get_mail_list_by_mailbox_type(0, mailbox_type, mailbox_ugd->sort_type, EMAIL_GET_MAIL_NORMAL, NULL, mail_count); + mail_data = _mailbox_get_mail_list_by_mailbox_type(0, mailbox_type, view->sort_type, EMAIL_GET_MAIL_NORMAL, NULL, mail_count); } #ifndef _FEATURE_PRIORITY_SENDER_DISABLE_ - else if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { - mail_data = _mailbox_get_priority_sender_mail_list(mailbox_ugd->sort_type, EMAIL_GET_MAIL_NORMAL, NULL, mail_count); + else if (view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { + mail_data = _mailbox_get_priority_sender_mail_list(view->sort_type, EMAIL_GET_MAIL_NORMAL, NULL, mail_count); } #endif else { - mail_data = _mailbox_get_mail_list_by_mailbox_id(mailbox_ugd->account_id, mailbox_ugd->mailbox_id, mailbox_ugd->sort_type, EMAIL_GET_MAIL_NORMAL, NULL, mail_count); + mail_data = _mailbox_get_mail_list_by_mailbox_id(view->account_id, view->mailbox_id, view->sort_type, EMAIL_GET_MAIL_NORMAL, NULL, mail_count); } } @@ -1728,39 +1728,39 @@ static void _make_sorting_rule_list(email_sort_type_e sort_type, int account_id, } } -static void _mailbox_make_list(EmailMailboxUGD *mailbox_ugd, const email_search_data_t *search_data) +static void _mailbox_make_list(EmailMailboxView *view, const email_search_data_t *search_data) { debug_enter(); email_mail_list_item_t *mail_list = NULL; int mail_count = 0; - debug_log("mode: %d, mailbox_type: %d", mailbox_ugd->mode, mailbox_ugd->mailbox_type); + debug_log("mode: %d, mailbox_type: %d", view->mode, view->mailbox_type); - mail_list = _mailbox_get_mail_list(mailbox_ugd, search_data, &mail_count); + mail_list = _mailbox_get_mail_list(view, search_data, &mail_count); if (mail_list) { /* Display last updated time for individual accounts */ - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX - && mailbox_ugd->only_local == FALSE && !mailbox_ugd->b_searchmode) { - mailbox_last_updated_time_item_add(mailbox_ugd, false); + if (view->mode == EMAIL_MAILBOX_MODE_MAILBOX + && view->only_local == FALSE && !view->b_searchmode) { + mailbox_last_updated_time_item_add(view, false); } - _mailbox_list_insert_n_mails(mailbox_ugd, mail_list, MIN(mail_count, FIRST_BLOCK_SIZE), search_data); + _mailbox_list_insert_n_mails(view, mail_list, MIN(mail_count, FIRST_BLOCK_SIZE), search_data); debug_log("COUNT: %d", mail_count); /* add remaining items */ - _mailbox_make_remaining_items(mailbox_ugd, search_data, mail_list, mail_count); + _mailbox_make_remaining_items(view, search_data, mail_list, mail_count); - if (mailbox_ugd->b_searchmode) { - mailbox_hide_no_contents_view(mailbox_ugd); + if (view->b_searchmode) { + mailbox_hide_no_contents_view(view); } else { - if ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX && mail_count > 0) { + if ((view->mode == EMAIL_MAILBOX_MODE_ALL || view->mode == EMAIL_MAILBOX_MODE_MAILBOX) + && view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX && mail_count > 0) { bool sending_mail_exist = false; GList *cur = NULL; MailItemData *ld = NULL; - G_LIST_FOREACH(mailbox_ugd->mail_list, cur, ld) { + G_LIST_FOREACH(view->mail_list, cur, ld) { if (ld->mail_status == EMAIL_MAIL_STATUS_SENDING) { sending_mail_exist = true; break; @@ -1768,42 +1768,42 @@ static void _mailbox_make_list(EmailMailboxUGD *mailbox_ugd, const email_search_ } if (!sending_mail_exist) { - mailbox_send_all_btn_add(mailbox_ugd); + mailbox_send_all_btn_add(view); } } - if ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_IMAP4) - || (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_POP3)) { + if ((view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX + && view->account_type == EMAIL_SERVER_TYPE_IMAP4) + || (view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX + && view->account_type == EMAIL_SERVER_TYPE_POP3)) { /* since there is a delay in receiving noti from email-service,creating more progress item directly. */ - mailbox_load_more_messages_item_add(mailbox_ugd); - } else if (mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { - mailbox_no_more_emails_item_add(mailbox_ugd); + mailbox_load_more_messages_item_add(view); + } else if (view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { + mailbox_no_more_emails_item_add(view); } - mailbox_hide_no_contents_view(mailbox_ugd); + mailbox_hide_no_contents_view(view); } - mailbox_ugd->b_edge_bottom = false; - mailbox_ugd->b_enable_get_more = true; + view->b_edge_bottom = false; + view->b_enable_get_more = true; } else { debug_log("no email exists."); - if (mailbox_ugd->b_searchmode) { - mailbox_show_no_contents_view(mailbox_ugd); + if (view->b_searchmode) { + mailbox_show_no_contents_view(view); } else { - if (mailbox_ugd->b_editmode) - mailbox_exit_edit_mode(mailbox_ugd); - mailbox_show_no_contents_view(mailbox_ugd); + if (view->b_editmode) + mailbox_exit_edit_mode(view); + mailbox_show_no_contents_view(view); } } debug_leave(); } -static void _mailbox_make_remaining_items(EmailMailboxUGD *mailbox_ugd, const email_search_data_t *search_data, +static void _mailbox_make_remaining_items(EmailMailboxView *view, const email_search_data_t *search_data, email_mail_list_item_t *mail_list, int mail_count) { debug_enter(); @@ -1816,7 +1816,7 @@ static void _mailbox_make_remaining_items(EmailMailboxUGD *mailbox_ugd, const em break; } - if (mailbox_ugd->b_searchmode && search_data) + if (view->b_searchmode && search_data) { search_data_clone = _clone_search_data(search_data); if (!search_data_clone) { @@ -1832,13 +1832,13 @@ static void _mailbox_make_remaining_items(EmailMailboxUGD *mailbox_ugd, const em } *req = (AddRemainingMailReqData) {mail_list, FIRST_BLOCK_SIZE, mail_count, - search_data_clone, mailbox_ugd}; + search_data_clone, view}; - if (mailbox_ugd->base.state != EV_STATE_ACTIVE) { + if (view->base.state != EV_STATE_ACTIVE) { debug_log("wait for active state..."); - mailbox_ugd->remaining_req = req; + view->remaining_req = req; } else { - mailbox_list_make_remaining_items_in_thread(mailbox_ugd, req); + mailbox_list_make_remaining_items_in_thread(view, req); } return; @@ -1851,38 +1851,38 @@ static void _mailbox_make_remaining_items(EmailMailboxUGD *mailbox_ugd, const em debug_leave(); } -static void _mailbox_clear_list(EmailMailboxUGD *mailbox_ugd) +static void _mailbox_clear_list(EmailMailboxView *view) { debug_enter(); - if (mailbox_ugd == NULL) { - debug_warning("mailbox_ugd is NULL"); + if (view == NULL) { + debug_warning("view is NULL"); return; } - debug_log("mailbox_ugd->mail_list[%p]", mailbox_ugd->mail_list); + debug_log("view->mail_list[%p]", view->mail_list); - mailbox_cancel_all_requests(mailbox_ugd); + mailbox_cancel_all_requests(view); - if (mailbox_ugd->b_editmode) - mailbox_exit_edit_mode(mailbox_ugd); + if (view->b_editmode) + mailbox_exit_edit_mode(view); - mailbox_get_more_progress_item_remove(mailbox_ugd); - mailbox_load_more_messages_item_remove(mailbox_ugd); - mailbox_no_more_emails_item_remove(mailbox_ugd); - mailbox_send_all_btn_remove(mailbox_ugd); + mailbox_get_more_progress_item_remove(view); + mailbox_load_more_messages_item_remove(view); + mailbox_no_more_emails_item_remove(view); + mailbox_send_all_btn_remove(view); - debug_log("mailbox_ugd->gl: 0x%x", mailbox_ugd->gl); - if (mailbox_ugd->gl) { - elm_genlist_clear(mailbox_ugd->gl); + debug_log("view->gl: 0x%x", view->gl); + if (view->gl) { + elm_genlist_clear(view->gl); } else { - debug_warning("mailbox_ugd->gl is null"); + debug_warning("view->gl is null"); return; } - mailbox_list_free_all_item_data(mailbox_ugd); + mailbox_list_free_all_item_data(view); - mailbox_ugd->last_updated_time_item = NULL; + view->last_updated_time_item = NULL; debug_leave(); } @@ -1925,9 +1925,9 @@ static void _mailbox_system_font_change_cb(system_settings_key_e key, void *data debug_enter(); retm_if(!data, "data si NULL"); - EmailMailboxUGD *mailbox_ugd = data; + EmailMailboxView *view = data; - mailbox_refresh_fullview(mailbox_ugd, true); + mailbox_refresh_fullview(view, true); } static char *_mailbox_get_ricipient_display_string(int mail_id) @@ -2045,20 +2045,20 @@ static void _mailbox_get_recipient_display_information(const gchar *addr_list, c } -static void _mailbox_list_insert_n_mails(EmailMailboxUGD *mailbox_ugd, email_mail_list_item_t *mail_list, int count, const email_search_data_t *search_data) +static void _mailbox_list_insert_n_mails(EmailMailboxView *view, email_mail_list_item_t *mail_list, int count, const email_search_data_t *search_data) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd is NULL"); + retm_if(!view, "view is NULL"); retm_if(!mail_list, "mail_list is NULL"); int i = 0; for (; i < count; i++) { - MailItemData *ld = mailbox_list_make_mail_item_data(mail_list + i, search_data, mailbox_ugd); + MailItemData *ld = mailbox_list_make_mail_item_data(mail_list + i, search_data, view); if (!ld) { continue; } - mailbox_list_insert_mail_item(ld, mailbox_ugd); + mailbox_list_insert_mail_item(ld, view); } } @@ -2067,29 +2067,29 @@ static void _mailbox_list_insert_n_mails(EmailMailboxUGD *mailbox_ugd, email_mai * Definition for exported functions */ -void mailbox_list_create_view(EmailMailboxUGD *mailbox_ugd) +void mailbox_list_create_view(EmailMailboxView *view) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd is NULL"); - debug_log("mailbox_type[%d]", mailbox_ugd->mailbox_type); + retm_if(!view, "view is NULL"); + debug_log("mailbox_type[%d]", view->mailbox_type); - if (mailbox_ugd->gl) { - elm_genlist_clear(mailbox_ugd->gl); - evas_object_del(mailbox_ugd->gl); - mailbox_ugd->gl = NULL; + if (view->gl) { + elm_genlist_clear(view->gl); + evas_object_del(view->gl); + view->gl = NULL; } - _mail_item_class_update(mailbox_ugd); + _mail_item_class_update(view); - Evas_Object *gl = elm_genlist_add(mailbox_ugd->content_layout); - if (mailbox_ugd->theme) { - elm_object_theme_set(gl, mailbox_ugd->theme); + Evas_Object *gl = elm_genlist_add(view->content_layout); + if (view->theme) { + elm_object_theme_set(gl, view->theme); } debug_log("genlist = %p", gl); - evas_object_smart_callback_add(gl, "realized", _realized_item_cb, mailbox_ugd); - evas_object_smart_callback_add(gl, "unhighlighted", _realized_item_cb, mailbox_ugd); - evas_object_smart_callback_add(gl, "highlighted", _pressed_item_cb, mailbox_ugd); + evas_object_smart_callback_add(gl, "realized", _realized_item_cb, view); + evas_object_smart_callback_add(gl, "unhighlighted", _realized_item_cb, view); + evas_object_smart_callback_add(gl, "highlighted", _pressed_item_cb, view); elm_scroller_policy_set(gl, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); elm_genlist_block_count_set(gl, BLOCK_COUNT); @@ -2100,18 +2100,18 @@ void mailbox_list_create_view(EmailMailboxUGD *mailbox_ugd) evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(gl); - mailbox_ugd->gl = gl; + view->gl = gl; - mailbox_ugd->selected_mail_list = eina_list_free(mailbox_ugd->selected_mail_list); - mailbox_ugd->selected_group_list = eina_list_free(mailbox_ugd->selected_group_list); - mailbox_refresh_flicks_cb_register(mailbox_ugd); + view->selected_mail_list = eina_list_free(view->selected_mail_list); + view->selected_group_list = eina_list_free(view->selected_group_list); + mailbox_refresh_flicks_cb_register(view); - _mailbox_check_cache_init(&mailbox_ugd->star_check_cache, "favorite"); - _mailbox_check_cache_init(&mailbox_ugd->select_check_cache, "default"); + _mailbox_check_cache_init(&view->star_check_cache, "favorite"); + _mailbox_check_cache_init(&view->select_check_cache, "default"); evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_DOWN, mailbox_set_main_thread_busy_cb, NULL); evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_UP, mailbox_reset_main_thread_busy_cb, NULL); - evas_object_event_callback_add(gl, EVAS_CALLBACK_FREE, _mailbox_gl_free_cb, mailbox_ugd); + evas_object_event_callback_add(gl, EVAS_CALLBACK_FREE, _mailbox_gl_free_cb, view); return; } @@ -2122,18 +2122,18 @@ void mailbox_list_open_email_viewer(MailItemData *ld) retm_if(!ld, "ld == NULL"); retm_if(ld->mail_id <= 0, "mail_id(%d) <= 0", ld->mail_id); - EmailMailboxUGD *mailbox_ugd = ld->mailbox_ugd; - retm_if(!mailbox_ugd, "mailbox_ugd == NULL"); + EmailMailboxView *view = ld->view; + retm_if(!view, "view == NULL"); - mailbox_open_email_viewer(mailbox_ugd, ld->account_id, ld->mailbox_id, ld->mail_id); + mailbox_open_email_viewer(view, ld->account_id, ld->mailbox_id, ld->mail_id); } -void mailbox_list_system_settings_callback_register(EmailMailboxUGD *mailbox_ugd) +void mailbox_list_system_settings_callback_register(EmailMailboxView *view) { debug_enter(); int ret = -1; - ret = email_register_accessibility_font_size_changed_callback(_mailbox_system_font_change_cb, mailbox_ugd); + ret = email_register_accessibility_font_size_changed_callback(_mailbox_system_font_change_cb, view); if (ret == -1) debug_error("email_register_accessibility_font_size_changed_callback failed"); @@ -2149,42 +2149,42 @@ void mailbox_list_system_settings_callback_unregister() debug_error("email_unregister_accessibility_font_size_changed_callback failed"); } -void mailbox_list_refresh(EmailMailboxUGD *mailbox_ugd, const email_search_data_t *search_data) +void mailbox_list_refresh(EmailMailboxView *view, const email_search_data_t *search_data) { debug_enter(); - _mailbox_clear_list(mailbox_ugd); - _mailbox_make_list(mailbox_ugd, search_data); + _mailbox_clear_list(view); + _mailbox_make_list(view, search_data); debug_leave(); } -void mailbox_list_insert_mail_item(MailItemData *ld, EmailMailboxUGD *mailbox_ugd) +void mailbox_list_insert_mail_item(MailItemData *ld, EmailMailboxView *view) { debug_enter(); - ld->mailbox_ugd = mailbox_ugd; - mailbox_ugd->mail_list = g_list_append(mailbox_ugd->mail_list, ld); + ld->view = view; + view->mail_list = g_list_append(view->mail_list, ld); - _insert_mail_item_to_list(mailbox_ugd, ld); + _insert_mail_item_to_list(view, ld); } -void mailbox_list_insert_mail_item_from_noti(MailItemData **ld_ptr, EmailMailboxUGD *mailbox_ugd) +void mailbox_list_insert_mail_item_from_noti(MailItemData **ld_ptr, EmailMailboxView *view) { debug_enter(); if (*ld_ptr == NULL) return; MailItemData *ld = *ld_ptr; /* ld variable used for better readability. */ - ld->mailbox_ugd = mailbox_ugd; + ld->view = view; - if (mailbox_list_get_mail_item_data_by_mailid(ld->mail_id, mailbox_ugd->mail_list)) { + if (mailbox_list_get_mail_item_data_by_mailid(ld->mail_id, view->mail_list)) { debug_log("this mail(%d) is already inserted in the current list.", ld->mail_id); mailbox_list_free_mail_item_data(ld); *ld_ptr = NULL; /* *ld_ptr should be assigned to NULL as mailbox_list_free_mail_item_data frees the memory that *ld_ptr holds*/ return; } - if (mailbox_ugd->b_searchmode) { - if (mailbox_check_searched_mail(ld->mail_id, mailbox_ugd)) { + if (view->b_searchmode) { + if (mailbox_check_searched_mail(ld->mail_id, view)) { debug_log("While searching, mail is inserted."); } else { mailbox_list_free_mail_item_data(ld); @@ -2194,9 +2194,9 @@ void mailbox_list_insert_mail_item_from_noti(MailItemData **ld_ptr, EmailMailbox } } - mailbox_ugd->mail_list = g_list_insert_sorted(mailbox_ugd->mail_list, ld, _compare_mail_item_order); + view->mail_list = g_list_insert_sorted(view->mail_list, ld, _compare_mail_item_order); - GList *cur = g_list_find(mailbox_ugd->mail_list, ld); + GList *cur = g_list_find(view->mail_list, ld); retm_if(!cur, "No such ld"); GList *prev = g_list_previous(cur); @@ -2204,11 +2204,11 @@ void mailbox_list_insert_mail_item_from_noti(MailItemData **ld_ptr, EmailMailbox GList *next = g_list_next(cur); MailItemData *next_data = next ? g_list_nth_data(next, 0) : NULL; - _insert_mail_item_to_list_from_noti(mailbox_ugd, ld, prev_data, next_data); + _insert_mail_item_to_list_from_noti(view, ld, prev_data, next_data); } -void mailbox_list_remove_mail_item(EmailMailboxUGD *mailbox_ugd, MailItemData *ld) +void mailbox_list_remove_mail_item(EmailMailboxView *view, MailItemData *ld) { debug_enter(); if (ld == NULL || ld->item == NULL) { @@ -2217,17 +2217,17 @@ void mailbox_list_remove_mail_item(EmailMailboxUGD *mailbox_ugd, MailItemData *l } elm_object_item_del(ld->item); - mailbox_ugd->mail_list = g_list_remove(mailbox_ugd->mail_list, ld); + view->mail_list = g_list_remove(view->mail_list, ld); - if (mailbox_ugd->selected_mail_list) { - mailbox_ugd->selected_mail_list = eina_list_remove(mailbox_ugd->selected_mail_list, ld); - debug_log("Remove from mailbox_ugd->selected_mail_list, ld->mail_id : %d", ld->mail_id); + if (view->selected_mail_list) { + view->selected_mail_list = eina_list_remove(view->selected_mail_list, ld); + debug_log("Remove from view->selected_mail_list, ld->mail_id : %d", ld->mail_id); } mailbox_list_free_mail_item_data(ld); } -MailItemData *mailbox_list_make_mail_item_data(email_mail_list_item_t *mail_info, const email_search_data_t *search_data, EmailMailboxUGD *mailbox_ugd) +MailItemData *mailbox_list_make_mail_item_data(email_mail_list_item_t *mail_info, const email_search_data_t *search_data, EmailMailboxView *view) { retvm_if(!mail_info, NULL, "mail_info is NULL"); @@ -2254,7 +2254,7 @@ MailItemData *mailbox_list_make_mail_item_data(email_mail_list_item_t *mail_info ld->mailbox_type = mail_info->mailbox_type; ld->reply_flag = mail_info->flags_answered_field; ld->forward_flag = mail_info->flags_forwarded_field; - ld->mailbox_ugd = mailbox_ugd; + ld->view = view; ld->checked = EINA_FALSE; ld->is_highlited = EINA_FALSE; @@ -2273,7 +2273,7 @@ MailItemData *mailbox_list_make_mail_item_data(email_mail_list_item_t *mail_info char *_subject = elm_entry_utf8_to_markup(buf); int title_len = STR_LEN(_subject); ld->title = MEM_ALLOC_STR(title_len + TAG_LEN + 1); - if (mailbox_ugd->b_searchmode && search_data && STR_VALID(search_data->subject)) { + if (view->b_searchmode && search_data && STR_VALID(search_data->subject)) { char *_search_subject = elm_entry_utf8_to_markup(search_data->subject); _mail_item_data_insert_search_tag(ld->title, title_len + TAG_LEN, (const char *) _subject, _search_subject); FREE(_search_subject); @@ -2296,7 +2296,7 @@ MailItemData *mailbox_list_make_mail_item_data(email_mail_list_item_t *mail_info char *_alias = elm_entry_utf8_to_markup(alias); int alias_len = STR_LEN(_alias); ld->alias = MEM_ALLOC_STR(alias_len + TAG_LEN + 1); - if (mailbox_ugd->b_searchmode && search_data && STR_VALID(search_data->sender)) { + if (view->b_searchmode && search_data && STR_VALID(search_data->sender)) { char *_search_sender = elm_entry_utf8_to_markup(search_data->sender); _mail_item_data_insert_search_tag(ld->alias, alias_len + TAG_LEN, (const char *) _alias, _search_sender); FREE(_search_sender); @@ -2319,7 +2319,7 @@ MailItemData *mailbox_list_make_mail_item_data(email_mail_list_item_t *mail_info char *_recipient = elm_entry_utf8_to_markup(recipient); int recipient_len = STR_LEN(_recipient); ld->recipient = MEM_ALLOC_STR(recipient_len + TAG_LEN + 1); - if (mailbox_ugd->b_searchmode && search_data && STR_VALID(search_data->recipient)) { + if (view->b_searchmode && search_data && STR_VALID(search_data->recipient)) { char *_search_recipient = elm_entry_utf8_to_markup(search_data->recipient); _mail_item_data_insert_search_tag(ld->recipient, recipient_len + TAG_LEN, (const char *) _recipient, _search_recipient); FREE(_search_recipient); @@ -2340,7 +2340,7 @@ MailItemData *mailbox_list_make_mail_item_data(email_mail_list_item_t *mail_info ld->absolute_time = mail_info->date_time; ld->timeordate = email_get_str_datetime(ld->absolute_time); - if (mailbox_ugd->sort_type == EMAIL_SORT_TO_CC_BCC) { + if (view->sort_type == EMAIL_SORT_TO_CC_BCC) { int err; int i; int account_count = 0; @@ -2351,7 +2351,7 @@ MailItemData *mailbox_list_make_mail_item_data(email_mail_list_item_t *mail_info err = email_get_account_list(&account_list, &account_count); if (err == EMAIL_ERROR_NONE && account_list) { for (i = 0; i < account_count; i++) { - if (mailbox_ugd->account_id == 0 || mailbox_ugd->account_id == account_list[i].account_id) { + if (view->account_id == 0 || view->account_id == account_list[i].account_id) { if (g_strstr_len(mail_info->email_address_recipient, -1, account_list[i].user_email_address)) { ld->is_to_address_mail = true; break; @@ -2400,29 +2400,29 @@ MailItemData *mailbox_list_get_mail_item_data_by_threadid(int thread_id, GList * return NULL; } -void mailbox_list_free_all_item_class_data(EmailMailboxUGD *mailbox_ugd) +void mailbox_list_free_all_item_class_data(EmailMailboxView *view) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd is NULL"); + retm_if(!view, "view is NULL"); - mailbox_ugd->itc.item_style = NULL; - mailbox_ugd->itc.func.text_get = NULL; - mailbox_ugd->itc.func.content_get = NULL; - mailbox_ugd->itc.func.state_get = NULL; - mailbox_ugd->itc.func.del = NULL; - elm_genlist_item_class_free(&mailbox_ugd->itc); + view->itc.item_style = NULL; + view->itc.func.text_get = NULL; + view->itc.func.content_get = NULL; + view->itc.func.state_get = NULL; + view->itc.func.del = NULL; + elm_genlist_item_class_free(&view->itc); mailbox_free_other_item_class_data(); } -void mailbox_list_free_all_item_data(EmailMailboxUGD *mailbox_ugd) +void mailbox_list_free_all_item_data(EmailMailboxView *view) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd is NULL"); + retm_if(!view, "view is NULL"); - _mail_item_data_list_free(&(mailbox_ugd->mail_list)); + _mail_item_data_list_free(&(view->mail_list)); - _mailbox_free_req_data(&mailbox_ugd->remaining_req); + _mailbox_free_req_data(&view->remaining_req); } void mailbox_list_free_mail_item_data(MailItemData *ld) @@ -2441,78 +2441,78 @@ void mailbox_list_free_mail_item_data(MailItemData *ld) FREE(ld); } -void mailbox_create_select_info(EmailMailboxUGD *mailbox_ugd) +void mailbox_create_select_info(EmailMailboxView *view) { debug_enter(); int cnt = 0; char text[128]; - cnt = eina_list_count(mailbox_ugd->selected_mail_list); - mailbox_view_title_unpack(mailbox_ugd); - elm_naviframe_item_title_enabled_set(mailbox_ugd->base.navi_item, EINA_TRUE, EINA_TRUE); - elm_naviframe_item_style_set(mailbox_ugd->base.navi_item, NULL); + cnt = eina_list_count(view->selected_mail_list); + mailbox_view_title_unpack(view); + elm_naviframe_item_title_enabled_set(view->base.navi_item, EINA_TRUE, EINA_TRUE); + elm_naviframe_item_style_set(view->base.navi_item, NULL); snprintf(text, sizeof(text), email_get_email_string("IDS_EMAIL_HEADER_PD_SELECTED_ABB2"), cnt); - elm_object_item_text_set(mailbox_ugd->base.navi_item, text); - elm_object_item_part_text_set(mailbox_ugd->base.navi_item, "subtitle", NULL); + elm_object_item_text_set(view->base.navi_item, text); + elm_object_item_part_text_set(view->base.navi_item, "subtitle", NULL); /* Title Cancel Button */ - if (!mailbox_ugd->cancel_btn) { - mailbox_ugd->cancel_btn = elm_button_add(mailbox_ugd->base.module->navi); - elm_object_style_set(mailbox_ugd->cancel_btn, "naviframe/title_left"); - elm_object_domain_translatable_text_set(mailbox_ugd->cancel_btn, PACKAGE, "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB"); - evas_object_smart_callback_add(mailbox_ugd->cancel_btn, "clicked", mailbox_exit_clicked_edit_mode, mailbox_ugd); + if (!view->cancel_btn) { + view->cancel_btn = elm_button_add(view->base.module->navi); + elm_object_style_set(view->cancel_btn, "naviframe/title_left"); + elm_object_domain_translatable_text_set(view->cancel_btn, PACKAGE, "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB"); + evas_object_smart_callback_add(view->cancel_btn, "clicked", mailbox_exit_clicked_edit_mode, view); } - elm_object_item_part_content_set(mailbox_ugd->base.navi_item, "title_left_btn", mailbox_ugd->cancel_btn); + elm_object_item_part_content_set(view->base.navi_item, "title_left_btn", view->cancel_btn); /* Title Done Button */ - if (!mailbox_ugd->save_btn) { - mailbox_ugd->save_btn = elm_button_add(mailbox_ugd->base.module->navi); - elm_object_style_set(mailbox_ugd->save_btn, "naviframe/title_right"); - if (mailbox_ugd->editmode_type == MAILBOX_EDIT_TYPE_DELETE) { - elm_object_domain_translatable_text_set(mailbox_ugd->save_btn, PACKAGE, "IDS_TPLATFORM_ACBUTTON_DELETE_ABB"); + if (!view->save_btn) { + view->save_btn = elm_button_add(view->base.module->navi); + elm_object_style_set(view->save_btn, "naviframe/title_right"); + if (view->editmode_type == MAILBOX_EDIT_TYPE_DELETE) { + elm_object_domain_translatable_text_set(view->save_btn, PACKAGE, "IDS_TPLATFORM_ACBUTTON_DELETE_ABB"); } else { - elm_object_domain_translatable_text_set(mailbox_ugd->save_btn, PACKAGE, "IDS_TPLATFORM_ACBUTTON_DONE_ABB"); + elm_object_domain_translatable_text_set(view->save_btn, PACKAGE, "IDS_TPLATFORM_ACBUTTON_DONE_ABB"); } - evas_object_smart_callback_add(mailbox_ugd->save_btn, "clicked", mailbox_update_done_clicked_edit_mode, mailbox_ugd); + evas_object_smart_callback_add(view->save_btn, "clicked", mailbox_update_done_clicked_edit_mode, view); } - elm_object_item_part_content_set(mailbox_ugd->base.navi_item, "title_right_btn", mailbox_ugd->save_btn); + elm_object_item_part_content_set(view->base.navi_item, "title_right_btn", view->save_btn); if (cnt == 0) { - elm_object_disabled_set(mailbox_ugd->save_btn, EINA_TRUE); + elm_object_disabled_set(view->save_btn, EINA_TRUE); } else { - elm_object_disabled_set(mailbox_ugd->save_btn, EINA_FALSE); + elm_object_disabled_set(view->save_btn, EINA_FALSE); } debug_leave(); } -void mailbox_update_select_info(EmailMailboxUGD *mailbox_ugd) +void mailbox_update_select_info(EmailMailboxView *view) { debug_enter(); int cnt = 0; char text[128]; - cnt = eina_list_count(mailbox_ugd->selected_mail_list); - int cnt_mail_list = g_list_length(mailbox_ugd->mail_list); + cnt = eina_list_count(view->selected_mail_list); + int cnt_mail_list = g_list_length(view->mail_list); if (cnt_mail_list == 0) { - debug_log("no email remain. b_editmode [%d], list count = %d", mailbox_ugd->b_editmode, cnt_mail_list); - mailbox_exit_edit_mode(mailbox_ugd); + debug_log("no email remain. b_editmode [%d], list count = %d", view->b_editmode, cnt_mail_list); + mailbox_exit_edit_mode(view); return; } snprintf(text, sizeof(text), email_get_email_string("IDS_EMAIL_HEADER_PD_SELECTED_ABB2"), cnt); - elm_object_item_text_set(mailbox_ugd->base.navi_item, text); - elm_object_item_part_text_set(mailbox_ugd->base.navi_item, "subtitle", NULL); + elm_object_item_text_set(view->base.navi_item, text); + elm_object_item_part_text_set(view->base.navi_item, "subtitle", NULL); if (cnt == 0) { - elm_object_disabled_set(mailbox_ugd->save_btn, EINA_TRUE); + elm_object_disabled_set(view->save_btn, EINA_TRUE); } else { - elm_object_disabled_set(mailbox_ugd->save_btn, EINA_FALSE); + elm_object_disabled_set(view->save_btn, EINA_FALSE); } debug_leave(); @@ -2521,11 +2521,11 @@ void mailbox_update_select_info(EmailMailboxUGD *mailbox_ugd) static void mailbox_update_done_clicked_edit_mode(void *data, Evas_Object *obj, void *event_info) { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - debug_log("mailbox_ugd->b_editmode %d", mailbox_ugd->b_editmode); + EmailMailboxView *view = (EmailMailboxView *)data; + debug_log("view->b_editmode %d", view->b_editmode); int cnt = 0; - cnt = eina_list_count(mailbox_ugd->selected_mail_list); + cnt = eina_list_count(view->selected_mail_list); if (cnt == 0) { int ret = notification_status_message_post(email_get_email_string("IDS_EMAIL_HEADER_SELECT_EMAILS")); if (ret != NOTIFICATION_ERROR_NONE) { @@ -2534,18 +2534,18 @@ static void mailbox_update_done_clicked_edit_mode(void *data, Evas_Object *obj, return; } - if (mailbox_ugd->editmode_type == MAILBOX_EDIT_TYPE_DELETE) { - mailbox_delete_mail(mailbox_ugd); - } else if (mailbox_ugd->editmode_type == MAILBOX_EDIT_TYPE_MOVE) { - mailbox_move_mail(mailbox_ugd); - } else if (mailbox_ugd->editmode_type == MAILBOX_EDIT_TYPE_ADD_SPAM) { - mailbox_to_spam_mail(mailbox_ugd); - } else if (mailbox_ugd->editmode_type == MAILBOX_EDIT_TYPE_REMOVE_SPAM) { - mailbox_from_spam_mail(mailbox_ugd); - } else if (mailbox_ugd->editmode_type == MAILBOX_EDIT_TYPE_MARK_READ) { - mailbox_markread_mail(mailbox_ugd); - } else if (mailbox_ugd->editmode_type == MAILBOX_EDIT_TYPE_MARK_UNREAD) { - mailbox_markunread_mail(mailbox_ugd); + if (view->editmode_type == MAILBOX_EDIT_TYPE_DELETE) { + mailbox_delete_mail(view); + } else if (view->editmode_type == MAILBOX_EDIT_TYPE_MOVE) { + mailbox_move_mail(view); + } else if (view->editmode_type == MAILBOX_EDIT_TYPE_ADD_SPAM) { + mailbox_to_spam_mail(view); + } else if (view->editmode_type == MAILBOX_EDIT_TYPE_REMOVE_SPAM) { + mailbox_from_spam_mail(view); + } else if (view->editmode_type == MAILBOX_EDIT_TYPE_MARK_READ) { + mailbox_markread_mail(view); + } else if (view->editmode_type == MAILBOX_EDIT_TYPE_MARK_UNREAD) { + mailbox_markunread_mail(view); } debug_leave(); @@ -2554,66 +2554,66 @@ static void mailbox_update_done_clicked_edit_mode(void *data, Evas_Object *obj, static void mailbox_exit_clicked_edit_mode(void *data, Evas_Object *obj, void *event_info) { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - mailbox_exit_edit_mode(mailbox_ugd); + mailbox_exit_edit_mode(view); } void mailbox_exit_edit_mode(void *data) { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - DELETE_EVAS_OBJECT(mailbox_ugd->more_ctxpopup); + DELETE_EVAS_OBJECT(view->more_ctxpopup); /*clear checked status of mail item*/ - mailbox_clear_edit_mode_list(mailbox_ugd); + mailbox_clear_edit_mode_list(view); - elm_naviframe_item_title_enabled_set(mailbox_ugd->base.navi_item, EINA_FALSE, EINA_TRUE); - mailbox_view_title_pack(mailbox_ugd); - mailbox_view_title_update_all_without_mailbox_change(mailbox_ugd); + elm_naviframe_item_title_enabled_set(view->base.navi_item, EINA_FALSE, EINA_TRUE); + mailbox_view_title_pack(view); + mailbox_view_title_update_all_without_mailbox_change(view); - if ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { - mailbox_send_all_btn_add(mailbox_ugd); + if ((view->mode == EMAIL_MAILBOX_MODE_ALL || view->mode == EMAIL_MAILBOX_MODE_MAILBOX) + && view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { + mailbox_send_all_btn_add(view); } - debug_log("b_editmode [%d]", mailbox_ugd->b_editmode); + debug_log("b_editmode [%d]", view->b_editmode); debug_leave(); } -void mailbox_clear_edit_mode_list(EmailMailboxUGD *mailbox_ugd) +void mailbox_clear_edit_mode_list(EmailMailboxView *view) { debug_enter(); int i = 0; - int checked_count = eina_list_count(mailbox_ugd->selected_mail_list); + int checked_count = eina_list_count(view->selected_mail_list); debug_log("checked_count [%d]", checked_count); - mailbox_ugd->b_editmode = false; + view->b_editmode = false; /*Remove Cancel and Done buttons*/ - elm_object_item_part_content_unset(mailbox_ugd->base.navi_item, "title_left_btn"); - DELETE_EVAS_OBJECT(mailbox_ugd->cancel_btn); - elm_object_item_part_content_unset(mailbox_ugd->base.navi_item, "title_right_btn"); - DELETE_EVAS_OBJECT(mailbox_ugd->save_btn); - - if (0 < g_list_length(mailbox_ugd->mail_list)) { - if (!mailbox_ugd->b_searchmode - && ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_IMAP4) - || (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_POP3))) { - mailbox_load_more_messages_item_add(mailbox_ugd); - } else if (!mailbox_ugd->b_searchmode - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { - mailbox_no_more_emails_item_add(mailbox_ugd); + elm_object_item_part_content_unset(view->base.navi_item, "title_left_btn"); + DELETE_EVAS_OBJECT(view->cancel_btn); + elm_object_item_part_content_unset(view->base.navi_item, "title_right_btn"); + DELETE_EVAS_OBJECT(view->save_btn); + + if (0 < g_list_length(view->mail_list)) { + if (!view->b_searchmode + && ((view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX + && view->account_type == EMAIL_SERVER_TYPE_IMAP4) + || (view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX + && view->account_type == EMAIL_SERVER_TYPE_POP3))) { + mailbox_load_more_messages_item_add(view); + } else if (!view->b_searchmode + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { + mailbox_no_more_emails_item_add(view); } } for (i = 0; i < checked_count; i++) { - Eina_List *nth_list = eina_list_nth_list(mailbox_ugd->selected_mail_list, i); + Eina_List *nth_list = eina_list_nth_list(view->selected_mail_list, i); MailItemData *ld = (MailItemData *)eina_list_data_get(nth_list); if (ld) { if (ld->checked == EINA_TRUE) { @@ -2622,48 +2622,48 @@ void mailbox_clear_edit_mode_list(EmailMailboxUGD *mailbox_ugd) } } - mailbox_ugd->selected_mail_list = eina_list_free(mailbox_ugd->selected_mail_list); - mailbox_ugd->selected_group_list = eina_list_free(mailbox_ugd->selected_group_list); + view->selected_mail_list = eina_list_free(view->selected_mail_list); + view->selected_group_list = eina_list_free(view->selected_group_list); - mailbox_ugd->selectAll_chksel = EINA_FALSE; - elm_genlist_realized_items_update(mailbox_ugd->gl); + view->selectAll_chksel = EINA_FALSE; + elm_genlist_realized_items_update(view->gl); - mailbox_select_all_item_remove(mailbox_ugd); - mailbox_show_compose_btn(mailbox_ugd); - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX - && mailbox_ugd->only_local == FALSE && !mailbox_ugd->b_searchmode) { + mailbox_select_all_item_remove(view); + mailbox_show_compose_btn(view); + if (view->mode == EMAIL_MAILBOX_MODE_MAILBOX + && view->only_local == FALSE && !view->b_searchmode) { Evas_Coord scroll_x = 0, scroll_y = 0, scroll_w = 0, scroll_h = 0; - elm_scroller_region_get(mailbox_ugd->gl, &scroll_x, &scroll_y, &scroll_w, &scroll_h); + elm_scroller_region_get(view->gl, &scroll_x, &scroll_y, &scroll_w, &scroll_h); if (scroll_y <= 0 || (scroll_y <= SELECT_ALL_LIST_ITEM_HEIGHT)) { - mailbox_last_updated_time_item_add(mailbox_ugd, true); + mailbox_last_updated_time_item_add(view, true); } else { - mailbox_last_updated_time_item_add(mailbox_ugd, false); + mailbox_last_updated_time_item_add(view, false); } } debug_leave(); } -void mailbox_update_edit_list_view(MailItemData *ld, EmailMailboxUGD *mailbox_ugd) +void mailbox_update_edit_list_view(MailItemData *ld, EmailMailboxView *view) { debug_enter(); retm_if(!ld, "ld is NULL"); retm_if(!ld->item, "ld->item is NULL"); - mailbox_ugd->selected_mail_list = eina_list_remove(mailbox_ugd->selected_mail_list, ld); + view->selected_mail_list = eina_list_remove(view->selected_mail_list, ld); - /*int cnt = eina_list_count(mailbox_ugd->selected_mail_list);*/ - int cnt_mail_list = g_list_length(mailbox_ugd->mail_list); - debug_log("b_editmode [%d], list count = %d", mailbox_ugd->b_editmode, cnt_mail_list); + /*int cnt = eina_list_count(view->selected_mail_list);*/ + int cnt_mail_list = g_list_length(view->mail_list); + debug_log("b_editmode [%d], list count = %d", view->b_editmode, cnt_mail_list); - if (cnt_mail_list <= 0 && mailbox_ugd->b_editmode == true) { + if (cnt_mail_list <= 0 && view->b_editmode == true) { debug_log("Exit edit mode due to empty list"); /* update controlbar to mailbox menu */ - mailbox_exit_edit_mode(mailbox_ugd); + mailbox_exit_edit_mode(view); } else { - mailbox_update_select_info(mailbox_ugd); + mailbox_update_select_info(view); } } @@ -2672,14 +2672,14 @@ void mailbox_remove_unnecessary_list_item_for_edit_mode(void *data) debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - if (mailbox_ugd->last_updated_time_item) - mailbox_last_updated_time_item_remove(mailbox_ugd); + if (view->last_updated_time_item) + mailbox_last_updated_time_item_remove(view); - mailbox_load_more_messages_item_remove(mailbox_ugd); - mailbox_no_more_emails_item_remove(mailbox_ugd); - mailbox_get_more_progress_item_remove(mailbox_ugd); + mailbox_load_more_messages_item_remove(view); + mailbox_no_more_emails_item_remove(view); + mailbox_get_more_progress_item_remove(view); } bool mailbox_check_searched_mail(int mail_id, void *data) @@ -2691,9 +2691,9 @@ bool mailbox_check_searched_mail(int mail_id, void *data) int i = 0; int total_count = 0, unread_count = 0; - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - email_search_data_t *search_data = mailbox_make_search_data(mailbox_ugd); + email_search_data_t *search_data = mailbox_make_search_data(view); if (search_data) cnt_filter_list += _get_filter_cnt_for_search_data(search_data); @@ -2740,12 +2740,12 @@ bool mailbox_check_searched_mail(int mail_id, void *data) return false; } -void mailbox_list_make_remaining_items_in_thread(EmailMailboxUGD *mailbox_ugd, AddRemainingMailReqData *req) +void mailbox_list_make_remaining_items_in_thread(EmailMailboxView *view, AddRemainingMailReqData *req) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd is NULL"); + retm_if(!view, "view is NULL"); retm_if(!req, "req is NULL"); - if (email_request_queue_add_request(mailbox_ugd->request_queue, EMAIL_REQUEST_TYPE_ADD_REMAINING_MAIL, req)) { + if (email_request_queue_add_request(view->request_queue, EMAIL_REQUEST_TYPE_ADD_REMAINING_MAIL, req)) { debug_log("Request added"); } else { debug_error("Added request failed"); diff --git a/Project-Files/modules/mailbox/src/email-mailbox-ug-util.c b/Project-Files/modules/mailbox/src/email-mailbox-module-util.c similarity index 52% rename from Project-Files/modules/mailbox/src/email-mailbox-ug-util.c rename to Project-Files/modules/mailbox/src/email-mailbox-module-util.c index 9ba4d08..42acd38 100644 --- a/Project-Files/modules/mailbox/src/email-mailbox-ug-util.c +++ b/Project-Files/modules/mailbox/src/email-mailbox-module-util.c @@ -21,7 +21,7 @@ #include "email-mailbox-list-other-items.h" #include "email-mailbox-sync.h" #include "email-mailbox-title.h" -#include "email-mailbox-ug-util.h" +#include "email-mailbox-module-util.h" #include "email-mailbox-util.h" #include "email-mailbox-more-menu.h" @@ -55,19 +55,19 @@ static void _viewer_result_cb(void *data, email_module_h module, email_params_h debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = data; + EmailMailboxView *view = data; const char *msg_type = NULL; retm_if(!email_params_get_str(result, EMAIL_BUNDLE_KEY_MSG, &msg_type), "email_params_get_str() failed!"); if (g_strcmp0(msg_type, EMAIL_BUNDLE_VAL_NEXT_MSG) == 0) { - mailbox_handle_next_msg_bundle(mailbox_ugd, result); + mailbox_handle_next_msg_bundle(view, result); } else if (g_strcmp0(msg_type, EMAIL_BUNDLE_VAL_PREV_MSG) == 0) { - mailbox_handle_prev_msg_bundle(mailbox_ugd, result); + mailbox_handle_prev_msg_bundle(view, result); } - debug_log("mailbox_ugd->opened_mail_id : %d", mailbox_ugd->opened_mail_id); + debug_log("view->opened_mail_id : %d", view->opened_mail_id); } static void _account_result_cb(void *data, email_module_h module, email_params_h result) @@ -77,30 +77,30 @@ static void _account_result_cb(void *data, email_module_h module, email_params_h retm_if(!data, "data is NULL"); const char *mode = NULL; - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - if (mailbox_ugd->account) - mailbox_account_module_destroy(mailbox_ugd, mailbox_ugd->account); + if (view->account) + mailbox_account_module_destroy(view, view->account); - /* handle result from move to folder ug */ + /* handle result from move to folder mode */ - int is_move_mail_ug = 0; - email_params_get_int_opt(result, EMAIL_BUNDLE_KEY_IS_MAILBOX_MOVE_MODE, &is_move_mail_ug); + int is_move_mail_mode = 0; + email_params_get_int_opt(result, EMAIL_BUNDLE_KEY_IS_MAILBOX_MOVE_MODE, &is_move_mail_mode); - if (is_move_mail_ug) { + if (is_move_mail_mode) { int b_edit_mod = 0; const char *moved_mailbox_name = NULL; email_params_get_int_opt(result, EMAIL_BUNDLE_KEY_IS_MAILBOX_EDIT_MODE, &b_edit_mod); - email_params_get_int_opt(result, EMAIL_BUNDLE_KEY_MAILBOX, &mailbox_ugd->mailbox_id); - email_params_get_int_opt(result, EMAIL_BUNDLE_KEY_MAILBOX_MOVE_STATUS, &mailbox_ugd->move_status); + email_params_get_int_opt(result, EMAIL_BUNDLE_KEY_MAILBOX, &view->mailbox_id); + email_params_get_int_opt(result, EMAIL_BUNDLE_KEY_MAILBOX_MOVE_STATUS, &view->move_status); email_params_get_str_opt(result, EMAIL_BUNDLE_KEY_MAILBOX_MOVED_MAILBOX_NAME, &moved_mailbox_name); - G_FREE(mailbox_ugd->moved_mailbox_name); - mailbox_ugd->moved_mailbox_name = g_strdup(moved_mailbox_name); + G_FREE(view->moved_mailbox_name); + view->moved_mailbox_name = g_strdup(moved_mailbox_name); if (b_edit_mod) { - mailbox_exit_edit_mode(mailbox_ugd); + mailbox_exit_edit_mode(view); } return; } @@ -108,53 +108,53 @@ static void _account_result_cb(void *data, email_module_h module, email_params_h email_params_get_str_opt(result, EMAIL_BUNDLE_KEY_ACCOUNT_TYPE, &mode); - mailbox_clear_prev_mailbox_info(mailbox_ugd); + mailbox_clear_prev_mailbox_info(view); if (g_strcmp0(mode, EMAIL_BUNDLE_VAL_ALL_ACCOUNT) == 0) { debug_log("EMAIL_BUNDLE_VAL_ALL_ACCOUNT"); - mailbox_ugd->mode = EMAIL_MAILBOX_MODE_ALL; - mailbox_ugd->account_id = 0; + view->mode = EMAIL_MAILBOX_MODE_ALL; + view->account_id = 0; int mailbox_type = 0; email_params_get_int_opt(result, EMAIL_BUNDLE_KEY_MAILBOX_TYPE, &mailbox_type); - mailbox_ugd->mailbox_type = mailbox_type; + view->mailbox_type = mailbox_type; - debug_log("account_id(%d), mailbox_type(%d)", mailbox_ugd->account_id, mailbox_ugd->mailbox_type); + debug_log("account_id(%d), mailbox_type(%d)", view->account_id, view->mailbox_type); } else if (g_strcmp0(mode, EMAIL_BUNDLE_VAL_SINGLE_ACCOUNT) == 0) { debug_log("EMAIL_BUNDLE_VAL_SINGLE_ACCOUNT"); - mailbox_ugd->mode = EMAIL_MAILBOX_MODE_MAILBOX; + view->mode = EMAIL_MAILBOX_MODE_MAILBOX; - email_params_get_int_opt(result, EMAIL_BUNDLE_KEY_ACCOUNT_ID, &mailbox_ugd->account_id); + email_params_get_int_opt(result, EMAIL_BUNDLE_KEY_ACCOUNT_ID, &view->account_id); - if (!email_params_get_int(result, EMAIL_BUNDLE_KEY_MAILBOX, &mailbox_ugd->mailbox_id)) { + if (!email_params_get_int(result, EMAIL_BUNDLE_KEY_MAILBOX, &view->mailbox_id)) { debug_error("failure on getting mailbox_id"); return; } - debug_log("account_id[%d], mailbox_id[%d]", mailbox_ugd->account_id, mailbox_ugd->mailbox_id); + debug_log("account_id[%d], mailbox_id[%d]", view->account_id, view->mailbox_id); } else if (g_strcmp0(mode, EMAIL_BUNDLE_VAL_PRIORITY_SENDER) == 0) { debug_log("EMAIL_BUNDLE_VAL_PRIORITY_SENDER"); - mailbox_ugd->account_id = 0; - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; - mailbox_ugd->mode = EMAIL_MAILBOX_MODE_PRIORITY_SENDER; + view->account_id = 0; + view->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; + view->mode = EMAIL_MAILBOX_MODE_PRIORITY_SENDER; } else { return; } - mailbox_view_title_update_all(mailbox_ugd); - mailbox_check_sort_type_validation(mailbox_ugd); - mailbox_list_refresh(mailbox_ugd, NULL); + mailbox_view_title_update_all(view); + mailbox_check_sort_type_validation(view); + mailbox_list_refresh(view, NULL); - mailbox_sync_current_mailbox(mailbox_ugd); - /*if (mailbox_sync_current_mailbox(mailbox_ugd)) - mailbox_refreshing_progress_add(mailbox_ugd); + mailbox_sync_current_mailbox(view); + /*if (mailbox_sync_current_mailbox(view)) + mailbox_refreshing_progress_add(view); else - mailbox_refreshing_progress_remove(mailbox_ugd);*/ + mailbox_refreshing_progress_remove(view);*/ } /* @@ -165,15 +165,15 @@ email_module_h mailbox_composer_module_create(void *data, email_module_type_e ty { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; email_module_listener_t listener = { 0 }; - listener.cb_data = mailbox_ugd; + listener.cb_data = view; listener.destroy_request_cb = mailbox_composer_module_destroy; - email_module_h module = email_module_create_child(mailbox_ugd->base.module, type, params, &listener); - if (mailbox_ugd->content_layout) - elm_object_tree_focus_allow_set(mailbox_ugd->content_layout, EINA_FALSE); + email_module_h module = email_module_create_child(view->base.module, type, params, &listener); + if (view->content_layout) + elm_object_tree_focus_allow_set(view->content_layout, EINA_FALSE); debug_leave(); @@ -186,9 +186,9 @@ void mailbox_composer_module_destroy(void *priv, email_module_h module) retm_if(!module, "module is NULL"); retm_if(!priv, "priv is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)priv; + EmailMailboxView *view = (EmailMailboxView *)priv; - GList *opened_mail = g_list_find_custom(mailbox_ugd->mail_list, GINT_TO_POINTER(mailbox_ugd->opened_mail_id), mailbox_compare_mailid_in_list); + GList *opened_mail = g_list_find_custom(view->mail_list, GINT_TO_POINTER(view->opened_mail_id), mailbox_compare_mailid_in_list); if (opened_mail) { MailItemData *ld = (MailItemData *)g_list_nth_data(opened_mail, 0); if (ld) { @@ -196,18 +196,18 @@ void mailbox_composer_module_destroy(void *priv, email_module_h module) elm_genlist_item_selected_set(ld->item, EINA_FALSE); } } - if (mailbox_ugd->content_layout) - elm_object_tree_focus_allow_set(mailbox_ugd->content_layout, EINA_TRUE); + if (view->content_layout) + elm_object_tree_focus_allow_set(view->content_layout, EINA_TRUE); - if (mailbox_ugd->composer) { - email_module_destroy(mailbox_ugd->composer); - mailbox_ugd->composer = NULL; + if (view->composer) { + email_module_destroy(view->composer); + view->composer = NULL; } - mailbox_ugd->is_module_launching = false; + view->is_module_launching = false; - if (mailbox_ugd->run_type == RUN_VIEWER_FROM_NOTIFICATION) { - mailbox_ugd->run_type = RUN_TYPE_UNKNOWN; - mailbox_open_email_viewer(mailbox_ugd, mailbox_ugd->account_id, mailbox_ugd->mailbox_id, mailbox_ugd->start_mail_id); + if (view->run_type == RUN_VIEWER_FROM_NOTIFICATION) { + view->run_type = RUN_TYPE_UNKNOWN; + mailbox_open_email_viewer(view, view->account_id, view->mailbox_id, view->start_mail_id); } } @@ -215,23 +215,23 @@ email_module_h mailbox_viewer_module_create(void *data, email_module_type_e type { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; email_module_listener_t listener = { 0 }; listener.cb_data = data; listener.result_cb = _viewer_result_cb; listener.destroy_request_cb = mailbox_viewer_module_destroy; - if (!mailbox_ugd->viewer) { - mailbox_ugd->viewer = email_module_create_child(mailbox_ugd->base.module, type, params, &listener); - if (mailbox_ugd->content_layout) { - elm_object_tree_focus_allow_set(mailbox_ugd->content_layout, EINA_FALSE); + if (!view->viewer) { + view->viewer = email_module_create_child(view->base.module, type, params, &listener); + if (view->content_layout) { + elm_object_tree_focus_allow_set(view->content_layout, EINA_FALSE); } } else { - email_module_send_message(mailbox_ugd->viewer, params); + email_module_send_message(view->viewer, params); } - return mailbox_ugd->viewer; + return view->viewer; } void mailbox_viewer_module_destroy(void *priv, email_module_h module) @@ -240,32 +240,32 @@ void mailbox_viewer_module_destroy(void *priv, email_module_h module) retm_if(!module, "module is NULL"); retm_if(!priv, "priv is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)priv; - if (mailbox_ugd) { + EmailMailboxView *view = (EmailMailboxView *)priv; + if (view) { - if (mailbox_ugd->content_layout) - elm_object_tree_focus_allow_set(mailbox_ugd->content_layout, EINA_TRUE); + if (view->content_layout) + elm_object_tree_focus_allow_set(view->content_layout, EINA_TRUE); } email_module_destroy(module); - mailbox_ugd->viewer = NULL; - mailbox_ugd->opened_mail_id = 0; + view->viewer = NULL; + view->opened_mail_id = 0; } email_module_h mailbox_account_module_create(void *data, email_module_type_e type, email_params_h params) { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; email_module_listener_t listener = { 0 }; - listener.cb_data = mailbox_ugd; + listener.cb_data = view; listener.result_cb = _account_result_cb; listener.destroy_request_cb = mailbox_account_module_destroy; - email_module_h module = email_module_create_child(mailbox_ugd->base.module, type, params, &listener); - if (mailbox_ugd->content_layout) - elm_object_tree_focus_allow_set(mailbox_ugd->content_layout, EINA_FALSE); + email_module_h module = email_module_create_child(view->base.module, type, params, &listener); + if (view->content_layout) + elm_object_tree_focus_allow_set(view->content_layout, EINA_FALSE); return module; } @@ -276,31 +276,31 @@ void mailbox_account_module_destroy(void *priv, email_module_h module) retm_if(!module, "module is NULL"); retm_if(!priv, "priv is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)priv; + EmailMailboxView *view = (EmailMailboxView *)priv; - if (mailbox_ugd->content_layout) - elm_object_tree_focus_allow_set(mailbox_ugd->content_layout, EINA_TRUE); + if (view->content_layout) + elm_object_tree_focus_allow_set(view->content_layout, EINA_TRUE); - if (mailbox_ugd->account) { - email_module_destroy(mailbox_ugd->account); - mailbox_ugd->account = NULL; + if (view->account) { + email_module_destroy(view->account); + view->account = NULL; } - mailbox_ugd->is_module_launching = false; + view->is_module_launching = false; } email_module_h mailbox_setting_module_create(void *data, email_module_type_e type, email_params_h params) { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; email_module_listener_t listener = { 0 }; - listener.cb_data = mailbox_ugd; + listener.cb_data = view; listener.destroy_request_cb = mailbox_setting_module_destroy; - email_module_h module = email_module_create_child(mailbox_ugd->base.module, type, params, &listener); - if (mailbox_ugd->content_layout) - elm_object_tree_focus_allow_set(mailbox_ugd->content_layout, EINA_FALSE); + email_module_h module = email_module_create_child(view->base.module, type, params, &listener); + if (view->content_layout) + elm_object_tree_focus_allow_set(view->content_layout, EINA_FALSE); return module; } @@ -311,13 +311,13 @@ void mailbox_setting_module_destroy(void *priv, email_module_h module) retm_if(!module, "module is NULL"); retm_if(!priv, "priv is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)priv; + EmailMailboxView *view = (EmailMailboxView *)priv; - if (mailbox_ugd->content_layout) - elm_object_tree_focus_allow_set(mailbox_ugd->content_layout, EINA_TRUE); + if (view->content_layout) + elm_object_tree_focus_allow_set(view->content_layout, EINA_TRUE); - if (module == mailbox_ugd->setting) { - email_module_destroy(mailbox_ugd->setting); - mailbox_ugd->setting = NULL; + if (module == view->setting) { + email_module_destroy(view->setting); + view->setting = NULL; } } diff --git a/Project-Files/modules/mailbox/src/email-mailbox-more-menu.c b/Project-Files/modules/mailbox/src/email-mailbox-more-menu.c index 53e8e11..ac564a1 100644 --- a/Project-Files/modules/mailbox/src/email-mailbox-more-menu.c +++ b/Project-Files/modules/mailbox/src/email-mailbox-more-menu.c @@ -21,7 +21,7 @@ #include "email-mailbox-toolbar.h" #include "email-mailbox-item.h" #include "email-mailbox-list.h" -#include "email-mailbox-ug-util.h" +#include "email-mailbox-module-util.h" #include "email-mailbox-util.h" #include "email-mailbox-more-menu.h" #include "email-mailbox-noti-mgr.h" @@ -42,8 +42,8 @@ static void _resize_more_ctxpopup_cb(void *data, Evas *e, Evas_Object *obj, void static void _delete_more_ctxpopup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _more_toolbar_clicked_cb(void *data, Evas_Object *obj, void *event_info); static void _compose_toolbar_clicked_cb(void *data, Evas_Object *obj, void *event_info); -static void _change_view_for_selection_mode(EmailMailboxUGD *mailbox_ugd); -static void _setup_edit_mode(EmailMailboxUGD *mailbox_ugd, mailbox_edit_type_e edit_type); +static void _change_view_for_selection_mode(EmailMailboxView *view); +static void _setup_edit_mode(EmailMailboxView *view, mailbox_edit_type_e edit_type); /* * Definitions @@ -58,7 +58,7 @@ static void _setup_edit_mode(EmailMailboxUGD *mailbox_ugd, mailbox_edit_type_e e typedef struct { int index; Evas_Object *radio; - EmailMailboxUGD *mailbox_ugd; + EmailMailboxView *view; } RadioItemData; @@ -70,20 +70,20 @@ typedef struct { * Definition for static functions */ -static void _setup_edit_mode(EmailMailboxUGD *mailbox_ugd, mailbox_edit_type_e edit_type) +static void _setup_edit_mode(EmailMailboxView *view, mailbox_edit_type_e edit_type) { - DELETE_EVAS_OBJECT(mailbox_ugd->more_ctxpopup); - if (!mailbox_ugd->b_editmode) { - mailbox_ugd->editmode_type = edit_type; - mailbox_ugd->selected_mail_list = eina_list_free(mailbox_ugd->selected_mail_list); - mailbox_ugd->selected_mail_list = NULL; - debug_log("Enter edit mode. type:(%d)", mailbox_ugd->editmode_type); - - mailbox_ugd->b_editmode = true; - _change_view_for_selection_mode(mailbox_ugd); - mailbox_sync_cancel_all(mailbox_ugd); - mailbox_toolbar_create(mailbox_ugd); - mailbox_create_select_info(mailbox_ugd); + DELETE_EVAS_OBJECT(view->more_ctxpopup); + if (!view->b_editmode) { + view->editmode_type = edit_type; + view->selected_mail_list = eina_list_free(view->selected_mail_list); + view->selected_mail_list = NULL; + debug_log("Enter edit mode. type:(%d)", view->editmode_type); + + view->b_editmode = true; + _change_view_for_selection_mode(view); + mailbox_sync_cancel_all(view); + mailbox_toolbar_create(view); + mailbox_create_select_info(view); } else { debug_warning("error status: already edit mode"); } @@ -94,8 +94,8 @@ static void _more_edit_delete_mode_cb(void *data, Evas_Object *obj, void *event_ debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - _setup_edit_mode(mailbox_ugd, MAILBOX_EDIT_TYPE_DELETE); + EmailMailboxView *view = (EmailMailboxView *)data; + _setup_edit_mode(view, MAILBOX_EDIT_TYPE_DELETE); } static void _more_edit_move_mode_cb(void *data, Evas_Object *obj, void *event_info) @@ -103,8 +103,8 @@ static void _more_edit_move_mode_cb(void *data, Evas_Object *obj, void *event_in debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - _setup_edit_mode(mailbox_ugd, MAILBOX_EDIT_TYPE_MOVE); + EmailMailboxView *view = (EmailMailboxView *)data; + _setup_edit_mode(view, MAILBOX_EDIT_TYPE_MOVE); } @@ -113,8 +113,8 @@ static void _more_edit_spam_mode_cb(void *data, Evas_Object *obj, void *event_in debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - _setup_edit_mode(mailbox_ugd, MAILBOX_EDIT_TYPE_ADD_SPAM); + EmailMailboxView *view = (EmailMailboxView *)data; + _setup_edit_mode(view, MAILBOX_EDIT_TYPE_ADD_SPAM); } static void _more_edit_remove_spam_mode_cb(void *data, Evas_Object *obj, void *event_info) @@ -122,8 +122,8 @@ static void _more_edit_remove_spam_mode_cb(void *data, Evas_Object *obj, void *e debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - _setup_edit_mode(mailbox_ugd, MAILBOX_EDIT_TYPE_REMOVE_SPAM); + EmailMailboxView *view = (EmailMailboxView *)data; + _setup_edit_mode(view, MAILBOX_EDIT_TYPE_REMOVE_SPAM); } @@ -132,8 +132,8 @@ static void _more_edit_read_mode_cb(void *data, Evas_Object *obj, void *event_in debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - _setup_edit_mode(mailbox_ugd, MAILBOX_EDIT_TYPE_MARK_READ); + EmailMailboxView *view = (EmailMailboxView *)data; + _setup_edit_mode(view, MAILBOX_EDIT_TYPE_MARK_READ); } @@ -142,8 +142,8 @@ static void _more_edit_unread_mode_cb(void *data, Evas_Object *obj, void *event_ debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - _setup_edit_mode(mailbox_ugd, MAILBOX_EDIT_TYPE_MARK_UNREAD); + EmailMailboxView *view = (EmailMailboxView *)data; + _setup_edit_mode(view, MAILBOX_EDIT_TYPE_MARK_UNREAD); } @@ -152,15 +152,15 @@ static void _settings_cb(void *data, Evas_Object *obj, void *event_info) debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; email_params_h params = NULL; - DELETE_EVAS_OBJECT(mailbox_ugd->more_ctxpopup); + DELETE_EVAS_OBJECT(view->more_ctxpopup); if (email_params_create(¶ms) && email_params_add_str(params, EMAIL_BUNDLE_KEY_VIEW_TYPE, EMAIL_BUNDLE_VAL_VIEW_SETTING)) { - mailbox_ugd->setting = mailbox_setting_module_create(mailbox_ugd, EMAIL_MODULE_SETTING, params); + view->setting = mailbox_setting_module_create(view, EMAIL_MODULE_SETTING, params); } email_params_free(¶ms); @@ -182,8 +182,8 @@ static void _more_ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *even debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - DELETE_EVAS_OBJECT(mailbox_ugd->more_ctxpopup); + EmailMailboxView *view = (EmailMailboxView *)data; + DELETE_EVAS_OBJECT(view->more_ctxpopup); } static void _move_more_ctxpopup(Evas_Object *ctxpopup, Evas_Object *win) @@ -216,8 +216,8 @@ static void _resize_more_ctxpopup_cb(void *data, Evas *e, Evas_Object *obj, void debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - _move_more_ctxpopup(mailbox_ugd->more_ctxpopup, mailbox_ugd->base.module->win); + EmailMailboxView *view = (EmailMailboxView *)data; + _move_more_ctxpopup(view->more_ctxpopup, view->base.module->win); } static void _delete_more_ctxpopup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) @@ -225,57 +225,57 @@ static void _delete_more_ctxpopup_cb(void *data, Evas *e, Evas_Object *obj, void debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - evas_object_event_callback_del(mailbox_ugd->base.module->navi, EVAS_CALLBACK_RESIZE, _resize_more_ctxpopup_cb); - eext_object_event_callback_del(mailbox_ugd->more_ctxpopup, EEXT_CALLBACK_BACK, _more_ctxpopup_back_cb); - eext_object_event_callback_del(mailbox_ugd->more_ctxpopup, EEXT_CALLBACK_MORE, _more_ctxpopup_back_cb); - evas_object_smart_callback_del(mailbox_ugd->more_ctxpopup, "dismissed", _more_ctxpopup_dismissed_cb); - evas_object_event_callback_del(mailbox_ugd->more_ctxpopup, EVAS_CALLBACK_DEL, _delete_more_ctxpopup_cb); + evas_object_event_callback_del(view->base.module->navi, EVAS_CALLBACK_RESIZE, _resize_more_ctxpopup_cb); + eext_object_event_callback_del(view->more_ctxpopup, EEXT_CALLBACK_BACK, _more_ctxpopup_back_cb); + eext_object_event_callback_del(view->more_ctxpopup, EEXT_CALLBACK_MORE, _more_ctxpopup_back_cb); + evas_object_smart_callback_del(view->more_ctxpopup, "dismissed", _more_ctxpopup_dismissed_cb); + evas_object_event_callback_del(view->more_ctxpopup, EVAS_CALLBACK_DEL, _delete_more_ctxpopup_cb); } void _sync_toolbar_clicked_cb(void *data, Evas_Object *obj, void *event_info) { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - DELETE_EVAS_OBJECT(mailbox_ugd->more_ctxpopup); + DELETE_EVAS_OBJECT(view->more_ctxpopup); - mailbox_sync_current_mailbox(mailbox_ugd); + mailbox_sync_current_mailbox(view); } static void _compose_toolbar_clicked_cb(void *data, Evas_Object *obj, void *event_info) { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - RETURN_IF_FAIL(mailbox_ugd != NULL); + EmailMailboxView *view = (EmailMailboxView *)data; + RETURN_IF_FAIL(view != NULL); - retm_if(mailbox_ugd->is_module_launching, "is_module_launching is true;"); - mailbox_ugd->is_module_launching = true; + retm_if(view->is_module_launching, "is_module_launching is true;"); + view->is_module_launching = true; int account_id = 0; - DELETE_EVAS_OBJECT(mailbox_ugd->more_ctxpopup); - DELETE_EVAS_OBJECT(mailbox_ugd->error_popup); + DELETE_EVAS_OBJECT(view->more_ctxpopup); + DELETE_EVAS_OBJECT(view->error_popup); - if (mailbox_ugd->account_count == 0) { - mailbox_create_timeout_popup(mailbox_ugd, _("IDS_ST_HEADER_WARNING"), + if (view->account_count == 0) { + mailbox_create_timeout_popup(view, _("IDS_ST_HEADER_WARNING"), _("IDS_EMAIL_POP_YOU_HAVE_NOT_YET_CREATED_AN_EMAIL_ACCOUNT_CREATE_AN_EMAIL_ACCOUNT_AND_TRY_AGAIN"), 3.0); - mailbox_ugd->is_module_launching = false; + view->is_module_launching = false; return; } - if (mailbox_ugd->composer) { - debug_log("Composer UG is already launched"); - mailbox_ugd->is_module_launching = false; + if (view->composer) { + debug_log("Composer module is already launched"); + view->is_module_launching = false; return; } - mailbox_sync_cancel_all(mailbox_ugd); + mailbox_sync_cancel_all(view); gint composer_type = RUN_COMPOSER_NEW; - account_id = mailbox_ugd->account_id; + account_id = view->account_id; if (account_id == 0) { /* If user execute all emails view, we will use default account id */ int default_account_id = 0; if (!email_engine_get_default_account(&default_account_id)) { @@ -287,7 +287,7 @@ static void _compose_toolbar_clicked_cb(void *data, Evas_Object *obj, void *even if (account_id <= 0) { debug_log("No account"); - mailbox_ugd->is_module_launching = false; + view->is_module_launching = false; return; } @@ -300,20 +300,20 @@ static void _compose_toolbar_clicked_cb(void *data, Evas_Object *obj, void *even email_params_add_int(params, EMAIL_BUNDLE_KEY_RUN_TYPE, composer_type) && email_params_add_int(params, EMAIL_BUNDLE_KEY_ACCOUNT_ID, account_id)) { - mailbox_ugd->composer = mailbox_composer_module_create(mailbox_ugd, EMAIL_MODULE_COMPOSER, params); + view->composer = mailbox_composer_module_create(view, EMAIL_MODULE_COMPOSER, params); } else { - mailbox_ugd->is_module_launching = false; + view->is_module_launching = false; } email_params_free(¶ms); debug_leave(); } -static Elm_Object_Item *_add_ctx_menu_item(EmailMailboxUGD *mailbox_ugd, const char *str, Evas_Object *icon, Evas_Smart_Cb cb) +static Elm_Object_Item *_add_ctx_menu_item(EmailMailboxView *view, const char *str, Evas_Object *icon, Evas_Smart_Cb cb) { Elm_Object_Item *ctx_menu_item = NULL; - ctx_menu_item = elm_ctxpopup_item_append(mailbox_ugd->more_ctxpopup, str, icon, cb, mailbox_ugd); + ctx_menu_item = elm_ctxpopup_item_append(view->more_ctxpopup, str, icon, cb, view); elm_object_item_domain_text_translatable_set(ctx_menu_item, PACKAGE, EINA_TRUE); return ctx_menu_item; } @@ -323,75 +323,75 @@ static void _more_toolbar_clicked_cb(void *data, Evas_Object *obj, void *event_i debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - - retm_if(mailbox_ugd->composer, "mailbox_ugd->composer(%p) is being shown.", mailbox_ugd->composer); - retm_if(mailbox_ugd->viewer, "mailbox_ugd->viewer(%p) is being shown.", mailbox_ugd->viewer); - retm_if(mailbox_ugd->account, "mailbox_ugd->account(%p) is being shown.", mailbox_ugd->account); - debug_log("b_searchmode: %d, b_editmode: %d", mailbox_ugd->b_searchmode, mailbox_ugd->b_editmode); - retm_if(mailbox_ugd->b_searchmode, "mailbox_ugd->b_searchmode(%d) Search mode is ON.", mailbox_ugd->b_searchmode); - retm_if(mailbox_ugd->b_editmode, "mailbox_ugd->b_editmode(%d) Edit mode is ON.", mailbox_ugd->b_editmode); - - mailbox_ugd->more_ctxpopup = elm_ctxpopup_add(mailbox_ugd->base.module->win); - - elm_ctxpopup_auto_hide_disabled_set(mailbox_ugd->more_ctxpopup, EINA_TRUE); - elm_object_style_set(mailbox_ugd->more_ctxpopup, "more/default"); - eext_object_event_callback_add(mailbox_ugd->more_ctxpopup, EEXT_CALLBACK_BACK, _more_ctxpopup_back_cb, mailbox_ugd); - eext_object_event_callback_add(mailbox_ugd->more_ctxpopup, EEXT_CALLBACK_MORE, _more_ctxpopup_back_cb, mailbox_ugd); - evas_object_smart_callback_add(mailbox_ugd->more_ctxpopup, "dismissed", _more_ctxpopup_dismissed_cb, mailbox_ugd); - - evas_object_event_callback_add(mailbox_ugd->more_ctxpopup, EVAS_CALLBACK_DEL, _delete_more_ctxpopup_cb, mailbox_ugd); - evas_object_event_callback_add(mailbox_ugd->base.module->navi, EVAS_CALLBACK_RESIZE, _resize_more_ctxpopup_cb, mailbox_ugd); - - _add_ctx_menu_item(mailbox_ugd, "IDS_EMAIL_OPT_REFRESH", NULL, _sync_toolbar_clicked_cb); - _add_ctx_menu_item(mailbox_ugd, "IDS_EMAIL_OPT_SEARCH", NULL, _search_button_clicked_cb); - - if (g_list_length(mailbox_ugd->mail_list) > 0) { - _add_ctx_menu_item(mailbox_ugd, "IDS_EMAIL_OPT_DELETE", NULL, _more_edit_delete_mode_cb); - if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX - || mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_TRASH - || mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_SPAMBOX - || mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_USER_DEFINED) { - _add_ctx_menu_item(mailbox_ugd, "IDS_EMAIL_OPT_MOVE", NULL, _more_edit_move_mode_cb); - if (mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_SPAMBOX) { - _add_ctx_menu_item(mailbox_ugd, "IDS_EMAIL_OPT_MOVE_TO_SPAMBOX", NULL, _more_edit_spam_mode_cb); + EmailMailboxView *view = (EmailMailboxView *)data; + + retm_if(view->composer, "view->composer(%p) is being shown.", view->composer); + retm_if(view->viewer, "view->viewer(%p) is being shown.", view->viewer); + retm_if(view->account, "view->account(%p) is being shown.", view->account); + debug_log("b_searchmode: %d, b_editmode: %d", view->b_searchmode, view->b_editmode); + retm_if(view->b_searchmode, "view->b_searchmode(%d) Search mode is ON.", view->b_searchmode); + retm_if(view->b_editmode, "view->b_editmode(%d) Edit mode is ON.", view->b_editmode); + + view->more_ctxpopup = elm_ctxpopup_add(view->base.module->win); + + elm_ctxpopup_auto_hide_disabled_set(view->more_ctxpopup, EINA_TRUE); + elm_object_style_set(view->more_ctxpopup, "more/default"); + eext_object_event_callback_add(view->more_ctxpopup, EEXT_CALLBACK_BACK, _more_ctxpopup_back_cb, view); + eext_object_event_callback_add(view->more_ctxpopup, EEXT_CALLBACK_MORE, _more_ctxpopup_back_cb, view); + evas_object_smart_callback_add(view->more_ctxpopup, "dismissed", _more_ctxpopup_dismissed_cb, view); + + evas_object_event_callback_add(view->more_ctxpopup, EVAS_CALLBACK_DEL, _delete_more_ctxpopup_cb, view); + evas_object_event_callback_add(view->base.module->navi, EVAS_CALLBACK_RESIZE, _resize_more_ctxpopup_cb, view); + + _add_ctx_menu_item(view, "IDS_EMAIL_OPT_REFRESH", NULL, _sync_toolbar_clicked_cb); + _add_ctx_menu_item(view, "IDS_EMAIL_OPT_SEARCH", NULL, _search_button_clicked_cb); + + if (g_list_length(view->mail_list) > 0) { + _add_ctx_menu_item(view, "IDS_EMAIL_OPT_DELETE", NULL, _more_edit_delete_mode_cb); + if (view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX + || view->mailbox_type == EMAIL_MAILBOX_TYPE_TRASH + || view->mailbox_type == EMAIL_MAILBOX_TYPE_SPAMBOX + || view->mailbox_type == EMAIL_MAILBOX_TYPE_USER_DEFINED) { + _add_ctx_menu_item(view, "IDS_EMAIL_OPT_MOVE", NULL, _more_edit_move_mode_cb); + if (view->mailbox_type != EMAIL_MAILBOX_TYPE_SPAMBOX) { + _add_ctx_menu_item(view, "IDS_EMAIL_OPT_MOVE_TO_SPAMBOX", NULL, _more_edit_spam_mode_cb); } else { - _add_ctx_menu_item(mailbox_ugd, "IDS_EMAIL_OPT_REMOVE_FROM_SPAM_ABB", NULL, _more_edit_remove_spam_mode_cb); + _add_ctx_menu_item(view, "IDS_EMAIL_OPT_REMOVE_FROM_SPAM_ABB", NULL, _more_edit_remove_spam_mode_cb); } } - if (mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_DRAFT - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_TRASH && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_SPAMBOX) { - _add_ctx_menu_item(mailbox_ugd, "IDS_EMAIL_OPT_MARK_AS_READ_ABB", NULL, _more_edit_read_mode_cb); - _add_ctx_menu_item(mailbox_ugd, "IDS_EMAIL_OPT_MARK_AS_UNREAD_ABB", NULL, _more_edit_unread_mode_cb); + if (view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX && view->mailbox_type != EMAIL_MAILBOX_TYPE_DRAFT + && view->mailbox_type != EMAIL_MAILBOX_TYPE_TRASH && view->mailbox_type != EMAIL_MAILBOX_TYPE_SPAMBOX) { + _add_ctx_menu_item(view, "IDS_EMAIL_OPT_MARK_AS_READ_ABB", NULL, _more_edit_read_mode_cb); + _add_ctx_menu_item(view, "IDS_EMAIL_OPT_MARK_AS_UNREAD_ABB", NULL, _more_edit_unread_mode_cb); } } - _add_ctx_menu_item(mailbox_ugd, "IDS_EMAIL_OPT_SETTINGS", NULL, _settings_cb); + _add_ctx_menu_item(view, "IDS_EMAIL_OPT_SETTINGS", NULL, _settings_cb); - elm_ctxpopup_direction_priority_set(mailbox_ugd->more_ctxpopup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN); - _move_more_ctxpopup(mailbox_ugd->more_ctxpopup, mailbox_ugd->base.module->win); + elm_ctxpopup_direction_priority_set(view->more_ctxpopup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN); + _move_more_ctxpopup(view->more_ctxpopup, view->base.module->win); - evas_object_show(mailbox_ugd->more_ctxpopup); + evas_object_show(view->more_ctxpopup); } -static void _change_view_for_selection_mode(EmailMailboxUGD *mailbox_ugd) +static void _change_view_for_selection_mode(EmailMailboxView *view) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd is NULL"); - elm_genlist_realized_items_update(mailbox_ugd->gl); + retm_if(!view, "view is NULL"); + elm_genlist_realized_items_update(view->gl); - if ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL - || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { - mailbox_send_all_btn_remove(mailbox_ugd); + if ((view->mode == EMAIL_MAILBOX_MODE_ALL + || view->mode == EMAIL_MAILBOX_MODE_MAILBOX) + && view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { + mailbox_send_all_btn_remove(view); } /* Last updated item should be removed after select all item is added. */ - mailbox_select_all_item_add(mailbox_ugd); - mailbox_remove_unnecessary_list_item_for_edit_mode(mailbox_ugd); + mailbox_select_all_item_add(view); + mailbox_remove_unnecessary_list_item_for_edit_mode(view); - mailbox_hide_compose_btn(mailbox_ugd); - if (mailbox_ugd->btn_mailbox) - mailbox_naviframe_mailbox_button_remove(mailbox_ugd); + mailbox_hide_compose_btn(view); + if (view->btn_mailbox) + mailbox_naviframe_mailbox_button_remove(view); } @@ -399,29 +399,29 @@ static void _change_view_for_selection_mode(EmailMailboxUGD *mailbox_ugd) * Definition for exported functions */ -Evas_Object *mailbox_create_toolbar_more_btn(EmailMailboxUGD *mailbox_ugd) +Evas_Object *mailbox_create_toolbar_more_btn(EmailMailboxView *view) { debug_enter(); - Evas_Object *btn = elm_button_add(mailbox_ugd->base.module->navi); + Evas_Object *btn = elm_button_add(view->base.module->navi); if (!btn) return NULL; elm_object_style_set(btn, "naviframe/more/default"); - evas_object_smart_callback_add(btn, "clicked", _more_toolbar_clicked_cb, mailbox_ugd); + evas_object_smart_callback_add(btn, "clicked", _more_toolbar_clicked_cb, view); return btn; } -void mailbox_create_compose_btn(EmailMailboxUGD *mailbox_ugd) +void mailbox_create_compose_btn(EmailMailboxView *view) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd is NULL"); + retm_if(!view, "view is NULL"); - Evas_Object *floating_btn = eext_floatingbutton_add(mailbox_ugd->base.content); - elm_object_part_content_set(mailbox_ugd->base.content, "elm.swallow.floatingbutton", floating_btn); + Evas_Object *floating_btn = eext_floatingbutton_add(view->base.content); + elm_object_part_content_set(view->base.content, "elm.swallow.floatingbutton", floating_btn); evas_object_repeat_events_set(floating_btn, EINA_FALSE); Evas_Object *btn = elm_button_add(floating_btn); elm_object_part_content_set(floating_btn, "button1", btn); - evas_object_smart_callback_add(btn, "clicked", _compose_toolbar_clicked_cb, mailbox_ugd); + evas_object_smart_callback_add(btn, "clicked", _compose_toolbar_clicked_cb, view); Evas_Object *img = elm_layout_add(btn); elm_layout_file_set(img, email_get_common_theme_path(), EMAIL_IMAGE_COMPOSE_BUTTON); @@ -429,33 +429,33 @@ void mailbox_create_compose_btn(EmailMailboxUGD *mailbox_ugd) evas_object_show(img); evas_object_show(floating_btn); - mailbox_ugd->compose_btn = floating_btn; + view->compose_btn = floating_btn; debug_leave(); } -void mailbox_show_compose_btn(EmailMailboxUGD *mailbox_ugd) +void mailbox_show_compose_btn(EmailMailboxView *view) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd is NULL"); + retm_if(!view, "view is NULL"); - if (mailbox_ugd->compose_btn && !mailbox_ugd->b_editmode && !mailbox_ugd->b_searchmode) { - elm_object_part_content_set(mailbox_ugd->base.content, "elm.swallow.floatingbutton", mailbox_ugd->compose_btn); - evas_object_repeat_events_set(mailbox_ugd->compose_btn, EINA_FALSE); - evas_object_show(mailbox_ugd->compose_btn); + if (view->compose_btn && !view->b_editmode && !view->b_searchmode) { + elm_object_part_content_set(view->base.content, "elm.swallow.floatingbutton", view->compose_btn); + evas_object_repeat_events_set(view->compose_btn, EINA_FALSE); + evas_object_show(view->compose_btn); } debug_leave(); } -void mailbox_hide_compose_btn(EmailMailboxUGD *mailbox_ugd) +void mailbox_hide_compose_btn(EmailMailboxView *view) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd is NULL"); + retm_if(!view, "view is NULL"); - if (mailbox_ugd->compose_btn) { - elm_object_part_content_unset(mailbox_ugd->base.content, "elm.swallow.floatingbutton"); - evas_object_hide(mailbox_ugd->compose_btn); + if (view->compose_btn) { + elm_object_part_content_unset(view->base.content, "elm.swallow.floatingbutton"); + evas_object_hide(view->compose_btn); } debug_leave(); } diff --git a/Project-Files/modules/mailbox/src/email-mailbox-noti-mgr.c b/Project-Files/modules/mailbox/src/email-mailbox-noti-mgr.c index 74f5433..aa2a48d 100644 --- a/Project-Files/modules/mailbox/src/email-mailbox-noti-mgr.c +++ b/Project-Files/modules/mailbox/src/email-mailbox-noti-mgr.c @@ -25,7 +25,7 @@ #include "email-mailbox-noti-mgr.h" #include "email-mailbox-request.h" #include "email-mailbox-title.h" -#include "email-mailbox-ug-util.h" +#include "email-mailbox-module-util.h" #include "email-mailbox-util.h" #include "email-mailbox-toolbar.h" @@ -39,8 +39,8 @@ static void _parse_set_rule_buf(char *inbuf, GList **mail_list); static void _parse_set_move_buf(char *inbuf, int *from_box_id, int *to_box_id, GList **mail_list); static void _parse_set_flag_buf(char *inbuf, char **field_name, GList **mail_list); static Eina_Bool _check_req_handle_list(int handle); -static void _sending_mail_list_add_mail_id(EmailMailboxUGD *mailbox_ugd, int mail_id); -static Eina_Bool _check_sending_mail_list(EmailMailboxUGD *mailbox_ugd, int mail_id); +static void _sending_mail_list_add_mail_id(EmailMailboxView *view, int mail_id); +static Eina_Bool _check_sending_mail_list(EmailMailboxView *view, int mail_id); static Eina_Bool _check_req_account_list(int account); static void _mailbox_remove_deleted_flag_mail(int mail_id, void *data); @@ -71,9 +71,9 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, debug_enter(); debug_secure("Object path=%s, interface name=%s, signal name=%s", object_path, interface_name, signal_name); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - if (mailbox_ugd == NULL) { + if (view == NULL) { debug_warning("data is NULL"); return; } @@ -96,7 +96,7 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, int mailid = 0; int mailbox_id = 0; int err = 0; - email_sort_type_e sort_type = mailbox_ugd->sort_type; + email_sort_type_e sort_type = view->sort_type; email_mailbox_type_e mailbox_type = EMAIL_MAILBOX_TYPE_NONE; email_mailbox_t *mailbox = NULL; email_account_t *account = NULL; @@ -109,7 +109,7 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, case NOTI_ACCOUNT_ADD: debug_trace("NOTI_ACCOUNT_ADD"); - if (mailbox_ugd->b_restoring) { + if (view->b_restoring) { debug_trace("email account is being restored now."); break; } @@ -117,19 +117,19 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, account_id = data1; if (email_engine_get_account_list(&account_count, &account_list)) - mailbox_ugd->account_count = account_count; + view->account_count = account_count; else - mailbox_ugd->account_count = 0; + view->account_count = 0; if (account_list) email_engine_free_account_list(&account_list, account_count); - /* destroy all top ug and refresh all emails */ - if (mailbox_ugd->account) { - mailbox_account_module_destroy(mailbox_ugd, mailbox_ugd->account); + /* destroy all top modules and refresh all emails */ + if (view->account) { + mailbox_account_module_destroy(view, view->account); } - if (mailbox_ugd->composer) { - mailbox_composer_module_destroy(mailbox_ugd, mailbox_ugd->composer); + if (view->composer) { + mailbox_composer_module_destroy(view, view->composer); } err = email_get_account(account_id, EMAIL_ACC_GET_OPT_DEFAULT, &account); @@ -140,40 +140,40 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, break; } - mailbox_hide_no_contents_view(mailbox_ugd); + mailbox_hide_no_contents_view(view); - mailbox_ugd->account_id = account_id; - mailbox_ugd->account_type = account->incoming_server_type; - mailbox_ugd->mode = EMAIL_MAILBOX_MODE_MAILBOX; - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; + view->account_id = account_id; + view->account_type = account->incoming_server_type; + view->mode = EMAIL_MAILBOX_MODE_MAILBOX; + view->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; - mailbox_account_color_list_add(mailbox_ugd, account_id, account->color_label); + mailbox_account_color_list_add(view, account_id, account->color_label); - G_FREE(mailbox_ugd->account_name); - G_FREE(mailbox_ugd->mailbox_alias); + G_FREE(view->account_name); + G_FREE(view->mailbox_alias); - mailbox_ugd->account_name = g_strdup(account->user_email_address); + view->account_name = g_strdup(account->user_email_address); email_free_account(&account, 1); - err = email_get_mailbox_by_mailbox_type(mailbox_ugd->account_id, EMAIL_MAILBOX_TYPE_INBOX, &mailbox); + err = email_get_mailbox_by_mailbox_type(view->account_id, EMAIL_MAILBOX_TYPE_INBOX, &mailbox); if (err == EMAIL_ERROR_NONE && mailbox) { - mailbox_ugd->mailbox_id = mailbox->mailbox_id; + view->mailbox_id = mailbox->mailbox_id; email_free_mailbox(&mailbox, 1); } else { - mailbox_ugd->mailbox_id = 0; - debug_warning("email_get_mailbox_by_mailbox_type : account_id(%d) type(INBOX) - err(%d) or mailbox is NULL(%p)", mailbox_ugd->account_id, err, mailbox); + view->mailbox_id = 0; + debug_warning("email_get_mailbox_by_mailbox_type : account_id(%d) type(INBOX) - err(%d) or mailbox is NULL(%p)", view->account_id, err, mailbox); } - if (mailbox_ugd->b_editmode) { - mailbox_exit_edit_mode(mailbox_ugd); + if (view->b_editmode) { + mailbox_exit_edit_mode(view); } - mailbox_view_title_update_all(mailbox_ugd); - mailbox_update_notifications_status(mailbox_ugd); - mailbox_list_refresh(mailbox_ugd, NULL); - mailbox_load_more_messages_item_remove(mailbox_ugd); - mailbox_no_more_emails_item_remove(mailbox_ugd); + mailbox_view_title_update_all(view); + mailbox_update_notifications_status(view); + mailbox_list_refresh(view, NULL); + mailbox_load_more_messages_item_remove(view); + mailbox_no_more_emails_item_remove(view); mailbox_req_handle_list_free(); @@ -182,73 +182,73 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, case NOTI_ACCOUNT_DELETE: debug_log("NOTI_ACCOUNT_DELETE"); - if (mailbox_ugd->b_restoring) { + if (view->b_restoring) { debug_trace("email account is being restored now."); break; } account_id = data1; - mailbox_ugd->account_count--; - mailbox_account_color_list_remove(mailbox_ugd, account_id); + view->account_count--; + mailbox_account_color_list_remove(view, account_id); - /* destroy all top ug and refresh all emails */ - if (mailbox_ugd->account) { - mailbox_account_module_destroy(mailbox_ugd, mailbox_ugd->account); + /* destroy all top modules and refresh all emails */ + if (view->account) { + mailbox_account_module_destroy(view, view->account); } - if (mailbox_ugd->composer) { - mailbox_composer_module_destroy(mailbox_ugd, mailbox_ugd->composer); + if (view->composer) { + mailbox_composer_module_destroy(view, view->composer); } - if (mailbox_ugd->account_count <= 0) { + if (view->account_count <= 0) { debug_log("no account exists"); email_set_need_restart_flag(true); - email_module_make_destroy_request(mailbox_ugd->base.module); + email_module_make_destroy_request(view->base.module); return; } - if (mailbox_ugd->account_id == 0 || mailbox_ugd->account_id == account_id) { - if (mailbox_ugd->account_count == 1) { + if (view->account_id == 0 || view->account_id == account_id) { + if (view->account_count == 1) { int err = 0; email_mailbox_t *mailbox = NULL; int default_account_id = 0; if (email_engine_get_default_account(&default_account_id)) { - mailbox_ugd->account_id = default_account_id; + view->account_id = default_account_id; - err = email_get_mailbox_by_mailbox_type(mailbox_ugd->account_id, EMAIL_MAILBOX_TYPE_INBOX, &mailbox); + err = email_get_mailbox_by_mailbox_type(view->account_id, EMAIL_MAILBOX_TYPE_INBOX, &mailbox); if (err == EMAIL_ERROR_NONE && mailbox) { - mailbox_ugd->mailbox_id = mailbox->mailbox_id; + view->mailbox_id = mailbox->mailbox_id; } else { - mailbox_ugd->mailbox_id = 0; - debug_warning("email_get_mailbox_by_mailbox_type : account_id(%d) type(INBOX) - err(%d) or mailbox is NULL(%p)", mailbox_ugd->account_id, err, mailbox); + view->mailbox_id = 0; + debug_warning("email_get_mailbox_by_mailbox_type : account_id(%d) type(INBOX) - err(%d) or mailbox is NULL(%p)", view->account_id, err, mailbox); } if (mailbox) email_free_mailbox(&mailbox, 1); - mailbox_ugd->mode = EMAIL_MAILBOX_MODE_MAILBOX; - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; + view->mode = EMAIL_MAILBOX_MODE_MAILBOX; + view->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; } else { debug_log("email_engine_get_default_account failed"); } } else { - mailbox_ugd->account_id = 0; - mailbox_ugd->mode = EMAIL_MAILBOX_MODE_ALL; - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; - mailbox_ugd->mailbox_id = 0; - G_FREE(mailbox_ugd->account_name); - G_FREE(mailbox_ugd->mailbox_alias); + view->account_id = 0; + view->mode = EMAIL_MAILBOX_MODE_ALL; + view->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; + view->mailbox_id = 0; + G_FREE(view->account_name); + G_FREE(view->mailbox_alias); } - if (mailbox_ugd->b_editmode) - mailbox_exit_edit_mode(mailbox_ugd); + if (view->b_editmode) + mailbox_exit_edit_mode(view); - if (mailbox_ugd->b_searchmode) - mailbox_finish_search_mode(mailbox_ugd); + if (view->b_searchmode) + mailbox_finish_search_mode(view); - mailbox_view_title_update_all(mailbox_ugd); - mailbox_update_notifications_status(mailbox_ugd); - mailbox_list_refresh(mailbox_ugd, NULL); + mailbox_view_title_update_all(view); + mailbox_update_notifications_status(view); + mailbox_list_refresh(view, NULL); } break; @@ -263,26 +263,26 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, return; } if (account) { - mailbox_account_color_list_update(mailbox_ugd, account_id, account->color_label); + mailbox_account_color_list_update(view, account_id, account->color_label); email_engine_free_account_list(&account, 1); } - if (account_id == mailbox_ugd->account_id) - mailbox_view_title_update_account_name(mailbox_ugd); + if (account_id == view->account_id) + mailbox_view_title_update_account_name(view); break; case NOTI_ACCOUNT_UPDATE_SYNC_STATUS: debug_log("NOTI_ACCOUNT_UPDATE_SYNC_STATUS"); account_id = data1; - if (data2 == SYNC_STATUS_FINISHED && (mailbox_ugd->account_id == 0 || mailbox_ugd->account_id == account_id)) { - mailbox_view_title_update_mail_count(mailbox_ugd); + if (data2 == SYNC_STATUS_FINISHED && (view->account_id == 0 || view->account_id == account_id)) { + mailbox_view_title_update_mail_count(view); } if (data2 == SYNC_STATUS_HAVE_NEW_MAILS - && mailbox_ugd->base.state == EV_STATE_ACTIVE - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX - && mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX - && mailbox_ugd->account_id != account_id) { + && view->base.state == EV_STATE_ACTIVE + && view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX + && view->mode == EMAIL_MAILBOX_MODE_MAILBOX + && view->account_id != account_id) { debug_log("update notification bar(%d)", account_id); email_update_notification_bar(account_id, 0, 0, 0); } @@ -294,12 +294,12 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, mailbox_id = data2; mailbox_type = data4; - if (mailbox_ugd->account_id == account_id - && mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX - && mailbox_ugd->mailbox_type == mailbox_type - && mailbox_ugd->mailbox_id == 0) { - mailbox_ugd->mailbox_id = mailbox_id; - debug_log("mailbox_ugd->mailbox_id(%d) is set", mailbox_ugd->mailbox_id); + if (view->account_id == account_id + && view->mode == EMAIL_MAILBOX_MODE_MAILBOX + && view->mailbox_type == mailbox_type + && view->mailbox_id == 0) { + view->mailbox_id = mailbox_id; + debug_log("view->mailbox_id(%d) is set", view->mailbox_id); } break; @@ -309,17 +309,17 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, account_id = data1; mailbox_id = data2; - if (mailbox_ugd->mailbox_id == data2 && mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) { - mailbox_ugd->mailbox_id = GET_MAILBOX_ID(account_id, EMAIL_MAILBOX_TYPE_INBOX); - debug_log("current folder view is destroyed.(mailbox_id : %d -> %d)", data2, mailbox_ugd->mailbox_id); - if (mailbox_ugd->b_editmode) { - mailbox_exit_edit_mode(mailbox_ugd); - } else if (mailbox_ugd->b_searchmode) { - mailbox_finish_search_mode(mailbox_ugd); + if (view->mailbox_id == data2 && view->mode == EMAIL_MAILBOX_MODE_MAILBOX) { + view->mailbox_id = GET_MAILBOX_ID(account_id, EMAIL_MAILBOX_TYPE_INBOX); + debug_log("current folder view is destroyed.(mailbox_id : %d -> %d)", data2, view->mailbox_id); + if (view->b_editmode) { + mailbox_exit_edit_mode(view); + } else if (view->b_searchmode) { + mailbox_finish_search_mode(view); } - mailbox_view_title_update_all(mailbox_ugd); - mailbox_check_sort_type_validation(mailbox_ugd); - mailbox_list_refresh(mailbox_ugd, NULL); + mailbox_view_title_update_all(view); + mailbox_check_sort_type_validation(view); + mailbox_list_refresh(view, NULL); } break; @@ -358,19 +358,19 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, } debug_log("account_id : %d, from_box_id= %d, to_box_id =%d, size of moved_count : %d", account_id, from_box_id, to_box_id, moved_count); - if (mailbox_ugd->move_status == EMAIL_ERROR_NONE) { - mailbox_ugd->move_status = -1; - if (mailbox_ugd->moved_mailbox_name) { + if (view->move_status == EMAIL_ERROR_NONE) { + view->move_status = -1; + if (view->moved_mailbox_name) { if (moved_count == 1) { char str[MAX_STR_LEN] = { 0, }; - snprintf(str, sizeof(str), email_get_email_string("IDS_EMAIL_TPOP_1_EMAIL_MOVED_TO_PS"), mailbox_ugd->moved_mailbox_name); + snprintf(str, sizeof(str), email_get_email_string("IDS_EMAIL_TPOP_1_EMAIL_MOVED_TO_PS"), view->moved_mailbox_name); ret = notification_status_message_post(str); } else { char str[MAX_STR_LEN] = { 0, }; - snprintf(str, sizeof(str), email_get_email_string("IDS_EMAIL_TPOP_P1SD_EMAILS_MOVED_TO_P2SS"), moved_count, mailbox_ugd->moved_mailbox_name); + snprintf(str, sizeof(str), email_get_email_string("IDS_EMAIL_TPOP_P1SD_EMAILS_MOVED_TO_P2SS"), moved_count, view->moved_mailbox_name); ret = notification_status_message_post(str); } - G_FREE(mailbox_ugd->moved_mailbox_name); + G_FREE(view->moved_mailbox_name); } else { if (moved_count == 1) { ret = notification_status_message_post(email_get_email_string("IDS_EMAIL_TPOP_1_EMAIL_MOVED_TO_SELECTED_FOLDER")); @@ -383,25 +383,25 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, if (ret != NOTIFICATION_ERROR_NONE) { debug_log("notification_status_message_post() failed: %d", ret); } - } else if (mailbox_ugd->need_deleted_noti) { - mailbox_ugd->need_deleted_noti = false; + } else if (view->need_deleted_noti) { + view->need_deleted_noti = false; } if (sort_type == EMAIL_SORT_SENDER_ATOZ || sort_type == EMAIL_SORT_SENDER_ZTOA || sort_type == EMAIL_SORT_RCPT_ATOZ || sort_type == EMAIL_SORT_RCPT_ZTOA || sort_type == EMAIL_SORT_SUBJECT_ATOZ || sort_type == EMAIL_SORT_SUBJECT_ZTOA) { - mailbox_list_refresh(mailbox_ugd, NULL); + mailbox_list_refresh(view, NULL); } else { MoveMailReqData *req = MEM_ALLOC(req, 1); retm_if(!req, "req is NULL"); - *req = (MoveMailReqData) {account_id, 0, g_strdup(msg_buf), mailbox_ugd}; + *req = (MoveMailReqData) {account_id, 0, g_strdup(msg_buf), view}; - if (!email_request_queue_add_request(mailbox_ugd->request_queue, EMAIL_REQUEST_TYPE_MOVE_MAIL, req)) { + if (!email_request_queue_add_request(view->request_queue, EMAIL_REQUEST_TYPE_MOVE_MAIL, req)) { debug_error("failed to add request EMAIL_REQUEST_TYPE_MOVE_WORKER"); free(req); } - mailbox_view_title_update_mail_count(mailbox_ugd); + mailbox_view_title_update_mail_count(view); } break; @@ -420,13 +420,13 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, case NOTI_MAIL_MOVE_FAIL: debug_log("NOTI_MAIL_MOVE_FAIL"); - debug_log("move status is %d, %d", mailbox_ugd->move_status, EMAIL_ERROR_NONE); + debug_log("move status is %d, %d", view->move_status, EMAIL_ERROR_NONE); int ret = 1; - if (mailbox_ugd->move_status != EMAIL_ERROR_NONE) { + if (view->move_status != EMAIL_ERROR_NONE) { ret = notification_status_message_post(email_get_email_string("IDS_EMAIL_POP_FAILED_TO_MOVE")); - } else if (mailbox_ugd->need_deleted_noti) { + } else if (view->need_deleted_noti) { ret = notification_status_message_post(email_get_email_string("IDS_EMAIL_POP_FAILED_TO_MOVE")); - mailbox_ugd->need_deleted_noti = false; + view->need_deleted_noti = false; } if (ret != NOTIFICATION_ERROR_NONE) { debug_log("notification_status_message_post() failed: %d", ret); @@ -438,36 +438,36 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, account_id = data1; msg_buf = data3; - if (mailbox_ugd->need_deleted_noti) { - /*if(mailbox_ugd->mode == EMAIL_MAILBOX_MODE_SCHEDULED_OUTBOX) + if (view->need_deleted_noti) { + /*if(view->mode == EMAIL_MAILBOX_MODE_SCHEDULED_OUTBOX) notification_status_message_post(_("IDS_EMAIL_BODY_SCHEDULED_EMAIL_DELETED")); else notification_status_message_post(dgettext(PACKAGE, "IDS_EMAIL_BUTTON_DELETE_ABB4")); */ - mailbox_ugd->need_deleted_noti = false; + view->need_deleted_noti = false; } DeleteMailReqData *req = MEM_ALLOC(req, 1); retm_if(!req, "req is NULL"); /* this dynamic var should be freed in NotiCB */ - *req = (DeleteMailReqData) {account_id, 0, g_strdup(msg_buf), mailbox_ugd}; + *req = (DeleteMailReqData) {account_id, 0, g_strdup(msg_buf), view}; - if (!email_request_queue_add_request(mailbox_ugd->request_queue, EMAIL_REQUEST_TYPE_DELETE_MAIL, req)) { + if (!email_request_queue_add_request(view->request_queue, EMAIL_REQUEST_TYPE_DELETE_MAIL, req)) { debug_error("failed to add request EMAIL_REQUEST_TYPE_DELETE_WORKER"); free(req); } - mailbox_view_title_update_mail_count(mailbox_ugd); + mailbox_view_title_update_mail_count(view); break; case NOTI_MAIL_DELETE_FAIL: debug_log("NOTI_MAIL_DELETE_FAIL"); - if (mailbox_ugd->need_deleted_noti) { + if (view->need_deleted_noti) { int ret = notification_status_message_post(email_get_email_string("IDS_EMAIL_POP_FAILED_TO_DELETE")); if (ret != NOTIFICATION_ERROR_NONE) { debug_log("notification_status_message_post() failed: %d", ret); } - mailbox_ugd->need_deleted_noti = false; + view->need_deleted_noti = false; } break; @@ -478,24 +478,24 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, mailid = data2; mailbox_id = atoi(data3); - debug_log("mailbox_ugd->mode(%d), mailbox_ugd->mailbox_type(%d), mailbox_ugd->mailbox_id(%d)", - mailbox_ugd->mode, mailbox_ugd->mailbox_type, mailbox_ugd->mailbox_id); + debug_log("view->mode(%d), view->mailbox_type(%d), view->mailbox_id(%d)", + view->mode, view->mailbox_type, view->mailbox_id); - if ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL && mailbox_ugd->mailbox_type == GET_MAILBOX_TYPE(mailbox_id)) - || (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->mailbox_id == mailbox_id)) { + if ((view->mode == EMAIL_MAILBOX_MODE_ALL && view->mailbox_type == GET_MAILBOX_TYPE(mailbox_id)) + || (view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->mailbox_id == mailbox_id)) { AddMailReqData *req = MEM_ALLOC(req, 1); retm_if(!req, "req is NULL"); /* this dynamic variable(req) should be freed in func_notify */ - *req = (AddMailReqData) {account_id, thread_id, mailid, mailbox_id, mailbox_ugd->mailbox_type, true, - mailbox_ugd->mode, mailbox_ugd}; + *req = (AddMailReqData) {account_id, thread_id, mailid, mailbox_id, view->mailbox_type, true, + view->mode, view}; - if (!email_request_queue_add_request(mailbox_ugd->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { + if (!email_request_queue_add_request(view->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { debug_error("failed to add request EMAIL_REQUEST_TYPE_ADD_MAIL_WORKER"); free(req); } } #ifndef _FEATURE_PRIORITY_SENDER_DISABLE_ - else if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { + else if (view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { email_mail_list_item_t *mail_info = NULL; mail_info = email_engine_get_mail_by_mailid(mailid); if (!mail_info) break; @@ -505,10 +505,10 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, AddMailReqData *req = MEM_ALLOC(req, 1); retm_if(!req, "req is NULL"); /* this dynamic variable(req) should be freed in func_notify */ - *req = (AddMailReqData) {account_id, thread_id, mailid, mailbox_id, mailbox_ugd->mailbox_type, true, - mailbox_ugd->mode, mailbox_ugd}; + *req = (AddMailReqData) {account_id, thread_id, mailid, mailbox_id, view->mailbox_type, true, + view->mode, view}; - if (!email_request_queue_add_request(mailbox_ugd->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { + if (!email_request_queue_add_request(view->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { debug_error("failed to add request EMAIL_REQUEST_TYPE_ADD_MAIL_WORKER"); free(req); } @@ -525,7 +525,7 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, int type = data4; if (type == UPDATE_PARTIAL_BODY_DOWNLOAD || type == APPEND_BODY) { - MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(mailid, mailbox_ugd->mail_list); + MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(mailid, view->mail_list); if (ld) { email_mail_list_item_t *mail_info = NULL; mail_info = email_engine_get_mail_by_mailid(mailid); @@ -543,28 +543,28 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, STR_NCPY(ld->title, _subject, title_len + TAG_LEN); FREE(_subject); } - MAILBOX_UPDATE_GENLIST_ITEM(mailbox_ugd->gl, ld->item); + MAILBOX_UPDATE_GENLIST_ITEM(view->gl, ld->item); FREE(mail_info); } } else if (type == UPDATE_EXTRA_FLAG) { - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { - MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(mailid, mailbox_ugd->mail_list); + if (view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { + MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(mailid, view->mail_list); if (ld) { email_mail_list_item_t *mail_info = NULL; mail_info = email_engine_get_mail_by_mailid(mailid); if (!mail_info) break; if (mail_info->save_status == EMAIL_MAIL_STATUS_SEND_SCHEDULED) { - mailbox_list_remove_mail_item(mailbox_ugd, ld); - mailbox_view_title_update_mail_count(mailbox_ugd); + mailbox_list_remove_mail_item(view, ld); + mailbox_view_title_update_mail_count(view); } else { ld->mail_status = mail_info->save_status; - MAILBOX_UPDATE_GENLIST_ITEM(mailbox_ugd->gl, ld->item); + MAILBOX_UPDATE_GENLIST_ITEM(view->gl, ld->item); } FREE(mail_info); } } } else if (type == UPDATE_MAIL || type == UPDATE_MEETING) { - MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(mailid, mailbox_ugd->mail_list); + MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(mailid, view->mail_list); if (ld) { email_mail_list_item_t *mail_info = NULL; mail_info = email_engine_get_mail_by_mailid(mailid); @@ -578,22 +578,22 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, (sort_type == EMAIL_SORT_UNREAD && ld->is_seen != mail_info->flags_seen_field) || (sort_type == EMAIL_SORT_IMPORTANT && ld->flag_type != mail_info->flags_flagged_field)) { int mailbox_id = ld->mailbox_id; - mailbox_list_remove_mail_item(mailbox_ugd, ld); + mailbox_list_remove_mail_item(view, ld); FREE(mail_info); AddMailReqData *req = MEM_ALLOC(req, 1); retm_if(!req, "req is NULL"); /* this dynamic variable(req) should be freed in func_notify */ - *req = (AddMailReqData) {account_id, 0, mailid, mailbox_id, mailbox_ugd->mailbox_type, false, - mailbox_ugd->mode, mailbox_ugd}; + *req = (AddMailReqData) {account_id, 0, mailid, mailbox_id, view->mailbox_type, false, + view->mode, view}; - if (!email_request_queue_add_request(mailbox_ugd->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { + if (!email_request_queue_add_request(view->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { debug_error("failed to add request EMAIL_REQUEST_TYPE_ADD_MAIL_WORKER"); free(req); } } else { ld->is_attachment = mail_info->attachment_count; - if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT) { + if (view->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT) { email_address_info_list_t *addrs_info_list = NULL; email_address_info_t *addrs_info = NULL; @@ -639,17 +639,17 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, if (ld->is_seen != mail_info->flags_seen_field) { debug_log("read status has been changed.(%d, %d)", ld->is_seen, mail_info->flags_seen_field); ld->is_seen = mail_info->flags_seen_field; - MAILBOX_UPDATE_GENLIST_ITEM_READ_STATE(mailbox_ugd->gl, ld->item, ld->is_seen); + MAILBOX_UPDATE_GENLIST_ITEM_READ_STATE(view->gl, ld->item, ld->is_seen); } ld->flag_type = mail_info->flags_flagged_field; ld->reply_flag = mail_info->flags_answered_field; ld->forward_flag = mail_info->flags_forwarded_field; - MAILBOX_UPDATE_GENLIST_ITEM(mailbox_ugd->gl, ld->item); + MAILBOX_UPDATE_GENLIST_ITEM(view->gl, ld->item); FREE(mail_info); } } else { - if ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX) { + if ((view->mode == EMAIL_MAILBOX_MODE_ALL || view->mode == EMAIL_MAILBOX_MODE_MAILBOX) + && view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX) { email_mail_list_item_t *mail_info = NULL; mail_info = email_engine_get_mail_by_mailid(mailid); if (!mail_info) break; @@ -659,9 +659,9 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, retm_if(!req, "req is NULL"); /* this dynamic variable(req) should be freed in func_notify */ *req = (AddMailReqData) {account_id, mail_info->thread_id, mailid, mail_info->mailbox_id, mail_info->mailbox_type, true, - mailbox_ugd->mode, mailbox_ugd}; + view->mode, view}; - if (!email_request_queue_add_request(mailbox_ugd->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { + if (!email_request_queue_add_request(view->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { debug_error("failed to add request EMAIL_REQUEST_TYPE_ADD_MAIL_WORKER"); free(req); } @@ -669,7 +669,7 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, FREE(mail_info); } #ifndef _FEATURE_PRIORITY_SENDER_DISABLE_ - else if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { + else if (view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { email_mail_list_item_t *mail_info = NULL; mail_info = email_engine_get_mail_by_mailid(mailid); if (!mail_info) break; @@ -679,10 +679,10 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, AddMailReqData *req = MEM_ALLOC(req, 1); retm_if(!req, "req is NULL"); /* this dynamic variable(req) should be freed in func_notify */ - *req = (AddMailReqData) {account_id, thread_id, mailid, mailbox_id, mailbox_ugd->mailbox_type, true, - mailbox_ugd->mode, mailbox_ugd}; + *req = (AddMailReqData) {account_id, thread_id, mailid, mailbox_id, view->mailbox_type, true, + view->mode, view}; - if (!email_request_queue_add_request(mailbox_ugd->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { + if (!email_request_queue_add_request(view->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { debug_error("failed to add request EMAIL_REQUEST_TYPE_ADD_MAIL_WORKER"); free(req); } @@ -709,14 +709,14 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, switch (update_type) { case EMAIL_MAIL_ATTRIBUTE_FLAGS_DELETED_FIELD: debug_log("DELETED FILED UPDATE"); - if (mailbox_ugd->move_status == EMAIL_ERROR_NONE) { - mailbox_ugd->move_status = -1; + if (view->move_status == EMAIL_ERROR_NONE) { + view->move_status = -1; int ret = 1; - if (mailbox_ugd->moved_mailbox_name) { + if (view->moved_mailbox_name) { char str[MAX_STR_LEN] = { 0, }; - snprintf(str, sizeof(str), email_get_email_string("IDS_EMAIL_TPOP_1_EMAIL_MOVED_TO_PS"), mailbox_ugd->moved_mailbox_name); + snprintf(str, sizeof(str), email_get_email_string("IDS_EMAIL_TPOP_1_EMAIL_MOVED_TO_PS"), view->moved_mailbox_name); ret = notification_status_message_post(str); - G_FREE(mailbox_ugd->moved_mailbox_name); + G_FREE(view->moved_mailbox_name); } else { ret = notification_status_message_post(email_get_email_string("IDS_EMAIL_TPOP_1_EMAIL_MOVED_TO_SELECTED_FOLDER")); } @@ -727,19 +727,19 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, if (value) { G_LIST_FOREACH(mail_list, cur, idx) { debug_log("idx: [%d]", *idx); - _mailbox_remove_deleted_flag_mail(*idx, mailbox_ugd); + _mailbox_remove_deleted_flag_mail(*idx, view); } } - mailbox_view_title_update_mail_count(mailbox_ugd); + mailbox_view_title_update_mail_count(view); break; case EMAIL_MAIL_ATTRIBUTE_FLAGS_SEEN_FIELD: G_LIST_FOREACH(mail_list, cur, idx) { debug_log("idx: [%d]", *idx); - MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, mailbox_ugd->mail_list); + MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, view->mail_list); if (ld) { if (sort_type == EMAIL_SORT_UNREAD) { int mailbox_id = ld->mailbox_id; - mailbox_list_remove_mail_item(mailbox_ugd, ld); + mailbox_list_remove_mail_item(view, ld); AddMailReqData *req = MEM_ALLOC(req, 1); if (!req) { @@ -748,37 +748,37 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, return; } /* this dynamic variable(req) should be freed in func_notify */ - *req = (AddMailReqData) {account_id, 0, *idx, mailbox_id, mailbox_ugd->mailbox_type, false, - mailbox_ugd->mode, mailbox_ugd}; + *req = (AddMailReqData) {account_id, 0, *idx, mailbox_id, view->mailbox_type, false, + view->mode, view}; - if (!email_request_queue_add_request(mailbox_ugd->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { + if (!email_request_queue_add_request(view->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { debug_error("failed to add request EMAIL_REQUEST_TYPE_ADD_MAIL_WORKER"); free(req); } } else { ld->is_seen = value; - MAILBOX_UPDATE_GENLIST_ITEM_READ_STATE(mailbox_ugd->gl, ld->item, ld->is_seen); + MAILBOX_UPDATE_GENLIST_ITEM_READ_STATE(view->gl, ld->item, ld->is_seen); } } } - mailbox_view_title_update_mail_count(mailbox_ugd); + mailbox_view_title_update_mail_count(view); break; case EMAIL_MAIL_ATTRIBUTE_FLAGS_FLAGGED_FIELD: G_LIST_FOREACH(mail_list, cur, idx) { debug_log("idx: [%d]", *idx); - MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, mailbox_ugd->mail_list); + MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, view->mail_list); if (ld) { if ((value == EMAIL_FLAG_NONE || value == EMAIL_FLAG_TASK_STATUS_CLEAR || value == EMAIL_FLAG_TASK_STATUS_COMPLETE) - && mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED) { - mailbox_list_remove_mail_item(mailbox_ugd, ld); - mailbox_view_title_update_mail_count(mailbox_ugd); - if (!g_list_length(mailbox_ugd->mail_list)) - mailbox_show_no_contents_view(mailbox_ugd); + && view->mode == EMAIL_MAILBOX_MODE_ALL && view->mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED) { + mailbox_list_remove_mail_item(view, ld); + mailbox_view_title_update_mail_count(view); + if (!g_list_length(view->mail_list)) + mailbox_show_no_contents_view(view); } else if (sort_type == EMAIL_SORT_IMPORTANT) { int mailbox_id = ld->mailbox_id; - mailbox_list_remove_mail_item(mailbox_ugd, ld); - mailbox_view_title_update_mail_count(mailbox_ugd); + mailbox_list_remove_mail_item(view, ld); + mailbox_view_title_update_mail_count(view); AddMailReqData *req = MEM_ALLOC(req, 1); if (!req) { @@ -787,25 +787,25 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, return; } /* this dynamic variable(req) should be freed in func_notify */ - *req = (AddMailReqData) {account_id, 0, *idx, mailbox_id, mailbox_ugd->mailbox_type, false, - mailbox_ugd->mode, mailbox_ugd}; + *req = (AddMailReqData) {account_id, 0, *idx, mailbox_id, view->mailbox_type, false, + view->mode, view}; - if (!email_request_queue_add_request(mailbox_ugd->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { + if (!email_request_queue_add_request(view->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { debug_error("failed to add request EMAIL_REQUEST_TYPE_ADD_MAIL_WORKER"); free(req); } } else { ld->flag_type = value; - MAILBOX_UPDATE_GENLIST_ITEM_FLAG_STATE(mailbox_ugd->gl, ld->item, ld->flag_type); + MAILBOX_UPDATE_GENLIST_ITEM_FLAG_STATE(view->gl, ld->item, ld->flag_type); } - if (true == mailbox_ugd->b_editmode) { - mailbox_update_select_info(mailbox_ugd); + if (true == view->b_editmode) { + mailbox_update_select_info(view); } } else { if ((value == EMAIL_FLAG_FLAGED || value == EMAIL_FLAG_TASK_STATUS_ACTIVE) - && mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED) { + && view->mode == EMAIL_MAILBOX_MODE_ALL && view->mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED) { AddMailReqData *req = MEM_ALLOC(req, 1); if (!req) { debug_log("req is NULL"); @@ -813,10 +813,10 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, return; } /* this dynamic variable(req) should be freed in func_notify */ - *req = (AddMailReqData) {account_id, 0, *idx, mailbox_id, mailbox_ugd->mailbox_type, false, - mailbox_ugd->mode, mailbox_ugd}; + *req = (AddMailReqData) {account_id, 0, *idx, mailbox_id, view->mailbox_type, false, + view->mode, view}; - if (!email_request_queue_add_request(mailbox_ugd->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { + if (!email_request_queue_add_request(view->request_queue, EMAIL_REQUEST_TYPE_ADD_MAIL, req)) { debug_error("failed to add request EMAIL_REQUEST_TYPE_ADD_MAIL_WORKER"); free(req); } @@ -827,20 +827,20 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, case EMAIL_MAIL_ATTRIBUTE_FLAGS_ANSWERED_FIELD: G_LIST_FOREACH(mail_list, cur, idx) { debug_log("idx: [%d]", *idx); - MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, mailbox_ugd->mail_list); + MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, view->mail_list); if (ld) { ld->reply_flag = value; - MAILBOX_UPDATE_GENLIST_ITEM(mailbox_ugd->gl, ld->item); + MAILBOX_UPDATE_GENLIST_ITEM(view->gl, ld->item); } } break; case EMAIL_MAIL_ATTRIBUTE_FLAGS_FORWARDED_FIELD: G_LIST_FOREACH(mail_list, cur, idx) { debug_log("idx: [%d]", *idx); - MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, mailbox_ugd->mail_list); + MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, view->mail_list); if (ld) { ld->forward_flag = value; - MAILBOX_UPDATE_GENLIST_ITEM(mailbox_ugd->gl, ld->item); + MAILBOX_UPDATE_GENLIST_ITEM(view->gl, ld->item); } } break; @@ -848,12 +848,12 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, G_LIST_FOREACH(mail_list, cur, idx) { debug_log("idx: [%d]", *idx); - MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, mailbox_ugd->mail_list); + MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, view->mail_list); if (ld) { - debug_log("mailbox_ugd->mailbox_type: [%d], ld->mailbox_type : %d", mailbox_ugd->mailbox_type, ld->mailbox_type); + debug_log("view->mailbox_type: [%d], ld->mailbox_type : %d", view->mailbox_type, ld->mailbox_type); { ld->mail_status = value; - MAILBOX_UPDATE_GENLIST_ITEM(mailbox_ugd->gl, ld->item); + MAILBOX_UPDATE_GENLIST_ITEM(view->gl, ld->item); } } } @@ -874,7 +874,7 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, debug_log("NOTI_MAIL_DELETE_FINISH"); account_id = data1; - mailbox_view_title_update_mail_count(mailbox_ugd); + mailbox_view_title_update_mail_count(view); break; case NOTI_RULE_APPLY: @@ -892,10 +892,10 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, G_LIST_FOREACH(mail_list, cur, idx) { debug_log("idx: [%d]", *idx); - MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, mailbox_ugd->mail_list); + MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, view->mail_list); if (ld) { ld->is_priority_sender_mail = true; - MAILBOX_UPDATE_GENLIST_ITEM(mailbox_ugd->gl, ld->item); + MAILBOX_UPDATE_GENLIST_ITEM(view->gl, ld->item); } } @@ -924,10 +924,10 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, G_LIST_FOREACH(mail_list, cur, idx) { debug_log("idx: [%d]", *idx); - MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, mailbox_ugd->mail_list); + MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, view->mail_list); if (ld) { ld->is_priority_sender_mail = false; - MAILBOX_UPDATE_GENLIST_ITEM(mailbox_ugd->gl, ld->item); + MAILBOX_UPDATE_GENLIST_ITEM(view->gl, ld->item); } } @@ -961,7 +961,7 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, } else { G_LIST_FOREACH(mail_list, cur, idx) { debug_log("idx: [%d]", *idx); - MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, mailbox_ugd->mail_list); + MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(*idx, view->mail_list); if (ld) { for (i = 0; i < count; i++) { if (rule_list[i].type == EMAIL_PRIORITY_SENDER) { @@ -978,7 +978,7 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, ld->is_priority_sender_mail = false; } } - MAILBOX_UPDATE_GENLIST_ITEM(mailbox_ugd->gl, ld->item); + MAILBOX_UPDATE_GENLIST_ITEM(view->gl, ld->item); } } email_free_rule(&rule_list, count); @@ -1024,12 +1024,12 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, debug_log("NOTI_DOWNLOAD_FINISH"); account_id = data1; mailbox_id = data2 ? atoi(data2) : 0; - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX - && mailbox_ugd->only_local == FALSE - && !mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && (mailbox_id == mailbox_ugd->mailbox_id || (account_id == mailbox_ugd->account_id && mailbox_id == 0)) - && g_list_length(mailbox_ugd->mail_list)) { - mailbox_last_updated_time_item_update(mailbox_ugd->mailbox_id, mailbox_ugd); + if (view->mode == EMAIL_MAILBOX_MODE_MAILBOX + && view->only_local == FALSE + && !view->b_searchmode && !view->b_editmode + && (mailbox_id == view->mailbox_id || (account_id == view->account_id && mailbox_id == 0)) + && g_list_length(view->mail_list)) { + mailbox_last_updated_time_item_update(view->mailbox_id, view); } @@ -1040,19 +1040,19 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, mailbox_req_handle_list_free(); } - mailbox_get_more_progress_item_remove(mailbox_ugd); - if (0 < g_list_length(mailbox_ugd->mail_list)) { - if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_IMAP4) - || (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_POP3))) { - mailbox_load_more_messages_item_add(mailbox_ugd); - } else if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { - mailbox_no_more_emails_item_add(mailbox_ugd); + mailbox_get_more_progress_item_remove(view); + if (0 < g_list_length(view->mail_list)) { + if (!view->b_searchmode && !view->b_editmode + && ((view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX + && view->account_type == EMAIL_SERVER_TYPE_IMAP4) + || (view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX + && view->account_type == EMAIL_SERVER_TYPE_POP3))) { + mailbox_load_more_messages_item_add(view); + } else if (!view->b_searchmode && !view->b_editmode + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { + mailbox_no_more_emails_item_add(view); } } } else { @@ -1069,25 +1069,25 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, mailbox_req_handle_list_free(); } - mailbox_get_more_progress_item_remove(mailbox_ugd); - if (0 < g_list_length(mailbox_ugd->mail_list)) { - if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_IMAP4) - || (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_POP3))) { - mailbox_load_more_messages_item_add(mailbox_ugd); - } else if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { - mailbox_no_more_emails_item_add(mailbox_ugd); + mailbox_get_more_progress_item_remove(view); + if (0 < g_list_length(view->mail_list)) { + if (!view->b_searchmode && !view->b_editmode + && ((view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX + && view->account_type == EMAIL_SERVER_TYPE_IMAP4) + || (view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX + && view->account_type == EMAIL_SERVER_TYPE_POP3))) { + mailbox_load_more_messages_item_add(view); + } else if (!view->b_searchmode && !view->b_editmode + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { + mailbox_no_more_emails_item_add(view); } } - if (data4 != EMAIL_ERROR_NONE && mailbox_ugd->composer == NULL - && mailbox_ugd->setting == NULL - && mailbox_ugd->viewer == NULL && mailbox_ugd->account == NULL) { + if (data4 != EMAIL_ERROR_NONE && view->composer == NULL + && view->setting == NULL + && view->viewer == NULL && view->account == NULL) { if (subtype == NOTI_DOWNLOAD_FAIL && data4 == EMAIL_ERROR_AUTHENTICATE) { email_authentication_method_t auth_method = EMAIL_AUTHENTICATION_METHOD_NO_AUTH; email_account_t *account = NULL; @@ -1099,15 +1099,15 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, email_free_account(&account, 1); if (auth_method == EMAIL_AUTHENTICATION_METHOD_XOAUTH2) { - mailbox_create_error_popup(data4, data1, mailbox_ugd); + mailbox_create_error_popup(data4, data1, view); } else { int mailbox_id = 0; if (data2) mailbox_id = atoi(data2); debug_log("error : %d, account_id = %d, mailbox_id = %d", data4, data1, mailbox_id); - mailbox_ugd->sync_needed_mailbox_id = mailbox_id; - mailbox_create_password_changed_popup(mailbox_ugd, data1); + view->sync_needed_mailbox_id = mailbox_id; + mailbox_create_password_changed_popup(view, data1); } } else if (subtype == NOTI_DOWNLOAD_FAIL && data4 == EMAIL_ERROR_LOGIN_FAILURE) { int mailbox_id = 0; @@ -1115,10 +1115,10 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, mailbox_id = atoi(data2); debug_log("error : %d, account_id = %d, mailbox_id = %d", data4, data1, mailbox_id); - mailbox_ugd->sync_needed_mailbox_id = mailbox_id; - mailbox_create_password_changed_popup(mailbox_ugd, data1); + view->sync_needed_mailbox_id = mailbox_id; + mailbox_create_password_changed_popup(view, data1); } else { - mailbox_create_error_popup(data4, data1, mailbox_ugd); + mailbox_create_error_popup(data4, data1, view); } } } else { @@ -1130,13 +1130,13 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, debug_log("NOTI_DOWNLOAD_BODY_FINISH"); mail_id = data1; - MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(mail_id, mailbox_ugd->mail_list); + MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(mail_id, view->mail_list); if (ld) { email_mail_list_item_t *mail_info = NULL; mail_info = email_engine_get_mail_by_mailid(mail_id); if (!mail_info) break; ld->is_attachment = mail_info->attachment_count; - MAILBOX_UPDATE_GENLIST_ITEM(mailbox_ugd->gl, ld->item); + MAILBOX_UPDATE_GENLIST_ITEM(view->gl, ld->item); FREE(mail_info); } break; @@ -1144,12 +1144,12 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, case NOTI_SEND_START: debug_log("NOTI_SEND_START"); mail_id = data3; - if ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL - || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { + if ((view->mode == EMAIL_MAILBOX_MODE_ALL + || view->mode == EMAIL_MAILBOX_MODE_MAILBOX) + && view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { if (data4 >= 0) { - _sending_mail_list_add_mail_id(mailbox_ugd, mail_id); - mailbox_send_all_btn_remove(mailbox_ugd); + _sending_mail_list_add_mail_id(view, mail_id); + mailbox_send_all_btn_remove(view); } } break; @@ -1157,13 +1157,13 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, case NOTI_SEND_FINISH: debug_log("NOTI_SEND_FINISH"); mail_id = data3; - if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX - && (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL - || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX)) { - if (_check_sending_mail_list(mailbox_ugd, mail_id)) { - if (g_list_first(mailbox_ugd->mail_list)) { - mailbox_send_all_btn_add(mailbox_ugd); + if (!view->b_searchmode && !view->b_editmode + && view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX + && (view->mode == EMAIL_MAILBOX_MODE_ALL + || view->mode == EMAIL_MAILBOX_MODE_MAILBOX)) { + if (_check_sending_mail_list(view, mail_id)) { + if (g_list_first(view->mail_list)) { + mailbox_send_all_btn_add(view); } } } @@ -1171,15 +1171,15 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, case NOTI_SEND_FAIL: account_id = data1; - debug_log("NOTI_SEND_FAIL: arg_accountid: %d, mailbox_ugd->account_id: %d", account_id, mailbox_ugd->account_id); + debug_log("NOTI_SEND_FAIL: arg_accountid: %d, view->account_id: %d", account_id, view->account_id); mail_id = data3; - if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX - && (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL - || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX)) { - if (_check_sending_mail_list(mailbox_ugd, mail_id)) { - if (g_list_first(mailbox_ugd->mail_list)) { - mailbox_send_all_btn_add(mailbox_ugd); + if (!view->b_searchmode && !view->b_editmode + && view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX + && (view->mode == EMAIL_MAILBOX_MODE_ALL + || view->mode == EMAIL_MAILBOX_MODE_MAILBOX)) { + if (_check_sending_mail_list(view, mail_id)) { + if (g_list_first(view->mail_list)) { + mailbox_send_all_btn_add(view); } } } @@ -1187,15 +1187,15 @@ static void _gdbus_event_mailbox_receive(GDBusConnection *connection, case NOTI_SEND_CANCEL: account_id = data1; - debug_log("NOTI_SEND_CANCEL: arg_accountid: %d, mailbox_ugd->account_id: %d", account_id, mailbox_ugd->account_id); + debug_log("NOTI_SEND_CANCEL: arg_accountid: %d, view->account_id: %d", account_id, view->account_id); mail_id = data3; - if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX - && (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL - || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX)) { - if (_check_sending_mail_list(mailbox_ugd, mail_id)) { - if (g_list_first(mailbox_ugd->mail_list)) { - mailbox_send_all_btn_add(mailbox_ugd); + if (!view->b_searchmode && !view->b_editmode + && view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX + && (view->mode == EMAIL_MAILBOX_MODE_ALL + || view->mode == EMAIL_MAILBOX_MODE_MAILBOX)) { + if (_check_sending_mail_list(view, mail_id)) { + if (g_list_first(view->mail_list)) { + mailbox_send_all_btn_add(view); } } } @@ -1396,39 +1396,39 @@ static Eina_Bool _check_req_handle_list(int handle) return TRUE; } -static void _sending_mail_list_add_mail_id(EmailMailboxUGD *mailbox_ugd, int mail_id) +static void _sending_mail_list_add_mail_id(EmailMailboxView *view, int mail_id) { - debug_log("mail_id(%d), g_sending_mail_list(%p)", mail_id, mailbox_ugd->g_sending_mail_list); + debug_log("mail_id(%d), g_sending_mail_list(%p)", mail_id, view->g_sending_mail_list); - GList *cur = g_list_find(mailbox_ugd->g_sending_mail_list, GINT_TO_POINTER(mail_id)); + GList *cur = g_list_find(view->g_sending_mail_list, GINT_TO_POINTER(mail_id)); if (!cur) { - mailbox_ugd->g_sending_mail_list = g_list_append(mailbox_ugd->g_sending_mail_list, GINT_TO_POINTER(mail_id)); + view->g_sending_mail_list = g_list_append(view->g_sending_mail_list, GINT_TO_POINTER(mail_id)); } else { debug_log("already exist."); } - debug_log("mail_count(%d)", g_list_length(mailbox_ugd->g_sending_mail_list)); + debug_log("mail_count(%d)", g_list_length(view->g_sending_mail_list)); } -static Eina_Bool _check_sending_mail_list(EmailMailboxUGD *mailbox_ugd, int mail_id) +static Eina_Bool _check_sending_mail_list(EmailMailboxView *view, int mail_id) { - debug_log("mail_id(%d), g_sending_mail_list(%p)", mail_id, mailbox_ugd->g_sending_mail_list); + debug_log("mail_id(%d), g_sending_mail_list(%p)", mail_id, view->g_sending_mail_list); GList *it = NULL; int *_mail_id = NULL; - int mail_count = g_list_length(mailbox_ugd->g_sending_mail_list); + int mail_count = g_list_length(view->g_sending_mail_list); debug_log("mail_count(%d)", mail_count); - G_LIST_FOREACH(mailbox_ugd->g_sending_mail_list, it, _mail_id) { + G_LIST_FOREACH(view->g_sending_mail_list, it, _mail_id) { if (GPOINTER_TO_INT(_mail_id) == mail_id) { - mailbox_ugd->g_sending_mail_list = g_list_remove(mailbox_ugd->g_sending_mail_list, _mail_id); + view->g_sending_mail_list = g_list_remove(view->g_sending_mail_list, _mail_id); debug_log("mail_id(%d) was removed", _mail_id); } } - mail_count = g_list_length(mailbox_ugd->g_sending_mail_list); + mail_count = g_list_length(view->g_sending_mail_list); debug_log("mail_count(%d)", mail_count); if (mail_count) @@ -1472,41 +1472,41 @@ static void _mailbox_remove_deleted_flag_mail(int mail_id, void *data) { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; if (mail_id <= 0) { debug_log("Invalid parameter(mail_id)"); return; } - MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(mail_id, mailbox_ugd->mail_list); + MailItemData *ld = mailbox_list_get_mail_item_data_by_mailid(mail_id, view->mail_list); if (ld) { - if ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL && mailbox_ugd->mailbox_type == ld->mailbox_type) - || (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && ld->mailbox_id == mailbox_ugd->mailbox_id)) { + if ((view->mode == EMAIL_MAILBOX_MODE_ALL && view->mailbox_type == ld->mailbox_type) + || (view->mode == EMAIL_MAILBOX_MODE_MAILBOX && ld->mailbox_id == view->mailbox_id)) { debug_log("Remove mail from list mail_id : %d", ld->mail_id); - if (mailbox_ugd->b_editmode) { + if (view->b_editmode) { debug_log("edit list update first"); - mailbox_update_edit_list_view(ld, mailbox_ugd); + mailbox_update_edit_list_view(ld, view); } - mailbox_list_remove_mail_item(mailbox_ugd, ld); - - if (g_list_length(mailbox_ugd->mail_list) > 0) { - if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_IMAP4) - || (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_POP3))) { - mailbox_load_more_messages_item_add(mailbox_ugd); - } else if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { - mailbox_no_more_emails_item_add(mailbox_ugd); + mailbox_list_remove_mail_item(view, ld); + + if (g_list_length(view->mail_list) > 0) { + if (!view->b_searchmode && !view->b_editmode + && ((view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX + && view->account_type == EMAIL_SERVER_TYPE_IMAP4) + || (view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX + && view->account_type == EMAIL_SERVER_TYPE_POP3))) { + mailbox_load_more_messages_item_add(view); + } else if (!view->b_searchmode && !view->b_editmode + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { + mailbox_no_more_emails_item_add(view); } } else { - mailbox_show_no_contents_view(mailbox_ugd); + mailbox_show_no_contents_view(view); } } } @@ -1517,7 +1517,7 @@ static void _mailbox_remove_deleted_flag_mail(int mail_id, void *data) * Definition for exported functions */ -void mailbox_setup_dbus_receiver(EmailMailboxUGD *mailbox_ugd) +void mailbox_setup_dbus_receiver(EmailMailboxView *view) { debug_enter(); @@ -1531,14 +1531,14 @@ void mailbox_setup_dbus_receiver(EmailMailboxUGD *mailbox_ugd) } _storage_id = g_dbus_connection_signal_subscribe(_g_mailbox_conn, NULL, "User.Email.StorageChange", "email", "/User/Email/StorageChange", - NULL, G_DBUS_SIGNAL_FLAGS_NONE, _gdbus_event_mailbox_receive, (void *)mailbox_ugd, NULL); + NULL, G_DBUS_SIGNAL_FLAGS_NONE, _gdbus_event_mailbox_receive, (void *)view, NULL); if (_storage_id == GDBUS_SIGNAL_SUBSCRIBE_FAILURE) { debug_log("Failed to g_dbus_connection_signal_subscribe()"); return; } _network_id = g_dbus_connection_signal_subscribe(_g_mailbox_conn, NULL, "User.Email.NetworkStatus", "email", "/User/Email/NetworkStatus", - NULL, G_DBUS_SIGNAL_FLAGS_NONE, _gdbus_event_mailbox_receive, (void *)mailbox_ugd, NULL); + NULL, G_DBUS_SIGNAL_FLAGS_NONE, _gdbus_event_mailbox_receive, (void *)view, NULL); if (_network_id == GDBUS_SIGNAL_SUBSCRIBE_FAILURE) { debug_critical("Failed to g_dbus_connection_signal_subscribe()"); return; @@ -1586,12 +1586,12 @@ void mailbox_req_account_list_free() } } -void mailbox_sending_mail_list_free(EmailMailboxUGD *mailbox_ugd) +void mailbox_sending_mail_list_free(EmailMailboxView *view) { - debug_log("g_sending_mail_list(%p)", mailbox_ugd->g_sending_mail_list); + debug_log("g_sending_mail_list(%p)", view->g_sending_mail_list); - if (mailbox_ugd->g_sending_mail_list) { - g_list_free(mailbox_ugd->g_sending_mail_list); - mailbox_ugd->g_sending_mail_list = NULL; + if (view->g_sending_mail_list) { + g_list_free(view->g_sending_mail_list); + view->g_sending_mail_list = NULL; } } diff --git a/Project-Files/modules/mailbox/src/email-mailbox-request.c b/Project-Files/modules/mailbox/src/email-mailbox-request.c index 2247e2f..eeb8651 100644 --- a/Project-Files/modules/mailbox/src/email-mailbox-request.c +++ b/Project-Files/modules/mailbox/src/email-mailbox-request.c @@ -193,12 +193,12 @@ void mailbox_requests_cbs_unregister() debug_leave(); } -void mailbox_cancel_all_requests(EmailMailboxUGD *mailbox_ugd) +void mailbox_cancel_all_requests(EmailMailboxView *view) { debug_enter(); - if (mailbox_ugd->request_queue) { - email_request_queue_cancel_all_requests(mailbox_ugd->request_queue); + if (view->request_queue) { + email_request_queue_cancel_all_requests(view->request_queue); } debug_leave(); @@ -219,7 +219,7 @@ static void _mailbox_add_remaining_mail_req_cb(email_request_h request) int i =req_data->start; for (; i < count; i++) { - MailItemData *ld = mailbox_list_make_mail_item_data(mail_list+i, req_data->search_data, req_data->mailbox_ugd); + MailItemData *ld = mailbox_list_make_mail_item_data(mail_list+i, req_data->search_data, req_data->view); if (!ld) { continue; } @@ -262,13 +262,13 @@ static void _mailbox_add_remaining_mail_req_add_item_cb(email_request_h request, gotom_if(!req_data, CLEANUP, "request data is NULL"); gotom_if(email_request_check(request), CLEANUP, "request is cancelled"); - EmailMailboxUGD *mailbox_ugd = req_data->mailbox_ugd; + EmailMailboxView *view = req_data->view; GList *ld_list = (GList *)msg_data; - g_list_foreach(ld_list, (GFunc)mailbox_list_insert_mail_item, (void *)mailbox_ugd); + g_list_foreach(ld_list, (GFunc)mailbox_list_insert_mail_item, (void *)view); g_list_free(ld_list); - if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { - mailbox_send_all_btn_remove(mailbox_ugd); - mailbox_send_all_btn_add(mailbox_ugd); + if (view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { + mailbox_send_all_btn_remove(view); + mailbox_send_all_btn_add(view); } return; @@ -309,7 +309,7 @@ static void _mailbox_move_mail_req_cb(email_request_h request) CHECK_THREAD_BUSY(); debug_log("wake up now"); - EmailMailboxUGD *mailbox_ugd = req_data->mailbox_ugd; + EmailMailboxView *view = req_data->view; char *src_folder = NULL; char *dst_folder = NULL; int src_mailbox_id = 0, dst_mailbox_id = 0; @@ -335,10 +335,10 @@ static void _mailbox_move_mail_req_cb(email_request_h request) int dst_mailbox_type = GET_MAILBOX_TYPE(dst_mailbox_id); - debug_log("b_searchmode : %d, b_editmode : %d", mailbox_ugd->b_searchmode, mailbox_ugd->b_editmode); + debug_log("b_searchmode : %d, b_editmode : %d", view->b_searchmode, view->b_editmode); G_LIST_FOREACH(mail_list, cur, idx) { - ld = mailbox_list_get_mail_item_data_by_mailid(*idx, mailbox_ugd->mail_list); + ld = mailbox_list_get_mail_item_data_by_mailid(*idx, view->mail_list); if (ld) { MoveMailReqReturnData *move_ret_data = MEM_ALLOC(move_ret_data, 1); retm_if(!move_ret_data, "memory allocation failed."); @@ -354,8 +354,8 @@ static void _mailbox_move_mail_req_cb(email_request_h request) debug_log("feeding to main"); email_request_send_feedback(request, move_ret_data); debug_log("Mail(%d) found in this view", *idx); - } else if ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL || mailbox_ugd->account_id == req_data->account_id) - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_SENTBOX + } else if ((view->mode == EMAIL_MAILBOX_MODE_ALL || view->account_id == req_data->account_id) + && view->mailbox_type == EMAIL_MAILBOX_TYPE_SENTBOX && dst_mailbox_type == EMAIL_MAILBOX_TYPE_SENTBOX) { debug_log("add sent email in Sentbox"); @@ -368,7 +368,7 @@ static void _mailbox_move_mail_req_cb(email_request_h request) err = email_close_db(); warn_if(err != EMAIL_ERROR_NONE, "fail to close db - err(%d)", err); - MailItemData *ld = mailbox_list_make_mail_item_data(mail_info, NULL, mailbox_ugd); + MailItemData *ld = mailbox_list_make_mail_item_data(mail_info, NULL, view); gotom_if(!ld, CLEANUP, "mailbox_list_make_mail_item_data() failed."); MoveMailReqReturnData *move_ret_data = MEM_ALLOC(move_ret_data, 1); @@ -419,42 +419,42 @@ static void _mailbox_move_mail_req_move_item_cb(email_request_h request, void *m MoveMailReqReturnData *move_ret_data = (MoveMailReqReturnData *)msg_data; MailItemData *ld = move_ret_data->ld; - EmailMailboxUGD *mailbox_ugd = req_data->mailbox_ugd; + EmailMailboxView *view = req_data->view; - if (mailbox_ugd->b_editmode) { + if (view->b_editmode) { debug_log("edit list update first"); - mailbox_update_edit_list_view(ld, mailbox_ugd); + mailbox_update_edit_list_view(ld, view); } if (move_ret_data->is_delete) { - if (!mailbox_list_get_mail_item_data_by_mailid(move_ret_data->mail_id, mailbox_ugd->mail_list)) { + if (!mailbox_list_get_mail_item_data_by_mailid(move_ret_data->mail_id, view->mail_list)) { debug_log("mailbox_list_get_mail_item_data_by_mailid(%d) failed.", move_ret_data->mail_id); goto CLEANUP; } - mailbox_list_remove_mail_item(mailbox_ugd, ld); - - if (g_list_length(mailbox_ugd->mail_list) > 0) { - if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_IMAP4) - || (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_POP3))) { - mailbox_load_more_messages_item_add(mailbox_ugd); - } else if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { - mailbox_no_more_emails_item_add(mailbox_ugd); + mailbox_list_remove_mail_item(view, ld); + + if (g_list_length(view->mail_list) > 0) { + if (!view->b_searchmode && !view->b_editmode + && ((view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX + && view->account_type == EMAIL_SERVER_TYPE_IMAP4) + || (view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX + && view->account_type == EMAIL_SERVER_TYPE_POP3))) { + mailbox_load_more_messages_item_add(view); + } else if (!view->b_searchmode && !view->b_editmode + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { + mailbox_no_more_emails_item_add(view); } } else { - mailbox_show_no_contents_view(mailbox_ugd); + mailbox_show_no_contents_view(view); } } else { - mailbox_load_more_messages_item_remove(mailbox_ugd); - mailbox_no_more_emails_item_remove(mailbox_ugd); - mailbox_hide_no_contents_view(mailbox_ugd); - mailbox_list_insert_mail_item_from_noti(&ld, mailbox_ugd); + mailbox_load_more_messages_item_remove(view); + mailbox_no_more_emails_item_remove(view); + mailbox_hide_no_contents_view(view); + mailbox_list_insert_mail_item_from_noti(&ld, view); } CLEANUP: @@ -486,7 +486,7 @@ static void _mailbox_del_mail_req_cb(email_request_h request) CHECK_THREAD_BUSY(); debug_log("wake up now"); - EmailMailboxUGD *mailbox_ugd = req_data->mailbox_ugd; + EmailMailboxView *view = req_data->view; GList *mail_list = NULL; MailItemData *ld = NULL; @@ -495,11 +495,11 @@ static void _mailbox_del_mail_req_cb(email_request_h request) _parse_delete_mail_buf(req_data->msg_buf, &mail_list); - debug_log("b_searchmode : %d, b_editmode : %d", mailbox_ugd->b_searchmode, mailbox_ugd->b_editmode); + debug_log("b_searchmode : %d, b_editmode : %d", view->b_searchmode, view->b_editmode); G_LIST_FOREACH(mail_list, cur, idx) { debug_log("idx: [%d]", *idx); - ld = mailbox_list_get_mail_item_data_by_mailid(*idx, mailbox_ugd->mail_list); + ld = mailbox_list_get_mail_item_data_by_mailid(*idx, view->mail_list); if (ld) { CHECK_THREAD_BUSY(); DeleteMailReqReturnData *delete_ret_data = MEM_ALLOC(delete_ret_data, 1); @@ -543,43 +543,43 @@ static void _mailbox_del_mail_req_del_item_cb(email_request_h request, void *msg DeleteMailReqReturnData *delete_ret_data = (DeleteMailReqReturnData *)msg_data; MailItemData *ld = delete_ret_data->ld; - EmailMailboxUGD *mailbox_ugd = req_data->mailbox_ugd; + EmailMailboxView *view = req_data->view; - if (!mailbox_list_get_mail_item_data_by_mailid(delete_ret_data->mail_id, mailbox_ugd->mail_list)) { + if (!mailbox_list_get_mail_item_data_by_mailid(delete_ret_data->mail_id, view->mail_list)) { goto CLEANUP; } - if (mailbox_ugd->b_editmode) { + if (view->b_editmode) { debug_log("edit list update first"); - mailbox_update_edit_list_view(ld, mailbox_ugd); + mailbox_update_edit_list_view(ld, view); } - if (!(mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT - || mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX)) { + if (!(view->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT + || view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX)) { if (ld->is_seen) { - mailbox_view_title_increase_mail_count(-1, 0, mailbox_ugd); + mailbox_view_title_increase_mail_count(-1, 0, view); } else { - mailbox_view_title_increase_mail_count(-1, -1, mailbox_ugd); + mailbox_view_title_increase_mail_count(-1, -1, view); } } - mailbox_list_remove_mail_item(mailbox_ugd, ld); - - if (g_list_length(mailbox_ugd->mail_list) > 0) { - if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_IMAP4) - || (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_POP3))) { - mailbox_load_more_messages_item_add(mailbox_ugd); - } else if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { - mailbox_no_more_emails_item_add(mailbox_ugd); + mailbox_list_remove_mail_item(view, ld); + + if (g_list_length(view->mail_list) > 0) { + if (!view->b_searchmode && !view->b_editmode + && ((view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX + && view->account_type == EMAIL_SERVER_TYPE_IMAP4) + || (view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX + && view->account_type == EMAIL_SERVER_TYPE_POP3))) { + mailbox_load_more_messages_item_add(view); + } else if (!view->b_searchmode && !view->b_editmode + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { + mailbox_no_more_emails_item_add(view); } } else { - mailbox_show_no_contents_view(mailbox_ugd); + mailbox_show_no_contents_view(view); } CLEANUP: @@ -610,7 +610,7 @@ static void _mailbox_add_mail_req_cb(email_request_h request) CHECK_THREAD_BUSY(); - EmailMailboxUGD *mailbox_ugd = req_data->mailbox_ugd; + EmailMailboxView *view = req_data->view; email_mail_list_item_t *mail_info = NULL; int err = 0; @@ -627,7 +627,7 @@ static void _mailbox_add_mail_req_cb(email_request_h request) debug_log("This is EAS SMS message. It will be added on the next sync operation"); goto CLEANUP; } - MailItemData *ld = mailbox_list_make_mail_item_data(mail_info, NULL, mailbox_ugd); + MailItemData *ld = mailbox_list_make_mail_item_data(mail_info, NULL, view); gotom_if(!ld, CLEANUP, "ld is NULL"); if (ld->mailbox_type == EMAIL_MAILBOX_TYPE_SEARCH_RESULT) { @@ -636,7 +636,7 @@ static void _mailbox_add_mail_req_cb(email_request_h request) goto CLEANUP; } - ld->mailbox_ugd = mailbox_ugd; + ld->view = view; CHECK_THREAD_BUSY(); @@ -659,67 +659,67 @@ static void _mailbox_add_mail_req_add_seed_mail_cb(email_request_h request, void gotom_if(!req_data, CLEANUP, "request data is NULL"); gotom_if(email_request_check(request), CLEANUP, "request is cancelled"); - EmailMailboxUGD *mailbox_ugd = req_data->mailbox_ugd; + EmailMailboxView *view = req_data->view; MailItemData *ld = (MailItemData *) msg_data; debug_log("thread_id(%d) mail_id(%d) info(%p)", req_data->thread_id, req_data->mail_id, ld); - mailbox_get_more_progress_item_remove(mailbox_ugd); + mailbox_get_more_progress_item_remove(view); - debug_log("(req, mailbox_ugd) mode(%d, %d), mailbox_type(%d, %d), mailbox_id(%d, %d)", - req_data->mode, mailbox_ugd->mode, req_data->mailbox_type, mailbox_ugd->mailbox_type, req_data->mailbox_id, mailbox_ugd->mailbox_id); + debug_log("(req, view) mode(%d, %d), mailbox_type(%d, %d), mailbox_id(%d, %d)", + req_data->mode, view->mode, req_data->mailbox_type, view->mailbox_type, req_data->mailbox_id, view->mailbox_id); if (req_data->mail_id == req_data->thread_id) { - if ((req_data->mode == EMAIL_MAILBOX_MODE_ALL && mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL && req_data->mailbox_type == mailbox_ugd->mailbox_type) || + if ((req_data->mode == EMAIL_MAILBOX_MODE_ALL && view->mode == EMAIL_MAILBOX_MODE_ALL && req_data->mailbox_type == view->mailbox_type) || #ifndef _FEATURE_PRIORITY_SENDER_DISABLE_ - (req_data->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER && mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER && req_data->mailbox_type == mailbox_ugd->mailbox_type) || + (req_data->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER && view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER && req_data->mailbox_type == view->mailbox_type) || #endif - (req_data->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && req_data->mailbox_id == mailbox_ugd->mailbox_id)/* || - (req->mode == EMAIL_MAILBOX_MODE_SCHEDULED_OUTBOX && mailbox_ugd->mode == EMAIL_MAILBOX_MODE_SCHEDULED_OUTBOX)*/) { - mailbox_list_insert_mail_item_from_noti(&ld, mailbox_ugd); + (req_data->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->mode == EMAIL_MAILBOX_MODE_MAILBOX && req_data->mailbox_id == view->mailbox_id)/* || + (req->mode == EMAIL_MAILBOX_MODE_SCHEDULED_OUTBOX && view->mode == EMAIL_MAILBOX_MODE_SCHEDULED_OUTBOX)*/) { + mailbox_list_insert_mail_item_from_noti(&ld, view); if (req_data->need_increase_mail_count && ld) { if (ld->is_seen) { - mailbox_view_title_increase_mail_count(1, 0, mailbox_ugd); + mailbox_view_title_increase_mail_count(1, 0, view); } else { - mailbox_view_title_increase_mail_count(1, 1, mailbox_ugd); + mailbox_view_title_increase_mail_count(1, 1, view); } } } else { debug_log("list has been changed"); } } else { - if ((req_data->mode == EMAIL_MAILBOX_MODE_ALL && mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL && req_data->mailbox_type == mailbox_ugd->mailbox_type) || + if ((req_data->mode == EMAIL_MAILBOX_MODE_ALL && view->mode == EMAIL_MAILBOX_MODE_ALL && req_data->mailbox_type == view->mailbox_type) || #ifndef _FEATURE_PRIORITY_SENDER_DISABLE_ - (req_data->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER && mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER && req_data->mailbox_type == mailbox_ugd->mailbox_type) || + (req_data->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER && view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER && req_data->mailbox_type == view->mailbox_type) || #endif - /*(req->mode == EMAIL_MAILBOX_MODE_SCHEDULED_OUTBOX && mailbox_ugd->mode == EMAIL_MAILBOX_MODE_SCHEDULED_OUTBOX) ||*/ - (req_data->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && req_data->mailbox_id == mailbox_ugd->mailbox_id)) { - mailbox_list_insert_mail_item_from_noti(&ld, mailbox_ugd); + /*(req->mode == EMAIL_MAILBOX_MODE_SCHEDULED_OUTBOX && view->mode == EMAIL_MAILBOX_MODE_SCHEDULED_OUTBOX) ||*/ + (req_data->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->mode == EMAIL_MAILBOX_MODE_MAILBOX && req_data->mailbox_id == view->mailbox_id)) { + mailbox_list_insert_mail_item_from_noti(&ld, view); if (req_data->need_increase_mail_count && ld) { if (ld->is_seen) - mailbox_view_title_increase_mail_count(1, 0, mailbox_ugd); + mailbox_view_title_increase_mail_count(1, 0, view); else - mailbox_view_title_increase_mail_count(1, 1, mailbox_ugd); + mailbox_view_title_increase_mail_count(1, 1, view); } } else { debug_log("list has been changed"); } } - if (mailbox_ugd->no_content_shown) { - if (g_list_length(mailbox_ugd->mail_list) > 0) { - mailbox_hide_no_contents_view(mailbox_ugd); - if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_IMAP4) - || (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && mailbox_ugd->only_local == false - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX - && mailbox_ugd->account_type == EMAIL_SERVER_TYPE_POP3))) { - mailbox_load_more_messages_item_add(mailbox_ugd); - } else if (!mailbox_ugd->b_searchmode && !mailbox_ugd->b_editmode - && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { - mailbox_no_more_emails_item_add(mailbox_ugd); + if (view->no_content_shown) { + if (g_list_length(view->mail_list) > 0) { + mailbox_hide_no_contents_view(view); + if (!view->b_searchmode && !view->b_editmode + && ((view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX + && view->account_type == EMAIL_SERVER_TYPE_IMAP4) + || (view->mode == EMAIL_MAILBOX_MODE_MAILBOX && view->only_local == false + && view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX + && view->account_type == EMAIL_SERVER_TYPE_POP3))) { + mailbox_load_more_messages_item_add(view); + } else if (!view->b_searchmode && !view->b_editmode + && view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX) { + mailbox_no_more_emails_item_add(view); } } } diff --git a/Project-Files/modules/mailbox/src/email-mailbox-search.c b/Project-Files/modules/mailbox/src/email-mailbox-search.c index 019c408..35be5ad 100644 --- a/Project-Files/modules/mailbox/src/email-mailbox-search.c +++ b/Project-Files/modules/mailbox/src/email-mailbox-search.c @@ -50,7 +50,7 @@ /* * Declaration for static functions */ -void _mailbox_create_searchbar(EmailMailboxUGD *mailbox_ugd); +void _mailbox_create_searchbar(EmailMailboxView *view); static void _searchbar_back_key_cb_clicked(void *data, Evas_Object *obj, void *event_info); static void _searchbar_back_key_cb_pressed(void *data, Evas_Object *obj, void *event_info); static void _searchbar_back_key_cb_unpressed(void *data, Evas_Object *obj, void *event_info); @@ -72,8 +72,8 @@ static void _searchbar_back_key_cb_clicked(void *data, Evas_Object *obj, void *e debug_error("data is NULL"); return; } - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - mailbox_finish_search_mode(mailbox_ugd); + EmailMailboxView *view = (EmailMailboxView *)data; + mailbox_finish_search_mode(view); } @@ -85,8 +85,8 @@ static void _searchbar_back_key_cb_pressed(void *data, Evas_Object *obj, void *e debug_error("data is NULL"); return; } - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - edje_object_signal_emit(_EDJ(mailbox_ugd->searchbar_ly), "btn.pressed", "elm"); + EmailMailboxView *view = (EmailMailboxView *)data; + edje_object_signal_emit(_EDJ(view->searchbar_ly), "btn.pressed", "elm"); } static void _searchbar_back_key_cb_unpressed(void *data, Evas_Object *obj, void *event_info) @@ -97,8 +97,8 @@ static void _searchbar_back_key_cb_unpressed(void *data, Evas_Object *obj, void debug_error("data is NULL"); return; } - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - edje_object_signal_emit(_EDJ(mailbox_ugd->searchbar_ly), "btn.unpressed", "elm"); + EmailMailboxView *view = (EmailMailboxView *)data; + edje_object_signal_emit(_EDJ(view->searchbar_ly), "btn.unpressed", "elm"); } @@ -110,46 +110,46 @@ static void _searchbar_enter_key_cb(void *data, Evas_Object *obj, void *event_in debug_error("data is NULL"); return; } - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - if (mailbox_ugd->search_editfield.entry) - ecore_imf_context_input_panel_hide((Ecore_IMF_Context *)elm_entry_imf_context_get(mailbox_ugd->search_editfield.entry)); + EmailMailboxView *view = (EmailMailboxView *)data; + if (view->search_editfield.entry) + ecore_imf_context_input_panel_hide((Ecore_IMF_Context *)elm_entry_imf_context_get(view->search_editfield.entry)); } static void _searchbar_entry_changed_cb(void *data, Evas_Object *obj, void *event_info) { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - DELETE_TIMER_OBJECT(mailbox_ugd->search_entry_changed_timer); - G_FREE(mailbox_ugd->current_entry_string); - mailbox_ugd->current_entry_string = (char *)elm_entry_markup_to_utf8(elm_object_text_get(mailbox_ugd->search_editfield.entry)); - mailbox_ugd->search_entry_changed_timer = ecore_timer_add(0.5, _search_editfield_changed_timer_cb, (void *)mailbox_ugd); + DELETE_TIMER_OBJECT(view->search_entry_changed_timer); + G_FREE(view->current_entry_string); + view->current_entry_string = (char *)elm_entry_markup_to_utf8(elm_object_text_get(view->search_editfield.entry)); + view->search_entry_changed_timer = ecore_timer_add(0.5, _search_editfield_changed_timer_cb, (void *)view); } static Eina_Bool _search_editfield_changed_timer_cb(void *data) { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - debug_secure("search entry text: %s", mailbox_ugd->current_entry_string); - - mailbox_ugd->search_entry_changed_timer = NULL; - - if (mailbox_ugd->current_entry_string) { - int entry_str_len = strlen(mailbox_ugd->current_entry_string); - if ((entry_str_len == 0 && NULL != mailbox_ugd->last_entry_string) || (entry_str_len > 0)) { - if (g_strcmp0(mailbox_ugd->current_entry_string, mailbox_ugd->last_entry_string)) { - G_FREE(mailbox_ugd->last_entry_string); - mailbox_ugd->last_entry_string = g_strdup(mailbox_ugd->current_entry_string); - mailbox_show_search_result(mailbox_ugd); + EmailMailboxView *view = (EmailMailboxView *)data; + debug_secure("search entry text: %s", view->current_entry_string); + + view->search_entry_changed_timer = NULL; + + if (view->current_entry_string) { + int entry_str_len = strlen(view->current_entry_string); + if ((entry_str_len == 0 && NULL != view->last_entry_string) || (entry_str_len > 0)) { + if (g_strcmp0(view->current_entry_string, view->last_entry_string)) { + G_FREE(view->last_entry_string); + view->last_entry_string = g_strdup(view->current_entry_string); + mailbox_show_search_result(view); if (entry_str_len == 0) { - Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(mailbox_ugd->search_editfield.entry); + Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(view->search_editfield.entry); if (imf_context) ecore_imf_context_input_panel_show(imf_context); } } } - G_FREE(mailbox_ugd->current_entry_string); + G_FREE(view->current_entry_string); } return ECORE_CALLBACK_CANCEL; } @@ -171,9 +171,9 @@ void _mailbox_search_list_scroll_stop_cb(void *data, Evas_Object * obj, void *ev static Eina_Bool _mailbox_searchbar_entry_set_focus(void *data) { - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - mailbox_ugd->search_entry_focus_idler = NULL; - elm_object_focus_set(mailbox_ugd->search_editfield.entry, EINA_TRUE); + EmailMailboxView *view = (EmailMailboxView *)data; + view->search_entry_focus_idler = NULL; + elm_object_focus_set(view->search_editfield.entry, EINA_TRUE); return ECORE_CALLBACK_CANCEL; } @@ -181,25 +181,25 @@ static Eina_Bool _mailbox_searchbar_entry_set_focus(void *data) * Definition for exported functions */ -void _mailbox_create_searchbar(EmailMailboxUGD *mailbox_ugd) +void _mailbox_create_searchbar(EmailMailboxView *view) { debug_enter(); - mailbox_ugd->searchbar_ly = elm_layout_add(mailbox_ugd->base.module->navi); - elm_layout_file_set(mailbox_ugd->searchbar_ly, email_get_mailbox_theme_path(), "email/layout/searchbar"); + view->searchbar_ly = elm_layout_add(view->base.module->navi); + elm_layout_file_set(view->searchbar_ly, email_get_mailbox_theme_path(), "email/layout/searchbar"); - Evas_Object *back_button = elm_button_add(mailbox_ugd->searchbar_ly); + Evas_Object *back_button = elm_button_add(view->searchbar_ly); elm_object_style_set(back_button, "naviframe/back_btn/default"); - evas_object_smart_callback_add(back_button, "clicked", _searchbar_back_key_cb_clicked, mailbox_ugd); - evas_object_smart_callback_add(back_button, "pressed", _searchbar_back_key_cb_pressed, mailbox_ugd); - evas_object_smart_callback_add(back_button, "unpressed", _searchbar_back_key_cb_unpressed, mailbox_ugd); - elm_object_part_content_set(mailbox_ugd->searchbar_ly, "elm.swallow.button", back_button); - - email_common_util_editfield_create(mailbox_ugd->searchbar_ly, EF_TITLE_SEARCH | EF_CLEAR_BTN, &mailbox_ugd->search_editfield); - elm_entry_input_panel_layout_set(mailbox_ugd->search_editfield.entry, ELM_INPUT_PANEL_LAYOUT_NORMAL); - elm_entry_input_panel_return_key_type_set(mailbox_ugd->search_editfield.entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH); - elm_entry_autocapital_type_set(mailbox_ugd->search_editfield.entry, ELM_AUTOCAPITAL_TYPE_NONE); - evas_object_smart_callback_add(mailbox_ugd->search_editfield.entry, "activated", _searchbar_enter_key_cb, mailbox_ugd); - elm_object_part_content_set(mailbox_ugd->searchbar_ly, "elm.swallow.content", mailbox_ugd->search_editfield.layout); + evas_object_smart_callback_add(back_button, "clicked", _searchbar_back_key_cb_clicked, view); + evas_object_smart_callback_add(back_button, "pressed", _searchbar_back_key_cb_pressed, view); + evas_object_smart_callback_add(back_button, "unpressed", _searchbar_back_key_cb_unpressed, view); + elm_object_part_content_set(view->searchbar_ly, "elm.swallow.button", back_button); + + email_common_util_editfield_create(view->searchbar_ly, EF_TITLE_SEARCH | EF_CLEAR_BTN, &view->search_editfield); + elm_entry_input_panel_layout_set(view->search_editfield.entry, ELM_INPUT_PANEL_LAYOUT_NORMAL); + elm_entry_input_panel_return_key_type_set(view->search_editfield.entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH); + elm_entry_autocapital_type_set(view->search_editfield.entry, ELM_AUTOCAPITAL_TYPE_NONE); + evas_object_smart_callback_add(view->search_editfield.entry, "activated", _searchbar_enter_key_cb, view); + elm_object_part_content_set(view->searchbar_ly, "elm.swallow.content", view->search_editfield.layout); } @@ -207,27 +207,27 @@ void _mailbox_create_searchbar(EmailMailboxUGD *mailbox_ugd) * Definition for exported functions */ -void mailbox_finish_search_mode(EmailMailboxUGD *mailbox_ugd) +void mailbox_finish_search_mode(EmailMailboxView *view) { debug_log("[Search Bar] Canceled Callback Called"); - DELETE_TIMER_OBJECT(mailbox_ugd->search_entry_changed_timer); - G_FREE(mailbox_ugd->current_entry_string); + DELETE_TIMER_OBJECT(view->search_entry_changed_timer); + G_FREE(view->current_entry_string); - evas_object_smart_callback_del(mailbox_ugd->gl, "scroll,drag,stop", _mailbox_search_list_scroll_stop_cb); - evas_object_smart_callback_del(mailbox_ugd->search_editfield.entry, "changed", _searchbar_entry_changed_cb); - evas_object_smart_callback_del(mailbox_ugd->search_editfield.entry, "preedit,changed", _searchbar_entry_changed_cb); + evas_object_smart_callback_del(view->gl, "scroll,drag,stop", _mailbox_search_list_scroll_stop_cb); + evas_object_smart_callback_del(view->search_editfield.entry, "changed", _searchbar_entry_changed_cb); + evas_object_smart_callback_del(view->search_editfield.entry, "preedit,changed", _searchbar_entry_changed_cb); - G_FREE(mailbox_ugd->last_entry_string); + G_FREE(view->last_entry_string); - mailbox_ugd->b_searchmode = false; - mailbox_create_no_contents_view(mailbox_ugd, false); + view->b_searchmode = false; + mailbox_create_no_contents_view(view, false); - mailbox_change_search_layout_state(mailbox_ugd, false); + mailbox_change_search_layout_state(view, false); - mailbox_list_refresh(mailbox_ugd, NULL); - mailbox_naviframe_mailbox_button_add(mailbox_ugd); - mailbox_show_compose_btn(mailbox_ugd); + mailbox_list_refresh(view, NULL); + mailbox_naviframe_mailbox_button_add(view); + mailbox_show_compose_btn(view); } void mailbox_free_mailbox_search_data(email_search_data_t *search_data) @@ -250,120 +250,120 @@ void _search_button_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, void *e debug_enter(); retm_if(!data, "data == NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - if (mailbox_ugd->b_searchmode) { + if (view->b_searchmode) { debug_log("already in search mode, return"); return; } - mailbox_ugd->b_searchmode = true; - - DELETE_EVAS_OBJECT(mailbox_ugd->more_ctxpopup); - - DELETE_TIMER_OBJECT(mailbox_ugd->search_entry_changed_timer); - G_FREE(mailbox_ugd->current_entry_string); - mailbox_last_updated_time_item_remove(mailbox_ugd); - if (mailbox_ugd->btn_mailbox) - mailbox_naviframe_mailbox_button_remove(mailbox_ugd); - mailbox_hide_compose_btn(mailbox_ugd); - mailbox_get_more_progress_item_remove(mailbox_ugd); - mailbox_load_more_messages_item_remove(mailbox_ugd); - mailbox_no_more_emails_item_remove(mailbox_ugd); - mailbox_send_all_btn_remove(mailbox_ugd); - - mailbox_create_no_contents_view(mailbox_ugd, true); - - mailbox_sync_cancel_all(mailbox_ugd); - - mailbox_change_search_layout_state(mailbox_ugd, true); - elm_entry_context_menu_disabled_set(mailbox_ugd->search_editfield.entry, EINA_FALSE); - evas_object_smart_callback_add(mailbox_ugd->search_editfield.entry, "changed", _searchbar_entry_changed_cb, mailbox_ugd); - evas_object_smart_callback_add(mailbox_ugd->search_editfield.entry, "preedit,changed", _searchbar_entry_changed_cb, mailbox_ugd); - evas_object_smart_callback_add(mailbox_ugd->gl, "scroll,drag,stop", _mailbox_search_list_scroll_stop_cb, mailbox_ugd->search_editfield.entry); + view->b_searchmode = true; + + DELETE_EVAS_OBJECT(view->more_ctxpopup); + + DELETE_TIMER_OBJECT(view->search_entry_changed_timer); + G_FREE(view->current_entry_string); + mailbox_last_updated_time_item_remove(view); + if (view->btn_mailbox) + mailbox_naviframe_mailbox_button_remove(view); + mailbox_hide_compose_btn(view); + mailbox_get_more_progress_item_remove(view); + mailbox_load_more_messages_item_remove(view); + mailbox_no_more_emails_item_remove(view); + mailbox_send_all_btn_remove(view); + + mailbox_create_no_contents_view(view, true); + + mailbox_sync_cancel_all(view); + + mailbox_change_search_layout_state(view, true); + elm_entry_context_menu_disabled_set(view->search_editfield.entry, EINA_FALSE); + evas_object_smart_callback_add(view->search_editfield.entry, "changed", _searchbar_entry_changed_cb, view); + evas_object_smart_callback_add(view->search_editfield.entry, "preedit,changed", _searchbar_entry_changed_cb, view); + evas_object_smart_callback_add(view->gl, "scroll,drag,stop", _mailbox_search_list_scroll_stop_cb, view->search_editfield.entry); } -void mailbox_change_search_layout_state(EmailMailboxUGD *mailbox_ugd, bool show_search_layout) +void mailbox_change_search_layout_state(EmailMailboxView *view, bool show_search_layout) { debug_enter(); - if (!mailbox_ugd) { - debug_warning("mailbox_ugd is NULL"); + if (!view) { + debug_warning("view is NULL"); return; } if(show_search_layout) { - if (!mailbox_ugd->search_editfield.layout) { + if (!view->search_editfield.layout) { debug_log("search_bar is not created, create search bar"); - _mailbox_create_searchbar(mailbox_ugd); + _mailbox_create_searchbar(view); } debug_log("title is visible, hide thread title"); - mailbox_view_title_unpack(mailbox_ugd); + mailbox_view_title_unpack(view); - if (!evas_object_visible_get(mailbox_ugd->searchbar_ly)) { + if (!evas_object_visible_get(view->searchbar_ly)) { debug_log("search_bar is not visible, show search bar"); - elm_object_part_content_set(mailbox_ugd->sub_layout_search, "top_bar", mailbox_ugd->searchbar_ly); - if (mailbox_ugd->last_entry_string) { - elm_entry_entry_set(mailbox_ugd->search_editfield.entry, mailbox_ugd->last_entry_string); - elm_entry_cursor_end_set(mailbox_ugd->search_editfield.entry); + elm_object_part_content_set(view->sub_layout_search, "top_bar", view->searchbar_ly); + if (view->last_entry_string) { + elm_entry_entry_set(view->search_editfield.entry, view->last_entry_string); + elm_entry_cursor_end_set(view->search_editfield.entry); } else { - elm_entry_entry_set(mailbox_ugd->search_editfield.entry, ""); + elm_entry_entry_set(view->search_editfield.entry, ""); } - mailbox_ugd->search_entry_focus_idler = ecore_idler_add(_mailbox_searchbar_entry_set_focus, mailbox_ugd); + view->search_entry_focus_idler = ecore_idler_add(_mailbox_searchbar_entry_set_focus, view); } } else { debug_log("title is not visible, show thread title."); - elm_object_part_content_unset(mailbox_ugd->content_layout, "top_bar"); - evas_object_hide(mailbox_ugd->searchbar_ly); - if (mailbox_ugd->searchbar_ly && - evas_object_visible_get(mailbox_ugd->searchbar_ly)) { - if (evas_object_visible_get(mailbox_ugd->search_editfield.layout)) { + elm_object_part_content_unset(view->content_layout, "top_bar"); + evas_object_hide(view->searchbar_ly); + if (view->searchbar_ly && + evas_object_visible_get(view->searchbar_ly)) { + if (evas_object_visible_get(view->search_editfield.layout)) { debug_log("search entry is visible, hide search entry"); - if (!mailbox_ugd->b_searchmode) - elm_entry_entry_set(mailbox_ugd->search_editfield.entry, ""); - elm_object_focus_set(mailbox_ugd->search_editfield.entry, EINA_FALSE); - evas_object_hide(mailbox_ugd->search_editfield.layout); + if (!view->b_searchmode) + elm_entry_entry_set(view->search_editfield.entry, ""); + elm_object_focus_set(view->search_editfield.entry, EINA_FALSE); + evas_object_hide(view->search_editfield.layout); } debug_log("search_bar is visible, hide search bar"); - elm_object_part_content_unset(mailbox_ugd->sub_layout_search, "top_bar"); + elm_object_part_content_unset(view->sub_layout_search, "top_bar"); } - mailbox_view_title_pack(mailbox_ugd); + mailbox_view_title_pack(view); } } -email_search_data_t *mailbox_make_search_data(EmailMailboxUGD *mailbox_ugd) +email_search_data_t *mailbox_make_search_data(EmailMailboxView *view) { debug_enter(); - retvm_if(!mailbox_ugd, NULL, "mailbox_ugd is NULL"); + retvm_if(!view, NULL, "view is NULL"); email_search_data_t *search_data = calloc(1, sizeof(email_search_data_t)); retvm_if(!search_data, NULL, "search_data memory alloc failed"); - search_data->subject = (char *)elm_entry_markup_to_utf8(elm_object_text_get(mailbox_ugd->search_editfield.entry)); - search_data->body_text = (char *)elm_entry_markup_to_utf8(elm_object_text_get(mailbox_ugd->search_editfield.entry)); - search_data->attach_text = (char *)elm_entry_markup_to_utf8(elm_object_text_get(mailbox_ugd->search_editfield.entry)); - if ((mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_SENTBOX) - || (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) - || (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT)) { - search_data->recipient = (char *)elm_entry_markup_to_utf8(elm_object_text_get(mailbox_ugd->search_editfield.entry)); + search_data->subject = (char *)elm_entry_markup_to_utf8(elm_object_text_get(view->search_editfield.entry)); + search_data->body_text = (char *)elm_entry_markup_to_utf8(elm_object_text_get(view->search_editfield.entry)); + search_data->attach_text = (char *)elm_entry_markup_to_utf8(elm_object_text_get(view->search_editfield.entry)); + if ((view->mailbox_type == EMAIL_MAILBOX_TYPE_SENTBOX) + || (view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) + || (view->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT)) { + search_data->recipient = (char *)elm_entry_markup_to_utf8(elm_object_text_get(view->search_editfield.entry)); } else { - search_data->sender = (char *)elm_entry_markup_to_utf8(elm_object_text_get(mailbox_ugd->search_editfield.entry)); + search_data->sender = (char *)elm_entry_markup_to_utf8(elm_object_text_get(view->search_editfield.entry)); } debug_secure("[EMAIL_SEARCH_ALL] %s", search_data->subject); return search_data; } -int mailbox_show_search_result(EmailMailboxUGD *mailbox_ugd) +int mailbox_show_search_result(EmailMailboxView *view) { debug_enter(); - if (!mailbox_ugd) + if (!view) return 0; - email_search_data_t *search_data = mailbox_make_search_data(mailbox_ugd); + email_search_data_t *search_data = mailbox_make_search_data(view); - mailbox_list_refresh(mailbox_ugd, search_data); + mailbox_list_refresh(view, search_data); mailbox_free_mailbox_search_data(search_data); diff --git a/Project-Files/modules/mailbox/src/email-mailbox-sync.c b/Project-Files/modules/mailbox/src/email-mailbox-sync.c index 0eec69d..5deede6 100644 --- a/Project-Files/modules/mailbox/src/email-mailbox-sync.c +++ b/Project-Files/modules/mailbox/src/email-mailbox-sync.c @@ -42,21 +42,21 @@ * Declaration for static functions */ -static bool _mailbox_sync_single_mailbox(EmailMailboxUGD *mailbox_ugd); -static bool _mailbox_sync_combined_mailbox(EmailMailboxUGD *mailbox_ugd); +static bool _mailbox_sync_single_mailbox(EmailMailboxView *view); +static bool _mailbox_sync_combined_mailbox(EmailMailboxView *view); /* * Definition for static functions */ -static bool _mailbox_sync_single_mailbox(EmailMailboxUGD *mailbox_ugd) +static bool _mailbox_sync_single_mailbox(EmailMailboxView *view) { debug_enter(); int err = 0; int handle = 0; - int account_id = mailbox_ugd->account_id; - int mailbox_id = mailbox_ugd->mailbox_id; + int account_id = view->account_id; + int mailbox_id = view->mailbox_id; email_account_t *account = NULL; char buf[MAX_STR_LEN] = {0}; @@ -79,7 +79,7 @@ static bool _mailbox_sync_single_mailbox(EmailMailboxUGD *mailbox_ugd) if (account) email_free_account(&account, 1); - if (mailbox_ugd->account_type == EMAIL_SERVER_TYPE_IMAP4) { + if (view->account_type == EMAIL_SERVER_TYPE_IMAP4) { debug_warning("syncing IMAP4 mailbox"); email_engine_sync_imap_mailbox_list(account_id, &handle); } @@ -95,7 +95,7 @@ static bool _mailbox_sync_single_mailbox(EmailMailboxUGD *mailbox_ugd) return true; } -static bool _mailbox_sync_combined_mailbox(EmailMailboxUGD *mailbox_ugd) +static bool _mailbox_sync_combined_mailbox(EmailMailboxView *view) { debug_enter(); @@ -105,10 +105,10 @@ static bool _mailbox_sync_combined_mailbox(EmailMailboxUGD *mailbox_ugd) bool ret = false; int mailbox_type = EMAIL_MAILBOX_TYPE_NONE; - if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_NONE || mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED) + if (view->mailbox_type == EMAIL_MAILBOX_TYPE_NONE || view->mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED) mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; else - mailbox_type = mailbox_ugd->mailbox_type; + mailbox_type = view->mailbox_type; int e = email_get_account_list(&account_list, &account_cnt); if (e != EMAIL_ERROR_NONE) { @@ -158,46 +158,46 @@ static bool _mailbox_sync_combined_mailbox(EmailMailboxUGD *mailbox_ugd) * Definition for exported functions */ -bool mailbox_sync_current_mailbox(EmailMailboxUGD *mailbox_ugd) +bool mailbox_sync_current_mailbox(EmailMailboxView *view) { - debug_log("mailbox_ugd->mode(%d)", mailbox_ugd->mode); + debug_log("view->mode(%d)", view->mode); - if (mailbox_ugd->account_count == 0) { - mailbox_create_timeout_popup(mailbox_ugd, _("IDS_ST_HEADER_WARNING"), + if (view->account_count == 0) { + mailbox_create_timeout_popup(view, _("IDS_ST_HEADER_WARNING"), _("IDS_EMAIL_POP_YOU_HAVE_NOT_YET_CREATED_AN_EMAIL_ACCOUNT_CREATE_AN_EMAIL_ACCOUNT_AND_TRY_AGAIN"), 3.0); return false; } - if (mailbox_ugd->only_local == true) { + if (view->only_local == true) { debug_log("this is local folder"); return false; } - if ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL) + if ((view->mode == EMAIL_MAILBOX_MODE_ALL) #ifndef _FEATURE_PRIORITY_SENDER_DISABLE_ - || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER + || view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER #endif ) { - mailbox_sync_cancel_all(mailbox_ugd); + mailbox_sync_cancel_all(view); - return _mailbox_sync_combined_mailbox(mailbox_ugd); - } else if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) { - email_account_server_t account_type = mailbox_ugd->account_type; + return _mailbox_sync_combined_mailbox(view); + } else if (view->mode == EMAIL_MAILBOX_MODE_MAILBOX) { + email_account_server_t account_type = view->account_type; if (account_type == EMAIL_SERVER_TYPE_POP3 || account_type == EMAIL_SERVER_TYPE_IMAP4) { - mailbox_sync_cancel_all(mailbox_ugd); + mailbox_sync_cancel_all(view); } mailbox_req_handle_list_free(); - return _mailbox_sync_single_mailbox(mailbox_ugd); + return _mailbox_sync_single_mailbox(view); } else { - debug_log("not need to sync for mailbox_ugd->mode(%d), type(%d)", mailbox_ugd->mode, mailbox_ugd->mailbox_type); + debug_log("not need to sync for view->mode(%d), type(%d)", view->mode, view->mailbox_type); return false; } return false; } -bool mailbox_sync_more_messages(EmailMailboxUGD *mailbox_ugd) +bool mailbox_sync_more_messages(EmailMailboxView *view) { debug_enter(); @@ -206,7 +206,7 @@ bool mailbox_sync_more_messages(EmailMailboxUGD *mailbox_ugd) bool ret = false; int handle = 0; - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL) { + if (view->mode == EMAIL_MAILBOX_MODE_ALL) { /* loop: All account */ email_account_t *account_list = NULL; int account_count = 0; @@ -223,7 +223,7 @@ bool mailbox_sync_more_messages(EmailMailboxUGD *mailbox_ugd) && (account_list[i].incoming_server_type == EMAIL_SERVER_TYPE_POP3 || account_list[i].incoming_server_type == EMAIL_SERVER_TYPE_IMAP4)) { int mailbox_id = 0; email_mailbox_t *mailbox = NULL; - err = email_get_mailbox_by_mailbox_type(account_list[i].account_id, mailbox_ugd->mailbox_type, &mailbox); + err = email_get_mailbox_by_mailbox_type(account_list[i].account_id, view->mailbox_type, &mailbox); if (err == EMAIL_ERROR_NONE && mailbox) { new_slot_size = mailbox->mail_slot_size + 25; mailbox_id = mailbox->mailbox_id; @@ -257,10 +257,10 @@ bool mailbox_sync_more_messages(EmailMailboxUGD *mailbox_ugd) } email_free_account(&account_list, account_count); - } else if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) { + } else if (view->mode == EMAIL_MAILBOX_MODE_MAILBOX) { /* mailbox mode */ email_account_t *account = NULL; - err = email_get_account(mailbox_ugd->account_id, EMAIL_ACC_GET_OPT_OPTIONS, &account); + err = email_get_account(view->account_id, EMAIL_ACC_GET_OPT_OPTIONS, &account); if (err != EMAIL_ERROR_NONE) { debug_log("email_get_account() failed(%d)", err); email_free_account(&account, 1); @@ -272,35 +272,35 @@ bool mailbox_sync_more_messages(EmailMailboxUGD *mailbox_ugd) return false; } if (account->sync_disabled == true) { - debug_log("sync of this account(%d) was disabled.", mailbox_ugd->account_id); + debug_log("sync of this account(%d) was disabled.", view->account_id); email_free_account(&account, 1); return false; } email_free_account(&account, 1); email_mailbox_t *mailbox = NULL; - err = email_get_mailbox_by_mailbox_id(mailbox_ugd->mailbox_id, &mailbox); + err = email_get_mailbox_by_mailbox_id(view->mailbox_id, &mailbox); retvm_if(err != EMAIL_ERROR_NONE, false, "email_get_mailbox_by_mailbox_id() failed(%d)", err); retvm_if(!mailbox, false, "mailboxis NULL"); new_slot_size = mailbox->mail_slot_size + 25; email_free_mailbox(&mailbox, 1); - err = email_set_mail_slot_size(mailbox_ugd->account_id, mailbox_ugd->mailbox_id, new_slot_size); + err = email_set_mail_slot_size(view->account_id, view->mailbox_id, new_slot_size); retvm_if(err != EMAIL_ERROR_NONE, false, "email_set_mail_slot_size() failed(%d)", err); - debug_log("account_id: [%d], mailbox_id: [%d], slot_size: [%d]", mailbox_ugd->account_id, mailbox_ugd->mailbox_id, new_slot_size); + debug_log("account_id: [%d], mailbox_id: [%d], slot_size: [%d]", view->account_id, view->mailbox_id, new_slot_size); - ret = email_engine_sync_folder(mailbox_ugd->account_id, mailbox_ugd->mailbox_id, &handle); + ret = email_engine_sync_folder(view->account_id, view->mailbox_id, &handle); retvm_if(ret == false, false, "email_engine_sync_folder() failed"); mailbox_req_handle_list_add_handle(handle); } else { - debug_warning("invalid mailbox_ugd->mode(%d)", mailbox_ugd->mode); + debug_warning("invalid view->mode(%d)", view->mode); } return ret; } -void mailbox_sync_cancel_all(EmailMailboxUGD *mailbox_ugd) +void mailbox_sync_cancel_all(EmailMailboxView *view) { debug_enter(); @@ -335,11 +335,11 @@ void mailbox_sync_folder_with_new_password(int account_id, int mailbox_id, void { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; int handle = 0; gboolean res = FALSE; - mailbox_sync_cancel_all(mailbox_ugd); + mailbox_sync_cancel_all(view); res = email_engine_sync_folder(account_id, mailbox_id, &handle); debug_log("handle: %d, res: %d", handle, res); diff --git a/Project-Files/modules/mailbox/src/email-mailbox-title.c b/Project-Files/modules/mailbox/src/email-mailbox-title.c index fa63253..9720b71 100644 --- a/Project-Files/modules/mailbox/src/email-mailbox-title.c +++ b/Project-Files/modules/mailbox/src/email-mailbox-title.c @@ -51,182 +51,182 @@ /* * Declaration for static functions */ -static Eina_Bool _get_total_and_unread_count_from_curr_mailbox(EmailMailboxUGD *mailbox_ugd, int *total_count, int *unread_count); +static Eina_Bool _get_total_and_unread_count_from_curr_mailbox(EmailMailboxView *view, int *total_count, int *unread_count); /* * Definition for exported functions */ -void mailbox_view_title_unpack(EmailMailboxUGD *mailbox_ugd) +void mailbox_view_title_unpack(EmailMailboxView *view) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd is NULL"); + retm_if(!view, "view is NULL"); - Evas_Object *obj = elm_object_part_content_unset(mailbox_ugd->content_layout, "top_bar"); + Evas_Object *obj = elm_object_part_content_unset(view->content_layout, "top_bar"); evas_object_hide(obj); debug_leave(); } -void mailbox_view_title_pack(EmailMailboxUGD *mailbox_ugd) +void mailbox_view_title_pack(EmailMailboxView *view) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd is NULL"); + retm_if(!view, "view is NULL"); - evas_object_show(mailbox_ugd->title_layout); - elm_object_part_content_set(mailbox_ugd->content_layout, "top_bar", mailbox_ugd->title_layout); + evas_object_show(view->title_layout); + elm_object_part_content_set(view->content_layout, "top_bar", view->title_layout); debug_leave(); } -void mailbox_view_title_update_all(EmailMailboxUGD *mailbox_ugd) +void mailbox_view_title_update_all(EmailMailboxView *view) { debug_log("mode: [%d], account_id: [%d], mailbox_id: [%d], mailbox_type: [%d], b_searchmode[%d], b_editmode[%d]", - mailbox_ugd->mode, mailbox_ugd->account_id, mailbox_ugd->mailbox_id, mailbox_ugd->mailbox_type, mailbox_ugd->b_searchmode, mailbox_ugd->b_editmode); + view->mode, view->account_id, view->mailbox_id, view->mailbox_type, view->b_searchmode, view->b_editmode); int total_count = 0; int unread_count = 0; int ret; /* initialize account name and mailbox name */ - G_FREE(mailbox_ugd->account_name); - G_FREE(mailbox_ugd->mailbox_alias); - mailbox_ugd->total_mail_count = 0; - mailbox_ugd->unread_mail_count = 0; - - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL) { - if (mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_FLAGGED) { - int mailbox_type = (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_NONE) ? EMAIL_MAILBOX_TYPE_INBOX : mailbox_ugd->mailbox_type; + G_FREE(view->account_name); + G_FREE(view->mailbox_alias); + view->total_mail_count = 0; + view->unread_mail_count = 0; + + if (view->mode == EMAIL_MAILBOX_MODE_ALL) { + if (view->mailbox_type != EMAIL_MAILBOX_TYPE_FLAGGED) { + int mailbox_type = (view->mailbox_type == EMAIL_MAILBOX_TYPE_NONE) ? EMAIL_MAILBOX_TYPE_INBOX : view->mailbox_type; if (!email_get_combined_mail_count_by_mailbox_type(mailbox_type, &total_count, &unread_count)) debug_warning("email_get_combined_mail_count_by_mailbox_type() failed"); } - switch (mailbox_ugd->mailbox_type) { + switch (view->mailbox_type) { case EMAIL_MAILBOX_TYPE_INBOX: - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_COMBINED_INBOX_ABB")); - mailbox_ugd->unread_mail_count = unread_count; - mailbox_ugd->only_local = false; + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_COMBINED_INBOX_ABB")); + view->unread_mail_count = unread_count; + view->only_local = false; break; case EMAIL_MAILBOX_TYPE_SENTBOX: - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_SENT_M_EMAIL")); - mailbox_ugd->unread_mail_count = unread_count; - mailbox_ugd->only_local = false; + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_SENT_M_EMAIL")); + view->unread_mail_count = unread_count; + view->only_local = false; break; case EMAIL_MAILBOX_TYPE_TRASH: - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_RECYCLE_BIN_ABB")); - mailbox_ugd->unread_mail_count = unread_count; - mailbox_ugd->only_local = false; + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_RECYCLE_BIN_ABB")); + view->unread_mail_count = unread_count; + view->only_local = false; break; case EMAIL_MAILBOX_TYPE_DRAFT: - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_DRAFTS")); - mailbox_ugd->total_mail_count = total_count; - mailbox_ugd->only_local = false; + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_DRAFTS")); + view->total_mail_count = total_count; + view->only_local = false; break; case EMAIL_MAILBOX_TYPE_SPAMBOX: - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_SPAMBOX")); - mailbox_ugd->unread_mail_count = unread_count; - mailbox_ugd->only_local = false; + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_SPAMBOX")); + view->unread_mail_count = unread_count; + view->only_local = false; break; case EMAIL_MAILBOX_TYPE_OUTBOX: - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_OUTBOX")); - mailbox_ugd->total_mail_count = total_count; - mailbox_ugd->only_local = true; + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_OUTBOX")); + view->total_mail_count = total_count; + view->only_local = true; break; case EMAIL_MAILBOX_TYPE_FLAGGED: - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_STARRED_EMAILS_ABB")); - mailbox_ugd->unread_mail_count = email_get_favourite_mail_count(true); - mailbox_ugd->only_local = false; + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_STARRED_EMAILS_ABB")); + view->unread_mail_count = email_get_favourite_mail_count(true); + view->only_local = false; break; default: - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_INBOX")); - mailbox_ugd->unread_mail_count = unread_count; - mailbox_ugd->only_local = false; + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_INBOX")); + view->unread_mail_count = unread_count; + view->only_local = false; break; } - mailbox_ugd->account_type = EMAIL_SERVER_TYPE_NONE; + view->account_type = EMAIL_SERVER_TYPE_NONE; } #ifndef _FEATURE_PRIORITY_SENDER_DISABLE_ - else if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_PRIORITY_SENDERS_ABB")); - mailbox_ugd->unread_mail_count = email_get_priority_sender_mail_count(true); - mailbox_ugd->account_type = EMAIL_SERVER_TYPE_NONE; - mailbox_ugd->only_local = false; + else if (view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { + view->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_PRIORITY_SENDERS_ABB")); + view->unread_mail_count = email_get_priority_sender_mail_count(true); + view->account_type = EMAIL_SERVER_TYPE_NONE; + view->only_local = false; } #endif - else if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) { + else if (view->mode == EMAIL_MAILBOX_MODE_MAILBOX) { email_account_t *account = NULL; - ret = email_get_account(mailbox_ugd->account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account); + ret = email_get_account(view->account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account); if (ret == EMAIL_ERROR_NONE && account) { - mailbox_ugd->account_name = g_strdup(account->user_email_address); - mailbox_ugd->account_type = account->incoming_server_type; + view->account_name = g_strdup(account->user_email_address); + view->account_type = account->incoming_server_type; } if (account) email_free_account(&account, 1); - if (mailbox_ugd->mailbox_id > 0) { + if (view->mailbox_id > 0) { email_mailbox_t *mailbox = NULL; - ret = email_get_mailbox_by_mailbox_id(mailbox_ugd->mailbox_id, &mailbox); + ret = email_get_mailbox_by_mailbox_id(view->mailbox_id, &mailbox); if (ret == EMAIL_ERROR_NONE && mailbox) { - mailbox_ugd->mailbox_type = mailbox->mailbox_type; + view->mailbox_type = mailbox->mailbox_type; - switch (mailbox_ugd->mailbox_type) { + switch (view->mailbox_type) { case EMAIL_MAILBOX_TYPE_INBOX: - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_INBOX")); - mailbox_ugd->unread_mail_count = mailbox->unread_count - email_get_deleted_flag_mail_count(mailbox_ugd->account_id); + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_INBOX")); + view->unread_mail_count = mailbox->unread_count - email_get_deleted_flag_mail_count(view->account_id); break; case EMAIL_MAILBOX_TYPE_SENTBOX: - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_SENT_M_EMAIL")); - mailbox_ugd->unread_mail_count = mailbox->unread_count; + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_SENT_M_EMAIL")); + view->unread_mail_count = mailbox->unread_count; break; case EMAIL_MAILBOX_TYPE_TRASH: - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_RECYCLE_BIN_ABB")); - mailbox_ugd->unread_mail_count = mailbox->unread_count; + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_RECYCLE_BIN_ABB")); + view->unread_mail_count = mailbox->unread_count; break; case EMAIL_MAILBOX_TYPE_DRAFT: - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_DRAFTS")); - mailbox_ugd->total_mail_count = mailbox->total_mail_count_on_local; + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_DRAFTS")); + view->total_mail_count = mailbox->total_mail_count_on_local; break; case EMAIL_MAILBOX_TYPE_SPAMBOX: - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_SPAMBOX")); - mailbox_ugd->unread_mail_count = mailbox->unread_count; + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_SPAMBOX")); + view->unread_mail_count = mailbox->unread_count; break; case EMAIL_MAILBOX_TYPE_OUTBOX: - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_OUTBOX")); - mailbox_ugd->total_mail_count = mailbox->total_mail_count_on_local - email_get_scheduled_outbox_mail_count_by_account_id(mailbox->account_id, false); + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_OUTBOX")); + view->total_mail_count = mailbox->total_mail_count_on_local - email_get_scheduled_outbox_mail_count_by_account_id(mailbox->account_id, false); break; default: - mailbox_ugd->mailbox_alias = g_strdup(mailbox->alias); - mailbox_ugd->unread_mail_count = mailbox->unread_count; + view->mailbox_alias = g_strdup(mailbox->alias); + view->unread_mail_count = mailbox->unread_count; break; } - mailbox_ugd->only_local = mailbox->local; + view->only_local = mailbox->local; - mailbox_set_last_updated_time(mailbox->last_sync_time, mailbox_ugd); + mailbox_set_last_updated_time(mailbox->last_sync_time, view); } email_free_mailbox(&mailbox, 1); - } else if (mailbox_ugd->mailbox_id == 0) { + } else if (view->mailbox_id == 0) { /* This is for the first entrance during creating an account. */ - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; - mailbox_ugd->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_INBOX")); - mailbox_ugd->unread_mail_count = 0; - mailbox_ugd->only_local = false; + view->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; + view->mailbox_alias = g_strdup(_("IDS_EMAIL_HEADER_INBOX")); + view->unread_mail_count = 0; + view->only_local = false; } else { - debug_warning("INVALID mailbox_ugd->mailbox_id(%d)", mailbox_ugd->mailbox_id); + debug_warning("INVALID view->mailbox_id(%d)", view->mailbox_id); return; } } else { - debug_warning("INVALID mailbox_ugd->mode(%d)", mailbox_ugd->mode); + debug_warning("INVALID view->mode(%d)", view->mode); return; } - debug_log("mailbox_id: [%d], mailbox_type: [%d]", mailbox_ugd->mailbox_id, mailbox_ugd->mailbox_type); - mailbox_view_title_update_all_without_mailbox_change(mailbox_ugd); + debug_log("mailbox_id: [%d], mailbox_type: [%d]", view->mailbox_id, view->mailbox_type); + mailbox_view_title_update_all_without_mailbox_change(view); } -void mailbox_view_title_update_all_without_mailbox_change(EmailMailboxUGD *mailbox_ugd) +void mailbox_view_title_update_all_without_mailbox_change(EmailMailboxView *view) { debug_log("mode: [%d], account_id: [%d], mailbox_id: [%d], mailbox_type: [%d], b_searchmode[%d], b_editmode[%d]", - mailbox_ugd->mode, mailbox_ugd->account_id, mailbox_ugd->mailbox_id, mailbox_ugd->mailbox_type, mailbox_ugd->b_searchmode, mailbox_ugd->b_editmode); + view->mode, view->account_id, view->mailbox_id, view->mailbox_type, view->b_searchmode, view->b_editmode); char mailbox_name_buf[MAX_STR_LEN] = { 0, }; char mailbox_alias_buf[MAX_STR_LEN] = { 0, }; @@ -235,26 +235,26 @@ void mailbox_view_title_update_all_without_mailbox_change(EmailMailboxUGD *mailb char *lang = NULL; system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &lang); - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) { + if (view->mode == EMAIL_MAILBOX_MODE_MAILBOX) { /* two line title */ - if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT || mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { - if (mailbox_ugd->total_mail_count == 0) - snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_FORMAT, mailbox_ugd->mailbox_alias); + if (view->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT || view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { + if (view->total_mail_count == 0) + snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_FORMAT, view->mailbox_alias); else - snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_WITH_COUNT_FORMAT, mailbox_ugd->mailbox_alias, mailbox_ugd->total_mail_count); + snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_WITH_COUNT_FORMAT, view->mailbox_alias, view->total_mail_count); } else { - if (mailbox_ugd->unread_mail_count == 0) - snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_FORMAT, mailbox_ugd->mailbox_alias); + if (view->unread_mail_count == 0) + snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_FORMAT, view->mailbox_alias); else - snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_WITH_COUNT_FORMAT, mailbox_ugd->mailbox_alias, mailbox_ugd->unread_mail_count); + snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_WITH_COUNT_FORMAT, view->mailbox_alias, view->unread_mail_count); } - markup_subtitle = elm_entry_utf8_to_markup(mailbox_ugd->account_name); + markup_subtitle = elm_entry_utf8_to_markup(view->account_name); snprintf(mailbox_alias_buf, sizeof(mailbox_alias_buf), TITLE_TEXT_FORMAT, markup_subtitle); - elm_layout_signal_emit(mailbox_ugd->title_layout, "two_lines_mode", "mailbox"); - elm_object_part_text_set(mailbox_ugd->title_layout, "title.text", mailbox_name_buf); - elm_object_part_text_set(mailbox_ugd->title_layout, "title.text.sub", mailbox_alias_buf); + elm_layout_signal_emit(view->title_layout, "two_lines_mode", "mailbox"); + elm_object_part_text_set(view->title_layout, "title.text", mailbox_name_buf); + elm_object_part_text_set(view->title_layout, "title.text.sub", mailbox_alias_buf); } else { @@ -263,79 +263,79 @@ void mailbox_view_title_update_all_without_mailbox_change(EmailMailboxUGD *mailb * So, If selected box is starred, update mail count when exit edit mode. */ /* one line title */ - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED) { - mailbox_ugd->unread_mail_count = email_get_favourite_mail_count(true); - if (mailbox_ugd->unread_mail_count == 0) - snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_FORMAT, mailbox_ugd->mailbox_alias); + if (view->mode == EMAIL_MAILBOX_MODE_ALL && view->mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED) { + view->unread_mail_count = email_get_favourite_mail_count(true); + if (view->unread_mail_count == 0) + snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_FORMAT, view->mailbox_alias); else - snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_WITH_COUNT_FORMAT, mailbox_ugd->mailbox_alias, mailbox_ugd->unread_mail_count); - } else if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT || mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { - if (mailbox_ugd->total_mail_count == 0) - snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_FORMAT, mailbox_ugd->mailbox_alias); + snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_WITH_COUNT_FORMAT, view->mailbox_alias, view->unread_mail_count); + } else if (view->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT || view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { + if (view->total_mail_count == 0) + snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_FORMAT, view->mailbox_alias); else - snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_WITH_COUNT_FORMAT, mailbox_ugd->mailbox_alias, mailbox_ugd->total_mail_count); + snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_WITH_COUNT_FORMAT, view->mailbox_alias, view->total_mail_count); } else { - if (mailbox_ugd->unread_mail_count == 0) - snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_FORMAT, mailbox_ugd->mailbox_alias); + if (view->unread_mail_count == 0) + snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_FORMAT, view->mailbox_alias); else - snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_WITH_COUNT_FORMAT, mailbox_ugd->mailbox_alias, mailbox_ugd->unread_mail_count); + snprintf(mailbox_name_buf, sizeof(mailbox_name_buf), TITLE_TEXT_WITH_COUNT_FORMAT, view->mailbox_alias, view->unread_mail_count); } - elm_layout_signal_emit(mailbox_ugd->title_layout, "single_line_mode", "mailbox"); - elm_object_part_text_set(mailbox_ugd->title_layout, "title.text.sub", NULL); - elm_object_part_text_set(mailbox_ugd->title_layout, "title.text", mailbox_name_buf); + elm_layout_signal_emit(view->title_layout, "single_line_mode", "mailbox"); + elm_object_part_text_set(view->title_layout, "title.text.sub", NULL); + elm_object_part_text_set(view->title_layout, "title.text", mailbox_name_buf); } FREE(lang); FREE(markup_title); FREE(markup_subtitle); - mailbox_toolbar_create(mailbox_ugd); - mailbox_naviframe_mailbox_button_add(mailbox_ugd); - if (!mailbox_ugd->b_editmode && mailbox_ugd->b_searchmode) { - mailbox_change_search_layout_state(mailbox_ugd, true); + mailbox_toolbar_create(view); + mailbox_naviframe_mailbox_button_add(view); + if (!view->b_editmode && view->b_searchmode) { + mailbox_change_search_layout_state(view, true); } } -void mailbox_view_title_update_account_name(EmailMailboxUGD *mailbox_ugd) +void mailbox_view_title_update_account_name(EmailMailboxView *view) { debug_log("mode: [%d], account_id: [%d], b_searchmode[%d], b_editmode[%d]", - mailbox_ugd->mode, mailbox_ugd->account_id, mailbox_ugd->b_searchmode, mailbox_ugd->b_editmode); + view->mode, view->account_id, view->b_searchmode, view->b_editmode); int ret = 0; email_account_t *account = NULL; char *markup_subtitle = NULL; char mailbox_alias_buf[MAX_STR_LEN] = { 0, }; - ret = email_get_account(mailbox_ugd->account_id, EMAIL_ACC_GET_OPT_DEFAULT, &account); + ret = email_get_account(view->account_id, EMAIL_ACC_GET_OPT_DEFAULT, &account); if (ret == EMAIL_ERROR_NONE && account) { - G_FREE(mailbox_ugd->account_name); - mailbox_ugd->account_name = g_strdup(account->user_email_address); + G_FREE(view->account_name); + view->account_name = g_strdup(account->user_email_address); } if (account) email_free_account(&account, 1); - if (mailbox_ugd->b_editmode) + if (view->b_editmode) return; - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) { + if (view->mode == EMAIL_MAILBOX_MODE_MAILBOX) { /* two line title */ - markup_subtitle = elm_entry_utf8_to_markup(mailbox_ugd->account_name); + markup_subtitle = elm_entry_utf8_to_markup(view->account_name); snprintf(mailbox_alias_buf, sizeof(mailbox_alias_buf), TITLE_TEXT_FORMAT, markup_subtitle); - elm_layout_signal_emit(mailbox_ugd->title_layout, "two_lines_mode", "mailbox"); - elm_object_part_text_set(mailbox_ugd->title_layout, "title.text.sub", mailbox_alias_buf); + elm_layout_signal_emit(view->title_layout, "two_lines_mode", "mailbox"); + elm_object_part_text_set(view->title_layout, "title.text.sub", mailbox_alias_buf); } FREE(markup_subtitle); } -static Eina_Bool _get_total_and_unread_count_from_curr_mailbox(EmailMailboxUGD *mailbox_ugd, int *total_count, int *unread_count) +static Eina_Bool _get_total_and_unread_count_from_curr_mailbox(EmailMailboxView *view, int *total_count, int *unread_count) { debug_enter(); int ret; *total_count = 0; *unread_count = 0; - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL) { - if (mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_FLAGGED) { + if (view->mode == EMAIL_MAILBOX_MODE_ALL) { + if (view->mailbox_type != EMAIL_MAILBOX_TYPE_FLAGGED) { email_account_t *account_list = NULL; int account_count = 0, i = 0; @@ -344,14 +344,14 @@ static Eina_Bool _get_total_and_unread_count_from_curr_mailbox(EmailMailboxUGD * for (i = 0; i < account_count; i++) { email_mailbox_t *mailbox = NULL; ret = email_get_mailbox_by_mailbox_type(account_list[i].account_id, - (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_NONE) ? EMAIL_MAILBOX_TYPE_INBOX : mailbox_ugd->mailbox_type, &mailbox); + (view->mailbox_type == EMAIL_MAILBOX_TYPE_NONE) ? EMAIL_MAILBOX_TYPE_INBOX : view->mailbox_type, &mailbox); if (ret == EMAIL_ERROR_NONE && mailbox) { *total_count = *total_count + mailbox->total_mail_count_on_local; *unread_count = *unread_count + mailbox->unread_count; email_free_mailbox(&mailbox, 1); } } - if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { + if (view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { *total_count = *total_count - email_get_scheduled_outbox_mail_count_by_account_id(0, false); } } @@ -360,25 +360,25 @@ static Eina_Bool _get_total_and_unread_count_from_curr_mailbox(EmailMailboxUGD * } } #ifndef _FEATURE_PRIORITY_SENDER_DISABLE_ - else if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { + else if (view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { *total_count = email_get_priority_sender_mail_count(false); *unread_count = email_get_priority_sender_mail_count(true); } #endif - else if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) { + else if (view->mode == EMAIL_MAILBOX_MODE_MAILBOX) { email_mailbox_t *mailbox = NULL; - ret = email_get_mailbox_by_mailbox_id(mailbox_ugd->mailbox_id, &mailbox); + ret = email_get_mailbox_by_mailbox_id(view->mailbox_id, &mailbox); if (ret == EMAIL_ERROR_NONE && mailbox) { - if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT) + if (view->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT) *total_count = mailbox->total_mail_count_on_local; - else if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) - *total_count = mailbox->total_mail_count_on_local - email_get_scheduled_outbox_mail_count_by_account_id(mailbox_ugd->account_id, false); + else if (view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) + *total_count = mailbox->total_mail_count_on_local - email_get_scheduled_outbox_mail_count_by_account_id(view->account_id, false); else *unread_count = mailbox->unread_count; } email_free_mailbox(&mailbox, 1); } else { - debug_warning("INVALID mailbox_ugd->mode(%d)", mailbox_ugd->mode); + debug_warning("INVALID view->mode(%d)", view->mode); return EINA_FALSE; } debug_log("mailbox total count [%d]", *total_count); @@ -387,72 +387,72 @@ static Eina_Bool _get_total_and_unread_count_from_curr_mailbox(EmailMailboxUGD * return EINA_TRUE; } -void mailbox_view_title_update_mail_count(EmailMailboxUGD *mailbox_ugd) +void mailbox_view_title_update_mail_count(EmailMailboxView *view) { debug_enter(); int total_mail_count = 0; int unread_mail_count = 0; - if(_get_total_and_unread_count_from_curr_mailbox(mailbox_ugd, &total_mail_count, &unread_mail_count)) { - mailbox_ugd->total_mail_count = total_mail_count; - mailbox_ugd->unread_mail_count = unread_mail_count; - debug_log("mailbox total mail count = %d", mailbox_ugd->total_mail_count); - debug_log("mailbox unread mail count = %d", mailbox_ugd->unread_mail_count); + if(_get_total_and_unread_count_from_curr_mailbox(view, &total_mail_count, &unread_mail_count)) { + view->total_mail_count = total_mail_count; + view->unread_mail_count = unread_mail_count; + debug_log("mailbox total mail count = %d", view->total_mail_count); + debug_log("mailbox unread mail count = %d", view->unread_mail_count); } else { debug_error("_get_total_and_unread_count_from_curr_mailbox() failed"); } - if (mailbox_ugd->b_editmode) { - mailbox_update_select_info(mailbox_ugd); + if (view->b_editmode) { + mailbox_update_select_info(view); debug_log("In edit mode, updated count should not be set in Navi title because selection info is shown there."); return; } - mailbox_view_title_update_all_without_mailbox_change(mailbox_ugd); + mailbox_view_title_update_all_without_mailbox_change(view); debug_leave(); } -void mailbox_view_title_increase_mail_count(int total_count_incr, int unread_count_incr, EmailMailboxUGD *mailbox_ugd) +void mailbox_view_title_increase_mail_count(int total_count_incr, int unread_count_incr, EmailMailboxView *view) { debug_log("total param [%d], unread param [%d]", total_count_incr, unread_count_incr); - debug_log("current total count [%d]", mailbox_ugd->total_mail_count); - debug_log("current unread count [%d]", mailbox_ugd->unread_mail_count); + debug_log("current total count [%d]", view->total_mail_count); + debug_log("current unread count [%d]", view->unread_mail_count); int serv_total_count = 0; int serv_unread_count = 0; - if (_get_total_and_unread_count_from_curr_mailbox(mailbox_ugd, &serv_total_count, &serv_unread_count)) { - if (mailbox_ugd->total_mail_count == serv_total_count) { + if (_get_total_and_unread_count_from_curr_mailbox(view, &serv_total_count, &serv_unread_count)) { + if (view->total_mail_count == serv_total_count) { debug_log("Total message count is the same. No need to update"); } else { debug_log("Total message need to be updated by %d", total_count_incr); - mailbox_ugd->total_mail_count = mailbox_ugd->total_mail_count + total_count_incr; + view->total_mail_count = view->total_mail_count + total_count_incr; } if (unread_count_incr != 0) { - if (mailbox_ugd->unread_mail_count == serv_unread_count) { + if (view->unread_mail_count == serv_unread_count) { debug_log("Unread message count is the same. No need to update"); } else { debug_log("Unread message count need to be updated by %d", unread_count_incr); - mailbox_ugd->unread_mail_count = mailbox_ugd->unread_mail_count + unread_count_incr; + view->unread_mail_count = view->unread_mail_count + unread_count_incr; } } } else { debug_error("_get_total_and_unread_count_from_curr_mailbox() failed!"); - mailbox_ugd->total_mail_count = mailbox_ugd->total_mail_count + total_count_incr; - mailbox_ugd->unread_mail_count = mailbox_ugd->unread_mail_count + unread_count_incr; + view->total_mail_count = view->total_mail_count + total_count_incr; + view->unread_mail_count = view->unread_mail_count + unread_count_incr; } - if (mailbox_ugd->b_editmode) { + if (view->b_editmode) { debug_log("edit mode. just return here."); return; } - if (mailbox_ugd->unread_mail_count < 0) - mailbox_ugd->unread_mail_count = 0; - if (mailbox_ugd->total_mail_count < 0) - mailbox_ugd->total_mail_count = 0; + if (view->unread_mail_count < 0) + view->unread_mail_count = 0; + if (view->total_mail_count < 0) + view->total_mail_count = 0; - mailbox_view_title_update_all_without_mailbox_change(mailbox_ugd); + mailbox_view_title_update_all_without_mailbox_change(view); } diff --git a/Project-Files/modules/mailbox/src/email-mailbox-toolbar.c b/Project-Files/modules/mailbox/src/email-mailbox-toolbar.c index f35131f..6367d8c 100644 --- a/Project-Files/modules/mailbox/src/email-mailbox-toolbar.c +++ b/Project-Files/modules/mailbox/src/email-mailbox-toolbar.c @@ -22,7 +22,7 @@ #include "email-mailbox-item.h" #include "email-mailbox-list.h" #include "email-mailbox-list-other-items.h" -#include "email-mailbox-ug-util.h" +#include "email-mailbox-module-util.h" #include "email-mailbox-util.h" #include "email-mailbox-more-menu.h" #include "email-mailbox-sync.h" @@ -63,8 +63,8 @@ typedef enum { /* * Declaration for static functions */ -static void _create_control_option(EmailMailboxUGD *ad); -static void _create_edit_control_option(EmailMailboxUGD *ad); +static void _create_control_option(EmailMailboxView *ad); +static void _create_edit_control_option(EmailMailboxView *ad); static void _popup_response_delete_ok_cb(void *data, Evas_Object *obj, void *event_info); @@ -77,8 +77,8 @@ static void _error_popup_destroy_cb(void *data, Evas_Object *obj, void *event_in debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - DELETE_EVAS_OBJECT(mailbox_ugd->error_popup); + EmailMailboxView *view = (EmailMailboxView *)data; + DELETE_EVAS_OBJECT(view->error_popup); } static void _error_popup_mouseup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) @@ -89,25 +89,25 @@ static void _error_popup_mouseup_cb(void *data, Evas *e, Evas_Object *obj, void } } -static void _create_control_option(EmailMailboxUGD *mailbox_ugd) +static void _create_control_option(EmailMailboxView *view) { debug_enter(); - if (!mailbox_ugd->controlbar_more_btn) { - mailbox_ugd->controlbar_more_btn = mailbox_create_toolbar_more_btn(mailbox_ugd); - elm_object_item_part_content_set(mailbox_ugd->base.navi_item, "toolbar_more_btn", mailbox_ugd->controlbar_more_btn); + if (!view->controlbar_more_btn) { + view->controlbar_more_btn = mailbox_create_toolbar_more_btn(view); + elm_object_item_part_content_set(view->base.navi_item, "toolbar_more_btn", view->controlbar_more_btn); } return; } -static void _create_edit_control_option(EmailMailboxUGD *mailbox_ugd) +static void _create_edit_control_option(EmailMailboxView *view) { debug_enter(); int i = 0; bool use_ReadUnread_popup = false; bool use_StarUnstar_popup = false; - int checked_count = eina_list_count(mailbox_ugd->selected_mail_list); + int checked_count = eina_list_count(view->selected_mail_list); Eina_List *first_list = NULL; MailItemData *first_ld = NULL; int first_read_status = 0; @@ -117,14 +117,14 @@ static void _create_edit_control_option(EmailMailboxUGD *mailbox_ugd) debug_log("selected count %d", checked_count); checked_count = 0; } else { - first_list = eina_list_nth_list(mailbox_ugd->selected_mail_list, 0); + first_list = eina_list_nth_list(view->selected_mail_list, 0); first_ld = eina_list_data_get(first_list); first_read_status = first_ld->is_seen; first_favourite_status = first_ld->flag_type; } for (i = 1; checked_count > 1 && i < checked_count; i++) { - Eina_List *nth_list = eina_list_nth_list(mailbox_ugd->selected_mail_list, i); + Eina_List *nth_list = eina_list_nth_list(view->selected_mail_list, i); MailItemData *ld = eina_list_data_get(nth_list); if (ld->is_seen != first_read_status && false == use_ReadUnread_popup) { @@ -143,15 +143,15 @@ static void _create_edit_control_option(EmailMailboxUGD *mailbox_ugd) * Definition for exported functions */ -void mailbox_toolbar_create(EmailMailboxUGD *mailbox_ugd) +void mailbox_toolbar_create(EmailMailboxView *view) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd is NULL."); + retm_if(!view, "view is NULL."); - if (mailbox_ugd->b_editmode) { - _create_edit_control_option(mailbox_ugd); + if (view->b_editmode) { + _create_edit_control_option(view); } else { - _create_control_option(mailbox_ugd); + _create_control_option(view); } } @@ -160,14 +160,14 @@ static void _popup_response_delete_ok_cb(void *data, Evas_Object *obj, void *eve debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; edit_req_t *req = MEM_ALLOC(req, 1); retm_if(!req, "memory allocation failed."); Eina_List *cur = NULL; MailItemData *ld = NULL; - EINA_LIST_FOREACH(mailbox_ugd->selected_mail_list, cur, ld) { + EINA_LIST_FOREACH(view->selected_mail_list, cur, ld) { DeleteRequestedMail *requested_mail = MEM_ALLOC(requested_mail, 1); requested_mail->account_id = ld->account_id; requested_mail->mail_id = ld->mail_id; @@ -176,10 +176,10 @@ static void _popup_response_delete_ok_cb(void *data, Evas_Object *obj, void *eve requested_mail->mail_status = ld->mail_status; req->requested_mail_list = eina_list_append(req->requested_mail_list, requested_mail); } - req->mailbox_ugd = mailbox_ugd; + req->view = view; ecore_thread_feedback_run(mailbox_process_delete_mail, NULL, NULL, NULL, req, EINA_TRUE); - mailbox_exit_edit_mode(mailbox_ugd); + mailbox_exit_edit_mode(view); } void mailbox_move_mail(void *data) @@ -191,26 +191,26 @@ void mailbox_move_mail(void *data) return; } - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { - MailItemData *ld = eina_list_data_get(mailbox_ugd->selected_mail_list); + if (view->mode == EMAIL_MAILBOX_MODE_ALL || view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { + MailItemData *ld = eina_list_data_get(view->selected_mail_list); int first_account_id = ld->account_id; Eina_List *cur = NULL; - EINA_LIST_FOREACH(mailbox_ugd->selected_mail_list, cur, ld) { + EINA_LIST_FOREACH(view->selected_mail_list, cur, ld) { if (first_account_id != ld->account_id) { debug_log("first_account_id : %d, account_id : %d", first_account_id, ld->account_id); - DELETE_EVAS_OBJECT(mailbox_ugd->error_popup); - mailbox_ugd->error_popup = mailbox_create_popup(mailbox_ugd, _("IDS_EMAIL_HEADER_UNABLE_TO_MOVE_EMAILS_ABB"), _("IDS_EMAIL_POP_UNABLE_TO_MOVE_EMAILS_FROM_MULTIPLE_ACCOUNTS_AT_ONCE"), _error_popup_destroy_cb, + DELETE_EVAS_OBJECT(view->error_popup); + view->error_popup = mailbox_create_popup(view, _("IDS_EMAIL_HEADER_UNABLE_TO_MOVE_EMAILS_ABB"), _("IDS_EMAIL_POP_UNABLE_TO_MOVE_EMAILS_FROM_MULTIPLE_ACCOUNTS_AT_ONCE"), _error_popup_destroy_cb, _error_popup_destroy_cb, "IDS_EMAIL_BUTTON_OK", NULL, NULL); - evas_object_event_callback_add(mailbox_ugd->error_popup, EVAS_CALLBACK_MOUSE_UP, _error_popup_mouseup_cb, mailbox_ugd); + evas_object_event_callback_add(view->error_popup, EVAS_CALLBACK_MOUSE_UP, _error_popup_mouseup_cb, view); return; } } } - mailbox_process_move_mail(mailbox_ugd); + mailbox_process_move_mail(view); } void mailbox_from_spam_mail(void *data) @@ -222,9 +222,9 @@ void mailbox_from_spam_mail(void *data) return; } - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - DELETE_EVAS_OBJECT(mailbox_ugd->more_ctxpopup); + DELETE_EVAS_OBJECT(view->more_ctxpopup); int i = 0, unblock_count = 0, j = 0; @@ -235,7 +235,7 @@ void mailbox_from_spam_mail(void *data) return; } - int checked_count = eina_list_count(mailbox_ugd->selected_mail_list); + int checked_count = eina_list_count(view->selected_mail_list); if (checked_count <= 0) return; GList *mail_list[max_account_id]; @@ -243,7 +243,7 @@ void mailbox_from_spam_mail(void *data) int ret = 0; for (j = 0; j < checked_count; j++) { - Eina_List *nth_list = eina_list_nth_list(mailbox_ugd->selected_mail_list, j); + Eina_List *nth_list = eina_list_nth_list(view->selected_mail_list, j); MailItemData *ld = eina_list_data_get(nth_list); mail_list[ld->account_id-1] = g_list_prepend(mail_list[ld->account_id-1], GINT_TO_POINTER(ld->mail_id)); @@ -289,7 +289,7 @@ void mailbox_from_spam_mail(void *data) } email_free_mailbox(&inbox, 1); } else { - debug_warning("email_get_mailbox_by_mailbox_type : account_id(%d) type(INBOX) - err(%d) or mailbox is NULL(%p)", mailbox_ugd->account_id, err, inbox); + debug_warning("email_get_mailbox_by_mailbox_type : account_id(%d) type(INBOX) - err(%d) or mailbox is NULL(%p)", view->account_id, err, inbox); } } } @@ -304,7 +304,7 @@ void mailbox_from_spam_mail(void *data) } } - mailbox_exit_edit_mode(mailbox_ugd); + mailbox_exit_edit_mode(view); debug_leave(); } @@ -317,7 +317,7 @@ void mailbox_to_spam_mail(void *data) return; } - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; int i = 0, block_count = 0; int max_account_id = email_engine_get_max_account_id(); int ret = 1; @@ -327,9 +327,9 @@ void mailbox_to_spam_mail(void *data) return; } - int checked_count = eina_list_count(mailbox_ugd->selected_mail_list); + int checked_count = eina_list_count(view->selected_mail_list); - DELETE_EVAS_OBJECT(mailbox_ugd->more_ctxpopup); + DELETE_EVAS_OBJECT(view->more_ctxpopup); if (checked_count <= 0) return; @@ -337,7 +337,7 @@ void mailbox_to_spam_mail(void *data) memset(mail_list, 0, max_account_id * sizeof(GList *)); for (i = 0; i < checked_count; i++) { - Eina_List *nth_list = eina_list_nth_list(mailbox_ugd->selected_mail_list, i); + Eina_List *nth_list = eina_list_nth_list(view->selected_mail_list, i); MailItemData *ld = eina_list_data_get(nth_list); mail_list[ld->account_id-1] = g_list_prepend(mail_list[ld->account_id-1], GINT_TO_POINTER(ld->mail_id)); @@ -361,7 +361,7 @@ void mailbox_to_spam_mail(void *data) debug_log("notification_status_message_post() failed: %d", ret); } - mailbox_ugd->need_deleted_noti = false; + view->need_deleted_noti = false; for (i = 0; i < max_account_id; i++) { if (!mail_list[i]) continue; @@ -399,7 +399,7 @@ void mailbox_to_spam_mail(void *data) } } } - mailbox_exit_edit_mode(mailbox_ugd); + mailbox_exit_edit_mode(view); } void mailbox_markunread_mail(void *data) @@ -411,7 +411,7 @@ void mailbox_markunread_mail(void *data) return; } - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; int i = 0; int max_account_id = email_engine_get_max_account_id(); int ret = 0; @@ -421,9 +421,9 @@ void mailbox_markunread_mail(void *data) return; } - int checked_count = eina_list_count(mailbox_ugd->selected_mail_list); + int checked_count = eina_list_count(view->selected_mail_list); - DELETE_EVAS_OBJECT(mailbox_ugd->more_ctxpopup); + DELETE_EVAS_OBJECT(view->more_ctxpopup); if (checked_count <= 0) return; @@ -431,7 +431,7 @@ void mailbox_markunread_mail(void *data) memset(mail_list, 0, max_account_id * sizeof(GList *)); for (i = 0; i < checked_count; i++) { - Eina_List *nth_list = eina_list_nth_list(mailbox_ugd->selected_mail_list, i); + Eina_List *nth_list = eina_list_nth_list(view->selected_mail_list, i); MailItemData *ld = eina_list_data_get(nth_list); mail_list[ld->account_id-1] = g_list_prepend(mail_list[ld->account_id-1], GINT_TO_POINTER(ld->mail_id)); } @@ -468,7 +468,7 @@ void mailbox_markunread_mail(void *data) debug_log("notification_status_message_post() failed: %d", ret); } - mailbox_exit_edit_mode(mailbox_ugd); + mailbox_exit_edit_mode(view); for (i = 0; i < max_account_id; ++i) { if (mail_list[i] != NULL) { @@ -487,7 +487,7 @@ void mailbox_markread_mail(void *data) return; } - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; int i = 0; int max_account_id = email_engine_get_max_account_id(); int ret = 0; @@ -497,9 +497,9 @@ void mailbox_markread_mail(void *data) return; } - int checked_count = eina_list_count(mailbox_ugd->selected_mail_list); + int checked_count = eina_list_count(view->selected_mail_list); - DELETE_EVAS_OBJECT(mailbox_ugd->more_ctxpopup); + DELETE_EVAS_OBJECT(view->more_ctxpopup); if (checked_count <= 0) return; @@ -507,7 +507,7 @@ void mailbox_markread_mail(void *data) memset(mail_list, 0, max_account_id * sizeof(GList *)); for (i = 0; i < checked_count; i++) { - Eina_List *nth_list = eina_list_nth_list(mailbox_ugd->selected_mail_list, i); + Eina_List *nth_list = eina_list_nth_list(view->selected_mail_list, i); MailItemData *ld = eina_list_data_get(nth_list); mail_list[ld->account_id-1] = g_list_prepend(mail_list[ld->account_id-1], GINT_TO_POINTER(ld->mail_id)); } @@ -544,7 +544,7 @@ void mailbox_markread_mail(void *data) debug_log("notification_status_message_post() failed: %d", ret); } - mailbox_exit_edit_mode(mailbox_ugd); + mailbox_exit_edit_mode(view); for (i = 0; i < max_account_id; ++i) { if (mail_list[i] != NULL) { diff --git a/Project-Files/modules/mailbox/src/email-mailbox-util.c b/Project-Files/modules/mailbox/src/email-mailbox-util.c index d813f99..cdbada3 100644 --- a/Project-Files/modules/mailbox/src/email-mailbox-util.c +++ b/Project-Files/modules/mailbox/src/email-mailbox-util.c @@ -42,7 +42,7 @@ EMAIL_DEFINE_GET_EDJ_PATH(email_get_mailbox_theme_path, "/email-mailbox.edj") */ typedef struct _EmailMailboxIdlerData { - void *mailbox_ugd; + void *view; void *data; } EmailMailboxIdlerData; @@ -70,21 +70,21 @@ static void _mailbox_password_popup_ok_cb(void *data, Evas_Object *obj, void *ev { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - mailbox_sync_folder_with_new_password((int)(ptrdiff_t)event_info, mailbox_ugd->sync_needed_mailbox_id, data); - mailbox_ugd->sync_needed_mailbox_id = -1; + mailbox_sync_folder_with_new_password((int)(ptrdiff_t)event_info, view->sync_needed_mailbox_id, data); + view->sync_needed_mailbox_id = -1; - DELETE_EVAS_OBJECT(mailbox_ugd->passwd_popup); + DELETE_EVAS_OBJECT(view->passwd_popup); } static void _mailbox_password_popup_canceled_cb(void *data, Evas_Object *obj, void *event_info) { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; - DELETE_EVAS_OBJECT(mailbox_ugd->passwd_popup); - mailbox_ugd->sync_needed_mailbox_id = -1; + EmailMailboxView *view = (EmailMailboxView *)data; + DELETE_EVAS_OBJECT(view->passwd_popup); + view->sync_needed_mailbox_id = -1; } @@ -156,19 +156,19 @@ static int _is_yesterday(const time_t req_time) * Definition for exported functions */ -void mailbox_clear_prev_mailbox_info(EmailMailboxUGD *mailbox_ugd) +void mailbox_clear_prev_mailbox_info(EmailMailboxView *view) { debug_enter(); - G_FREE(mailbox_ugd->account_name); - G_FREE(mailbox_ugd->mailbox_alias); - mailbox_ugd->account_id = 0; - mailbox_ugd->mode = EMAIL_MAILBOX_MODE_UNKOWN; - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_NONE; - mailbox_ugd->mailbox_id = 0; + G_FREE(view->account_name); + G_FREE(view->mailbox_alias); + view->account_id = 0; + view->mode = EMAIL_MAILBOX_MODE_UNKOWN; + view->mailbox_type = EMAIL_MAILBOX_TYPE_NONE; + view->mailbox_id = 0; } -void mailbox_set_last_updated_time(time_t last_update_time, EmailMailboxUGD *mailbox_ugd) +void mailbox_set_last_updated_time(time_t last_update_time, EmailMailboxView *view) { debug_enter(); @@ -181,17 +181,17 @@ void mailbox_set_last_updated_time(time_t last_update_time, EmailMailboxUGD *mai retm_if(ret != I18N_ERROR_NONE, "i18n_ulocale_get_default() failed! ret:[%d]"); if (_is_today(last_update_time)) { - skeleton = (!mailbox_ugd->b_format_24hour) ? + skeleton = (!view->b_format_24hour) ? EMAIL_TIME_FORMAT_12 : EMAIL_TIME_FORMAT_24; formatted_text = email_get_date_text(icu_locale, skeleton, &last_update_time); snprintf(updatetime, sizeof(updatetime), "%s : %s %s", _("IDS_EMAIL_BODY_LAST_UPDATED"), _("IDS_EMAIL_BODY_TODAY"), formatted_text); } else if (_is_yesterday(last_update_time)) { - skeleton = (!mailbox_ugd->b_format_24hour) ? + skeleton = (!view->b_format_24hour) ? EMAIL_TIME_FORMAT_12 : EMAIL_TIME_FORMAT_24; formatted_text = email_get_date_text(icu_locale, skeleton, &last_update_time); snprintf(updatetime, sizeof(updatetime), "%s : %s %s", _("IDS_EMAIL_BODY_LAST_UPDATED"), _("IDS_EMAIL_BODY_YESTERDAY"), formatted_text); } else { - skeleton = (!mailbox_ugd->b_format_24hour) ? + skeleton = (!view->b_format_24hour) ? EMAIL_DATETIME_FORMAT_12 : EMAIL_DATETIME_FORMAT_24; formatted_text = email_get_date_text(icu_locale, skeleton, &last_update_time); snprintf(updatetime, sizeof(updatetime), "%s : %s", _("IDS_EMAIL_BODY_LAST_UPDATED"), formatted_text); @@ -200,10 +200,10 @@ void mailbox_set_last_updated_time(time_t last_update_time, EmailMailboxUGD *mai debug_secure("date&time: %d [%s]", last_update_time, updatetime); FREE(formatted_text); - FREE(mailbox_ugd->last_updated_time); - mailbox_ugd->last_updated_time = calloc(1, LAST_UPDATED_TIME); - retm_if(!mailbox_ugd->last_updated_time, "mailbox_ugd->last_updated_time is NULL!"); - memcpy(mailbox_ugd->last_updated_time, updatetime, LAST_UPDATED_TIME); + FREE(view->last_updated_time); + view->last_updated_time = calloc(1, LAST_UPDATED_TIME); + retm_if(!view->last_updated_time, "view->last_updated_time is NULL!"); + memcpy(view->last_updated_time, updatetime, LAST_UPDATED_TIME); } @@ -216,13 +216,13 @@ int mailbox_compare_mailid_in_list(gconstpointer a, gconstpointer b) return 1; } -Evas_Object *mailbox_create_timeout_popup(EmailMailboxUGD *mailbox_ugd, const char *title_text, const char *contents_text, double timeout) +Evas_Object *mailbox_create_timeout_popup(EmailMailboxView *view, const char *title_text, const char *contents_text, double timeout) { debug_enter(); - retvm_if(!mailbox_ugd, NULL, "mailbox_ugd is NULL"); + retvm_if(!view, NULL, "view is NULL"); retvm_if(!contents_text, NULL, "contents_text is NULL"); - Evas_Object *popup = elm_popup_add(mailbox_ugd->base.module->navi); + Evas_Object *popup = elm_popup_add(view->base.module->navi); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); @@ -242,17 +242,17 @@ Evas_Object *mailbox_create_timeout_popup(EmailMailboxUGD *mailbox_ugd, const ch return popup; } -Evas_Object *mailbox_create_popup(EmailMailboxUGD *mailbox_ugd, const char *title, const char *content, Evas_Smart_Cb back_button_cb, +Evas_Object *mailbox_create_popup(EmailMailboxView *view, const char *title, const char *content, Evas_Smart_Cb back_button_cb, Evas_Smart_Cb btn1_response_cb, const char *btn1_text, Evas_Smart_Cb btn2_response_cb, const char *btn2_text) { debug_enter(); - retvm_if(!mailbox_ugd, NULL, "mailbox_ugd is NULL"); + retvm_if(!view, NULL, "view is NULL"); retvm_if(!content, NULL, "content is NULL"); retvm_if(!back_button_cb, NULL, "response_cb is NULL"); retvm_if(!btn1_response_cb || !btn1_text, NULL, "btn1_response_cb or btn1_text is NULL"); - Evas_Object *popup = elm_popup_add(mailbox_ugd->base.module->navi); - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, back_button_cb, mailbox_ugd); + Evas_Object *popup = elm_popup_add(view->base.module->navi); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, back_button_cb, view); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); @@ -268,21 +268,21 @@ Evas_Object *mailbox_create_popup(EmailMailboxUGD *mailbox_ugd, const char *titl elm_object_style_set(btn1, "popup"); elm_object_domain_translatable_text_set(btn1, PACKAGE, btn1_text); elm_object_part_content_set(popup, "button1", btn1); - evas_object_smart_callback_add(btn1, "clicked", btn1_response_cb, mailbox_ugd); + evas_object_smart_callback_add(btn1, "clicked", btn1_response_cb, view); elm_object_focus_set(btn1, EINA_TRUE); Evas_Object *btn2 = elm_button_add(popup); elm_object_style_set(btn2, "popup"); elm_object_domain_translatable_text_set(btn2, PACKAGE, btn2_text); elm_object_part_content_set(popup, "button2", btn2); - evas_object_smart_callback_add(btn2, "clicked", btn2_response_cb, mailbox_ugd); + evas_object_smart_callback_add(btn2, "clicked", btn2_response_cb, view); } else { Evas_Object *btn1 = elm_button_add(popup); elm_object_style_set(btn1, "popup"); elm_object_domain_translatable_text_set(btn1, PACKAGE, btn1_text); elm_object_part_content_set(popup, "button1", btn1); - evas_object_smart_callback_add(btn1, "clicked", btn1_response_cb, mailbox_ugd); + evas_object_smart_callback_add(btn1, "clicked", btn1_response_cb, view); elm_object_focus_set(btn1, EINA_TRUE); } @@ -291,7 +291,7 @@ Evas_Object *mailbox_create_popup(EmailMailboxUGD *mailbox_ugd, const char *titl return popup; } -void mailbox_create_error_popup(int error_type, int account_id, EmailMailboxUGD *mailbox_ugd) +void mailbox_create_error_popup(int error_type, int account_id, EmailMailboxView *view) { debug_enter(); @@ -344,59 +344,59 @@ void mailbox_create_password_changed_popup(void *data, int account_id) { debug_enter(); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - DELETE_EVAS_OBJECT(mailbox_ugd->passwd_popup); - mailbox_ugd->passwd_popup = email_util_create_password_changed_popup( - mailbox_ugd->base.module->navi, account_id, _mailbox_password_popup_ok_cb, + DELETE_EVAS_OBJECT(view->passwd_popup); + view->passwd_popup = email_util_create_password_changed_popup( + view->base.module->navi, account_id, _mailbox_password_popup_ok_cb, _mailbox_password_popup_canceled_cb, data); } -void mailbox_check_sort_type_validation(EmailMailboxUGD *mailbox_ugd) +void mailbox_check_sort_type_validation(EmailMailboxView *view) { debug_enter(); - if (mailbox_ugd->sort_type == EMAIL_SORT_IMPORTANT) { - if (!(mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX && - mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX && mailbox_ugd->mailbox_type != EMAIL_MAILBOX_TYPE_DRAFT)) { + if (view->sort_type == EMAIL_SORT_IMPORTANT) { + if (!(view->mode == EMAIL_MAILBOX_MODE_MAILBOX && + view->mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX && view->mailbox_type != EMAIL_MAILBOX_TYPE_DRAFT)) { debug_log("Account options. sort_type is changed into EMAIL_SORT_DATE_RECENT"); - mailbox_ugd->sort_type_index = SORTBY_DATE_RECENT; - mailbox_ugd->sort_type = EMAIL_SORT_DATE_RECENT; + view->sort_type_index = SORTBY_DATE_RECENT; + view->sort_type = EMAIL_SORT_DATE_RECENT; } } - if (mailbox_ugd->sort_type == EMAIL_SORT_TO_CC_BCC) { - if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX || - mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT || - mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_SENTBOX) { + if (view->sort_type == EMAIL_SORT_TO_CC_BCC) { + if (view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX || + view->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT || + view->mailbox_type == EMAIL_MAILBOX_TYPE_SENTBOX) { debug_log("Not outbox options. sort_type is changed into EMAIL_SORT_DATE_RECENT"); - mailbox_ugd->sort_type_index = SORTBY_DATE_RECENT; - mailbox_ugd->sort_type = EMAIL_SORT_DATE_RECENT; + view->sort_type_index = SORTBY_DATE_RECENT; + view->sort_type = EMAIL_SORT_DATE_RECENT; } } } -void mailbox_account_color_list_add(EmailMailboxUGD *mailbox_ugd, int account_id, int account_color) +void mailbox_account_color_list_add(EmailMailboxView *view, int account_id, int account_color) { debug_enter(); - retm_if(!mailbox_ugd, "invalid parameter, mailbox_ugd is NULL"); + retm_if(!view, "invalid parameter, view is NULL"); debug_log("account_color : %d", account_color); MailboxAccountColor *account_color_data = MEM_ALLOC(account_color_data, 1); account_color_data->account_id = account_id; account_color_data->account_color = account_color; - mailbox_ugd->account_color_list = g_list_append(mailbox_ugd->account_color_list, account_color_data); + view->account_color_list = g_list_append(view->account_color_list, account_color_data); } -void mailbox_account_color_list_update(EmailMailboxUGD *mailbox_ugd, int account_id, int update_color) +void mailbox_account_color_list_update(EmailMailboxView *view, int account_id, int update_color) { debug_enter(); - retm_if(account_id <= 0 || !mailbox_ugd, "invalid parameter, account_id : %d", account_id); + retm_if(account_id <= 0 || !view, "invalid parameter, account_id : %d", account_id); - if (mailbox_ugd->account_color_list) { + if (view->account_color_list) { GList *cur = NULL; MailboxAccountColor *account_color_data = NULL; - G_LIST_FOREACH(mailbox_ugd->account_color_list, cur, account_color_data) { + G_LIST_FOREACH(view->account_color_list, cur, account_color_data) { if (account_color_data->account_id == account_id) { account_color_data->account_color = update_color; break; @@ -405,18 +405,18 @@ void mailbox_account_color_list_update(EmailMailboxUGD *mailbox_ugd, int account } } -void mailbox_account_color_list_remove(EmailMailboxUGD *mailbox_ugd, int account_id) +void mailbox_account_color_list_remove(EmailMailboxView *view, int account_id) { debug_enter(); - retm_if(account_id <= 0 || !mailbox_ugd, "invalid parameter, account_id : %d", account_id); + retm_if(account_id <= 0 || !view, "invalid parameter, account_id : %d", account_id); debug_log("account_id : %d", account_id); - if (mailbox_ugd->account_color_list) { + if (view->account_color_list) { GList *cur = NULL; MailboxAccountColor *account_color_data = NULL; - G_LIST_FOREACH(mailbox_ugd->account_color_list, cur, account_color_data) { + G_LIST_FOREACH(view->account_color_list, cur, account_color_data) { if (account_color_data->account_id == account_id) { - mailbox_ugd->account_color_list = g_list_remove(mailbox_ugd->account_color_list, account_color_data); + view->account_color_list = g_list_remove(view->account_color_list, account_color_data); FREE(account_color_data); break; } @@ -424,17 +424,17 @@ void mailbox_account_color_list_remove(EmailMailboxUGD *mailbox_ugd, int account } } -int mailbox_account_color_list_get_account_color(EmailMailboxUGD *mailbox_ugd, int account_id) +int mailbox_account_color_list_get_account_color(EmailMailboxView *view, int account_id) { - if (account_id <= 0 || !mailbox_ugd) { + if (account_id <= 0 || !view) { debug_log("invalid parameter, account_id : %d", account_id); return 0; } - if (mailbox_ugd->account_color_list) { + if (view->account_color_list) { GList *cur = NULL; MailboxAccountColor *account_color_data = NULL; - G_LIST_FOREACH(mailbox_ugd->account_color_list, cur, account_color_data) { + G_LIST_FOREACH(view->account_color_list, cur, account_color_data) { if (account_color_data->account_id == account_id) { return account_color_data->account_color; } @@ -443,20 +443,20 @@ int mailbox_account_color_list_get_account_color(EmailMailboxUGD *mailbox_ugd, i return 0; } -void mailbox_account_color_list_free(EmailMailboxUGD *mailbox_ugd) +void mailbox_account_color_list_free(EmailMailboxView *view) { - retm_if(mailbox_ugd == NULL, "mailbox_ugd[NULL]"); + retm_if(view == NULL, "view[NULL]"); - debug_log("mailbox_ugd->account_color_list(%p)", mailbox_ugd->account_color_list); + debug_log("view->account_color_list(%p)", view->account_color_list); - if (mailbox_ugd->account_color_list) { + if (view->account_color_list) { GList *cur = NULL; MailboxAccountColor *account_color_data = NULL; - G_LIST_FOREACH(mailbox_ugd->account_color_list, cur, account_color_data) { + G_LIST_FOREACH(view->account_color_list, cur, account_color_data) { FREE(account_color_data); } - g_list_free(mailbox_ugd->account_color_list); - mailbox_ugd->account_color_list = NULL; + g_list_free(view->account_color_list); + view->account_color_list = NULL; } } diff --git a/Project-Files/modules/mailbox/src/email-mailbox.c b/Project-Files/modules/mailbox/src/email-mailbox.c index 9afb767..61637bf 100644 --- a/Project-Files/modules/mailbox/src/email-mailbox.c +++ b/Project-Files/modules/mailbox/src/email-mailbox.c @@ -15,10 +15,6 @@ * */ -#ifndef UG_MODULE_API -#define UG_MODULE_API __attribute__ ((visibility("default"))) -#endif - #include #include #include @@ -29,7 +25,7 @@ #include "email-mailbox-list-other-items.h" #include "email-mailbox-search.h" #include "email-mailbox-noti-mgr.h" -#include "email-mailbox-ug-util.h" +#include "email-mailbox-module-util.h" #include "email-mailbox-util.h" #include "email-mailbox-more-menu.h" #include "email-mailbox-sync.h" @@ -67,8 +63,8 @@ static void _mailbox_on_message(email_module_t *self, email_params_h msg); static void _mailbox_email_service_ping_thread_heavy_cb(void *data, Ecore_Thread *thread); static void _mailbox_email_service_ping_thread_notify_cb(void *data, Ecore_Thread *thread, void *msg_data); -static int _mailbox_module_create_view(EmailMailboxModule *md); -static int _mailbox_create_account_setting_module(EmailMailboxUGD *mailbox_ugd); +static int _mailbox_module_create_view(EmailMailboxModule *module); +static int _mailbox_create_account_setting_module(EmailMailboxView *view); static int _mailbox_create(email_view_t *self); static void _mailbox_destroy(email_view_t *self); @@ -77,26 +73,26 @@ static void _mailbox_deactivate(email_view_t *self); static void _mailbox_update(email_view_t *self, int flags); static void _mailbox_on_back_key(email_view_t *self); -static int _mailbox_initialize(EmailMailboxUGD *mailbox_ugd); -static void _mailbox_finalize(EmailMailboxUGD *mailbox_ugd); +static int _mailbox_initialize(EmailMailboxView *view); +static void _mailbox_finalize(EmailMailboxView *view); static email_run_type_e _mailbox_params_get_run_type(email_params_h params); static int _mailbox_params_get_account_id(email_params_h params); static int _mailbox_params_get_mail_id(email_params_h params); -static int _mailbox_handle_launch_mailbox_bundle_val(EmailMailboxUGD *mailbox_ugd, email_params_h msg); -static int _mailbox_handle_launch_viewer_bundle_val(EmailMailboxUGD *mailbox_ugd, email_params_h msg); +static int _mailbox_handle_launch_mailbox_bundle_val(EmailMailboxView *view, email_params_h msg); +static int _mailbox_handle_launch_viewer_bundle_val(EmailMailboxView *view, email_params_h msg); -static void _mailbox_create_view(EmailMailboxUGD *mailbox_ugd); -static void _mailbox_delete_evas_object(EmailMailboxUGD *mailbox_ugd); +static void _mailbox_create_view(EmailMailboxView *view); +static void _mailbox_delete_evas_object(EmailMailboxView *view); static void _mailbox_timezone_change_cb(system_settings_key_e key, void *data); static void _mailbox_sys_settings_datetime_format_changed_cb(system_settings_key_e node, void *data); static void _mailbox_vip_rule_value_changed_cb(const char *key, void *data); static void _mailbox_title_clicked_cb(void *data, Evas_Object *obj, void *event_info); -static void _mailbox_module_show_initialising_popup(EmailMailboxModule *md); +static void _mailbox_module_show_initialising_popup(EmailMailboxModule *module); static void _mailbox_initialising_popup_back_cb(void *data, Evas_Object *obj, void *event_info); -static int _mailbox_push_base_view_layout(EmailMailboxUGD *mailbox_ugd); +static int _mailbox_push_base_view_layout(EmailMailboxView *view); /* * Definition for static functions @@ -107,36 +103,36 @@ static int _mailbox_module_create(email_module_t *self, email_params_h params) debug_enter(); retvm_if(!self, -1, "self is NULL"); - EmailMailboxModule *md = (EmailMailboxModule *)self; + EmailMailboxModule *module = (EmailMailboxModule *)self; - md->view.run_type = _mailbox_params_get_run_type(params); + module->view.run_type = _mailbox_params_get_run_type(params); - if (md->view.run_type == RUN_MAILBOX_FROM_NOTIFICATION) { - md->view.account_id = _mailbox_params_get_account_id(params); - } else if (md->view.run_type == RUN_VIEWER_FROM_NOTIFICATION) { - md->view.start_mail_id = _mailbox_params_get_mail_id(params); + if (module->view.run_type == RUN_MAILBOX_FROM_NOTIFICATION) { + module->view.account_id = _mailbox_params_get_account_id(params); + } else if (module->view.run_type == RUN_VIEWER_FROM_NOTIFICATION) { + module->view.start_mail_id = _mailbox_params_get_mail_id(params); } - md->start_thread = ecore_thread_feedback_run(_mailbox_email_service_ping_thread_heavy_cb, - _mailbox_email_service_ping_thread_notify_cb, NULL, NULL, md, EINA_TRUE); - if (!md->start_thread) { + module->start_thread = ecore_thread_feedback_run(_mailbox_email_service_ping_thread_heavy_cb, + _mailbox_email_service_ping_thread_notify_cb, NULL, NULL, module, EINA_TRUE); + if (!module->start_thread) { debug_error("Start thread create failed!"); return -1; } double wait_time = 0.0; - while (!md->start_thread_done) { + while (!module->start_thread_done) { usleep(EMAIL_SERIVE_PING_CHECK_INTERVAL_USEC); wait_time += EMAIL_SERIVE_PING_CHECK_INTERVAL_SEC; if (wait_time >= EMAIL_SERIVE_PING_TIMEOUT_SEC) { - _mailbox_module_show_initialising_popup(md); + _mailbox_module_show_initialising_popup(module); debug_leave(); return 0; } } - _mailbox_email_service_ping_thread_notify_cb(md, NULL, NULL); + _mailbox_email_service_ping_thread_notify_cb(module, NULL, NULL); debug_leave(); return 0; @@ -147,11 +143,11 @@ static void _mailbox_module_destroy(email_module_t *self) debug_enter(); retm_if(!self, "self is NULL"); - EmailMailboxModule *md = (EmailMailboxModule *)self; + EmailMailboxModule *module = (EmailMailboxModule *)self; - if (md->start_thread) { - ecore_thread_cancel(md->start_thread); - md->start_thread = NULL; + if (module->start_thread) { + ecore_thread_cancel(module->start_thread); + module->start_thread = NULL; } debug_leave(); @@ -162,7 +158,7 @@ static void _mailbox_email_service_ping_thread_heavy_cb(void *data, Ecore_Thread debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxModule *md = data; + EmailMailboxModule *module = data; gboolean first = true; gboolean ret = false; @@ -182,7 +178,7 @@ static void _mailbox_email_service_ping_thread_heavy_cb(void *data, Ecore_Thread if (ret) { ecore_thread_feedback(thread, NULL); - md->start_thread_done = true; + module->start_thread_done = true; } email_engine_finalize_force(); @@ -196,36 +192,36 @@ static void _mailbox_email_service_ping_thread_notify_cb(void *data, Ecore_Threa debug_enter(); retm_if(!data, "data is NULL"); - EmailMailboxModule *md = data; + EmailMailboxModule *module = data; - if (md->start_thread) { - md->start_thread = NULL; - if (_mailbox_module_create_view(md) != 0) { + if (module->start_thread) { + module->start_thread = NULL; + if (_mailbox_module_create_view(module) != 0) { debug_error("_mailbox_module_create_view() failed!"); - email_module_make_destroy_request(&md->base); + email_module_make_destroy_request(&module->base); return; } - DELETE_EVAS_OBJECT(md->init_pupup); + DELETE_EVAS_OBJECT(module->init_pupup); } debug_leave(); } -static int _mailbox_module_create_view(EmailMailboxModule *md) +static int _mailbox_module_create_view(EmailMailboxModule *module) { debug_enter(); - retvm_if(!md, -1, "md is NULL"); + retvm_if(!module, -1, "module is NULL"); int ret = 0; - md->view.base.create = _mailbox_create; - md->view.base.destroy = _mailbox_destroy; - md->view.base.activate = _mailbox_activate; - md->view.base.deactivate = _mailbox_deactivate; - md->view.base.update = _mailbox_update; - md->view.base.on_back_key = _mailbox_on_back_key; + module->view.base.create = _mailbox_create; + module->view.base.destroy = _mailbox_destroy; + module->view.base.activate = _mailbox_activate; + module->view.base.deactivate = _mailbox_deactivate; + module->view.base.update = _mailbox_update; + module->view.base.on_back_key = _mailbox_on_back_key; - ret = email_module_create_view(&md->base, &md->view.base); + ret = email_module_create_view(&module->base, &module->view.base); if (ret != 0) { debug_error("email_module_create_view(): failed (%d)", ret); return -1; @@ -235,22 +231,22 @@ static int _mailbox_module_create_view(EmailMailboxModule *md) return 0; } -static int _mailbox_create_account_setting_module(EmailMailboxUGD *mailbox_ugd) +static int _mailbox_create_account_setting_module(EmailMailboxView *view) { debug_enter(); - retvm_if(!mailbox_ugd, -1, "mailbox_ugd is NULL"); + retvm_if(!view, -1, "view is NULL"); email_params_h params = NULL; if (email_params_create(¶ms) && email_params_add_str(params, EMAIL_BUNDLE_KEY_VIEW_TYPE, EMAIL_BUNDLE_VAL_VIEW_ACCOUNT_SETUP)) { - mailbox_ugd->setting = mailbox_setting_module_create(mailbox_ugd, EMAIL_MODULE_SETTING, params); + view->setting = mailbox_setting_module_create(view, EMAIL_MODULE_SETTING, params); } email_params_free(¶ms); - retvm_if(!mailbox_ugd->setting, -1, "mailbox_setting_module_create() failed!"); + retvm_if(!view->setting, -1, "mailbox_setting_module_create() failed!"); debug_leave(); return 0; @@ -328,115 +324,115 @@ static int _mailbox_create(email_view_t *self) debug_enter(); retvm_if(!self, -1, "self is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)self; + EmailMailboxView *view = (EmailMailboxView *)self; int ret = 0; int default_account_id = 0; - email_run_type_e run_type = mailbox_ugd->run_type; + email_run_type_e run_type = view->run_type; if (!email_engine_initialize()) { debug_error("Failed to initialize email engine"); return -1; } - ret = _mailbox_push_base_view_layout(mailbox_ugd); + ret = _mailbox_push_base_view_layout(view); retvm_if(ret != 0, -1, "_mailbox_push_base_view_layout() failed! ret: [%d]", ret); if (!email_engine_get_default_account(&default_account_id)) { debug_log("No default account. Creating account setup setting view..."); - mailbox_ugd->account_id = 0; - return _mailbox_create_account_setting_module(mailbox_ugd); + view->account_id = 0; + return _mailbox_create_account_setting_module(view); } - mailbox_ugd->run_type = RUN_TYPE_UNKNOWN; - mailbox_ugd->b_ready_for_initialize = true; + view->run_type = RUN_TYPE_UNKNOWN; + view->b_ready_for_initialize = true; if (run_type == RUN_VIEWER_FROM_NOTIFICATION) { - email_mail_list_item_t *mail = email_engine_get_mail_by_mailid(mailbox_ugd->start_mail_id); + email_mail_list_item_t *mail = email_engine_get_mail_by_mailid(view->start_mail_id); retvm_if(!mail, -1, "email_engine_get_mail_by_mailid() failed!"); - mailbox_ugd->account_id = mail->account_id; - mailbox_ugd->mailbox_id = mail->mailbox_id; - return mailbox_open_email_viewer(mailbox_ugd, mail->account_id, mail->mailbox_id, mailbox_ugd->start_mail_id); + view->account_id = mail->account_id; + view->mailbox_id = mail->mailbox_id; + return mailbox_open_email_viewer(view, mail->account_id, mail->mailbox_id, view->start_mail_id); } debug_leave(); - return _mailbox_initialize(mailbox_ugd); + return _mailbox_initialize(view); } -static int _mailbox_initialize(EmailMailboxUGD *mailbox_ugd) +static int _mailbox_initialize(EmailMailboxView *view) { debug_enter(); - retvm_if(!mailbox_ugd, -1, "mailbox_ugd is NULL"); - retvm_if(!mailbox_ugd->b_ready_for_initialize, -1, "mailbox_ugd->b_ready_for_initialize is false"); + retvm_if(!view, -1, "view is NULL"); + retvm_if(!view->b_ready_for_initialize, -1, "view->b_ready_for_initialize is false"); /* init members of mailbox */ - mailbox_ugd->initialized = true; - mailbox_ugd->account_count = 0; - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_NONE; - mailbox_ugd->sort_type = EMAIL_SORT_DATE_RECENT; - mailbox_ugd->sort_type_index = SORTBY_DATE_RECENT; - mailbox_ugd->only_local = false; - mailbox_ugd->gl = NULL; - mailbox_ugd->mail_list = NULL; - mailbox_ugd->b_editmode = false; - mailbox_ugd->g_sending_mail_list = NULL; - mailbox_ugd->is_send_all_run = false; - mailbox_ugd->account_type = EMAIL_SERVER_TYPE_NONE; - mailbox_ugd->b_format_24hour = false; + view->initialized = true; + view->account_count = 0; + view->mailbox_type = EMAIL_MAILBOX_TYPE_NONE; + view->sort_type = EMAIL_SORT_DATE_RECENT; + view->sort_type_index = SORTBY_DATE_RECENT; + view->only_local = false; + view->gl = NULL; + view->mail_list = NULL; + view->b_editmode = false; + view->g_sending_mail_list = NULL; + view->is_send_all_run = false; + view->account_type = EMAIL_SERVER_TYPE_NONE; + view->b_format_24hour = false; /* DBUS */ - mailbox_setup_dbus_receiver(mailbox_ugd); + mailbox_setup_dbus_receiver(view); system_settings_get_value_bool( SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, - &mailbox_ugd->b_format_24hour); + &view->b_format_24hour); - mailbox_ugd->request_queue = email_request_queue_create(); + view->request_queue = email_request_queue_create(); /* register thread callbacks for mailbox thread operation */ mailbox_requests_cbs_register(); /* create accouts list view */ - _mailbox_create_view(mailbox_ugd); + _mailbox_create_view(view); int account_count = 0; email_account_t *account_list = NULL; if (email_engine_get_account_list(&account_count, &account_list)) - mailbox_ugd->account_count = account_count; + view->account_count = account_count; else - mailbox_ugd->account_count = 0; + view->account_count = 0; - if (account_list && (mailbox_ugd->account_count > 0)) { + if (account_list && (view->account_count > 0)) { int i; for (i = 0; i < account_count; i++) { - mailbox_account_color_list_add(mailbox_ugd, account_list[i].account_id, account_list[i].color_label); + mailbox_account_color_list_add(view, account_list[i].account_id, account_list[i].color_label); } } - if ((mailbox_ugd->account_id == 0 && mailbox_ugd->account_count > 1) - || (mailbox_ugd->account_count == 0)) { - mailbox_ugd->account_id = 0; - mailbox_ugd->mode = EMAIL_MAILBOX_MODE_ALL; - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; + if ((view->account_id == 0 && view->account_count > 1) + || (view->account_count == 0)) { + view->account_id = 0; + view->mode = EMAIL_MAILBOX_MODE_ALL; + view->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; } else { int err = 0; email_mailbox_t *mailbox = NULL; - mailbox_ugd->mode = EMAIL_MAILBOX_MODE_MAILBOX; - if (mailbox_ugd->account_id == 0 && account_list) { - mailbox_ugd->account_id = account_list[0].account_id; /* If one account is only registered, launch mailbox mode by using first account id. */ - mailbox_ugd->mailbox_id = 0; + view->mode = EMAIL_MAILBOX_MODE_MAILBOX; + if (view->account_id == 0 && account_list) { + view->account_id = account_list[0].account_id; /* If one account is only registered, launch mailbox mode by using first account id. */ + view->mailbox_id = 0; } - if (mailbox_ugd->mailbox_id == 0) { - err = email_get_mailbox_by_mailbox_type(mailbox_ugd->account_id, EMAIL_MAILBOX_TYPE_INBOX, &mailbox); + if (view->mailbox_id == 0) { + err = email_get_mailbox_by_mailbox_type(view->account_id, EMAIL_MAILBOX_TYPE_INBOX, &mailbox); if (err == EMAIL_ERROR_NONE && mailbox) { - mailbox_ugd->mailbox_id = mailbox->mailbox_id; + view->mailbox_id = mailbox->mailbox_id; email_free_mailbox(&mailbox, 1); } else { - mailbox_ugd->mailbox_id = 0; - debug_warning("email_get_mailbox_by_mailbox_type : account_id(%d) type(INBOX) - err(%d) or mailbox is NULL(%p)", mailbox_ugd->account_id, err, mailbox); + view->mailbox_id = 0; + debug_warning("email_get_mailbox_by_mailbox_type : account_id(%d) type(INBOX) - err(%d) or mailbox is NULL(%p)", view->account_id, err, mailbox); } } } @@ -444,16 +440,16 @@ static int _mailbox_initialize(EmailMailboxUGD *mailbox_ugd) if (account_list) email_engine_free_account_list(&account_list, account_count); - mailbox_view_title_update_all(mailbox_ugd); - mailbox_list_refresh(mailbox_ugd, NULL); + mailbox_view_title_update_all(view); + mailbox_list_refresh(view, NULL); /* register callbacks */ - system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, _mailbox_sys_settings_datetime_format_changed_cb, mailbox_ugd); - system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, _mailbox_sys_settings_datetime_format_changed_cb, mailbox_ugd); + system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, _mailbox_sys_settings_datetime_format_changed_cb, view); + system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, _mailbox_sys_settings_datetime_format_changed_cb, view); - mailbox_list_system_settings_callback_register(mailbox_ugd); + mailbox_list_system_settings_callback_register(view); - email_register_timezone_changed_callback(_mailbox_timezone_change_cb, mailbox_ugd); + email_register_timezone_changed_callback(_mailbox_timezone_change_cb, view); return 0; } @@ -463,40 +459,40 @@ static void _mailbox_activate(email_view_t *self, email_view_state prev_state) debug_enter(); retm_if(!self, "self is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)self; + EmailMailboxView *view = (EmailMailboxView *)self; - if (mailbox_ugd->initialized) { - if (!mailbox_ugd->started) { - mailbox_ugd->started = true; + if (view->initialized) { + if (!view->started) { + view->started = true; int res = email_update_vip_rule_value(); if (res != 0) { debug_error("email_update_vip_rule_value failed. err = %d", res); } - res = email_get_vip_rule_value(&mailbox_ugd->vip_rule_value); + res = email_get_vip_rule_value(&view->vip_rule_value); if (res != 0) { debug_error("email_get_vip_rule_value failed. err = %d", res); } - res = email_set_vip_rule_change_callback(_mailbox_vip_rule_value_changed_cb, mailbox_ugd); + res = email_set_vip_rule_change_callback(_mailbox_vip_rule_value_changed_cb, view); if (res != 0) { debug_error("email_set_vip_rule_change_callback failed. err = %d", res); } /* download new mails */ - if (mailbox_sync_current_mailbox(mailbox_ugd)) + if (mailbox_sync_current_mailbox(view)) { debug_log("Start sync"); } } - if (mailbox_ugd->remaining_req) { - mailbox_list_make_remaining_items_in_thread(mailbox_ugd, mailbox_ugd->remaining_req); - mailbox_ugd->remaining_req = NULL; + if (view->remaining_req) { + mailbox_list_make_remaining_items_in_thread(view, view->remaining_req); + view->remaining_req = NULL; } - mailbox_update_notifications_status(mailbox_ugd); + mailbox_update_notifications_status(view); } debug_leave(); @@ -507,10 +503,10 @@ static void _mailbox_deactivate(email_view_t *self) debug_enter(); retm_if(!self, "self is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)self; + EmailMailboxView *view = (EmailMailboxView *)self; - if (mailbox_ugd->initialized) { - mailbox_update_notifications_status(mailbox_ugd); + if (view->initialized) { + mailbox_update_notifications_status(view); } debug_leave(); @@ -521,24 +517,24 @@ static void _mailbox_update(email_view_t *self, int flags) debug_enter(); retm_if(!self, "self is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)self; + EmailMailboxView *view = (EmailMailboxView *)self; debug_log("flags: %d", flags); bool need_update = false; bool update_title = false; - if (!mailbox_ugd->initialized) { + if (!view->initialized) { if (flags & EVUF_POPPING) { int default_account_id = 0; if (!email_engine_get_default_account(&default_account_id)) { debug_log("No default account. Terminating..."); - email_module_make_destroy_request(mailbox_ugd->base.module); + email_module_make_destroy_request(view->base.module); } else { - mailbox_ugd->b_ready_for_initialize = true; - if (_mailbox_initialize(mailbox_ugd) != 0) { + view->b_ready_for_initialize = true; + if (_mailbox_initialize(view) != 0) { debug_error("Application initialization failed. Terminating..."); - email_module_make_destroy_request(mailbox_ugd->base.module); + email_module_make_destroy_request(view->base.module); } } } @@ -552,14 +548,14 @@ static void _mailbox_update(email_view_t *self, int flags) debug_error("email_update_viprule_value failed. err = %d", res); } else { #ifndef _FEATURE_PRIORITY_SENDER_DISABLE_ - if (mailbox_ugd->vip_rule_value != viprule_val && - mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { + if (view->vip_rule_value != viprule_val && + view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { debug_log("Mailbox list should be refreshed because vip setting is changed, priority sender view"); need_update = true; update_title = true; } #endif - mailbox_ugd->vip_rule_value = viprule_val; + view->vip_rule_value = viprule_val; } } @@ -573,7 +569,7 @@ static void _mailbox_update(email_view_t *self, int flags) } if (need_update) { - mailbox_refresh_fullview(mailbox_ugd, update_title); + mailbox_refresh_fullview(view, update_title); } } @@ -582,51 +578,51 @@ static void _mailbox_destroy(email_view_t *self) debug_enter(); retm_if(!self, "self is NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)self; + EmailMailboxView *view = (EmailMailboxView *)self; - _mailbox_finalize(mailbox_ugd); + _mailbox_finalize(view); email_engine_finalize(); debug_leave(); } -static void _mailbox_finalize(EmailMailboxUGD *mailbox_ugd) +static void _mailbox_finalize(EmailMailboxView *view) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd is NULL"); + retm_if(!view, "view is NULL"); - if (!mailbox_ugd->initialized) { + if (!view->initialized) { return; } - mailbox_ugd->initialized = false; + view->initialized = false; - if(mailbox_ugd->search_entry_focus_idler) { - ecore_idler_del(mailbox_ugd->search_entry_focus_idler); - mailbox_ugd->search_entry_focus_idler = NULL; + if(view->search_entry_focus_idler) { + ecore_idler_del(view->search_entry_focus_idler); + view->search_entry_focus_idler = NULL; } - mailbox_sync_cancel_all(mailbox_ugd); + mailbox_sync_cancel_all(view); - _mailbox_delete_evas_object(mailbox_ugd); + _mailbox_delete_evas_object(view); - mailbox_list_free_all_item_class_data(mailbox_ugd); + mailbox_list_free_all_item_class_data(view); - if (mailbox_ugd->request_queue) { - email_request_queue_destroy(mailbox_ugd->request_queue); - mailbox_ugd->request_queue = NULL; + if (view->request_queue) { + email_request_queue_destroy(view->request_queue); + view->request_queue = NULL; } mailbox_requests_cbs_unregister(); - mailbox_list_free_all_item_data(mailbox_ugd); + mailbox_list_free_all_item_data(view); - mailbox_sending_mail_list_free(mailbox_ugd); - mailbox_account_color_list_free(mailbox_ugd); + mailbox_sending_mail_list_free(view); + mailbox_account_color_list_free(view); - G_FREE(mailbox_ugd->mailbox_alias); - G_FREE(mailbox_ugd->account_name); - FREE(mailbox_ugd->last_updated_time); - G_FREE(mailbox_ugd->moved_mailbox_name); + G_FREE(view->mailbox_alias); + G_FREE(view->account_name); + FREE(view->last_updated_time); + G_FREE(view->moved_mailbox_name); email_unregister_timezone_changed_callback(_mailbox_timezone_change_cb); @@ -638,8 +634,8 @@ static void _mailbox_finalize(EmailMailboxUGD *mailbox_ugd) debug_error("email_unset_vip_rule_change_callback failed. err = %d", res); } - elm_theme_extension_del(mailbox_ugd->theme, email_get_mailbox_theme_path()); - elm_theme_free(mailbox_ugd->theme); + elm_theme_extension_del(view->theme, email_get_mailbox_theme_path()); + elm_theme_free(view->theme); mailbox_list_system_settings_callback_unregister(); @@ -652,19 +648,19 @@ static void _mailbox_on_message(email_module_t *self, email_params_h msg) debug_enter(); retm_if(!self, "self is NULL"); - EmailMailboxModule *md = (EmailMailboxModule *)self; - EmailMailboxUGD *mailbox_ugd = &md->view; + EmailMailboxModule *module = (EmailMailboxModule *)self; + EmailMailboxView *view = &module->view; email_run_type_e run_type = _mailbox_params_get_run_type(msg); - if (!mailbox_ugd->initialized && (_mailbox_initialize(mailbox_ugd) != 0)) { + if (!view->initialized && (_mailbox_initialize(view) != 0)) { debug_error("Initialize failed!"); return; } if (run_type == RUN_MAILBOX_FROM_NOTIFICATION) { - _mailbox_handle_launch_mailbox_bundle_val(mailbox_ugd, msg); + _mailbox_handle_launch_mailbox_bundle_val(view, msg); } else if (run_type == RUN_VIEWER_FROM_NOTIFICATION) { - _mailbox_handle_launch_viewer_bundle_val(mailbox_ugd, msg); + _mailbox_handle_launch_viewer_bundle_val(view, msg); } else { debug_log("Unknown msg type"); } @@ -673,30 +669,30 @@ static void _mailbox_on_message(email_module_t *self, email_params_h msg) return; } -int mailbox_handle_next_msg_bundle(EmailMailboxUGD *mailbox_ugd, email_params_h msg) +int mailbox_handle_next_msg_bundle(EmailMailboxView *view, email_params_h msg) { debug_enter(); - retvm_if(!mailbox_ugd, -1, "Error: mailbox_ugd is NULL"); + retvm_if(!view, -1, "Error: view is NULL"); debug_log("EMAIL_BUNDLE_VAL_NEXT_MSG"); - if (!mailbox_ugd->initialized && (_mailbox_initialize(mailbox_ugd) != 0)) { + if (!view->initialized && (_mailbox_initialize(view) != 0)) { debug_error("Initialize failed!"); return -1; } MailItemData *ld = NULL; - GList *first = g_list_first(mailbox_ugd->mail_list); - GList *last = g_list_last(mailbox_ugd->mail_list); + GList *first = g_list_first(view->mail_list); + GList *last = g_list_last(view->mail_list); int current_mail_index = -1; - int cnt = g_list_length(mailbox_ugd->mail_list); + int cnt = g_list_length(view->mail_list); debug_log("first %p, last %p, cnt: %d", first, last, cnt); email_params_get_int_opt(msg, EMAIL_BUNDLE_KEY_MAIL_INDEX, ¤t_mail_index); debug_log("current_mail_index: %d", current_mail_index); - GList *opened_mail = g_list_find_custom(mailbox_ugd->mail_list, GINT_TO_POINTER(mailbox_ugd->opened_mail_id), mailbox_compare_mailid_in_list); + GList *opened_mail = g_list_find_custom(view->mail_list, GINT_TO_POINTER(view->opened_mail_id), mailbox_compare_mailid_in_list); if (!opened_mail && current_mail_index > -1 && current_mail_index < cnt) { opened_mail = g_list_nth(first, current_mail_index); } else if (!opened_mail && current_mail_index > -1 && current_mail_index == cnt) { @@ -727,30 +723,30 @@ int mailbox_handle_next_msg_bundle(EmailMailboxUGD *mailbox_ugd, email_params_h } -int mailbox_handle_prev_msg_bundle(EmailMailboxUGD *mailbox_ugd, email_params_h msg) +int mailbox_handle_prev_msg_bundle(EmailMailboxView *view, email_params_h msg) { debug_enter(); - retvm_if(!mailbox_ugd, -1, "Error: mailbox_ugd is NULL"); + retvm_if(!view, -1, "Error: view is NULL"); debug_log("EMAIL_BUNDLE_VAL_PREV_MSG"); - if (!mailbox_ugd->initialized && (_mailbox_initialize(mailbox_ugd) != 0)) { + if (!view->initialized && (_mailbox_initialize(view) != 0)) { debug_error("Initialize failed!"); return -1; } MailItemData *ld = NULL; - GList *first = g_list_first(mailbox_ugd->mail_list); - GList *last = g_list_last(mailbox_ugd->mail_list); + GList *first = g_list_first(view->mail_list); + GList *last = g_list_last(view->mail_list); int current_mail_index = -1; - int cnt = g_list_length(mailbox_ugd->mail_list); + int cnt = g_list_length(view->mail_list); debug_log("first %p, last %p, cnt: %d", first, last, cnt); email_params_get_int_opt(msg, EMAIL_BUNDLE_KEY_MAIL_INDEX, ¤t_mail_index); debug_log("current_mail_index: %d", current_mail_index); - GList *opened_mail = g_list_find_custom(mailbox_ugd->mail_list, GINT_TO_POINTER(mailbox_ugd->opened_mail_id), mailbox_compare_mailid_in_list); + GList *opened_mail = g_list_find_custom(view->mail_list, GINT_TO_POINTER(view->opened_mail_id), mailbox_compare_mailid_in_list); if (!opened_mail && current_mail_index > -1 && current_mail_index < cnt) { opened_mail = g_list_nth(first, current_mail_index); } else if (!opened_mail && current_mail_index > -1 && current_mail_index == cnt) { @@ -782,47 +778,47 @@ int mailbox_handle_prev_msg_bundle(EmailMailboxUGD *mailbox_ugd, email_params_h return 0; } -static int _mailbox_destroy_child_modules(EmailMailboxUGD *mailbox_ugd, bool keep_viewer) +static int _mailbox_destroy_child_modules(EmailMailboxView *view, bool keep_viewer) { debug_enter(); - retvm_if(!mailbox_ugd, -1, "Error: mailbox_ugd is NULL"); + retvm_if(!view, -1, "Error: view is NULL"); email_params_h params = NULL; int ret = -1; - if (mailbox_ugd->account) { - mailbox_account_module_destroy(mailbox_ugd, mailbox_ugd->account); + if (view->account) { + mailbox_account_module_destroy(view, view->account); } - if (mailbox_ugd->setting) { - mailbox_setting_module_destroy(mailbox_ugd, mailbox_ugd->setting); + if (view->setting) { + mailbox_setting_module_destroy(view, view->setting); } - if (mailbox_ugd->viewer && !keep_viewer) { + if (view->viewer && !keep_viewer) { debug_log("Viewer is running. Need to destroy all viewer child modules."); if (email_params_create(¶ms) && email_params_add_str(params, EMAIL_BUNDLE_KEY_MSG, EMAIL_BUNDLE_VAL_VIEWER_DESTROY_VIEW)) { - ret = email_module_send_message(mailbox_ugd->viewer, params); + ret = email_module_send_message(view->viewer, params); } if (ret != 0) { debug_warning("Failed to send message to viewer. Forcing destroy."); - mailbox_viewer_module_destroy(mailbox_ugd, mailbox_ugd->viewer); + mailbox_viewer_module_destroy(view, view->viewer); } } - if (mailbox_ugd->composer) { + if (view->composer) { debug_log("Asking composer to save in drafts."); if (email_params_create(¶ms) && email_params_add_str(params, EMAIL_BUNDLE_KEY_MSG, EMAIL_BUNDLE_VAL_EMAIL_COMPOSER_SAVE_DRAFT)) { - ret = email_module_send_message(mailbox_ugd->viewer, params); + ret = email_module_send_message(view->viewer, params); } if (ret != 0) { debug_log("Failed to send message to composer. Forcing destroy."); - mailbox_composer_module_destroy(mailbox_ugd, mailbox_ugd->composer); + mailbox_composer_module_destroy(view, view->composer); } } @@ -832,80 +828,80 @@ static int _mailbox_destroy_child_modules(EmailMailboxUGD *mailbox_ugd, bool kee return 0; } -static int _mailbox_update_mailbox(EmailMailboxUGD *mailbox_ugd, int account_id, int mailbox_id) +static int _mailbox_update_mailbox(EmailMailboxView *view, int account_id, int mailbox_id) { debug_enter(); bool need_update = true; - if (account_id == mailbox_ugd->account_id) { + if (account_id == view->account_id) { if (mailbox_id == 0) { - if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX && - mailbox_ugd->mode != EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { + if (view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX && + view->mode != EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { need_update = false; } } else { - if (mailbox_ugd->mailbox_id == mailbox_id && - mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) { + if (view->mailbox_id == mailbox_id && + view->mode == EMAIL_MAILBOX_MODE_MAILBOX) { need_update = false; } } } - if (mailbox_ugd->b_editmode) { - mailbox_exit_edit_mode(mailbox_ugd); + if (view->b_editmode) { + mailbox_exit_edit_mode(view); } if (!need_update) { debug_log("the proper mailbox is shown now."); - if (mailbox_ugd->b_searchmode) { - mailbox_finish_search_mode(mailbox_ugd); + if (view->b_searchmode) { + mailbox_finish_search_mode(view); } return 0; } if (account_id == 0) { - mailbox_ugd->account_id = account_id; - mailbox_ugd->mode = EMAIL_MAILBOX_MODE_ALL; - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; - mailbox_ugd->only_local = FALSE; + view->account_id = account_id; + view->mode = EMAIL_MAILBOX_MODE_ALL; + view->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; + view->only_local = FALSE; } else { int err = 0; email_mailbox_t *mailbox = NULL; - mailbox_ugd->mode = EMAIL_MAILBOX_MODE_MAILBOX; - mailbox_ugd->account_id = account_id; - mailbox_ugd->mailbox_id = mailbox_id; + view->mode = EMAIL_MAILBOX_MODE_MAILBOX; + view->account_id = account_id; + view->mailbox_id = mailbox_id; if (mailbox_id == 0) { - err = email_get_mailbox_by_mailbox_type(mailbox_ugd->account_id, EMAIL_MAILBOX_TYPE_INBOX, &mailbox); + err = email_get_mailbox_by_mailbox_type(view->account_id, EMAIL_MAILBOX_TYPE_INBOX, &mailbox); if ((err == EMAIL_ERROR_NONE) && mailbox) { - mailbox_ugd->mailbox_id = mailbox->mailbox_id; + view->mailbox_id = mailbox->mailbox_id; email_free_mailbox(&mailbox, 1); } else { - debug_warning("email_get_mailbox_by_mailbox_type : account_id(%d) type(INBOX) - err(%d) or mailbox is NULL(%p)", mailbox_ugd->account_id, err, mailbox); - mailbox_ugd->mailbox_id = 0; + debug_warning("email_get_mailbox_by_mailbox_type : account_id(%d) type(INBOX) - err(%d) or mailbox is NULL(%p)", view->account_id, err, mailbox); + view->mailbox_id = 0; } } } - mailbox_view_title_update_all(mailbox_ugd); - mailbox_update_notifications_status(mailbox_ugd); - mailbox_check_sort_type_validation(mailbox_ugd); + mailbox_view_title_update_all(view); + mailbox_update_notifications_status(view); + mailbox_check_sort_type_validation(view); - if (mailbox_ugd->b_searchmode) { - mailbox_finish_search_mode(mailbox_ugd); + if (view->b_searchmode) { + mailbox_finish_search_mode(view); } else { - mailbox_list_refresh(mailbox_ugd, NULL); + mailbox_list_refresh(view, NULL); } debug_leave(); return 0; } -static int _mailbox_handle_launch_mailbox_bundle_val(EmailMailboxUGD *mailbox_ugd, email_params_h msg) +static int _mailbox_handle_launch_mailbox_bundle_val(EmailMailboxView *view, email_params_h msg) { debug_enter(); - retvm_if(!mailbox_ugd, -1, "Error: mailbox_ugd is NULL"); + retvm_if(!view, -1, "Error: view is NULL"); int account_id = 0; int ret = 0; @@ -913,20 +909,20 @@ static int _mailbox_handle_launch_mailbox_bundle_val(EmailMailboxUGD *mailbox_ug account_id = _mailbox_params_get_account_id(msg); retvm_if(account_id <= 0, -1, "(account_id <= 0) is not allowed"); - ret = _mailbox_destroy_child_modules(mailbox_ugd, false); + ret = _mailbox_destroy_child_modules(view, false); retvm_if(ret != 0, -1, "_mailbox_destroy_child_modules() failed!"); - ret = _mailbox_update_mailbox(mailbox_ugd, account_id, 0); + ret = _mailbox_update_mailbox(view, account_id, 0); retvm_if(ret != 0, -1, "_mailbox_update_mailbox() failed!"); debug_leave(); return 0; } -static int _mailbox_handle_launch_viewer_bundle_val(EmailMailboxUGD *mailbox_ugd, email_params_h msg) +static int _mailbox_handle_launch_viewer_bundle_val(EmailMailboxView *view, email_params_h msg) { debug_enter(); - retvm_if(!mailbox_ugd, -1, "Error: mailbox_ugd is NULL"); + retvm_if(!view, -1, "Error: view is NULL"); int mail_id = 0; email_mail_list_item_t *mail = NULL; @@ -935,12 +931,12 @@ static int _mailbox_handle_launch_viewer_bundle_val(EmailMailboxUGD *mailbox_ugd mail_id = _mailbox_params_get_mail_id(msg); retvm_if(mail_id <= 0, -1, "(mail_id <= 0) is not allowed"); - if (mailbox_ugd->viewer && (mail_id == mailbox_ugd->opened_mail_id)) { + if (view->viewer && (mail_id == view->opened_mail_id)) { email_params_h params = NULL; if (email_params_create(¶ms) && email_params_add_str(params, EMAIL_BUNDLE_KEY_MSG, EMAIL_BUNDLE_VAL_VIEWER_RESTORE_VIEW)) { - ret = email_module_send_message(mailbox_ugd->viewer, params); + ret = email_module_send_message(view->viewer, params); } else { ret = -1; } @@ -954,67 +950,67 @@ static int _mailbox_handle_launch_viewer_bundle_val(EmailMailboxUGD *mailbox_ugd mail = email_engine_get_mail_by_mailid(mail_id); retvm_if(!mail, -1, "email_engine_get_mail_by_mailid() failed!"); - ret = _mailbox_destroy_child_modules(mailbox_ugd, true); + ret = _mailbox_destroy_child_modules(view, true); retvm_if(ret != 0, -1, "_mailbox_update_mailbox() failed!"); - ret = _mailbox_update_mailbox(mailbox_ugd, mail->account_id, mail->mailbox_id); + ret = _mailbox_update_mailbox(view, mail->account_id, mail->mailbox_id); retvm_if(ret != 0, -1, "_mailbox_update_mailbox() failed!"); - if (!mailbox_ugd->composer) { - ret = mailbox_open_email_viewer(mailbox_ugd, mail->account_id, mail->mailbox_id, mail_id); + if (!view->composer) { + ret = mailbox_open_email_viewer(view, mail->account_id, mail->mailbox_id, mail_id); retvm_if(ret != 0, -1, "mailbox_open_email_viewer() failed!"); } else { - mailbox_ugd->run_type = RUN_VIEWER_FROM_NOTIFICATION; - mailbox_ugd->start_mail_id = mail_id; + view->run_type = RUN_VIEWER_FROM_NOTIFICATION; + view->start_mail_id = mail_id; } debug_leave(); return 0; } -static void _mailbox_create_view(EmailMailboxUGD *mailbox_ugd) +static void _mailbox_create_view(EmailMailboxView *view) { debug_enter(); /*load theme*/ - mailbox_ugd->theme = elm_theme_new(); - elm_theme_ref_set(mailbox_ugd->theme, NULL); /* refer to default theme(NULL) */ - elm_theme_extension_add(mailbox_ugd->theme, email_get_mailbox_theme_path()); /* add extension to the new theme */ + view->theme = elm_theme_new(); + elm_theme_ref_set(view->theme, NULL); /* refer to default theme(NULL) */ + elm_theme_extension_add(view->theme, email_get_mailbox_theme_path()); /* add extension to the new theme */ /*base content*/ - mailbox_ugd->content_layout = elm_layout_add(mailbox_ugd->base.content); - evas_object_size_hint_weight_set(mailbox_ugd->content_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_layout_file_set(mailbox_ugd->content_layout, email_get_mailbox_theme_path(), "layout.email.mailbox.hd"); - elm_object_part_content_set(mailbox_ugd->base.content, "elm.swallow.content", mailbox_ugd->content_layout); + view->content_layout = elm_layout_add(view->base.content); + evas_object_size_hint_weight_set(view->content_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_layout_file_set(view->content_layout, email_get_mailbox_theme_path(), "layout.email.mailbox.hd"); + elm_object_part_content_set(view->base.content, "elm.swallow.content", view->content_layout); /*title*/ - mailbox_ugd->title_layout = elm_layout_add(mailbox_ugd->base.content); - evas_object_size_hint_weight_set(mailbox_ugd->title_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_layout_file_set(mailbox_ugd->title_layout, email_get_mailbox_theme_path(), "email/layout/mailbox_title"); - elm_object_part_content_set(mailbox_ugd->content_layout, "top_bar", mailbox_ugd->title_layout); + view->title_layout = elm_layout_add(view->base.content); + evas_object_size_hint_weight_set(view->title_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_layout_file_set(view->title_layout, email_get_mailbox_theme_path(), "email/layout/mailbox_title"); + elm_object_part_content_set(view->content_layout, "top_bar", view->title_layout); /* create genlist */ - mailbox_list_create_view(mailbox_ugd); + mailbox_list_create_view(view); /* create nocontents layout */ - mailbox_create_no_contents_view(mailbox_ugd, false); + mailbox_create_no_contents_view(view, false); - elm_object_part_content_set(mailbox_ugd->content_layout, "list", mailbox_ugd->gl); - mailbox_ugd->sub_layout_search = mailbox_ugd->content_layout; + elm_object_part_content_set(view->content_layout, "list", view->gl); + view->sub_layout_search = view->content_layout; - mailbox_naviframe_mailbox_button_add(mailbox_ugd); + mailbox_naviframe_mailbox_button_add(view); /*Compose floatting button*/ - mailbox_create_compose_btn(mailbox_ugd); + mailbox_create_compose_btn(view); } -static void _mailbox_module_show_initialising_popup(EmailMailboxModule *md) +static void _mailbox_module_show_initialising_popup(EmailMailboxModule *module) { debug_enter(); - retm_if(!md, "md == NULL"); + retm_if(!module, "module == NULL"); - Evas_Object *popup = elm_popup_add(md->base.win); + Evas_Object *popup = elm_popup_add(module->base.win); elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); Evas_Object *layout = elm_layout_add(popup); @@ -1032,11 +1028,11 @@ static void _mailbox_module_show_initialising_popup(EmailMailboxModule *md) elm_object_part_content_set(layout, "processing", progress); elm_object_content_set(popup, layout); - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _mailbox_initialising_popup_back_cb, md); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _mailbox_initialising_popup_back_cb, module); evas_object_show(popup); - md->init_pupup = popup; + module->init_pupup = popup; } static void _mailbox_initialising_popup_back_cb(void *data, Evas_Object *obj, void *event_info) @@ -1044,37 +1040,37 @@ static void _mailbox_initialising_popup_back_cb(void *data, Evas_Object *obj, vo debug_enter(); retm_if(!data, "data == NULL"); - EmailMailboxModule *md = data; + EmailMailboxModule *module = data; - email_module_make_destroy_request(&md->base); + email_module_make_destroy_request(&module->base); } -static int _mailbox_push_base_view_layout(EmailMailboxUGD *mailbox_ugd) +static int _mailbox_push_base_view_layout(EmailMailboxView *view) { debug_enter(); - retvm_if(!mailbox_ugd, -1, "mailbox_ugd == NULL"); + retvm_if(!view, -1, "view == NULL"); - mailbox_ugd->base.content = elm_layout_add(mailbox_ugd->base.module->navi); - elm_layout_theme_set(mailbox_ugd->base.content, "layout", "application", "default"); - evas_object_size_hint_weight_set(mailbox_ugd->base.content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(mailbox_ugd->base.content); - email_module_view_push(&mailbox_ugd->base, NULL, EVPF_NO_BACK_BUTTON | EVPF_NO_TITLE); + view->base.content = elm_layout_add(view->base.module->navi); + elm_layout_theme_set(view->base.content, "layout", "application", "default"); + evas_object_size_hint_weight_set(view->base.content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(view->base.content); + email_module_view_push(&view->base, NULL, EVPF_NO_BACK_BUTTON | EVPF_NO_TITLE); debug_leave(); return 0; } -static void _mailbox_delete_evas_object(EmailMailboxUGD *mailbox_ugd) +static void _mailbox_delete_evas_object(EmailMailboxView *view) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd == NULL"); - - DELETE_EVAS_OBJECT(mailbox_ugd->more_ctxpopup); - DELETE_EVAS_OBJECT(mailbox_ugd->error_popup); - DELETE_EVAS_OBJECT(mailbox_ugd->searchbar_ly); - DELETE_EVAS_OBJECT(mailbox_ugd->title_layout); - DELETE_EVAS_OBJECT(mailbox_ugd->compose_btn); - DELETE_EVAS_OBJECT(mailbox_ugd->gl); + retm_if(!view, "view == NULL"); + + DELETE_EVAS_OBJECT(view->more_ctxpopup); + DELETE_EVAS_OBJECT(view->error_popup); + DELETE_EVAS_OBJECT(view->searchbar_ly); + DELETE_EVAS_OBJECT(view->title_layout); + DELETE_EVAS_OBJECT(view->compose_btn); + DELETE_EVAS_OBJECT(view->gl); } static void _mailbox_timezone_change_cb(system_settings_key_e key, void *data) @@ -1082,14 +1078,14 @@ static void _mailbox_timezone_change_cb(system_settings_key_e key, void *data) debug_enter(); retm_if(!data, "data == NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - mailbox_exit_edit_mode(mailbox_ugd); + mailbox_exit_edit_mode(view); - if (mailbox_ugd->last_updated_time_item) - mailbox_last_updated_time_item_update(mailbox_ugd->mailbox_id, mailbox_ugd); + if (view->last_updated_time_item) + mailbox_last_updated_time_item_update(view->mailbox_id, view); - mailbox_list_refresh(mailbox_ugd, NULL); + mailbox_list_refresh(view, NULL); } static void _mailbox_sys_settings_datetime_format_changed_cb(system_settings_key_e node, void *data) @@ -1097,17 +1093,17 @@ static void _mailbox_sys_settings_datetime_format_changed_cb(system_settings_key debug_enter(); retm_if(!data, "data == NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; char *dt_fmt = email_get_datetime_format(); /* This values is used on mailbox_last_updated_time_item_update function. */ system_settings_get_value_bool( SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, - &mailbox_ugd->b_format_24hour); + &view->b_format_24hour); - if (mailbox_ugd->last_updated_time_item) - mailbox_last_updated_time_item_update(mailbox_ugd->mailbox_id, mailbox_ugd); + if (view->last_updated_time_item) + mailbox_last_updated_time_item_update(view->mailbox_id, view); FREE(dt_fmt); @@ -1118,18 +1114,18 @@ static void _mailbox_vip_rule_value_changed_cb(const char *key, void *data) debug_enter(); retm_if(!data, "data == NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data; + EmailMailboxView *view = (EmailMailboxView *)data; - int res = email_get_vip_rule_value(&mailbox_ugd->vip_rule_value); + int res = email_get_vip_rule_value(&view->vip_rule_value); if (res != 0) { debug_error("email_update_viprule_value failed. err = %d", res); } #ifndef _FEATURE_PRIORITY_SENDER_DISABLE_ - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { + if (view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { debug_log("Mailbox list should be refreshed because vip setting is changed, priority sender view"); - mailbox_view_title_update_all(mailbox_ugd); - mailbox_list_refresh(mailbox_ugd, NULL); + mailbox_view_title_update_all(view); + mailbox_list_refresh(view, NULL); } #endif } @@ -1138,36 +1134,36 @@ static void _mailbox_title_clicked_cb(void *data, Evas_Object *obj, void *event_ { debug_enter(); - EmailMailboxUGD *mailbox_ugd = data; - retm_if(mailbox_ugd->is_module_launching, "is_module_launching is true;"); - mailbox_ugd->is_module_launching = true; + EmailMailboxView *view = data; + retm_if(view->is_module_launching, "is_module_launching is true;"); + view->is_module_launching = true; - debug_log("account_id(%d), mode(%d)", mailbox_ugd->account_id, mailbox_ugd->mode); + debug_log("account_id(%d), mode(%d)", view->account_id, view->mode); - DELETE_EVAS_OBJECT(mailbox_ugd->more_ctxpopup); + DELETE_EVAS_OBJECT(view->more_ctxpopup); - if (!mailbox_ugd->b_editmode && !mailbox_ugd->b_searchmode) { + if (!view->b_editmode && !view->b_searchmode) { const char *account_type = EMAIL_BUNDLE_VAL_SINGLE_ACCOUNT; - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { + if (view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { account_type = EMAIL_BUNDLE_VAL_PRIORITY_SENDER; - } else if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL && mailbox_ugd->account_id == 0 && EMAIL_MAILBOX_TYPE_FLAGGED == mailbox_ugd->mailbox_type) { + } else if (view->mode == EMAIL_MAILBOX_MODE_ALL && view->account_id == 0 && EMAIL_MAILBOX_TYPE_FLAGGED == view->mailbox_type) { account_type = EMAIL_BUNDLE_VAL_FILTER_INBOX; - } else if (mailbox_ugd->account_id == 0) { + } else if (view->account_id == 0) { account_type = EMAIL_BUNDLE_VAL_ALL_ACCOUNT; } email_params_h params = NULL; if (email_params_create(¶ms) && - email_params_add_int(params, EMAIL_BUNDLE_KEY_ACCOUNT_ID, mailbox_ugd->account_id) && + email_params_add_int(params, EMAIL_BUNDLE_KEY_ACCOUNT_ID, view->account_id) && email_params_add_int(params, EMAIL_BUNDLE_KEY_IS_MAILBOX_MOVE_MODE, 0) && email_params_add_int(params, EMAIL_BUNDLE_KEY_IS_MAILBOX_ACCOUNT_MODE, 1) && - email_params_add_int(params, EMAIL_BUNDLE_KEY_MAILBOX_TYPE, mailbox_ugd->mailbox_type) && - email_params_add_int(params, EMAIL_BUNDLE_KEY_MAILBOX, mailbox_ugd->mailbox_id) && + email_params_add_int(params, EMAIL_BUNDLE_KEY_MAILBOX_TYPE, view->mailbox_type) && + email_params_add_int(params, EMAIL_BUNDLE_KEY_MAILBOX, view->mailbox_id) && email_params_add_str(params, EMAIL_BUNDLE_KEY_ACCOUNT_TYPE, account_type)) { - mailbox_ugd->account = mailbox_account_module_create(mailbox_ugd, EMAIL_MODULE_ACCOUNT, params); + view->account = mailbox_account_module_create(view, EMAIL_MODULE_ACCOUNT, params); } email_params_free(¶ms); @@ -1182,35 +1178,35 @@ static void _mailbox_on_back_key(email_view_t *self) debug_enter(); retm_if(!self, "self == NULL"); - EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)self; - retm_if(!mailbox_ugd->initialized, "Not initialized!"); + EmailMailboxView *view = (EmailMailboxView *)self; + retm_if(!view->initialized, "Not initialized!"); int account_count = 0; email_account_t *account_list = NULL; - if (mailbox_ugd->b_editmode) { - mailbox_exit_edit_mode(mailbox_ugd); - } else if (mailbox_ugd->b_searchmode) { - mailbox_finish_search_mode(mailbox_ugd); + if (view->b_editmode) { + mailbox_exit_edit_mode(view); + } else if (view->b_searchmode) { + mailbox_finish_search_mode(view); } else { - if ((mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL || mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) - && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX) { - elm_win_lower(mailbox_ugd->base.module->win); + if ((view->mode == EMAIL_MAILBOX_MODE_ALL || view->mode == EMAIL_MAILBOX_MODE_MAILBOX) + && view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX) { + elm_win_lower(view->base.module->win); } else { - mailbox_sync_cancel_all(mailbox_ugd); + mailbox_sync_cancel_all(view); - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) { + if (view->mode == EMAIL_MAILBOX_MODE_MAILBOX) { int ret = 0; email_mailbox_t *mailbox = NULL; - ret = email_get_mailbox_by_mailbox_type(mailbox_ugd->account_id, EMAIL_MAILBOX_TYPE_INBOX, &mailbox); + ret = email_get_mailbox_by_mailbox_type(view->account_id, EMAIL_MAILBOX_TYPE_INBOX, &mailbox); if (ret == EMAIL_ERROR_NONE && mailbox) { - mailbox_ugd->mailbox_id = mailbox->mailbox_id; - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; + view->mailbox_id = mailbox->mailbox_id; + view->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; email_free_mailbox(&mailbox, 1); } else { debug_log("email_get_mailbox_by_mailbox_type failed : %d", ret); - mailbox_ugd->mailbox_id = 0; - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; + view->mailbox_id = 0; + view->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; } } else { if (FALSE == email_engine_get_account_list(&account_count, &account_list)) { @@ -1221,32 +1217,32 @@ static void _mailbox_on_back_key(email_view_t *self) if (account_count == 1 && account_list) { int ret = 0; email_mailbox_t *mailbox = NULL; - mailbox_ugd->account_id = account_list[0].account_id; - ret = email_get_mailbox_by_mailbox_type(mailbox_ugd->account_id, EMAIL_MAILBOX_TYPE_INBOX, &mailbox); + view->account_id = account_list[0].account_id; + ret = email_get_mailbox_by_mailbox_type(view->account_id, EMAIL_MAILBOX_TYPE_INBOX, &mailbox); if (ret == EMAIL_ERROR_NONE && mailbox) { - debug_log("account_id:%d, account_count:%d, mailbox_id:%d", mailbox_ugd->account_id, account_count, mailbox->mailbox_id); - mailbox_ugd->mailbox_id = mailbox->mailbox_id; - mailbox_ugd->mode = EMAIL_MAILBOX_MODE_MAILBOX; - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; + debug_log("account_id:%d, account_count:%d, mailbox_id:%d", view->account_id, account_count, mailbox->mailbox_id); + view->mailbox_id = mailbox->mailbox_id; + view->mode = EMAIL_MAILBOX_MODE_MAILBOX; + view->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; email_free_mailbox(&mailbox, 1); } else { debug_log("email_get_mailbox_by_mailbox_type failed : %d", ret); - mailbox_ugd->mailbox_id = 0; - mailbox_ugd->mode = EMAIL_MAILBOX_MODE_MAILBOX; - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; + view->mailbox_id = 0; + view->mode = EMAIL_MAILBOX_MODE_MAILBOX; + view->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; } } else { - mailbox_ugd->mode = EMAIL_MAILBOX_MODE_ALL; - mailbox_ugd->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; + view->mode = EMAIL_MAILBOX_MODE_ALL; + view->mailbox_type = EMAIL_MAILBOX_TYPE_INBOX; } if (account_list) email_engine_free_account_list(&account_list, account_count); } - mailbox_view_title_update_all(mailbox_ugd); - mailbox_update_notifications_status(mailbox_ugd); - mailbox_list_refresh(mailbox_ugd, NULL); + mailbox_view_title_update_all(view); + mailbox_update_notifications_status(view); + mailbox_list_refresh(view, NULL); } } } @@ -1264,39 +1260,39 @@ email_module_t *mailbox_module_alloc() { debug_enter(); - EmailMailboxModule *md = MEM_ALLOC(md, 1); - if (!md) { - debug_error("md is NULL"); + EmailMailboxModule *module = MEM_ALLOC(module, 1); + if (!module) { + debug_error("module is NULL"); return NULL; } - md->base.create = _mailbox_module_create; - md->base.destroy = _mailbox_module_destroy; - md->base.on_message = _mailbox_on_message; + module->base.create = _mailbox_module_create; + module->base.destroy = _mailbox_module_destroy; + module->base.on_message = _mailbox_on_message; debug_leave(); - return &md->base; + return &module->base; } -void mailbox_create_no_contents_view(EmailMailboxUGD *mailbox_ugd, bool search_mode) +void mailbox_create_no_contents_view(EmailMailboxView *view, bool search_mode) { debug_log("search_mode : %d", search_mode); - if (!mailbox_ugd) { - debug_warning("mailbox_ugd is NULL"); + if (!view) { + debug_warning("view is NULL"); return; } - Evas_Object *no_content_scroller = elm_object_part_content_get(mailbox_ugd->content_layout, "noc"); + Evas_Object *no_content_scroller = elm_object_part_content_get(view->content_layout, "noc"); if (no_content_scroller) { debug_log("remove no content view"); - elm_object_part_content_unset(mailbox_ugd->content_layout, "noc"); + elm_object_part_content_unset(view->content_layout, "noc"); evas_object_del(no_content_scroller); no_content_scroller = NULL; } Evas_Object *no_content = NULL; - no_content = elm_layout_add(mailbox_ugd->content_layout); + no_content = elm_layout_add(view->content_layout); if (search_mode) { elm_layout_theme_set(no_content, "layout", "nocontents", "search"); @@ -1309,7 +1305,7 @@ void mailbox_create_no_contents_view(EmailMailboxUGD *mailbox_ugd, bool search_m evas_object_size_hint_weight_set(no_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); /* Added Scrollar to fix the searchbar not showing in landscape mode completely*/ - no_content_scroller = elm_scroller_add(mailbox_ugd->content_layout); + no_content_scroller = elm_scroller_add(view->content_layout); elm_scroller_policy_set(no_content_scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); elm_object_focus_allow_set(no_content_scroller, EINA_FALSE); evas_object_show(no_content_scroller); @@ -1318,29 +1314,29 @@ void mailbox_create_no_contents_view(EmailMailboxUGD *mailbox_ugd, bool search_m elm_layout_signal_emit(no_content, "text,disabled", ""); elm_layout_signal_emit(no_content, "align.center", "elm"); - elm_object_part_content_set(mailbox_ugd->content_layout, "noc", no_content_scroller); + elm_object_part_content_set(view->content_layout, "noc", no_content_scroller); - if (mailbox_ugd->no_content_shown && !search_mode) { - mailbox_hide_no_contents_view(mailbox_ugd); + if (view->no_content_shown && !search_mode) { + mailbox_hide_no_contents_view(view); } } -void mailbox_show_no_contents_view(EmailMailboxUGD *mailbox_ugd) +void mailbox_show_no_contents_view(EmailMailboxView *view) { debug_enter(); - if (evas_object_visible_get(mailbox_ugd->gl)) - evas_object_hide(mailbox_ugd->gl); + if (evas_object_visible_get(view->gl)) + evas_object_hide(view->gl); - edje_object_signal_emit(_EDJ(mailbox_ugd->sub_layout_search), "hide_list", "elm"); - edje_object_signal_emit(_EDJ(mailbox_ugd->sub_layout_search), "show_noc", "elm"); + edje_object_signal_emit(_EDJ(view->sub_layout_search), "hide_list", "elm"); + edje_object_signal_emit(_EDJ(view->sub_layout_search), "show_noc", "elm"); - mailbox_send_all_btn_remove(mailbox_ugd); + mailbox_send_all_btn_remove(view); - Evas_Object *no_content_scroller = elm_object_part_content_get(mailbox_ugd->content_layout, "noc"); + Evas_Object *no_content_scroller = elm_object_part_content_get(view->content_layout, "noc"); Evas_Object *no_content = elm_object_content_get(no_content_scroller); - if (mailbox_ugd->b_searchmode == true) { + if (view->b_searchmode == true) { elm_layout_theme_set(no_content, "layout", "nocontents", "search"); elm_object_domain_translatable_part_text_set(no_content, "elm.text", PACKAGE, "IDS_EMAIL_NPBODY_NO_RESULTS_FOUND"); elm_object_domain_translatable_part_text_set(no_content, "elm.help.text", PACKAGE, ""); @@ -1348,23 +1344,23 @@ void mailbox_show_no_contents_view(EmailMailboxUGD *mailbox_ugd) elm_layout_theme_set(no_content, "layout", "nocontents", "default"); elm_object_domain_translatable_part_text_set(no_content, "elm.text", PACKAGE, "IDS_EMAIL_NPBODY_NO_EMAILS"); - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { + if (view->mode == EMAIL_MAILBOX_MODE_PRIORITY_SENDER) { elm_object_domain_translatable_part_text_set(no_content, "elm.help.text", PACKAGE, "IDS_EMAIL_BODY_AFTER_YOU_ADD_PRIORITY_SENDERS_EMAILS_FROM_THEM_WILL_BE_SHOWN_HERE"); - } else if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL && mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX) { + } else if (view->mode == EMAIL_MAILBOX_MODE_ALL && view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX) { elm_object_domain_translatable_part_text_set(no_content, "elm.help.text", PACKAGE, "IDS_EMAIL_BODY_AFTER_YOU_RECEIVE_EMAILS_THEY_WILL_BE_SHOWN_HERE"); - } else if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { + } else if (view->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) { elm_object_domain_translatable_part_text_set(no_content, "elm.help.text", PACKAGE, "IDS_EMAIL_BODY_AFTER_YOU_HAVE_TRIED_TO_SEND_EMAILS_BUT_THEY_FAILED_TO_BE_SENT_THEY_WILL_BE_SHOWN_HERE"); - } else if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_SENTBOX) { + } else if (view->mailbox_type == EMAIL_MAILBOX_TYPE_SENTBOX) { elm_object_domain_translatable_part_text_set(no_content, "elm.help.text", PACKAGE, "IDS_EMAIL_BODY_AFTER_YOU_SEND_EMAILS_THEY_WILL_BE_SHOWN_HERE"); - } else if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_TRASH) { + } else if (view->mailbox_type == EMAIL_MAILBOX_TYPE_TRASH) { elm_object_domain_translatable_part_text_set(no_content, "elm.help.text", PACKAGE, "IDS_EMAIL_BODY_AFTER_YOU_DELETE_EMAILS_THEY_WILL_BE_SHOWN_HERE"); - } else if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED) { + } else if (view->mailbox_type == EMAIL_MAILBOX_TYPE_FLAGGED) { elm_object_domain_translatable_part_text_set(no_content, "elm.help.text", PACKAGE, "IDS_EMAIL_BODY_AFTER_YOU_ADD_FAVOURITE_EMAILS_BY_TAPPING_THE_STAR_ICON_THEY_WILL_BE_SHOWN_HERE"); - } else if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX) { + } else if (view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX) { elm_object_domain_translatable_part_text_set(no_content, "elm.help.text", PACKAGE, "IDS_EMAIL_BODY_AFTER_YOU_RECEIVE_EMAILS_THEY_WILL_BE_SHOWN_HERE"); - } else if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT) { + } else if (view->mailbox_type == EMAIL_MAILBOX_TYPE_DRAFT) { elm_object_domain_translatable_part_text_set(no_content, "elm.help.text", PACKAGE, "IDS_EMAIL_BODY_AFTER_YOU_SAVE_EMAILS_IN_DRAFTS_THEY_WILL_BE_SHOWN_HERE"); - } else if (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_SPAMBOX) { + } else if (view->mailbox_type == EMAIL_MAILBOX_TYPE_SPAMBOX) { elm_object_domain_translatable_part_text_set(no_content, "elm.help.text", PACKAGE, "IDS_EMAIL_BODY_AFTER_YOU_ADD_EMAILS_TO_SPAM_THEY_WILL_BE_SHOWN_HERE"); } else { elm_object_domain_translatable_part_text_set(no_content, "elm.help.text", PACKAGE, "IDS_EMAIL_BODY_AFTER_YOU_MOVE_EMAILS_TO_THIS_FOLDER_THEY_WILL_BE_SHOWN_HERE"); @@ -1373,75 +1369,75 @@ void mailbox_show_no_contents_view(EmailMailboxUGD *mailbox_ugd) elm_layout_signal_emit(no_content, "text,disabled", ""); elm_layout_signal_emit(no_content, "align.center", "elm"); - mailbox_ugd->no_content_shown = true; + view->no_content_shown = true; } -void mailbox_hide_no_contents_view(EmailMailboxUGD *mailbox_ugd) +void mailbox_hide_no_contents_view(EmailMailboxView *view) { debug_enter(); - if (!evas_object_visible_get(mailbox_ugd->gl)) - evas_object_show(mailbox_ugd->gl); + if (!evas_object_visible_get(view->gl)) + evas_object_show(view->gl); - edje_object_signal_emit(_EDJ(mailbox_ugd->sub_layout_search), "hide_noc", "elm"); - edje_object_signal_emit(_EDJ(mailbox_ugd->sub_layout_search), "show_list", "elm"); - mailbox_ugd->no_content_shown = false; + edje_object_signal_emit(_EDJ(view->sub_layout_search), "hide_noc", "elm"); + edje_object_signal_emit(_EDJ(view->sub_layout_search), "show_list", "elm"); + view->no_content_shown = false; } -void mailbox_refresh_fullview(EmailMailboxUGD *mailbox_ugd, bool update_title) +void mailbox_refresh_fullview(EmailMailboxView *view, bool update_title) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd == NULL"); + retm_if(!view, "view == NULL"); - DELETE_EVAS_OBJECT(mailbox_ugd->more_ctxpopup); + DELETE_EVAS_OBJECT(view->more_ctxpopup); - if (mailbox_ugd->b_editmode) - mailbox_exit_edit_mode(mailbox_ugd); + if (view->b_editmode) + mailbox_exit_edit_mode(view); if (update_title) - mailbox_view_title_update_all(mailbox_ugd); + mailbox_view_title_update_all(view); - if (mailbox_ugd->b_searchmode) - mailbox_show_search_result(mailbox_ugd); + if (view->b_searchmode) + mailbox_show_search_result(view); else - mailbox_list_refresh(mailbox_ugd, NULL); + mailbox_list_refresh(view, NULL); } -void mailbox_naviframe_mailbox_button_remove(EmailMailboxUGD *mailbox_ugd) +void mailbox_naviframe_mailbox_button_remove(EmailMailboxView *view) { - elm_object_part_content_unset(mailbox_ugd->title_layout, "mailbox_button"); - evas_object_hide(mailbox_ugd->btn_mailbox); + elm_object_part_content_unset(view->title_layout, "mailbox_button"); + evas_object_hide(view->btn_mailbox); return; } -void mailbox_naviframe_mailbox_button_add(EmailMailboxUGD *mailbox_ugd) +void mailbox_naviframe_mailbox_button_add(EmailMailboxView *view) { - if (!mailbox_ugd->btn_mailbox) { - mailbox_ugd->btn_mailbox = elm_button_add(mailbox_ugd->title_layout); - elm_object_style_set(mailbox_ugd->btn_mailbox, "naviframe/title_right"); - evas_object_smart_callback_add(mailbox_ugd->btn_mailbox, "clicked", _mailbox_title_clicked_cb, mailbox_ugd); + if (!view->btn_mailbox) { + view->btn_mailbox = elm_button_add(view->title_layout); + elm_object_style_set(view->btn_mailbox, "naviframe/title_right"); + evas_object_smart_callback_add(view->btn_mailbox, "clicked", _mailbox_title_clicked_cb, view); } - elm_object_domain_translatable_text_set(mailbox_ugd->btn_mailbox, PACKAGE, "IDS_EMAIL_ACBUTTON_MAILBOX_ABB"); - elm_object_part_content_set(mailbox_ugd->title_layout, "mailbox_button", mailbox_ugd->btn_mailbox); - evas_object_show(mailbox_ugd->btn_mailbox); + elm_object_domain_translatable_text_set(view->btn_mailbox, PACKAGE, "IDS_EMAIL_ACBUTTON_MAILBOX_ABB"); + elm_object_part_content_set(view->title_layout, "mailbox_button", view->btn_mailbox); + evas_object_show(view->btn_mailbox); return; } -void mailbox_update_notifications_status(EmailMailboxUGD *mailbox_ugd) +void mailbox_update_notifications_status(EmailMailboxView *view) { debug_enter(); - retm_if(!mailbox_ugd, "mailbox_ugd == NULL"); + retm_if(!view, "view == NULL"); - if ((mailbox_ugd->base.state == EV_STATE_ACTIVE) && - (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX) && - (mailbox_ugd->mode != EMAIL_MAILBOX_MODE_PRIORITY_SENDER)) { + if ((view->base.state == EV_STATE_ACTIVE) && + (view->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX) && + (view->mode != EMAIL_MAILBOX_MODE_PRIORITY_SENDER)) { email_set_is_inbox_active(true); - if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX) { - email_clear_notification_bar(mailbox_ugd->account_id); + if (view->mode == EMAIL_MAILBOX_MODE_MAILBOX) { + email_clear_notification_bar(view->account_id); } else { email_clear_notification_bar(ALL_ACCOUNT); } @@ -1452,10 +1448,10 @@ void mailbox_update_notifications_status(EmailMailboxUGD *mailbox_ugd) debug_leave(); } -int mailbox_open_email_viewer(EmailMailboxUGD *mailbox_ugd, int account_id, int mailbox_id, int mail_id) +int mailbox_open_email_viewer(EmailMailboxView *view, int account_id, int mailbox_id, int mail_id) { debug_enter(); - retvm_if(!mailbox_ugd, -1, "mailbox_ugd is NULL"); + retvm_if(!view, -1, "view is NULL"); debug_log("account_id: %d, mailbox_id: %d, mail_id: %d", account_id, mailbox_id, mail_id); email_params_h params = NULL; @@ -1465,8 +1461,8 @@ int mailbox_open_email_viewer(EmailMailboxUGD *mailbox_ugd, int account_id, int email_params_add_int(params, EMAIL_BUNDLE_KEY_MAILBOX, mailbox_id) && email_params_add_int(params, EMAIL_BUNDLE_KEY_MAIL_ID, mail_id)) { - mailbox_ugd->opened_mail_id = mail_id; - mailbox_ugd->viewer = mailbox_viewer_module_create(mailbox_ugd, EMAIL_MODULE_VIEWER, params); + view->opened_mail_id = mail_id; + view->viewer = mailbox_viewer_module_create(view, EMAIL_MODULE_VIEWER, params); } email_params_free(¶ms); -- 2.7.4