+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef UG_MODULE_API
-#define UG_MODULE_API __attribute__ ((visibility("default")))
-#endif
-
-#include "email-block.h"
-#include "email-utils.h"
-#include <contacts-svc.h>
-#include <contacts-ug.h>
-#include <vconf.h>
-#include <vconf-keys.h>
-#include <string.h>
-#include <stdlib.h>
-
-Evas_Object *g_delete_btn = NULL;
-char *block_addr = NULL;
-static EmailBlockAppData *_g_eb_ug_data = NULL;
-static Elm_Genlist_Item_Class itc;
-
-#define EMAIL_VCONF_KEY_BLOCK_RULE_CHANGED "file/private/org.tizen.email/spam_rule_changed"
-
-/* appcore */
-static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv);
-static void on_start(ui_gadget_h ug, service_h service, void *priv);
-static void on_pause(ui_gadget_h ug, service_h service, void *priv);
-static void on_resume(ui_gadget_h ug, service_h service, void *priv);
-static void on_destroy(ui_gadget_h ug, service_h service, void *priv);
-static void on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv);
-static void on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv);
-static void on_key_event(ui_gadget_h ug, enum ug_key_event event, service_h service, void *priv);
-
-static void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv);
-static void result_cb(ui_gadget_h ug, service_h service, void *priv);
-static void destroy_cb(ui_gadget_h ug, void *priv);
-static ui_gadget_h create_ug(char *ug_name, service_h service, void *data);
-static void _win_profile_changed_cb(void *data, Evas_Object *obj, void *event);
-
-static void eb_create_view(EmailBlockAppData *ug_data);
-static void eb_add_navigation_bar(EmailBlockAppData *ug_data);
-static void eb_add_control_bar(EmailBlockAppData *ug_data);
-static void eb_create_first_view(EmailBlockAppData *ug_data);
-static void eb_create_list(EmailBlockAppData *ug_data);
-static void eb_free_list(EmailBlockAppData *ug_data);
-static void eb_create_noc(EmailBlockAppData *ug_data);
-static void eb_free_noc(EmailBlockAppData *ug_data);
-static void eb_destroy_main_view(EmailBlockAppData *ug_data);
-static void eb_destroy_filter_add_view(EmailBlockAppData *ug_data);
-
-static void _add_filter_clicked_cb(void *data, Evas_Object *obj, void *event_info);
-static void _add_filter_cancel_clicked_cb(void *data, Evas_Object *obj, void *event_info);
-static void _add_one_rule(EmailBlockAppData *ug_data, char *buf);
-static void _changed_filter_type_cb(void *data, Evas_Object *obj, void *event_info);
-static void _back_cb(void *data, Evas_Object *obj, void *event_info);
-static void _edit_cb(void *data, Evas_Object *obj, void *event_info);
-static void _back_prev_view_cb(void *data, Evas_Object *obj, void *event_info);
-static void _delete_rule_cb(void *data, Evas_Object *obj, void *event_info);
-static void _rule_save_cb(void *data, Evas_Object *obj, void *event_info);
-static void _contact_button_cb(void *data, Evas_Object *obj, void *event_info);
-static void _recent_button_cb(void *data, Evas_Object *obj, void *event_info);
-static void _block_rule_vconf_key_changed_cb(keynode_t *key, void *data);
-static void _get_contact_email_list(const char *val, char **result, EmailBlockAppData *ug_data);
-
-static void _popup_block_clicked_cb(void *data, Evas_Object *obj, void *event_info);
-static void _del_button_state_set(EmailBlockAppData *ug_data);
-static void _show_selection_info(EmailBlockAppData *ugd);
-
-static void _block_recent_create_view(void *data);
-static void _block_recent_init(EmailBlockAppData *ugd);
-static Evas_Object *_block_recent_create_genlist_top_half(void *data);
-static Eina_Bool _block_recent_create_genlist_bottom_half(void *data);
-static bool _block_recent_check_addr_is_duplicated(const char *addr, Evas_Object *recent_list);
-static void _block_recent_back_cb(void *data, Evas_Object *obj, void *event_info);
-static Evas_Object *_block_recent_create_no_content_view(Evas_Object *parent, void *data);
-static void _block_recent_show_selection_info(EmailBlockAppData *ugd);
-static void _block_recent_done_cb(void *data, Evas_Object *obj, void *event_info);
-static void _block_recent_item_check_changed_cb(void *data, Evas_Object *obj, void *event_info);
-static Evas_Object *_block_recent_create_layout(EmailBlockAppData *ugd);
-static void _block_recent_set_editmode(void *data);
-static void _block_recent_select_all_layout_mouse_down_cb(void *data, Evas * evas, Evas_Object *obj, void *event_info);
-static void _block_recent_select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info);
-static void _block_recent_check_select_all(EmailBlockAppData *ugd);
-static void _block_recent_set_genlist_item_style(EmailBlockAppData *ugd);
-static void _block_recent_gl_sel(void *data, Evas_Object *obj, void *event_info);
-static char *_block_recent_gl_label_get(void *data, Evas_Object *obj, const char *part);
-static Evas_Object *_block_recent_gl_icon_get(void *data, Evas_Object *obj, const char *part);
-
-static void _edit_item_check_changed_cb(void *data, Evas_Object *obj, void *event_info);
-static void _check_select_all(EmailBlockAppData *ug_data);
-static void _select_all_layout_mouse_down_cb(void *data, Evas * evas, Evas_Object *obj, void *event_info);
-static void _select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info);
-static char *_eb_gl_label_get(void *data, Evas_Object *obj, const char *part);
-static void _eb_gl_sel_cb(void *data, Evas_Object *obj, void *event_info);
-static void _eb_gl_del(void *data, Evas_Object *obj);
-static Evas_Object *_eb_gl_add_ef_icon_get(void *data, Evas_Object *obj, const char *part);
-/*static Evas_Object *_eb_gl_add_btn_icon_get(void *data, Evas_Object *obj, const char *part);*/
-static void _cb_backup_input(void *data, Evas_Object *obj, void *event_info);
-static void _cb_entry_focused(void *data, Evas_Object *obj, void *event_info);
-static void _cb_entry_unfocused(void *data, Evas_Object *obj, void *event_info);
-static void _cb_eraser_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
-
-/* Call back function to get the information of buttons of underlying layer in sweep menu */
-static Evas_Object *_eb_gl_icon_get(void *data, Evas_Object *obj, const char *part);
-static void _eb_sweep_edit_clicked_cb(void *data, Evas_Object *obj, void *event_info);
-static void _eb_sweep_delete_clicked_cb(void *data, Evas_Object *obj, void *event_info);
-static void _my_gl_mode_right(void *data, Evas_Object *obj, void *event_info);
-static void _my_gl_mode_left(void *data, Evas_Object *obj, void *event_info);
-static void _my_gl_mode_cancel(void *data, Evas_Object *obj, void *event_info);
-
-static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv)
-{
- debug_log("");
-
- Evas_Object *win;
- EmailBlockAppData *ug_data;
-
- if (!ug || !priv)
- return NULL;
-
- ug_data = priv;
- ug_data->ug = ug;
-
- win = ug_get_window();
- if (!win)
- return NULL;
-
- ug_data->win_main = win;
- ug_data->evas = evas_object_evas_get(win);
-
- char *id = NULL;
- service_get_extra_data(service, EMAIL_BUNDLE_KEY_ACCOUNT_ID, &id);
- ug_data->account_id = atoi(id);
- g_free(id);
-
- char *mailbox_id = NULL;
- service_get_extra_data(service, EMAIL_BUNDLE_KEY_MAILBOX, &mailbox_id);
- ug_data->mailbox_id = atoi(mailbox_id);
- g_free(mailbox_id);
-
- debug_log("ACCOUNT_ID:%d", ug_data->account_id);
- debug_log("MAILBOX_ID:%d", ug_data->mailbox_id);
-
- ug_data->cbs.layout_cb = layout_cb;
- ug_data->cbs.result_cb = result_cb;
- ug_data->cbs.destroy_cb = destroy_cb;
- ug_data->cbs.priv = (void *)ug_data;
-
- /* theme extension */
- ug_data->theme = elm_theme_new();
- elm_theme_ref_set(ug_data->theme, NULL);
- elm_theme_extension_add(ug_data->theme, EMAIL_BLOCK_THEME_PATH);
-
- eb_create_view(ug_data);
-
- int vconf_ret = -1;
- vconf_ret = vconf_notify_key_changed(EMAIL_VCONF_KEY_BLOCK_RULE_CHANGED, _block_rule_vconf_key_changed_cb, ug_data);
- if (vconf_ret == -1) {
- debug_log("vconf_notify_key_changed failed");
- }
-
- return ug_data->layout_main;
-}
-
-static void on_start(ui_gadget_h ug, service_h service, void *priv)
-{
- debug_log("");
-}
-
-static void on_pause(ui_gadget_h ug, service_h service, void *priv)
-{
- debug_log("");
-}
-
-static void on_resume(ui_gadget_h ug, service_h service, void *priv)
-{
- debug_log("");
-}
-
-static void on_destroy(ui_gadget_h ug, service_h service, void *priv)
-{
- debug_log("");
- EmailBlockAppData *ug_data;
-
- if (!ug || !priv)
- return;
-
- ug_data = priv;
-
- /* theme extension */
- elm_theme_extension_del(ug_data->theme, EMAIL_BLOCK_THEME_PATH);
- elm_theme_free(ug_data->theme);
-
- int vconf_ret = -1;
- vconf_ret = vconf_ignore_key_changed(EMAIL_VCONF_KEY_BLOCK_RULE_CHANGED, _block_rule_vconf_key_changed_cb);
- if (vconf_ret == -1) {
- debug_log("vconf_ignore_key_changed failed");
- }
-
- vconf_ret = vconf_unset(EMAIL_VCONF_KEY_BLOCK_RULE_CHANGED);
- if (vconf_ret == -1) {
- debug_log("vconf_unset failed");
- }
-
- eb_destroy_main_view(ug_data);
-}
-
-static void on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv)
-{
- debug_log("");
-}
-
-static void on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv)
-{
- debug_log("");
-
- switch (event) {
- case UG_EVENT_LOW_MEMORY:
- break;
- case UG_EVENT_LOW_BATTERY:
- break;
- case UG_EVENT_LANG_CHANGE:
- break;
- case UG_EVENT_ROTATE_PORTRAIT:
- break;
- case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
- break;
- case UG_EVENT_ROTATE_LANDSCAPE:
- break;
- case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
- break;
- case UG_EVENT_REGION_CHANGE:
- break;
- default:
- break;
- }
-}
-
-static void on_key_event(ui_gadget_h ug, enum ug_key_event event, service_h service, void *priv)
-{
- debug_log("");
-
- if (!ug || !priv)
- return;
-
- EmailBlockAppData *ug_data;
- ug_data = priv;
-
- switch (event) {
- case UG_KEY_EVENT_END:
- if (elm_naviframe_top_item_get(ug_data->navi_bar) == elm_naviframe_bottom_item_get(ug_data->navi_bar))
- ug_destroy_me(ug);
- else
- _back_prev_view_cb(ug_data, NULL, NULL);
- break;
-
- default:
- break;
- }
-}
-
-static void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
-{
- debug_log("");
- Evas_Object *base, *win;
-
- if (!ug || !priv)
- return;
-
- base = ug_get_layout(ug);
- if (!base)
- return;
-
- win = ug_get_window();
-
- switch (mode) {
- case UG_MODE_FULLVIEW:
- evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(win, base);
- evas_object_show(base);
- break;
-
- default:
- break;
- }
-}
-
-static void result_cb(ui_gadget_h ug, service_h service, void *priv)
-{
- debug_log("");
-
- if (!ug || !priv)
- return;
-
- EmailBlockAppData *ug_data = (EmailBlockAppData *)priv;
-
- if (ug != ug_data->ug_contact) {
- goto FINISH;
- }
-
- char *val = NULL;
- service_get_extra_data(service, CT_UG_BUNDLE_RESULT_EMAIL_ID_LIST, &val);
-
- if (!val) {
- debug_log("service_get_extra_data return NULL");
- goto FINISH;
- }
-
- char *result_address = NULL;
- _get_contact_email_list(val, &result_address, ug_data);
- g_free(val);
-
- if (!result_address) {
- ug_data->popup_empty = elm_popup_add(ug_data->layout_main);
- evas_object_size_hint_weight_set(ug_data->popup_empty, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_popup_timeout_set(ug_data->popup_empty, 1);
- elm_object_text_set(ug_data->popup_empty, _("IDS_EMAIL_POP_NO_EMAIL_ADDRESS"));
- elm_object_part_text_set(ug_data->popup_empty, "title,text", _("IDS_EMAIL_POP_ALERT"));
- evas_object_smart_callback_add(ug_data->popup_empty, "block,clicked", _popup_block_clicked_cb, ug_data);
- evas_object_show(ug_data->popup_empty);
- goto FINISH;
- }
-
- if (!block_addr) {
- block_addr = g_strdup(result_address);
- debug_log("Null block_addr = %s", block_addr);
- elm_entry_entry_set(ug_data->entry_filter_name, block_addr);
- } else {
- char *addr_tmp = block_addr;
- block_addr = g_strconcat(block_addr, ";", result_address, NULL);
- debug_log("Not Null block_addr = %s", block_addr);
- elm_entry_entry_set(ug_data->entry_filter_name, block_addr);
- g_free(addr_tmp);
- }
-
- g_free(result_address);
-
-FINISH:
- evas_object_show(ug_data->entry_filter_name);
- elm_object_focus_set(ug_data->entry_filter_name, EINA_TRUE);
- ug_data->view_type = VIEW_BLOCK_FILTER_DATA_SET;
- ug_destroy(ug);
-}
-
-static void destroy_cb(ui_gadget_h ug, void *priv)
-{
- debug_log("");
-
- if (!ug || !priv)
- return;
-
- EmailBlockAppData *ug_data = (EmailBlockAppData *)priv;
-
- if (ug == ug_data->ug_contact) {
- ug_data->view_type = VIEW_BLOCK_FILTER_DATA_SET;
- /*elm_object_signal_emit(ug_data->ef_filter_name, "clicked", "elm");*/
- evas_object_show(ug_data->entry_filter_name);
- elm_object_focus_set(ug_data->entry_filter_name, EINA_TRUE);
- }
-
- ug_destroy(ug);
-}
-
-UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
-{
- debug_log("");
- EmailBlockAppData *ug_data;
-
- if (!ops)
- return -1;
-
- ug_data = calloc(1, sizeof(EmailBlockAppData));
- if (!ug_data)
- return -1;
-
- ops->create = on_create;
- ops->start = on_start;
- ops->pause = on_pause;
- ops->resume = on_resume;
- ops->destroy = on_destroy;
- ops->message = on_message;
- ops->event = on_event;
- ops->key_event = on_key_event;
- ops->priv = ug_data;
- ops->opt = UG_OPT_INDICATOR_ENABLE;
-
- _g_eb_ug_data = ug_data;
-
- return 0;
-}
-
-UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
-{
- debug_log("");
- EmailBlockAppData *ug_data;
-
- if (!ops)
- return;
-
- ug_data = ops->priv;
- if (ug_data)
- free(ug_data);
-
- _g_eb_ug_data = NULL;
-}
-
-static ui_gadget_h create_ug(char *ug_name, service_h service, void *data)
-{
- debug_log("");
- ui_gadget_h ug;
- struct ug_cbs cbs = { 0, };
-
- EmailBlockAppData *ug_data = (EmailBlockAppData *)data;
-
- cbs.layout_cb = layout_cb;
- cbs.result_cb = result_cb;
- cbs.destroy_cb = destroy_cb;
- cbs.priv = data;
-
- ug = ug_create(ug_data->ug, ug_name, UG_MODE_FULLVIEW, service, &cbs);
-
- return ug;
-}
-
-static void eb_create_view(EmailBlockAppData *ug_data)
-{
- debug_log("");
-
- Evas_Object *layout;
-
- ug_data->bg = elm_bg_add(ug_data->win_main);
- evas_object_size_hint_weight_set(ug_data->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(ug_data->win_main, ug_data->bg);
- evas_object_show(ug_data->bg);
-
- layout = elm_layout_add(ug_data->win_main);
- elm_layout_theme_set(layout, "layout", "application", "default");
- evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(ug_data->win_main, layout);
- evas_object_show(layout);
- ug_data->layout_main = layout;
- elm_object_part_content_set(ug_data->layout_main, "elm.swallow.bg", ug_data->bg);
-
- evas_object_smart_callback_add(ug_data->win_main, "profile,changed", _win_profile_changed_cb, ug_data);
-
- ug_data->selected_segment = 0;
- eb_add_navigation_bar(ug_data);
- eb_add_control_bar(ug_data);
- eb_create_first_view(ug_data);
-}
-
-static void _win_profile_changed_cb(void *data, Evas_Object *obj, void *event)
-{
- debug_log("");
- if (!data) {
- debug_log("data is NULL");
- return;
- }
-
- EmailBlockAppData *ug_data = (EmailBlockAppData *)data;
-
- const char *profile = elm_config_profile_get();
- if (!g_strcmp0(profile, "desktop"))
- elm_layout_theme_set(ug_data->layout_main, "layout", "application", "noindicator");
- else
- elm_layout_theme_set(ug_data->layout_main, "layout", "application", "default");
-
- evas_object_size_hint_weight_set(ug_data->layout_main, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(ug_data->win_main, ug_data->layout_main);
- evas_object_show(ug_data->layout_main);
-}
-
-static void eb_add_navigation_bar(EmailBlockAppData *ug_data)
-{
- debug_log("");
- Evas_Object *navi_bar;
-
- navi_bar = elm_naviframe_add(ug_data->layout_main);
- elm_object_part_content_set(ug_data->layout_main, "elm.swallow.content", navi_bar);
- evas_object_show(navi_bar);
-
- ug_data->navi_bar = navi_bar;
-}
-
-static void eb_add_control_bar(EmailBlockAppData *ug_data)
-{
- debug_log("");
- Elm_Object_Item *it1, *it2;
-
- if (ug_data == NULL)
- return;
-
- ug_data->control_bar = elm_toolbar_add(ug_data->navi_bar);
- elm_toolbar_shrink_mode_set(ug_data->control_bar, ELM_TOOLBAR_SHRINK_EXPAND);
- elm_object_style_set(ug_data->control_bar, "naviframe");
- evas_object_show(ug_data->control_bar);
-
- ug_data->c_item[0] = elm_toolbar_item_append(ug_data->control_bar, NULL,
- dgettext("sys_string", "IDS_COM_SK_DELETE"), _edit_cb, ug_data);
- elm_object_item_disabled_set(elm_toolbar_item_append(ug_data->control_bar, NULL, "", NULL, NULL), EINA_TRUE);
- ug_data->c_item[1] = elm_toolbar_item_append(ug_data->control_bar, NULL,
- dgettext("sys_string", "IDS_COM_SK_ADD"), _add_filter_clicked_cb, ug_data);
-
- ug_data->segment = elm_segment_control_add(ug_data->navi_bar);
- it1 = elm_segment_control_item_add(ug_data->segment, NULL, _("IDS_EMAIL_BODY_ADDRESS"));
- it2 = elm_segment_control_item_add(ug_data->segment, NULL, dgettext("sys_string", "IDS_COM_BODY_SUBJECT"));
- evas_object_smart_callback_add(ug_data->segment, "changed", _changed_filter_type_cb, ug_data);
- evas_object_show(ug_data->segment);
-
- debug_log("selected segment: %d", ug_data->selected_segment);
- if (ug_data->selected_segment == 0) {
- ug_data->block_type = TYPE_BLOCK_ADDRESS;
- elm_segment_control_item_selected_set(it1, TRUE);
- } else if (ug_data->selected_segment == 1) {
- ug_data->block_type = TYPE_BLOCK_SUBJECT;
- elm_segment_control_item_selected_set(it2, TRUE);
- }
-}
-
-static void eb_create_first_view(EmailBlockAppData *ug_data)
-{
- debug_log("");
-
- ug_data->view_type = VIEW_BLOCK_MAIN;
-
- ug_data->sub_ly = elm_layout_add(ug_data->navi_bar);
- elm_layout_theme_set(ug_data->sub_ly, "layout", "application", "noindicator");
- evas_object_size_hint_weight_set(ug_data->sub_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(ug_data->sub_ly);
-
- ug_data->l_button = elm_button_add(ug_data->navi_bar);
- evas_object_smart_callback_add(ug_data->l_button, "clicked", _back_cb, ug_data);
- elm_object_style_set(ug_data->l_button, "naviframe/back_btn/default");
- evas_object_show(ug_data->l_button);
-
- ug_data->navi_main_it = elm_naviframe_item_push(ug_data->navi_bar, _("IDS_EMAIL_HEADER_BLOCK_EMAILS"), ug_data->l_button, NULL, ug_data->sub_ly, NULL);
- elm_naviframe_item_style_set(ug_data->navi_main_it, "segment");
- elm_object_item_part_content_set(ug_data->navi_main_it, "segment", ug_data->segment);
- elm_object_item_part_content_set(ug_data->navi_main_it, "controlbar", ug_data->control_bar);
-
- _changed_filter_type_cb(ug_data, ug_data->segment, NULL);
-}
-
-static void eb_create_list(EmailBlockAppData *ug_data)
-{
- debug_log("");
- int count, i;
- email_rule_t *rule_list = NULL;
-
- ug_data->main_box = elm_box_add(ug_data->navi_bar);
- evas_object_size_hint_weight_set(ug_data->main_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(ug_data->main_box);
- elm_object_part_content_set(ug_data->sub_ly, "elm.swallow.content", ug_data->main_box);
-
- ug_data->gl_addrs = elm_genlist_add(ug_data->navi_bar);
- elm_genlist_block_count_set(ug_data->gl_addrs, 25);
- evas_object_size_hint_weight_set(ug_data->gl_addrs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(ug_data->gl_addrs, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_smart_callback_add(ug_data->gl_addrs, "drag,start,right", _my_gl_mode_right, NULL); /* sweep right */
- evas_object_smart_callback_add(ug_data->gl_addrs, "drag,start,left", _my_gl_mode_left, NULL); /* sweep left */
- evas_object_smart_callback_add(ug_data->gl_addrs, "drag,start,up", _my_gl_mode_cancel, NULL); /* flick */
- evas_object_smart_callback_add(ug_data->gl_addrs, "drag,start,down", _my_gl_mode_cancel, NULL); /* flick */
-
- ug_data->gl_subject = elm_genlist_add(ug_data->navi_bar);
- elm_genlist_block_count_set(ug_data->gl_subject, 25);
- evas_object_size_hint_weight_set(ug_data->gl_subject, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(ug_data->gl_subject, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_smart_callback_add(ug_data->gl_subject, "drag,start,right", _my_gl_mode_right, NULL); /* sweep right */
- evas_object_smart_callback_add(ug_data->gl_subject, "drag,start,left", _my_gl_mode_left, NULL); /* sweep left */
- evas_object_smart_callback_add(ug_data->gl_subject, "drag,start,up", _my_gl_mode_cancel, NULL); /* flick */
- evas_object_smart_callback_add(ug_data->gl_subject, "drag,start,down", _my_gl_mode_cancel, NULL); /* flick */
-
- elm_object_style_set(ug_data->gl_addrs, "1text");
- elm_object_style_set(ug_data->gl_subject, "1text");
-
- ug_data->itc_block.item_style = "1text"; /* for upper layer */
- ug_data->itc_block.decorate_item_style = "mode/slide2"; /* for lower layer */
- ug_data->itc_block.func.text_get = _eb_gl_label_get;
- ug_data->itc_block.func.del = _eb_gl_del;
- ug_data->itc_block.func.content_get = _eb_gl_icon_get;
- ug_data->itc_block.decorate_all_item_style = "edit_default";
-
- /* get the rule list from service */
- if (email_get_rule_list(&rule_list, &count) < 0) {
- debug_log("email_get_rule_list failed");
- }
-
- if (count > 0) {
- /* copy rule list */
- if (ug_data->rule_list != NULL) {
- free(ug_data->rule_list);
- ug_data->rule_list = NULL;
- }
-
- ug_data->rule_list = (email_rule_t *) malloc(sizeof(email_rule_t)*count);
- if (ug_data->rule_list && rule_list)
- memcpy(ug_data->rule_list, rule_list, sizeof(email_rule_t)*count);
- else
- goto FINISH_OFF;
-
- for (i = 0; i < count; i++) {
- ListItemData *item_data = NULL;
- if (ug_data->rule_list[i].type == EMAIL_FILTER_FROM) {
- item_data = calloc(1, sizeof(ListItemData));
- item_data->rule = &(ug_data->rule_list[i]);
- item_data->rule->value = g_strdup(item_data->rule->value);
- item_data->genlist = ug_data->gl_addrs;
- item_data->it = elm_genlist_item_append(ug_data->gl_addrs, &(ug_data->itc_block), (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, _eb_gl_sel_cb, (void *)item_data);
- ug_data->address_rule_count++;
- } else if (ug_data->rule_list[i].type == EMAIL_FILTER_SUBJECT) {
- item_data = calloc(1, sizeof(ListItemData));
- item_data->rule = &(ug_data->rule_list[i]);
- item_data->rule->value = g_strdup(item_data->rule->value);
- item_data->genlist = ug_data->gl_subject;
- item_data->it = elm_genlist_item_append(ug_data->gl_subject, &(ug_data->itc_block), (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, _eb_gl_sel_cb, (void *)item_data);
- ug_data->subject_rule_count++;
- } else {
- debug_log("undefined rule type");
- }
-
- debug_log("ug_data->address_rule_count %d n ug_data->subject_rule_count %d", ug_data->address_rule_count, ug_data->subject_rule_count);
- }
- }
-
-FINISH_OFF:
- /* free emf rule_list */
- email_free_rule(&rule_list, count);
-}
-
-static void _my_gl_mode_right(void *data, Evas_Object *obj, void *event_info)
-{
- if (!event_info)
- return;
-
- /* Start genlist sweep */
- elm_genlist_item_decorate_mode_set(event_info, "slide", EINA_TRUE);
-}
-
-static void _my_gl_mode_left(void *data, Evas_Object *obj, void *event_info)
-{
- if (!event_info)
- return;
-
- /* Finish genlist sweep */
- elm_genlist_item_decorate_mode_set(event_info, "slide", EINA_FALSE);
-}
-
-static void _my_gl_mode_cancel(void *data, Evas_Object *obj, void *event_info)
-{
- if (!obj)
- return;
-
- /* Get sweeped item */
- Elm_Object_Item *it = (Elm_Object_Item *)elm_genlist_decorated_item_get(obj);
- /* Finish genlist sweep */
- if (it)
- elm_genlist_item_decorate_mode_set(it, "slide", EINA_FALSE);
-}
-
-static void eb_free_list(EmailBlockAppData *ug_data)
-{
- debug_log("");
- if (ug_data->gl_addrs != NULL) {
- elm_genlist_clear(ug_data->gl_addrs);
- evas_object_del(ug_data->gl_addrs);
- ug_data->gl_addrs = NULL;
- }
- if (ug_data->gl_subject != NULL) {
- elm_genlist_clear(ug_data->gl_subject);
- evas_object_del(ug_data->gl_subject);
- ug_data->gl_subject = NULL;
- }
- if (ug_data->gl_string != NULL) {
- elm_genlist_clear(ug_data->gl_string);
- evas_object_del(ug_data->gl_string);
- ug_data->gl_string = NULL;
- }
- ug_data->address_rule_count = 0;
- ug_data->subject_rule_count = 0;
-
- if (ug_data->main_box) {
- evas_object_del(ug_data->main_box);
- ug_data->main_box = NULL;
- }
-}
-
-static void eb_create_noc(EmailBlockAppData *ug_data)
-{
- debug_log("");
-
- ug_data->noc = elm_layout_add(ug_data->navi_bar);
- elm_layout_theme_set(ug_data->noc, "layout", "nocontents", "text");
- elm_object_part_text_set(ug_data->noc, "elm.text", dgettext("sys_string", "IDS_COM_BODY_NO_CONTENTS"));
-
- ug_data->noc_ly = elm_layout_add(ug_data->navi_bar);
- elm_layout_file_set(ug_data->noc_ly, THEME_PATH, "email_block_noc");
- evas_object_size_hint_weight_set(ug_data->noc_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
- elm_object_part_content_set(ug_data->noc_ly, "contents", ug_data->noc);
-}
-
-static void eb_free_noc(EmailBlockAppData *ug_data)
-{
- debug_log("");
-
- elm_object_part_content_unset(ug_data->noc_ly, "contents");
- if (ug_data->noc) {
- evas_object_del(ug_data->noc);
- ug_data->noc = NULL;
- }
-
- if (ug_data->noc_ly) {
- evas_object_del(ug_data->noc_ly);
- ug_data->noc_ly = NULL;
- }
-}
-
-static void eb_destroy_main_view(EmailBlockAppData *ug_data)
-{
- debug_log("");
-
- eb_free_list(ug_data);
- eb_free_noc(ug_data);
-
- if (ug_data->popup_empty) {
- evas_object_del(ug_data->popup_empty);
- ug_data->popup_empty = NULL;
- }
-
- if (ug_data->timeout_popup) {
- evas_object_del(ug_data->timeout_popup);
- ug_data->timeout_popup = NULL;
- }
-
- if (ug_data->segment) {
- evas_object_del(ug_data->segment);
- ug_data->segment = NULL;
- }
-
- if (ug_data->control_bar) {
- evas_object_del(ug_data->control_bar);
- ug_data->control_bar = NULL;
- }
-
- if (ug_data->navi_bar) {
- evas_object_del(ug_data->navi_bar);
- ug_data->navi_bar = NULL;
- }
-
- if (ug_data->sub_ly) {
- evas_object_del(ug_data->sub_ly);
- ug_data->sub_ly = NULL;
- }
-
- if (ug_data->layout_main) {
- evas_object_del(ug_data->layout_main);
- ug_data->layout_main = NULL;
- }
-}
-
-static void eb_destroy_filter_add_view(EmailBlockAppData *ug_data)
-{
- debug_log("");
-
- if (ug_data->str_filter_name) {
- g_free(ug_data->str_filter_name);
- ug_data->str_filter_name = NULL;
- }
-}
-
-static void eb_create_add_filter_view(EmailBlockAppData *ug_data, email_rule_t * rule)
-{
- debug_log("");
- ug_data->view_type = VIEW_BLOCK_FILTER_DATA_SET;
-
- Elm_Object_Item *item = NULL;
- Elm_Object_Item *git = NULL;
-
- ug_data->gl_add_filter = elm_genlist_add(ug_data->navi_bar);
- elm_object_style_set(ug_data->gl_add_filter, "dialogue");
- elm_genlist_bounce_set(ug_data->gl_add_filter, EINA_FALSE, EINA_FALSE);
- elm_object_theme_set(ug_data->gl_add_filter, ug_data->theme);
-
- ug_data->itc1.item_style = "dialogue/1icon";
- ug_data->itc1.func.text_get = NULL;
- ug_data->itc1.func.content_get = _eb_gl_add_ef_icon_get;
- ug_data->itc1.func.state_get = NULL;
- ug_data->itc1.func.del = NULL;
-
- ug_data->itc2.item_style = "dialogue/email.2icon";
- ug_data->itc2.func.text_get = NULL;
- ug_data->itc2.func.content_get = _eb_gl_add_ef_icon_get;
- ug_data->itc2.func.state_get = NULL;
- ug_data->itc2.func.del = NULL;
-
- ug_data->itc3.item_style = "dialogue/separator/21/with_line";
- ug_data->itc3.func.text_get = NULL;
- ug_data->itc3.func.content_get = NULL;
- ug_data->itc3.func.state_get = NULL;
- ug_data->itc3.func.del = NULL;
-
- ug_data->itc4.item_style = "dialogue/separator/20";
- ug_data->itc4.func.text_get = NULL;
- ug_data->itc4.func.content_get = NULL;
- ug_data->itc4.func.state_get = NULL;
- ug_data->itc4.func.del = NULL;
-
- git = elm_genlist_item_append(ug_data->gl_add_filter, &ug_data->itc3, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
- elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
-
- if (ug_data->block_type == TYPE_BLOCK_ADDRESS && ug_data->mode == BLOCK_MODE_ADD) {
- item = elm_genlist_item_append(ug_data->gl_add_filter, &ug_data->itc2, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
- } else {
- item = elm_genlist_item_append(ug_data->gl_add_filter, &ug_data->itc1, (void *)rule, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
- }
-
- ug_data->match_crt = TYPE_MATCH_CRT_INC_ON;
-
- Evas_Object *conform;
- elm_win_conformant_set(ug_data->win_main, 1);
- conform = elm_conformant_add(ug_data->win_main);
- elm_object_style_set(conform, "internal_layout");
- evas_object_show(conform);
-
- ug_data->layout_add = elm_layout_add(ug_data->navi_bar);
- elm_layout_theme_set(ug_data->layout_add, "layout", "application", "noindicator");
- evas_object_size_hint_weight_set(ug_data->layout_add, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
- elm_object_content_set(conform, ug_data->gl_add_filter);
- elm_object_part_content_set(ug_data->layout_add, "elm.swallow.content", conform);
-
- ug_data->r_button2 = elm_button_add(ug_data->navi_bar);
- elm_object_style_set(ug_data->r_button2, "naviframe/title/default");
- elm_object_text_set(ug_data->r_button2, dgettext("sys_string", "IDS_COM_SK_DONE"));
- evas_object_smart_callback_add(ug_data->r_button2, "clicked", _rule_save_cb, ug_data);
- evas_object_show(ug_data->r_button2);
-
- ug_data->l_button2 = elm_button_add(ug_data->navi_bar);
- elm_object_style_set(ug_data->l_button2, "naviframe/title/default");
- elm_object_text_set(ug_data->l_button2, dgettext("sys_string", "IDS_COM_SK_CANCEL"));
- evas_object_smart_callback_add(ug_data->l_button2, "clicked", _back_prev_view_cb, ug_data);
- evas_object_show(ug_data->l_button2);
-
- Elm_Object_Item *navi_it = NULL;
- if (rule) {
- navi_it = elm_naviframe_item_push(ug_data->navi_bar, _("IDS_EMAIL_HEADER_EDIT_RULES"), NULL, NULL, ug_data->layout_add, NULL);
- } else {
- elm_object_disabled_set(ug_data->r_button2, EINA_TRUE);
-
- if (ug_data->block_type == TYPE_BLOCK_ADDRESS) {
- navi_it = elm_naviframe_item_push(ug_data->navi_bar, _("IDS_EMAIL_BODY_ADD_ADDRESS"), NULL, NULL, ug_data->layout_add, NULL);
- } else if (ug_data->block_type == TYPE_BLOCK_SUBJECT) {
- navi_it = elm_naviframe_item_push(ug_data->navi_bar, N_("Add subject"), NULL, NULL, ug_data->layout_add, NULL);
- }
- }
-
- elm_object_item_part_content_set(navi_it, "title_right_btn", ug_data->l_button2);
- elm_object_item_part_content_set(navi_it, "title_left_btn", ug_data->r_button2);
-
- ug_data->back_btn_add = elm_object_item_part_content_get(navi_it, "prev_btn");
- if (ug_data->back_btn_add)
- evas_object_smart_callback_add(ug_data->back_btn_add, "clicked", _add_filter_cancel_clicked_cb, ug_data);
-}
-
-static void _rule_save_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
-
- EmailBlockAppData *ug_data = (EmailBlockAppData *)data;
-
- if (block_addr) {
- g_free(block_addr);
- block_addr = NULL;
- }
-
- elm_object_disabled_set(ug_data->r_button2, EINA_TRUE);
- elm_object_disabled_set(ug_data->l_button2, EINA_TRUE);
- elm_object_disabled_set(ug_data->back_btn_add, EINA_TRUE);
-
- char *buf_ = (char *)elm_entry_entry_get(ug_data->entry_filter_name);
- char *buf = elm_entry_markup_to_utf8(buf_);
-
- if (!buf || !strlen(buf)) {
- ug_data->popup_empty = elm_popup_add(ug_data->layout_main);
- evas_object_size_hint_weight_set(ug_data->popup_empty, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_popup_timeout_set(ug_data->popup_empty, 2);
- elm_object_text_set(ug_data->popup_empty, _("IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"));
- elm_object_part_text_set(ug_data->popup_empty, "title,text", _("IDS_EMAIL_POP_ALERT"));
- evas_object_smart_callback_add(ug_data->popup_empty, "block,clicked", _popup_block_clicked_cb, ug_data);
- evas_object_show(ug_data->popup_empty);
- goto FINISH_OFF;
- }
-
- gchar **vector;
- char *item_str;
- int i = 0;
- int valid_vector_cnt = 0;
- vector = g_strsplit_set(buf, ";", -1);
- guint str_cnt = g_strv_length(vector);
- debug_log("addr_cnt: %d", str_cnt);
-
- if (ug_data->block_type == TYPE_BLOCK_ADDRESS) {
- for (i = 0; i < str_cnt; i++) {
- /* check if valid address */
- if (vector[i] != NULL && strlen(vector[i]) > 0) {
- if (email_get_address_validation(vector[i]) == FALSE) {
- valid_vector_cnt = 0;
- break;
- }
-
- valid_vector_cnt++;
- }
- }
-
- if (valid_vector_cnt == 0) {
- ug_data->popup_empty = elm_popup_add(ug_data->layout_main);
- evas_object_size_hint_weight_set(ug_data->popup_empty, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_popup_timeout_set(ug_data->popup_empty, 2);
- elm_object_text_set(ug_data->popup_empty, _("IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"));
- elm_object_part_text_set(ug_data->popup_empty, "title,text", _("IDS_EMAIL_POP_ALERT"));
- evas_object_smart_callback_add(ug_data->popup_empty, "block,clicked", _popup_block_clicked_cb, ug_data);
- evas_object_show(ug_data->popup_empty);
-
- g_strfreev(vector);
- goto FINISH_OFF;
- }
-
- for (i = 0; i < str_cnt; i++) {
- if (vector[i] != NULL && strlen(vector[i]) > 0) {
- item_str = g_strdup(vector[i]);
- _add_one_rule(ug_data, item_str);
- g_free(item_str);
- }
- }
- } else { /* subject */
- int empty = 1;
- debug_log("subject: [%s] %d", buf, strlen(buf));
- for (i = 0; i < strlen(buf); i++)
- if (buf[i] != ' ') {
- empty = 0;
- break;
- }
-
- if (empty == 0)
- _add_one_rule(ug_data, (char *)buf);
- else {
- ug_data->popup_empty = elm_popup_add(ug_data->layout_main);
- evas_object_size_hint_weight_set(ug_data->popup_empty, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_popup_timeout_set(ug_data->popup_empty, 2);
- elm_object_text_set(ug_data->popup_empty, _("IDS_EMAIL_POP_UNABLE_TO_SAVE_SUBJECT_EMPTY"));
- elm_object_part_text_set(ug_data->popup_empty, "title,text", _("IDS_EMAIL_POP_ALERT"));
- evas_object_smart_callback_add(ug_data->popup_empty, "block,clicked", _popup_block_clicked_cb, ug_data);
- evas_object_show(ug_data->popup_empty);
-
- g_strfreev(vector);
- goto FINISH_OFF;
- }
- }
-
- g_strfreev(vector);
-
- _changed_filter_type_cb(ug_data, ug_data->segment, NULL);
-
- _back_prev_view_cb(ug_data, NULL, NULL);
-
- FINISH_OFF:
- elm_object_disabled_set(ug_data->r_button2, EINA_FALSE);
- elm_object_disabled_set(ug_data->l_button2, EINA_FALSE);
- elm_object_disabled_set(ug_data->back_btn_add, EINA_FALSE);
- g_free(buf);
-}
-
-static void _add_one_rule(EmailBlockAppData *ug_data, char *buf)
-{
- int ret = EMAIL_ERROR_NONE;
- email_rule_t *rule = NULL;
-
- /* add filtering rule */
- rule = malloc(sizeof(email_rule_t));
- if (!rule)
- return;
- rule->account_id = ug_data->account_id;
- rule->type = ug_data->block_type;
- rule->value = g_strdup(buf);
- rule->faction = 2; /* BLOCK */
- rule->target_mailbox_id = ug_data->mailbox_id;
- rule->flag1 = 1; /* on */
- rule->flag2 = 1;
-
- debug_log("priv->type_crt %d value %s", ug_data->block_type, rule->value);
-
- if (ug_data->mode == BLOCK_MODE_ADD) {
- ret = email_add_rule(rule);
- if (ret < 0)
- debug_log("email_add_rule failed %d", ret);
- }
-
- else if (ug_data->mode == BLOCK_MODE_EDIT) {
- ret = email_update_rule(ug_data->edit_filter_id, rule);
- if (ret < 0)
- debug_log("email_update_rule failed");
- }
-
- if (ret == EMAIL_ERROR_ALREADY_EXISTS) {
- /* Should display error popup */
- ug_data->timeout_popup = elm_popup_add(ug_data->layout_main);
- evas_object_size_hint_weight_set(ug_data->timeout_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_popup_timeout_set(ug_data->timeout_popup, 2);
- if (rule->type == EMAIL_FILTER_FROM)
- elm_object_text_set(ug_data->timeout_popup, _("IDS_EMAIL_POP_ALREADY_BLOCKED"));
- else
- elm_object_text_set(ug_data->timeout_popup, _("IDS_EMAIL_POP_ALREADY_BLOCKED"));
- elm_object_part_text_set(ug_data->timeout_popup, "title,text", _("IDS_EMAIL_POP_ALERT"));
- evas_object_smart_callback_add(ug_data->timeout_popup, "block,clicked", _popup_block_clicked_cb, ug_data);
- evas_object_show(ug_data->timeout_popup);
- }
-
- email_free_rule(&rule, 1);
- g_free(rule);
-}
-
-static void _add_filter_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- EmailBlockAppData *ug_data = (EmailBlockAppData *)data;
-
- ug_data->mode = BLOCK_MODE_ADD;
- eb_create_add_filter_view(ug_data, NULL);
-}
-
-static void _changed_filter_type_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- EmailBlockAppData *ug_data = (EmailBlockAppData *)data;
- Elm_Object_Item *it;
- char *label_str = NULL;
- int value;
-
- it = elm_segment_control_item_selected_get(obj);
- value = elm_segment_control_item_index_get(it);
- debug_log("index is value %d", value);
-
- if (value < 0 || value >= 2) {
- debug_log("invalid index, return");
- return;
- }
-
- label_str = (char *)elm_segment_control_item_label_get(obj, value);
- debug_log("label:%s", label_str);
-
- if (label_str == NULL) {
- debug_log("label str is NULL, return");
- return;
- }
-
- ug_data->selected_segment = value;
-
- elm_object_part_content_unset(ug_data->sub_ly, "elm.swallow.content");
- eb_free_list(ug_data);
- eb_free_noc(ug_data);
-
- eb_create_list(ug_data);
-
- if (g_strcmp0(label_str, dgettext("sys_string", "IDS_COM_BODY_SUBJECT")) == 0) {
- if (ug_data->subject_rule_count > 0) {
- elm_box_pack_end(ug_data->main_box, ug_data->gl_subject);
- evas_object_show(ug_data->gl_subject);
- elm_object_item_disabled_set(ug_data->c_item[0], EINA_FALSE);
- } else {
- eb_create_noc(ug_data);
- elm_object_part_text_set(ug_data->noc, "elm.text", _("IDS_EMAIL_BODY_NO_SUBJECT"));
- elm_box_pack_end(ug_data->main_box, ug_data->noc_ly);
- evas_object_show(ug_data->noc_ly);
- elm_object_item_disabled_set(ug_data->c_item[0], EINA_TRUE);
- }
-
- ug_data->block_type = TYPE_BLOCK_SUBJECT;
- } else if (g_strcmp0(label_str, _("IDS_EMAIL_BODY_ADDRESS")) == 0) {
- if (ug_data->address_rule_count > 0) {
- elm_box_pack_end(ug_data->main_box, ug_data->gl_addrs);
- evas_object_show(ug_data->gl_addrs);
- elm_object_item_disabled_set(ug_data->c_item[0], EINA_FALSE);
- } else {
- eb_create_noc(ug_data);
- elm_object_part_text_set(ug_data->noc, "elm.text", _("IDS_EMAIL_BODY_NO_ADDRESS"));
- elm_box_pack_end(ug_data->main_box, ug_data->noc_ly);
- evas_object_show(ug_data->noc_ly);
- elm_object_item_disabled_set(ug_data->c_item[0], EINA_TRUE);
- }
-
- ug_data->block_type = TYPE_BLOCK_ADDRESS;
- }
-}
-
-static void _back_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- EmailBlockAppData *ug_data = (EmailBlockAppData *)data;
-
- /* This avoids moving back to Email settings screen */
- Evas_Object *genlist = NULL;
-
- if (ug_data->block_type == TYPE_BLOCK_SUBJECT) {
- genlist = ug_data->gl_subject;
- } else if (ug_data->block_type == TYPE_BLOCK_ADDRESS) {
- genlist = ug_data->gl_addrs;
- }
-
- if (!elm_genlist_decorate_mode_get(genlist)) {
- ug_destroy_me(ug_data->ug);
- } else {
- _edit_cb(ug_data, NULL, NULL);
- }
-}
-
-static void _edit_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- EmailBlockAppData *ug_data = (EmailBlockAppData *)data;
-
- Evas_Object *genlist = NULL;
-
- if (ug_data->block_type == TYPE_BLOCK_SUBJECT) {
- genlist = ug_data->gl_subject;
- ug_data->edit_total_count = ug_data->subject_rule_count;
- } else if (ug_data->block_type == TYPE_BLOCK_ADDRESS) {
- genlist = ug_data->gl_addrs;
- ug_data->edit_total_count = ug_data->address_rule_count;
- }
-
- if (!elm_genlist_decorate_mode_get(genlist)) {
- ug_data->edit_checked_count = 0;
- /* Change layout background color to edit_mode color */
- edje_object_signal_emit(_EDJ(ug_data->layout_main), "elm,bg,show,edit_mode", "elm");
-
- elm_object_item_part_content_unset(ug_data->navi_main_it, "segment");
- elm_object_item_part_content_unset(ug_data->navi_main_it, "controlbar");
- evas_object_hide(ug_data->segment);
- evas_object_hide(ug_data->control_bar);
- elm_naviframe_item_style_set(ug_data->navi_main_it, "basic");
-
- ug_data->control_bar_edit = elm_toolbar_add(ug_data->navi_bar);
- elm_toolbar_shrink_mode_set(ug_data->control_bar_edit, ELM_TOOLBAR_SHRINK_EXPAND);
- elm_object_style_set(ug_data->control_bar_edit, "naviframe");
- evas_object_show(ug_data->control_bar_edit);
-
- ug_data->c_item[2] = elm_toolbar_item_append(ug_data->control_bar_edit, NULL,
- dgettext("sys_string", "IDS_COM_SK_DELETE"), _delete_rule_cb, ug_data);
- elm_object_item_disabled_set(ug_data->c_item[2], EINA_TRUE);
- elm_object_item_disabled_set(elm_toolbar_item_append(ug_data->control_bar_edit, NULL, "", NULL, NULL), EINA_TRUE);
- elm_object_item_disabled_set(elm_toolbar_item_append(ug_data->control_bar_edit, NULL, "", NULL, NULL), EINA_TRUE);
- elm_object_item_part_content_set(ug_data->navi_main_it, "controlbar", ug_data->control_bar_edit);
-
- /* Append 'Select All' layout */
- ug_data->select_all_layout = elm_layout_add(ug_data->main_box);
- elm_layout_theme_set(ug_data->select_all_layout, "genlist", "item", "select_all/default");
- evas_object_size_hint_weight_set(ug_data->select_all_layout, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
- evas_object_size_hint_align_set(ug_data->select_all_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_event_callback_add(ug_data->select_all_layout, EVAS_CALLBACK_MOUSE_DOWN, _select_all_layout_mouse_down_cb, ug_data);
-
- ug_data->select_all_checkbox = elm_check_add(ug_data->select_all_layout);
- elm_check_state_pointer_set(ug_data->select_all_checkbox, &ug_data->select_all_checked);
- evas_object_smart_callback_add(ug_data->select_all_checkbox, "changed", _select_all_check_changed_cb, ug_data);
- evas_object_propagate_events_set(ug_data->select_all_checkbox, EINA_FALSE);
- elm_object_part_content_set(ug_data->select_all_layout, "elm.icon", ug_data->select_all_checkbox);
-
- elm_object_part_text_set(ug_data->select_all_layout, "elm.text", dgettext("sys_string", "IDS_COM_BODY_SELECT_ALL"));
- elm_box_pack_start(ug_data->main_box, ug_data->select_all_layout);
- evas_object_show(ug_data->select_all_layout);
-
- /* Set reorder and edit mode */
- elm_genlist_reorder_mode_set(genlist, EINA_TRUE);
- elm_genlist_decorate_mode_set(genlist, EINA_TRUE);
-
- /* This means even if selected, every click will make the selected callbacks be called. */
- elm_genlist_select_mode_set(genlist, ELM_OBJECT_SELECT_MODE_ALWAYS);
-
- /* This disables sweep menu in edit mode */
- ug_data->itc_block.decorate_item_style = NULL; /* for lower layer */
-
- elm_object_item_text_set(ug_data->navi_main_it, _("IDS_EMAIL_HEADER_DELETE"));
- } else {
- /* Change layout background color to default background color */
- edje_object_signal_emit(_EDJ(ug_data->layout_main), "elm,bg,show,default", "elm");
-
- elm_object_item_part_content_unset(ug_data->navi_main_it, "controlbar");
- if (ug_data->control_bar_edit) {
- evas_object_del(ug_data->control_bar_edit);
- ug_data->control_bar_edit = NULL;
- }
-
- elm_naviframe_item_style_set(ug_data->navi_main_it, "segment");
- elm_object_item_part_content_set(ug_data->navi_main_it, "segment", ug_data->segment);
- elm_object_item_part_content_set(ug_data->navi_main_it, "controlbar", ug_data->control_bar);
- evas_object_show(ug_data->segment);
- evas_object_show(ug_data->control_bar);
-
- /* Remove 'Select All' layout. */
- elm_box_unpack(ug_data->main_box, ug_data->select_all_layout);
- evas_object_del(ug_data->select_all_layout);
- ug_data->select_all_layout = NULL;
-
- if (ug_data->edit_select_info) {
- evas_object_del(ug_data->edit_select_info);
- ug_data->edit_select_info = NULL;
- }
-
- /* Unset edit mode */
- elm_genlist_decorate_mode_set(genlist, EINA_FALSE);
- elm_genlist_reorder_mode_set(genlist, EINA_FALSE);
- elm_genlist_select_mode_set(genlist, ELM_OBJECT_SELECT_MODE_DEFAULT);
-
- ug_data->select_all_checked = EINA_FALSE;
- elm_check_state_pointer_set(ug_data->select_all_checkbox, &ug_data->select_all_checked);
- _changed_filter_type_cb(ug_data, ug_data->segment, NULL);
-
- /* Set the navigation bar title */
- elm_object_item_text_set(ug_data->navi_main_it, _("IDS_EMAIL_HEADER_BLOCK_EMAILS"));
- }
-}
-
-static void _back_prev_view_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- EmailBlockAppData *ug_data = (EmailBlockAppData *)data;
-
- if (ug_data->view_type != VIEW_BLOCK_FILTER_DATA_SET) {
- debug_log("**double clicked**");
- return;
- }
-
- elm_object_disabled_set(ug_data->r_button2, EINA_TRUE);
- elm_object_disabled_set(ug_data->l_button2, EINA_TRUE);
- elm_object_disabled_set(ug_data->back_btn_add, EINA_TRUE);
-
- debug_log("view type is %d", ug_data->view_type);
- elm_naviframe_item_pop(ug_data->navi_bar);
-
- if (block_addr) {
- g_free(block_addr);
- block_addr = NULL;
- }
-
- switch (ug_data->view_type) {
- case VIEW_BLOCK_EDIT_FILTER_LIST:
- /*eb_destroy_edit_view(ug_data);*/
- ug_data->gl_edit = NULL;
- ug_data->view_type = VIEW_BLOCK_MAIN;
- break;
-
- case VIEW_BLOCK_CRITERIA_SET:
- /*eb_destroy_criterion_view(ug_data);*/
- ug_data->view_type = VIEW_BLOCK_FILTER_DATA_SET;
- break;
-
- case VIEW_BLOCK_FILTER_DATA_SET:
- eb_destroy_filter_add_view(ug_data);
- ug_data->view_type = VIEW_BLOCK_MAIN;
- _changed_filter_type_cb(ug_data, ug_data->segment, NULL);
- break;
- }
-}
-
-static void _add_filter_cancel_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- EmailBlockAppData *ug_data = (EmailBlockAppData *)data;
-
- if (ug_data->view_type != VIEW_BLOCK_FILTER_DATA_SET) {
- debug_log("**double clicked**");
- return;
- }
-
- elm_object_disabled_set(ug_data->r_button2, EINA_TRUE);
- elm_object_disabled_set(ug_data->l_button2, EINA_TRUE);
- elm_object_disabled_set(ug_data->back_btn_add, EINA_TRUE);
-
- debug_log("view type is %d", ug_data->view_type);
-
- if (block_addr) {
- g_free(block_addr);
- block_addr = NULL;
- }
-
- switch (ug_data->view_type) {
- case VIEW_BLOCK_EDIT_FILTER_LIST:
- /*eb_destroy_edit_view(ug_data);*/
- ug_data->gl_edit = NULL;
- ug_data->view_type = VIEW_BLOCK_MAIN;
- break;
-
- case VIEW_BLOCK_CRITERIA_SET:
- /*eb_destroy_criterion_view(ug_data);*/
- ug_data->view_type = VIEW_BLOCK_FILTER_DATA_SET;
- break;
-
- case VIEW_BLOCK_FILTER_DATA_SET:
- eb_destroy_filter_add_view(ug_data);
- ug_data->view_type = VIEW_BLOCK_MAIN;
- _changed_filter_type_cb(ug_data, ug_data->segment, NULL);
- break;
- }
-}
-
-static void _check_select_all(EmailBlockAppData *ug_data)
-{
- debug_log("");
- ListItemData *it_data;
- Elm_Object_Item *it;
-
- Evas_Object *genlist = NULL;
-
- if (ug_data->block_type == TYPE_BLOCK_SUBJECT) {
- genlist = ug_data->gl_subject;
- } else if (ug_data->block_type == TYPE_BLOCK_ADDRESS) {
- genlist = ug_data->gl_addrs;
- }
-
- if (ug_data->select_all_checked)
- ug_data->edit_checked_count = ug_data->edit_total_count;
- else
- ug_data->edit_checked_count = 0;
-
- it = elm_genlist_first_item_get(genlist);
- while (it) {
- it_data = elm_object_item_data_get(it);
- if (it_data)
- it_data->checked = ug_data->select_all_checked;
- it = elm_genlist_item_next_get(it);
- }
-
- _del_button_state_set(ug_data);
- _show_selection_info(ug_data);
-
- /* Update all realized items */
- elm_genlist_realized_items_update(genlist);
-}
-
-static void _select_all_layout_mouse_down_cb(void *data, Evas * evas, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- EmailBlockAppData *ug_data = (EmailBlockAppData *)data;
-
- ug_data->select_all_checked = !ug_data->select_all_checked;
- elm_check_state_pointer_set(ug_data->select_all_checkbox, &ug_data->select_all_checked);
-
- _check_select_all(ug_data);
-}
-
-static void _select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- _check_select_all(data);
-}
-
-static void _delete_rule_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- EmailBlockAppData *ug_data = (EmailBlockAppData *)data;
- Elm_Object_Item *it;
- ListItemData *item_data = NULL;
- Evas_Object *genlist = NULL;
-
- if (ug_data->block_type == TYPE_BLOCK_SUBJECT) {
- genlist = ug_data->gl_subject;
- } else if (ug_data->block_type == TYPE_BLOCK_ADDRESS) {
- genlist = ug_data->gl_addrs;
- }
-
- it = elm_genlist_first_item_get(genlist);
- while (it) {
- item_data = (ListItemData *) elm_object_item_data_get(it);
- it = elm_genlist_item_next_get(it);
-
- if ((item_data) && (item_data->checked)) {
- email_delete_rule(item_data->rule->filter_id);
- elm_object_item_del(item_data->it);
- ug_data->edit_total_count--;
- ug_data->edit_checked_count--;
- }
- }
-
- if (ug_data->edit_select_info) {
- evas_object_del(ug_data->edit_select_info);
- ug_data->edit_select_info = NULL;
- }
-
- _del_button_state_set(ug_data);
-
- if (ug_data->edit_total_count == 0) {
- ug_data->select_all_checked = EINA_FALSE;
- elm_check_state_pointer_set(ug_data->select_all_checkbox, &ug_data->select_all_checked);
-
- _edit_cb(ug_data, NULL, NULL);
- }
-}
-
-static void _get_contact_email_list(const char *val, char **result, EmailBlockAppData *ug_data)
-{
- debug_log("");
-
- int i = 0;
- int j = 0;
- int c_id = 0;
- int *c_id_list = NULL;
- int error_code = 0;
- gsize c_id_list_len = 0;
-
- char *result_address = NULL;
- char *result_address_ = NULL;
- char *email_addr = NULL;
- char *tmp_addr = NULL;
-
- CTSstruct *email_contact = NULL;
- GSList *email_list = NULL;
- GSList *li = NULL;
- CTSvalue *email = NULL;
-
- c_id_list = (int *)g_base64_decode(val, &c_id_list_len);
-
- for (j = 0; j < c_id_list_len / sizeof(int); j++) {
- c_id = c_id_list[j];
- debug_log("selected contact id: %d", c_id);
-
- error_code = contacts_svc_get_contact_value(CTS_GET_EMAIL_VALUE, c_id, &email);
- tmp_addr = g_strdup(contacts_svc_value_get_str(email, CTS_EMAIL_VAL_ADDR_STR));
- contacts_svc_value_free(email);
-
- if (!tmp_addr) {
- debug_log("addr is NULL");
- continue;
- }
- debug_log("addr = %s", tmp_addr);
-
- int ct_idx = contacts_svc_find_contact_by(CTS_FIND_BY_EMAIL, tmp_addr);
- debug_log("ct_idx = %d", ct_idx);
-
- if (ct_idx < 0) {
- debug_log("CT ID is not valid");
- continue;
- }
-
- error_code = contacts_svc_get_contact(ct_idx, &email_contact);
- error_code = contacts_svc_struct_get_list(email_contact, CTS_CF_EMAIL_LIST, &email_list);
-
- if (email_list != NULL && g_slist_length(email_list) > 0) {
- int cnt = 0;
- EmailRecipientInfo *ri = (EmailRecipientInfo *) calloc(1, sizeof(EmailRecipientInfo));
-
- for (li = email_list; li != NULL; li = g_slist_next(li)) {
- email_addr = (char *)contacts_svc_value_get_str(li->data, CTS_EMAIL_VAL_ADDR_STR);
- if (email_addr && strlen(email_addr) > 0) {
- debug_log("email: %s", email_addr);
- debug_log("dest buf size (%d)", sizeof(ri->email_list[cnt].email_addr));
- snprintf(ri->email_list[cnt].email_addr, sizeof(ri->email_list[cnt].email_addr), "%s", email_addr);
- cnt++;
- }
- }
-
- for (i = 0; i < cnt; i++) {
- debug_log("ri->email_list[i].email_addr : [%s]", ri->email_list[i].email_addr);
- if (result_address)
- result_address_ = g_strconcat(result_address, ";", ri->email_list[i].email_addr, NULL);
- else
- result_address_ = g_strdup(ri->email_list[i].email_addr);
-
- if (result_address)
- g_free(result_address);
- result_address = result_address_;
- }
-
- debug_log("result address : [%s]", result_address);
- contacts_svc_struct_free(email_contact);
- free(ri);
- }
- }
-
- g_free(c_id_list);
- *result = result_address;
-}
-
-static void _contact_button_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- EmailBlockAppData *ug_data = (EmailBlockAppData *)data;
-
- if (g_strcmp0("", ug_data->str_filter_name) == 0) {
- g_free(block_addr);
- block_addr = NULL;
- } else if (g_strcmp0(block_addr, ug_data->str_filter_name) != 0) {
- g_free(block_addr);
- block_addr = g_strdup(ug_data->str_filter_name);
- }
-
- ug_data->view_type = VIEW_BLOCK_CONTACT_ADD;
-
- /*struct ug_cbs cbs = { 0, };
-
- cbs.layout_cb = layout_cb;
- cbs.result_cb = result_cb;
- cbs.destroy_cb = destroy_cb;
- cbs.priv = (void *)ug_data;*/
-
- int ret;
- service_h service = NULL;
-
- ret = service_create(&service);
-
- if (service) {
- char contact_ug[255] = { 0, };
- snprintf(contact_ug, sizeof(contact_ug), "%d", CT_UG_REQUEST_CHECK_FOR_EMAIL);
-
- ret = service_add_extra_data(service, EMAIL_BUNDLE_KEY_CONTACT_TYPE, contact_ug);
- //ug_data->ug_contact = ug_create(ug_data->ug, UG_NAME_CONTACT, UG_MODE_FULLVIEW, service, &cbs);
- ug_data->ug_contact = create_ug(UG_NAME_CONTACT, service, data);
- ret = service_destroy(service);
- }
-}
-
-static void _recent_button_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- EmailBlockAppData *ugd = (EmailBlockAppData *)data;
-
- if (ugd == NULL) {
- debug_log("ugd is NULL");
- return;
- }
-
- if (g_strcmp0("", ugd->str_filter_name) == 0)
- block_addr = NULL;
- else if (g_strcmp0(block_addr, ugd->str_filter_name) != 0)
- block_addr = g_strdup(ugd->str_filter_name);
-
- _block_recent_create_view(ugd);
-}
-
-static void _block_rule_vconf_key_changed_cb(keynode_t *key, void *data)
-{
- debug_log("");
- EmailBlockAppData *ug_data = (EmailBlockAppData *)data;
-
- if (!ug_data) return;
-
- if (ug_data->view_type != VIEW_BLOCK_MAIN) {
- debug_log("not in block main view");
- return;
- }
-
- if (ug_data->block_type == TYPE_BLOCK_ADDRESS) {
- if (!elm_genlist_decorate_mode_get(ug_data->gl_addrs)) {
- debug_log("TYPE_BLOCK_ADDRESS");
- elm_object_part_content_unset(ug_data->sub_ly, "elm.swallow.content");
- eb_free_list(ug_data);
- eb_free_noc(ug_data);
- eb_create_list(ug_data);
-
- if (ug_data->address_rule_count > 0) {
- elm_box_pack_end(ug_data->main_box, ug_data->gl_addrs);
- evas_object_show(ug_data->gl_addrs);
- elm_object_item_disabled_set(ug_data->c_item[0], EINA_FALSE);
- } else {
- eb_create_noc(ug_data);
- elm_object_part_text_set(ug_data->noc, "elm.text", _("IDS_EMAIL_BODY_NO_ADDRESS"));
- elm_box_pack_end(ug_data->main_box, ug_data->noc_ly);
- evas_object_show(ug_data->noc_ly);
- elm_object_item_disabled_set(ug_data->c_item[0], EINA_TRUE);
- }
- }
- }
-}
-
-static void _popup_block_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- EmailBlockAppData *ugd = (EmailBlockAppData *)data;
-
- if (ugd->popup_empty) {
- evas_object_del(ugd->popup_empty);
- ugd->popup_empty = NULL;
- }
-
- if (ugd->timeout_popup) {
- evas_object_del(ugd->timeout_popup);
- ugd->timeout_popup = NULL;
- }
-}
-
-static char *_eb_gl_label_get(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
- ListItemData *item_data = (ListItemData *) data;
-
- email_rule_t *rule = NULL;
- char buf[256];
- memset(buf, 0x00, 256);
-
- rule = item_data->rule;
- snprintf(buf, sizeof(buf), "%s", rule->value);
-
- return strdup(buf);
-}
-
-static Evas_Object *_eb_gl_icon_get(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
- ListItemData *item_data = (ListItemData *) data;
- Evas_Object *button;
- Evas_Object *check;
-
- if (elm_genlist_decorate_mode_get(obj)) {
- if (!strcmp(part, "elm.edit.icon.1")) {
- check = elm_check_add(obj);
- elm_check_state_pointer_set(check, &item_data->checked);
- evas_object_smart_callback_add(check, "changed", _edit_item_check_changed_cb, item_data);
- return check;
- }
- } else {
- if (0 == strcmp(part, "elm.slide.swallow.1")) {
- button = elm_button_add(obj);
- elm_object_style_set(button, "text_only/sweep");
- elm_object_text_set(button, dgettext("sys_string", "IDS_COM_SK_EDIT"));
- evas_object_smart_callback_add(button, "clicked", _eb_sweep_edit_clicked_cb, (void *)data);
- return button;
- } else if (0 == strcmp(part, "elm.slide.swallow.2")) {
- button = elm_button_add(obj);
- elm_object_style_set(button, "text_only/sweep");
- elm_object_text_set(button, dgettext("sys_string", "IDS_COM_SK_DELETE"));
- evas_object_smart_callback_add(button, "clicked", _eb_sweep_delete_clicked_cb, (void *)data);
- return button;
- }
- }
-
- return NULL;
-}
-
-static Evas_Object *_eb_gl_add_ef_icon_get(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
-
- EmailBlockAppData *ug_data = _g_eb_ug_data;
- email_rule_t *rule = (email_rule_t *) data;
-
- if (!strcmp(part, "elm.icon")) {
- ug_data->ef_filter_name = elm_layout_add(obj);
- elm_layout_theme_set(ug_data->ef_filter_name, "layout", "editfield", "title");
- ug_data->entry_filter_name = elm_entry_add(obj);
- elm_entry_scrollable_set(ug_data->entry_filter_name, EINA_TRUE);
- elm_entry_single_line_set(ug_data->entry_filter_name, TRUE);
- elm_entry_cnp_mode_set(ug_data->entry_filter_name, ELM_CNP_MODE_PLAINTEXT);
- if (ug_data->block_type == TYPE_BLOCK_ADDRESS) {
- elm_entry_input_panel_layout_set(ug_data->entry_filter_name, ELM_INPUT_PANEL_LAYOUT_EMAIL);
- } else if (ug_data->block_type == TYPE_BLOCK_SUBJECT) {
- elm_entry_input_panel_layout_set(ug_data->entry_filter_name, ELM_INPUT_PANEL_LAYOUT_NORMAL);
- }
- evas_object_smart_callback_add(ug_data->entry_filter_name, "preedit,changed", _cb_backup_input, ug_data->ef_filter_name);
- evas_object_smart_callback_add(ug_data->entry_filter_name, "changed", _cb_backup_input, ug_data->ef_filter_name);
- evas_object_smart_callback_add(ug_data->entry_filter_name, "focused", _cb_entry_focused, ug_data->ef_filter_name);
- evas_object_smart_callback_add(ug_data->entry_filter_name, "unfocused", _cb_entry_unfocused, ug_data->ef_filter_name);
- evas_object_show(ug_data->entry_filter_name);
-
- elm_object_part_content_set(ug_data->ef_filter_name, "elm.swallow.content", ug_data->entry_filter_name);
- if (ug_data->block_type == TYPE_BLOCK_ADDRESS) {
- elm_object_part_text_set(ug_data->ef_filter_name, "elm.text", _("IDS_EMAIL_BODY_ADDRESS"));
- } else if (ug_data->block_type == TYPE_BLOCK_SUBJECT) {
- elm_object_part_text_set(ug_data->ef_filter_name, "elm.text", dgettext("sys_string", "IDS_COM_BODY_SUBJECT"));
- }
- elm_object_signal_callback_add(ug_data->ef_filter_name, "elm,eraser,clicked", "elm", _cb_eraser_clicked, ug_data->entry_filter_name);
-
- evas_object_size_hint_weight_set(ug_data->ef_filter_name, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(ug_data->ef_filter_name);
-
- if (ug_data->str_filter_name)
- elm_entry_entry_set(ug_data->entry_filter_name, ug_data->str_filter_name);
-
- if (rule) {
- elm_entry_entry_set(ug_data->entry_filter_name, rule->value);
- if (ug_data->block_type == TYPE_BLOCK_ADDRESS) {
- block_addr = realloc(block_addr, strlen(rule->value) + 1);
- sprintf(block_addr, "%s", rule->value);
- }
-
- ug_data->edit_filter_id = rule->filter_id;
- }
-
- if (ug_data->view_type == VIEW_BLOCK_FILTER_DATA_SET) {
- evas_object_show(ug_data->entry_filter_name);
- elm_object_focus_set(ug_data->entry_filter_name, EINA_TRUE);
- }
-
- return ug_data->ef_filter_name;
- } else if (!strcmp(part, "elm.icon2")) {
- char buf[MAX_STR_LEN] = { 0, };
- Evas_Object *btn = elm_button_add(obj);
- Evas_Object *ic = elm_icon_add(obj);
- snprintf(buf, sizeof(buf), "%s/M02_function_ccbcc.png", IMGDIR);
- elm_icon_file_set(ic, buf, NULL);
- elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
- evas_object_show(ic);
- elm_object_style_set(btn, "circle/empty");
- evas_object_show(btn);
- elm_object_part_content_set(btn, "icon", ic);
- evas_object_smart_callback_add(btn, "clicked", _contact_button_cb, ug_data);
- return btn;
- }
-
- return NULL;
-}
-
-/*static Evas_Object *_eb_gl_add_btn_icon_get(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
-
- EmailBlockAppData *ug_data = _g_eb_ug_data;
-
- if (!strcmp(part, "elm.icon.1")) {
- ug_data->recent_btn = elm_button_add(obj);
- elm_object_text_set(ug_data->recent_btn, dgettext("sys_string", "IDS_COM_BUTTON_RECENT"));
- evas_object_show(ug_data->recent_btn);
- evas_object_smart_callback_add(ug_data->recent_btn, "clicked", _recent_button_cb, ug_data);
- return ug_data->recent_btn;
- } else if (!strcmp(part, "elm.icon.2")) {
- ug_data->contact_btn = elm_button_add(obj);
- elm_object_text_set(ug_data->contact_btn, dgettext("sys_string", "IDS_COM_BODY_CONTACTS"));
- evas_object_smart_callback_add(ug_data->contact_btn, "clicked", _contact_button_cb, ug_data);
- evas_object_show(ug_data->contact_btn);
- return ug_data->contact_btn;
- }
-
- return NULL;
-}*/
-
-static void _eb_sweep_edit_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- ListItemData *item_data = (ListItemData *) data;
- email_rule_t *rule = item_data->rule;
-
- EmailBlockAppData *ug_data = _g_eb_ug_data;
- ug_data->mode = BLOCK_MODE_EDIT;
- eb_create_add_filter_view(ug_data, rule);
-}
-
-static void _eb_sweep_delete_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- ListItemData *item_data = (ListItemData *) data;
- email_rule_t *rule = item_data->rule;
-
- EmailBlockAppData *ug_data = _g_eb_ug_data;
-
- if (EMAIL_ERROR_NONE != email_delete_rule(rule->filter_id)) {
- debug_critical("email_delete_rule fails");
- }
-
- _changed_filter_type_cb(ug_data, ug_data->segment, NULL);
-}
-
-static void _eb_gl_sel_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- Elm_Object_Item *item = (Elm_Object_Item *)event_info;
- elm_genlist_item_selected_set(item, EINA_FALSE);
- EmailBlockAppData *ug_data = _g_eb_ug_data;
- ListItemData *item_data = (ListItemData *) data;
-
- if (elm_genlist_decorate_mode_get(item_data->genlist)) {
- item_data->checked = !item_data->checked;
-
- if (item_data->checked)
- ug_data->edit_checked_count++;
- else
- ug_data->edit_checked_count--;
-
- if (ug_data->select_all_layout) {
- if (ug_data->edit_total_count == ug_data->edit_checked_count)
- ug_data->select_all_checked = EINA_TRUE;
- else
- ug_data->select_all_checked = EINA_FALSE;
-
- elm_check_state_pointer_set(ug_data->select_all_checkbox, &ug_data->select_all_checked);
- }
-
- elm_genlist_item_update(item_data->it);
- _del_button_state_set(ug_data);
- _show_selection_info(ug_data);
-
- } else {
- email_rule_t *rule = NULL;
- ug_data->selected_item = elm_genlist_selected_item_get(obj);
- ug_data->mode = BLOCK_MODE_EDIT;
-
- if (item_data) {
- rule = item_data->rule;
- }
- eb_create_add_filter_view(ug_data, rule);
- elm_genlist_item_selected_set(ug_data->selected_item, EINA_FALSE);
- }
-}
-
-static void _eb_gl_del(void *data, Evas_Object *obj)
-{
- debug_log("");
- ListItemData *item_data = (ListItemData *) data;
-
- if (item_data)
- g_free(item_data);
-}
-
-static void _cb_backup_input(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- EmailBlockAppData *ug_data = _g_eb_ug_data;
- Evas_Object *eo = (Evas_Object *)obj;
-
- if (elm_object_focus_get(data)) {
- if (elm_entry_is_empty(obj))
- elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
- else
- elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
- }
-
- if (eo == ug_data->entry_filter_name) {
- if (ug_data->str_filter_name) {
- g_free(ug_data->str_filter_name);
- ug_data->str_filter_name = NULL;
- }
-
- ug_data->str_filter_name = g_strdup(elm_entry_entry_get(eo));
-
- if (!g_strcmp0(ug_data->str_filter_name, "")) {
- elm_object_disabled_set(ug_data->r_button2, EINA_TRUE);
- } else {
- elm_object_disabled_set(ug_data->r_button2, EINA_FALSE);
- }
- }
-}
-
-static void _cb_entry_focused(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
-
- if (!data || !obj) {
- debug_log("data is NULL");
- return;
- }
-
- if (!elm_entry_is_empty(obj))
- elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
- elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm");
-}
-
-static void _cb_entry_unfocused(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
-
- if (!data || !obj) {
- debug_log("data is NULL");
- return;
- }
-
- if (elm_entry_is_empty(obj))
- elm_object_signal_emit(data, "elm,state,guidetext,show", "elm");
- elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
-}
-
-static void _cb_eraser_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
-{
- debug_log("");
-
- if (!data || !obj) {
- debug_log("data is NULL");
- return;
- }
-
- elm_entry_entry_set(data, "");
-}
-
-static void _edit_item_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- ListItemData *item_data = (ListItemData *) data;
- EmailBlockAppData *ug_data = _g_eb_ug_data;
-
- if (item_data->checked)
- ug_data->edit_checked_count++;
- else
- ug_data->edit_checked_count--;
-
- /* update select all check button */
- if (ug_data->select_all_layout) {
- if (ug_data->edit_total_count == ug_data->edit_checked_count)
- ug_data->select_all_checked = EINA_TRUE;
- else
- ug_data->select_all_checked = EINA_FALSE;
-
- elm_check_state_pointer_set(ug_data->select_all_checkbox, &ug_data->select_all_checked);
- }
- _del_button_state_set(ug_data);
- _show_selection_info(ug_data);
-}
-
-static void _del_button_state_set(EmailBlockAppData *ug_data)
-{
- if (ug_data->edit_checked_count > 0)
- elm_object_item_disabled_set(ug_data->c_item[2], EINA_FALSE);
- else
- elm_object_item_disabled_set(ug_data->c_item[2], EINA_TRUE);
-}
-
-static void _show_selection_info(EmailBlockAppData *ugd)
-{
- if (!ugd->edit_select_info) {
- ugd->edit_select_info = elm_notify_add(ugd->layout_main);
- elm_notify_orient_set(ugd->edit_select_info, ELM_NOTIFY_ORIENT_BOTTOM);
- ugd->edit_select_info_ly = elm_layout_add(ugd->layout_main);
- elm_layout_theme_set(ugd->edit_select_info_ly, "standard", "selectioninfo", "vertical/bottom_64");
- elm_object_content_set(ugd->edit_select_info, ugd->edit_select_info_ly);
- }
- if (ugd->edit_checked_count == 0)
- evas_object_hide(ugd->edit_select_info);
- else {
- char text[128] = { '0', };
- if (ugd->block_type == TYPE_BLOCK_ADDRESS) {
- if (ugd->edit_checked_count == 1)
- snprintf(text, 127, "%s (%d)", dgettext("sys_string", "IDS_COM_POP_SELECTED"), ugd->edit_checked_count);
- else
- snprintf(text, 127, "%s (%d)", dgettext("sys_string", "IDS_COM_POP_SELECTED"), ugd->edit_checked_count);
- } else {
- if (ugd->edit_checked_count == 1)
- snprintf(text, 127, "%s (%d)", dgettext("sys_string", "IDS_COM_POP_SELECTED"), ugd->edit_checked_count);
- else
- snprintf(text, 127, "%s (%d)", dgettext("sys_string", "IDS_COM_POP_SELECTED"), ugd->edit_checked_count);
- }
- edje_object_part_text_set(_EDJ(ugd->edit_select_info_ly), "elm.text", text);
- /*elm_notify_timeout_set(select_info, 1);*/
- evas_object_show(ugd->edit_select_info);
- }
-}
-
-static void _block_recent_create_view(void *data)
-{
- debug_log("");
-
- EmailBlockAppData *ugd = (EmailBlockAppData *)data;
-
- Evas_Object *recent_layout;
- Evas_Object *l_button;
- Evas_Object *cbar;
-
- _block_recent_init(ugd);
-
- ugd->view_type = VIEW_BLOCK_RECENT_ADD;
-
- _block_recent_set_genlist_item_style(ugd);
-
- ugd->recent_genlist = _block_recent_create_genlist_top_half(ugd);
-
- if (ugd->total_count > 0)
- evas_object_data_set(ugd->recent_genlist, "view_data", ugd);
-
- l_button = elm_button_add(ugd->navi_bar);
- evas_object_smart_callback_add(l_button, "clicked", _block_recent_back_cb, ugd);
- elm_object_style_set(l_button, "naviframe/back_btn/default");
- ugd->recent_lbutton = l_button;
-
- Elm_Object_Item *navi_it = NULL;
-
- if (ugd->total_count > 0) {
- recent_layout = _block_recent_create_layout(ugd);
- _block_recent_set_editmode(ugd);
-
- navi_it = elm_naviframe_item_push(ugd->navi_bar, _("IDS_EMAIL_HEADER_RECENT_T_HEADER"), l_button, NULL, recent_layout, NULL);
-
- cbar = elm_toolbar_add(ugd->navi_bar);
- elm_toolbar_shrink_mode_set(cbar, ELM_TOOLBAR_SHRINK_EXPAND);
- elm_object_style_set(cbar, "naviframe");
- evas_object_show(cbar);
-
- elm_object_item_disabled_set(elm_toolbar_item_append(cbar, NULL, "", NULL, NULL), EINA_TRUE);
- ugd->c_item[3] = elm_toolbar_item_append(cbar, NULL,
- dgettext("sys_string", "IDS_COM_SK_DONE"), _block_recent_done_cb, ugd);
-
- elm_object_item_part_content_set(navi_it, "controlbar", cbar);
- elm_object_item_disabled_set(ugd->c_item[3], EINA_TRUE);
-
- evas_object_show(recent_layout);
- evas_object_show(ugd->recent_genlist);
-
- Evas_Object *waiting_popup = elm_popup_add(ugd->win_main);
- evas_object_size_hint_weight_set(waiting_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_text_set(waiting_popup, _("IDS_EMAIL_POP_RETRIEVING_ADDRESS_LIST_ING"));
- elm_object_part_text_set(waiting_popup, "title,text", _("IDS_EMAIL_HEADER_RECENT_T_HEADER"));
- evas_object_smart_callback_add(waiting_popup, "block,clicked", _popup_block_clicked_cb, ugd);
- evas_object_show(waiting_popup);
- ugd->waiting_popup = waiting_popup;
-
- elm_object_disabled_set(l_button, EINA_TRUE);
- ugd->recent_timer = ecore_timer_add(0.5, _block_recent_create_genlist_bottom_half, ugd);
-
- } else {
- ugd->no_content = _block_recent_create_no_content_view(ugd->navi_bar, ugd);
- navi_it = elm_naviframe_item_push(ugd->navi_bar, _("IDS_EMAIL_HEADER_RECENT_T_HEADER"), l_button, NULL, ugd->no_content, NULL);
- evas_object_show(ugd->no_content);
- }
-}
-
-static void _block_recent_init(EmailBlockAppData *ugd)
-{
- elm_object_content_unset(ugd->recent_box);
-
- elm_box_unpack(ugd->recent_box,ugd->block_select_all_layout);
- elm_box_unpack(ugd->recent_box,ugd->recent_genlist);
-
- if (ugd->recent_genlist!= NULL) {
- elm_genlist_clear(ugd->recent_genlist);
- evas_object_del(ugd->recent_genlist);
- ugd->recent_genlist = NULL;
- }
- if (ugd->block_select_all_layout != NULL) {
- debug_log("delete layout");
- evas_object_del(ugd->block_select_all_layout);
- ugd->block_select_all_layout = NULL;
- }
- if (ugd->no_content != NULL) {
- evas_object_del(ugd->no_content);
- ugd->no_content = NULL;
- }
- if (ugd->recent_box!= NULL) {
- evas_object_del(ugd->recent_box);
- ugd->recent_box = NULL;
- }
-
- edje_object_signal_emit(_EDJ(ugd->layout_main), "elm,bg,show,default", "elm");
-}
-
-static void _block_recent_set_editmode(void *data)
-{
- debug_log("");
-
- EmailBlockAppData *ugd = (EmailBlockAppData *)data;
-
- Evas_Object *genlist = ugd->recent_genlist;
- Evas_Object *layout, *check;
-
- if (!elm_genlist_decorate_mode_get(genlist)) {
- edje_object_signal_emit(_EDJ(ugd->layout_main), "elm,bg,show,edit_mode", "elm");
-
- layout = ugd->block_select_all_layout = elm_layout_add(ugd->recent_box);
- elm_layout_theme_set(layout, "genlist", "item", "select_all/default");
- evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
- evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_event_callback_add(layout, EVAS_CALLBACK_MOUSE_DOWN, _block_recent_select_all_layout_mouse_down_cb, ugd);
-
- check = ugd->select_all_checkbox = elm_check_add(ugd->block_select_all_layout);
- elm_check_state_pointer_set(check, &ugd->block_recent_select_all_checked);
- evas_object_smart_callback_add(check, "changed", _block_recent_select_all_check_changed_cb, ugd);
- evas_object_propagate_events_set(check, EINA_FALSE);
- elm_object_part_content_set(layout, "elm.icon", check);
-
- elm_object_part_text_set(ugd->block_select_all_layout, "elm.text", dgettext("sys_string", "IDS_COM_BODY_SELECT_ALL"));
- elm_box_pack_start(ugd->recent_box, ugd->block_select_all_layout);
- evas_object_show(ugd->block_select_all_layout);
-
- elm_genlist_reorder_mode_set(genlist, EINA_FALSE);
- elm_genlist_decorate_mode_set(genlist, EINA_TRUE);
- elm_genlist_select_mode_set(genlist, ELM_OBJECT_SELECT_MODE_ALWAYS);
- }
-}
-
-static void _block_recent_select_all_layout_mouse_down_cb(void *data, Evas * evas, Evas_Object *obj, void *event_info)
-{
- EmailBlockAppData *ugd = (EmailBlockAppData *)data;
-
- ugd->block_recent_select_all_checked = !ugd->block_recent_select_all_checked;
- elm_check_state_pointer_set(ugd->select_all_checkbox, &ugd->block_recent_select_all_checked);
-
- _block_recent_check_select_all(ugd);
-
- if (ugd->checked_count > 0)
- elm_object_item_disabled_set(ugd->c_item[3], EINA_FALSE);
- else
- elm_object_item_disabled_set(ugd->c_item[3], EINA_TRUE);
-}
-
-static void _block_recent_select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
-{
- EmailBlockAppData *ugd = (EmailBlockAppData *)data;
-
- _block_recent_check_select_all(data);
-
- if (ugd->checked_count > 0)
- elm_object_item_disabled_set(ugd->c_item[3], EINA_FALSE);
- else
- elm_object_item_disabled_set(ugd->c_item[3], EINA_TRUE);
-}
-
-static void _block_recent_check_select_all(EmailBlockAppData *ugd)
-{
- debug_log("");
- Item_Data *it_data;
- Elm_Object_Item *it;
-
- if (ugd->block_recent_select_all_checked)
- ugd->checked_count = ugd->total_count;
- else
- ugd->checked_count = 0;
-
- it = elm_genlist_first_item_get(ugd->recent_genlist);
- while (it) {
- it_data = elm_object_item_data_get(it);
- if (it_data)
- it_data->checked = ugd->block_recent_select_all_checked;
- it = elm_genlist_item_next_get(it);
- }
- elm_genlist_realized_items_update(ugd->recent_genlist);
-
- _block_recent_show_selection_info(ugd);
-}
-
-static Evas_Object *_block_recent_create_genlist_top_half(void *data)
-{
- debug_log("");
-
- EmailBlockAppData *ugd = (EmailBlockAppData *)data;
-
- int mail_cnt = 0;
- int err;
-
- Evas_Object *recent_list = NULL;
- recent_list = elm_genlist_add(ugd->navi_bar);
-
- elm_genlist_homogeneous_set(recent_list, EINA_TRUE);
- elm_genlist_tree_effect_enabled_set(recent_list, EINA_TRUE);
- evas_object_size_hint_weight_set(recent_list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(recent_list, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- email_mail_list_item_t *mail_data = NULL;
- email_mailbox_t *mail_box = NULL;
-
- err = email_get_mailbox_by_mailbox_type(ugd->account_id, EMAIL_MAILBOX_TYPE_INBOX, &mail_box);
-
- if (err != EMAIL_ERROR_NONE || mail_box == NULL) {
- debug_log("[FAILED] email_get_mailbox_by_mailbox_type:%d", err);
- goto FINISH_OFF;
- }
-
- debug_log("mailbox_id = %d", mail_box->mailbox_id);
-
- err = email_get_mail_list(ugd->account_id,
- mail_box->mailbox_id, EMAIL_LIST_TYPE_NORMAL, -1,
- 10,
- EMAIL_SORT_DATETIME_HIGH, &mail_data, &mail_cnt);
-
- if (mail_box) {
- email_free_mailbox(&mail_box, 1);
- mail_box = NULL;
- }
-
- if (err < 0 || mail_cnt < 0) {
- debug_log("Get mail address list failed : [%d]", err);
- goto FINISH_OFF;
- }
-
- ugd->recent_mail_data = mail_data;
-
-FINISH_OFF:
- ugd->total_count = mail_cnt;
- return recent_list;
-}
-
-static Eina_Bool _block_recent_create_genlist_bottom_half(void *data)
-{
- debug_log("");
-
- EmailBlockAppData *ugd = (EmailBlockAppData *)data;
-
- int index;
- int total_cnt = 0;
-
- Evas_Object *recent_list = ugd->recent_genlist;
- Item_Data *item_data = NULL;
-
- email_address_info_list_t *addrs_info_list = NULL;
- email_mail_list_item_t *mail_data = ugd->recent_mail_data;
-
- if (!mail_data) {
- debug_log("mail_data is NULL");
- goto FINISH_OFF;
- }
-
- if (ugd->total_count > MAX_RECENT_MAIL_TO_RETRIEVE)
- ugd->total_count = MAX_RECENT_MAIL_TO_RETRIEVE;
-
- for (index = 0; index < ugd->total_count; index++, mail_data++) {
-
- if (mail_data->mail_id <= 0) {
- debug_log("Invalid mail ID");
- goto FINISH_OFF;
- }
-
- email_get_address_info_list(mail_data->mail_id, &addrs_info_list);
-
- if (!addrs_info_list || !(addrs_info_list->from)) {
- debug_log("address info is NULL");
- goto FINISH_OFF;
- }
-
- int n_to_list = g_list_length(addrs_info_list->from);
- int i = 0;
-
- for (i = 0; i < n_to_list; i++) {
- email_address_info_t *addrs_info = NULL;
-
- addrs_info = (email_address_info_t *) g_list_nth_data(addrs_info_list->from, i);
-
- if (addrs_info && addrs_info->address) {
- if (total_cnt == MAX_RECENT_CNT)
- break;
-
- item_data = calloc(1, sizeof(Item_Data));
- item_data->address = g_strdup(addrs_info->address);
- if (!_block_recent_check_addr_is_duplicated(addrs_info->address, recent_list)) {
- item_data->it = elm_genlist_item_append(recent_list,
- &itc,
- item_data,
- NULL, ELM_GENLIST_ITEM_NONE, _block_recent_gl_sel, item_data);
-
- total_cnt++;
- }
- }
- }
- }
-
- if (addrs_info_list) {
- email_free_address_info_list(&addrs_info_list);
- addrs_info_list = NULL;
- }
-
-FINISH_OFF:
-
- if (ugd->waiting_popup) {
- evas_object_del(ugd->waiting_popup);
- ugd->waiting_popup = NULL;
- }
-
- if (ugd->recent_mail_data) {
- g_free(ugd->recent_mail_data);
- ugd->recent_mail_data = NULL;
- }
-
- elm_object_disabled_set(ugd->recent_lbutton, EINA_FALSE);
- ugd->total_count = total_cnt;
- return EINA_FALSE;
-}
-
-static Evas_Object *_block_recent_create_layout(EmailBlockAppData *ugd)
-{
- Evas_Object *genlist = ugd->recent_genlist;
- Evas_Object *box, *conform;
-
- elm_win_conformant_set(ugd->win_main, EINA_TRUE);
-
- conform = elm_conformant_add(ugd->navi_bar);
- elm_object_style_set(conform, "internal_layout");
- evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(conform);
-
- box = elm_box_add(ugd->navi_bar);
- ugd->recent_box = box;
- evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(box);
-
- evas_object_show(genlist);
- elm_box_pack_end(box, genlist);
-
- elm_object_content_set(conform, box);
-
- return conform;
-}
-
-static void _block_recent_set_genlist_item_style(EmailBlockAppData *ugd)
-{
- itc.item_style = "1text";
- itc.func.text_get = _block_recent_gl_label_get;
- itc.func.content_get = _block_recent_gl_icon_get;
- itc.func.state_get = NULL;
- itc.func.del = NULL;
- itc.decorate_all_item_style = "edit_default";
-}
-
-static void _block_recent_gl_sel(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- Elm_Object_Item *item = (Elm_Object_Item *)event_info;
- elm_genlist_item_selected_set(item, EINA_FALSE);
-
- Item_Data *item_data = (Item_Data *) data;
- EmailBlockAppData *ugd = (EmailBlockAppData *)evas_object_data_get(obj, "view_data");
-
- if (elm_genlist_decorate_mode_get(ugd->recent_genlist)) {
- item_data->checked = !item_data->checked;
-
- if (item_data->checked)
- ugd->checked_count++;
- else
- ugd->checked_count--;
-
- if (ugd->block_select_all_layout) {
- if (ugd->total_count == ugd->checked_count)
- ugd->block_recent_select_all_checked = EINA_TRUE;
- else
- ugd->block_recent_select_all_checked = EINA_FALSE;
-
- elm_check_state_pointer_set(ugd->select_all_checkbox, &ugd->block_recent_select_all_checked);
- }
-
- elm_genlist_item_update(item_data->it);
-
- if (ugd->checked_count > 0)
- elm_object_item_disabled_set(ugd->c_item[3], EINA_FALSE);
- else
- elm_object_item_disabled_set(ugd->c_item[3], EINA_TRUE);
-
- _block_recent_show_selection_info(ugd);
- }
-}
-
-static char *_block_recent_gl_label_get(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
-
- Item_Data *item_data = (Item_Data *) data;
- if (!item_data)
- return NULL;
-
- debug_log("addr = %s", item_data->address);
-
- if (!g_strcmp0(part, "elm.text"))
- return strdup(item_data->address);
-
- return NULL;
-}
-
-static Evas_Object *_block_recent_gl_icon_get(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
- Evas_Object *check = NULL;
- Item_Data *item_data = (Item_Data *) data;
-
- if (elm_genlist_decorate_mode_get(obj)) {
- if (!strcmp(part, "elm.edit.icon.1")) {
- check = elm_check_add(obj);
- elm_check_state_pointer_set(check, &item_data->checked);
- evas_object_smart_callback_add(check, "changed", _block_recent_item_check_changed_cb, item_data);
- return check;
- }
- }
-
- return NULL;
-}
-
-static void _block_recent_item_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- Item_Data *item_data = (Item_Data *) data;
- EmailBlockAppData *ugd = (EmailBlockAppData *)evas_object_data_get(elm_object_item_widget_get(item_data->it), "view_data");
-
- if (item_data->checked)
- ugd->checked_count++;
- else
- ugd->checked_count--;
-
- if (ugd->block_select_all_layout) {
- if (ugd->total_count == ugd->checked_count)
- ugd->block_recent_select_all_checked = EINA_TRUE;
- else
- ugd->block_recent_select_all_checked = EINA_FALSE;
-
- elm_check_state_pointer_set(ugd->select_all_checkbox, &ugd->block_recent_select_all_checked);
- }
-
- if (ugd->checked_count > 0)
- elm_object_item_disabled_set(ugd->c_item[3], EINA_FALSE);
- else
- elm_object_item_disabled_set(ugd->c_item[3], EINA_TRUE);
-
- _block_recent_show_selection_info(ugd);
-}
-
-static bool _block_recent_check_addr_is_duplicated(const char *addr, Evas_Object *recent_list)
-{
- debug_log("");
-
- Elm_Object_Item *item;
- Item_Data *it_data;
-
- debug_log("addr = %s", addr);
-
- item = elm_genlist_first_item_get(recent_list);
-
- while (item) {
- it_data = (Item_Data *) elm_object_item_data_get(item);
-
- debug_log("str = %s", it_data->address);
-
- if (g_strcmp0(addr, it_data->address) == 0)
- return true;
-
- item = elm_genlist_item_next_get(item);
- }
-
- return false;
-}
-
-static void _block_recent_back_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
-
- EmailBlockAppData *ugd = (EmailBlockAppData *)data;
-
- if (ugd->view_type != VIEW_BLOCK_RECENT_ADD) {
- debug_log("**double clicked**");
- return;
- }
-
- elm_object_disabled_set(ugd->recent_lbutton, EINA_TRUE);
- elm_object_item_disabled_set(ugd->c_item[3], EINA_TRUE);
-
- if (ugd->recent_select_info) {
- evas_object_del(ugd->recent_select_info);
- ugd->recent_select_info = NULL;
- }
-
- ugd->block_recent_select_all_checked = EINA_FALSE;
-
- ugd->checked_count = 0;
-
- ugd->view_type = VIEW_BLOCK_FILTER_DATA_SET;
-
- /*elm_object_signal_emit(ugd->ef_filter_name, "clicked", "elm");*/
- evas_object_show(ugd->entry_filter_name);
- elm_object_focus_set(ugd->entry_filter_name, EINA_TRUE);
-
- elm_naviframe_item_pop(ugd->navi_bar);
-}
-
-static void _block_recent_done_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- EmailBlockAppData *ugd = (EmailBlockAppData *)data;
-
- char *result_address = NULL;
- char *result_address_ = NULL;
-
- elm_object_disabled_set(ugd->recent_lbutton, EINA_TRUE);
- elm_object_item_disabled_set(ugd->c_item[3], EINA_TRUE);
-
- if (ugd->recent_select_info) {
- evas_object_del(ugd->recent_select_info);
- ugd->recent_select_info = NULL;
- }
-
- Item_Data *item_data;
- Elm_Object_Item *it;
-
- it = elm_genlist_first_item_get(ugd->recent_genlist);
-
- while (it) {
- item_data = elm_object_item_data_get(it);
- it = elm_genlist_item_next_get(it);
-
- if ((item_data) && (item_data->checked)) {
- char *email_addr = item_data->address;
- if (email_addr) {
- if (result_address)
- result_address_ = g_strconcat(result_address, ";", email_addr, NULL);
- else
- result_address_ = g_strdup(email_addr);
-
- if (result_address)
- g_free(result_address);
-
- result_address = result_address_;
- }
- }
- debug_log("result address : [%s]", result_address);
- }
-
- if (!block_addr) {
- block_addr = g_strdup(result_address);
- debug_log("Null block_addr = %s", block_addr);
- elm_entry_entry_set(ugd->entry_filter_name, block_addr);
- ugd->str_filter_name = g_strdup(block_addr);
- } else {
- char *addr_tmp = block_addr;
- block_addr = g_strconcat(block_addr, ";", result_address, NULL);
- debug_log("Not Null block_addr = %s", block_addr);
- elm_entry_entry_set(ugd->entry_filter_name, block_addr);
- g_free(addr_tmp);
- ugd->str_filter_name = g_strdup(block_addr);
- }
-
- ugd->block_recent_select_all_checked = EINA_FALSE;
-
- ugd->checked_count = 0;
-
- ugd->view_type = VIEW_BLOCK_FILTER_DATA_SET;
-
- g_free(result_address);
-
- elm_genlist_decorate_mode_set(ugd->recent_genlist, EINA_FALSE);
- elm_genlist_select_mode_set(ugd->recent_genlist, ELM_OBJECT_SELECT_MODE_DEFAULT);
-
- /*elm_object_signal_emit(ugd->ef_filter_name, "clicked", "elm");*/
- evas_object_show(ugd->entry_filter_name);
- elm_object_focus_set(ugd->entry_filter_name, EINA_TRUE);
-
- elm_naviframe_item_pop(ugd->navi_bar);
-}
-
-static Evas_Object *_block_recent_create_no_content_view(Evas_Object *parent, void *data)
-{
- debug_log("");
-
- Evas_Object *no_content = elm_layout_add(parent);
- elm_layout_theme_set(no_content, "layout", "nocontents", "full");
- elm_object_part_text_set(no_content, "elm.text", dgettext("sys_string", "IDS_COM_BODY_NO_CONTENTS"));
-
- evas_object_show(no_content);
-
- return no_content;
-}
-
-static void _block_recent_show_selection_info(EmailBlockAppData *ugd)
-{
- if (!ugd->recent_select_info) {
- ugd->recent_select_info = elm_notify_add(ugd->layout_main);
- elm_notify_orient_set(ugd->recent_select_info, ELM_NOTIFY_ORIENT_BOTTOM);
- ugd->recent_select_info_ly = elm_layout_add(ugd->layout_main);
- elm_layout_theme_set(ugd->recent_select_info_ly, "standard", "selectioninfo", "vertical/bottom_64");
- elm_object_content_set(ugd->recent_select_info, ugd->recent_select_info_ly);
- }
-
- if (ugd->checked_count == 0)
- evas_object_hide(ugd->recent_select_info);
- else {
- char text[128] = { '0', };
- if (ugd->checked_count == 1)
- snprintf(text, 127, "%s (%d)", dgettext("sys_string", "IDS_COM_POP_SELECTED"), ugd->checked_count);
- else
- snprintf(text, 127, "%s (%d)", dgettext("sys_string", "IDS_COM_POP_SELECTED"), ugd->checked_count);
- edje_object_part_text_set(_EDJ(ugd->recent_select_info_ly), "elm.text", text);
- /*elm_notify_timeout_set(select_info, 1);*/
- evas_object_show(ugd->recent_select_info);
- }
-}
-
-/* EOF */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define GENLIST_HEIGHT_1_INC 1
-#define GENLIST_HEIGHT_16_INC 16
-#define GENLIST_HEIGHT_33_INC 33
-#define GENLIST_HEIGHT_49_INC 49
-#define GENLIST_HEIGHT_62_INC 62
-#define GENLIST_HEIGHT_65_INC 65
-#define GENLIST_HEIGHT_73_INC 73
-#define GENLIST_HEIGHT_77_INC 77
-#define GENLIST_HEIGHT_89_INC 89
-#define GENLIST_HEIGHT_93_INC 93
-#define GENLIST_HEIGHT_97_INC 97
-#define GENLIST_HEIGHT_129_INC 129
-#define GENLIST_HEIGHT_161_INC 161
-#define GENLIST_HEIGHT_163_INC 163
-#define GENLIST_HEIGHT_164_INC 164
-#define GENLIST_HEIGHT_165_INC 165
-#define GENLIST_HEIGHT_177_INC 177
-#define GENLIST_HEIGHT_182_INC 182
-#define GENLIST_HEIGHT_190_INC 190
-#define GENLIST_HEIGHT_207_INC 207
-#define GENLIST_HEIGHT_260_INC 260
-#define GENLIST_HEIGHT_291_INC 291
-#define GENLIST_HEIGHT_454_INC 454
-#define GENLIST_HEIGHT_566_INC 566
-
-#define GENLIST_PADDING_4_INC 4
-#define GENLIST_PADDING_5_INC 5
-#define GENLIST_PADDING_6_INC 6
-#define GENLIST_PADDING_8_INC 8
-#define GENLIST_PADDING_10_INC 10
-#define GENLIST_PADDING_11_INC 11
-#define GENLIST_PADDING_12_INC 12
-#define GENLIST_PADDING_13_INC 13
-#define GENLIST_PADDING_14_INC 14
-#define GENLIST_PADDING_16_INC 16
-#define GENLIST_PADDING_18_INC 18
-#define GENLIST_PADDING_21_INC 21
-#define GENLIST_PADDING_22_INC 22
-#define GENLIST_PADDING_24_INC 24
-#define GENLIST_PADDING_27_INC 27
-#define GENLIST_PADDING_32_INC 32
-#define GENLIST_PADDING_34_INC 34
-#define GENLIST_PADDING_46_INC 46
-#define GENLIST_PADDING_48_INC 48
-#define GENLIST_PADDING_64_INC 64
-#define GENLIST_PADDING_74_INC 74
-#define GENLIST_PADDING_88_INC 88
-#define GENLIST_PADDING_124_INC 124
-
-#define GENLIST_TEXT_SIZE_LIST_MAIN_TEXT 44
-#define GENLIST_TEXT_SIZE_LIST_BUBBLE_TEXT 32
-#define GENLIST_TEXT_SIZE_NAME_TEXT 32
-#define GENLIST_TEXT_SIZE_LIST_MESSAGE_TEXT 32
-#define GENLIST_FONT_27_INC 27
-#define GENLIST_FONT_28_INC 28
-#define GENLIST_FONT_30_INC 30
-#define GENLIST_FONT_32_INC 32
-#define GENLIST_FONT_STYLE_32_INC "32"
-#define GENLIST_FONT_36_INC 36
-#define GENLIST_FONT_STYLE_36_INC "36"
-#define GENLIST_FONT_40_INC 40
-#define GENLIST_FONT_STYLE_40_INC "40"
-#define GENLIST_FONT_42_INC 42
-#define GENLIST_FONT_STYLE_42_INC "42"
-#define GENLIST_FONT_48_INC 48
-#define GENLIST_FONT_STYLE_48_INC "48"
-
-#define GENLIST_SIZE_4_INC 4
-#define GENLIST_SIZE_6_INC 6
-#define GENLIST_SIZE_8_INC 8
-#define GENLIST_SIZE_10_INC 10
-#define GENLIST_SIZE_13_INC 13
-#define GENLIST_SIZE_16_INC 16
-#define GENLIST_SIZE_18_INC 18
-#define GENLIST_SIZE_21_INC 21
-#define GENLIST_SIZE_28_INC 28
-#define GENLIST_SIZE_35_INC 35
-#define GENLIST_SIZE_38_INC 38
-#define GENLIST_SIZE_40_INC 40
-#define GENLIST_SIZE_42_INC 42
-#define GENLIST_SIZE_44_INC 44
-#define GENLIST_SIZE_45_INC 45
-#define GENLIST_SIZE_46_INC 46
-#define GENLIST_SIZE_48_INC 48
-#define GENLIST_SIZE_54_INC 54
-#define GENLIST_SIZE_56_INC 56
-#define GENLIST_SIZE_57_INC 57
-#define GENLIST_SIZE_60_INC 60
-#define GENLIST_SIZE_61_INC 61
-#define GENLIST_SIZE_SLIDE_60_INC 60
-#define GENLIST_SIZE_66_INC 66
-#define GENLIST_SIZE_74_INC 74
-#define GENLIST_SIZE_SLIDE_74_INC 74
-#define GENLIST_SIZE_80_INC 80
-#define GENLIST_SIZE_88_INC 88
-#define GENLIST_SIZE_90_INC 90
-#define GENLIST_SIZE_96_INC 96
-#define GENLIST_SIZE_112_INC 112
-#define GENLIST_SIZE_116_INC 116
-#define GENLIST_SIZE_128_INC 128
-#define GENLIST_SIZE_133_INC 133
-#define GENLIST_SIZE_141_INC 141
-#define GENLIST_SIZE_144_INC 144
-#define GENLIST_SIZE_154_INC 154
-#define GENLIST_SIZE_160_INC 160
-#define GENLIST_SIZE_163_INC 163
-#define GENLIST_SIZE_168_INC 168
-#define GENLIST_SIZE_174_INC 174
-#define GENLIST_SIZE_SLIDE_165_INC 165
-#define GENLIST_SIZE_176_INC 176
-#define GENLIST_SIZE_177_INC 177
-#define GENLIST_SIZE_192_INC 192
-#define GENLIST_SIZE_195_INC 195
-#define GENLIST_SIZE_197_INC 197
-#define GENLIST_SIZE_206_INC 206
-#define GENLIST_SIZE_234_INC 234
-#define GENLIST_SIZE_235_INC 235
-#define GENLIST_SIZE_SLIDE_220_INC 220
-#define GENLIST_SIZE_304_INC 304
-#define GENLIST_SIZE_390_INC 390
-#define GENLIST_SIZE_448_INC 448
-#define GENLIST_SIZE_560_INC 560
-#define GENLIST_SIZE_576_INC 576
-#define GENLIST_SIZE_672_INC 672
-
-#define GENLIST_TREESIZE_16_INC 16
-#define GENLIST_TREESIZE_20_INC 20
-
-// ----------- TEXT COLOR ---------------- //
-#define GENLIST_TEXT_COLOR_LIST_MAIN_TEXT_READ 124 124 124 255
-#define GENLIST_TEXT_COLOR_LIST_MAIN_TEXT_UNREAD 0 0 0 255
-#define GENLIST_TEXT_COLOR_LIST_MAIN_TEXT_FOCUS 249 249 249 255
-
-#define GENLIST_TEXT_COLOR_LIST_SUB_TEXT_DEFAULT 124 124 124 255
-#define GENLIST_TEXT_COLOR_LIST_SUB_TEXT_SETTINGS 42 137 194 204
-#define GENLIST_TEXT_COLOR_LIST_SUB_TEXT_FOCUS 249 249 249 255
-
-#define GENLIST_TEXT_COLOR_FLEXIBLE_TEXT_MAIN 0 0 0 255
-#define GENLIST_TEXT_COLOR_FLEXIBLE_TEXT_SUB 149 149 149 255
-
-#define GENLIST_TEXT_COLOR_EDITFIELD_TEXT 158 187 205 255
-#define GENLIST_TEXT_COLOR_EDITFIELD_TEXT_CURSOR 42 137 194 255
-
-#define GENLIST_TEXT_COLOR_MULTILINE_TEXT 124 124 124 255
-
-#define GENLIST_TEXT_COLOR_INDEX_LIST 29 100 149 255
-#define GENLIST_TEXT_COLOR_3LINE_MAIN_TEXT_01_READ 124 124 124 255
-#define GENLIST_TEXT_COLOR_3LINE_MAIN_TEXT_01_UNREAD 0 0 0 255
-#define GENLIST_TEXT_COLOR_3LINE_MAIN_TEXT_01_FOCUS 249 249 249 255
-
-#define GENLIST_TEXT_COLOR_3LINE_MAIN_TEXT_02 124 124 124 255
-#define GENLIST_TEXT_COLOR_3LINE_MAIN_TEXT_02_FOCUS 249 249 249 255
-
-#define GENLIST_TEXT_COLOR_3LINE_MAIN_TEXT_03 124 124 124 255
-#define GENLIST_TEXT_COLOR_3LINE_MAIN_TEXT_03_FOCUS 249 249 249 255
-
-#define GENLIST_TEXT_COLOR_CONVERTOR_STYLE 249 249 249 255
-#define GENLIST_TEXT_COLOR_CONVERTOR_STYLE_FOCUS 249 249 249 255
-
-#define GENLIST_TEXT_COLOR_UNREAD_EMAIL 0 0 0 255
-#define GENLIST_TEXT_COLOR_CONTENTS_TEXT 210 210 210 255
-#define GENLIST_TEXT_COLOR_NAME_TEXT 128 128 128 255
-#define GENLIST_TEXT_COLOR_NAME_TEXT_DIM 42 137 194 255
-#define GENLIST_TEXT_COLOR_LIST_BUBBLE_TEXT 249 249 249 255
-#define GENLIST_TEXT_COLOR_LIST_MESSAGE_TEXT 0 0 0 255
-
-#define GENLIST_TEXT_COLOR_BUBBLE_READ_MESSAGE 0 0 0 255
-#define GENLIST_TEXT_COLOR_BUBBLE_MESSAGE_TIME 0 0 0 255
-#define GENLIST_TEXT_COLOR_BUBBLE_SENT_MESSAGE 0 0 0 255
-#define GENLIST_TEXT_COLOR_BUBBLE_SOS_MESSAGE 192 23 23 255
-#define GENLIST_TEXT_COLOR_BUBBLE_MESSAGE_DATE 128 128 128 255
-#define GENLIST_TEXT_COLOR_BUBBLE_LINK_MESSAGE 34 129 157 255
-#define GENLIST_TEXT_COLOR_BUBBLE_MESSAGE_FAILED 211 0 0 255
-#define GENLIST_TEXT_COLOR_BUBBLE_READ_MESSAGE_NAME 57 166 215 255
-#define GENLIST_TEXT_COLOR_BUBBLE_MESSAGE_HELP 146 146 146 255
-#define GENLIST_TEXT_COLOR_SWEEP_STYLE 118 118 118 255
-
-#define GENLIST_TEXT_COLOR_STYLE_NAME_TEXT "#808080FF"
-#define GENLIST_TEXT_COLOR_STYLE_LIST_MAIN_TEXT_READ "#000000FF"
-#define GENLIST_TEXT_COLOR_STYLE_LIST_SUB_TEXT "#7C7C7CFF"
-#define GENLIST_TEXT_COLOR_LIST_MESSAGE_TEXT_STYLE "#000000FF"
-#define GENLIST_PART_FONT_FLEXIBLE_TEXT_MAIN_STYLE_COLOR_INC "#000000FF"
-#define GENLIST_PART_FONT_FLEXIBLE_TEXT_SUB_STYLE_COLOR_INC "#959595FF"
-#define GENLIST_PART_FONT_MULTILINE_TEXT_STYLE_COLOR_INC "#959595FF"
-#define GENLIST_PART_FONT_3LINE_MAIN_TEXT_READ_STYLE_COLOR_INC "#7C7C7CFF"
-#define GENLIST_PART_FONT_3LINE_MAIN_TEXT_UNREAD_STYLE_COLOR_INC "#000000FF"
-#define GENLIST_PART_FONT_3LINE_MAIN_TEXT_FOCUS_STYLE_COLOR_INC "#F9F9F9FF"
-#define GENLIST_PART_FONT_3LINE_MAIN_TEXT_2_STYLE_COLOR_INC "#7C7C7CFF"
-#define GENLIST_PART_FONT_3LINE_MAIN_TEXT_2_FOCUS_STYLE_COLOR_INC "#F9F9F9FF"
-#define GENLIST_PART_FONT_HELP_TEXT_STYLE_COLOR_INC "#7C7C7CFF"
-#define GENLIST_TEXT_COLOR_LIST_BUBBLE_TEXT_STYLE "#F9F9F9FF"
-
-#define GENLIST_PART_DISCLIP_COLOR_INC 255 255 255 110 // alpha was 64 [???]
-#define GENLIST_PART_BG_COLOR_INC 236 240 242 255
-#define GENLIST_PART_LIST_BG_COLOR_INC 249 249 249 255
-#define GENLIST_PART_LIST_LINE_COLOR_INC 169 169 169 255
-#define GENLIST_PART_LIST_PRESS_COLOR_INC 42 137 194 255
-#define GENLIST_PART_TEXT_PRESS_COLOR_INC 249 249 249 255
-#define GENLIST_PART_EXPANDABLE_2ND_DEPTH_BG_COLOR_INC 215 225 232 255
-#define GENLIST_PART_EXPANDABLE_3ND_DEPTH_BG_COLOR_INC 215 225 232 255
-#define GENLIST_PART_EDIT_SELECT_ALL_BG_COLOR_INC 215 225 232 255
-#define GENLIST_PART_EDIT_REORDER_BG_COLOR_INC 215 225 232 255
-#define GENLIST_PART_EDIT_1PIXEL_LINE_COLOR_INC 169 169 169 255
-#define GENLIST_PART_BUBBLE_DATE_BG_COLOR_INC 56 69 90 255
-#define GENLIST_PART_BUBBLE_1PIXEL_LINE_COLOR_INC 153 153 153 255
-//
-// Remove this, use GENLIST_PART_BASE_EVENT_OFF instead
-#define GENLIST_PART_INDEX_LIST_BASE_EVENT_INC \
- part { name: "base_event";\
- type: RECT;\
- repeat_events: 0;\
- description { state: "default" 0.0;\
- color: 0 0 0 0;\
- }\
- }
-#define GENLIST_PART_INDEX_LIST_BASE_IMAGE_INC \
- part { name: "base_image";\
- repeat_events: 1;\
- description { state: "default" 0.0;\
- rel1.to: "rect";\
- rel2.to: "rect";\
- image {\
- normal: "00_index list_bg.png";\
- border: 0 0 2 2;\
- }\
- }\
- }
-
-#define GENLIST_PART_TEXT_PRESS_STYLE_COLOR_INC "#F9F9F9FF"
-#define GENLIST_PART_MATCH_TAG_COLOR_INC "+ color=#3F8DAD"
-
-#define GENLIST_DIALOGUE_GT_TEXT_COLOR 102 102 102 255
-#define GENLIST_DIALOGUE_FONT_EDIT_MODE_TEXT_01_COLOR_INC 100 100 100 255
-#define GENLIST_DIALOGUE_FONT_EDIT_MODE_TEXT_01_FOCUS_COLOR_INC 249 249 249 255
-#define GENLIST_DIALOGUE_FONT_EDIT_MODE_TEXT_02_COLOR_INC 249 249 249 255
-#define GENLIST_DIALOGUE_FONT_EDIT_MODE_TEXT_02_DIM_COLOR_INC 7 180 211 255
-#define GENLIST_DIALOGUE_FONT_EDIT_MODE_TEXT_02_FOCUS_COLOR_INC 249 249 249 255
-#define GENLIST_DIALOGUE_FONT_DETAIL_TEXT_MAIN_COLOR_INC 0 0 0 255
-#define GENLIST_DIALOGUE_FONT_DETAIL_TEXT_SUB_COLOR_INC 124 124 124 255
-#define GENLIST_DIALOGUE_FONT_APPS_NAME_COLOR_INC 0 0 0 255
-#define GENLIST_DIALOGUE_FONT_APPS_INC_COLOR_INC 124 124 124 255
-#define GENLIST_DIALOGUE_FONT_APPS_RATING_COLOR_INC 124 124 124 255
-#define GENLIST_DIALOGUE_FONT_APPS_PRICE_ORIGINAL_COLOR_INC 7 180 211 255
-#define GENLIST_DIALOGUE_FONT_APPS_PRICE_SALE_COLOR_INC 221 134 21 255
-#define GENLIST_DIALOGUE_FONT_APPS_PRICE_FREE_COLOR_INC 7 180 211 255
-#define GENLIST_DIALOGUE_FONT_PASSWORD_TITLE_COLOR_INC 124 124 124 255
-#define GENLIST_DIALOGUE_FONT_PASSWORD_INPUT_TEXT_COLOR_INC 0 0 0 255
-#define GENLIST_DIALOGUE_FONT_DETAIL_WORD_COLOR_INC 249 249 249 255
-#define GENLIST_DIALOGUE_FONT_DETAIL_PRONUNCIATION_COLOR_INC 7 180 211 255
-#define GENLIST_DIALOGUE_FONT_DETAIL_NATION_COLOR_INC 146 146 146 255
-#define GENLIST_DIALOGUE_FONT_DETAIL_INFO_01_COLOR_INC 249 249 249 255
-#define GENLIST_DIALOGUE_FONT_DETAIL_INFO_02_COLOR_INC 146 146 146 255
-
-#define GENLIST_DIALOGUE_GROUP_BG_COLOR_INC 236 240 242 255
-#define GENLIST_DIALOGUE_GROUP_LIST_BG_COLOR_INC 249 249 249 255
-#define GENLIST_DIALOGUE_GROUP_LEFT_BG_COLOR_INC 108 168 199 255
-#define GENLIST_DIALOGUE_1PIXEL_LINE_COLOR_INC 142 154 163 255
-#define GENLIST_DIALOGUE_ICON_1PIXEL_LINE_COLOR_INC 68 68 68 255
-#define GENLIST_DIALOGUE_PHOTO_ID_1PIXEL_LINE_COLOR_INC 68 68 68 255
-#define GENLIST_DIALOGUE_BG_IMAGE_COLOR_INC 236 240 242 255
-
-#define GENLIST_SWEEP_BG_COLOR_INC 236 240 242 255
-
-#define GENLIST_PART_EMAIL_MSGCOUNT_TEXT_COLOR_INC 255 255 255 255
-#define GENLIST_PART_TEXTBLOCK_STYLE_COLOR_INC "#a8a8a8FF"
-#define GENLIST_PART_TEXTBLOCK_STYLE_SELECTED_COLOR_INC "#646464"
-#define GENLIST_PART_TEXTBLOCK_READ_STYLE_COLOR_INC "#9E9E9EFF"
-#define GENLIST_PART_TEXTBLOCK_UNREAD_STYLE_COLOR_INC "#000000FF"
-#define GENLIST_PART_TEXTBLOCK_SUB_STYLE_COLOR_INC "#a8a8a8"
-#define GENLIST_PART_TEXTBLOCK_URGENCY_READ_STYLE_COLOR_INC "#AB5252"
-#define GENLIST_PART_TEXTBLOCK_URGENCY_UNREAD_STYLE_COLOR_INC "#CF2525"
-
-#define GENLIST_HEIGHT_1LINE 113 // excep bottom 1 line
-//FIXME: Change from GENLIST_TREESIZE_DEFAULT to below macro
-#define GENLIST_TREESIZE_DEFAULT 32
-
-#define GENLIST_PADDING_SIZE_DEFAULT 16
-#define GENLIST_PADDING_SIZE_LEFT GENLIST_PADDING_SIZE_DEFAULT
-#define GENLIST_PADDING_SIZE_RIGHT GENLIST_PADDING_SIZE_DEFAULT
-#define GENLIST_PADDING_SIZE_TOP 10
-#define GENLIST_PADDING_SIZE_BOTTOM 10
-
-#define GENLIST_TEXT2_WIDTH_MIN 150
-
-#define GENLIST_SIZE_PASSWORD_ICON 114
-
-#define GENLIST_TEXT_BTN_HEIGHT 72
-#define GENLIST_ICON_SMALL_SIZE 32
-#define GENLIST_ICON_MEDIUM_SIZE 48
-#define GENLIST_ICON_BIG_SIZE 64
-#define GENLIST_ICON_ONOFF_HEIGHT 80
-#define GENLIST_ICON_ONOFF_WIDTH 60
-#define GENLIST_ICON_CHECK_SIZE 60
-#define GENLIST_ICON_RADIO_SIZE 60
-
-// Group Title
-#define GENLIST_GT_PAD_T_H 36
-#define GENLIST_GT_PAD_B_H 10
-#define GENLIST_GT_TEXT_H 36
-#define GENLIST_GT_PAD_L_W 16
-#define GENLIST_GT_PAD_R_W 36
-#define GENLIST_GT_PAD_M_W 16
-#define GENLIST_GT_H GENLIST_GT_PAD_T_H + GENLIST_GT_PAD_B_H + GENLIST_GT_TEXT_H
-
-#define GENLIST_DIALOGUE_SEPARATOR_DEFAULT_HEIGHT 40
-
-
-#define GENLIST_DESCRIPT_DEFAULT( left, right, top, bottom ) \
- description { state: "default" 0.0;\
- rel1 { \
- relative: 1 1; \
- to_x: left; \
- to_y: top; \
- }\
- rel2 {\
- relative: 0 0;\
- to_x: right;\
- to_y: bottom;\
- }\
-
-#define GENLIST_DESCRIPT_DOT_LT( left, top ) \
- description { state: "default" 0.0;\
- align: 0 0;\
- rel1 { \
- relative: 1 1; \
- to_x: left; \
- to_y: top; \
- }\
- rel2 {\
- relative: 1 1;\
- to_x: left;\
- to_y: top;\
- }\
-
-#define GENLIST_DESCRIPT_DOT_RT( right, top ) \
- description { state: "default" 0.0;\
- align: 1 0;\
- rel1 { \
- relative: 0 1; \
- to_x: right; \
- to_y: top; \
- }\
- rel2 {\
- relative: 0 1;\
- to_x: right;\
- to_y: top;\
- }\
-
-#define GENLIST_DESCRIPT_DOT_LB( left, bottom ) \
- description { state: "default" 0.0;\
- align: 0 1;\
- rel1 { \
- relative: 1 0; \
- to_x: left; \
- to_y: bottom; \
- }\
- rel2 {\
- relative: 1 0;\
- to_x: left;\
- to_y: bottom;\
- }\
-
-#define GENLIST_DESCRIPT_DOT_RB( right, bottom ) \
- description { state: "default" 0.0;\
- align: 1 1;\
- rel1 { \
- relative: 0 0; \
- to_x: right; \
- to_y: bottom; \
- }\
- rel2 {\
- relative: 0 0;\
- to_x: right;\
- to_y: bottom;\
- }\
-
-#define GENLIST_DESCRIPT_LINE_LEFT( left, top, bottom ) \
- description { state: "default" 0.0;\
- align: 0 0.5;\
- rel1 { \
- relative: 1 1; \
- to_x: left; \
- to_y: top; \
- }\
- rel2 {\
- relative: 1 0;\
- to_x: left;\
- to_y: bottom;\
- }\
-
-#define GENLIST_DESCRIPT_LINE_RIGHT( right, top, bottom ) \
- description { state: "default" 0.0;\
- align: 1 0.5;\
- rel1 { \
- relative: 0 1; \
- to_x: right; \
- to_y: top; \
- }\
- rel2 {\
- relative: 0 0;\
- to_x: right;\
- to_y: bottom;\
- }\
-
-#define GENLIST_DESCRIPT_LINE_TOP( left, right, top ) \
- description { state: "default" 0.0;\
- align: 0.5 0;\
- rel1 { \
- relative: 1 1; \
- to_x: left; \
- to_y: top; \
- }\
- rel2 {\
- relative: 0 1;\
- to_x: right;\
- to_y: top;\
- }\
-
-#define GENLIST_DESCRIPT_LINE_BOTTOM( left, right, bottom ) \
- description { state: "default" 0.0;\
- align: 0.5 1;\
- rel1 { \
- relative: 1 0; \
- to_x: left; \
- to_y: bottom; \
- }\
- rel2 {\
- relative: 0 0;\
- to_x: right;\
- to_y: bottom;\
- }\
-
-#define GENLIST_PADDING(NAME, SIZE_X, SIZE_Y, DESCRIPT) \
- part { name: NAME; \
- type: RECT; \
- scale: 1; \
- DESCRIPT \
- min: SIZE_X SIZE_Y; \
- fixed: 1 1; \
- visible: 0; \
- }\
- } \
-
-
-// *************** Function Macro ******************* //
-#define GENLIST_PART_BASE( param_item_height ) \
- part { name: "base"; \
- type: RECT; \
- repeat_events: 1; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: 0 param_item_height; \
- color: GENLIST_PART_BG_COLOR_INC; \
- } \
- }
-
-#define GENLIST_PART_BASE_BG( param_item_height ) \
- part { name: "base"; \
- type: RECT; \
- repeat_events: 1; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: 0 param_item_height; \
- color: GENLIST_PART_BG_COLOR_INC; \
- } \
- }
-
-/// This block events
-#define GENLIST_PART_BASE_EVENT_OFF \
- part { name: "base_event";\
- type: RECT;\
- repeat_events: 0;\
- description { state: "default" 0.0;\
- color: 0 0 0 0;\
- }\
- }
-
-#define GENLIST_PART_BG \
- part { name: "bg"; \
- type: RECT; \
- clip_to: "disclip"; \
- mouse_events: 0; \
- description { state: "default" 0.0; \
- color: GENLIST_PART_BG_COLOR_INC; \
- } \
- description { state: "hide" 0.0; \
- inherit: "default" 0.0; \
- rel1 { relative: 0.025 0.0; } \
- rel2 { relative: 1.025 1.0; } \
- } \
- description { state: "hide" 0.1; \
- inherit: "default" 0.0; \
- rel1 { relative: 0.13 0.0; } \
- rel2 { relative: 1.13 1.0; } \
- } \
- description { state: "hide" 0.2; \
- inherit: "default" 0.0; \
- rel1 { relative: 0.5 0.0; } \
- rel2 { relative: 1.5 1.0; } \
- } \
- description { state: "hide" 0.3; \
- inherit: "default" 0.0; \
- rel1 { relative: 1.0 0.0; } \
- rel2 { relative: 2.0 1.0; } \
- } \
- }
-
-#define GENLIST_PART_BG_IMAGE \
- part { name: "bg_image"; \
- type: RECT; \
- clip_to: "disclip"; \
- mouse_events: 0; \
- description { state: "default" 0.0; \
- color: GENLIST_PART_LIST_BG_COLOR_INC; \
- } \
- description { state: "selected" 0.0; \
- inherit: "default" 0.0; \
- color: GENLIST_PART_LIST_PRESS_COLOR_INC; \
- } \
- }
-
-#define GENLIST_PART_BOTTOM_LINE \
- part { name: "bottom_line"; \
- type: RECT; \
- mouse_events: 0; \
- description { state: "default" 0.0; \
- min: 0 1; \
- fixed: 0 1; \
- visible: 1; \
- color: GENLIST_PART_LIST_LINE_COLOR_INC; \
- rel1 { \
- relative: 0.0 1.0; \
- offset: 0 -1; \
- } \
- } \
- }
-
-#define GENLIST_PART_BOTTOM_EFFECT_LINE \
- part { name: "bottom_line"; \
- type: RECT; \
- mouse_events: 0; \
- description { state: "default" 0.0; \
- min: 0 1; \
- fixed: 0 1; \
- visible: 1; \
- color: GENLIST_PART_LIST_LINE_COLOR_INC; \
- rel1 { \
- relative: 0.0 1.0; \
- offset: 0 -1; \
- } \
- } \
- GENLIST_PART_MAP_START(-90.0, 0.0, 0.0) \
- GENLIST_PART_MAP_FINISH(0.0, 0.0, 0.0) \
- }
-
-#define GENLIST_PART_PADDING_TOP( param_padding_size ) \
- part { name: "elm.padding.top"; \
- type: RECT; \
- scale: 1; \
- description { \
- state: "default" 0.0; \
- min: 0 param_padding_size; \
- fixed: 0 1; \
- visible: 0; \
- rel2.relative: 1.0 0.0; \
- align: 0.0 0.0; \
- } \
- }
-
-#define GENLIST_PART_PADDING_TEXT_TOP( param_padding_size ) \
- part { name: "elm.padding.text.top"; \
- type: RECT; \
- scale: 1; \
- description { \
- state: "default" 0.0; \
- min: 0 param_padding_size; \
- fixed: 0 1; \
- visible: 0; \
- rel2.relative: 1.0 0.0; \
- align: 0.0 0.0; \
- } \
- }
-
-#define GENLIST_PART_PADDING_BOTTOM( param_padding_size ) \
- part { name: "elm.padding.bottom"; \
- type: RECT; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: 0 param_padding_size; \
- fixed: 0 1; \
- visible: 0; \
- rel1.relative: 0.0 1.0; \
- align: 1.0 1.0; \
- } \
- }
-
-#define GENLIST_PART_PADDING_LEFT( param_padding_size ) \
- part { name: "elm.padding.left"; \
- type: RECT; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: param_padding_size 0; \
- fixed: 1 0; \
- visible: 0; \
- rel2.relative: 0.0 1.0; \
- align: 0.0 0.0; \
- } \
- }
-
-#define GENLIST_PART_PADDING_RIGHT( param_padding_size ) \
- part { name: "elm.padding.right"; \
- type: RECT; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: param_padding_size 0; \
- fixed: 1 0; \
- visible: 0; \
- rel1.relative: 1.0 0.0; \
- align: 1.0 0.0; \
- } \
- }
-
-#define GENLIST_DIALOGUE_PART_BASE( param_item_height ) \
- part { name: "base_part"; \
- type: RECT; \
- clip_to: "disclip"; \
- repeat_events: 1; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: 0 param_item_height; \
- color: LAYOUT_GROUP_LIST_BG_COLOR_INC; \
- } \
- }
-
-// FIXME: Use above instead
-#define GENLIST_PART_DIALOGUE_BASE( param_item_height ) \
- part { name: "base"; \
- type: RECT; \
- clip_to: "disclip"; \
- repeat_events: 1; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: 0 param_item_height; \
- color: LAYOUT_GROUP_LIST_BG_COLOR_INC; \
- } \
- }
-
-#define GENLIST_PART_DIALOGUE_BG_IMAGE \
- part { name: "bg_image"; \
- type: RECT; \
- clip_to: "disclip"; \
- mouse_events: 0; \
- description { state: "default" 0.0; \
- color: GENLIST_DIALOGUE_BG_IMAGE_COLOR_INC; \
- } \
- description { state: "selected" 0.0; \
- inherit: "default" 0.0; \
- color: GENLIST_PART_LIST_PRESS_COLOR_INC; \
- } \
- }
-
-#define GENLIST_PART_DIALOGUE_ITEM \
- part { name: "elm.rect.dialogue"; \
- type: RECT; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: GENLIST_PADDING_12_INC 0; \
- fixed: 1 0; \
- color: GENLIST_DIALOGUE_GROUP_LEFT_BG_COLOR_INC; \
- rel2.relative: 0.0 1.0; \
- align: 0.0 0.0; \
- } \
- }
-
-#define GENLIST_PART_DIALOGUE_RIGHT_LINE \
- part { name: "elm.rect.dialogue.right.line"; \
- type: RECT; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: 1 0; \
- fixed: 1 0; \
- visible: 1; \
- rel1 { \
- relative: 1.0 0.0; \
- offset: -1 0; \
- } \
- align: 1.0 0.0; \
- color: GENLIST_PART_LIST_LINE_COLOR_INC; \
- } \
- }
-
-#define GENLIST_PART_DIALOGUE_EXPANDABLE_ITEM \
- part { name: "elm.rect.dialogue"; \
- type: RECT; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: GENLIST_PADDING_12_INC 0; \
- fixed: 1 0; \
- color: GENLIST_DIALOGUE_GROUP_LEFT_BG_COLOR_INC; \
- rel2.relative: 0.0 1.0; \
- align: 0.0 0.0; \
- } \
- GENLIST_PART_MAP_START(-90.0, 0.0, 0.0) \
- GENLIST_PART_MAP_FINISH(0.0, 0.0, 0.0) \
- }
-
-#define GENLIST_PART_SWALLOW_END( param_padding_size ) \
- part { name: "elm.padding.left.swallow.end";\
- clip_to: "disclip"; \
- type: RECT;\
- scale: 1;\
- description { state: "default" 0.0;\
- min: param_padding_size 0;\
- fixed: 1 0;\
- visible: 0; \
- rel1.to_x: "elm.swallow.end";\
- rel2 {\
- relative: 0.0 1.0;\
- to_x: "elm.swallow.end";\
- }\
- align: 1.0 0.5;\
- }\
- }\
- part { name: "elm.swallow.end";\
- clip_to: "disclip"; \
- type: SWALLOW;\
- scale: 1;\
- description { state: "default" 0.0;\
- fixed: 1 0;\
- align: 1.0 0.5;\
- rel1.to_x: "elm.padding.right";\
- rel2 {\
- relative: 0.0 1.0;\
- to_x: "elm.padding.right";\
- }\
- }\
- }
-
-// When rotating, sometimes item size is expaned.
-#define GENLIST_PART_DISCLIP \
- part { name: "disclip"; \
- type: RECT; \
- description { state: "default" 0.0; \
- } \
- description { state: "disabled" 0.0; \
- inherit: "default" 0.0; \
- color: GENLIST_PART_DISCLIP_COLOR_INC; \
- } \
- }
-
-#define GENLIST_EXPANDABLE_PART_PERSPECTIVE_POINT() \
- part { name: "point"; \
- type: RECT; \
- scale: 1; \
- description { \
- state: "default" 0.0; \
- color: 0 0 0 0; \
- rel1 { relative: 0.0 0.0; } \
- rel2 { relative: 1.0 0.0; } \
- } \
- }
-
-#define GENLIST_PART_MAP_START( param_x, param_y, param_z ) \
- description { state: "map_transition" 0.0; \
- inherit: "default" 0.0; \
- color: 50 50 50 100; \
- map { \
- perspective: "point"; \
- on: 1; \
- smooth: 1; \
- perspective_on: 1; \
- backface_cull: 1; \
- rotation { \
- center: "point"; \
- x: param_x; \
- y: param_y; \
- z: param_z; \
- } \
- } \
- } \
- description { \
- state: "hide" 0.0; \
- inherit: "default" 0.0; \
- visible: 0; \
- }
-
-#define GENLIST_PART_MAP_FINISH( param_x, param_y, param_z ) \
- description { \
- state: "map_rotate" 0.0; \
- inherit: "default" 0.0; \
- map { \
- perspective: "point"; \
- on: 1; \
- smooth: 1; \
- perspective_on: 1; \
- backface_cull: 1; \
- rotation { \
- center: "point"; \
- x: param_x; \
- y: param_y; \
- z: param_z; \
- } \
- } \
- } \
-
-#define GENLIST_PART_MAP_BASE( param_item_height ) \
- part { name: "base"; \
- type: RECT; \
- repeat_events: 1; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: 0 param_item_height; \
- color: GENLIST_PART_BG_COLOR_INC; \
- } \
- GENLIST_PART_MAP_START(-90.0, 0.0, 0.0) \
- GENLIST_PART_MAP_FINISH(0.0, 0.0, 0.0) \
- }
-
-#define GENLIST_EXPANDABLE_PART_BASE( GE_HEIGHT , GE_COLOR ) \
- part { name: "base"; \
- type: RECT; \
- repeat_events: 1; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: 0 GE_HEIGHT; \
- color: GE_COLOR; \
- } \
- description { state: "selected" 0.0; \
- inherit: "default" 0.0; \
- color: GENLIST_PART_LIST_PRESS_COLOR_INC; \
- } \
- GENLIST_PART_MAP_START(-90.0, 0.0, 0.0) \
- GENLIST_PART_MAP_FINISH(0.0, 0.0, 0.0) \
- }
-
-/* XXX: refactor expandable edc first.
- and use GENLIST_EXPANDABLE_PART_BASE_NEW as GENLIST_EXPANDABLE_PART_BASE.
-*/
-#define GENLIST_EXPANDABLE_PART_BASE_NEW( GE_HEIGHT , GE_COLOR ) \
- part { name: "base"; \
- type: RECT; \
- repeat_events: 1; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: 0 GE_HEIGHT; \
- color: GE_COLOR; \
- } \
- description { state: "selected" 0.0; \
- inherit: "default" 0.0; \
- color: GENLIST_PART_LIST_PRESS_COLOR_INC; \
- } \
- }
-
-#define GENLIST_PROGRAM_MAP_ROTATE_EXPAND_START() \
- name: "rotaion_transition"; \
- signal: "flip_item"; \
- action: STATE_SET "map_transition" 0.0; \
- after: "rotation";
-
-#define GENLIST_PROGRAM_MAP_ROTATE_EXPAND_FINISH( second ) \
- name: "rotation"; \
- action: STATE_SET "map_rotate" 0.0; \
- transition: LINEAR second; \
- after: "rotation_end";
-
-#define GENLIST_PROGRAM_MAP_EXPAND_END() \
- name: "rotation_end"; \
- action: STATE_SET "default" 0.0;
-
-#define GENLIST_PROGRAM_MAP_ROTATE_CONTRACT_START() \
- name: "rotation_transition2"; \
- signal: "elm,state,contract_flip"; \
- action: STATE_SET "map_rotate" 0.0; \
- after: "rotation2";
-
-#define GENLIST_PROGRAM_MAP_ROTATE_CONTRACT_FINISH( second ) \
- name: "rotation2"; \
- action: STATE_SET "map_transition" 0.0; \
- transition: LINEAR second; \
- after: "rotation3";
-
-#define GENLIST_PROGRAM_MAP_CONTRACT_END() \
- name: "rotation3"; \
- action: STATE_SET "hide" 0.0;
-
-#define GENLIST_PART_EXPANDABLE2_NOSHADOW_BASE( param_item_height ) \
- part { name: "base"; \
- type: RECT; \
- repeat_events: 1; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: 0 param_item_height; \
- color: GENLIST_PART_EXPANDABLE_2ND_DEPTH_BG_COLOR_INC; \
- } \
- GENLIST_PART_MAP_START(-90.0, 0.0, 0.0) \
- GENLIST_PART_MAP_FINISH(0.0, 0.0, 0.0) \
- }
-
-#define GENLIST_PART_EXPANDABLE_SWALLOW_PADDING \
- part { name: "elm.swallow.pad"; \
- type: SWALLOW; \
- description { state: "default" 0.0; \
- fixed: 1 0; \
- align: 0.0 0.5; \
- rel1 { \
- relative: 1.0 0.0;\
- to_x: "elm.padding.left"; \
- } \
- rel2.to_x: "elm.padding.left"; \
- } \
- GENLIST_PART_MAP_START(-90.0, 0.0, 0.0) \
- GENLIST_PART_MAP_FINISH(0.0, 0.0, 0.0) \
- } \
-
-#define GENLIST_PART_PADDING_LEFT_SLIDE( param_padding_size ) \
- part { name: "elm.padding.left"; \
- type: RECT; \
- scale: 1; \
- description { \
- state: "default" 0.0; \
- min: param_padding_size 0; \
- fixed: 1 0; \
- visible: 0; \
- rel1 { relative: 0.0 0.0; to: "bg"; } \
- rel2 { relative: 0.0 1.0; to: "bg"; } \
- align: 0.0 0.0; \
- } \
- }
-
-/* only for demo */
-#define GENLIST_PART_BUTTON( param_name, param_text_name, param_text, param_left, param_right, param_top, param_bottom ) \
- part { name: param_name; \
- mouse_events: 1; \
- description { state: "default" 0.0; \
- visible: 1; \
- rel1 { relative: param_left param_top; offset: 0 0; } \
- rel2 { relative: param_right param_bottom; offset: -1 -1; } \
- image { \
- normal: "btn_normal.png"; \
- border: 10 10 10 10; \
- border_scale: 1; \
- } \
- image.middle: SOLID; \
- fill.smooth: 0; \
- } \
- description { state: "selected" 0.0; \
- inherit: "default" 0.0; \
- image { \
- normal: "btn_selected.png"; \
- } \
- } \
- } \
- part { name: param_text_name; \
- type: TEXT; \
- mouse_events: 0; \
- scale: 1; \
- description { \
- align: 0.0 0.0; \
- state: "default" 0.0; \
- color: 0 0 0 255; \
- rel1 { relative: 0.0 0.0; to: param_name; } \
- rel2 { relative: 1.0 1.0; to: param_name; } \
- text { \
- text: param_text; \
- font: "SLP:style=Roman"; \
- size: 24; \
- min: 1 1; \
- align: 0.5 0.5; \
- text_class: "list_item"; \
- } \
- } \
- }
-
-/* only for demo */
-#define GENLIST_PROGRAM_BUTTON( param_name_focused, param_name_normal, param_part_name ) \
- program { name: param_name_focused; \
- source: param_part_name; \
- signal: "mouse,down,1"; \
- action: STATE_SET "selected" 0.0; \
- target: param_part_name; \
- } \
- program { name: param_name_normal; \
- source: param_part_name; \
- signal: "mouse,up,1"; \
- action: STATE_SET "default" 0.0; \
- target: param_part_name; \
- }
-
-#define GENLIST_PROGRAM_SLIDE_WITH_AFTER( param_name, param_state, param_next ) \
- program { name: param_name; \
- action: STATE_SET "hide" param_state; \
- target: "bg"; \
- transition: LINEAR 0.3; \
- after: param_next; \
- }
-
-#define GENLIST_PROGRAM_SLIDE( param_name, param_state_name, param_state_value ) \
- program { name: param_name; \
- action: STATE_SET param_state_name param_state_value; \
- target: "bg"; \
- transition: LINEAR 0.3; \
- }
-
-#define DESC_FLIP_IMAGE( param_state_value, param_image_file_name ) \
- description { state: "flipping" param_state_value; \
- inherit: "default" 0.0; \
- image { normal: param_image_file_name; } \
- }
-
-#define DESC_TEXT_HIDE( param_state_value ) \
- description { state: "hide" param_state_value; \
- inherit: "default" 0.0; \
- color: 0 0 0 (255*(1-param_state_value/0.20)); \
- }
-
-#define GENLIST_EDIT_PART_BASE( param_item_height ) \
- part { name: "base"; \
- type: RECT; \
- repeat_events: 0; \
- scale: 1; \
- description { state: "default" 0.0; \
- min: 0 param_item_height; \
- color: 0 0 0 0; \
- } \
- }
-
-#define GENLIST_PART_FLIP \
- part { name: "elm.flip.icon"; \
- clip_to: "disclip"; \
- type: SWALLOW; \
- scale: 1; \
- description { state: "default" 0.0; \
- visible: 0; \
- fixed: 1 1; \
- align: 1 0; \
- min: 80 0; \
- rel1 { \
- relative: 0.0 0.0; \
- to_x: "elm.padding.right"; \
- } \
- rel2 { \
- relative: 0.0 1.0; \
- to_x: "elm.padding.right"; \
- } \
- } \
- description { state: "flip_enabled" 0.0; \
- inherit: "default" 0.0; \
- visible: 1; \
- } \
- } \
- part { name: "elm.flip.content"; \
- clip_to: "disclip"; \
- type: SWALLOW; \
- scale: 1; \
- description { state: "default" 0.0; \
- visible: 0; \
- fixed: 1 1; \
- rel1 { \
- relative: 1.0 0.5; \
- to_x: "elm.padding.left"; \
- } \
- rel2 { \
- relative: 0.0 0.5; \
- to_x: "elm.flip.icon"; \
- } \
- } \
- description { state: "flip_enabled" 0.0; \
- inherit: "default" 0.0; \
- visible: 1; \
- } \
- }
-
-#define GENLIST_DESCRIPTION_INVISIBLE_SELECTED \
- description { state: "selected" 1.0; \
- inherit: "default" 0.0; \
- visible: 0; \
- }
-
-#define GENLIST_DESCRIPTION_FLIP_ENABLED \
- description { state: "flip_enabled" 0.0; \
- inherit: "default" 0.0; \
- visible: 0; \
- }
-
-#define GENLIST_PROGRAM_SCRIPT_FLIP_SELECT_1TEXT \
- script { \
- new st[31]; \
- new Float:vl; \
- get_state(PART:"elm.text", st, 30, vl); \
- set_state(PART:"bg_image", "selected", 0.0); \
- if (!strcmp(st, "flip_enabled")) \
- set_state(PART:"elm.text", "selected", 1.0); \
- else \
- set_state(PART:"elm.text", "selected", 0.0); \
- }
-
-#define GENLIST_PROGRAM_SCRIPT_FLIP_SELECT_2TEXT \
- script { \
- new st[31]; \
- new Float:vl; \
- get_state(PART:"elm.text.1", st, 30, vl); \
- set_state(PART:"bg_image", "selected", 0.0); \
- if (!strcmp(st, "flip_enabled")) { \
- set_state(PART:"elm.text.1", "selected", 1.0); \
- set_state(PART:"elm.text.2", "selected", 1.0); \
- } \
- else { \
- set_state(PART:"elm.text.1", "selected", 0.0); \
- set_state(PART:"elm.text.2", "selected", 0.0); \
- } \
- }
-
-#define GENLIST_PROGRAM_SCRIPT_FLIP_SELECT_3TEXT \
- script { \
- new st[31]; \
- new Float:vl; \
- get_state(PART:"elm.text.1", st, 30, vl); \
- set_state(PART:"bg_image", "selected", 0.0); \
- if (!strcmp(st, "flip_enabled")) { \
- set_state(PART:"elm.text.1", "selected", 1.0); \
- set_state(PART:"elm.text.2", "selected", 1.0); \
- set_state(PART:"elm.text.3", "selected", 1.0); \
- } \
- else { \
- set_state(PART:"elm.text.1", "selected", 0.0); \
- set_state(PART:"elm.text.2", "selected", 0.0); \
- set_state(PART:"elm.text.3", "selected", 0.0); \
- } \
- }
-
-#define GENLIST_PROGRAM_FLIP_1TEXT \
- program { name: "flip_enabled"; \
- signal: "elm,state,flip,enabled"; \
- source: "elm"; \
- action: STATE_SET "flip_enabled" 0.0; \
- target: "elm.text"; \
- target: "elm.flip.content"; \
- } \
- program { name: "flip_disabled"; \
- signal: "elm,state,flip,disabled"; \
- source: "elm"; \
- action: STATE_SET "default" 0.0; \
- target: "elm.text"; \
- target: "elm.flip.content"; \
- }
-
-#define GENLIST_PROGRAM_FLIP_1TEXT_1ICON \
- program { name: "flip_enabled"; \
- signal: "elm,state,flip,enabled"; \
- source: "elm"; \
- action: STATE_SET "flip_enabled" 0.0; \
- target: "elm.text"; \
- target: "elm.icon"; \
- target: "elm.flip.content"; \
- } \
- program { name: "flip_disabled"; \
- signal: "elm,state,flip,disabled"; \
- source: "elm"; \
- action: STATE_SET "default" 0.0; \
- target: "elm.text"; \
- target: "elm.icon"; \
- target: "elm.flip.content"; \
- }
-
-#define GENLIST_PROGRAM_FLIP_1TEXT_2ICON \
- program { name: "flip_enabled"; \
- signal: "elm,state,flip,enabled"; \
- source: "elm"; \
- action: STATE_SET "flip_enabled" 0.0; \
- target: "elm.text"; \
- target: "elm.icon.1"; \
- target: "elm.icon.2"; \
- target: "elm.flip.content"; \
- } \
- program { name: "flip_disabled"; \
- signal: "elm,state,flip,disabled"; \
- source: "elm"; \
- action: STATE_SET "default" 0.0; \
- target: "elm.text"; \
- target: "elm.icon.1"; \
- target: "elm.icon.2"; \
- target: "elm.flip.content"; \
- }
-
-#define GENLIST_PROGRAM_FLIP_1TEXT_3ICON \
- program { name: "flip_enabled"; \
- signal: "elm,state,flip,enabled"; \
- source: "elm"; \
- action: STATE_SET "flip_enabled" 0.0; \
- target: "elm.text"; \
- target: "elm.icon.1"; \
- target: "elm.icon.2"; \
- target: "elm.icon.3"; \
- target: "elm.flip.content"; \
- } \
- program { name: "flip_disabled"; \
- signal: "elm,state,flip,disabled"; \
- source: "elm"; \
- action: STATE_SET "default" 0.0; \
- target: "elm.text"; \
- target: "elm.icon.1"; \
- target: "elm.icon.2"; \
- target: "elm.icon.3"; \
- target: "elm.flip.content"; \
- }
-
-#define GENLIST_PROGRAM_FLIP_2TEXT \
- program { name: "flip_enabled"; \
- signal: "elm,state,flip,enabled"; \
- source: "elm"; \
- action: STATE_SET "flip_enabled" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.flip.content"; \
- } \
- program { name: "flip_disabled"; \
- signal: "elm,state,flip,disabled"; \
- source: "elm"; \
- action: STATE_SET "default" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.flip.content"; \
- }
-
-#define GENLIST_PROGRAM_FLIP_2TEXT_1ICON \
- program { name: "flip_enabled"; \
- signal: "elm,state,flip,enabled"; \
- source: "elm"; \
- action: STATE_SET "flip_enabled" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.icon"; \
- target: "elm.flip.content"; \
- } \
- program { name: "flip_disabled"; \
- signal: "elm,state,flip,disabled"; \
- source: "elm"; \
- action: STATE_SET "default" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.icon"; \
- target: "elm.flip.content"; \
- }
-
-#define GENLIST_PROGRAM_FLIP_2TEXT_2ICON \
- program { name: "flip_enabled"; \
- signal: "elm,state,flip,enabled"; \
- source: "elm"; \
- action: STATE_SET "flip_enabled" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.icon.1"; \
- target: "elm.icon.2"; \
- target: "elm.flip.content"; \
- } \
- program { name: "flip_disabled"; \
- signal: "elm,state,flip,disabled"; \
- source: "elm"; \
- action: STATE_SET "default" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.icon.1"; \
- target: "elm.icon.2"; \
- target: "elm.flip.content"; \
- }
-
-#define GENLIST_PROGRAM_FLIP_2TEXT_3ICON \
- program { name: "flip_enabled"; \
- signal: "elm,state,flip,enabled"; \
- source: "elm"; \
- action: STATE_SET "flip_enabled" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.icon.1"; \
- target: "elm.icon.2"; \
- target: "elm.icon.3"; \
- target: "elm.flip.content"; \
- } \
- program { name: "flip_disabled"; \
- signal: "elm,state,flip,disabled"; \
- source: "elm"; \
- action: STATE_SET "default" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.icon.1"; \
- target: "elm.icon.2"; \
- target: "elm.icon.3"; \
- target: "elm.flip.content"; \
- }
-
-#define GENLIST_PROGRAM_FLIP_3TEXT \
- program { name: "flip_enabled"; \
- signal: "elm,state,flip,enabled"; \
- source: "elm"; \
- action: STATE_SET "flip_enabled" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.text.3"; \
- target: "elm.flip.content"; \
- } \
- program { name: "flip_disabled"; \
- signal: "elm,state,flip,disabled"; \
- source: "elm"; \
- action: STATE_SET "default" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.text.3"; \
- target: "elm.flip.content"; \
- }
-
-#define GENLIST_PROGRAM_FLIP_3TEXT_1ICON \
- program { name: "flip_enabled"; \
- signal: "elm,state,flip,enabled"; \
- source: "elm"; \
- action: STATE_SET "flip_enabled" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.text.3"; \
- target: "elm.icon"; \
- target: "elm.flip.content"; \
- } \
- program { name: "flip_disabled"; \
- signal: "elm,state,flip,disabled"; \
- source: "elm"; \
- action: STATE_SET "default" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.text.3"; \
- target: "elm.icon"; \
- target: "elm.flip.content"; \
- }
-
-#define GENLIST_PROGRAM_FLIP_3TEXT_2ICON \
- program { name: "flip_enabled"; \
- signal: "elm,state,flip,enabled"; \
- source: "elm"; \
- action: STATE_SET "flip_enabled" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.text.3"; \
- target: "elm.icon.1"; \
- target: "elm.icon.2"; \
- target: "elm.flip.content"; \
- } \
- program { name: "flip_disabled"; \
- signal: "elm,state,flip,disabled"; \
- source: "elm"; \
- action: STATE_SET "default" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.text.3"; \
- target: "elm.icon.1"; \
- target: "elm.icon.2"; \
- target: "elm.flip.content"; \
- }
-
-#define GENLIST_PROGRAM_FLIP_3TEXT_3ICON \
- program { name: "flip_enabled"; \
- signal: "elm,state,flip,enabled"; \
- source: "elm"; \
- action: STATE_SET "flip_enabled" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.text.3"; \
- target: "elm.icon.1"; \
- target: "elm.icon.2"; \
- target: "elm.icon.3"; \
- target: "elm.flip.content"; \
- } \
- program { name: "flip_disabled"; \
- signal: "elm,state,flip,disabled"; \
- source: "elm"; \
- action: STATE_SET "default" 0.0; \
- target: "elm.text.1"; \
- target: "elm.text.2"; \
- target: "elm.text.3"; \
- target: "elm.icon.1"; \
- target: "elm.icon.2"; \
- target: "elm.icon.3"; \
- target: "elm.flip.content"; \
- }
-
-/* genlist multisense macro - start */
-#define GENLIST_PROGRAM_AFTER_PLAY_BUTTON_PRESS \
- after: "play_button_press";
-
-#define GENLIST_PROGRAM_PLAY_BUTTON_PRESS \
- program { name: "play_button_press"; \
- action: PLAY_SAMPLE "button-pressed" 1.0; \
- }
-
-
-
-/* genlist multisense macro - end */
\ No newline at end of file