diff options
author | JuWan Kim <juwan.kim@samsung.com> | 2015-04-13 16:15:19 +0900 |
---|---|---|
committer | JuWan Kim <juwan.kim@samsung.com> | 2015-04-13 16:15:19 +0900 |
commit | f0a1c1151e3dfcacf959cfc5444c2ee0c66c82dd (patch) | |
tree | a98413db0865a8faf006229bc152deb3d060ee5a /src | |
parent | 480b4ad8d67839364e2f7fbdae7b574b3521ee95 (diff) | |
download | settings-f0a1c1151e3dfcacf959cfc5444c2ee0c66c82dd.tar.gz settings-f0a1c1151e3dfcacf959cfc5444c2ee0c66c82dd.tar.bz2 settings-f0a1c1151e3dfcacf959cfc5444c2ee0c66c82dd.zip |
Fix auto-test bug
* Fix btn click callback
* Remove Key defines
Change-Id: I8a1b442cc2e5a36641b157b60ebbd06b211fad61
Signed-off-by: JuWan Kim <juwan.kim@samsung.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/timeout_handler.cpp | 1 | ||||
-rw-r--r-- | src/view_maincatalog.cpp | 251 | ||||
-rwxr-xr-x | src/view_need_pwd.cpp | 3 | ||||
-rwxr-xr-x | src/view_pwd_popup.cpp | 3 | ||||
-rw-r--r-- | src/view_sublist.cpp | 13 | ||||
-rw-r--r-- | src/view_system_clock.cpp | 1 | ||||
-rw-r--r-- | src/view_uigadget.cpp | 1 |
7 files changed, 103 insertions, 170 deletions
diff --git a/src/timeout_handler.cpp b/src/timeout_handler.cpp index db39007..dc9a00f 100644 --- a/src/timeout_handler.cpp +++ b/src/timeout_handler.cpp @@ -16,6 +16,7 @@ #include <app.h> #include <Elementary.h> +#include <AppCommon.h> #include "dbg.h" #include "stdlib.h" #include "stdbool.h" diff --git a/src/view_maincatalog.cpp b/src/view_maincatalog.cpp index 0e67b27..d7f15b7 100644 --- a/src/view_maincatalog.cpp +++ b/src/view_maincatalog.cpp @@ -15,6 +15,7 @@ */ #include <app.h> +#include <AppCommon.h> #include "dbg.h" #include "def.h" @@ -1520,114 +1521,64 @@ static int _add_icon_btns(SMainCatalog *data, Eina_List *list) * * @return: 0 - success, -1 - fail. */ -static int _draw_main_items(SMainCatalog *data) +void CMainCatalogView::m_DrawMainItems(void) { - Evas_Object *box, *btn, *tmp, *icon; - Eina_Array *btns, *icons; - Eina_List *list; - int cnt, i; - Eina_Array_Iterator a; - void* obj; - - if (!data || !data->base) - return -1; - - box = utils_add_box(data->base); - if (!box) - return -1; - - data->mainitem_box = box; - - cnt = 0; - list = viewdata_get_childitems_list(data->main_setting_view); - if (list) - cnt = eina_list_count(list); - - if (cnt == 0) { - _ERR("There is no child item"); - evas_object_del(box); - viewdata_free_childitems_list(list); - return -1; - } - - data->main_item_count = cnt; - - btns = eina_array_new(1); - if (!btns) { - _ERR("Create Eina Array failed\n"); - evas_object_del(box); - viewdata_free_childitems_list(list); - return -1; - } - - data->main_item_btn = btns; - - icons = eina_array_new(1); - if (!icons) { - _ERR("new array for icon base failed."); - evas_object_del(box); - viewdata_free_childitems_list(list); - eina_array_free(btns); - return -1; - } - - data->main_icon_base = icons; - - if (_add_icon_btns(data, list) == -1) { - _ERR("Fail to add icon buttons"); - goto error; - } - - elm_object_part_content_set(data->base, MAIN_VIEW_ICON_SWALLOW, box); - - if (!data->item_path) { - btn = (Evas_Object *)eina_array_data_get(btns, 0); - if (!btn) - goto error; - - if (_draw_subitems(data, - (const char *) evas_object_data_get(btn, SETTING_ID)) == -1) - goto error; - - icon = (Evas_Object *)eina_array_data_get(icons, 0); - if (!icon) { - if (data->subsetting_view) - viewdata_release(data->subsetting_view); - goto error; + Evas_Object *btn, *icon; + Eina_List *list = NULL; + bool ret = true; + + _CREATE_BEGIN { + _CHECK(m->mainitem_box = utils_add_box(m->base)) + _CHECK(list = viewdata_get_childitems_list(m->main_setting_view)) + _COMMAND{ + m->main_item_count = 0; + m->main_item_count = eina_list_count(list); } + _CHECK(m->main_item_count) + _CHECK(m->main_item_btn = eina_array_new(1)) + _CHECK(m->main_icon_base = eina_array_new(1)) + _CHECK(_add_icon_btns(m, list) != -1) + _COMMAND { + elm_object_part_content_set(m->base, MAIN_VIEW_ICON_SWALLOW, m->mainitem_box); + + if (!m->item_path) { + btn = (Evas_Object *)eina_array_data_get(m->main_item_btn, 0); + if (btn) { + if (_draw_subitems(m, (const char *) evas_object_data_get(btn, SETTING_ID)) != -1) { + icon = (Evas_Object *)eina_array_data_get(m->main_icon_base, 0); + if (icon) { + elm_object_signal_emit(icon, MAIN_BTN_FOCUSED, MAIN_BTN); + + m->focus_status = FOCUS_MAIN_ITEM; + elm_object_focus_set(btn, EINA_TRUE); + m->focused_main_item_btn = btn; + } + else { + if (m->subsetting_view) + viewdata_release(m->subsetting_view); + ret = false; + } + } + else + ret = false; + } + else + ret = false; + } - elm_object_signal_emit(icon, MAIN_BTN_FOCUSED, MAIN_BTN); - - data->focus_status = FOCUS_MAIN_ITEM; - - elm_object_focus_set(btn, EINA_TRUE); - data->focused_main_item_btn = btn; - } - - utils_set_focus_directions(data->main_item_btn, cnt); - - viewdata_free_childitems_list(list); - - return 0; - -error: - evas_object_del(box); - viewdata_free_childitems_list(list); - EINA_ARRAY_ITER_NEXT(btns, i, obj, a) - { - tmp = (Evas_Object *) obj; - evas_object_del(tmp); - } - eina_array_free(btns); - - EINA_ARRAY_ITER_NEXT(icons, i, obj, a) - { - tmp = (Evas_Object *) obj; - evas_object_del(tmp); - } - eina_array_free(icons); - - return -1; + utils_set_focus_directions(m->main_item_btn, m->main_item_count); + viewdata_free_childitems_list(list); + } + _CHECK(ret) + _WHEN_SUCCESS { } + _CHECK_FAIL{/* ret */} + _CHECK_FAIL{/*_add_icon_btns(m, list) != -1*/} + _CHECK_FAIL{if(m->main_icon_base) eina_array_free(m->main_icon_base);} + _CHECK_FAIL{if(m->main_item_btn) eina_array_free(m->main_item_btn);} + _CHECK_FAIL{/* m->main_item_count */} + _CHECK_FAIL{if(list) viewdata_free_childitems_list(list);} + _CHECK_FAIL{if(m->mainitem_box) evas_object_del(m->mainitem_box);} + } _CREATE_END_AND_CATCH { return; } } /** @@ -1640,21 +1591,21 @@ error: * * @return: void. */ -static void _view_anim_finish(void *data, Evas_Object *obj, - const char *emission, const char *source) +void CMainCatalogView::sm_CbViewAniFinish(void *data, Evas_Object *obj, const char *emission, const char *source) { - _DBG("START ========================================================="); - SMainCatalog *priv; + if(!data){ _ERR("Invalid Param"); return;} + CMainCatalogView *root; + root = (CMainCatalogView *) data; + root->m_OnViewAniFinish(obj, emission, source); +} - if (!data) - return; - priv = (SMainCatalog *)data; - - _draw_main_items(priv); - _DBG("END ========================================================="); +void CMainCatalogView::m_OnViewAniFinish(Evas_Object *obj, const char *emission, const char *source) +{ + m_DrawMainItems(); } + /** * This function moves focus from main item to subitem and * does corresponding operations. @@ -1770,53 +1721,31 @@ bool CMainCatalogView::Create(struct settingview_data *view, void *prev) ASSERT(!m); ASSERT(view); - _DBG("START =================================================================="); - Evas_Object *base, *win; - CSettingMgr *mgr = CSettingMgr::GetInstance(); - - win = mgr->Window(); - ASSERT(win); - - m = (SMainCatalog *) calloc(1, sizeof(*m)); - if (!m) - return false; - - base = elm_layout_add(win); - if (!base) { - delete m; - m = NULL; - return false; - } - - if (!elm_layout_file_set(base, EDJ_FILE, MAIN_VIEW_PAGE)) - goto error; - - m->mgr = mgr; - m->win = win; - m->base = base; - m->main_setting_view = view; - m->subsetting_view = NULL; - m->item_path = mgr->GetItemPath(); - - evas_object_data_set(base, DATA_ID, m); - - elm_object_signal_callback_add(base, MAIN_VIEW_ANIM_FINISH, - MAIN_VIEW_SOURCE, _view_anim_finish, m); - - if (!m->item_path) - elm_object_signal_emit(m->base, MAIN_VIEW_LOAD, ""); - else - _view_anim_finish(m, NULL, NULL, NULL); + _CREATE_BEGIN{ + _CHECK(m = new SMainCatalog) + _CHECK(m->mgr = CSettingMgr::GetInstance()) + _CHECK(m->win = m->mgr->Window()) + _CHECK(m->base = elm_layout_add(m->win)) + _WHEN_SUCCESS { + elm_layout_file_set(m->base, EDJ_FILE, MAIN_VIEW_PAGE); + m->main_setting_view = view; + m->subsetting_view = NULL; + m->item_path = m->mgr->GetItemPath(); + evas_object_data_set(m->base, DATA_ID, m); + elm_object_signal_callback_add(m->base, MAIN_VIEW_ANIM_FINISH, MAIN_VIEW_SOURCE, sm_CbViewAniFinish, this); + + if (!m->item_path) + elm_object_signal_emit(m->base, MAIN_VIEW_LOAD, ""); + else + m_OnViewAniFinish(NULL, NULL, NULL); + } + _CHECK_FAIL{if(m->base) evas_object_del(m->base);} + _CHECK_FAIL{/* m->win = m->mgr->Window() */} + _CHECK_FAIL{/* m->mgr = CSettingMgr::GetInstance() */} + _CHECK_FAIL{ delete m; m = NULL; } + } _CREATE_END_AND_CATCH{ return false; } - _DBG("END =================================================================="); return true; - -error: - _DBG("END-ERROR =================================================================="); - evas_object_del(base); - delete m; - m = NULL; - return false; } @@ -2097,4 +2026,4 @@ struct setting_class *view_maincatalog_get_vclass(void) { return &_vclass; } -#endif
\ No newline at end of file +#endif diff --git a/src/view_need_pwd.cpp b/src/view_need_pwd.cpp index 8438ddd..26c9687 100755 --- a/src/view_need_pwd.cpp +++ b/src/view_need_pwd.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <AppCommon.h> #include "dbg.h" #include "def.h" #include "utils.h" @@ -738,4 +739,4 @@ struct setting_class *view_need_passcode_get_vclass(void) { return &_vclass; } -#endif
\ No newline at end of file +#endif diff --git a/src/view_pwd_popup.cpp b/src/view_pwd_popup.cpp index ae64bb4..7226f15 100755 --- a/src/view_pwd_popup.cpp +++ b/src/view_pwd_popup.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <AppCommon.h> #include "dbg.h" #include "def.h" #include "view_pwd_popup.h" @@ -891,4 +892,4 @@ struct setting_class *view_passcode_popup_get_vclass(void) { return &_vclass; } -#endif
\ No newline at end of file +#endif diff --git a/src/view_sublist.cpp b/src/view_sublist.cpp index 1f5b6f2..c95546f 100644 --- a/src/view_sublist.cpp +++ b/src/view_sublist.cpp @@ -269,6 +269,7 @@ bool CSublistView::m_DrawCtxpopupLayout() } if (m->sub_items_count > MAX_ITEMS) { + _DBG(); m->scroller = utils_add_scroller(m->ctxpopup); if (!m->scroller) { _ERR("elm_scroller_add failed"); @@ -368,14 +369,13 @@ bool CSublistView::m_DrawListItems(Eina_List *list) val = listitem_get_value(ldata); if (!strncmp(sel, val, strlen(sel))) { - elm_object_signal_emit(btn, - CTXPOPUPBTN_BUTTON_HIGHLIGHT, - CTXPOPUPBTN_BUTTON_SOURCE); + elm_object_signal_emit(btn, CTXPOPUPBTN_BUTTON_HIGHLIGHT, CTXPOPUPBTN_BUTTON_SOURCE); check = i; } evas_object_data_set(btn, ITEMID, val); + _DBG("[%s] Connected", name); Connect(btn, ID_BTNS, TYPE_FOCUSED | TYPE_UNFOCUSED | TYPE_CLICKED | TYPE_KEY_DOWN); //evas_object_smart_callback_add(btn, SIG_ITEM_FOCUSED, sm_CbSubitemFocusIn, this); @@ -410,9 +410,7 @@ bool CSublistView::m_DrawSublist(void) { _DBG(); Eina_List *list; - double ratio, w; - int cnt, x, y, height, screen_h; - struct obj_geometry_data *param; + int cnt; if (!m->sublist_view || !m->geometry_data) { _ERR("Invalid argument\n"); @@ -478,7 +476,8 @@ bool CSublistView::Create(struct settingview_data *view, void *prev) _COMMAND { elm_layout_file_set(m->base, EDJ_FILE, SUBLIST_VIEW_PAGE); } - _CHECK(m->ctxpopup = utils_add_ctxpopup(m->win, (char *) SUBLIST_CTXPOPUP_STYLE1)) + //_CHECK(m->ctxpopup = utils_add_ctxpopup(m->win, (char *) SUBLIST_CTXPOPUP_STYLE1)) + _CHECK(m->ctxpopup = utils_add_ctxpopup(m->win, NULL)) _COMMAND { evas_object_smart_callback_add(m->ctxpopup, SIG_CTXPOPUP_DISMISSED, sm_CbCtxpopupDismissed, this); m->geometry_data = (struct obj_geometry_data *) prev; diff --git a/src/view_system_clock.cpp b/src/view_system_clock.cpp index 8a3f915..f6e22d3 100644 --- a/src/view_system_clock.cpp +++ b/src/view_system_clock.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <AppCommon.h> #include "dbg.h" #include "def.h" #include "stdbool.h" diff --git a/src/view_uigadget.cpp b/src/view_uigadget.cpp index 2f699ff..17ddda6 100644 --- a/src/view_uigadget.cpp +++ b/src/view_uigadget.cpp @@ -15,6 +15,7 @@ */ #include <ui-gadget.h> +#include <AppCommon.h> #include "view_uigadget.h" #include "dbg.h" #include "def.h" |