From d73182b101f2e26f8f08ce0c920e43f69b41d7b8 Mon Sep 17 00:00:00 2001 From: Bartlomiej Uliasz Date: Thu, 10 Mar 2016 15:59:02 +0100 Subject: [PATCH] Fixed unnecessary ERR in grid update Fixed unnecessary ERR in grid update, when there are no yet any realized items (nothing to update) Change-Id: Ic4eec3c43e21bc8ccb4777e5b234e99911e952cb Signed-off-by: Bartlomiej Uliasz --- src/common/listmgr.c | 4 +-- src/view/system/view_location.c | 54 ++++++++++++++++++----------------------- 2 files changed, 25 insertions(+), 33 deletions(-) diff --git a/src/common/listmgr.c b/src/common/listmgr.c index 09b97af..e11ccff 100644 --- a/src/common/listmgr.c +++ b/src/common/listmgr.c @@ -373,8 +373,8 @@ bool listmgr_update_grid(struct listmgr *listmgr, const char *list_id) list = elm_gengrid_realized_items_get(linfo->grid); if (!list) { - _ERR("List is NULL."); - return false; + _DBG("No realized items yet. No need to update."); + return true; } EINA_LIST_FOREACH(list, l, it) { diff --git a/src/view/system/view_location.c b/src/view/system/view_location.c index 17a6553..8d54297 100644 --- a/src/view/system/view_location.c +++ b/src/view/system/view_location.c @@ -40,7 +40,7 @@ struct _priv { Evas_Object *_btn2; struct listmgr *list_mgr; - struct datamgr *country_data_mgr; + struct datamgr *data_mgr; Elm_Object_Item *selected_country_item; Elm_Object_Item *configured_country; char *language; @@ -116,7 +116,7 @@ static void _country_selected_cb(Elm_Object_Item *it, void *data) priv->selected_country_item = it; - if (!datamgr_select(priv->country_data_mgr, it, NULL)) { + if (!datamgr_select(priv->data_mgr, it, NULL)) { _ERR("Unavailable status for selecting country."); return; } @@ -241,9 +241,6 @@ static Evas_Object *_create(Evas_Object *win, void *data) { SETTING_TRACE_BEGIN; struct _priv *priv = NULL; - struct datamgr *data_mgr = NULL; - Evas_Object *base = NULL; - struct listmgr *list_mgr = NULL; if (!win) { _ERR("Get window object failed."); @@ -255,62 +252,57 @@ static Evas_Object *_create(Evas_Object *win, void *data) _ERR("Calloc failed."); return NULL; } + priv->win = win; - base = utils_add_layout(win, GRP_VIEW_LOCATION, EINA_TRUE); - if (!base) { + priv->base = utils_add_layout(win, GRP_VIEW_LOCATION, EINA_TRUE); + if (!priv->base) { _ERR("Add layout failed."); free(priv); return NULL; } - priv->base = base; - - data_mgr = datamgr_create(get_location_data_class(), _data_event_cb, priv); - if (!data_mgr) { + priv->data_mgr = datamgr_create(get_location_data_class(), _data_event_cb, priv); + if (!priv->data_mgr) { _ERR("Create datamgr failed."); + evas_object_del(priv->base); free(priv); - evas_object_del(base); return NULL; } - list_mgr = listmgr_create(base); - if (!list_mgr) { + priv->list_mgr = listmgr_create(priv->base); + if (!priv->list_mgr) { _ERR("Create listmgr failed."); - datamgr_destroy(data_mgr); + datamgr_destroy(priv->data_mgr); + evas_object_del(priv->base); free(priv); - evas_object_del(base); return NULL; } - if (!listmgr_add_list(list_mgr, LOCATION_LIST_ID, get_location_grid_class(), + if (!listmgr_add_list(priv->list_mgr, LOCATION_LIST_ID, get_location_grid_class(), _country_selected_cb, priv)) { _ERR("Add location list failed."); - listmgr_destroy(list_mgr); - datamgr_destroy(data_mgr); + listmgr_destroy(priv->list_mgr); + datamgr_destroy(priv->data_mgr); + evas_object_del(priv->base); free(priv); - evas_object_del(base); return NULL; } - listmgr_add_inner_grid_cb(list_mgr, LOCATION_LIST_ID, &_grid_input_handler, NULL); - - priv->win = win; - priv->list_mgr = list_mgr; - priv->country_data_mgr = data_mgr; + listmgr_add_inner_grid_cb(priv->list_mgr, LOCATION_LIST_ID, &_grid_input_handler, NULL); if (!viewmgr_set_view_data(VIEW_LOCATION, priv)) { _ERR("Set view data failed."); - listmgr_destroy(list_mgr); - datamgr_destroy(data_mgr); - evas_object_del(base); + listmgr_destroy(priv->list_mgr); + datamgr_destroy(priv->data_mgr); + evas_object_del(priv->base); free(priv); return NULL; } - data_location_fill_list_data(list_mgr, &priv->configured_country, NULL); + data_location_fill_list_data(priv->list_mgr, &priv->configured_country, NULL); _draw_menu_area(priv); - return base; + return priv->base; } static void _show(void *data) @@ -355,7 +347,7 @@ static void _destroy(void *data) return; } - datamgr_destroy(priv->country_data_mgr); + datamgr_destroy(priv->data_mgr); listmgr_destroy(priv->list_mgr); layoutmgr_destroy(priv->ly_mgr); -- 2.7.4