summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorMinkyu Kang <mk7.kang@samsung.com>2015-09-06 18:48:52 -0700
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2015-09-06 18:48:52 -0700
commit27043b4645801eb912071bc829f999eb8b91e071 (patch)
tree21718bc59cb7c7dce34afb50f884b9af15155eab /src/util
parent2c0af96fc715b34de9d4ffe834d0b578840f828a (diff)
parent869d6f0d7760530485d1a6a9eb0707328d5aad4d (diff)
downloadair_mediahub-27043b4645801eb912071bc829f999eb8b91e071.tar.gz
air_mediahub-27043b4645801eb912071bc829f999eb8b91e071.tar.bz2
air_mediahub-27043b4645801eb912071bc829f999eb8b91e071.zip
Merge "remove grid related code from layout" into tizen
Diffstat (limited to 'src/util')
-rw-r--r--src/util/listmgr.c76
1 files changed, 40 insertions, 36 deletions
diff --git a/src/util/listmgr.c b/src/util/listmgr.c
index cb76302..876f137 100644
--- a/src/util/listmgr.c
+++ b/src/util/listmgr.c
@@ -23,6 +23,7 @@
#include "define.h"
#include "data/mediadata.h"
+#include "grid/grid.h"
#include "util/listmgr.h"
#include "util/util.h"
@@ -111,7 +112,7 @@ static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
Evas_Event_Key_Down *ev)
{
struct listmgr *lmgr;
- struct grid_ops *gops;
+ struct grid_data *gdata;
if (!data || !obj || !ev)
return;
@@ -125,9 +126,9 @@ static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
!strcmp(ev->keyname, KEY_BACK_REMOTE))
elm_object_focus_next(obj, ELM_FOCUS_UP);
else {
- gops = lmgr->data->gops;
- if (gops->key_down_cb)
- gops->key_down_cb(gops->ops_data,
+ gdata = lmgr->data->gdata;
+ if (gdata->key_down_cb)
+ gdata->key_down_cb(lmgr->data->grid_cb_data,
lmgr->focused_it, ev);
}
@@ -235,7 +236,7 @@ static void _focused_cb(int id, void *data, Evas_Object *obj,
static void _grid_selected(void *data)
{
struct listmgr *lmgr;
- struct grid_ops *gops;
+ struct grid_data *gdata;
if (!data) {
_ERR("invalid argument");
@@ -243,11 +244,10 @@ static void _grid_selected(void *data)
}
lmgr = data;
+ gdata = lmgr->data->gdata;
- gops = lmgr->data->gops;
-
- if (gops->selected_cb)
- gops->selected_cb(gops->ops_data, lmgr->selected_it);
+ if (gdata->selected_cb)
+ gdata->selected_cb(lmgr->data->grid_cb_data, lmgr->selected_it);
}
static void _grid_selected_cb(int id, void *data, Evas_Object *obj,
@@ -269,16 +269,16 @@ static void _play_info_selected_cb(void *data, Evas_Object *obj,
const char *emission, const char *source)
{
struct listmgr *lmgr;
- struct play_info_ops *pops;
+ struct play_info_data *pdata;
if (!data || !obj)
return;
lmgr = data;
- pops = lmgr->data->pops;
+ pdata = lmgr->data->pdata;
- if (pops->selected_cb)
- pops->selected_cb(pops->ops_data, obj);
+ if (pdata->selected_cb)
+ pdata->selected_cb(pdata->cb_data, obj);
}
static input_handler _grid_handler = {
@@ -330,7 +330,7 @@ static int _get_grid_width(int count, int num_item, int item_x)
static bool _draw_play_info(struct listmgr *lmgr)
{
Evas_Object *ly, *index, *content;
- struct play_info_ops *pops;
+ struct play_info_data *pdata;
ly = elm_layout_add(lmgr->box);
if (!ly) {
@@ -340,9 +340,9 @@ static bool _draw_play_info(struct listmgr *lmgr)
elm_layout_file_set(ly, EDJEFILE, GRP_LIST_ITEM);
- pops = lmgr->data->pops;
+ pdata = lmgr->data->pdata;
- if (!pops->draw(pops->ops_data, ly)) {
+ if (!pdata->draw(pdata->cb_data, ly)) {
_ERR("failed to draw play info item");
evas_object_del(ly);
return false;
@@ -397,31 +397,32 @@ static Evas_Object *_add_list_item_grid(struct listmgr *lmgr,
Evas_Object *base, struct group_info *gi)
{
Evas_Object *grid;
- struct listmgr_data *data;
+ struct grid_data *gdata;
int width;
- data = lmgr->data;
+ gdata = lmgr->data->gdata;
- grid = util_add_gengrid(base, data->grid_item_x,
- data->grid_item_y, EINA_TRUE);
+ grid = util_add_gengrid(base, gdata->item_x,
+ gdata->item_y, EINA_TRUE);
if (!grid) {
_ERR("failed to add gengrid object");
return NULL;
}
- if (!gridmgr_add_grid(lmgr->gmgr, gi->name, grid, data->gops->gclass)) {
+ if (!gridmgr_add_grid(lmgr->gmgr, gi->name, grid, gdata->gclass)) {
_ERR("failed to add grid");
evas_object_del(grid);
return NULL;
}
- width = _get_grid_width(eina_list_count(gi->list), data->grid_num_item,
- data->grid_item_x);
+ width = _get_grid_width(eina_list_count(gi->list), gdata->item_num,
+ gdata->item_x);
evas_object_size_hint_min_set(grid, width,
- data->grid_num_item * data->grid_item_y);
+ gdata->item_num * gdata->item_y);
- elm_object_focus_next_object_set(grid, data->view_btn, ELM_FOCUS_DOWN);
+ elm_object_focus_next_object_set(grid, lmgr->data->view_btn,
+ ELM_FOCUS_DOWN);
inputmgr_add_callback(grid, LISTMGR_GRID, &_grid_handler, lmgr);
@@ -629,17 +630,25 @@ bool listmgr_update_content_item(struct listmgr *lmgr)
return true;
}
-bool listmgr_update_content_list(struct listmgr *lmgr, Eina_List *list)
+bool listmgr_update_content_list(struct listmgr *lmgr, Eina_List *list,
+ struct grid_data *gdata)
{
Evas_Object *ly, *btn, *grid;
Eina_List *l;
struct group_info *gi;
- if (!lmgr) {
+ if (!lmgr || !gdata) {
_ERR("invalid argument");
return false;
}
+ lmgr->data->gdata = gdata;
+
+ elm_scroller_step_size_set(lmgr->scr, SCROLLER_STEP_SIZE(
+ gdata->grid_padding + gdata->item_x), 0);
+
+ elm_box_padding_set(lmgr->box, gdata->grid_padding, 0);
+
ly = NULL;
EINA_LIST_FOREACH(list, l, gi) {
ly = _draw_list_item(lmgr, gi);
@@ -674,7 +683,7 @@ bool listmgr_update_content_list(struct listmgr *lmgr, Eina_List *list)
bool listmgr_update_play_info(struct listmgr *lmgr, app_media_info *info)
{
- struct play_info_ops *pops;
+ struct play_info_data *pdata;
if (!lmgr) {
_ERR("invalid argument");
@@ -693,9 +702,9 @@ bool listmgr_update_play_info(struct listmgr *lmgr, app_media_info *info)
return true;
}
- pops = lmgr->data->pops;
+ pdata = lmgr->data->pdata;
- if (!pops->update(pops->ops_data, lmgr->play_info)) {
+ if (!pdata->update(pdata->cb_data, lmgr->play_info)) {
_ERR("failed to update play info");
return false;
}
@@ -730,9 +739,6 @@ bool listmgr_draw_list_area(struct listmgr *lmgr)
return false;
}
- elm_scroller_step_size_set(scr, SCROLLER_STEP_SIZE(
- data->box_padding + data->grid_item_x), 0);
-
inputmgr_add_callback(scr, LISTMGR_SCROLLER, &_handler, lmgr);
box = util_add_box(scr, EINA_TRUE);
@@ -742,8 +748,6 @@ bool listmgr_draw_list_area(struct listmgr *lmgr)
return false;
}
- elm_box_padding_set(box, data->box_padding, 0);
-
evas_object_show(box);
elm_object_content_set(scr, box);
@@ -752,7 +756,7 @@ bool listmgr_draw_list_area(struct listmgr *lmgr)
lmgr->scr = scr;
lmgr->box = box;
- if (data->pops) {
+ if (data->pdata) {
if (!_draw_play_info(lmgr)) {
_ERR("failed to draw play info");
evas_object_del(scr);