[Email] Remove usage of mouse events for closing popups in account module 27/54627/3
authorAndriy Kolesnichenko <a.kolesniche@samsung.com>
Wed, 16 Dec 2015 18:13:44 +0000 (20:13 +0200)
committerAndriy Kolesnichenko <a.kolesniche@samsung.com>
Thu, 17 Dec 2015 16:34:09 +0000 (18:34 +0200)
[Implementation] Accounts module refactoring

Change-Id: If89ff1564b1ad4923a54ca6d87855f6ab634e2fa
Signed-off-by: Andriy Kolesnichenko <a.kolesniche@samsung.com>
.gitignore
Project-Files/modules/account/inc/email-account-util.h
Project-Files/modules/account/inc/email-account.h
Project-Files/modules/account/src/email-account-folder.c
Project-Files/modules/account/src/email-account-list-view.c
Project-Files/modules/account/src/email-account-util.c
Project-Files/modules/account/src/email-account.c

index 78faf00..452fa7d 100644 (file)
@@ -7,6 +7,8 @@
 .buildpath
 .sdb.devicemap
 .package-stamp
+.cproject
+.project
 .sign/
 CMakeCache.txt
 CMakeFiles/
index c47e8e1..c6b2372 100644 (file)
@@ -40,7 +40,7 @@ char *account_get_user_email_address(int account_id);
 
 Evas_Object *account_create_entry_popup(EmailAccountUGD *ug_data, email_string_t t_title,
                const char *entry_text, const char *entry_selection_text,
-               Evas_Smart_Cb _back_response_cb, Evas_Object_Event_Cb _mouse_up_response_cb, Evas_Smart_Cb _done_key_cb,
+               Evas_Smart_Cb _back_response_cb, Evas_Smart_Cb _done_key_cb,
                Evas_Smart_Cb btn1_response_cb, const char *btn1_text, Evas_Smart_Cb btn2_response_cb, const char *btn2_text);
 
 char *account_get_ellipsised_folder_name(EmailAccountUGD *ug_data, char *org_filename);
index 37e3893..03c542f 100644 (file)
@@ -250,7 +250,6 @@ void account_gdbus_event_account_receive(GDBusConnection *connection,
                                                                                        gpointer data);
 
 void account_show_all_folder(EmailAccountUGD *ug_data);
-Evas_Object *account_create_account_color_bar(Evas_Object *parent, unsigned int color);
 
 #endif /* __EMAIL_ACCOUNT_H__ */
 
index 4387946..8284109 100644 (file)
@@ -60,9 +60,6 @@ static void _update_folder_view_after_folder_action(void *data);
 static void _update_folder_list_after_folder_delete_action(void *data, int action_type, int mailbox_id, bool show_success_popup);
 static void _update_folder_list_after_folder_action(void *data, int action_type, int mailbox_id, bool show_success_popup);
 
-static void _mouseup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _folder_popup_mouseup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-
 static void _add_root_item_in_genlist(void *data);
 static void _gl_root_item_del(void *data, Evas_Object *obj);
 static char *_gl_label_get_for_root_item(void *data, Evas_Object *obj, const char *part);
@@ -1906,7 +1903,6 @@ static void _popup_delfolder_cb(void *data, Evas_Object *obj, void *event_info)
                elm_object_part_content_set(popup, "button1", btn1);
                evas_object_smart_callback_add(btn1, "clicked", _popup_destroy_cb, ug_data);
                ug_data->popup = popup;
-               evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, _mouseup_cb, ug_data);
                evas_object_show(popup);
        } else {
                ug_data->folder_mode = ACC_FOLDER_DELETE;
@@ -1932,8 +1928,6 @@ static void _popup_delfolder_cb(void *data, Evas_Object *obj, void *event_info)
                evas_object_smart_callback_add(btn2, "clicked", _delete_con_cb, ug_data);
 
                ug_data->popup = notify;
-               evas_object_event_callback_add(notify, EVAS_CALLBACK_MOUSE_UP, _folder_popup_mouseup_cb, ug_data);
-
                evas_object_show(notify);
        }
 }
