From: Taejin Woo Date: Wed, 19 Jun 2013 01:47:21 +0000 (+0900) Subject: Add back key cb for new efl dark theme X-Git-Tag: submit/tizen_2.2/20130714.154515~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=51746eaef38fcc22d370e1e1d52b4033b769268c;p=apps%2Fhome%2Fug-bluetooth-efl.git Add back key cb for new efl dark theme [issue#] N_SE-42183 [problem] Occured abnormal operation using H/W back key [cause] There is no H/W back key control [solution] Add back key cb func [team] BT Change-Id: I4e2ee58541bdd028965fea13b699f6ae5fc436d4 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 7eb2501..3687e3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED elementary appcore-efl ui-gadget-1 x11 dlog vconf edbus evas edje ecore eina aul syspopup-caller -gobject-2.0 capi-network-bluetooth capi-network-connection) +gobject-2.0 capi-network-bluetooth capi-network-connection efl-assist) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}") diff --git a/packaging/ug-bluetooth-efl.spec b/packaging/ug-bluetooth-efl.spec index be668fb..1afeda1 100644 --- a/packaging/ug-bluetooth-efl.spec +++ b/packaging/ug-bluetooth-efl.spec @@ -15,6 +15,7 @@ BuildRequires: cmake BuildRequires: edje-tools BuildRequires: gettext-tools BuildRequires: pkgconfig(elementary) +BuildRequires: efl-assist-devel BuildRequires: pkgconfig(bundle) BuildRequires: pkgconfig(ui-gadget-1) BuildRequires: pkgconfig(dlog) diff --git a/src/ui/bt-main-view.c b/src/ui/bt-main-view.c index 0c0bc13..66e8de6 100644 --- a/src/ui/bt-main-view.c +++ b/src/ui/bt-main-view.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "bt-main-ug.h" #include "bt-string-define.h" @@ -987,15 +988,14 @@ static service_h __bt_main_get_pick_result(bt_ug_data *ugd, return service; } -static void __bt_main_quit_btn_cb(void *data, Evas_Object *obj, - void *event_info) +static Eina_Bool __bt_main_quit_btn_cb(void *data, Elm_Object_Item *it) { FN_START; service_h service = NULL; bt_ug_data *ugd = (bt_ug_data *)data; - ret_if(ugd == NULL); + retv_if(ugd == NULL, EINA_FALSE); if (ugd->bt_launch_mode == BT_LAUNCH_VISIBILITY) { service = __bt_main_get_visibility_result(ugd, FALSE); @@ -1009,12 +1009,12 @@ static void __bt_main_quit_btn_cb(void *data, Evas_Object *obj, if (service == NULL) { _bt_ug_destroy(data, NULL); - return; + return EINA_FALSE; } if (service_add_extra_data(service, "result", BT_RESULT_FAIL) < 0) { - BT_DBG("Fail to add extra data"); + BT_ERR("Fail to add extra data"); } _bt_ug_destroy(data, (void *)service); @@ -1025,6 +1025,7 @@ static void __bt_main_quit_btn_cb(void *data, Evas_Object *obj, } FN_END; + return EINA_FALSE; } static int __bt_main_enable_bt(void *data) @@ -2808,9 +2809,10 @@ int _bt_main_draw_list_view(bt_ug_data *ugd) int ret = 0; Evas_Object *navi; Evas_Object *btn; + Evas_Object *toolbar; + Evas_Object *segmentedBtn; Evas_Object *layout; Evas_Object *genlist; - Evas_Object *back_btn; Evas_Object *title; Elm_Object_Item *navi_it; @@ -2820,8 +2822,10 @@ int _bt_main_draw_list_view(bt_ug_data *ugd) evas_object_smart_callback_add(navi, "title,clicked", __bt_title_clicked_cb, NULL); - /* create back button */ - back_btn = elm_button_add(navi); + elm_naviframe_prev_btn_auto_pushed_set(navi, EINA_FALSE); + + ea_object_event_callback_add(navi, EA_CALLBACK_BACK, + ea_naviframe_back_cb, NULL); _bt_create_bg(navi, "group_list"); @@ -2829,7 +2833,7 @@ int _bt_main_draw_list_view(bt_ug_data *ugd) genlist = __bt_main_add_genlist_dialogue(layout, ugd); - navi_it = elm_naviframe_item_push(navi, NULL, back_btn, NULL, genlist, + navi_it = elm_naviframe_item_push(navi, NULL, NULL, NULL, genlist, NULL); /* Slide title */ @@ -2842,21 +2846,31 @@ int _bt_main_draw_list_view(bt_ug_data *ugd) evas_object_show(title); elm_object_item_part_content_set(navi_it, "elm.swallow.title", title); + /* Will modify this code after applying EFL changes */ +#ifndef NEW_TOOL_BAR /* BT_STR_SCAN will be changed to icon */ btn = _bt_create_button(navi, "naviframe/toolbar/default", BT_STR_SCAN, - NULL, __bt_main_controlbar_btn_cb, - (void *)ugd); + NULL, __bt_main_controlbar_btn_cb, + (void *)ugd); ugd->scan_btn = btn; elm_object_item_part_content_set(navi_it, "toolbar_button1", btn); - ugd->navi_it = navi_it; + elm_naviframe_item_pop_cb_set(navi_it, __bt_main_quit_btn_cb, ugd); +#else + /* create toolbar for scan button*/ + toolbar = elm_toolbar_add(navi); + elm_object_style_set(toolbar, "default"); + elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND); + elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE); - /* Style set should be called after elm_naviframe_item_push(). */ - elm_object_style_set(back_btn, "naviframe/back_btn/default"); - evas_object_smart_callback_add(back_btn, "clicked", - __bt_main_quit_btn_cb, (void *)ugd); + btn = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL); + elm_object_item_part_content_set(btn, "object", segmentedBtn); + elm_object_item_part_content_set(navi_it, "toolbar", toolbar); + ugd->scan_btn = segmentedBtn; +#endif + ugd->navi_it = navi_it; ugd->navi_bar = navi; ugd->main_layout = layout; ugd->main_genlist = genlist; @@ -2904,15 +2918,13 @@ int _bt_main_draw_visibility_view(bt_ug_data *ugd) Evas_Object *navi = NULL; Evas_Object *layout = NULL; Evas_Object *genlist = NULL; - Evas_Object *back_btn = NULL; Elm_Object_Item *navi_it; retv_if(ugd == NULL, BT_UG_FAIL); navi = _bt_create_naviframe(ugd->base); - /* create back button */ - back_btn = elm_button_add(navi); + elm_naviframe_prev_btn_auto_pushed_set(navi, EINA_FALSE); _bt_create_bg(navi, "group_list"); @@ -2920,19 +2932,15 @@ int _bt_main_draw_visibility_view(bt_ug_data *ugd) genlist = __bt_main_add_visibility_dialogue(layout, ugd); - navi_it = elm_naviframe_item_push(navi, BT_STR_VISIBLE, back_btn, NULL, genlist, + navi_it = elm_naviframe_item_push(navi, BT_STR_VISIBLE, NULL, NULL, genlist, NULL); + elm_naviframe_item_pop_cb_set(navi_it, __bt_main_quit_btn_cb, ugd); ugd->navi_it = navi_it; /* create controlbar */ _bt_create_controlbar(navi, "default"); - /* Style set should be called after elm_naviframe_item_push(). */ - elm_object_style_set(back_btn, "naviframe/back_btn/default"); - evas_object_smart_callback_add(back_btn, "clicked", - __bt_main_quit_btn_cb, (void *)ugd); - ugd->navi_bar = navi; ugd->main_layout = layout; ugd->main_genlist = genlist; @@ -2941,7 +2949,6 @@ int _bt_main_draw_visibility_view(bt_ug_data *ugd) if (ugd->op_status == BT_ACTIVATED) elm_object_item_disabled_set(ugd->visible_item, EINA_FALSE); - FN_END; return BT_UG_ERROR_NONE; } diff --git a/src/ui/bt-profile-view.c b/src/ui/bt-profile-view.c index 6b93785..9c66463 100644 --- a/src/ui/bt-profile-view.c +++ b/src/ui/bt-profile-view.c @@ -18,7 +18,7 @@ #include #include #include - +#include #include "bt-main-ug.h" #include "bt-main-view.h" @@ -1656,7 +1656,7 @@ void _bt_profile_create_view(bt_dev_t *dev_info) /* create back button */ back_btn = elm_button_add(layout); - navi_it = elm_naviframe_item_push(ugd->navi_bar, NULL, + navi_it = elm_naviframe_item_push(vd->navi_bar, NULL, back_btn, NULL, genlist, NULL); /* Slide title */ @@ -1669,6 +1669,11 @@ void _bt_profile_create_view(bt_dev_t *dev_info) evas_object_show(title); elm_object_item_part_content_set(navi_it, "elm.swallow.title", title); + elm_naviframe_prev_btn_auto_pushed_set(vd->navi_bar, EINA_FALSE); + + ea_object_event_callback_add(vd->navi_bar, EA_CALLBACK_BACK, + ea_naviframe_back_cb, NULL); + /* Style set should be called after elm_naviframe_item_push(). */ elm_object_style_set(back_btn, "naviframe/back_btn/default"); evas_object_smart_callback_add(back_btn, "clicked",