rimmed pushed a commit to branch master.

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

commit 96f9b553d39459d7ed3f4e6b51bb11306c64e19a
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Thu Jul 9 12:07:57 2015 +0300

    connector: allow to delete last group in the project
---
 src/bin/ui/connector.c | 96 +++-----------------------------------------------
 1 file changed, 5 insertions(+), 91 deletions(-)

diff --git a/src/bin/ui/connector.c b/src/bin/ui/connector.c
index ca34273..643a1e7 100644
--- a/src/bin/ui/connector.c
+++ b/src/bin/ui/connector.c
@@ -1498,71 +1498,11 @@ _project_close_request(App_Data *ap, Eina_Bool changed)
 }
 
 
/******************************************************************************/
-static Style *
-_style_with_another_object_get(Project *pro, Style *given_style)
-{
-   Widget *widget = NULL;
-   Class *class = NULL;
-   Style *another_style = NULL;
-   /* try to find layout. */
-   EINA_INLIST_FOREACH(pro->layouts, another_style)
-     {
-        if (another_style->full_group_name == given_style->full_group_name)
-          continue;
-        if (!another_style->isAlias)
-          return another_style;
-     }
-   /* try to find style */
-   EINA_INLIST_FOREACH(pro->widgets, widget)
-     {
-        EINA_INLIST_FOREACH(widget->classes, class)
-          {
-               EINA_INLIST_FOREACH(class->styles, another_style)
-                {
-                   if (another_style->full_group_name == 
given_style->full_group_name)
-                     continue;
-                   if (!another_style->isAlias)
-                     return another_style;
-                }
-          }
-     }
-   return NULL;
-}
-
-static Style *
-_style_from_another_class_with_another_object_get(Project *pro, Class 
*given_class)
-{
-   Widget *widget = NULL;
-   Class *class = NULL;
-   Style *another_style = NULL;
-   /* try to find layout. */
-   EINA_INLIST_FOREACH(pro->layouts, another_style)
-     {
-        if (!another_style->isAlias)
-          return another_style;
-     }
-   /* try to find style */
-   EINA_INLIST_FOREACH(pro->widgets, widget)
-     {
-        EINA_INLIST_FOREACH(widget->classes, class)
-          {
-             if (class->name != given_class->name)
-               {
-                  EINA_INLIST_FOREACH(class->styles, another_style)
-                    return another_style;
-               }
-          }
-     }
-   return NULL;
-}
-
-
 static Eina_Bool
 _selected_layout_delete(Evas_Object *genlist, App_Data *ap)
 {
    Elm_Object_Item *item_to_del = elm_genlist_selected_item_get(genlist), *eoi;
    Style *style = elm_object_item_data_get(item_to_del);;
-   Style *style_work = NULL;
    int i;
 
    if (!item_to_del)
@@ -1583,17 +1523,9 @@ _selected_layout_delete(Evas_Object *genlist, App_Data 
*ap)
         i--;
      }
 
-   style_work = _style_with_another_object_get(ap->project, style);
-
-   if (!style_work)
-     {
-        NOTIFY_INFO(3, _("Can not delete last layout"));
-        return false;
-     }
-
-   pm_save_to_dev(ap->project, style_work, true);
+   pm_save_to_dev(ap->project, NULL, true);
    evas_object_del(style->obj);
-   if (!edje_edit_group_del(style_work->obj, style->full_group_name))
+   if (!edje_edit_group_del(ap->project->global_object, 
style->full_group_name))
      {
         NOTIFY_INFO(3, _("Failed to delete layout[%s]"),
                     style->name);
@@ -1627,7 +1559,6 @@ _selected_style_delete(Evas_Object *genlist, App_Data *ap)
    Class *class_st = NULL;
    Style *style = NULL;
    Style *alias_style = NULL;
-   Style *style_work = NULL;
 
    Elm_Object_Item *eoi = elm_genlist_selected_item_get(genlist);
    Eina_List *l = NULL;
@@ -1649,17 +1580,6 @@ _selected_style_delete(Evas_Object *genlist, App_Data 
*ap)
 
    if (class_st->__type != CLASS) return false;
 
-   if (style)
-     style_work = _style_with_another_object_get(ap->project, style);
-   else
-     style_work = 
_style_from_another_class_with_another_object_get(ap->project, class_st);
-
-   if (!style_work)
-     {
-        ERR("Failed search style object from another class");
-        return false;
-     }
-
    if (style) /* Deleting style */
      {
         Evas_Object *st_cur = style->obj;
@@ -1680,9 +1600,9 @@ _selected_style_delete(Evas_Object *genlist, App_Data *ap)
                 wm_style_free(alias_style);
           }
          /*Delete loaded object for unlock group in edj file*/
-        pm_save_to_dev(ap->project, style_work, true);
+        pm_save_to_dev(ap->project, NULL, true);
         evas_object_del(style->obj);
-        if (!edje_edit_group_del(style_work->obj, style->full_group_name))
+        if (!edje_edit_group_del(ap->project->global_object, 
style->full_group_name))
           {
              NOTIFY_INFO(3, _("Failed to delete style[%s]"), style->name);
              return false;
@@ -1699,7 +1619,7 @@ _selected_style_delete(Evas_Object *genlist, App_Data *ap)
         EINA_INLIST_FOREACH_SAFE(class_st->styles, l, style)
           {
              evas_object_del(style->obj);
-             if (!edje_edit_group_del(style_work->obj, style->full_group_name))
+             if (!edje_edit_group_del(ap->project->global_object, 
style->full_group_name))
                NOTIFY_INFO(3, _("Failed to delete style[%s] in class [%s]"),
                            style->name, class_st->name);
           }
@@ -1736,12 +1656,6 @@ ui_group_delete(App_Data *ap, Type group_type)
    Elm_Object_Item *eoi = elm_genlist_selected_item_get(gl_groups);
    if (!eoi)
      return true;
-   /* Checking number of groups */
-   Eina_List *groups = edje_file_collection_list(ap->project->dev);
-   unsigned int count = eina_list_count(groups);
-   edje_file_collection_list_free(groups);
-   if (count == 1)
-     return false;
 
    if (group_type != LAYOUT)
      return _selected_style_delete(gl_groups, ap);

-- 


Reply via email to