diff options
author | Yakov Goldberg <yakov.g@samsung.com> | 2014-05-20 12:01:50 +0300 |
---|---|---|
committer | Yakov Goldberg <yakov.g@samsung.com> | 2014-05-20 13:26:14 +0300 |
commit | 3a53fc7331f400cf83d4000ff221d78412f8fb7d (patch) | |
tree | 61212ac4240afccd39544ff26eb299810c25cf08 | |
parent | 54b2560275e44a66f1f1cd9c690623af5702e6e3 (diff) |
wdg_get() refactoring
-rw-r--r-- | src/bin/egui_gui/editor.c | 30 | ||||
-rw-r--r-- | src/bin/egui_gui/egui_logic.c | 2 | ||||
-rw-r--r-- | src/bin/egui_gui/seqview.c | 8 | ||||
-rw-r--r-- | src/lib/ffi_abstraction.c | 10 | ||||
-rw-r--r-- | src/lib/ffi_glue.c | 4 | ||||
-rw-r--r-- | src/lib/generator.c | 4 | ||||
-rw-r--r-- | src/lib/gui_parser.c | 2 | ||||
-rw-r--r-- | src/lib/gui_widget.c | 22 | ||||
-rw-r--r-- | src/lib/gui_widget.h | 2 | ||||
-rw-r--r-- | src/lib/simulator.c | 4 | ||||
-rw-r--r-- | src/tests/suite.c | 2 |
11 files changed, 44 insertions, 46 deletions
diff --git a/src/bin/egui_gui/editor.c b/src/bin/egui_gui/editor.c index 5e8f8bc..e4d6da5 100644 --- a/src/bin/egui_gui/editor.c +++ b/src/bin/egui_gui/editor.c | |||
@@ -879,7 +879,7 @@ _content_set(Gui_Session *session, const Gui_Widget *container, const Gui_Widget | |||
879 | * container is "Box"; | 879 | * container is "Box"; |
880 | * w is "Button" */ | 880 | * w is "Button" */ |
881 | Dep_Id dep_id = DEP_ID_GET(value); | 881 | Dep_Id dep_id = DEP_ID_GET(value); |
882 | Gui_Widget *w = wdg_get(wdg_context_get(container), NULL, dep_id); | 882 | Gui_Widget *w = wdg_get(wdg_context_get(container), dep_id); |
883 | wdg_data_set(w, CONTAINER, (void *) container); | 883 | wdg_data_set(w, CONTAINER, (void *) container); |
884 | } | 884 | } |
885 | } | 885 | } |
@@ -1373,10 +1373,15 @@ _prop_update_from_propview(void *data EINA_UNUSED, Eo *obj, void *event_info) | |||
1373 | else if (type == GUI_TYPE_OBJECT) | 1373 | else if (type == GUI_TYPE_OBJECT) |
1374 | { | 1374 | { |
1375 | Dep_Id old_dep_id = (uintptr_t) DEP_ID_GET(val); | 1375 | Dep_Id old_dep_id = (uintptr_t) DEP_ID_GET(val); |
1376 | Dep_Id new_dep_id = gui_context_dep_data_get_id_by_name(_active_context_get(), new_enum_value); | ||
1377 | if (!new_dep_id) | ||
1378 | { | ||
1379 | ERR("Resource not exist for: \"%s\"", new_enum_value); | ||
1380 | } | ||
1376 | /* FIXME: need to check if widget wasn't deleted yet*/ | 1381 | /* FIXME: need to check if widget wasn't deleted yet*/ |
1377 | const char *cur_param = gui_context_dep_data_get(_active_context_get(), old_dep_id); | 1382 | const char *cur_param = gui_context_dep_data_get(_active_context_get(), old_dep_id); |
1378 | Gui_Widget *cur_param_wdg = wdg_get(_active_context_get(), cur_param, 0); | 1383 | Gui_Widget *cur_param_wdg = wdg_get(_active_context_get(), old_dep_id); |
1379 | Gui_Widget *new_param_wdg = wdg_get(_active_context_get(), new_enum_value, 0); | 1384 | Gui_Widget *new_param_wdg = wdg_get(_active_context_get(), new_dep_id); |
1380 | /* GUI_TYPE_OBJECT ops depend on other widgets, check that widget exists. | 1385 | /* GUI_TYPE_OBJECT ops depend on other widgets, check that widget exists. |
1381 | * or new one not equal old one.*/ | 1386 | * or new one not equal old one.*/ |
1382 | if ((!new_param_wdg) || (cur_param_wdg == new_param_wdg)) | 1387 | if ((!new_param_wdg) || (cur_param_wdg == new_param_wdg)) |
@@ -1385,11 +1390,6 @@ _prop_update_from_propview(void *data EINA_UNUSED, Eo *obj, void *event_info) | |||
1385 | } | 1390 | } |
1386 | /* If I simply change value in prop: t.e. "but1"->"but2" change parent of "but1".*/ | 1391 | /* If I simply change value in prop: t.e. "but1"->"but2" change parent of "but1".*/ |
1387 | /* and change dependencies. */ | 1392 | /* and change dependencies. */ |
1388 | Dep_Id new_dep_id = gui_context_dep_data_get_id_by_name(_active_context_get(), new_enum_value); | ||
1389 | if (!new_dep_id) | ||
1390 | { | ||
1391 | ERR("Resource not exist for: \"%s\"", new_enum_value); | ||
1392 | } | ||
1393 | gui_value_name_id_set(val, type, new_dep_id); | 1393 | gui_value_name_id_set(val, type, new_dep_id); |
1394 | 1394 | ||
1395 | /* Update parent, if op supports it. */ | 1395 | /* Update parent, if op supports it. */ |
@@ -1497,7 +1497,7 @@ _prop_del_from_propview(void *data, Eo *obj EINA_UNUSED, void *ev EINA_UNUSED) | |||
1497 | if (gui_value_type_get(val) == GUI_TYPE_OBJECT) | 1497 | if (gui_value_type_get(val) == GUI_TYPE_OBJECT) |
1498 | { | 1498 | { |
1499 | Dep_Id dep_id = DEP_ID_GET(val); | 1499 | Dep_Id dep_id = DEP_ID_GET(val); |
1500 | Gui_Widget *param_wdg = wdg_get(_active_context_get(), NULL, dep_id); | 1500 | Gui_Widget *param_wdg = wdg_get(_active_context_get(), dep_id); |
1501 | if (param_wdg) | 1501 | if (param_wdg) |
1502 | { | 1502 | { |
1503 | const Gui_Widget *parent_win = wdg_parent_win_wdg_get(param_wdg); | 1503 | const Gui_Widget *parent_win = wdg_parent_win_wdg_get(param_wdg); |
@@ -1598,7 +1598,8 @@ _content_del_from_propview(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Descr | |||
1598 | 1598 | ||
1599 | /* Need to remove parent container from widget. */ | 1599 | /* Need to remove parent container from widget. */ |
1600 | const char* wdg_name = wdg_container_name_get_by_id(wdg, idx); | 1600 | const char* wdg_name = wdg_container_name_get_by_id(wdg, idx); |
1601 | Gui_Widget *param_wdg = wdg_get(_active_context_get(), wdg_name, 0); | 1601 | Dep_Id name_id = gui_context_dep_data_get_id_by_name(_active_context_get(), wdg_name); |
1602 | Gui_Widget *param_wdg = wdg_get(_active_context_get(), name_id); | ||
1602 | wdg_data_set(param_wdg, CONTAINER, NULL); | 1603 | wdg_data_set(param_wdg, CONTAINER, NULL); |
1603 | /* Need to change parent for content being unset from container. | 1604 | /* Need to change parent for content being unset from container. |
1604 | * Set parent window as parent for widget. */ | 1605 | * Set parent window as parent for widget. */ |
@@ -1804,6 +1805,11 @@ _content_change_from_propview(void *data EINA_UNUSED, Eo *obj, const Eo_Event_De | |||
1804 | eo_do(obj, old_value = elm_obj_widget_part_text_get(NULL)); | 1805 | eo_do(obj, old_value = elm_obj_widget_part_text_get(NULL)); |
1805 | if (!strcmp(new_value, old_value)) | 1806 | if (!strcmp(new_value, old_value)) |
1806 | return EO_CALLBACK_CONTINUE; | 1807 | return EO_CALLBACK_CONTINUE; |
1808 | |||
1809 | Dep_Id old_name_id, new_name_id; | ||
1810 | old_name_id = gui_context_dep_data_get_id_by_name(_active_context_get(), old_value); | ||
1811 | new_name_id = gui_context_dep_data_get_id_by_name(_active_context_get(), new_value); | ||
1812 | |||
1807 | eo_do(obj, elm_obj_widget_part_text_set(NULL, new_value)); | 1813 | eo_do(obj, elm_obj_widget_part_text_set(NULL, new_value)); |
1808 | 1814 | ||
1809 | if (type == GUI_TYPE_ENUM) | 1815 | if (type == GUI_TYPE_ENUM) |
@@ -1813,8 +1819,8 @@ _content_change_from_propview(void *data EINA_UNUSED, Eo *obj, const Eo_Event_De | |||
1813 | } | 1819 | } |
1814 | if (type == GUI_TYPE_OBJECT) | 1820 | if (type == GUI_TYPE_OBJECT) |
1815 | { | 1821 | { |
1816 | Gui_Widget *old_param_wdg = wdg_get(_active_context_get(), old_value, 0); | 1822 | Gui_Widget *old_param_wdg = wdg_get(_active_context_get(), old_name_id); |
1817 | Gui_Widget *new_param_wdg = wdg_get(_active_context_get(), new_value, 0); | 1823 | Gui_Widget *new_param_wdg = wdg_get(_active_context_get(), new_name_id); |
1818 | 1824 | ||
1819 | /* Check if new_widget was packed previously. | 1825 | /* Check if new_widget was packed previously. |
1820 | * If so, we need to unpack widget and delete from contents*/ | 1826 | * If so, we need to unpack widget and delete from contents*/ |
diff --git a/src/bin/egui_gui/egui_logic.c b/src/bin/egui_gui/egui_logic.c index 77761e6..dac6c1b 100644 --- a/src/bin/egui_gui/egui_logic.c +++ b/src/bin/egui_gui/egui_logic.c | |||
@@ -499,7 +499,7 @@ _graphviz_sequence_build(Agraph_t *ag, Gui_Sequence *seq) | |||
499 | case CREATION_ACTION: | 499 | case CREATION_ACTION: |
500 | { | 500 | { |
501 | Dep_Id wdg_id = action_widget_id_get(action); | 501 | Dep_Id wdg_id = action_widget_id_get(action); |
502 | Gui_Widget *w = wdg_get(sequence_ctx_get(seq), NULL, wdg_id); | 502 | Gui_Widget *w = wdg_get(sequence_ctx_get(seq), wdg_id); |
503 | Agnode_t *wdg_node = _graphviz_widget_build(ag, w); | 503 | Agnode_t *wdg_node = _graphviz_widget_build(ag, w); |
504 | agedge(ag, seq_node, wdg_node, 0, 1); | 504 | agedge(ag, seq_node, wdg_node, 0, 1); |
505 | break; | 505 | break; |
diff --git a/src/bin/egui_gui/seqview.c b/src/bin/egui_gui/seqview.c index 2b9de61..5a846b1 100644 --- a/src/bin/egui_gui/seqview.c +++ b/src/bin/egui_gui/seqview.c | |||
@@ -148,7 +148,7 @@ _action_prop_selected(void *data, Eo *obj EINA_UNUSED, void *event_info) | |||
148 | { | 148 | { |
149 | Dep_Id wdg_id = action_widget_id_get(action); | 149 | Dep_Id wdg_id = action_widget_id_get(action); |
150 | 150 | ||
151 | Gui_Widget *wdg = wdg_id ? wdg_get(action_ctx_get(action), NULL, wdg_id) : NULL; | 151 | Gui_Widget *wdg = wdg_id ? wdg_get(action_ctx_get(action), wdg_id) : NULL; |
152 | Op_Desc *op = db_mro_op_desc_get(wdg_class_name_get(wdg), prop_name); | 152 | Op_Desc *op = db_mro_op_desc_get(wdg_class_name_get(wdg), prop_name); |
153 | Gui_Widget_Property *prop = prop_create_for_op(op); | 153 | Gui_Widget_Property *prop = prop_create_for_op(op); |
154 | action_property_set(action, prop); | 154 | action_property_set(action, prop); |
@@ -234,8 +234,8 @@ _action_prop_update(void *data, Eo *obj, void *event_info) | |||
234 | { | 234 | { |
235 | Dep_Id dep_id = DEP_ID_GET(val); | 235 | Dep_Id dep_id = DEP_ID_GET(val); |
236 | Dep_Id new_name_id = gui_context_dep_data_get_id_by_name(_active_ctx, new_enum_value); | 236 | Dep_Id new_name_id = gui_context_dep_data_get_id_by_name(_active_ctx, new_enum_value); |
237 | Gui_Widget *cur_param_wdg = wdg_get(_active_ctx, NULL, dep_id); | 237 | Gui_Widget *cur_param_wdg = wdg_get(_active_ctx, dep_id); |
238 | Gui_Widget *new_param_wdg = wdg_get(_active_ctx, NULL, new_name_id); | 238 | Gui_Widget *new_param_wdg = wdg_get(_active_ctx, new_name_id); |
239 | /* GUI_TYPE_OBJECT ops depend on other widgets, check that widget exists. | 239 | /* GUI_TYPE_OBJECT ops depend on other widgets, check that widget exists. |
240 | * or new one not equal old one.*/ | 240 | * or new one not equal old one.*/ |
241 | if ((!new_param_wdg) || (cur_param_wdg == new_param_wdg)) | 241 | if ((!new_param_wdg) || (cur_param_wdg == new_param_wdg)) |
@@ -321,7 +321,7 @@ _action_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part E | |||
321 | if (act_type == MODIF_ACTION) | 321 | if (act_type == MODIF_ACTION) |
322 | { | 322 | { |
323 | Dep_Id wdg_id = action_widget_id_get(action); | 323 | Dep_Id wdg_id = action_widget_id_get(action); |
324 | Gui_Widget *wdg = wdg_id ? wdg_get(action_ctx_get(action), NULL, wdg_id) : NULL; | 324 | Gui_Widget *wdg = wdg_id ? wdg_get(action_ctx_get(action), wdg_id) : NULL; |
325 | Gui_Widget_Property *prop = action_property_get(action); | 325 | Gui_Widget_Property *prop = action_property_get(action); |
326 | Eo *props_hover = props_hoversel_object_ops_add(box, elm_widget_top_get(lst), " --- ", wdg); | 326 | Eo *props_hover = props_hoversel_object_ops_add(box, elm_widget_top_get(lst), " --- ", wdg); |
327 | evas_object_smart_callback_add(props_hover, "selected", _action_prop_selected, action); | 327 | evas_object_smart_callback_add(props_hover, "selected", _action_prop_selected, action); |
diff --git a/src/lib/ffi_abstraction.c b/src/lib/ffi_abstraction.c index e8a3a7f..6b2870c 100644 --- a/src/lib/ffi_abstraction.c +++ b/src/lib/ffi_abstraction.c | |||
@@ -100,8 +100,7 @@ _ffi_eo_do(const Gui_Session *session, const Gui_Widget *wdg, const Gui_Widget_P | |||
100 | { | 100 | { |
101 | Dep_Id dep_id = DEP_ID_GET(gui_value); | 101 | Dep_Id dep_id = DEP_ID_GET(gui_value); |
102 | 102 | ||
103 | Eo *tobj = session_eo_get(session, | 103 | Eo *tobj = session_eo_get(session, wdg_get(wdg_context_get(wdg), dep_id)); |
104 | wdg_get(wdg_context_get(wdg), NULL, dep_id)); | ||
105 | objects[i] = tobj; | 104 | objects[i] = tobj; |
106 | p = &objects[i]; | 105 | p = &objects[i]; |
107 | } | 106 | } |
@@ -306,8 +305,7 @@ _ffi_eo_do_content(const Gui_Session *session, const Gui_Widget *wdg, const Gui_ | |||
306 | if (gui_value_type_get(gui_value) == GUI_TYPE_OBJECT) | 305 | if (gui_value_type_get(gui_value) == GUI_TYPE_OBJECT) |
307 | { | 306 | { |
308 | Dep_Id dep_id = DEP_ID_GET(gui_value); | 307 | Dep_Id dep_id = DEP_ID_GET(gui_value); |
309 | Eo *tobj = session_eo_get(session, | 308 | Eo *tobj = session_eo_get(session, wdg_get(wdg_context_get(wdg), dep_id)); |
310 | wdg_get(wdg_context_get(wdg), NULL, dep_id)); | ||
311 | objects[i] = tobj; | 309 | objects[i] = tobj; |
312 | p = &objects[i]; | 310 | p = &objects[i]; |
313 | } | 311 | } |
@@ -428,10 +426,8 @@ _ffi_eo_item_add(const Gui_Session *session, const Gui_Widget *wdg, const Gui_Wi | |||
428 | 426 | ||
429 | Dep_Id dep_id = DEP_ID_GET(gui_value); | 427 | Dep_Id dep_id = DEP_ID_GET(gui_value); |
430 | const Gui_Context *ctx = wdg_context_get(wdg); | 428 | const Gui_Context *ctx = wdg_context_get(wdg); |
431 | const char *wdg_name = gui_context_dep_data_get(ctx, dep_id); | ||
432 | 429 | ||
433 | Eo *tobj = session_eo_get(session, | 430 | Eo *tobj = session_eo_get(session, wdg_get(ctx, dep_id)); |
434 | wdg_get(ctx, wdg_name, 0)); | ||
435 | objects[i] = tobj; | 431 | objects[i] = tobj; |
436 | p = &objects[i]; | 432 | p = &objects[i]; |
437 | } | 433 | } |
diff --git a/src/lib/ffi_glue.c b/src/lib/ffi_glue.c index 084a841..21f8c6d 100644 --- a/src/lib/ffi_glue.c +++ b/src/lib/ffi_glue.c | |||
@@ -50,7 +50,7 @@ _wdg_prop_eo_do_test(Gui_Session *session, const Gui_Widget *wdg, const Gui_Widg | |||
50 | if (gui_value_type_get(val) == GUI_TYPE_OBJECT) | 50 | if (gui_value_type_get(val) == GUI_TYPE_OBJECT) |
51 | { | 51 | { |
52 | Dep_Id dep_id = DEP_ID_GET(val); | 52 | Dep_Id dep_id = DEP_ID_GET(val); |
53 | Gui_Widget *wdg_tmp = wdg_get(wdg_context_get(wdg), NULL, dep_id); | 53 | Gui_Widget *wdg_tmp = wdg_get(wdg_context_get(wdg), dep_id); |
54 | 54 | ||
55 | if (!session_wdg_exists(session, wdg_tmp)) | 55 | if (!session_wdg_exists(session, wdg_tmp)) |
56 | { | 56 | { |
@@ -116,7 +116,7 @@ manager_widget_content_add(Gui_Session *session, const Gui_Widget *wdg, Action_M | |||
116 | { | 116 | { |
117 | Dep_Id dep_id = DEP_ID_GET(val); | 117 | Dep_Id dep_id = DEP_ID_GET(val); |
118 | /* FIXME: check if object exists, if not delete this property from container. */ | 118 | /* FIXME: check if object exists, if not delete this property from container. */ |
119 | w = wdg_get(wdg_context_get(wdg), NULL, dep_id); | 119 | w = wdg_get(wdg_context_get(wdg), dep_id); |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
diff --git a/src/lib/generator.c b/src/lib/generator.c index 474f430..f31ab24 100644 --- a/src/lib/generator.c +++ b/src/lib/generator.c | |||
@@ -462,7 +462,7 @@ _sequence_generate(Gui_Session *session, Gui_Sequence *seq, Global_Gen_Context * | |||
462 | case CREATION_ACTION: | 462 | case CREATION_ACTION: |
463 | { | 463 | { |
464 | Dep_Id wdg_id = action_widget_id_get(action); | 464 | Dep_Id wdg_id = action_widget_id_get(action); |
465 | Gui_Widget *w = wdg_get(gl_ctx->ctx, NULL, wdg_id); | 465 | Gui_Widget *w = wdg_get(gl_ctx->ctx, wdg_id); |
466 | if (!w) | 466 | if (!w) |
467 | { | 467 | { |
468 | ERR("Failed to find \"%d\" widget.", wdg_id); | 468 | ERR("Failed to find \"%d\" widget.", wdg_id); |
@@ -483,7 +483,7 @@ _sequence_generate(Gui_Session *session, Gui_Sequence *seq, Global_Gen_Context * | |||
483 | const Gui_Context *ctx = gl_ctx->ctx; | 483 | const Gui_Context *ctx = gl_ctx->ctx; |
484 | Dep_Id wdg_id = action_widget_id_get(action); | 484 | Dep_Id wdg_id = action_widget_id_get(action); |
485 | const char *wdg_name = gui_context_dep_data_get(ctx, wdg_id); | 485 | const char *wdg_name = gui_context_dep_data_get(ctx, wdg_id); |
486 | Gui_Widget *wdg = wdg_get(ctx, NULL, wdg_id); | 486 | Gui_Widget *wdg = wdg_get(ctx, wdg_id); |
487 | Gui_Widget_Property *prop = action_property_get(action); | 487 | Gui_Widget_Property *prop = action_property_get(action); |
488 | 488 | ||
489 | /* If parameter of action's property is object, need to declare it as (static) global. */ | 489 | /* If parameter of action's property is object, need to declare it as (static) global. */ |
diff --git a/src/lib/gui_parser.c b/src/lib/gui_parser.c index 3679dc6..8572a18 100644 --- a/src/lib/gui_parser.c +++ b/src/lib/gui_parser.c | |||
@@ -661,7 +661,7 @@ _sequence_parse(Gui_Context *gui_ctx, Dep_Id seq_id, Eina_Json_Value *sequence_j | |||
661 | const char *wdg_modif_name = eina_json_string_get(eina_json_array_nth_get(cur, 0)); | 661 | const char *wdg_modif_name = eina_json_string_get(eina_json_array_nth_get(cur, 0)); |
662 | // check if modif widget is already created | 662 | // check if modif widget is already created |
663 | Dep_Id wdg_id = gui_context_dep_data_get_id_by_name(gui_ctx, wdg_modif_name); | 663 | Dep_Id wdg_id = gui_context_dep_data_get_id_by_name(gui_ctx, wdg_modif_name); |
664 | Gui_Widget *modif_wdg = wdg_get(gui_ctx, NULL, wdg_id); | 664 | Gui_Widget *modif_wdg = wdg_get(gui_ctx, wdg_id); |
665 | if (!modif_wdg) | 665 | if (!modif_wdg) |
666 | { | 666 | { |
667 | goto end; | 667 | goto end; |
diff --git a/src/lib/gui_widget.c b/src/lib/gui_widget.c index 6b4757a..2ec51f9 100644 --- a/src/lib/gui_widget.c +++ b/src/lib/gui_widget.c | |||
@@ -382,10 +382,6 @@ gui_context_free_name_get(const Gui_Context *ctx, const char *class_name) | |||
382 | eina_hash_set(ctx->names_hash, class_name, (void *) (uintptr_t) id); | 382 | eina_hash_set(ctx->names_hash, class_name, (void *) (uintptr_t) id); |
383 | break; | 383 | break; |
384 | } | 384 | } |
385 | else | ||
386 | { | ||
387 | ERR("Name: \"%s\" exist.", name); | ||
388 | } | ||
389 | } | 385 | } |
390 | return name; | 386 | return name; |
391 | } | 387 | } |
@@ -675,15 +671,10 @@ wdg_prop_del(Gui_Widget *wdg, Gui_Widget_Property *prop) | |||
675 | } | 671 | } |
676 | 672 | ||
677 | Gui_Widget* | 673 | Gui_Widget* |
678 | wdg_get(const Gui_Context *ctx, const char *wdg_name, Dep_Id _dep_id) | 674 | wdg_get(const Gui_Context *ctx, Dep_Id dep_id) |
679 | { | 675 | { |
680 | EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, NULL); | 676 | EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, NULL); |
681 | Dep_Id dep_id = _dep_id; | ||
682 | Gui_Widget *wdg = NULL; | 677 | Gui_Widget *wdg = NULL; |
683 | if (wdg_name) | ||
684 | { | ||
685 | dep_id = (uintptr_t) eina_hash_find(ctx->deps_by_name, wdg_name); | ||
686 | } | ||
687 | if (dep_id == 0) | 678 | if (dep_id == 0) |
688 | return NULL; | 679 | return NULL; |
689 | wdg = eina_hash_find(ctx->wdg_hash, &dep_id); | 680 | wdg = eina_hash_find(ctx->wdg_hash, &dep_id); |
@@ -919,9 +910,13 @@ wdg_parent_set(Gui_Widget *wdg, const char *parent_name) | |||
919 | { | 910 | { |
920 | EINA_SAFETY_ON_NULL_RETURN_VAL(wdg, EINA_FALSE); | 911 | EINA_SAFETY_ON_NULL_RETURN_VAL(wdg, EINA_FALSE); |
921 | Gui_Widget *parent_wdg = NULL; | 912 | Gui_Widget *parent_wdg = NULL; |
913 | Dep_Id name_id = 0; | ||
914 | |||
922 | if (parent_name) | 915 | if (parent_name) |
923 | parent_wdg = wdg_get(wdg->ctx, parent_name, 0); | 916 | name_id = gui_context_dep_data_get_id_by_name(wdg_context_get(wdg), parent_name); |
924 | if ((parent_name) && (!parent_wdg)) | 917 | if (name_id) |
918 | parent_wdg = wdg_get(wdg->ctx, name_id); | ||
919 | if ((name_id) && (!parent_wdg)) | ||
925 | { | 920 | { |
926 | return EINA_FALSE; | 921 | return EINA_FALSE; |
927 | } | 922 | } |
@@ -942,7 +937,8 @@ wdg_parent_win_wdg_get(const Gui_Widget *wdg) | |||
942 | parent_name = wdg_parent_name_get(wdg); | 937 | parent_name = wdg_parent_name_get(wdg); |
943 | while (parent_name) | 938 | while (parent_name) |
944 | { | 939 | { |
945 | wdg = wdg_get(wdg_context_get(wdg), parent_name, 0); | 940 | Dep_Id name_id = gui_context_dep_data_get_id_by_name(wdg_context_get(wdg), parent_name); |
941 | wdg = wdg_get(wdg_context_get(wdg), name_id); | ||
946 | if (IS_WIN(wdg)) return wdg; | 942 | if (IS_WIN(wdg)) return wdg; |
947 | parent_name = wdg_parent_name_get(wdg); | 943 | parent_name = wdg_parent_name_get(wdg); |
948 | } | 944 | } |
diff --git a/src/lib/gui_widget.h b/src/lib/gui_widget.h index ccc1ac3..aa2c39a 100644 --- a/src/lib/gui_widget.h +++ b/src/lib/gui_widget.h | |||
@@ -240,7 +240,7 @@ wdg_new(const Gui_Context *_ctx, const char *class_name, Dep_Id dep_id); | |||
240 | 240 | ||
241 | /* Get widget by name. */ | 241 | /* Get widget by name. */ |
242 | Gui_Widget* | 242 | Gui_Widget* |
243 | wdg_get(const Gui_Context *ctx, const char *wdg_name, Dep_Id dep_id); | 243 | wdg_get(const Gui_Context *ctx, Dep_Id dep_id); |
244 | 244 | ||
245 | /* Find first widget, which has name like "wdg_name"*/ | 245 | /* Find first widget, which has name like "wdg_name"*/ |
246 | Gui_Widget* | 246 | Gui_Widget* |
diff --git a/src/lib/simulator.c b/src/lib/simulator.c index 8f4cc93..3ddc06f 100644 --- a/src/lib/simulator.c +++ b/src/lib/simulator.c | |||
@@ -58,7 +58,7 @@ _execute_sequence(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *d | |||
58 | case CREATION_ACTION: | 58 | case CREATION_ACTION: |
59 | { | 59 | { |
60 | Dep_Id wdg_id = action_widget_id_get(action); | 60 | Dep_Id wdg_id = action_widget_id_get(action); |
61 | Gui_Widget *wdg = wdg_get(ctx, NULL, wdg_id); | 61 | Gui_Widget *wdg = wdg_get(ctx, wdg_id); |
62 | /* EINA_TRUE is passed to force creation of first widget. | 62 | /* EINA_TRUE is passed to force creation of first widget. |
63 | * Have to remove this bloody flag cause bigbang action is here for that. | 63 | * Have to remove this bloody flag cause bigbang action is here for that. |
64 | */ | 64 | */ |
@@ -69,7 +69,7 @@ _execute_sequence(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *d | |||
69 | case MODIF_ACTION: | 69 | case MODIF_ACTION: |
70 | { | 70 | { |
71 | Dep_Id wdg_id = action_widget_id_get(action); | 71 | Dep_Id wdg_id = action_widget_id_get(action); |
72 | Gui_Widget *wdg = wdg_get(ctx, NULL, wdg_id); | 72 | Gui_Widget *wdg = wdg_get(ctx, wdg_id); |
73 | if (!wdg) | 73 | if (!wdg) |
74 | { | 74 | { |
75 | ERR("Widget \"%d\" doesn't exist in project", wdg_id); | 75 | ERR("Widget \"%d\" doesn't exist in project", wdg_id); |
diff --git a/src/tests/suite.c b/src/tests/suite.c index 7d4b584..a24b61c 100644 --- a/src/tests/suite.c +++ b/src/tests/suite.c | |||
@@ -176,7 +176,7 @@ START_TEST(test_wdg) | |||
176 | Dep_Id wdg_id = gui_context_dep_data_set(ctx, "class_name"); | 176 | Dep_Id wdg_id = gui_context_dep_data_set(ctx, "class_name"); |
177 | wdg_tmp = wdg_new(ctx, wdg_name, wdg_id); | 177 | wdg_tmp = wdg_new(ctx, wdg_name, wdg_id); |
178 | fail_if(!wdg_tmp); | 178 | fail_if(!wdg_tmp); |
179 | wdg = wdg_get(wdg_context_get(wdg_tmp), wdg_name, 0); | 179 | wdg = wdg_get(wdg_context_get(wdg_tmp), NULL, wdg_id); |
180 | fail_if(!wdg); | 180 | fail_if(!wdg); |
181 | ck_assert_str_eq(wdg_name_get(wdg), wdg_name); | 181 | ck_assert_str_eq(wdg_name_get(wdg), wdg_name); |
182 | 182 | ||