diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-05-20 09:52:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-20 09:52:49 +0300 |
commit | f606f588455ef6909b98a35839ee6eb0eda6516d (patch) | |
tree | 56226c3ae7bcf87995eda8a600dd9eb36bcabfec /source/blender/windowmanager/intern/wm_files.c | |
parent | 3184460ff7f4f660a70ec7a18a3a882eb2de57f8 (diff) |
Cleanup: add wm_utils.c for generic functions
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index fd193225a49..d91f30d6945 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -2855,7 +2855,7 @@ static void wm_block_file_close_cancel(bContext *C, void *arg_block, void *UNUSE static void wm_block_file_close_discard(bContext *C, void *arg_block, void *arg_data) { - wmGenericCallback *callback = wm_generic_callback_steal((wmGenericCallback *)arg_data); + wmGenericCallback *callback = WM_generic_callback_steal((wmGenericCallback *)arg_data); /* Close the popup before executing the callback. Otherwise * the popup might be closed by the callback, which will lead @@ -2864,12 +2864,12 @@ static void wm_block_file_close_discard(bContext *C, void *arg_block, void *arg_ UI_popup_block_close(C, win, arg_block); callback->exec(C, callback->user_data); - wm_generic_callback_free(callback); + WM_generic_callback_free(callback); } static void wm_block_file_close_save(bContext *C, void *arg_block, void *arg_data) { - wmGenericCallback *callback = wm_generic_callback_steal((wmGenericCallback *)arg_data); + wmGenericCallback *callback = WM_generic_callback_steal((wmGenericCallback *)arg_data); bool execute_callback = true; wmWindow *win = CTX_wm_window(C); @@ -2897,7 +2897,7 @@ static void wm_block_file_close_save(bContext *C, void *arg_block, void *arg_dat if (execute_callback) { callback->exec(C, callback->user_data); } - wm_generic_callback_free(callback); + WM_generic_callback_free(callback); } static void wm_block_file_close_cancel_button(uiBlock *block, wmGenericCallback *post_action) @@ -3039,7 +3039,7 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C, struct ARegi static void free_post_file_close_action(void *arg) { wmGenericCallback *action = (wmGenericCallback *)arg; - wm_generic_callback_free(action); + WM_generic_callback_free(action); } void wm_close_file_dialog(bContext *C, wmGenericCallback *post_action) @@ -3054,25 +3054,4 @@ bool wm_file_or_image_is_modified(const bContext *C) return !wm->file_saved || ED_image_should_save_modified(C); } -void wm_generic_callback_free(wmGenericCallback *callback) -{ - if (callback->free_user_data) { - callback->free_user_data(callback->user_data); - } - MEM_freeN(callback); -} - -static void do_nothing(bContext *UNUSED(C), void *UNUSED(user_data)) -{ -} - -wmGenericCallback *wm_generic_callback_steal(wmGenericCallback *callback) -{ - wmGenericCallback *new_callback = MEM_dupallocN(callback); - callback->exec = do_nothing; - callback->free_user_data = NULL; - callback->user_data = NULL; - return new_callback; -} - /** \} */ |