edje: make functions in edje_edit API return Eina_Bool.

Make the following functions return Eina_Bool so the caller can detect errors:
edje_edit_state_visible_set
edje_edit_state_color_class_set

Removed unnecessary check in edje_edit_state_image_border_fill_set.

Reviewers: cedric, seoz

Reviewed By: cedric

CC: reutskiy.v.v

Differential Revision: https://phab.enlightenment.org/D305

Signed-off-by: Cedric Bail <cedric.bail@samsung.com>
This commit is contained in:
Vorobiov Vitalii 2013-11-01 11:01:37 +09:00 committed by Cedric Bail
parent cf452cc419
commit 848cc1d1ea
2 changed files with 22 additions and 10 deletions

View File

@ -1987,8 +1987,10 @@ EAPI Eina_Bool edje_edit_state_visible_get(Evas_Object *obj, const char *part, c
* @param state The name of the state to set visibility (not including the state value).
* @param value The state value.
* @param visible To set state visible (EINA_TRUE if the state is visible, EINA_FALSE otherwise)
*
* @return EINA_TRUE if successful, EINA_FALSE otherwise.
*/
EAPI void edje_edit_state_visible_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool visible);
EAPI Eina_Bool edje_edit_state_visible_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool visible);
/** Get the color class of the given part state.
*
@ -2010,8 +2012,10 @@ EAPI const char *edje_edit_state_color_class_get(Evas_Object *obj, const char *p
* @param state The name of the state to set color class (not including the state value).
* @param value The state value.
* @param color_class The color class to assign.
*
* @return EINA_TRUE if successful, EINA_FALSE otherwise.
*/
EAPI void edje_edit_state_color_class_set(Evas_Object *obj, const char *part, const char *state, double value, const char *color_class);
EAPI Eina_Bool edje_edit_state_color_class_set(Evas_Object *obj, const char *part, const char *state, double value, const char *color_class);
/** Get the list of parameters for an external part.
*

View File

@ -3533,14 +3533,18 @@ edje_edit_state_visible_get(Evas_Object *obj, const char *part, const char *stat
return pd->visible;
}
EAPI void
EAPI Eina_Bool
edje_edit_state_visible_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool visible)
{
GET_PD_OR_RETURN();
//printf("Set state visible flag of part: %s state: %s to: %d\n", part, state, visible);
if ((!obj) || (!part) || (!state))
return EINA_FALSE;
GET_PD_OR_RETURN(EINA_FALSE);
if (visible) pd->visible = 1;
else pd->visible = 0;
edje_object_calc_force(obj);
return EINA_TRUE;
}
EAPI unsigned char
@ -3569,13 +3573,17 @@ edje_edit_state_color_class_get(Evas_Object *obj, const char *part, const char *
return eina_stringshare_add(pd->color_class);
}
EAPI void
EAPI Eina_Bool
edje_edit_state_color_class_set(Evas_Object *obj, const char *part, const char *state, double value, const char *color_class)
{
GET_PD_OR_RETURN();
//printf("Set ColorClass of part: %s state: %s [to: %s]\n", part, state, color_class);
if ((!obj) || (!part) || (!state))
return EINA_FALSE;
GET_PD_OR_RETURN(EINA_FALSE);
_edje_if_string_free(ed, pd->color_class);
pd->color_class = (char*)eina_stringshare_add(color_class);
pd->color_class = (char *)eina_stringshare_add(color_class);
return EINA_TRUE;
}
EAPI const Eina_List *
@ -4798,7 +4806,7 @@ edje_edit_state_image_border_fill_set(Evas_Object *obj, const char *part, const
if ((!obj) || (!part) || (!state))
return EINA_FALSE;
if ((fill < 0) || (fill > 2))
if (fill > 2)
return EINA_FALSE;
eina_error_set(0);