From 26cd65cfcb7605330133effc841baa8fac9e0131 Mon Sep 17 00:00:00 2001 From: Vorobiov Vitalii Date: Wed, 30 Oct 2013 21:45:00 +0900 Subject: [PATCH] edje: Make setters for "edje_edit_state_min/max..." return Eina_Bool This patch start returning Eina_Bool for state's min and max value setters, so we can now catch error when calling those function. edje_edit_state_min_h_set edje_edit_state_min_w_set edje_edit_state_max_h_set edje_edit_state_max_w_set Reviewers: cedric, seoz Reviewed By: cedric CC: reutskiy.v.v Differential Revision: https://phab.enlightenment.org/D298 Signed-off-by: Cedric Bail --- src/lib/edje/Edje_Edit.h | 8 ++++---- src/lib/edje/edje_edit.c | 20 ++++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 1a6d037..1c3f24f 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -1608,7 +1608,7 @@ EAPI int edje_edit_state_min_w_get(Evas_Object *obj, const char *part, const cha * @param value The state value. * @param min_w Minimum width value. */ -EAPI void edje_edit_state_min_w_set(Evas_Object *obj, const char *part, const char *state, double value, int min_w); +EAPI Eina_Bool edje_edit_state_min_w_set(Evas_Object *obj, const char *part, const char *state, double value, int min_w); /** Get the minimum height value of a part state. * @@ -1629,7 +1629,7 @@ EAPI int edje_edit_state_min_h_get(Evas_Object *obj, const char *part, const cha * @param value The state value. * @param min_h Minimum height value. */ -EAPI void edje_edit_state_min_h_set(Evas_Object *obj, const char *part, const char *state, double value, int min_h); +EAPI Eina_Bool edje_edit_state_min_h_set(Evas_Object *obj, const char *part, const char *state, double value, int min_h); /** Get the maximum width value of a part state. * @@ -1650,7 +1650,7 @@ EAPI int edje_edit_state_max_w_get(Evas_Object *obj, const char *part, const cha * @param value The state value. * @param max_w Maximum width value. */ -EAPI void edje_edit_state_max_w_set(Evas_Object *obj, const char *part, const char *state, double value, int max_w); +EAPI Eina_Bool edje_edit_state_max_w_set(Evas_Object *obj, const char *part, const char *state, double value, int max_w); /** Get the maximum height value of a part state. * @@ -1671,7 +1671,7 @@ EAPI int edje_edit_state_max_h_get(Evas_Object *obj, const char *part, const cha * @param value The state value. * @param max_h Maximum height value. */ -EAPI void edje_edit_state_max_h_set(Evas_Object *obj, const char *part, const char *state, double value, int max_h); +EAPI Eina_Bool edje_edit_state_max_h_set(Evas_Object *obj, const char *part, const char *state, double value, int max_h); /** Get the minimum aspect value of a part state. * diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 90cb4cf..e72cf8e 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -3346,27 +3346,31 @@ edje_edit_state_color3_set(Evas_Object *obj, const char *part, const char *state edje_object_calc_force(obj); \ } -#define FUNC_STATE_INT(Class, Value) \ +#define FUNC_STATE_INT(Class, Value, Min) \ EAPI int \ edje_edit_state_##Class##_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \ { \ GET_PD_OR_RETURN(0); \ return pd->Class.Value; \ } \ - EAPI void \ + EAPI Eina_Bool \ edje_edit_state_##Class##_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, int v) \ { \ - GET_PD_OR_RETURN(); \ - pd->Class.Value = v; \ + if ((!obj) || (!part) || (!state)) \ + return EINA_FALSE; \ + if (v < Min) return EINA_FALSE; \ + GET_PD_OR_RETURN(EINA_FALSE); \ + pd->Class.Value = v; \ edje_object_calc_force(obj); \ + return EINA_TRUE; \ } FUNC_STATE_DOUBLE(align, x); FUNC_STATE_DOUBLE(align, y); -FUNC_STATE_INT(min, w); -FUNC_STATE_INT(min, h); -FUNC_STATE_INT(max, w); -FUNC_STATE_INT(max, h); +FUNC_STATE_INT(min, w, 0); +FUNC_STATE_INT(min, h, 0); +FUNC_STATE_INT(max, w, -1); +FUNC_STATE_INT(max, h, -1); FUNC_STATE_DOUBLE(aspect, min); FUNC_STATE_DOUBLE(aspect, max); -- 2.7.4