From: Jehun Lim Date: Thu, 23 Jul 2015 13:03:12 +0000 (+0900) Subject: music: update now playing item X-Git-Tag: accepted/tizen/tv/20150728.070555~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=baa5c776e27b319c506124e609a5cfd4e4669cfa;p=profile%2Ftv%2Fapps%2Fnative%2Fair_mediahub.git music: update now playing item Change-Id: I1af01a4b4558f974636750aa99b4e369d6b61bc8 Signed-off-by: Jehun Lim --- diff --git a/src/layout/music.c b/src/layout/music.c index 76313b5..746e4f7 100644 --- a/src/layout/music.c +++ b/src/layout/music.c @@ -14,11 +14,9 @@ * limitations under the License. */ -#include #include #include #include -#include #include #include #include @@ -358,49 +356,29 @@ static void _update_content_list(struct _priv *priv) _update_content_info(priv); } -static void _update_playing_item(struct _priv *priv) +static void _update_playing_item(struct _priv *priv, int index) { - GList *list; + Eina_List *list; app_media *am; app_media_info *info; - struct recent_data *recent; - int r; - - list = NULL; - info = NULL; - r = app_contents_get_recent_list(CONTENTS_MUSIC, 1, &list); - if (r != APP_CONTENTS_ERROR_NONE) { - _ERR("failed to get movie recent list"); + list = mediadata_get_medialist(priv->md); + am = eina_list_nth(list, index); + if (!am) { + _ERR("failed to get app media"); return; } - recent = (struct recent_data *)g_list_nth_data(list, 0); - - if (recent) { - am = util_find_media_info(mediadata_get_medialist(priv->md), - recent->id); - if (!am) { - _ERR("failed to get app media"); - g_list_free(list); - return; - } - - info = app_media_get_info(am); - if (!info) { - _ERR("failed to get app media info"); - g_list_free(list); - return; - } - - priv->playing_info = am; + info = app_media_get_info(am); + if (!info) { + _ERR("failed to get app media info"); + return; } + priv->playing_info = am; + if (!listmgr_update_play_info(priv->listmgr, info)) _ERR("failed to update now playing item"); - - - g_list_free(list); } static bool _create(layoutmgr *lmgr, void *data) @@ -563,7 +541,14 @@ static void _update(void *layout_data, int update_type, void *data) switch (update_type) { case UPDATE_CONTENT: _update_content_list(priv); - _update_playing_item(priv); + break; + case UPDATE_PLAY_INFO: + if (!vdata) { + _ERR("invalid argument"); + return; + } + + _update_playing_item(priv, vdata->index); break; case UPDATE_FOCUS: if (!vdata) { @@ -577,7 +562,6 @@ static void _update(void *layout_data, int update_type, void *data) update = false; listmgr_update_focus_item(priv->listmgr, vdata->index, update); - _update_playing_item(priv); break; default: break;