rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=f696147dfa586f526298b60ce85f568bd0259d49

commit f696147dfa586f526298b60ce85f568bd0259d49
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Mon Sep 26 19:52:47 2016 +0300

    project_manager: show error while deleting folder that contain opened groups
    
    if group opened in tab, we need to find it and say that it is opened
    
    @fix
---
 src/bin/ui/project_navigator.c | 46 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 40 insertions(+), 6 deletions(-)

diff --git a/src/bin/ui/project_navigator.c b/src/bin/ui/project_navigator.c
index 833c5c0..d273d79 100644
--- a/src/bin/ui/project_navigator.c
+++ b/src/bin/ui/project_navigator.c
@@ -492,6 +492,29 @@ _btn_add_group_cb(void *data __UNUSED__,
    evas_object_smart_callback_add(popup, POPUP_CLOSE_CB, 
_add_group_popup_close_cb, NULL);
 }
 
+static Eina_Bool
+_folder_check(const char *prefix, Eina_Bool del)
+{
+   Eina_List *folders = NULL, *groups = NULL;
+   Eina_Stringshare *tmp;
+   Group2 *group;
+   Eina_Bool del_inside = del;
+
+   widget_tree_items_get(ap.project->RM.groups, prefix, &folders, &groups);
+   EINA_LIST_FREE(folders, tmp)
+     {
+        del_inside = _folder_check(tmp, del);
+     }
+
+   EINA_LIST_FREE(groups, group)
+     {
+        if (group->edit_object)
+          del_inside = false;
+     }
+
+   return del_inside;
+}
+
 static void
 _folder_del(const char *prefix)
 {
@@ -504,7 +527,6 @@ _folder_del(const char *prefix)
      {
        _folder_del(tmp);
      }
-
    EINA_LIST_FREE(groups, group)
      {
         tmp = eina_stringshare_add(group->common.name);
@@ -627,11 +649,23 @@ _btn_del_group_cb(void *data __UNUSED__,
    glit = elm_genlist_selected_item_get(project_navigator.genlist);
    if (elm_genlist_item_type_get(glit) == ELM_GENLIST_ITEM_TREE)
      {
-        popup = popup_add(_("Confirm delete layouts"),
-                          _("Are you sure you want to delete the selected 
layouts?<br>"
-                            "All aliases will be delete too."),
-                          BTN_OK|BTN_CANCEL, NULL, NULL);
-        evas_object_smart_callback_add(popup, POPUP_CLOSE_CB, 
_folder_del_popup_close_cb, glit);
+        const char *prefix = (const char *)elm_object_item_data_get(glit);
+        if (!_folder_check(prefix, true))
+          {
+             popup_add(_("Warning: Delete layout"),
+                       _("Cann't delete one of those opened layouts. Please, "
+                         "close the layout tab before delete it."),
+                       BTN_CANCEL, NULL, NULL);
+             return;
+          }
+        else
+          {
+             popup = popup_add(_("Confirm delete layouts"),
+                               _("Are you sure you want to delete the selected 
layouts?<br>"
+                                 "All aliases will be delete too."),
+                               BTN_OK|BTN_CANCEL, NULL, NULL);
+             evas_object_smart_callback_add(popup, POPUP_CLOSE_CB, 
_folder_del_popup_close_cb, glit);
+          }
      }
    else
      {

-- 


Reply via email to