eo_unref(job);
}
-void error_cb(void *data, Eina_Error *error)
+void error_cb(void *data, Eina_Error error)
{
Eio_Job *job = data;
EINA_SAFETY_ON_NULL_RETURN(error);
- const char *msg = eina_error_msg_get(*error);
+ const char *msg = eina_error_msg_get(error);
printf("%s error: %s\n", __FUNCTION__, msg);
ecore_main_loop_quit();
Eio_Job *job = eo_add(EIO_JOB_CLASS, NULL);
eo_event_callback_add(job, EIO_JOB_EVENT_FILTER_NAME, (Eo_Event_Cb)&filter_cb, NULL);
- eio_job_file_ls(job, path, &promise);
+ promise = eio_job_file_ls(job, path);
eina_promise_progress_cb_add(promise, (Eina_Promise_Progress_Cb)&progress_cb, NULL, NULL);
- eina_promise_then(promise, (Eina_Promise_Cb)&done_cb, (Eina_Promise_Error_Cb)&error_cb, job);
+ eina_promise_then(promise, &done_cb, &error_cb, job);
}
int main(int argc, char const *argv[])
#include <Eio.h>
#include <Ecore.h>
-void error_cb(void *data, Eina_Error *error)
+void error_cb(void *data, Eina_Error error, Eina_Promise* promise EINA_UNUSED)
{
- EINA_SAFETY_ON_NULL_RETURN(error);
EINA_SAFETY_ON_NULL_RETURN(data);
- const char *msg = eina_error_msg_get(*error);
+ const char *msg = eina_error_msg_get(error);
EINA_LOG_ERR("error: %s", msg);
ecore_main_loop_quit();
}
-void done_closing_cb(int *result EINA_UNUSED)
+void done_closing_cb(void* data EINA_UNUSED, void *value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED)
{
printf("%s closed file.\n", __FUNCTION__);
Eina_Promise *promise = NULL;
printf("%s Will close the file...\n", __FUNCTION__);
eio_job_file_close(job, file, &promise);
- eina_promise_then(promise, (Eina_Promise_Cb)&done_closing_cb, (Eina_Promise_Error_Cb)&error_cb, job);
+ eina_promise_then(promise, &done_closing_cb, &error_cb, job);
}
-void done_open_cb(void *data, Eina_File **file)
+void done_open_cb(void *data, void* value, Eina_Promise* promise)
{
EINA_SAFETY_ON_NULL_RETURN(data);
- EINA_SAFETY_ON_NULL_RETURN(file);
- EINA_SAFETY_ON_NULL_RETURN(*file);
+ EINA_SAFETY_ON_NULL_RETURN(value);
+
+ Eina_File *file = eina_file_dup(value);
Eio_Job *job = data;
- const char *name = eina_file_filename_get(*file);
+ const char *name = eina_file_filename_get(file);
printf("%s opened file %s\n", __FUNCTION__, name);
- closing_job(job, *file);
+ closing_job(job, file);
}
void open_file(const char *path)
Eina_Promise *promise;
Eio_Job *job = eo_add(EIO_JOB_CLASS, NULL);
- eio_job_file_open(job, path, EINA_FALSE, &promise);
- eina_promise_then(promise, (Eina_Promise_Cb)&done_open_cb, (Eina_Promise_Error_Cb)&error_cb, job);
+ eina_promise_then(eio_job_file_open(job, path, EINA_FALSE), &done_open_cb, &error_cb, job);
eo_unref(job);
}
#include <Eio.h>
#include <Ecore.h>
-void error_cb(void *data, Eina_Error *error)
+void error_cb(void *data, Eina_Error error)
{
EINA_SAFETY_ON_NULL_RETURN(error);
EINA_SAFETY_ON_NULL_RETURN(data);
- const char *msg = eina_error_msg_get(*error);
+ const char *msg = eina_error_msg_get(error);
EINA_LOG_ERR("error: %s", msg);
Eio_Job *job = data;
ecore_main_loop_quit();
}
-void done_closing_cb(void *data, Eina_Iterator **result EINA_UNUSED)
+void done_closing_cb(void *data, void* value EINA_UNUSED)
{
EINA_SAFETY_ON_NULL_RETURN(data);
+ Eina_Iterator* result = value;
+
printf("%s closed file.\n", __FUNCTION__);
Eio_Job *job = data;
eio_job_file_close(job, file1, &tasks[0]);
eio_job_file_close(job, file2, &tasks[1]);
promise = eina_promise_all(eina_carray_iterator_new((void**)&tasks[0]));
- eina_promise_then(promise, (Eina_Promise_Cb)&done_closing_cb, (Eina_Promise_Error_Cb)&error_cb, job);
+ eina_promise_then(promise, &done_closing_cb, &error_cb, job);
}
void done_open_cb(void *data, Eina_Iterator **iterator)
Eina_Promise *tasks[3] = {NULL, NULL, NULL};
Eio_Job *job = eo_add(EIO_JOB_CLASS, NULL);
- eio_job_file_open(job, path, EINA_FALSE, &tasks[0]);
- eio_job_file_open(job, path2, EINA_FALSE, &tasks[1]);
+ tasks[0] = eio_job_file_open(job, path, EINA_FALSE);
+ tasks[1] = eio_job_file_open(job, path2, EINA_FALSE);
promise = eina_promise_all(eina_carray_iterator_new((void**)&tasks[0]));
eina_promise_then(promise, (Eina_Promise_Cb)&done_open_cb, (Eina_Promise_Error_Cb)&error_cb, job);
}
static int prop_count = 0;
-struct eina_iterator
-{
- Eina_Iterator* success_iterator;
- Eina_Iterator* failure_iterator;
-};
-
static void
-promise_then_prop_c(Eo* obj, struct eina_iterator* it_struct)
+promise_then_prop_c(Eo* obj, void* data)
{
Eina_Value * property_value;
const Eina_Array *properties_list;
Eina_Array_Iterator a_it;
char *property, *prop_str;
const char *name;
- Eina_Iterator* it = it_struct->success_iterator;
+ Eina_Iterator* it = data;
name = eldbus_model_proxy_name_get(obj);
properties_list = efl_model_properties_get(obj);
}
static void
-promise_then_a(Eo* obj EINA_UNUSED, Eina_Accessor **accessor)
+promise_then_a(Eo* obj EINA_UNUSED, void* data)
{
const Eina_Array *properties_list;
Eina_Array_Iterator a_it;
char *property;
Eo* child;
int i = 0;
+ Eina_Accessor* accessor = data;
- EINA_ACCESSOR_FOREACH(*accessor, i, child)
+ EINA_ACCESSOR_FOREACH(accessor, i, child)
{
properties_list = efl_model_properties_get(child);
name = eldbus_model_proxy_name_get(child);
efl_model_property_get(child, property, &promises[j]);
}
eina_promise_then(eina_promise_all(eina_carray_iterator_new((void **)promises)),
- (Eina_Promise_Cb)&promise_then_prop_c, &error_cb, child);
+ &promise_then_prop_c, &error_cb, child);
prop_count++;
}
else
ecore_main_loop_quit();
}
static void
-promise_then(Eo* obj EINA_UNUSED, struct eina_iterator* it_struct)
+promise_then(Eo* obj EINA_UNUSED, void* data)
{
- Eina_Accessor **accessor;
+ Eina_Accessor *accessor;
unsigned int* count;
- Eina_Iterator* iterator = it_struct->success_iterator;
+ Eina_Iterator* iterator = data;
- if (!eina_iterator_next(iterator, (void **)&accessor))
+ if (!eina_iterator_next(iterator, (void**)&accessor))
{
printf("bye\n");
ecore_main_loop_quit();
efl_model_children_count_get(root, &promises[1]);
eina_promise_then(eina_promise_all(eina_carray_iterator_new((void **)promises)),
- (Eina_Promise_Cb)&promise_then, &error_cb, root);
+ &promise_then, &error_cb, root);
ecore_main_loop_begin();
char *path;
Eo *model;
- eina_value_get((Eina_Value *)value, &path);
+ eina_value_get(value, &path);
model = eo_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(eo_self, path));
elm_view_list_model_set(priv->fileview, model);
}