yakov pushed a commit to branch master. http://git.enlightenment.org/tools/erigo.git/commit/?id=74a9fe83236d64645741f82f2132dace5bb91cfe
commit 74a9fe83236d64645741f82f2132dace5bb91cfe Author: Yakov Goldberg <yako...@samsung.com> Date: Tue Nov 17 15:39:03 2015 +0200 Refactoring project closure functions... ... in order to implement popup window for not saved projects. --- src/bin/gui/egui_logic.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/bin/gui/egui_logic.c b/src/bin/gui/egui_logic.c index 02a1a40..045c836 100644 --- a/src/bin/gui/egui_logic.c +++ b/src/bin/gui/egui_logic.c @@ -103,15 +103,37 @@ _context_toolbar_item_delete(const Gui_Context *ctx) } } +/* Wrapper to handle project closure and appropriate UI changes. */ +static void +_project_close_internal(Gui_Context *ctx) +{ + _guilogic_cbs->_project_close(ctx); + _active_context_set(NULL); + _context_toolbar_item_delete(ctx); +} + +/* Wrapper to handle project closure and allow to show popup window for not saved project. */ +static void +project_close(Gui_Context *ctx, Eina_Bool erigo_close) +{ + if (context_current_memento_get(ctx) == context_saved_memento_get(ctx)) + { + _project_close_internal(ctx); + } + else + { + ERR("show popup"); + _project_close_internal(ctx); + } +} + static void _main_win_del_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { Gui_Context *close_ctx = _active_context_get(); while ((close_ctx = _active_context_get())) { - _guilogic_cbs->_project_close(close_ctx); - _active_context_set(NULL); - _context_toolbar_item_delete(close_ctx); + project_close(close_ctx); } printf("win del\n"); @@ -551,9 +573,7 @@ _project_menu_item_sel_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_ case ITEM_CLOSE: { Gui_Context *close_ctx = _active_context_get(); - _guilogic_cbs->_project_close(close_ctx); - _active_context_set(NULL); - _context_toolbar_item_delete(close_ctx); + project_close(close_ctx); _canvas_name_update(_active_context_get(), EINA_FALSE); _menu_item_disabled_set(project_menu, ITEM_OPEN, EINA_FALSE); --