ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/tools/edi.git/commit/?id=21ae2bfebdbdfdc458dd10df49a34ca42f8e983b

commit 21ae2bfebdbdfdc458dd10df49a34ca42f8e983b
Author: YeongJong Lee <[email protected]>
Date:   Mon Dec 19 23:08:55 2016 +0000

    filelist: Check that the filelist has same file before insertion.
    
    Summary:
    'elm_code_file_save' emit EIO_MONITOR_FILE_CREATED event.
    It occurs filelist duplication.
    So Check that the filelist has same file before insertion.
    
    Test Plan:
    1. Run Edi.
    2. Open project.
    3. Edit a file.
    4. Save the file.
    5. Check that the filelist doesn't have same file.
    
    Reviewers: ajwillia.ms
    
    Reviewed By: ajwillia.ms
    
    Differential Revision: https://phab.enlightenment.org/D4497
---
 src/bin/edi_filepanel.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/bin/edi_filepanel.c b/src/bin/edi_filepanel.c
index 0c6ff7f..b92bc94 100644
--- a/src/bin/edi_filepanel.c
+++ b/src/bin/edi_filepanel.c
@@ -352,6 +352,7 @@ _file_listing_item_insert(const char *path, Eina_Bool 
isdir, Elm_Object_Item *pa
 {
    Elm_Genlist_Item_Class *clas = &itc;
    Edi_Dir_Data *sd;
+   Elm_Object_Item *it;
 
    sd = calloc(1, sizeof(Edi_Dir_Data));
    if (isdir)
@@ -361,6 +362,11 @@ _file_listing_item_insert(const char *path, Eina_Bool 
isdir, Elm_Object_Item *pa
      }
 
    sd->path = eina_stringshare_add(path);
+   it = elm_genlist_search_by_text_item_get(list, NULL, "elm.text",
+                                            basename((char *)sd->path),
+                                            ELM_GLOB_MATCH_NO_ESCAPE);
+   if (it) return;
+
    (void)!elm_genlist_item_sorted_insert(list, clas, sd, parent_it,
                                          isdir ? ELM_GENLIST_ITEM_TREE : 
ELM_GENLIST_ITEM_NONE,
                                          _file_list_cmp, _item_sel, sd);

-- 


Reply via email to