summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2015-01-04 15:11:15 +0200
committerYakov Goldberg <yakov.g@samsung.com>2015-01-04 15:11:15 +0200
commit6ede272cc94b0c59de7b9ae9f262a89ba75fe6c4 (patch)
treef2aa5b158d19333bb18d1589900418a57b9d4b0a
parenta3a591fc29b98bd00754ebf5995bf1119f5ba7f4 (diff)
Fix duplicate adding of empty string into resource hoversel
-rw-r--r--src/bin/egui_gui/props_helper.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/bin/egui_gui/props_helper.c b/src/bin/egui_gui/props_helper.c
index f6efbf6..90e7860 100644
--- a/src/bin/egui_gui/props_helper.c
+++ b/src/bin/egui_gui/props_helper.c
@@ -408,7 +408,19 @@ props_hoversel_resources_add(Eo *box, Eo *hoversel, Eo *hover_parent, const char
408 hoversel = eo_add(ELM_HOVERSEL_CLASS, box); 408 hoversel = eo_add(ELM_HOVERSEL_CLASS, box);
409 eo_do(hoversel, elm_obj_hoversel_hover_parent_set(hover_parent)); 409 eo_do(hoversel, elm_obj_hoversel_hover_parent_set(hover_parent));
410 } 410 }
411 elm_hoversel_item_add(hoversel, PROP_HOVERSEL_NONE_VALUE, NULL, ELM_ICON_NONE, NULL, NULL); 411 /* Check if empty string was added already.
412 * If not - add it. */
413 const Eina_List *itr;
414 Elm_Object_Item *it;
415 Eina_Bool add_empty = EINA_TRUE;
416 EINA_LIST_FOREACH(eo_do(hoversel, elm_obj_hoversel_items_get()), itr, it)
417 {
418 const char *str = elm_object_item_text_get(it);
419 if (str && !strcmp(str, PROP_HOVERSEL_NONE_VALUE))
420 add_empty = EINA_FALSE;
421 }
422 if (add_empty)
423 elm_hoversel_item_add(hoversel, PROP_HOVERSEL_NONE_VALUE, NULL, ELM_ICON_NONE, NULL, NULL);
412 424
413 if (!default_val) 425 if (!default_val)
414 { 426 {
@@ -416,7 +428,7 @@ props_hoversel_resources_add(Eo *box, Eo *hoversel, Eo *hover_parent, const char
416 } 428 }
417 elm_object_text_set(hoversel, default_val); 429 elm_object_text_set(hoversel, default_val);
418 430
419 const Eina_List *res_lst, *itr; 431 const Eina_List *res_lst;
420 Eid *res_id; 432 Eid *res_id;
421 res_lst = gui_context_resource_list_get(ctx, type); 433 res_lst = gui_context_resource_list_get(ctx, type);
422 EINA_LIST_FOREACH(res_lst, itr, res_id) 434 EINA_LIST_FOREACH(res_lst, itr, res_id)