summaryrefslogtreecommitdiff
path: root/src/lib/eio
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2018-01-19 15:29:59 -0800
committerCedric BAIL <cedric@osg.samsung.com>2018-04-30 14:21:12 -0700
commit6de16678b936744582ef96a60e51452306905060 (patch)
treea8bae5293c1cb860908f785f502227199abcc601 /src/lib/eio
parent51776fb94ac8cc01bc994374565baf1f09b544b8 (diff)
eio: convert efl_io_manager_stat_ls to use Eina_Future.
Diffstat (limited to 'src/lib/eio')
-rw-r--r--src/lib/eio/efl_io_manager.c35
-rw-r--r--src/lib/eio/efl_io_manager.eo3
2 files changed, 21 insertions, 17 deletions
diff --git a/src/lib/eio/efl_io_manager.c b/src/lib/eio/efl_io_manager.c
index 4a638659a2..1878b57307 100644
--- a/src/lib/eio/efl_io_manager.c
+++ b/src/lib/eio/efl_io_manager.c
@@ -273,44 +273,47 @@ _efl_io_manager_direct_ls(Eo *obj,
273 return future; 273 return future;
274} 274}
275 275
276static Efl_Future * 276static Eina_Future *
277_efl_io_manager_stat_ls(Eo *obj, 277_efl_io_manager_stat_ls(Eo *obj,
278 Efl_Io_Manager_Data *pd EINA_UNUSED, 278 Efl_Io_Manager_Data *pd EINA_UNUSED,
279 const char *path, 279 const char *path,
280 Eina_Bool recursive) 280 Eina_Bool recursive,
281 void *info_data, EflIoDirectInfo info, Eina_Free_Cb info_free_cb)
281{ 282{
282 Efl_Promise *p; 283 Eina_Promise *p;
284 Eina_Future *future;
283 Eio_File *h; 285 Eio_File *h;
284 286
285 Eo *loop = efl_loop_get(obj); 287 p = efl_loop_promise_new(obj, _efl_io_manager_future_cancel, NULL);
286 p = efl_add(EFL_PROMISE_CLASS, loop);
287 if (!p) return NULL; 288 if (!p) return NULL;
289 future = eina_future_new(p);
288 290
289 if (!recursive) 291 if (!recursive)
290 { 292 {
291 h = _eio_file_stat_ls(path, 293 h = _eio_file_stat_ls(path,
292 _file_info_cb, 294 _future_file_info_cb,
293 _file_done_cb, 295 _future_file_done_cb,
294 _file_error_cb, 296 _future_file_error_cb,
295 p); 297 p);
296 } 298 }
297 else 299 else
298 { 300 {
299 h = _eio_dir_stat_ls(path, 301 h = _eio_dir_stat_ls(path,
300 _file_info_cb, 302 _future_file_info_cb,
301 _file_done_cb, 303 _future_file_done_cb,
302 _file_error_cb, 304 _future_file_error_cb,
303 p); 305 p);
304 } 306 }
305
306 if (!h) goto end; 307 if (!h) goto end;
307 308
308 efl_event_callback_array_add(p, promise_progress_handling(), h); 309 ecore_thread_local_data_add(h->thread, ".info", info, NULL, EINA_TRUE);
309 return efl_promise_future_get(p); 310 ecore_thread_local_data_add(h->thread, ".info_data", info_data, info_free_cb, EINA_TRUE);
311 eina_promise_data_set(p, h);
312
313 return efl_future_Eina_FutureXXX_then(obj, future);
310 314
311 end: 315 end:
312 efl_del(p); 316 return future;
313 return NULL;
314} 317}
315 318
316static Eina_Future * 319static Eina_Future *
diff --git a/src/lib/eio/efl_io_manager.eo b/src/lib/eio/efl_io_manager.eo
index ef10cabbe4..030ef95052 100644
--- a/src/lib/eio/efl_io_manager.eo
+++ b/src/lib/eio/efl_io_manager.eo
@@ -52,8 +52,9 @@ class Efl.Io.Manager (Efl.Loop_Consumer)
52 params { 52 params {
53 @in path: string;[[Path we want to list entries for]] 53 @in path: string;[[Path we want to list entries for]]
54 @in recursive: bool; [[If $true, list entries recursively, $false otherwise]] 54 @in recursive: bool; [[If $true, list entries recursively, $false otherwise]]
55 info: EflIoDirectInfo; [[Callback called for each packet of @Eina.File.Direct.Info]]
55 } 56 }
56 return: future<uint64, const(array<ptr(Eina.File.Direct.Info)>)>; [[List of entries in path]] 57 return: ptr(Eina.Future) @owned; [[Amount of files found during the listing of the directory]]
57 } 58 }
58 59
59 // Extended attributes 60 // Extended attributes