edje: Edje_Edit - add API for renaming of image.

Reviewers: Hermet, raster, seoz, cedric

@feature

Subscribers: reutskiy.v.v

Projects: #efl

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
Cedric BAIL 2015-01-05 10:53:57 +01:00
parent 93da127573
commit a5183ee424
2 changed files with 37 additions and 0 deletions

View File

@ -4666,6 +4666,19 @@ EAPI Eina_Bool edje_edit_image_del(Evas_Object *obj, const char *name);
*/
EAPI Eina_Bool edje_edit_image_replace(Evas_Object *obj, const char *name, const char *new_name);
/** Rename image
*
* @param obj Object being edited.
* @param name The name of the image to be renamed.
* @param new_name The new_name of the image.
*
* @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.(including the
* case when one of the names is not valid)
*
* @since 1.12
*/
EAPI Eina_Bool edje_edit_image_rename(Evas_Object *obj, const char *name, const char *new_name);
/** Get list of (Edje_Part_Image_Use *) - group-part-state triplets where given
* image is used
*

View File

@ -7320,6 +7320,30 @@ edje_edit_image_replace(Evas_Object *obj, const char *name, const char *new_name
return EINA_TRUE;
}
EAPI Eina_Bool
edje_edit_image_rename(Evas_Object *obj, const char *name, const char *new_name)
{
Edje_Image_Directory_Entry *de = NULL;
unsigned int i;
GET_ED_OR_RETURN(EINA_FALSE);
// Check if image with 'new_name' already exists
if (edje_edit_image_id_get(obj, new_name) >= 0)
return EINA_FALSE;
for (i = 0; i < ed->file->image_dir->entries_count; ++i)
{
de = ed->file->image_dir->entries + i;
if ((de->entry) && (!strcmp(name, de->entry)))
break;
}
if (i == ed->file->image_dir->entries_count) return EINA_FALSE;
_edje_if_string_replace(ed, &de->entry, new_name);
return EINA_TRUE;
}
EAPI Eina_List*
edje_edit_image_usage_list_get(Evas_Object *obj, const char *name, Eina_Bool first_only)
{