rimmed pushed a commit to branch master.

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

commit dc303dca61c07f71295a7ef870f4cb429c06945e
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Thu Mar 17 12:56:54 2016 +0200

    demo_group: update item and demo_part structure on part rename
    
    Fixes T3233
---
 src/bin/ui/tabs.c                 |  1 -
 src/bin/ui/workspace/demo_group.c | 56 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/src/bin/ui/tabs.c b/src/bin/ui/tabs.c
index c9e6620..ef49dc2 100644
--- a/src/bin/ui/tabs.c
+++ b/src/bin/ui/tabs.c
@@ -338,7 +338,6 @@ _part_renamed(void *data __UNUSED__,
    part = pm_resource_unsorted_get(tabs.current_group->parts, ren->old_name);
    gm_part_rename(part, ren->new_name);
    workspace_group_navigator_update_part(tabs.current_workspace, part);
-   TODO("update live_view here");
 }
 
 static void
diff --git a/src/bin/ui/workspace/demo_group.c 
b/src/bin/ui/workspace/demo_group.c
index b9b640d..6e0b47d 100644
--- a/src/bin/ui/workspace/demo_group.c
+++ b/src/bin/ui/workspace/demo_group.c
@@ -220,6 +220,61 @@ _content_get(void *data __UNUSED__,
    return button;
 }
 
+static void
+_part_renamed(void *data,
+              Evas_Object *obj __UNUSED__,
+              void *ei)
+{
+   Rename *ren = ei;
+   Eina_List *l;
+   Demo_Part *demo_part;
+   Part_Demo_List *pl = data;
+
+   Elm_Object_Item *part_item, *list_item = NULL;
+   const Eina_List *part_items;
+   Demo_Part *pr;
+
+   assert(ren != NULL);
+
+   EINA_LIST_FOREACH(pl->text_list, l, demo_part)
+     {
+        if (demo_part->name == ren->old_name)
+          {
+             eina_stringshare_del(demo_part->name);
+             demo_part->name = eina_stringshare_add(ren->new_name);
+
+             list_item = pl->it_text;
+          }
+     }
+
+   /* didn't found genlist item in text, search inside of swallow list */
+   if (!list_item)
+     {
+        EINA_LIST_FOREACH(pl->swallow_list, l, demo_part)
+          {
+             if (demo_part->name == ren->old_name)
+               {
+                  eina_stringshare_del(demo_part->name);
+                  demo_part->name = eina_stringshare_add(ren->new_name);
+                  list_item = pl->it_swallow;
+               }
+          }
+     }
+
+   elm_genlist_item_expanded_set(list_item, true);
+   part_items = elm_genlist_item_subitems_get(list_item);
+   part_item = eina_list_data_get(part_items);
+   pr = elm_object_item_data_get(part_item);
+   while (pr != demo_part)
+     {
+        part_items = eina_list_next(part_items);
+        part_item = eina_list_data_get(part_items);
+        pr = elm_object_item_data_get(part_item);
+        assert(pr != NULL);
+     }
+   elm_genlist_item_update(part_item);
+}
+
 Evas_Object *
 demo_group_add(Group *group)
 {
@@ -285,6 +340,7 @@ demo_group_add(Group *group)
    elm_scroller_policy_set(pl->genlist, ELM_SCROLLER_POLICY_OFF, 
ELM_SCROLLER_POLICY_AUTO);
    evas_object_show(pl->genlist);
    elm_object_content_set(pl->layout, pl->genlist);
+   evas_object_smart_callback_add(ap.win, SIGNAL_PART_RENAMED, _part_renamed, 
pl);
    evas_object_smart_callback_add(pl->genlist, "clicked,double", 
_on_clicked_double, pl);
    evas_object_smart_callback_add(pl->genlist, "expand,request", 
_expand_request_cb, pl);
    evas_object_smart_callback_add(pl->genlist, "contract,request", 
_contract_request_cb, pl);

-- 


Reply via email to