From 98600358d49c276883cf090d74a979747d0b2d60 Mon Sep 17 00:00:00 2001 From: DoHyun Pyun Date: Wed, 12 Sep 2012 10:55:02 +0900 Subject: [PATCH] Fix the bug about phone name [Issue] Internal bug [Problem] The phone name was not changed properly [Cause] Not use the vconf value when BT on [Solution] Match the phone name Change-Id: I10f3292eb298cad8039b3de4a2635b12c719cbd0 --- debian/changelog | 8 ++++++++ include/bt-util.h | 2 ++ packaging/ug-bluetooth-efl.spec | 2 +- src/libraries/bt-callback.c | 2 ++ src/libraries/bt-util.c | 14 ++++++++++++++ src/ui/bt-main-view.c | 14 ++++++++++++++ 6 files changed, 41 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index fd20e79..c9bfe2b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +ug-setting-bluetooth-efl (0.2.117) unstable; urgency=low + + * Upload the package + * Git: magnolia/apps/home/ug-bluetooth-efl + * Tag: ug-setting-bluetooth-efl_0.2.117 + + -- DoHyun Pyun Wed, 12 Sep 2012 10:54:14 +0900 + ug-setting-bluetooth-efl (0.2.116) unstable; urgency=low * Upload the package diff --git a/include/bt-util.h b/include/bt-util.h index 98c9397..438b62d 100644 --- a/include/bt-util.h +++ b/include/bt-util.h @@ -58,6 +58,8 @@ void _bt_util_launch_no_event(void *data, void *obj, void *event); void _bt_util_set_list_disabled(Evas_Object *genlist, Eina_Bool disable); +void _bt_util_set_phone_name(void); + int _bt_util_get_phone_name(char *phone_name, int size); int _bt_util_get_timeout_string(int timeout, char *buf, int size); diff --git a/packaging/ug-bluetooth-efl.spec b/packaging/ug-bluetooth-efl.spec index 8abfef9..a296a98 100644 --- a/packaging/ug-bluetooth-efl.spec +++ b/packaging/ug-bluetooth-efl.spec @@ -5,7 +5,7 @@ Name: ug-bluetooth-efl Summary: UI gadget about the bluetooth -Version: 0.2.116 +Version: 0.2.117 Release: 1 Group: TO_BE/FILLED_IN License: TO BE FILLED IN diff --git a/src/libraries/bt-callback.c b/src/libraries/bt-callback.c index fdc0b0e..008ba9c 100644 --- a/src/libraries/bt-callback.c +++ b/src/libraries/bt-callback.c @@ -116,6 +116,8 @@ static void __bt_cb_enable(int result, void *data) } } + _bt_util_set_phone_name(); + elm_object_item_disabled_set(ugd->visible_item, EINA_FALSE); elm_genlist_item_update(ugd->status_item); elm_genlist_item_update(ugd->visible_item); diff --git a/src/libraries/bt-util.c b/src/libraries/bt-util.c index a6fe9ee..1c6d854 100644 --- a/src/libraries/bt-util.c +++ b/src/libraries/bt-util.c @@ -330,6 +330,20 @@ gboolean _bt_util_store_get_value(const char *key, bt_store_type_t store_type, return TRUE; } +void _bt_util_set_phone_name(void) +{ + char *phone_name = NULL; + char *ptr = NULL; + + phone_name = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR); + if (phone_name && strlen(phone_name) != 0) { + if (!g_utf8_validate(phone_name, -1, (const char **)&ptr)) + *ptr = '\0'; + + bt_adapter_set_name(phone_name); + } +} + int _bt_util_get_phone_name(char *phone_name, int size) { FN_START; diff --git a/src/ui/bt-main-view.c b/src/ui/bt-main-view.c index 6a0a11d..071e3ff 100644 --- a/src/ui/bt-main-view.c +++ b/src/ui/bt-main-view.c @@ -2923,6 +2923,8 @@ void _bt_main_init_status(bt_ug_data *ugd, void *data) FN_START; service_h service = NULL; + char *dev_name = NULL; + char phone_name[BT_DEVICE_NAME_LENGTH_MAX + 1]; bool status = false; bt_adapter_state_e bt_state = BT_ADAPTER_DISABLED; bt_adapter_visibility_mode_e mode = @@ -2961,6 +2963,18 @@ void _bt_main_init_status(bt_ug_data *ugd, void *data) ugd->op_status = BT_ACTIVATED; + /* Get adapter name from bluez */ + bt_adapter_get_name(&dev_name); + + /* Get phone name from vconf */ + _bt_util_get_phone_name(phone_name, BT_DEVICE_NAME_LENGTH_MAX); + + if (g_strcmp0(dev_name, phone_name) != 0) { + _bt_util_set_phone_name(); + } + + g_free(dev_name); + if(bt_adapter_get_visibility(&mode) != BT_ERROR_NONE) BT_DBG("bt_adapter_get_visibility() failed."); -- 2.34.1