summaryrefslogtreecommitdiff
path: root/ug-wifidirect/src/wfd_ug_genlist.c
blob: bb2345cc627820c73623cf4d8eb30889a86a42ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
/*
*  WiFi-Direct UG
*
* Copyright 2012  Samsung Electronics Co., Ltd

* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

* http://www.tizenopensource.org/license

* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#include <libintl.h>

#include <assert.h>
#include <glib.h>

#include <Elementary.h>
#include <vconf.h>
#include <ui-gadget-module.h>
#include <wifi-direct.h>

#include "wfd_ug.h"
#include "wfd_ug_view.h"
#include "wfd_client.h"

Elm_Gen_Item_Class head_itc;
Elm_Gen_Item_Class name_itc;
Elm_Gen_Item_Class title_itc;
Elm_Gen_Item_Class peer_itc;
Elm_Gen_Item_Class noitem_itc;
Elm_Gen_Item_Class button_itc;

Elm_Gen_Item_Class title_conn_itc;
Elm_Gen_Item_Class peer_conn_itc;

Elm_Gen_Item_Class title_busy_itc;
Elm_Gen_Item_Class peer_busy_itc;

Elm_Gen_Item_Class title_multi_connect_itc;
Elm_Gen_Item_Class peer_multi_connect_itc;

Elm_Gen_Item_Class title_conn_failed_itc;
Elm_Gen_Item_Class peer_conn_failed_itc;

/**
 *	This function let the ug get the label of header
 *	@return   the label of header
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static char *_gl_header_label_get(void *data, Evas_Object *obj, const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;
	struct ug_data *ugd = (struct ug_data *) data;
	WDUG_LOGI("%s", part);

	if (data == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)\n");
		return NULL;
	}

	if (!strcmp(part, "elm.text.1")) {
		WDUG_LOGI("Current text mode [%d]\n", ugd->head_text_mode);
		switch (ugd->head_text_mode) {
		case HEAD_TEXT_TYPE_DIRECT:
		case HEAD_TEXT_TYPE_ACTIVATED:
		case HEAD_TEXT_TYPE_SCANING:
			return strdup(dgettext("sys_string", "IDS_COM_OPT1_WI_FI_DIRECT"));
			break;
		case HEAD_TEXT_TYPE_DEACTIVATING:
			return strdup(_("IDS_WFD_BODY_DEACTIVATING"));
			break;
		case HEAD_TEXT_TYPE_ACTIVATING:
			return strdup(_("IDS_WFD_BODY_ACTIVATING"));
			break;
		default:
			break;
		}
	} else if (!strcmp(part, "elm.text.1")) {
		return strdup(dgettext("sys_string", "IDS_COM_OPT1_WI_FI_DIRECT"));
	} else if (!strcmp(part, "elm.text.2")) {
		return strdup(ugd->dev_name);
	}

	__WDUG_LOG_FUNC_EXIT__;
	return NULL;
}

/**
 *	This function let the ug get the icon of header
 *	@return   the icon of header
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static Evas_Object *_gl_header_icon_get(void *data, Evas_Object *obj, const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;
	struct ug_data *ugd = (struct ug_data *) data;
	Evas_Object *onoff = NULL;

	if (data == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)\n");
		return NULL;
	}

	if (ugd->head_text_mode == HEAD_TEXT_TYPE_ACTIVATING ||
		ugd->head_text_mode == HEAD_TEXT_TYPE_DEACTIVATING) {
		return NULL;
	}

	if (!strcmp(part, "elm.icon")) {
		onoff = elm_check_add(obj);
		elm_object_style_set(onoff, "on&off");
		elm_check_state_set(onoff, ugd->wfd_onoff);
		evas_object_show(onoff);
	}

	__WDUG_LOG_FUNC_EXIT__;
	return onoff;
}

/**
 *	This function let the ug get the label of about item
 *	@return   the label of about item
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static char *_gl_name_label_get(void *data, Evas_Object *obj, const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;
	struct ug_data *ugd = (struct ug_data *) data;

	if (data == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)\n");
		return NULL;
	}

	WDUG_LOGI("%s", part);

	if (!strcmp(part, "elm.text")) {
		return strdup(IDS_WFD_TITLE_ABOUT_WIFI_DIRECT);
	} else if (!strcmp(part, "elm.text.2")) {
		return strdup(ugd->dev_name);
	}

	__WDUG_LOG_FUNC_EXIT__;
	return NULL;
}

/**
 *	This function let the ug get the label of titile
 *	@return   the label of titile
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static char *_gl_title_label_get(void *data, Evas_Object *obj, const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;
	struct ug_data *ugd = (struct ug_data *) data;

	if (data == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)\n");
		return NULL;
	}

	if (!strcmp(part, "elm.text")) {
		if (ugd->multiconn_view_genlist != NULL) {
			// It's called at Multi connect view...
			if (ugd->gl_available_dev_cnt_at_multiconn_view > 0) {
				return strdup(_("IDS_WFD_BODY_AVAILABLE_DEVICES"));
			} else {
				return strdup(_("IDS_WFD_BODY_WIFI_DIRECT_DEVICES"));
			}
		} else {
			// It's called at Main View
			if (ugd->gl_available_peer_cnt > 0) {
				return strdup(_("IDS_WFD_BODY_AVAILABLE_DEVICES"));
			} else {
				return strdup(_("IDS_WFD_BODY_WIFI_DIRECT_DEVICES"));
			}
		}
	}

	__WDUG_LOG_FUNC_EXIT__;
	return NULL;
}

/**
 *	This function let the ug get the content of titile
 *	@return   the content of titile
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static Evas_Object *_gl_title_content_get(void *data, Evas_Object *obj, const char *part)
{
	Evas_Object *progressbar = NULL;
	struct ug_data *ugd = (struct ug_data *) data;

	if (data == NULL) {
	    WDUG_LOGE("Incorrect parameter(NULL)\n");
	    return NULL;
	}

	if (!strcmp(part, "elm.icon")) {
		if (HEAD_TEXT_TYPE_SCANING == ugd->head_text_mode) {
			progressbar = elm_progressbar_add(obj);
			elm_object_style_set(progressbar, "list_process_small");
			elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
			elm_progressbar_pulse(progressbar, EINA_TRUE);
			evas_object_show(progressbar);
		} else {
			return NULL;
		}
	}

	return progressbar;
}

/**
 *	This function let the ug get the label of peer item
 *	@return   the label of peer item
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static char *_gl_peer_label_get(void *data, Evas_Object *obj, const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;
	assertm_if(NULL == obj, "NULL!!");
	assertm_if(NULL == part, "NULL!!");
	device_type_s *peer = (device_type_s *) data;
	char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
	WDUG_LOGI("%s", part);

	if (data == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)\n");
		return NULL;
	}

	if (!strcmp(part, "elm.text.1")) {
		__WDUG_LOG_FUNC_EXIT__;
		return strdup(peer->ssid);
	} else if (!strcmp(part, "elm.text.2")) {
		switch (peer->conn_status) {
		case PEER_CONN_STATUS_DISCONNECTED:
			g_strlcpy(buf, _("IDS_WFD_TAP_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
			break;
		case PEER_CONN_STATUS_CONNECTING:
			g_strlcpy(buf, _("IDS_WFD_CONNECTING"), WFD_GLOBALIZATION_STR_LENGTH);
			break;
		case PEER_CONN_STATUS_CONNECTED:
			if (peer->is_group_owner == FALSE) {
				g_strlcpy(buf, _("IDS_WFD_CONNECTED"), WFD_GLOBALIZATION_STR_LENGTH);
			} else {
				g_strlcpy(buf, _("IDS_WFD_TAP_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
			}
			break;
		case PEER_CONN_STATUS_FAILED_TO_CONNECT:
			g_strlcpy(buf, _("IDS_WFD_FAILED_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
			break;
		case PEER_CONN_STATUS_WAIT_FOR_CONNECT:
			g_strlcpy(buf, _("IDS_WFD_WAITING_FOR_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
			break;
		default:
			g_strlcpy(buf, _("IDS_WFD_TAP_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
			break;
		}
	} else {
		__WDUG_LOG_FUNC_EXIT__;
		return NULL;
	}

	__WDUG_LOG_FUNC_EXIT__;
	return strdup(buf);
}

/**
 *	This function let the ug get the icon of peer item
 *	@return   the icon of peer item
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static Evas_Object *_gl_peer_icon_get(void *data, Evas_Object *obj, const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;
	assertm_if(NULL == obj, "NULL!!");
	assertm_if(NULL == part, "NULL!!");
	device_type_s *peer = (device_type_s *) data;
	Evas_Object *icon = NULL;
	struct ug_data *ugd = wfd_get_ug_data();

	if (data == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)\n");
		return NULL;
	}

	if (!strcmp(part, "elm.icon.2")) {
		WDUG_LOGI("elm.icon.2 - connection status [%d]\n", peer->conn_status);
		if (peer->conn_status == PEER_CONN_STATUS_CONNECTING) {
			icon = elm_progressbar_add(obj);
			elm_object_style_set(icon, "list_process");
			elm_progressbar_pulse(icon, EINA_TRUE);
		} else if (peer->conn_status == PEER_CONN_STATUS_CONNECTED) {
			return NULL;
		}

		evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
		elm_icon_resizable_set(icon, 1, 1);
		evas_object_show(icon);
	} else if (!strcmp(part, "elm.icon.1")) {
		WDUG_LOGI("elm.icon.1 - category [%d]\n", peer->category);
		char *img_path = NULL;
		int status = -1;

		status = wfd_get_device_status(ugd, peer);

		/*
		* the icon of connected device is
		* different from available and busy device
		*/
		switch (peer->category) {
		case WFD_DEVICE_TYPE_COMPUTER:
			if (1 == status) {
				img_path = WFD_ICON_DEVICE_COMPUTER_CONNECT;
			} else {
				img_path = WFD_ICON_DEVICE_COMPUTER;
			}
			break;
		case WFD_DEVICE_TYPE_INPUT_DEVICE:
			if (1 == status) {
				img_path = WFD_ICON_DEVICE_INPUT_DEVICE_CONNECT;
			} else {
				img_path = WFD_ICON_DEVICE_INPUT_DEVICE;
			}
			break;
		case WFD_DEVICE_TYPE_PRINTER:
			if (1 == status) {
				img_path = WFD_ICON_DEVICE_PRINTER_CONNECT;
			} else {
				img_path = WFD_ICON_DEVICE_PRINTER;
			}
			break;
		case WFD_DEVICE_TYPE_CAMERA:
			if (1 == status) {
				img_path = WFD_ICON_DEVICE_CAMERA_CONNECT;
			} else {
				img_path = WFD_ICON_DEVICE_CAMERA;
			}
			break;
		case WFD_DEVICE_TYPE_STORAGE:
			if (1 == status) {
				img_path = WFD_ICON_DEVICE_STORAGE_CONNECT;
			} else {
				img_path = WFD_ICON_DEVICE_STORAGE;
			}
			break;
		case WFD_DEVICE_TYPE_NW_INFRA:
			if (1 == status) {
				img_path = WFD_ICON_DEVICE_NETWORK_INFRA_CONNECT;
			} else {
				img_path = WFD_ICON_DEVICE_NETWORK_INFRA;
			}
			break;
		case WFD_DEVICE_TYPE_DISPLAYS:
			if (1 == status) {
				img_path = WFD_ICON_DEVICE_DISPLAY_CONNECT;
			} else {
				img_path = WFD_ICON_DEVICE_DISPLAY;
			}
			break;
		case WFD_DEVICE_TYPE_MM_DEVICES:
			if (1 == status) {
				img_path = WFD_ICON_DEVICE_MULTIMEDIA_DEVICE_CONNECT;
			} else {
				img_path = WFD_ICON_DEVICE_MULTIMEDIA_DEVICE;
			}
			break;
		case WFD_DEVICE_TYPE_GAME_DEVICES:
			if (1 == status) {
				img_path = WFD_ICON_DEVICE_GAMING_DEVICE_CONNECT;
			} else {
				img_path = WFD_ICON_DEVICE_GAMING_DEVICE;
			}
			break;
		case WFD_DEVICE_TYPE_TELEPHONE:
			if (1 == status) {
				img_path = WFD_ICON_DEVICE_TELEPHONE_CONNECT;
			} else {
				img_path = WFD_ICON_DEVICE_TELEPHONE;
			}
			break;
		case WFD_DEVICE_TYPE_AUDIO:
			if (1 == status) {
				img_path = WFD_ICON_DEVICE_AUDIO_DEVICE_CONNECT;
			} else {
				img_path = WFD_ICON_DEVICE_AUDIO_DEVICE;
			}
			break;
		default:
			if (1 == status) {
				img_path = WFD_ICON_DEVICE_COMPUTER_CONNECT;
			} else {
				img_path = WFD_ICON_DEVICE_COMPUTER;
			}
			break;
		}

		if (img_path != NULL) {
			icon = elm_icon_add(obj);
			elm_icon_file_set(icon, img_path, NULL);
			evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
			elm_icon_resizable_set(icon, 1, 1);
			evas_object_show(icon);
		} else {
			return NULL;
		}
	}

	__WDUG_LOG_FUNC_EXIT__;
	return icon;
}

