Fix the bug about phone name 2.0alpha master 2.0_alpha submit/master/20120920.150952
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 12 Sep 2012 01:55:02 +0000 (10:55 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 12 Sep 2012 01:55:02 +0000 (10:55 +0900)
[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
include/bt-util.h
packaging/ug-bluetooth-efl.spec
src/libraries/bt-callback.c
src/libraries/bt-util.c
src/ui/bt-main-view.c

index fd20e79..c9bfe2b 100644 (file)
@@ -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 <dh79.pyun@samsung.com>  Wed, 12 Sep 2012 10:54:14 +0900
+
 ug-setting-bluetooth-efl (0.2.116) unstable; urgency=low
 
   * Upload the package
index 98c9397..438b62d 100644 (file)
@@ -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);
index 8abfef9..a296a98 100644 (file)
@@ -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
index fdc0b0e..008ba9c 100644 (file)
@@ -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);
index a6fe9ee..1c6d854 100644 (file)
@@ -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;
index 6a0a11d..071e3ff 100644 (file)
@@ -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.");