diff --git a/src/daemon/entrance_image.c b/src/daemon/entrance_image.c index 8700622..816f0a9 100644 --- a/src/daemon/entrance_image.c +++ b/src/daemon/entrance_image.c @@ -108,3 +108,46 @@ entrance_image_user_backgrounds(const char *username) snprintf(path, sizeof(path),"%s/.config/entrance/images/backgrounds/", homedir); return _entrance_image_get(_entrance_image_readdir(path), NULL, NULL); } + +Eina_List* +entrance_image_user_pool_get(Eina_List *users) +{ + Eina_List *node, *result = NULL; + Entrance_Login *eu; + Entrance_User_Pool *pool; + + EINA_LIST_FOREACH(users, node, eu) + { + pool = calloc(1, sizeof(Entrance_User_Pool)); + pool->name = eina_stringshare_add(eu->login); + pool->icon_pool = entrance_image_user_icons(pool->name); + pool->background_pool = entrance_image_user_backgrounds(pool->name); + result = eina_list_append(result, pool); + } + return result; +} + +void +entrance_image_user_pool_free(Eina_List *user_pool) +{ + Entrance_User_Pool *pool; + Entrance_Image *img; + + EINA_LIST_FREE(user_pool, pool) + { + eina_stringshare_del(pool->name); + EINA_LIST_FREE(pool->icon_pool, img) + { + eina_stringshare_del(img->path); + eina_stringshare_del(img->group); + free(img); + } + EINA_LIST_FREE(pool->background_pool, img) + { + eina_stringshare_del(img->path); + eina_stringshare_del(img->group); + free(img); + } + free(pool); + } +} diff --git a/src/daemon/entrance_image.h b/src/daemon/entrance_image.h index 425efd3..0445bbb 100644 --- a/src/daemon/entrance_image.h +++ b/src/daemon/entrance_image.h @@ -5,6 +5,7 @@ Eina_List* entrance_image_system_icons(); Eina_List* entrance_image_system_backgrounds(); Eina_List* entrance_image_user_icons(const char *username); Eina_List* entrance_image_user_backgrounds(const char *username); - +Eina_List* entrance_image_user_pool_get(Eina_List *users); +void entrance_image_user_pool_free(Eina_List *user_pool); #endif /* ENTRANCE_H_ */