diff options
author | Jehun Lim <jehun.lim@samsung.com> | 2015-09-10 14:30:02 +0900 |
---|---|---|
committer | Jehun Lim <jehun.lim@samsung.com> | 2015-09-10 18:03:24 +0900 |
commit | af92654816569528bae0233a0b1ee4c6744e6b53 (patch) | |
tree | d5cbd47a38734ea2645f90000909f1b274bc0dc3 | |
parent | 3905646642911a77906c7b5aef18a098bee99d96 (diff) | |
download | air_mediahub-af92654816569528bae0233a0b1ee4c6744e6b53.tar.gz air_mediahub-af92654816569528bae0233a0b1ee4c6744e6b53.tar.bz2 air_mediahub-af92654816569528bae0233a0b1ee4c6744e6b53.zip |
grid: add function to free item list
Change-Id: I29c662d61646db6c98c2e93ca5aab758ca330a55
Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
-rw-r--r-- | include/grid/grid.h | 1 | ||||
-rw-r--r-- | src/grid/grid_gallery.c | 6 | ||||
-rw-r--r-- | src/grid/grid_movie.c | 6 | ||||
-rw-r--r-- | src/grid/grid_music.c | 6 | ||||
-rw-r--r-- | src/layout/gallery.c | 16 | ||||
-rw-r--r-- | src/layout/movie.c | 16 | ||||
-rw-r--r-- | src/layout/music.c | 16 |
7 files changed, 43 insertions, 24 deletions
diff --git a/include/grid/grid.h b/include/grid/grid.h index da89cf9..d7dbf18 100644 --- a/include/grid/grid.h +++ b/include/grid/grid.h @@ -49,6 +49,7 @@ struct grid_data { int grid_padding; struct grid_class *gclass; Eina_List *(*get_item_list)(struct mediadata *md); + void (*free_item_list)(Eina_List *list); void (*key_down_cb)(void *data, Elm_Object_Item *it, Evas_Event_Key_Down *ev); void (*selected_cb)(void *data, Elm_Object_Item *it); diff --git a/src/grid/grid_gallery.c b/src/grid/grid_gallery.c index 2697d1c..e33555e 100644 --- a/src/grid/grid_gallery.c +++ b/src/grid/grid_gallery.c @@ -120,6 +120,11 @@ static Eina_List *_get_item_list(struct mediadata *md) return mediadata_get_list(md, E_LIST_DATE); } +static void _free_item_list(Eina_List *list) +{ + mediadata_free_list(list); +} + static void _key_down_cb(void *data, Elm_Object_Item *it, Evas_Event_Key_Down *ev) { @@ -193,6 +198,7 @@ static struct grid_data _gdata[] = { .grid_padding = GALLERY_EVENT_GRID_PADDING, .gclass = &_gclass[E_GALLERY_EVENT], .get_item_list = _get_item_list, + .free_item_list = _free_item_list, .key_down_cb = _key_down_cb, .selected_cb = _selected_cb }, diff --git a/src/grid/grid_movie.c b/src/grid/grid_movie.c index f661518..0ec306d 100644 --- a/src/grid/grid_movie.c +++ b/src/grid/grid_movie.c @@ -110,6 +110,11 @@ static Eina_List *_get_item_list(struct mediadata *md) return mediadata_get_list(md, E_LIST_NAME); } +static void _free_item_list(Eina_List *list) +{ + mediadata_free_list(list); +} + static void _key_down_cb(void *data, Elm_Object_Item *it, Evas_Event_Key_Down *ev) { @@ -183,6 +188,7 @@ static struct grid_data _gdata[] = { .grid_padding = MOVIE_NAME_GRID_PADDING, .gclass = &_gclass[E_MOVIE_NAME], .get_item_list = _get_item_list, + .free_item_list = _free_item_list, .key_down_cb = _key_down_cb, .selected_cb = _selected_cb }, diff --git a/src/grid/grid_music.c b/src/grid/grid_music.c index c786969..12526a9 100644 --- a/src/grid/grid_music.c +++ b/src/grid/grid_music.c @@ -107,6 +107,11 @@ static Eina_List *_get_item_list(struct mediadata *md) return mediadata_get_list(md, E_LIST_NAME); } +static void _free_item_list(Eina_List *list) +{ + mediadata_free_list(list); +} + static void _key_down_cb(void *data, Elm_Object_Item *it, Evas_Event_Key_Down *ev) { @@ -180,6 +185,7 @@ static struct grid_data _gdata[] = { .grid_padding = MUSIC_SONG_GRID_PADDING, .gclass = &_gclass[E_MUSIC_SONG], .get_item_list = _get_item_list, + .free_item_list = _free_item_list, .key_down_cb = _key_down_cb, .selected_cb = _selected_cb }, diff --git a/src/layout/gallery.c b/src/layout/gallery.c index 829b8de..c279df5 100644 --- a/src/layout/gallery.c +++ b/src/layout/gallery.c @@ -58,6 +58,7 @@ struct _priv { Eina_List *media_list; int view_mode; + struct grid_data *gdata; }; static void _recent_item_selected(struct _priv *priv, app_media *am) @@ -117,7 +118,7 @@ static void _update_content_info(struct _priv *priv) static void _clear_content_list(struct _priv *priv) { if (priv->media_list) { - mediadata_free_list(priv->media_list); + priv->gdata->free_item_list(priv->media_list); priv->media_list = NULL; } @@ -127,23 +128,22 @@ static void _clear_content_list(struct _priv *priv) static void _update_content_list(struct _priv *priv) { Eina_List *list; - struct grid_data *gdata; if (priv->media_list) { _update_content_info(priv); return; } - gdata = get_gallery_grid_data(priv->view_mode); + priv->gdata = get_gallery_grid_data(priv->view_mode); - list = gdata->get_item_list(priv->md); + list = priv->gdata->get_item_list(priv->md); if (!list) { elm_object_part_text_set(priv->layout, PART_NOCONTENT, TEXT_NOCONTENT); return; } - if (!listmgr_update_content_list(priv->listmgr, list, gdata)) + if (!listmgr_update_content_list(priv->listmgr, list, priv->gdata)) _ERR("failed to update list area"); priv->media_list = list; @@ -255,7 +255,7 @@ static void _destroy(void *layout_data) priv = layout_data; - mediadata_free_list(priv->media_list); + priv->gdata->free_item_list(priv->media_list); mediadata_destroy(priv->md); listmgr_destroy(priv->listmgr); @@ -351,9 +351,9 @@ static void _update(void *layout_data, int update_type, void *data) if (mode == priv->view_mode) return; - priv->view_mode = mode; - _clear_content_list(priv); + + priv->view_mode = mode; _update_content_list(priv); break; default: diff --git a/src/layout/movie.c b/src/layout/movie.c index 2252f1d..e81fc7b 100644 --- a/src/layout/movie.c +++ b/src/layout/movie.c @@ -66,6 +66,7 @@ struct _priv { app_media *recent_info; int view_mode; + struct grid_data *gdata; }; static bool _update_recent_info(Evas_Object *base, app_media_info *info) @@ -323,7 +324,7 @@ static void _update_content_info(struct _priv *priv) static void _clear_content_list(struct _priv *priv) { if (priv->media_list) { - mediadata_free_list(priv->media_list); + priv->gdata->free_item_list(priv->media_list); priv->media_list = NULL; } @@ -333,23 +334,22 @@ static void _clear_content_list(struct _priv *priv) static void _update_content_list(struct _priv *priv) { Eina_List *list; - struct grid_data *gdata; if (priv->media_list) { _update_content_info(priv); return; } - gdata = get_movie_grid_data(priv->view_mode); + priv->gdata = get_movie_grid_data(priv->view_mode); - list = gdata->get_item_list(priv->md); + list = priv->gdata->get_item_list(priv->md); if (!list) { elm_object_part_text_set(priv->layout, PART_NOCONTENT, TEXT_NOCONTENT); return; } - if (!listmgr_update_content_list(priv->listmgr, list, gdata)) { + if (!listmgr_update_content_list(priv->listmgr, list, priv->gdata)) { _ERR("failed to update list area"); return; } @@ -520,7 +520,7 @@ static void _destroy(void *layout_data) progressbar_destroy(priv->prog); - mediadata_free_list(priv->media_list); + priv->gdata->free_item_list(priv->media_list); mediadata_destroy(priv->md); listmgr_destroy(priv->listmgr); @@ -620,9 +620,9 @@ static void _update(void *layout_data, int update_type, void *data) if (mode == priv->view_mode) return; - priv->view_mode = mode; - _clear_content_list(priv); + + priv->view_mode = mode; _update_content_list(priv); break; default: diff --git a/src/layout/music.c b/src/layout/music.c index 66a922e..0ee6d95 100644 --- a/src/layout/music.c +++ b/src/layout/music.c @@ -62,6 +62,7 @@ struct _priv { app_media *playing_info; int view_mode; + struct grid_data *gdata; }; static bool _update_playing_info(void *data, Evas_Object *base) @@ -267,7 +268,7 @@ static void _update_content_info(struct _priv *priv) static void _clear_content_list(struct _priv *priv) { if (priv->media_list) { - mediadata_free_list(priv->media_list); + priv->gdata->free_item_list(priv->media_list); priv->media_list = NULL; } @@ -277,23 +278,22 @@ static void _clear_content_list(struct _priv *priv) static void _update_content_list(struct _priv *priv) { Eina_List *list; - struct grid_data *gdata; if (priv->media_list) { _update_content_info(priv); return; } - gdata = get_music_grid_data(priv->view_mode); + priv->gdata = get_music_grid_data(priv->view_mode); - list = gdata->get_item_list(priv->md); + list = priv->gdata->get_item_list(priv->md); if (!list) { elm_object_part_text_set(priv->layout, PART_NOCONTENT, TEXT_NOCONTENT); return; } - if (!listmgr_update_content_list(priv->listmgr, list, gdata)) + if (!listmgr_update_content_list(priv->listmgr, list, priv->gdata)) _ERR("failed to update list area"); priv->media_list = list; @@ -458,7 +458,7 @@ static void _destroy(void *layout_data) priv = layout_data; - mediadata_free_list(priv->media_list); + priv->gdata->free_item_list(priv->media_list); mediadata_destroy(priv->md); listmgr_destroy(priv->listmgr); @@ -559,9 +559,9 @@ static void _update(void *layout_data, int update_type, void *data) if (mode == priv->view_mode) return; - priv->view_mode = mode; - _clear_content_list(priv); + + priv->view_mode = mode; _update_content_list(priv); break; default: |