summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAndrii Kroitor <an.kroitor@samsung.com>2017-01-17 13:35:54 +0200
committerAndrii Kroitor <an.kroitor@samsung.com>2017-01-17 13:42:36 +0200
commitb909f913ed5c4175a62442df212dced6b112dd63 (patch)
treec5a6656eb0dc88fd70457a62fefbe286c4921206 /src/lib
parentcaf3b95a6d8b2cf69562ae762fe83c16150fb2c6 (diff)
edje_edit: add Efl.File.mmap.set implementation for edje_edit
This fixes edje_edit_program_source_get for mmaped edje_edit object @fix
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/edje/edje_edit.c94
-rw-r--r--src/lib/edje/edje_edit.eo1
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)
194 eet_close(ef); 194 eet_close(ef);
195} 195}
196 196
197EOLIAN static Eina_Bool 197static Eina_Bool
198_edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const char *group) 198_load_scripts(Eo *obj, Edje_Edit *eed)
199{ 199{
200 Eina_Bool ret;
201 Eet_File *ef; 200 Eet_File *ef;
202 char **keys, buf[64]; 201 char **keys, buf[64];
203 int count, i; 202 int count, i;
204 int len = strlen("edje/scripts/embryo/source/"); 203 int len = strlen("edje/scripts/embryo/source/");
205 204
206 ret = EINA_FALSE;
207
208 _edje_edit_data_clean(eed);
209
210 /* TODO and maybes:
211 * * The whole point of this thing is keep track of stuff such as
212 * strings to free and who knows what, so we need to take care
213 * of those if the file/group changes.
214 * * Maybe have the possibility to open just files, not always with
215 * a group given.
216 * * A way to skip the cache? Could help avoid some issues when editing
217 * a group being used by the application in some other way, or multiple
218 * opens of the same file.
219 * * Here we probably want to allow opening groups with broken references
220 * (GROUP parts or BOX/TABLE items pointing to non-existent/renamed
221 * groups).
222 */
223 Efl_Vpath_File *file_obj =
224 efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file);
225 efl_vpath_file_do(file_obj);
226 // XXX:FIXME: allow this to be async
227 efl_vpath_file_wait(file_obj);
228 file = efl_vpath_file_result_get(file_obj);
229
230 Eina_Bool int_ret = EINA_FALSE;
231 int_ret = efl_file_set(efl_super(obj, MY_CLASS), file, group);
232 if (!int_ret)
233 {
234 efl_del(file_obj);
235 return ret;
236 }
237
238 GET_ED_OR_RETURN(EINA_FALSE); 205 GET_ED_OR_RETURN(EINA_FALSE);
239 206
240 eed->program_scripts = eina_hash_int32_new((Eina_Free_Cb)_edje_edit_program_script_free); 207 eed->program_scripts = eina_hash_int32_new((Eina_Free_Cb)_edje_edit_program_script_free);
241 208
242 ef = _edje_edit_eet_open(ed, EET_FILE_MODE_READ); 209 ef = _edje_edit_eet_open(ed, EET_FILE_MODE_READ);
243 efl_del(file_obj);
244 210
245 snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i", 211 snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i",
246 eed->base->collection->id); 212 eed->base->collection->id);
@@ -266,9 +232,61 @@ _edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const ch
266 } 232 }
267 _edje_edit_eet_close(ef); 233 _edje_edit_eet_close(ef);
268 234
269 ret = EINA_TRUE; 235 return EINA_TRUE;
236}
270 237
271 return ret; 238EOLIAN static Eina_Bool
239_edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const char *group)
240{
241 _edje_edit_data_clean(eed);
242
243 /* TODO and maybes:
244 * * The whole point of this thing is keep track of stuff such as
245 * strings to free and who knows what, so we need to take care
246 * of those if the file/group changes.
247 * * Maybe have the possibility to open just files, not always with
248 * a group given.
249 * * A way to skip the cache? Could help avoid some issues when editing
250 * a group being used by the application in some other way, or multiple
251 * opens of the same file.
252 * * Here we probably want to allow opening groups with broken references
253 * (GROUP parts or BOX/TABLE items pointing to non-existent/renamed
254 * groups).
255 * P.S. don't forget about mmap version below
256 */
257 Efl_Vpath_File *file_obj =
258 efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file);
259 efl_vpath_file_do(file_obj);
260 // XXX:FIXME: allow this to be async
261 efl_vpath_file_wait(file_obj);
262 file = efl_vpath_file_result_get(file_obj);
263
264 Eina_Bool int_ret;
265 int_ret = efl_file_set(efl_super(obj, MY_CLASS), file, group);
266 efl_del(file_obj);
267 if (!int_ret)
268 return EINA_FALSE;
269
270 if (!_load_scripts(obj, eed))
271 return EINA_FALSE;
272
273 return EINA_TRUE;
274}
275
276EOLIAN static Eina_Bool
277_edje_edit_efl_file_mmap_set(Eo *obj, Edje_Edit *eed, const Eina_File *mmap, const char *group)
278{
279 _edje_edit_data_clean(eed);
280
281 Eina_Bool int_ret;
282 int_ret = efl_file_mmap_set(efl_super(obj, MY_CLASS), mmap, group);
283 if (!int_ret)
284 return EINA_FALSE;
285
286 if (!_load_scripts(obj, eed))
287 return EINA_FALSE;
288
289 return EINA_TRUE;
272} 290}
273 291
274EAPI Evas_Object * 292EAPI 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)
12 Efl.Object.destructor; 12 Efl.Object.destructor;
13 Efl.Canvas.Group.group_del; 13 Efl.Canvas.Group.group_del;
14 Efl.File.file { set; } 14 Efl.File.file { set; }
15 Efl.File.mmap { set; }
15 } 16 }
16} 17}