jackdanielz pushed a commit to branch master. http://git.enlightenment.org/tools/erigo.git/commit/?id=5912507b1f093bd7aef38fbcd13fc8db21c9101a
commit 5912507b1f093bd7aef38fbcd13fc8db21c9101a Author: Daniel Zaoui <[email protected]> Date: Tue Feb 24 13:16:29 2015 +0200 Eo: adapt code to follow eo_do new syntax --- src/bin/egui_gui/cbview.c | 6 +++--- src/bin/egui_gui/dnd.c | 8 ++++---- src/bin/egui_gui/editor.c | 39 ++++++++++++++++++++------------------- src/bin/egui_gui/egui_logic.c | 3 ++- src/bin/egui_gui/props_helper.c | 3 ++- src/bin/egui_gui/propview.c | 3 ++- src/bin/egui_gui/rmview.c | 7 ++++--- src/bin/egui_gui/settings_view.c | 2 +- src/lib/ffi_abstraction.c | 10 ---------- src/lib/generator.c | 8 ++++---- 10 files changed, 42 insertions(+), 47 deletions(-) diff --git a/src/bin/egui_gui/cbview.c b/src/bin/egui_gui/cbview.c index da878fc..23df147 100644 --- a/src/bin/egui_gui/cbview.c +++ b/src/bin/egui_gui/cbview.c @@ -282,7 +282,7 @@ static void _action_prop_update(void *data, Eo *obj, void *event_info) { unsigned int par_idx = (unsigned int) (uintptr_t) data; - It_Data *it_data = eo_do(obj, eo_key_data_get("cb_it_data")); + It_Data *it_data = eo_do_ret(obj, it_data, eo_key_data_get("cb_it_data")); Gui_Widget_Callback *cb = it_data->cb; Gui_Context *ctx = (Gui_Context *) wdg_context_get(it_data->wdg); @@ -340,7 +340,7 @@ _action_prop_update(void *data, Eo *obj, void *event_info) } if (kl == ELM_CHECK_CLASS) { - Eina_Bool state = eo_do(obj, elm_obj_check_state_get()); + Eina_Bool state = eo_do_ret(obj, state, elm_obj_check_state_get()); gui_value_bool_set(val, state); } if (kl == ELM_HOVERSEL_CLASS) @@ -516,7 +516,7 @@ _item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EIN } else { - wdgs = eo_do(cb_item_box, eo_key_data_get("cb_item_wdgs")); + eo_do_ret(cb_item_box, wdgs, eo_key_data_get("cb_item_wdgs")); } eo_do(wdgs->cb_label, elm_obj_widget_part_text_set(NULL, cb_type_get(it_data->cb))); diff --git a/src/bin/egui_gui/dnd.c b/src/bin/egui_gui/dnd.c index 87cffa1..500e325 100644 --- a/src/bin/egui_gui/dnd.c +++ b/src/bin/egui_gui/dnd.c @@ -234,7 +234,7 @@ _droppos(void *data, Eo *obj, Evas_Coord x, Evas_Coord y, Elm_Xdnd_Action action } else { - Eo *main_obj_inlined_win_img = eo_do(wdg_eo, eo_key_data_get("__editor_win")); + Eo *main_obj_inlined_win_img = eo_do_ret(wdg_eo, main_obj_inlined_win_img, eo_key_data_get("__editor_win")); iwin = elm_win_inlined_image_object_get(main_obj_inlined_win_img); } eo_do(iwin, evas_obj_position_get(&iwin_x, &iwin_y)); @@ -418,7 +418,7 @@ _drag_start(void *data) } else { - Eo *main_obj_inlined_win_img = eo_do(main_wdg_eo, eo_key_data_get("__editor_win")); + Eo *main_obj_inlined_win_img = eo_do_ret(main_wdg_eo, main_obj_inlined_win_img, eo_key_data_get("__editor_win")); drag_object = elm_win_inlined_image_object_get(main_obj_inlined_win_img); } } @@ -549,7 +549,7 @@ _target_info_new(Gui_Widget *wdg, Eo *obj) } else if (obj) { - ti = eo_do(obj, eo_key_data_get(DROP_TARGET)); + eo_do_ret(obj, ti, eo_key_data_get(DROP_TARGET)); if (!ti) { ti = calloc(1, sizeof(Target_Info)); @@ -619,7 +619,7 @@ drop_target_wdg_del(Gui_Widget *wdg, Eo *obj) } else if (obj) { - ti = eo_do(obj, eo_key_data_get(DROP_TARGET)); + eo_do_ret(obj, ti, eo_key_data_get(DROP_TARGET)); eo_do(obj, eo_key_data_del(DROP_TARGET)); } diff --git a/src/bin/egui_gui/editor.c b/src/bin/egui_gui/editor.c index 48efced..80f9374 100644 --- a/src/bin/egui_gui/editor.c +++ b/src/bin/egui_gui/editor.c @@ -468,7 +468,7 @@ _iter_widget_delete(Gui_Widget *wdg) if (!IS_WIN(wdg)) { Eo *o = session_eo_get(session, wdg); - optional_win = eo_do(o, eo_key_data_get("__editor_win")); + eo_do_ret(o, optional_win, eo_key_data_get("__editor_win")); } Eo *fr = main_wdg_info_frame_get(wi); if (fr) @@ -749,7 +749,7 @@ _marker_mouse_move(void *data, Eo *marker EINA_UNUSED, const Eo_Event_Descriptio if (!IS_WIN(wdg)) { Eo *main_obj_eo = session_eo_get(session, wdg); - Eo *main_obj_win = eo_do(main_obj_eo, eo_key_data_get("__editor_win")); + Eo *main_obj_win = eo_do_ret(main_obj_eo, main_obj_win, eo_key_data_get("__editor_win")); eo_do(main_obj_win, evas_obj_size_set(ow, oh)); } } @@ -998,7 +998,7 @@ _frame_mouse_up(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *des /* Check if dragged object is visible. * If not, means that _drag_start_cb was called, so need to reload main wdg. */ Eo *canvas = egui_layout_gui_get()->main_win->canvas_bg; - DnD_Info *di = eo_do(canvas, eo_key_data_get(EDITOR_DND_DATA)); + DnD_Info *di = eo_do_ret(canvas, di, eo_key_data_get(EDITOR_DND_DATA)); const Gui_Widget *drag_widget = dnd_drag_wdg_get(); if (!drag_widget) return EO_CALLBACK_CONTINUE; @@ -1151,7 +1151,7 @@ _win_resize(void *data EINA_UNUSED, Eo *o, const Eo_Event_Description *desc EINA /* For main objects, which are not win. */ else { - Eo *optional_win = eo_do(o, eo_key_data_get("__editor_win")); + Eo *optional_win = eo_do_ret(o, optional_win, eo_key_data_get("__editor_win")); Eo *inwin_img = elm_win_inlined_image_object_get(optional_win); eo_do(optional_win, evas_obj_size_set(ow, oh)); eo_do(inwin_img, evas_obj_size_set(ow, oh)); @@ -1238,10 +1238,10 @@ _widget_prop_add(Gui_Session *session, const Gui_Widget *wdg, const Gui_Widget_P Eo *o = session_eo_get(session, wdg), *win = NULL, *fr = NULL; if (!IS_WIN(wdg)) { - win = eo_do(o, eo_key_data_get("__editor_win")); - fr = eo_do(win, eo_key_data_get("__editor_frame")); + eo_do_ret(o, win, eo_key_data_get("__editor_win")); + eo_do_ret(win, fr, eo_key_data_get("__editor_frame")); } - else fr = eo_do(o, eo_key_data_get("__editor_frame")); + else eo_do_ret(o, fr, eo_key_data_get("__editor_frame")); if (IS_WIN(wdg) && !strcmp(prop_name_get(prop), TITLE_SET)) { Gui_Value *v = prop_value_nth_get(wdg_prop_get(wdg, DB_DEF_WIN_CLASS, TITLE_SET), 0); @@ -1274,7 +1274,8 @@ _widget_prop_add(Gui_Session *session, const Gui_Widget *wdg, const Gui_Widget_P Eo *o = session_eo_get(session, wdg); Evas *e = evas_object_evas_get(o); Evas_Object *layout = eo_add(EDJE_EDIT_CLASS, e); - if (eo_do(layout, efl_file_set(resource_value_get(res), group))) + Eina_Bool ret; + if (eo_do_ret(layout, ret, efl_file_set(resource_value_get(res), group))) { Eina_List *parts = edje_edit_parts_list_get(layout); Eina_Stringshare *part_name; @@ -1416,7 +1417,7 @@ _drop_target_main_wdg_enter(void *data, Evas_Object *obj) } else if (canvas_drop_target != NULL) { - di = eo_do(canvas_drop_target, eo_key_data_get(EDITOR_DND_DATA)); + eo_do_ret(canvas_drop_target, di, eo_key_data_get(EDITOR_DND_DATA)); canvas = canvas_drop_target; _wdg_border_draw(NULL, EINA_FALSE, BORDER_DROP_TARGET); } @@ -1458,7 +1459,7 @@ _drop_target_main_wdg_leave(void *data, Evas_Object *obj) } else if (canvas_drop_target != NULL) { - di = eo_do(canvas_drop_target, eo_key_data_get(EDITOR_DND_DATA)); + eo_do_ret(canvas_drop_target, di, eo_key_data_get(EDITOR_DND_DATA)); } else { @@ -1596,7 +1597,7 @@ _drop_target_drop(void *data, Evas_Object *obj, Elm_Selection_Data *ev) } else if (canvas_drop_target != NULL) { - di = eo_do(canvas_drop_target, eo_key_data_get(EDITOR_DND_DATA)); + eo_do_ret(canvas_drop_target, di, eo_key_data_get(EDITOR_DND_DATA)); } else { @@ -1634,7 +1635,7 @@ _drop_target_drop(void *data, Evas_Object *obj, Elm_Selection_Data *ev) Eo *o = session_eo_get(session, new_wdg); /* This object will be deleted in frame or optional_win. */ session_wdg_existence_set((Gui_Session *) session, new_wdg, EINA_FALSE); - Eo *optional_win = eo_do(o, eo_key_data_get("__editor_win")); + Eo *optional_win = eo_do_ret(o, optional_win, eo_key_data_get("__editor_win")); wdg_data_set(new_wdg, MAIN_WDG_INFO, NULL); eo_do(o, eo_key_data_del("__editor_win")); eo_del(optional_win); @@ -2011,7 +2012,7 @@ _drop_target_pos(void *data, Eo *obj, Evas_Coord x, Evas_Coord y, Elm_Xdnd_Actio } else if (canvas_drop_target != NULL) { - di = eo_do(canvas_drop_target, eo_key_data_get(EDITOR_DND_DATA)); + eo_do_ret(canvas_drop_target, di, eo_key_data_get(EDITOR_DND_DATA)); } else { @@ -2039,7 +2040,7 @@ _drop_target_pos(void *data, Eo *obj, Evas_Coord x, Evas_Coord y, Elm_Xdnd_Actio int idx = 0; //if (di->packed) eo_do(wdg_eo, elm_obj_box_unpack(di->eo_cur)); - Eina_List *box_chld = eo_do(wdg_eo, elm_obj_box_children_get()), *l; + Eina_List *box_chld = eo_do_ret(wdg_eo, box_chld, elm_obj_box_children_get()), *l; di->box_pack_idx = 0; EINA_LIST_FOREACH(box_chld, l, child) { @@ -2047,7 +2048,7 @@ _drop_target_pos(void *data, Eo *obj, Evas_Coord x, Evas_Coord y, Elm_Xdnd_Actio eo_do(child, evas_obj_position_get(&child_x, &child_y)); eo_do(child, evas_obj_size_get(&child_w, &child_h)); - Eina_Bool hor_box = eo_do(wdg_eo, elm_obj_box_horizontal_get()); + Eina_Bool hor_box = eo_do_ret(wdg_eo, hor_box, elm_obj_box_horizontal_get()); /* Check box layout, cursor position and elements inside the box and * determine where to pack new object. */ @@ -2709,7 +2710,7 @@ _editor_undo(const Gui_Context *ctx) { Eo *fr = main_wdg_info_frame_get(wi); Eo *o = session_eo_get(session, wdg); - Eo *optional_win = eo_do(o, eo_key_data_get("__editor_win")); + Eo *optional_win = eo_do_ret(o, optional_win, eo_key_data_get("__editor_win")); eo_del(optional_win); eo_del(fr); free(wi); @@ -2911,7 +2912,7 @@ _editor_redo(const Gui_Context *ctx) { Eo *fr = main_wdg_info_frame_get(wi); Eo *o = session_eo_get(session, wdg); - Eo *optional_win = eo_do(o, eo_key_data_get("__editor_win")); + Eo *optional_win = eo_do_ret(o, optional_win, eo_key_data_get("__editor_win")); eo_del(optional_win); eo_del(fr); free(wi); @@ -3193,7 +3194,7 @@ _editor_factory_wdg_create(const char *class_name, const Gui_Widget *focused_wdg void editor_shutdown() { - DnD_Info *di = eo_do(g->main_win->canvas_bg, eo_key_data_get(EDITOR_DND_DATA)); + DnD_Info *di = eo_do_ret(g->main_win->canvas_bg, di, eo_key_data_get(EDITOR_DND_DATA)); eo_do(g->main_win->canvas_bg, eo_key_data_del(EDITOR_DND_DATA)); free(di); drop_target_wdg_del(NULL, g->main_win->canvas_bg); @@ -4290,7 +4291,7 @@ static void _key_binding_wdg_del_cb(void *data EINA_UNUSED) { /* If main_win is currently focused, widget can be deleted. */ - Eo *obj = eo_do(g->main_win->main_win, elm_obj_widget_focused_object_get()); + Eo *obj = eo_do_ret(g->main_win->main_win, obj, elm_obj_widget_focused_object_get()); if ((obj == g->main_win->main_win) || (eo_isa(obj, ELM_GENLIST_CLASS)) || (eo_isa(obj, ELM_TOOLBAR_CLASS)) || diff --git a/src/bin/egui_gui/egui_logic.c b/src/bin/egui_gui/egui_logic.c index 61234f0..ab6d511 100644 --- a/src/bin/egui_gui/egui_logic.c +++ b/src/bin/egui_gui/egui_logic.c @@ -182,7 +182,8 @@ _on_fs_done(void *data, Evas_Object *obj EINA_UNUSED, void *event) _menu_item_disabled_set(project_menu, ITEM_SAVE, EINA_FALSE); _menu_item_disabled_set(project_menu, ITEM_SAVEAS, EINA_FALSE); _menu_item_disabled_set(project_menu, ITEM_EXPORT, EINA_FALSE); - const char *project_name = eo_do(fs_win->fs_project_name_entry, elm_obj_widget_part_text_get(NULL)); + const char *project_name = NULL; + eo_do_ret(fs_win->fs_project_name_entry, project_name, elm_obj_widget_part_text_get(NULL)); if (!strlen(project_name)) project_name = "New Project"; char *default_filename = strdup(project_name), *p; diff --git a/src/bin/egui_gui/props_helper.c b/src/bin/egui_gui/props_helper.c index 2229180..fad9e40 100644 --- a/src/bin/egui_gui/props_helper.c +++ b/src/bin/egui_gui/props_helper.c @@ -410,7 +410,8 @@ props_hoversel_resources_add(Eo *box, Eo *hoversel, Eo *hover_parent, const char const Eina_List *itr; Elm_Object_Item *it; Eina_Bool add_empty = EINA_TRUE; - EINA_LIST_FOREACH(eo_do(hoversel, elm_obj_hoversel_items_get()), itr, it) + const Eina_List *items; + EINA_LIST_FOREACH(eo_do_ret(hoversel, items, elm_obj_hoversel_items_get()), itr, it) { const char *str = elm_object_item_text_get(it); if (str && !strcmp(str, PROP_HOVERSEL_NONE_VALUE)) diff --git a/src/bin/egui_gui/propview.c b/src/bin/egui_gui/propview.c index b305f93..f15c829 100644 --- a/src/bin/egui_gui/propview.c +++ b/src/bin/egui_gui/propview.c @@ -180,7 +180,8 @@ _prop_item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *par } else { - Eina_List *last = eina_list_last(eo_do(it_box, elm_obj_box_children_get())); + Eina_List *children = eo_do_ret(it_box, children, elm_obj_box_children_get()); + Eina_List *last = eina_list_last(children); Eo *prop_menu_button = eina_list_data_get(last); eo_do(prop_menu_button, eo_key_data_set(_STR_EDITOR, it_data, NULL)); diff --git a/src/bin/egui_gui/rmview.c b/src/bin/egui_gui/rmview.c index b45c3e5..ae5b8ac 100644 --- a/src/bin/egui_gui/rmview.c +++ b/src/bin/egui_gui/rmview.c @@ -240,8 +240,8 @@ _res_changed(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc E static Eina_Bool _enventor_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { - Rmview_Field_Data *f_data = eo_do(obj, eo_key_data_get(_STR_RMVIEW)); - const char *edc_file = eo_do(f_data->it_data->en3, elm_interface_fileselector_path_get()); + Rmview_Field_Data *f_data = eo_do_ret(obj, f_data, eo_key_data_get(_STR_RMVIEW)); + const char *edc_file = eo_do_ret(f_data->it_data->en3, edc_file, elm_interface_fileselector_path_get()); if (strlen(edc_file)) { Eina_Stringshare *path = gui_context_project_path_get(resource_context_get(f_data->it_data->res)); @@ -713,7 +713,8 @@ _rm_add_button_clicked(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Eve resource_value_set(gui_res, value_str); if (res_type == RESOURCE_EDJE) { - resource_edc_path_set(gui_res, eo_do(g_rm_win->rm_edje_fs_edc, elm_interface_fileselector_path_get())); + const char *edc_path = eo_do_ret(g_rm_win->rm_edje_fs_edc, edc_path, elm_interface_fileselector_path_get()); + resource_edc_path_set(gui_res, edc_path); resource_edj_path_set(gui_res, value_str); eo_do(g_rm_win->rm_edje_fs_edc, elm_interface_fileselector_path_set("")); eo_do(g_rm_win->rm_edje_fs_edj, elm_interface_fileselector_path_set("")); diff --git a/src/bin/egui_gui/settings_view.c b/src/bin/egui_gui/settings_view.c index d2fb24b..9806f0f 100644 --- a/src/bin/egui_gui/settings_view.c +++ b/src/bin/egui_gui/settings_view.c @@ -108,7 +108,7 @@ static Eina_Bool _start_pt_chk_chg(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { Eid *wdg_id = data; - Eina_Bool state = eo_do(obj, elm_obj_check_state_get()); + Eina_Bool state = eo_do_ret(obj, state, elm_obj_check_state_get()); if (state) _start_pts = eina_list_append(_start_pts, wdg_id); else diff --git a/src/lib/ffi_abstraction.c b/src/lib/ffi_abstraction.c index 1fbd0b7..00e05b6 100644 --- a/src/lib/ffi_abstraction.c +++ b/src/lib/ffi_abstraction.c @@ -146,14 +146,12 @@ _ffi_eo_do(const Gui_Session *session, const Gui_Widget *wdg, const Gui_Widget_P const Eo *_eoid_ = eo_cur; if (_eo_do_start(_eoid_, NULL, EINA_FALSE, __FILE__, __FUNCTION__, __LINE__)) { - const Eo *_id_clean_ EO_DO_CLEANUP = _eoid_; if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, arg_num, &ffi_type_uint, types) == FFI_OK) { unsigned int result; ffi_call(&cif, (void (*)()) func_pointer, &result, values); ret = EINA_TRUE; } - (void) _id_clean_; } end: @@ -233,14 +231,12 @@ _ffi_eo_do_get(const Gui_Session *session, const Gui_Widget *wdg, const Gui_Widg const Eo *_eoid_ = eo_cur; if (_eo_do_start(_eoid_, NULL, EINA_FALSE, __FILE__, __FUNCTION__, __LINE__)) { - const Eo *_id_clean_ EO_DO_CLEANUP = _eoid_; if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, arg_num, &ffi_type_uint, types) == FFI_OK) { unsigned int result; ffi_call(&cif, (void (*)()) func_pointer, &result, values); ret = EINA_TRUE; } - (void) _id_clean_; } /* For enum type default value will be int. We need to change it to string value of current enum. */ @@ -343,10 +339,8 @@ _ffi_eo_add(const Gui_Session *session, const Gui_Widget *wdg, Eo *parent_eo) const Eo *_eoid_ = _tmp_obj; if (_eo_do_start(_eoid_, NULL, EINA_FALSE, __FILE__, __FUNCTION__, __LINE__)) { - const Eo *_id_clean_ EO_DO_CLEANUP = _eoid_; func_pointer(); _tmp_obj = eo_finalize(); - (void) _id_clean_; } ret = _tmp_obj; @@ -427,14 +421,12 @@ _ffi_eo_do_content(const Gui_Session *session, const Gui_Widget *wdg, const Gui_ const Eo *_eoid_ = eo_cur; if (_eo_do_start(_eoid_, NULL, EINA_FALSE, __FILE__, __FUNCTION__, __LINE__)) { - const Eo *_id_clean_ EO_DO_CLEANUP = _eoid_; if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, arg_num, &ffi_type_uint, types) == FFI_OK) { unsigned int result; ffi_call(&cif, (void (*)()) func_pointer, &result, values); ret = EINA_TRUE; } - (void) _id_clean_; } end: @@ -550,12 +542,10 @@ _ffi_eo_item_add(const Gui_Session *session, const Gui_Widget *wdg, const Item_C const Eo *_eoid_ = eo_cur; if (_eo_do_start(_eoid_, NULL, EINA_FALSE, __FILE__, __FUNCTION__, __LINE__)) { - const Eo *_id_clean_ EO_DO_CLEANUP = _eoid_; if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, arg_num, &ffi_type_pointer, types) == FFI_OK) { ffi_call(&cif, (void (*)()) func_pointer, &ret_item, values); } - (void) _id_clean_; } end: diff --git a/src/lib/generator.c b/src/lib/generator.c index 8f84e04..8550578 100644 --- a/src/lib/generator.c +++ b/src/lib/generator.c @@ -327,13 +327,13 @@ _item_iterate(Gui_Session *session, Widget_Context *wdg_ctx, const Gui_Widget *w * If TRUE, variable need to be declared and assigned. */ if (item_name) { + eina_strbuf_append_printf(wdg_ctx->buf, " eo_do_ret(%s, %s, %s(", + wdg_name_get(wdg), item_name, db_op_desc_func_name_get(op_desc)); wdg_ctx->declarations = eina_list_append(wdg_ctx->declarations, wit_id); - eina_strbuf_append_printf(wdg_ctx->buf, " %s = ", item_name); } else - eina_strbuf_append_printf(wdg_ctx->buf, " "); - eina_strbuf_append_printf(wdg_ctx->buf, "eo_do(%s, %s(", - wdg_name_get(wdg), db_op_desc_func_name_get(op_desc)); + eina_strbuf_append_printf(wdg_ctx->buf, " eo_do(%s, %s(", + wdg_name_get(wdg), db_op_desc_func_name_get(op_desc)); if (wdg_ctx->inside_cb) { --
