rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=cbcd5bc6c2f47127a4a727a5557d740abb23bb76
commit cbcd5bc6c2f47127a4a727a5557d740abb23bb76 Author: Vyacheslav Reutskiy <[email protected]> Date: Tue Oct 13 10:52:03 2015 +0300 popup: use the Helper_Done_Cb instead Evas_Smart_Cb Change-Id: I3d617fd7f1edf1c70a9e53e64416ebc6f73f6b2a --- src/bin/ui/main_window.h | 19 ++++++++++++++++--- src/bin/ui/popup.c | 23 ++++++++++++++--------- src/bin/ui/tab_home_common.c | 3 ++- src/bin/ui/tabs_private.h | 2 +- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/bin/ui/main_window.h b/src/bin/ui/main_window.h index 8ab1d99..50340a7 100644 --- a/src/bin/ui/main_window.h +++ b/src/bin/ui/main_window.h @@ -104,6 +104,19 @@ extern int MENU_ITEMS_LIST_TEMPORARY[]; */ typedef Eina_Bool(* Popup_Validator_Func)(void *data); +/** + * The fileselector helper callback. + * + * @param data The user data; + * @param obj The fileselector from helper; + * @param event_info The eina_list with the selected paths. + * + * @return EINA_TRUE if all good and you happy, overwise all bad EINA_FALSE. + * + * @ingroup Window + */ +typedef Eina_Bool(* Helper_Done_Cb)(void *data, Evas_Object *obj, void *event_info); + #define POPUP_BUTTON_MASK 0xf typedef enum _Popup_Button { @@ -416,17 +429,17 @@ popup_buttons_disabled_set(Popup_Button p_btns, Eina_Bool disabled); void popup_fileselector_folder_helper(const char *title, Evas_Object *follow_up, const char *path, - Evas_Smart_Cb func, void *data, + Helper_Done_Cb func, void *data, Eina_Bool multi, Eina_Bool is_save); void popup_fileselector_edj_helper(const char *title, Evas_Object *follow_up, const char *path, - Evas_Smart_Cb func, void *data, + Helper_Done_Cb func, void *data, Eina_Bool multi, Eina_Bool is_save); void popup_fileselector_edc_helper(const char *title, Evas_Object *follow_up, const char *path, - Evas_Smart_Cb func, void *data, + Helper_Done_Cb func, void *data, Eina_Bool multi, Eina_Bool is_save); void diff --git a/src/bin/ui/popup.c b/src/bin/ui/popup.c index dfd4f8d..06d477f 100644 --- a/src/bin/ui/popup.c +++ b/src/bin/ui/popup.c @@ -23,7 +23,7 @@ static Popup_Button btn_pressed; static Evas_Object *popup; static Evas_Object *helper; static Evas_Object *fs; -static Evas_Smart_Cb dismiss_func; +static Helper_Done_Cb dismiss_func; static void* func_data; static const Popup_Button _btn_ok = BTN_OK; @@ -140,6 +140,7 @@ _done(void *data __UNUSED__, { Eina_List *selected_paths = NULL; Eina_Stringshare *selected; + Eina_Bool res = true; if (dismiss_func) { @@ -155,12 +156,16 @@ _done(void *data __UNUSED__, selected = elm_fileselector_path_get(fs); selected_paths = eina_list_append(selected_paths, selected); } - ((Evas_Smart_Cb)dismiss_func)(func_data, obj, selected_paths); + res = ((Helper_Done_Cb)dismiss_func)(func_data, obj, selected_paths); } + eina_list_free(selected_paths); - dismiss_func = NULL; - func_data = NULL; - _helper_dismiss(NULL, NULL, data, NULL); + if (res) + { + dismiss_func = NULL; + func_data = NULL; + _helper_dismiss(NULL, NULL, data, NULL); + } } #define FS_W 430 @@ -200,7 +205,7 @@ _fileselector_helper(const char *title, const char *path, Eina_Bool multi, Eina_Bool is_save, - Evas_Smart_Cb func, + Helper_Done_Cb func, void *data, Elm_Fileselector_Filter_Func filter_cb) { @@ -258,7 +263,7 @@ _fileselector_helper(const char *title, void popup_fileselector_folder_helper(const char *title, Evas_Object *follow_up, const char *path, - Evas_Smart_Cb func, void *data, + Helper_Done_Cb func, void *data, Eina_Bool multi, Eina_Bool is_save) { _fileselector_helper(title, follow_up, path, multi, is_save, func, data, NULL); @@ -278,7 +283,7 @@ _edj_filter(const char *path, void popup_fileselector_edj_helper(const char *title, Evas_Object *follow_up, const char *path, - Evas_Smart_Cb func, void *data, + Helper_Done_Cb func, void *data, Eina_Bool multi, Eina_Bool is_save) { _fileselector_helper(title, follow_up, path, multi, is_save, func, data, _edj_filter); @@ -298,7 +303,7 @@ _edc_filter(const char *path, void popup_fileselector_edc_helper(const char *title, Evas_Object *follow_up, const char *path, - Evas_Smart_Cb func, void *data, + Helper_Done_Cb func, void *data, Eina_Bool multi, Eina_Bool is_save) { _fileselector_helper(title, follow_up, path, multi, is_save, func, data, _edc_filter); diff --git a/src/bin/ui/tab_home_common.c b/src/bin/ui/tab_home_common.c index ed835c9..05c384f 100644 --- a/src/bin/ui/tab_home_common.c +++ b/src/bin/ui/tab_home_common.c @@ -75,7 +75,7 @@ elipsis_btn_add(Evas_Object *entry, Evas_Smart_Cb cb_func, void *data) elm_object_part_content_set(entry, "elm.swallow.elipsis", bt); } -void +Eina_Bool entry_path_set(void *data, Evas_Object *obj __UNUSED__, void *event_info) @@ -84,6 +84,7 @@ entry_path_set(void *data, Eina_List *selected = (Eina_List *)event_info; elm_entry_entry_set(entry, eina_list_data_get(selected)); + return true; } void diff --git a/src/bin/ui/tabs_private.h b/src/bin/ui/tabs_private.h index fd8f892..33ca19a 100644 --- a/src/bin/ui/tabs_private.h +++ b/src/bin/ui/tabs_private.h @@ -61,7 +61,7 @@ _tab_project_info_add(void); void elipsis_btn_add(Evas_Object *entry, Evas_Smart_Cb cb_func, void *data); -void +Eina_Bool entry_path_set(void *data, Evas_Object *obj, void *event_info); void --
