From 73c2ae44e0ae7404c64e2da1c0220301392a2220 Mon Sep 17 00:00:00 2001 From: "m.biliavskyi" Date: Tue, 29 Oct 2013 10:23:42 +0900 Subject: [PATCH] edje: return Eina_Bool values in setters for dragable confine and event params in Edje_Edit API. Many Edje_Edit API can fail and don't return any error information. This patch start returning Eina_Bool for setters on dragable confine and event params to catch those error. Reviewers: cedric Reviewed By: cedric CC: seoz Differential Revision: https://phab.enlightenment.org/D274 Signed-off-by: Cedric Bail --- src/lib/edje/Edje_Edit.h | 8 ++++++-- src/lib/edje/edje_edit.c | 15 ++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 131744b..40626db 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -1103,8 +1103,10 @@ EAPI const char * edje_edit_part_drag_confine_get(Evas_Object *obj, const char * * @param obj Object being edited. * @param part Part to set the name that is used as 'confine' for the given draggies. * @param confine The name of the confine part or NULL to unset confine. + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. */ -EAPI void edje_edit_part_drag_confine_set(Evas_Object *obj, const char *part, const char *confine); +EAPI Eina_Bool edje_edit_part_drag_confine_set(Evas_Object *obj, const char *part, const char *confine); /** Get the name of the part that is used as the receiver of the drag event. * @@ -1120,8 +1122,10 @@ EAPI const char * edje_edit_part_drag_event_get(Evas_Object *obj, const char *pa * @param obj Object being edited. * @param part Part to set the name that will receive events from the given draggies. * @param event The name of the part that will receive events, or NULL to unset. + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. */ -EAPI void edje_edit_part_drag_event_set(Evas_Object *obj, const char *part, const char *event); +EAPI Eina_Bool edje_edit_part_drag_event_set(Evas_Object *obj, const char *part, const char *event); //@} diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index e44c076..1999f49 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -2592,20 +2592,25 @@ FUNC_PART_DRAG_INT(count, y); p = ed->table_parts[rp->part->dragable.Id##_id]; \ return eina_stringshare_add(p->part->name); \ } \ - EAPI void \ + EAPI Eina_Bool \ edje_edit_part_drag_##Id##_set(Evas_Object *obj, const char *part, const char *e) \ { \ Edje_Real_Part *e_part; \ \ - GET_RP_OR_RETURN(); \ - if (!e) \ + eina_error_set(0); \ + if ((!obj) || (!part)) \ + return EINA_FALSE; \ + \ + GET_RP_OR_RETURN(EINA_FALSE); \ + if (!e) \ { \ rp->part->dragable.Id##_id = -1; \ - return; \ + return EINA_TRUE; \ } \ - \ e_part = _edje_real_part_get(ed, e); \ + if (!e_part) return EINA_FALSE; \ rp->part->dragable.Id##_id = e_part->part->id; \ + return EINA_TRUE; \ } FUNC_PART_DRAG_ID(confine); -- 2.7.4