tasn pushed a commit to branch master.

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

commit b82092f4f3260c71dd27909f46465c38673543fa
Author: Subodh Kumar <s7158.ku...@samsung.com>
Date:   Tue Jan 12 13:25:12 2016 +0000

    Elm entry: Use edje api and simplify empty check logic
    
    Summary: Use edje api and simplify empty check logic
    
    Test Plan: NA
    
    Reviewers: herdsman, tasn
    
    Reviewed By: tasn
    
    Subscribers: shilpasingh, cedric
    
    Differential Revision: https://phab.enlightenment.org/D3505
---
 src/lib/elm_entry.c | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index 6d0e4d7..226f5a5 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -3989,26 +3989,15 @@ _elm_entry_entry_append(Eo *obj EINA_UNUSED, 
Elm_Entry_Data *sd, const char *ent
 EOLIAN static Eina_Bool
 _elm_entry_is_empty(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
 {
-   Eina_Bool ret;
-   /* FIXME: until there's support for that in textblock, we just
-    * check to see if the there is text or not. */
-   const Evas_Object *tb;
-   Evas_Textblock_Cursor *cur;
-
-   /* It's a hack until we get the support suggested above.  We just
-    * create a cursor, point it to the beginning, and then try to
-    * advance it, if it can advance, the tb is not empty, otherwise it
-    * is. */
-   tb = edje_object_part_object_get(sd->entry_edje, "elm.text");
-
-   /* This is actually, ok for the time being, these hackish stuff
-      will be removed once evas 1.0 is out */
-   cur = evas_object_textblock_cursor_new((Evas_Object *)tb);
-   evas_textblock_cursor_pos_set(cur, 0);
-   ret = evas_textblock_cursor_char_next(cur);
-   evas_textblock_cursor_free(cur);
+   edje_object_part_text_cursor_copy
+               (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN, 
EDJE_CURSOR_USER);
+   edje_object_part_text_cursor_pos_set
+                              (sd->entry_edje, "elm.text", EDJE_CURSOR_USER, 
1);
+   if (edje_object_part_text_cursor_pos_get
+                            (sd->entry_edje, "elm.text", EDJE_CURSOR_USER) == 
1)
+     return EINA_FALSE;
 
-   return !ret;
+   return EINA_TRUE;
 }
 
 EOLIAN static Evas_Object*

-- 


Reply via email to