@@ -1953,7 +1947,7 @@ static void _popup_renamefolder_cb(void *data, Evas_Object *obj, void *event_inf
 
        email_string_t EMAIL_ACCOUNT_HEADER_RENAME_FOLDER = { PACKAGE, "IDS_EMAIL_OPT_RENAME_FOLDER"};
        account_create_entry_popup(ug_data, EMAIL_ACCOUNT_HEADER_RENAME_FOLDER, prev_folder_name, NULL,
-                       _rename_folder_cancel_cb, _mouseup_cb, _rename_folder_ok_cb,
+                       _rename_folder_cancel_cb, _rename_folder_ok_cb,
                        _rename_folder_cancel_cb, "IDS_EMAIL_BUTTON_CANCEL",
                        _rename_folder_ok_cb, "IDS_EMAIL_BUTTON_RENAME_ABB");
        FREE(prev_folder_name);
@@ -2089,7 +2083,7 @@ static void _popup_newfolder_cb(void *data, Evas_Object *obj, void *event_info)
 
        email_string_t EMAIL_ACCOUNT_HEADER_CREATE_FOLDER = { PACKAGE, "IDS_EMAIL_OPT_CREATE_FOLDER_ABB2"};
        account_create_entry_popup(ug_data, EMAIL_ACCOUNT_HEADER_CREATE_FOLDER, NULL, NULL,
-                       _create_folder_popup_cancel_cb, _mouseup_cb, _create_folder_ok_cb,
+                       _create_folder_popup_cancel_cb, _create_folder_ok_cb,
                        _create_folder_popup_cancel_cb, "IDS_EMAIL_BUTTON_CANCEL",
                        _create_folder_ok_cb, "IDS_EMAIL_BUTTON_CREATE_ABB2");
 }
@@ -2302,33 +2296,6 @@ static void _popup_progress_cb(void *data, Evas_Object *obj, void *event_info)
        evas_object_show(popup);
 }
 
-static void _mouseup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
-       Evas_Event_Mouse_Up *ev = event_info;
-       if (ev->button == 3) { /* if mouse right button is up */
-               _popup_destroy_cb(data, obj, NULL);
-       }
-}
-
-static void _folder_popup_mouseup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
-       Evas_Event_Mouse_Up *ev = event_info;
-       if (ev->button == 3) { /* if mouse right button is up */
-               _back_button_cb(data, obj, NULL);
-       }
-}
-
-/*
-static void _folder_progress_popup_mouseup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
-       Evas_Event_Mouse_Up *ev = event_info;
-       if (ev->button == 3) // if mouse right button is up
-       {
-               _cancel_button_cb(data, obj, NULL);
-       }
-}
-*/
-
 static void _add_root_item_in_genlist(void *data)
 {
        debug_enter();
@@ -2399,7 +2366,7 @@ void account_folder_newfolder(void *data, Evas_Object *obj, void *event_info)
 
        email_string_t EMAIL_ACCOUNT_HEADER_CREATE_FOLDER = { PACKAGE, "IDS_EMAIL_OPT_CREATE_FOLDER_ABB2"};
        account_create_entry_popup(ug_data, EMAIL_ACCOUNT_HEADER_CREATE_FOLDER, NULL, NULL,
-                       _create_folder_popup_cancel_cb, _mouseup_cb, _create_folder_ok_cb,
+                       _create_folder_popup_cancel_cb, _create_folder_ok_cb,
                        _create_folder_popup_cancel_cb, "IDS_EMAIL_BUTTON_CANCEL",
                        _create_folder_ok_cb, "IDS_EMAIL_BUTTON_CREATE_ABB2");
 }
