forked from enlightenment/efl
Changing return type of state_{add,del}. By Fidencio
Now, returning Eina_Bool instead of void, makes more sense. Author: Fabiano Fidencio <fidencio at profusion.mobi> SVN revision: 51005
This commit is contained in:
parent
128482520c
commit
186b6905ce
|
@ -1114,8 +1114,10 @@ EAPI Eina_Bool edje_edit_state_name_set(Evas_Object *obj, const char *part, cons
|
||||||
* @param part Part to set the name of the new state.
|
* @param part Part to set the name of the new state.
|
||||||
* @param name Name for the new state (not including the state value).
|
* @param name Name for the new state (not including the state value).
|
||||||
* @param value The state value.
|
* @param value The state value.
|
||||||
|
*
|
||||||
|
* @return EINA_TRUE if succesfully, EINA_FALSE otherwise.
|
||||||
*/
|
*/
|
||||||
EAPI void edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double value);
|
EAPI Eina_Bool edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double value);
|
||||||
|
|
||||||
/** Delete the given part state from the edje.
|
/** Delete the given part state from the edje.
|
||||||
*
|
*
|
||||||
|
@ -1123,8 +1125,10 @@ EAPI void edje_edit_state_add(Evas_Object *obj, const char *part, const char *na
|
||||||
* @param part Part that contain state.
|
* @param part Part that contain state.
|
||||||
* @param state The current name of the state (not including the state value).
|
* @param state The current name of the state (not including the state value).
|
||||||
* @param value The state value.
|
* @param value The state value.
|
||||||
|
*
|
||||||
|
* @return EINA_TRUE if succesfully, EINA_FALSE otherwise.
|
||||||
*/
|
*/
|
||||||
EAPI void edje_edit_state_del(Evas_Object *obj, const char *part, const char *state, double value);
|
EAPI Eina_Bool edje_edit_state_del(Evas_Object *obj, const char *part, const char *state, double value);
|
||||||
|
|
||||||
/** Check if a part state with the given name exist.
|
/** Check if a part state with the given name exist.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1955,7 +1955,16 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type
|
||||||
ed->table_parts[ep->id % ed->table_parts_size] = rp;
|
ed->table_parts[ep->id % ed->table_parts_size] = rp;
|
||||||
|
|
||||||
/* Create default description */
|
/* Create default description */
|
||||||
edje_edit_state_add(obj, name, "default", 0.0);
|
if (!edje_edit_state_add(obj, name, "default", 0.0))
|
||||||
|
{
|
||||||
|
_edje_if_string_free(ed, ep->name);
|
||||||
|
if (source)
|
||||||
|
_edje_if_string_free(ed, ep->source);
|
||||||
|
free(ep);
|
||||||
|
free(rp);
|
||||||
|
free(ed);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
edje_edit_part_selected_state_set(obj, name, "default", 0.0);
|
edje_edit_part_selected_state_set(obj, name, "default", 0.0);
|
||||||
|
|
||||||
ce = eina_hash_find(ed->file->collection, ed->group);
|
ce = eina_hash_find(ed->file->collection, ed->group);
|
||||||
|
@ -2628,21 +2637,24 @@ edje_edit_state_name_set(Evas_Object *obj, const char *part, const char *state,
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI Eina_Bool
|
||||||
edje_edit_state_del(Evas_Object *obj, const char *part, const char *state, double value)
|
edje_edit_state_del(Evas_Object *obj, const char *part, const char *state, double value)
|
||||||
{
|
{
|
||||||
Edje_Part_Collection_Directory_Entry *ce;
|
Edje_Part_Collection_Directory_Entry *ce;
|
||||||
Edje_Part_Description_Common *pd;
|
Edje_Part_Description_Common *pd;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
GET_RP_OR_RETURN();
|
GET_RP_OR_RETURN(EINA_FALSE);
|
||||||
|
|
||||||
|
if (!edje_edit_state_exist(obj, part, state, value))
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
pd = _edje_part_description_find_byname(eed, part, state, value);
|
pd = _edje_part_description_find_byname(eed, part, state, value);
|
||||||
if (!pd) return;
|
if (!pd) return EINA_FALSE;
|
||||||
|
|
||||||
/* Don't allow to delete default state, for now at least; */
|
/* Don't allow to delete default state, for now at least; */
|
||||||
if (pd == rp->part->default_desc)
|
if (pd == rp->part->default_desc)
|
||||||
return;
|
return EINA_FALSE;
|
||||||
|
|
||||||
/* And if we are deleting the current state, go back to default first */
|
/* And if we are deleting the current state, go back to default first */
|
||||||
if (pd == rp->chosen_description)
|
if (pd == rp->chosen_description)
|
||||||
|
@ -2661,6 +2673,7 @@ edje_edit_state_del(Evas_Object *obj, const char *part, const char *state, doubl
|
||||||
}
|
}
|
||||||
|
|
||||||
_edje_collection_free_part_description_free(rp->part->type, pd, ce, 0);
|
_edje_collection_free_part_description_free(rp->part->type, pd, ce, 0);
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Edje_Part_Description_Common *
|
static Edje_Part_Description_Common *
|
||||||
|
@ -2710,16 +2723,19 @@ _edje_edit_state_alloc(int type, Edje *ed)
|
||||||
return pd;
|
return pd;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI Eina_Bool
|
||||||
edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double value)
|
edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double value)
|
||||||
{
|
{
|
||||||
Edje_Part_Description_Common *pd;
|
Edje_Part_Description_Common *pd;
|
||||||
|
|
||||||
GET_RP_OR_RETURN();
|
GET_RP_OR_RETURN(EINA_FALSE);
|
||||||
|
|
||||||
|
if (edje_edit_state_exist(obj, part, name, value))
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
//printf("ADD STATE: %s TO PART: %s\n", name , part);
|
//printf("ADD STATE: %s TO PART: %s\n", name , part);
|
||||||
pd = _edje_edit_state_alloc(rp->part->type, ed);
|
pd = _edje_edit_state_alloc(rp->part->type, ed);
|
||||||
if (!pd) return;
|
if (!pd) return EINA_FALSE;
|
||||||
|
|
||||||
if (!rp->part->default_desc)
|
if (!rp->part->default_desc)
|
||||||
{
|
{
|
||||||
|
@ -2734,7 +2750,7 @@ edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
{
|
{
|
||||||
free(pd);
|
free(pd);
|
||||||
return;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
rp->part->other.desc = tmp;
|
rp->part->other.desc = tmp;
|
||||||
rp->part->other.desc[rp->part->other.desc_count++] = pd;
|
rp->part->other.desc[rp->part->other.desc_count++] = pd;
|
||||||
|
@ -2890,6 +2906,8 @@ edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double
|
||||||
table = (Edje_Part_Description_Table*) pd;
|
table = (Edje_Part_Description_Table*) pd;
|
||||||
memset(&table->table, 0, sizeof (table->table));
|
memset(&table->table, 0, sizeof (table->table));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
|
|
Loading…
Reference in New Issue