yakov pushed a commit to branch master. http://git.enlightenment.org/tools/erigo.git/commit/?id=355011d0ab23017887494be284c95beae6ccc403
commit 355011d0ab23017887494be284c95beae6ccc403 Author: Yakov Goldberg <yako...@samsung.com> Date: Thu Mar 19 18:13:08 2015 +0200 Handle default value for Efl.File in Property View --- src/bin/egui_gui/props_helper.c | 23 +++++++++++++++++++---- src/bin/egui_gui/props_helper.h | 1 + src/lib/ffi_abstraction.c | 7 +++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/bin/egui_gui/props_helper.c b/src/bin/egui_gui/props_helper.c index 3e913ad..7c2961a 100644 --- a/src/bin/egui_gui/props_helper.c +++ b/src/bin/egui_gui/props_helper.c @@ -103,7 +103,15 @@ _prop_field_update(const Gui_Widget_Property *prop, Eo *item_box, It_Data *it_da Eid *eid = EID_ID_GET(prop_value_nth_get(prop, i)); const char *default_str = PROP_HOVERSEL_NONE_VALUE; if (IS_ID_VALID(eid)) - default_str = eid_name_get(eid); + { + default_str = eid_name_get(eid); + } + /* Eid == DUMMY_ID, means that value was fetched by eo_do(_get()), + * so set DEFAULT str. */ + else if (eid == DUMMY_ID) + { + default_str = DEFAULT_RESOURCE; + } eo_do(o, elm_obj_widget_part_text_set(NULL, default_str)); break; } @@ -528,10 +536,17 @@ props_value_add(Eo *box, const Gui_Widget *wdg, const Gui_Value *value, const Op if (value) { Eid *eid = EID_ID_GET(value); - if (eid) default_str = eid_name_get(eid); - if (!default_str) + if (IS_ID_VALID(eid)) + { + default_str = eid_name_get(eid); + if (!default_str) + ERR("Looks like resource image was deleted. Handle this."); + } + /* Eid == DUMMY_ID, means that value was fetched by eo_do(_get()), + * so set DEFAULT str. */ + else if (eid == DUMMY_ID) { - ERR("Looks like resource image was deleted. Handle this."); + default_str = DEFAULT_RESOURCE; } } diff --git a/src/bin/egui_gui/props_helper.h b/src/bin/egui_gui/props_helper.h index 866e0c7..b1f7b73 100644 --- a/src/bin/egui_gui/props_helper.h +++ b/src/bin/egui_gui/props_helper.h @@ -6,6 +6,7 @@ #include "egui_layout.h" #define PROP_HOVERSEL_NONE_VALUE " " +#define DEFAULT_RESOURCE "DEFAULT" /* pass Gui_Widget or Item_Container_Item */ #define IT_DATA_BUILD(type_v, wi) \ diff --git a/src/lib/ffi_abstraction.c b/src/lib/ffi_abstraction.c index 5b114a0..6c80afa 100644 --- a/src/lib/ffi_abstraction.c +++ b/src/lib/ffi_abstraction.c @@ -257,6 +257,13 @@ _ffi_eo_do_get(const Gui_Session *session, const Gui_Widget *wdg, const Gui_Widg { gui_value_string_set(gui_value, STRING_GET(gui_value)); } + /* In case of File, const char * is returned, and Erigo uses Resource ID. + * If path is not NULL, we can not translate it into Resource, so assign DUMMY. */ + else if (gv_type == GUI_TYPE_FILE) + { + if (EID_ID_GET(gui_value)) + gui_value_name_id_set(gui_value, gv_type, DUMMY_ID); + } i++; } --