terminology: wallpaper - simplify logic matching extention by using Eina infrastructure.

This commit is contained in:
Cedric BAIL 2013-12-30 15:50:54 +09:00
parent 7f92258ee4
commit a4d890119a
1 changed files with 6 additions and 11 deletions

View File

@ -57,14 +57,12 @@ _grid_content_get(void *data, Evas_Object *obj, const char *part)
{
if (item->path)
{
int len0, len = strlen(item->path);
int len0;
int i, ret = 0;
for (i = 0; extn_edj[i]; i++)
{
len0 = strlen(extn_edj[i]);
if ((len > len0) &&
(!strcasecmp(&(item->path[len - len0]), extn_edj[i])))
if (eina_str_has_extension(item->path, extn_edj[i]))
return media_add(obj, item->path, config,
MEDIA_BG, &ret);
}
@ -284,7 +282,7 @@ _rec_read_directorys(Eina_List *list, char *root_path, Evas_Object *term)
{
Eina_List *childs = ecore_file_ls(root_path);
char *file_name;
int i, j, len, len0;
int i, j, len0;
char path[PATH_MAX];
Background_Item *item;
@ -292,7 +290,6 @@ _rec_read_directorys(Eina_List *list, char *root_path, Evas_Object *term)
EINA_LIST_FREE(childs, file_name)
{
snprintf(path, PATH_MAX, "%s/%s", root_path, file_name);
len = strlen(file_name);
if ((!ecore_file_is_dir(path)) && (file_name[0] != '.'))
{
const char **extns[5] =
@ -304,9 +301,7 @@ _rec_read_directorys(Eina_List *list, char *root_path, Evas_Object *term)
for (i = 0; ex[i]; i++)
{
len0 = strlen(ex[i]);
if ((len > len0) &&
(!strcasecmp(&(file_name[len - len0]), ex[i])))
if (eina_str_has_extension(file_name, ex[i]))
{
item = calloc(1, sizeof(Background_Item));
if (item)