rimmed pushed a commit to branch eflete-1.18. http://git.enlightenment.org/tools/eflete.git/commit/?id=5d9629118485cad4a07ddb202e703762ad780afc
commit 5d9629118485cad4a07ddb202e703762ad780afc Author: Andrii Kroitor <an.kroi...@samsung.com> Date: Mon Sep 5 18:02:09 2016 +0300 fileselector_helper: prepare code for async popup --- src/bin/ui/main_window.h | 3 ++ src/bin/ui/popup.c | 20 ++++++++ src/bin/ui/project_common.c | 6 ++- src/bin/ui/project_common.h | 2 +- src/bin/ui/project_export.c | 101 +++++++++++++++++++++++---------------- src/bin/ui/tab_home_import_edc.c | 25 ++++++---- src/bin/ui/tab_home_import_edj.c | 24 ++++++---- src/bin/ui/tab_home_new.c | 26 +++++----- 8 files changed, 133 insertions(+), 74 deletions(-) diff --git a/src/bin/ui/main_window.h b/src/bin/ui/main_window.h index 6e37458..6839e4b 100644 --- a/src/bin/ui/main_window.h +++ b/src/bin/ui/main_window.h @@ -377,6 +377,9 @@ void popup_button_disabled_set(Evas_Object *popup, Popup_Button btn, Eina_Bool disabled); void +popup_fileselector_helper_dismiss(); + +void popup_fileselector_folder_helper(const char *title, Evas_Object *follow_up, const char *path, Helper_Done_Cb func, void *data, Eina_Bool multi, Eina_Bool is_save); diff --git a/src/bin/ui/popup.c b/src/bin/ui/popup.c index 536d771..39e0fab 100644 --- a/src/bin/ui/popup.c +++ b/src/bin/ui/popup.c @@ -481,6 +481,26 @@ _colorclass_done(void *data, } #endif +void +popup_fileselector_helper_dismiss() +{ + Evas_Object *follow_up = (Evas_Object *) helper; + + evas_object_event_callback_del_full(follow_up, EVAS_CALLBACK_RESIZE, _helper_obj_follow, NULL); + evas_object_event_callback_del_full(follow_up, EVAS_CALLBACK_MOVE, _helper_obj_follow, NULL); + evas_object_event_callback_del_full(follow_up, EVAS_CALLBACK_RESIZE, _helper_property_follow, NULL); + evas_object_event_callback_del_full(follow_up, EVAS_CALLBACK_MOVE, _helper_property_follow, NULL); + + if (!follow_up) + evas_object_event_callback_del_full(ap.win, EVAS_CALLBACK_RESIZE, _helper_win_follow, NULL); + + Helper_Data *helper_data = evas_object_data_get(helper, "STRUCT"); + if (helper_data) free(helper_data); + + shortcuts_object_check_pop(helper); + ecore_job_add(_delete_object_job, helper); +} + static void _helper_dismiss(void *data __UNUSED__, Evas_Object *obj, diff --git a/src/bin/ui/project_common.c b/src/bin/ui/project_common.c index 5c41351..24b12f5 100644 --- a/src/bin/ui/project_common.c +++ b/src/bin/ui/project_common.c @@ -22,7 +22,9 @@ Eina_Bool exist_permission_check(const char *path, const char *name, - const char *title, const char *msg, Eina_Bool append) + const char *title, const char *msg, Eina_Bool append, + Ecore_Cb func, + const void *data) { Eina_Strbuf *buf, *buf_msg; Popup_Button btn_res; @@ -61,6 +63,8 @@ exist_permission_check(const char *path, const char *name, } if (btn_res == BTN_REPLACE) ecore_file_recursive_rm(eina_strbuf_string_get(buf)); + if (func) + func((void *)data); eina_strbuf_free(buf); return true; } diff --git a/src/bin/ui/project_common.h b/src/bin/ui/project_common.h index c5c211a..a5a115a 100644 --- a/src/bin/ui/project_common.h +++ b/src/bin/ui/project_common.h @@ -21,7 +21,7 @@ #define PROJECT_COMMON_H Eina_Bool -exist_permission_check(const char *path, const char *name, const char *title, const char *msg, Eina_Bool append); +exist_permission_check(const char *path, const char *name, const char *title, const char *msg, Eina_Bool append, Ecore_Cb func, const void *data); Eina_Bool progress_print(void *data, Eina_Stringshare *progress_string); diff --git a/src/bin/ui/project_export.c b/src/bin/ui/project_export.c index 0fa37c8..1e44af2 100644 --- a/src/bin/ui/project_export.c +++ b/src/bin/ui/project_export.c @@ -40,6 +40,15 @@ _export_develop_setup(void *data, Splash_Status status __UNUSED__) return true; } +static void +_after_export_dev_check(void *data) +{ + ap.splash = splash_add(ap.win, _export_develop_setup, _export_teardown, NULL, data); + evas_object_focus_set(ap.splash, true); + evas_object_show(ap.splash); + popup_fileselector_helper_dismiss(); +} + static Eina_Bool _export_dev(void *data __UNUSED__, Evas_Object *obj, /* this is fileselector from popup */ @@ -64,19 +73,14 @@ _export_dev(void *data __UNUSED__, eina_strbuf_append_printf(buf, _("<font_size=16>A project file '%s' already exist." "Do you want to replace it?</font_size>"), path); - if (obj && !exist_permission_check(elm_fileselector_path_get(obj), - elm_fileselector_current_name_get(obj), - _("Export to develop edj-file"), - eina_strbuf_string_get(buf), EINA_TRUE)) - return false; + exist_permission_check(elm_fileselector_path_get(obj), + elm_fileselector_current_name_get(obj), + _("Export to develop edj-file"), + eina_strbuf_string_get(buf), EINA_TRUE, + _after_export_dev_check, (void *)eina_stringshare_add(path)); eina_strbuf_free(buf); - ap.splash = splash_add(ap.win, _export_develop_setup, _export_teardown, - NULL, (void *)eina_stringshare_add(path)); - evas_object_focus_set(ap.splash, true); - evas_object_show(ap.splash); - - return true; + return false; } void @@ -111,6 +115,16 @@ _export_release_setup(void *data, Splash_Status status __UNUSED__) return true; } +static void +_after_export_release_check(void *data) +{ + ap.splash = splash_add(ap.win, _export_release_setup, _export_teardown, + NULL, data); + evas_object_focus_set(ap.splash, true); + evas_object_show(ap.splash); + popup_fileselector_helper_dismiss(); +} + static Eina_Bool _export_release(void *data __UNUSED__, Evas_Object *obj, /* this is fileselector from popup */ @@ -136,19 +150,14 @@ _export_release(void *data __UNUSED__, eina_strbuf_append_printf(buf, _("<font_size=16>A project file '%s' already exist." "Do you want to replace it?</font_size>"), path); - if (!exist_permission_check(elm_fileselector_path_get(obj), - elm_fileselector_current_name_get(obj), - _("Export to release edj-file"), - eina_strbuf_string_get(buf), EINA_FALSE)) - return false; + exist_permission_check(elm_fileselector_path_get(obj), + elm_fileselector_current_name_get(obj), + _("Export to release edj-file"), + eina_strbuf_string_get(buf), EINA_FALSE, + _after_export_release_check, (void *)eina_stringshare_add(path)); eina_strbuf_free(buf); - ap.splash = splash_add(ap.win, _export_release_setup, _export_teardown, - NULL, (void *)eina_stringshare_add(path)); - evas_object_focus_set(ap.splash, true); - evas_object_show(ap.splash); - - return true; + return false; } void @@ -187,6 +196,15 @@ _export_source_code_setup(void *data, Splash_Status status __UNUSED__) return true; } +static void +_after_export_source_code_check(void *data) +{ + ap.splash = splash_add(ap.win, _export_source_code_setup, _export_teardown, NULL, data); + evas_object_focus_set(ap.splash, true); + evas_object_show(ap.splash); + popup_fileselector_helper_dismiss(); +} + static Eina_Bool _export_source_code(void *data __UNUSED__, Evas_Object *obj __UNUSED__, /* this is fileselector from popup */ @@ -210,18 +228,14 @@ _export_source_code(void *data __UNUSED__, "Do you want to replace it?</font_size>"), path, folder); - if (!exist_permission_check(path, - folder, - _("Export to develop edj-file"), - eina_strbuf_string_get(buf), EINA_FALSE)) - return false; + exist_permission_check(path, + folder, + _("Export to develop edj-file"), + eina_strbuf_string_get(buf), EINA_FALSE, + _after_export_source_code_check, (void *)path); eina_strbuf_free(buf); - ap.splash = splash_add(ap.win, _export_source_code_setup, _export_teardown, NULL, (void *)path); - evas_object_focus_set(ap.splash, true); - evas_object_show(ap.splash); - - return true; + return false; } void @@ -254,6 +268,15 @@ _export_group_source_code_setup(void *data, Splash_Status status __UNUSED__) return true; } +static void +_after_group_source_check(void *data) +{ + ap.splash = splash_add(ap.win, _export_group_source_code_setup, _export_teardown, NULL, data); + evas_object_focus_set(ap.splash, true); + evas_object_show(ap.splash); + popup_fileselector_helper_dismiss(); +} + static Eina_Bool _export_group_source_code(void *data __UNUSED__, Evas_Object *obj __UNUSED__, /* this is fileselector from popup */ @@ -277,18 +300,14 @@ _export_group_source_code(void *data __UNUSED__, _("<font_size=16>A project file '%s/%s' already exist." "Do you want to replace it?</font_size>"), path, name); - if (!exist_permission_check(path, name, - _("Export group source code"), - eina_strbuf_string_get(buf), EINA_FALSE)) - return false; + exist_permission_check(path, name, + _("Export group source code"), + eina_strbuf_string_get(buf), EINA_FALSE, _after_group_source_check, path); + eina_strbuf_free(buf); free(name); - ap.splash = splash_add(ap.win, _export_group_source_code_setup, _export_teardown, NULL, (void *)path); - evas_object_focus_set(ap.splash, true); - evas_object_show(ap.splash); - - return true; + return false; } void diff --git a/src/bin/ui/tab_home_import_edc.c b/src/bin/ui/tab_home_import_edc.c index b477d93..80ed101 100644 --- a/src/bin/ui/tab_home_import_edc.c +++ b/src/bin/ui/tab_home_import_edc.c @@ -412,6 +412,18 @@ _cancel_open_splash(void *data __UNUSED__, Splash_Status status __UNUSED__) } static void +_after_import_check(void *data __UNUSED__) +{ + ap.splash = splash_add(ap.win, + _setup_open_splash, + _teardown_open_splash, + _cancel_open_splash, + NULL); + elm_object_focus_set(ap.splash, true); + evas_object_show(ap.splash); +} + +static void _import(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) @@ -442,18 +454,11 @@ _import(void *data __UNUSED__, elm_entry_entry_get(tab_edc.name), elm_entry_entry_get(tab_edc.path)); - if (!exist_permission_check(elm_entry_entry_get(tab_edc.path), + exist_permission_check(elm_entry_entry_get(tab_edc.path), elm_entry_entry_get(tab_edc.name), - _("Import edc-file"), eina_strbuf_string_get(buf), EINA_FALSE)) - return; + _("Import edc-file"), eina_strbuf_string_get(buf), EINA_FALSE, + _after_import_check, NULL); eina_strbuf_free(buf); - ap.splash = splash_add(ap.win, - _setup_open_splash, - _teardown_open_splash, - _cancel_open_splash, - NULL); - elm_object_focus_set(ap.splash, true); - evas_object_show(ap.splash); } void diff --git a/src/bin/ui/tab_home_import_edj.c b/src/bin/ui/tab_home_import_edj.c index d2a1ee1..8dba3dd 100644 --- a/src/bin/ui/tab_home_import_edj.c +++ b/src/bin/ui/tab_home_import_edj.c @@ -463,6 +463,17 @@ _cancel_open_splash(void *data __UNUSED__, Splash_Status status __UNUSED__) } static void +_after_import_check(void *data __UNUSED__) +{ + ap.splash = splash_add(ap.win, + _setup_open_splash, + _teardown_open_splash, + NULL, + NULL); + elm_object_focus_set(ap.splash, true); + evas_object_show(ap.splash); +} +static void _import(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) @@ -491,18 +502,11 @@ _import(void *data __UNUSED__, elm_entry_entry_get(tab_edj.name), elm_entry_entry_get(tab_edj.path)); - if (!exist_permission_check(elm_entry_entry_get(tab_edj.path), + exist_permission_check(elm_entry_entry_get(tab_edj.path), elm_entry_entry_get(tab_edj.name), - _("Import edj-file"), eina_strbuf_string_get(buf), EINA_FALSE)) - return; + _("Import edj-file"), eina_strbuf_string_get(buf), EINA_FALSE, + _after_import_check, NULL); eina_strbuf_free(buf); - ap.splash = splash_add(ap.win, - _setup_open_splash, - _teardown_open_splash, - NULL, - NULL); - elm_object_focus_set(ap.splash, true); - evas_object_show(ap.splash); } static void diff --git a/src/bin/ui/tab_home_new.c b/src/bin/ui/tab_home_new.c index 2fe913e..e4414a5 100644 --- a/src/bin/ui/tab_home_new.c +++ b/src/bin/ui/tab_home_new.c @@ -510,6 +510,18 @@ _cancel_open_splash(void *data __UNUSED__, Splash_Status status __UNUSED__) /* TAB_HOME_NEW LAYOUT */ static void +_after_on_create_check(void *data __UNUSED__) +{ + ap.splash = splash_add(ap.win, + _setup_open_splash, + _teardown_open_splash, + _cancel_open_splash, + NULL); + elm_object_focus_set(ap.splash, true); + evas_object_show(ap.splash); + elm_check_state_set(tab_new.ch_all, false); +} +static void _on_create(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) @@ -530,19 +542,11 @@ _on_create(void *data __UNUSED__, elm_entry_entry_get(tab_new.name), elm_entry_entry_get(tab_new.path)); - if (!exist_permission_check(elm_entry_entry_get(tab_new.path), + exist_permission_check(elm_entry_entry_get(tab_new.path), elm_entry_entry_get(tab_new.name), - _("New project"), eina_strbuf_string_get(buf), EINA_FALSE)) - return; + _("New project"), eina_strbuf_string_get(buf), EINA_FALSE, + _after_on_create_check, NULL); eina_strbuf_free(buf); - ap.splash = splash_add(ap.win, - _setup_open_splash, - _teardown_open_splash, - _cancel_open_splash, - NULL); - elm_object_focus_set(ap.splash, true); - evas_object_show(ap.splash); - elm_check_state_set(tab_new.ch_all, false); } static void --