index e8677cd..4424fe6 100644 (file)
@@ -82,6 +82,7 @@ static char *_get_account_item_text_for_single_subitem(Account_Item_Data *item_d
 static void _check_account_list_zoom_state(EmailAccountUGD *ug_data);
 static int _convert_account_list_item_type(EmailAccountUGD *ug_data, int account_id, int mailbox_type);
 static char *_create_account_list_item_text(Account_Item_Data *item_data, const char *text);
+static Evas_Object *_create_account_subitem_color_bar(Evas_Object *parent, unsigned int color);
 
 int account_create_account_list_view(EmailAccountUGD *ug_data)
 {
@@ -509,7 +510,7 @@ static Evas_Object *_gl_account_content_get_for_single_subitem(void *data, Evas_
                evas_object_size_hint_align_set(full_item_ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
                int account_color = account_color_list_get_account_color(item_data->ug_data, item_data->account_id);
-               Evas_Object *color_bar = account_create_account_color_bar(full_item_ly, account_color);
+               Evas_Object *color_bar = _create_account_subitem_color_bar(full_item_ly, account_color);
                elm_object_part_content_set(full_item_ly, "elm.swallow.icon", color_bar);
 
                elm_object_part_text_set(full_item_ly, "elm.text", _get_account_item_text_for_single_subitem(item_data));
@@ -574,6 +575,19 @@ static void  _gl_account_group_list_item_sel(void *data, Evas_Object *obj, void
        debug_leave();
 }
 
+static Evas_Object *_create_account_subitem_color_bar(Evas_Object *parent, unsigned int color)
+{
+       Evas_Object *color_bar = evas_object_rectangle_add(evas_object_evas_get(parent));
+       int r = R_MASKING(color);
+       int g = G_MASKING(color);
+       int b = B_MASKING(color);
+       int a = A_MASKING(color);
+
+       evas_object_size_hint_fill_set(color_bar, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_color_set(color_bar, r, g, b, a);
+       return color_bar;
+}
+
 static char *_create_account_list_item_text(Account_Item_Data *item_data, const char *text)
 {
        int account_item_type = _convert_account_list_item_type(item_data->ug_data,
index 77c4ba1..93a4c08 100644 (file)
@@ -336,7 +336,7 @@ char *account_get_user_email_address(int account_id)
 
 Evas_Object *account_create_entry_popup(EmailAccountUGD *ug_data, email_string_t t_title,
                const char *entry_text, const char *entry_selection_text,
-               Evas_Smart_Cb _back_response_cb, Evas_Object_Event_Cb _mouse_up_response_cb, Evas_Smart_Cb _done_key_cb,
+               Evas_Smart_Cb _back_response_cb, Evas_Smart_Cb _done_key_cb,
                Evas_Smart_Cb btn1_response_cb, const char *btn1_text, Evas_Smart_Cb btn2_response_cb, const char *btn2_text)
 {
        debug_enter();
@@ -356,8 +356,8 @@ Evas_Object *account_create_entry_popup(EmailAccountUGD *ug_data, email_string_t
                ug_data->popup = NULL;
        }
 
-       if (!_back_response_cb || !_mouse_up_response_cb || !_done_key_cb) {
-               debug_log("_response_cb or _mouse_up_response_cb or _done_key_cb is NULL");
+       if (!_back_response_cb || !_done_key_cb) {
+               debug_log("_response_cb or _done_key_cb is NULL");
                return NULL;
        }
 
@@ -457,9 +457,7 @@ Evas_Object *account_create_entry_popup(EmailAccountUGD *ug_data, email_string_t
        ug_data->popup = popup;
        ug_data->popup_ok_btn = btn2;
 
-       evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, _mouse_up_response_cb, ug_data);
        elm_object_focus_set(editfield.entry, EINA_TRUE);
-
        _register_entry_popup_rot_callback(popup, ug_data, t_title.id);
 
        return popup;
index c2080ed..2bdfc56 100644 (file)
@@ -398,20 +398,16 @@ int _create_fullview(EmailAccountUGD *ug_data)
        ug_data->base.content = elm_layout_add(ug_data->base.module->win);
        elm_layout_theme_set(ug_data->base.content, "layout", "application", "default");
        evas_object_size_hint_weight_set(ug_data->base.content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       /*elm_win_resize_object_add(ug_data->win, ug_data->navi_content);*/
+       email_module_view_push(&ug_data->base, NULL, 0);
 
        debug_log("folder_view_mode %d", ug_data->folder_view_mode);
-
        if (ug_data->folder_view_mode == ACC_FOLDER_MOVE_MAIL_VIEW_MODE) {
-               email_module_view_push(&ug_data->base, NULL, 0);
                elm_object_item_domain_translatable_text_set(ug_data->base.navi_item, PACKAGE, "IDS_EMAIL_HEADER_SELECT_FOLDER_ABB2");
        } else if (ug_data->folder_view_mode == ACC_FOLDER_ACCOUNT_LIST_VIEW_MODE) {
-               email_module_view_push(&ug_data->base, NULL, 0);
                elm_object_item_domain_translatable_text_set(ug_data->base.navi_item, PACKAGE, "IDS_EMAIL_HEADER_MAILBOX_ABB");
                ug_data->more_btn = _create_title_btn(ug_data->base.module->navi, NULL, _account_more_clicked_cb, ug_data);
                elm_object_item_part_content_set(ug_data->base.navi_item, "toolbar_more_btn", ug_data->more_btn);
        } else {
-               email_module_view_push(&ug_data->base, NULL, 0);
                ug_data->more_btn = _create_title_btn(ug_data->base.module->navi, NULL, _account_more_clicked_cb, ug_data);
                elm_object_item_part_content_set(ug_data->base.navi_item, "toolbar_more_btn", ug_data->more_btn);
 
@@ -954,18 +950,4 @@ static int _get_accounts_data(int *account_count, email_account_t **account_list
 
        return 0;
 }
-
-Evas_Object *account_create_account_color_bar(Evas_Object *parent, unsigned int color)
-{
-       Evas_Object *color_bar = evas_object_rectangle_add(evas_object_evas_get(parent));
-       int r = R_MASKING(color);
-       int g = G_MASKING(color);
-       int b = B_MASKING(color);
-       int a = A_MASKING(color);
-
-       evas_object_size_hint_fill_set(color_bar, EVAS_HINT_FILL, EVAS_HINT_FILL);
-       evas_object_color_set(color_bar, r, g, b, a);
-       return color_bar;
-}
-
 /* EOF */