/**
 *	This function let the ug get the text of no device item
 *	@return   the text of no device item
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static char *_gl_noitem_text_get(void *data, Evas_Object *obj, const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;

	if (data == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)\n");
		return NULL;
	}

	__WDUG_LOG_FUNC_EXIT__;
	return strdup(_("IDS_WFD_NOCONTENT"));
}

/**
 *	This function let the ug get the multi connect button
 *	@return   the multi connect button
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static Evas_Object *_gl_button_get(void *data, Evas_Object *obj, const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;
	struct ug_data *ugd = (struct ug_data *) data;

	WDUG_LOGI("%s", part);
	ugd->multi_btn = elm_button_add(obj);
	wfd_refresh_wifi_direct_state(ugd);

	if (ugd->wfd_status == WIFI_DIRECT_STATE_CONNECTING) {
		elm_object_text_set(ugd->multi_btn, _("IDS_WFD_BUTTON_CANCEL"));
		WDUG_LOGI("button: Cancel connect\n");
	} else {
		if (ugd->gl_connected_peer_cnt > 1) {
			elm_object_text_set(ugd->multi_btn, _("IDS_WFD_BUTTON_DISCONNECT_ALL"));
			WDUG_LOGI("button: Disconnect All\n");
		} else if (ugd->gl_connected_peer_cnt == 1) {
			elm_object_text_set(ugd->multi_btn, _("IDS_WFD_BUTTON_DISCONNECT"));
			WDUG_LOGI("button: Disconnect\n");
		} else {
			elm_object_text_set(ugd->multi_btn, _("IDS_WFD_BUTTON_MULTI"));
			WDUG_LOGI("button: Multi connect\n");
		}
	}

	evas_object_smart_callback_add(ugd->multi_btn, "clicked", _wifid_create_multibutton_cb, ugd);
	evas_object_show(ugd->multi_btn);

	__WDUG_LOG_FUNC_EXIT__;
	return ugd->multi_btn;
}

/**
 *	This function let the ug get the title label of connected device list
 *	@return   the title label of connected device list
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static char *_gl_conn_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;

	if (data == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)\n");
		return NULL;
	}

	if (!strcmp(part, "elm.text")) {
		return strdup(_("IDS_WFD_BODY_CONNECTED_DEVICES"));
	}

	__WDUG_LOG_FUNC_EXIT__;
	return NULL;
}

/**
 *	This function let the ug get the label of connected device
 *	@return   the label of connected device
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static char *_gl_peer_conn_dev_label_get(void *data, Evas_Object *obj, const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;
	assertm_if(NULL == obj, "NULL!!");
	assertm_if(NULL == part, "NULL!!");
	device_type_s *peer = (device_type_s *) data;
	char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
	WDUG_LOGI("%s", part);

	if (data == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)\n");
		return NULL;
	}

	if (!strcmp(part, "elm.text.1")) {
		return strdup(peer->ssid);
	} else {
		g_strlcpy(buf, _("IDS_WFD_CONNECTED"), WFD_GLOBALIZATION_STR_LENGTH);
		__WDUG_LOG_FUNC_EXIT__;
		return strdup(buf);
	}
}

/**
 *	This function let the ug get the title label of connected failed device list
 *	@return   the label of connected device
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static char *_gl_conn_failed_dev_title_label_get(void *data, Evas_Object *obj,
		const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;

	if (data == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)\n");
		return NULL;
	}

	if (!strcmp(part, "elm.text")) {
		return strdup(IDS_WFD_BODY_FAILED_DEVICES);
	}

	__WDUG_LOG_FUNC_EXIT__;
	return NULL;
}

/**
 *	This function let the ug get the label of connected failed device
 *	@return   the label of connected device
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static char *_gl_peer_conn_failed_dev_label_get(void *data, Evas_Object *obj, const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;
	assertm_if(NULL == obj, "NULL!!");
	assertm_if(NULL == part, "NULL!!");
	device_type_s *peer = (device_type_s *) data;
	char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
	WDUG_LOGI("%s", part);

	if (data == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)\n");
		return NULL;
	}

	if (!strcmp(part, "elm.text.1")) {
		return strdup(peer->ssid);
	} else {
		g_strlcpy(buf, _("IDS_WFD_FAILED_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
		__WDUG_LOG_FUNC_EXIT__;
		return strdup(buf);
	}
}

/**
 *	This function let the ug get the title label of multi connect list
 *	@return   the label of connected device
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static char *_gl_multi_connect_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;
	struct ug_data *ugd = wfd_get_ug_data();

	if (data == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)\n");
		return NULL;
	}

	if (!strcmp(part, "elm.text")) {
		if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_IN_PROGRESS) {
			return strdup(_("IDS_WFD_BODY_AVAILABLE_DEVICES"));
		} else if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_COMPLETED) {
			return strdup(IDS_WFD_BODY_FAILED_DEVICES);
		}
	}

	__WDUG_LOG_FUNC_EXIT__;
	return NULL;
}

/**
 *	This function let the ug get the title label of busy device list
 *	@return   the label of connected device
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static char *_gl_busy_dev_title_label_get(void *data, Evas_Object *obj,
		const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;

	if (data == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)\n");
		return NULL;
	}

	if (!strcmp(part, "elm.text")) {
		return strdup(_("IDS_WFD_BODY_BUSY_DEVICES"));
	}

	__WDUG_LOG_FUNC_EXIT__;
	return NULL;
}

/**
 *	This function let the ug get the label of busy device
 *	@return   the label of connected device
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 *	@param[in] part the pointer to the part of item
 */
