glima pushed a commit to branch master.

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

commit 9c4deec7e2a4d9f6fd7e2f12f5cddf21e87ee660
Author: Gustavo Lima Chaves <[email protected]>
Date:   Thu Dec 26 13:54:57 2013 -0200

    Multi button entry items now support custom parts on 
elm_object_item_text_[gs]et() calls.
    
    I also removed a crazy "if (!label) return", since no other item text
    hook on Elementary does that and I can't find a single reason for that
    to be there.
---
 src/lib/elc_multibuttonentry.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/lib/elc_multibuttonentry.c b/src/lib/elc_multibuttonentry.c
index 40c6750..634e016 100644
--- a/src/lib/elc_multibuttonentry.c
+++ b/src/lib/elc_multibuttonentry.c
@@ -539,12 +539,15 @@ _item_text_set_hook(Elm_Object_Item *it,
                     const char *label)
 {
    Elm_Multibuttonentry_Item *item;
+   const char *dest_part = NULL;
 
-   if (part && strcmp(part, "default")) return;
-   if (!label) return;
+   if (!part || !strcmp(part, "elm.text"))
+     dest_part = "elm.btn.text";
+   else
+     dest_part = part;
 
    item = (Elm_Multibuttonentry_Item *)it;
-   edje_object_part_text_escaped_set(item->button, "elm.btn.text", label);
+   edje_object_part_text_escaped_set(item->button, dest_part, label);
    _button_resize(item->base.widget, item->button, &item->rw, &item->vw);
 }
 
@@ -553,10 +556,15 @@ _item_text_get_hook(const Elm_Object_Item *it,
                     const char *part)
 {
    Elm_Multibuttonentry_Item *item;
+   const char *src_part = NULL;
+
+   if (!part || !strcmp(part, "elm.text"))
+     src_part = "elm.btn.text";
+   else
+     src_part = part;
 
-   if (part && strcmp(part, "default")) return NULL;
    item = (Elm_Multibuttonentry_Item *)it;
-   return edje_object_part_text_get(item->button, "elm.btn.text");
+   return edje_object_part_text_get(item->button, src_part);
 }
 
 static Eina_Bool

-- 


Reply via email to