diff options
author | Jehun Lim <jehun.lim@samsung.com> | 2015-12-21 15:28:29 +0900 |
---|---|---|
committer | Jehun Lim <jehun.lim@samsung.com> | 2015-12-21 15:28:29 +0900 |
commit | 62c9ac3ee050c932a02d76ac1158059040e8a37b (patch) | |
tree | 20583a8fbc56d983d0168f57f8a0777dd0533a36 | |
parent | c03963d9f13af87d16f29f33a8cfa7c0ca387e5a (diff) | |
download | air_mediahub-62c9ac3ee050c932a02d76ac1158059040e8a37b.tar.gz air_mediahub-62c9ac3ee050c932a02d76ac1158059040e8a37b.tar.bz2 air_mediahub-62c9ac3ee050c932a02d76ac1158059040e8a37b.zip |
grid: modify the method to get genre/place list
Change-Id: I6d84d4f8b274d472835e6f210591daf2433496b0
Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
-rw-r--r-- | src/grid/grid_gallery.c | 9 | ||||
-rw-r--r-- | src/grid/grid_movie.c | 15 | ||||
-rw-r--r-- | src/grid/grid_music.c | 15 |
3 files changed, 29 insertions, 10 deletions
diff --git a/src/grid/grid_gallery.c b/src/grid/grid_gallery.c index d579042..c523251 100644 --- a/src/grid/grid_gallery.c +++ b/src/grid/grid_gallery.c @@ -229,6 +229,7 @@ static Eina_List *_get_event_list(struct datamgr *dmgr) static Eina_List *_get_place_list(struct datamgr *dmgr) { + Eina_List *place_list; Eina_List *list; struct group_info *gi; @@ -237,6 +238,11 @@ static Eina_List *_get_place_list(struct datamgr *dmgr) return NULL; } + place_list = dmgr->ops->get_group(dmgr->handle, + E_GROUP_MEDIA_PLACE, NULL); + if (!place_list) + return NULL; + gi = calloc(1, sizeof(*gi)); if (!gi) { _ERR("failed to allocate memory"); @@ -244,8 +250,7 @@ static Eina_List *_get_place_list(struct datamgr *dmgr) } gi->name = STR_PLACE_NAME; - gi->list = dmgr->ops->get_group(dmgr->handle, - E_GROUP_MEDIA_PLACE, NULL); + gi->list = place_list; list = NULL; list = eina_list_append(list, gi); diff --git a/src/grid/grid_movie.c b/src/grid/grid_movie.c index 0341f57..520f228 100644 --- a/src/grid/grid_movie.c +++ b/src/grid/grid_movie.c @@ -194,6 +194,7 @@ static Eina_List *_get_name_list(struct datamgr *dmgr) static Eina_List *_get_genre_list(struct datamgr *dmgr) { + Eina_List *genre_list; Eina_List *list; struct group_info *gi; @@ -202,6 +203,11 @@ static Eina_List *_get_genre_list(struct datamgr *dmgr) return NULL; } + genre_list = dmgr->ops->get_group(dmgr->handle, + E_GROUP_MEDIA_GENRE, NULL); + if (!genre_list) + return NULL; + gi = calloc(1, sizeof(*gi)); if (!gi) { _ERR("failed to allocate memory"); @@ -209,8 +215,7 @@ static Eina_List *_get_genre_list(struct datamgr *dmgr) } gi->name = STR_GENRE_NAME; - gi->list = dmgr->ops->get_group(dmgr->handle, - E_GROUP_MEDIA_GENRE, NULL); + gi->list = genre_list; list = NULL; list = eina_list_append(list, gi); @@ -270,11 +275,13 @@ static void _get_media_info(struct datamgr *dmgr, Eina_List *list, static void _get_genre_info(struct datamgr *dmgr, Eina_List *list, char *str, int size) { + Eina_List *l; struct group_info *gi; int cnt; - gi = eina_list_nth(list, 0); - cnt = eina_list_count(gi->list); + cnt = 0; + EINA_LIST_FOREACH(list, l, gi) + cnt += eina_list_count(gi->list); snprintf(str, size, "%d Genre", cnt); } diff --git a/src/grid/grid_music.c b/src/grid/grid_music.c index d55e7c3..7718eaa 100644 --- a/src/grid/grid_music.c +++ b/src/grid/grid_music.c @@ -320,6 +320,7 @@ static Eina_List *_get_artist_list(struct datamgr *dmgr) static Eina_List *_get_genre_list(struct datamgr *dmgr) { + Eina_List *genre_list; Eina_List *list; struct group_info *gi; @@ -328,6 +329,11 @@ static Eina_List *_get_genre_list(struct datamgr *dmgr) return NULL; } + genre_list = dmgr->ops->get_group(dmgr->handle, + E_GROUP_MEDIA_GENRE, NULL); + if (!genre_list) + return NULL; + gi = calloc(1, sizeof(*gi)); if (!gi) { _ERR("failed to allocate memory"); @@ -335,8 +341,7 @@ static Eina_List *_get_genre_list(struct datamgr *dmgr) } gi->name = STR_GENRE_NAME; - gi->list = dmgr->ops->get_group(dmgr->handle, - E_GROUP_MEDIA_GENRE, NULL); + gi->list = genre_list; list = NULL; list = eina_list_append(list, gi); @@ -414,11 +419,13 @@ static void _get_artist_info(struct datamgr *dmgr, Eina_List *list, char *str, static void _get_genre_info(struct datamgr *dmgr, Eina_List *list, char *str, int size) { + Eina_List *l; struct group_info *gi; int cnt; - gi = eina_list_nth(list, 0); - cnt = eina_list_count(gi->list); + cnt = 0; + EINA_LIST_FOREACH(list, l, gi) + cnt += eina_list_count(gi->list); snprintf(str, size, "%d Genre", cnt); } |