cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=93d3b5e28594b4b660bbaa90f92f5f2fdc67a087

commit 93d3b5e28594b4b660bbaa90f92f5f2fdc67a087
Author: Maksym Volodin <[email protected]>
Date:   Thu Jul 10 11:51:26 2014 +0200

    edje: Edje_edit - edje_edit_state_text_source_set and 
edje_edit_state_text_text_source_set logic fix.
    
    Summary: Patch make it possible to set NULL value for text_text_source and 
text_source.
    
    Reviewers: cedric, raster, Hermet, seoz, reutskiy.v.v
    
    Subscribers: cedric, reutskiy.v.v
    
    Differential Revision: https://phab.enlightenment.org/D1167
    
    Signed-off-by: Cedric BAIL <[email protected]>
---
 src/lib/edje/edje_edit.c | 57 ++++++++++++++++++++++++++++++------------------
 1 file changed, 36 insertions(+), 21 deletions(-)

diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index c437e19..1dc78f4 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -6852,24 +6852,32 @@ edje_edit_state_text_text_source_set(Evas_Object *obj, 
const char *part, const c
    const char *text_source;
    int id_text_source;
 
-   if (!source) return EINA_FALSE;
    GET_PD_OR_RETURN(EINA_FALSE);
 
    if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
        (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
      return EINA_FALSE;
 
-   spd = _edje_part_description_find_byname(eed, source, state, value);
-   txt = (Edje_Part_Description_Text *) pd;
-   source_txt = (Edje_Part_Description_Text *) spd;
+   if (source)
+     {
+        spd = _edje_part_description_find_byname(eed, source, state, value);
+        txt = (Edje_Part_Description_Text *) pd;
+        source_txt = (Edje_Part_Description_Text *) spd;
 
-   id_text_source = _edje_part_id_find(ed, source);
-   txt->text.id_text_source = id_text_source;
+        id_text_source = _edje_part_id_find(ed, source);
+        txt->text.id_text_source = id_text_source;
 
-   text_source = source_txt->text.text.str;
-   _edje_if_string_free(ed, txt->text.text.str);
-   txt->text.text.str = eina_stringshare_add(text_source);
-   txt->text.text.id = 0;
+        text_source = source_txt->text.text.str;
+        _edje_if_string_free(ed, txt->text.text.str);
+        txt->text.text.str = eina_stringshare_add(text_source);
+        txt->text.text.id = 0;
+     }
+   else
+     {
+        txt = (Edje_Part_Description_Text *) pd;
+        txt->text.id_text_source = -1;
+        txt->text.text.str = eina_stringshare_add(NULL);
+     }
 
    edje_object_calc_force(obj);
    return EINA_TRUE;
@@ -6904,24 +6912,31 @@ edje_edit_state_text_source_set(Evas_Object *obj, const 
char *part, const char *
    int id_source;
 
    GET_PD_OR_RETURN(EINA_FALSE);
-   if (!source) return EINA_FALSE;
 
    if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
        (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
      return EINA_FALSE;
 
-   spd = _edje_part_description_find_byname(eed, source, state, value);
-   txt = (Edje_Part_Description_Text *) pd;
-   source_style = (Edje_Part_Description_Text *) spd;
-
-   id_source = _edje_part_id_find(ed, source);
-   txt->text.id_source = id_source;
+   if (source)
+     {
+        spd = _edje_part_description_find_byname(eed, source, state, value);
+        txt = (Edje_Part_Description_Text *) pd;
+        source_style = (Edje_Part_Description_Text *) spd;
 
-   style_source = source_style->text.text.str;
-   _edje_if_string_free(ed, txt->text.text.str);
-   txt->text.text.str = eina_stringshare_add(style_source);
-   txt->text.text.id = 0;
+        id_source = _edje_part_id_find(ed, source);
+        txt->text.id_source = id_source;
 
+        style_source = source_style->text.text.str;
+        _edje_if_string_free(ed, txt->text.text.str);
+        txt->text.text.str = eina_stringshare_add(style_source);
+        txt->text.text.id = 0;
+     }
+   else
+     {
+        txt = (Edje_Part_Description_Text *) pd;
+        txt->text.id_source = -1;
+        txt->text.text.str = eina_stringshare_add(NULL);
+     }
    /* need to recalc, because the source part can has a text */
    edje_object_calc_force(obj);
    return EINA_TRUE;

-- 


Reply via email to