diff options
author | jinwang.an <jinwang.an@samsung.com> | 2017-09-11 21:21:44 +0900 |
---|---|---|
committer | jinwang.an <jinwang.an@samsung.com> | 2017-09-12 18:09:33 +0900 |
commit | 5b1d8e1cad13d82351371774c163c948408f6963 (patch) | |
tree | fedb0d2dcc9bd853fc2a8a430f68ff02c5685bf2 | |
parent | f3b0800ec195c48f4b7b10e46503da845e301e93 (diff) | |
download | watch-setting-5b1d8e1cad13d82351371774c163c948408f6963.tar.gz watch-setting-5b1d8e1cad13d82351371774c163c948408f6963.tar.bz2 watch-setting-5b1d8e1cad13d82351371774c163c948408f6963.zip |
Added location menu in Connection
Change-Id: Ic701ba539bc6074240fff79df2767c4eda08988f
Signed-off-by: jinwang.an <jinwang.an@samsung.com>
-rw-r--r-- | include/setting-connection.h | 3 | ||||
-rw-r--r-- | src/setting-connection.c | 45 |
2 files changed, 43 insertions, 5 deletions
diff --git a/include/setting-connection.h b/include/setting-connection.h index caf7499..91d2104 100644 --- a/include/setting-connection.h +++ b/include/setting-connection.h @@ -33,7 +33,8 @@ enum { SETTING_CONNECTION_WIFI, SETTING_CONNECTION_NFC, /* SETTING_CONNECTION_BT_ALERTS, */ - SETTING_CONNECTION_FLIGHT_MODE + SETTING_CONNECTION_FLIGHT_MODE, + SETTING_CONNECTION_LOCATION }; struct _connection_menu_item { diff --git a/src/setting-connection.c b/src/setting-connection.c index d7434c3..049f36f 100644 --- a/src/setting-connection.c +++ b/src/setting-connection.c @@ -40,6 +40,7 @@ void _wifi_cb(void *data, Evas_Object *obj, void *event_info); /*void _alerts_cb(void *data, Evas_Object *obj, void *event_info); */ void _flight_mode_cb(void *data, Evas_Object *obj, void *event_info); void _nfc_cb(void *data, Evas_Object *obj, void *event_info); +void _location_cb(void *data, Evas_Object *obj, void *event_info); static void bt_status_vconf_changed_cb(keynode_t *key, void *data); static void wifi_status_vconf_changed_cb(keynode_t *key, void *data); @@ -51,6 +52,7 @@ static struct _connection_menu_item connection_menu_its[] = { { "IDS_ST_BODY_NFC", SETTING_CONNECTION_NFC, _nfc_cb }, /* { "Alerts", SETTING_CONNECTION_BT_ALERTS, _alerts_cb }, */ { "IDS_ST_BODY_FLIGHT_MODE", SETTING_CONNECTION_FLIGHT_MODE, _flight_mode_cb }, + { "Location", SETTING_CONNECTION_LOCATION, _location_cb }, }; static int CONNECT_TOP_MENU_SIZE = @@ -193,12 +195,9 @@ static void _flight_mode_check_cb(void *data, Evas *e, Evas_Object *obj, void *e layout = elm_layout_add(popup); elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons2"); - char *txt = strdup(buf); - elm_object_text_set(layout, txt); + elm_object_text_set(layout, buf); elm_object_content_set(popup, layout); - FREE(txt); - btn1 = elm_button_add(popup); elm_object_style_set(btn1, "popup/circle/left"); evas_object_size_hint_weight_set(btn1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -257,6 +256,8 @@ Evas_Object *_gl_connection_check_get(void *data, Evas_Object *obj, const char * vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &is_value); evas_object_event_callback_add(check, EVAS_CALLBACK_MOUSE_DOWN, _flight_mode_check_cb, (void *)check); break; + default: + break; } elm_check_state_set(check, (is_value) ? EINA_TRUE : EINA_FALSE); /*default */ @@ -375,6 +376,38 @@ void _nfc_cb(void *data, Evas_Object *obj, void *event_info) running_timer = ecore_timer_add(0.5, (Ecore_Task_Cb)_app_ctrl_timer_cb, NULL); } +void _location_cb(void *data, Evas_Object *obj, void *event_info) +{ + elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); + + DBG("_location_cb in"); + appdata *ad = data; + + if (ad == NULL) { + DBG("Setting - ad is null"); + return; + } + + if (running_connection) { + return; + } + + app_control_h service; + app_control_create(&service); + app_control_set_package(service, "org.tizen.setting-location-wearable"); + app_control_send_launch_request(service, NULL, NULL); + + ad->service_nfc = service; + + running_connection = true; + + if (running_timer) { + ecore_timer_del(running_timer); + running_timer = NULL; + } + running_timer = ecore_timer_add(0.5, (Ecore_Task_Cb)_app_ctrl_timer_cb, NULL); +} + /*void _alerts_cb(void *data, Evas_Object *obj, void *event_info) */ /*{ */ /* elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE); */ @@ -412,6 +445,9 @@ char *_gl_connection_title_get(void *data, Evas_Object *obj, const char *part) vconf_get_bool(VCONFKEY_NFC_STATE, &val); snprintf(buf, sizeof(buf) - 1, text_color, val ? _("IDS_COM_BODY_ON_ABB") : _("IDS_COM_BODY_OFF_ABB_M_STATUS")); break; + case SETTING_CONNECTION_LOCATION: + vconf_get_bool(VCONFKEY_LOCATION_USE_MY_LOCATION, &val); + snprintf(buf, sizeof(buf) - 1, text_color, val ? _("IDS_COM_BODY_ON_ABB") : _("IDS_COM_BODY_OFF_ABB_M_STATUS")); /* case SETTING_CONNECTION_BT_ALERTS: */ /* snprintf(buf, sizeof(buf) - 1, "Receive BT disconnection alerts."); */ /* break; */ @@ -492,6 +528,7 @@ Evas_Object *_create_connection_list(void *data) case SETTING_CONNECTION_BLUETOOTH: case SETTING_CONNECTION_WIFI: case SETTING_CONNECTION_NFC: + case SETTING_CONNECTION_LOCATION: /* case SETTING_CONNECTION_BT_ALERTS: */ itc_tmp = itc; break; |