lorddrew pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=b909f913ed5c4175a62442df212dced6b112dd63

commit b909f913ed5c4175a62442df212dced6b112dd63
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Tue Jan 17 13:35:54 2017 +0200

    edje_edit: add Efl.File.mmap.set implementation for edje_edit
    
    This fixes edje_edit_program_source_get for mmaped edje_edit object
    @fix
---
 src/lib/edje/edje_edit.c  | 94 ++++++++++++++++++++++++++++-------------------
 src/lib/edje/edje_edit.eo |  1 +
 2 files changed, 57 insertions(+), 38 deletions(-)

diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index c7eaa19..38b08e6 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -194,53 +194,19 @@ _edje_edit_eet_close(Eet_File *ef)
      eet_close(ef);
 }
 
-EOLIAN static Eina_Bool
-_edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const 
char *group)
+static Eina_Bool
+_load_scripts(Eo *obj, Edje_Edit *eed)
 {
-   Eina_Bool ret;
    Eet_File *ef;
    char **keys, buf[64];
    int count, i;
    int len = strlen("edje/scripts/embryo/source/");
 
-   ret = EINA_FALSE;
-
-   _edje_edit_data_clean(eed);
-
-   /* TODO and maybes:
-    *  * The whole point of this thing is keep track of stuff such as
-    *    strings to free and who knows what, so we need to take care
-    *    of those if the file/group changes.
-    *  * Maybe have the possibility to open just files, not always with
-    *    a group given.
-    *  * A way to skip the cache? Could help avoid some issues when editing
-    *    a group being used by the application in some other way, or multiple
-    *    opens of the same file.
-    *  * Here we probably want to allow opening groups with broken references
-    *    (GROUP parts or BOX/TABLE items pointing to non-existent/renamed
-    *    groups).
-    */
-   Efl_Vpath_File *file_obj =
-     efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file);
-   efl_vpath_file_do(file_obj);
-   // XXX:FIXME: allow this to be async
-   efl_vpath_file_wait(file_obj);
-   file = efl_vpath_file_result_get(file_obj);
-
-   Eina_Bool int_ret = EINA_FALSE;
-   int_ret = efl_file_set(efl_super(obj, MY_CLASS), file, group);
-   if (!int_ret)
-     {
-        efl_del(file_obj);
-        return ret;
-     }
-
    GET_ED_OR_RETURN(EINA_FALSE);
 
    eed->program_scripts = 
eina_hash_int32_new((Eina_Free_Cb)_edje_edit_program_script_free);
 
    ef = _edje_edit_eet_open(ed, EET_FILE_MODE_READ);
-   efl_del(file_obj);
 
    snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i",
             eed->base->collection->id);
@@ -266,9 +232,61 @@ _edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, 
const char *file, const ch
      }
    _edje_edit_eet_close(ef);
 
-   ret = EINA_TRUE;
+   return EINA_TRUE;
+}
 
-   return ret;
+EOLIAN static Eina_Bool
+_edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const 
char *group)
+{
+   _edje_edit_data_clean(eed);
+
+   /* TODO and maybes:
+    *  * The whole point of this thing is keep track of stuff such as
+    *    strings to free and who knows what, so we need to take care
+    *    of those if the file/group changes.
+    *  * Maybe have the possibility to open just files, not always with
+    *    a group given.
+    *  * A way to skip the cache? Could help avoid some issues when editing
+    *    a group being used by the application in some other way, or multiple
+    *    opens of the same file.
+    *  * Here we probably want to allow opening groups with broken references
+    *    (GROUP parts or BOX/TABLE items pointing to non-existent/renamed
+    *    groups).
+    *  P.S. don't forget about mmap version below
+    */
+   Efl_Vpath_File *file_obj =
+     efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file);
+   efl_vpath_file_do(file_obj);
+   // XXX:FIXME: allow this to be async
+   efl_vpath_file_wait(file_obj);
+   file = efl_vpath_file_result_get(file_obj);
+
+   Eina_Bool int_ret;
+   int_ret = efl_file_set(efl_super(obj, MY_CLASS), file, group);
+   efl_del(file_obj);
+   if (!int_ret)
+     return EINA_FALSE;
+
+   if (!_load_scripts(obj, eed))
+     return EINA_FALSE;
+
+   return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_edje_edit_efl_file_mmap_set(Eo *obj, Edje_Edit *eed, const Eina_File *mmap, 
const char *group)
+{
+   _edje_edit_data_clean(eed);
+
+   Eina_Bool int_ret;
+   int_ret = efl_file_mmap_set(efl_super(obj, MY_CLASS), mmap, group);
+   if (!int_ret)
+     return EINA_FALSE;
+
+   if (!_load_scripts(obj, eed))
+     return EINA_FALSE;
+
+   return EINA_TRUE;
 }
 
 EAPI Evas_Object *
diff --git a/src/lib/edje/edje_edit.eo b/src/lib/edje/edje_edit.eo
index 5dd8e83..0d87b32 100644
--- a/src/lib/edje/edje_edit.eo
+++ b/src/lib/edje/edje_edit.eo
@@ -12,5 +12,6 @@ class Edje.Edit (Edje.Object)
       Efl.Object.destructor;
       Efl.Canvas.Group.group_del;
       Efl.File.file { set; }
+      Efl.File.mmap { set; }
    }
 }

-- 


Reply via email to