static char *_gl_peer_busy_dev_label_get(void *data, Evas_Object *obj, const char *part)
{
	__WDUG_LOG_FUNC_ENTER__;
	assertm_if(NULL == obj, "NULL!!");
	assertm_if(NULL == part, "NULL!!");
	device_type_s *peer = (device_type_s *) data;
	char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
	WDUG_LOGI("%s", part);

	if (data == NULL) {
		WDUG_LOGE("Incorrect parameter(NULL)\n");
		return NULL;
	}

	WDUG_LOGI("peer->ssid = %s", peer->ssid);

	if (!strcmp(part, "elm.text.1")) {
		return strdup(peer->ssid);
	} else {
		g_strlcpy(buf, _("IDS_WFD_CONNECTED_WITH_OTHER_DEVICE"), WFD_GLOBALIZATION_STR_LENGTH);
		__WDUG_LOG_FUNC_EXIT__;
		return strdup(buf);
	}
}

/**
 *	This function let the ug delete the peer item
 *	@return   void
 *	@param[in] data the pointer to the main data structure
 *	@param[in] obj the pointer to the evas object
 */
static void _gl_peer_del(void *data, Evas_Object *obj)
{
	__WDUG_LOG_FUNC_ENTER__;
	assertm_if(NULL == obj, "NULL!!");
	assertm_if(NULL == data, "NULL!!");

	__WDUG_LOG_FUNC_EXIT__;
	return;
}

