kimcinoo pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=d5218350490f893e115f59d274570d11b4af6e4c

commit d5218350490f893e115f59d274570d11b4af6e4c
Author: Jaehyun Cho <jae_hyun....@samsung.com>
Date:   Thu Jul 31 21:26:14 2014 +0900

    elc_naviframe: Fix access info set for naviframe prev_btn and next_btn.
    
    Summary: Do not set access info for naviframe prev_btn and next_btn when 
their access info are already set.
    
    Reviewers: Hermet, kimcinoo
    
    Reviewed By: kimcinoo
    
    Differential Revision: https://phab.enlightenment.org/D1255
---
 src/lib/elc_naviframe.c | 43 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 38 insertions(+), 5 deletions(-)

diff --git a/src/lib/elc_naviframe.c b/src/lib/elc_naviframe.c
index 2e58c44..1c6d7b8 100644
--- a/src/lib/elc_naviframe.c
+++ b/src/lib/elc_naviframe.c
@@ -280,6 +280,27 @@ _access_object_get(Elm_Naviframe_Item *it, const char* 
part)
    return ao;
 }
 
+static Eina_Bool
+_access_info_has(Evas_Object *obj, int type)
+{
+   Elm_Access_Info *ac;
+   Elm_Access_Item *ai;
+   Eina_List *l;
+
+   ac = _elm_access_info_get(obj);
+   if (!ac) return EINA_FALSE;
+
+   EINA_LIST_FOREACH(ac->items, l, ai)
+     {
+        if (ai->type == type)
+          {
+             if (ai->func || ai->data) return EINA_TRUE;
+          }
+     }
+
+   return EINA_FALSE;
+}
+
 static void
 _item_signals_emit(Elm_Naviframe_Item *it)
 {
@@ -1203,9 +1224,15 @@ _item_new(Evas_Object *obj,
         _item_content_set_hook((Elm_Object_Item *)it, PREV_BTN_PART, prev_btn);
 
         if (!elm_layout_text_get(prev_btn, NULL))
-          _elm_access_callback_set
-            (_elm_access_info_get(prev_btn), ELM_ACCESS_INFO,
-             _access_prev_btn_info_cb, it);
+          {
+             if (!_access_info_has(prev_btn, ELM_ACCESS_INFO))
+               {
+                  /* set access info */
+                  _elm_access_callback_set
+                     (_elm_access_info_get(prev_btn), ELM_ACCESS_INFO,
+                      _access_prev_btn_info_cb, it);
+               }
+          }
      }
 
    if (next_btn)
@@ -1213,8 +1240,14 @@ _item_new(Evas_Object *obj,
         _item_content_set_hook((Elm_Object_Item *)it, NEXT_BTN_PART, next_btn);
 
         if (!elm_layout_text_get(next_btn, NULL))
-          _elm_access_text_set
-            (_elm_access_info_get(next_btn), ELM_ACCESS_INFO, E_("Next"));
+          {
+             if (!_access_info_has(next_btn, ELM_ACCESS_INFO))
+               {
+                  /* set access info */
+                  _elm_access_text_set
+                     (_elm_access_info_get(next_btn), ELM_ACCESS_INFO, 
E_("Next"));
+               }
+          }
      }
 
    _item_content_set(it, content);

-- 


Reply via email to