movie: modify the method to get recently watched item 31/44631/2
authorJehun Lim <jehun.lim@samsung.com>
Fri, 24 Jul 2015 05:39:35 +0000 (14:39 +0900)
committerJehun Lim <jehun.lim@samsung.com>
Fri, 24 Jul 2015 05:42:27 +0000 (14:42 +0900)
Change-Id: I493d4314f25d3b86015254ca20202871569192ad
Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
CMakeLists.txt
packaging/org.tizen.mediahub.spec
src/layout/movie.c

index 1138f9e..9245e39 100644 (file)
@@ -18,7 +18,6 @@ PROJECT("mediahub" C)
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(PKGS REQUIRED
-               glib-2.0
                elementary
                capi-appfw-application
                capi-media-player
index 89f74f0..969283d 100644 (file)
@@ -8,7 +8,6 @@ Source0:   %{name}-%{version}.tar.gz
 Source1:   %{name}.manifest
 
 BuildRequires: cmake
-BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(elementary)
 BuildRequires: pkgconfig(capi-appfw-application)
 BuildRequires: pkgconfig(capi-media-player)
index ceb236f..9d8d39a 100644 (file)
  * limitations under the License.
  */
 
-#include <glib.h>
 #include <Elementary.h>
 #include <media_content.h>
 #include <app_debug.h>
-#include <app_contents.h>
 #include <app_media.h>
 #include <gridmgr.h>
 #include <layoutmgr.h>
@@ -386,49 +384,29 @@ static void _update_content_list(struct _priv *priv)
        _update_content_info(priv);
 }
 
-static void _update_recent_item(struct _priv *priv)
+static void _update_recent_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_MOVIE, 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->recent_info = am;
+       info = app_media_get_info(am);
+       if (!info) {
+               _ERR("failed to get app media info");
+               return;
        }
 
+       priv->recent_info = am;
+
        if (!listmgr_update_play_info(priv->listmgr, info))
                _ERR("failed to update recently watched item");
-
-
-       g_list_free(list);
 }
 
 static bool _create(layoutmgr *lmgr, void *data)
@@ -593,7 +571,6 @@ static void _update(void *layout_data, int update_type, void *data)
        switch (update_type) {
        case UPDATE_CONTENT:
                _update_content_list(priv);
-               _update_recent_item(priv);
                break;
        case UPDATE_FOCUS:
                if (!vdata) {
@@ -602,7 +579,7 @@ static void _update(void *layout_data, int update_type, void *data)
                }
 
                listmgr_focus_play_info(priv->listmgr);
-               _update_recent_item(priv);
+               _update_recent_item(priv, vdata->index);
                break;
        default:
                break;