Fix elm_bg_file_set/get

If the file is a NULL pointer, it will delete the old imagem and set its
internal strings about file and group to NULL.
In the get function if the file argument is null does not mean that
it will not retrieve the group too.

SVN revision: 54986
This commit is contained in:
helen 2010-11-25 15:16:48 +00:00 committed by helen
parent 7e70efd730
commit 59351f8aac
1 changed files with 11 additions and 2 deletions

View File

@ -165,6 +165,9 @@ elm_bg_add(Evas_Object *parent)
* will be stretched (retaining aspect if its an image file) to completely fill
* the bg object. This may mean some parts are not visible.
*
* @note Once the image of @p obj is set, a previously set one will be deleted,
* even if @p file is NULL.
*
* @ingroup Bg
*/
EAPI void
@ -179,7 +182,14 @@ elm_bg_file_set(Evas_Object *obj, const char *file, const char *group)
evas_object_del(wd->img);
wd->img = NULL;
}
if (!file) return;
if (!file)
{
eina_stringshare_del(wd->file);
wd->file = NULL;
eina_stringshare_del(wd->group);
wd->group = NULL;
return;
}
eina_stringshare_replace(&wd->file, file);
eina_stringshare_replace(&wd->group, group);
if (((p = strrchr(file, '.'))) && (!strcasecmp(p, ".edj")))
@ -212,7 +222,6 @@ elm_bg_file_get(const Evas_Object *obj, const char **file, const char **group)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!file) return;
if (file) *file = wd->file;
if (group) *group = wd->group;
}