diff options
author | jinwang.an <jinwang.an@samsung.com> | 2018-08-02 18:30:39 +0900 |
---|---|---|
committer | jinwang.an <jinwang.an@samsung.com> | 2018-08-02 18:30:39 +0900 |
commit | 7da46536523380c1152340c1cc03315864d633bb (patch) | |
tree | 163f06993136ebac30f1b6f9f35e05429375d436 | |
parent | 00b59c3f6085eefbc804b17e424d5103c14c4d08 (diff) | |
download | watch-setting-7da46536523380c1152340c1cc03315864d633bb.tar.gz watch-setting-7da46536523380c1152340c1cc03315864d633bb.tar.bz2 watch-setting-7da46536523380c1152340c1cc03315864d633bb.zip |
Apply location API to remove vconf calling.submit/tizen/20180808.010606accepted/tizen/unified/20180813.061255
Change-Id: I7bd28077497b53df1d0d57d48414530f4c4edd0f
Signed-off-by: jinwang.an <jinwang.an@samsung.com>
-rwxr-xr-x | CMakeLists.txt | 1 | ||||
-rwxr-xr-x | org.tizen.watch-setting.xml.in | 5 | ||||
-rw-r--r-- | packaging/org.tizen.watch-setting.spec | 1 | ||||
-rw-r--r-- | src/setting-connection.c | 38 |
4 files changed, 31 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a6acae6..6c80879 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,6 +82,7 @@ pkg_check_modules(pkgs REQUIRED elementary ecore-imf appcore-common appcore-efl capi-base-utils-i18n tapi watch-control + capi-location-manager ) #?? diff --git a/org.tizen.watch-setting.xml.in b/org.tizen.watch-setting.xml.in index 823288a..b3da517 100755 --- a/org.tizen.watch-setting.xml.in +++ b/org.tizen.watch-setting.xml.in @@ -103,6 +103,11 @@ <privilege>http://tizen.org/privilege/telephony.admin</privilege> <privilege>http://tizen.org/privilege/telephony</privilege> <privilege>http://tizen.org/privilege/network.get</privilege> + <privilege>http://tizen.org/feature/location</privilege> + <privilege>http://tizen.org/feature/location.enable</privilege> + <privilege>http://tizen.org/feature/location.gps</privilege> + <privilege>http://tizen.org/feature/location.wps</privilege> + <!-- <privilege>http://tizen.org/privilege/appmanager.kill</privilege> <privilege>http://tizen.org/privilege/account.read</privilege> diff --git a/packaging/org.tizen.watch-setting.spec b/packaging/org.tizen.watch-setting.spec index 28159ee..03ec39a 100644 --- a/packaging/org.tizen.watch-setting.spec +++ b/packaging/org.tizen.watch-setting.spec @@ -63,6 +63,7 @@ BuildRequires: pkgconfig(storage) BuildRequires: pkgconfig(capi-base-utils-i18n) BuildRequires: pkgconfig(tapi) BuildRequires: pkgconfig(watch-control) +BuildRequires: pkgconfig(capi-location-manager) %description diff --git a/src/setting-connection.c b/src/setting-connection.c index f0b9d5b..ea6776a 100644 --- a/src/setting-connection.c +++ b/src/setting-connection.c @@ -25,6 +25,7 @@ #include <bluetooth.h> #include <nfc.h> #include <wifi-manager.h> +#include <locations.h> #include "setting-connection.h" #include "util.h" @@ -55,8 +56,9 @@ void _location_cb(void *data, Evas_Object *obj, void *event_info); static void bt_status_changed_cb(int result, bt_adapter_state_e adapter_state, void *user_data); static void wifi_status_changed_cb(wifi_manager_device_state_e state, void *user_data); -static void nfc_status_vconf_changed_cb(bool activated, void *user_data); -static void location_status_vconf_changed_cb(keynode_t *key, void *data); +static void nfc_status_changed_cb(bool activated, void *user_data); +static void location_status_changed_cb(location_method_e method, bool enable, void *user_data); + static struct _connection_menu_item connection_menu_its[] = { { "IDS_ST_BODY_BLUETOOTH", SETTING_CONNECTION_BLUETOOTH, _bluetooth_cb }, @@ -106,8 +108,6 @@ void _clear_connection_resource() g_app_context = NULL; - unregister_vconf_changing(VCONFKEY_LOCATION_USE_MY_LOCATION, location_status_vconf_changed_cb); - if (tel_handle) { tel_deinit(tel_handle); tel_handle = NULL; @@ -125,8 +125,14 @@ void _clear_connection_resource() wifi_manager_unset_device_state_changed_cb(wifi_handle); int wifi_ret = wifi_manager_deinitialize(wifi_handle); + if (wifi_ret != WIFI_MANAGER_ERROR_NONE) ERR("ERROR WIFI deinit %d", wifi_ret); + + int location_ret = location_manager_unset_setting_changed_cb(LOCATIONS_METHOD_HYBRID); + if (location_ret != LOCATIONS_ERROR_NONE) + ERR("ERROR LOCATION unset changed cb %d", location_ret); + } @@ -547,8 +553,10 @@ char *_gl_connection_title_get(void *data, Evas_Object *obj, const char *part) snprintf(buf, sizeof(buf) - 1, text_color, is_on ? _("IDS_COM_BODY_ON_ABB") : _("IDS_COM_BODY_OFF_ABB_M_STATUS")); break; case SETTING_CONNECTION_LOCATION: - vconf_get_int(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")); + location_manager_is_enabled_method(LOCATIONS_METHOD_HYBRID, &is_on); + snprintf(buf, sizeof(buf) - 1, text_color, is_on ? _("IDS_COM_BODY_ON_ABB") : _("IDS_COM_BODY_OFF_ABB_M_STATUS")); + // vconf_get_int(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; */ @@ -721,8 +729,6 @@ Evas_Object *_create_connection_list(void *data) g_connection_genlist = genlist; - register_vconf_changing(VCONFKEY_LOCATION_USE_MY_LOCATION, location_status_vconf_changed_cb, ad); - int bt_ret = bt_initialize(); if (bt_ret != BT_ERROR_NONE) @@ -737,17 +743,21 @@ Evas_Object *_create_connection_list(void *data) if (nfc_ret != NFC_ERROR_NONE) ERR("ERROR NFC init %d", nfc_ret); - nfc_ret = nfc_manager_set_activation_changed_cb(nfc_status_vconf_changed_cb, ad); + nfc_ret = nfc_manager_set_activation_changed_cb(nfc_status_changed_cb, ad); if (nfc_ret != NFC_ERROR_NONE) ERR("ERROR NFC register changed cb %d", nfc_ret); int wifi_ret = wifi_manager_initialize(&wifi_handle); if (wifi_ret != WIFI_MANAGER_ERROR_NONE) - DBG("ERROR WIFI init%d", wifi_ret); + ERR("ERROR WIFI init%d", wifi_ret); wifi_ret = wifi_manager_set_device_state_changed_cb(wifi_handle, wifi_status_changed_cb, ad); if (wifi_ret != WIFI_MANAGER_ERROR_NONE) - DBG("ERROR WIFI set changed cb%d", wifi_ret); + ERR("ERROR WIFI set changed cb%d", wifi_ret); + + int location_ret = location_manager_set_setting_changed_cb(LOCATIONS_METHOD_HYBRID, location_status_changed_cb, ad); + if (location_ret != LOCATIONS_ERROR_NONE) + ERR("ERROR LOCATION set changed cb %d", location_ret); return genlist; } @@ -772,13 +782,13 @@ static void wifi_status_changed_cb(wifi_manager_device_state_e state, void *user _update_connection_list(g_WIFI_item); } -static void nfc_status_vconf_changed_cb(bool activated, void *user_data) +static void nfc_status_changed_cb(bool activated, void *user_data) { - DBG("Setting - nfc_status_vconf_changed_cb() is called!!"); + DBG("Setting - nfc_status_changed_cb() is called!!"); _update_connection_list(g_NFC_item); } -static void location_status_vconf_changed_cb(keynode_t *key, void *data) +static void location_status_changed_cb(location_method_e method, bool enable, void *user_data) { DBG("Setting - location_status_vconf_changed_cb() is called!!"); _update_connection_list(g_location_item); |