summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubodh Kumar <s7158.kumar@samsung.com>2016-01-12 13:25:12 +0000
committerTom Hacohen <tom@stosb.com>2016-01-12 13:25:12 +0000
commit9fc1eed7a62241d9339ba5cc045de51cd9823837 (patch)
treee344c62f34558c8d63c6d1c3ab57692a1097ef9c
parent3b3091796c6faf62a68a16f7defeb3dae61dca26 (diff)
downloadelementary-devs/tasn/wip.tar.gz
Elm entry: Use edje api and simplify empty check logicdevs/tasn/wip
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
-rw-r--r--src/lib/elm_entry.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index a2c6d73b1..f013618cb 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*