/**
 *	This function let the ug initialize the items of genlist
 *	@return   void
 */
void initialize_gen_item_class()
{
	__WDUG_LOG_FUNC_ENTER__;
	head_itc.item_style = "dialogue/2text.1icon.10";
	head_itc.func.text_get = _gl_header_label_get;
	head_itc.func.content_get = _gl_header_icon_get;
	head_itc.func.state_get = NULL;

	name_itc.item_style = "dialogue/1text";
	name_itc.func.text_get = _gl_name_label_get;
	name_itc.func.content_get = NULL;
	name_itc.func.state_get = NULL;
	name_itc.func.del = NULL;

	title_itc.item_style = "dialogue/title";
	title_itc.func.text_get = _gl_title_label_get;
	title_itc.func.content_get = _gl_title_content_get;
	title_itc.func.state_get = NULL;
	title_itc.func.del = NULL;

	peer_itc.item_style = "dialogue/2text.2icon.3";
	peer_itc.func.text_get = _gl_peer_label_get;
	peer_itc.func.content_get = _gl_peer_icon_get;
	peer_itc.func.state_get = NULL;
	peer_itc.func.del = _gl_peer_del;

	noitem_itc.item_style = "dialogue/1text";
	noitem_itc.func.text_get = _gl_noitem_text_get;
	noitem_itc.func.content_get = NULL;
	noitem_itc.func.state_get = NULL;
	noitem_itc.func.del = NULL;

	button_itc.item_style = "1icon";
	button_itc.func.text_get = NULL;
	button_itc.func.content_get = _gl_button_get;
	button_itc.func.state_get = NULL;
	button_itc.func.del = NULL;

	title_conn_itc.item_style = "dialogue/title";
	title_conn_itc.func.text_get = _gl_conn_dev_title_label_get;
	title_conn_itc.func.content_get = NULL;
	title_conn_itc.func.state_get = NULL;
	title_conn_itc.func.del = NULL;

	peer_conn_itc.item_style = "dialogue/2text.2icon.3";
	peer_conn_itc.func.text_get = _gl_peer_conn_dev_label_get;
	peer_conn_itc.func.content_get = _gl_peer_icon_get;
	peer_conn_itc.func.state_get = NULL;
	peer_conn_itc.func.del = _gl_peer_del;

	title_conn_failed_itc.item_style = "dialogue/title";
	title_conn_failed_itc.func.text_get = _gl_conn_failed_dev_title_label_get;
	title_conn_failed_itc.func.content_get = NULL;
	title_conn_failed_itc.func.state_get = NULL;
	title_conn_failed_itc.func.del = NULL;

	peer_conn_failed_itc.item_style = "dialogue/2text.2icon.3";
	peer_conn_failed_itc.func.text_get = _gl_peer_conn_failed_dev_label_get;
	peer_conn_failed_itc.func.content_get = _gl_peer_icon_get;
	peer_conn_failed_itc.func.state_get = NULL;
	peer_conn_failed_itc.func.del = _gl_peer_del;

	title_busy_itc.item_style = "dialogue/title";
	title_busy_itc.func.text_get = _gl_busy_dev_title_label_get;
	title_busy_itc.func.content_get = NULL;
	title_busy_itc.func.state_get = NULL;
	title_busy_itc.func.del = NULL;

	peer_busy_itc.item_style = "dialogue/2text.2icon.3";
	peer_busy_itc.func.text_get = _gl_peer_busy_dev_label_get;
	peer_busy_itc.func.content_get = _gl_peer_icon_get;
	peer_busy_itc.func.state_get = NULL;
	peer_busy_itc.func.del = _gl_peer_del;

	title_multi_connect_itc.item_style = "dialogue/title";
	title_multi_connect_itc.func.text_get = _gl_multi_connect_dev_title_label_get;
	title_multi_connect_itc.func.content_get = NULL;
	title_multi_connect_itc.func.state_get = NULL;
	title_multi_connect_itc.func.del = NULL;

	__WDUG_LOG_FUNC_EXIT__;

}