From a5b74872a66bde195dcc234e2f55a7cd6499f985 Mon Sep 17 00:00:00 2001 From: Segwon Date: Fri, 6 Jan 2017 16:14:09 +0900 Subject: Block device duplicate detection. Signed-off-by: Segwon Change-Id: I5c4fdaee28c8c689f8b532a866818062f4cc9170 --- src/ui/setting_item_device_list.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ui/setting_item_device_list.c b/src/ui/setting_item_device_list.c index ce8f5bc..535f260 100644 --- a/src/ui/setting_item_device_list.c +++ b/src/ui/setting_item_device_list.c @@ -76,7 +76,7 @@ static void popup_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) } set_acl_device_list(); - evas_object_del(popup); + evas_object_del(popup); } static void show_device_list_selected_popup(char *title_name, char *content, char *left_button_name, char *center_button_name, char *right_button_name) @@ -220,7 +220,7 @@ static Evas_Object* create_image(Evas_Object *parent, Evas_Coord w, Evas_Coord h elm_image_file_set(img, "usr/apps/org.tizen.d2d-conv-setting/res/images/device_type_icon_multimedia.png", NULL); } - evas_object_size_hint_min_set(img, ELM_SCALE_SIZE(w), ELM_SCALE_SIZE(h)); + evas_object_size_hint_min_set(img, ELM_SCALE_SIZE(w), ELM_SCALE_SIZE(h)); return img; } @@ -272,7 +272,14 @@ static void discovery_foreach_cb(conv_device_h device_h, int result, void *data) conv_device_get_property_string(device_h, CONV_DEVICE_NAME, &device_name); conv_device_get_property_string(device_h, CONV_DEVICE_TYPE, &device_type); - int index = ++discovered_devices_index; + int index; + for (index = 0; index <= discovered_devices_index; index++) { + if (!strcmp(discovered_devices_info[index]->mac_address, device_id)) { + return; + } + } + + index = ++discovered_devices_index; discovered_devices_info[index] = (device_info_s *) calloc(sizeof(device_info_s), 1); discovered_devices_info[index]->list_type = LIST_TYPE_DISCOVERED; discovered_devices_info[index]->index = index; @@ -283,7 +290,7 @@ static void discovery_foreach_cb(conv_device_h device_h, int result, void *data) elm_genlist_item_append(discovered_list, device_item_builder, discovered_devices_info[index], discovered_device_group, ELM_GENLIST_ITEM_NONE, device_list_select_cb, discovered_devices_info[index]); elm_genlist_item_fields_update(discovered_device_group, "elm.swallow.end", ELM_GENLIST_ITEM_FIELD_CONTENT); - break; + return; case CONV_DISCOVERY_RESULT_FINISHED : conv_destroy(conv_handle); -- cgit v1.2.3