bb2345cc627820c73623cf4d8eb30889a86a42ab
[apps/native/ug-wifi-direct.git] / ug-wifidirect / src / wfd_ug_genlist.c
1 /*
2 *  WiFi-Direct UG
3 *
4 * Copyright 2012  Samsung Electronics Co., Ltd
5
6 * Licensed under the Flora License, Version 1.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9
10 * http://www.tizenopensource.org/license
11
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20 #include <libintl.h>
21
22 #include <assert.h>
23 #include <glib.h>
24
25 #include <Elementary.h>
26 #include <vconf.h>
27 #include <ui-gadget-module.h>
28 #include <wifi-direct.h>
29
30 #include "wfd_ug.h"
31 #include "wfd_ug_view.h"
32 #include "wfd_client.h"
33
34 Elm_Gen_Item_Class head_itc;
35 Elm_Gen_Item_Class name_itc;
36 Elm_Gen_Item_Class title_itc;
37 Elm_Gen_Item_Class peer_itc;
38 Elm_Gen_Item_Class noitem_itc;
39 Elm_Gen_Item_Class button_itc;
40
41 Elm_Gen_Item_Class title_conn_itc;
42 Elm_Gen_Item_Class peer_conn_itc;
43
44 Elm_Gen_Item_Class title_busy_itc;
45 Elm_Gen_Item_Class peer_busy_itc;
46
47 Elm_Gen_Item_Class title_multi_connect_itc;
48 Elm_Gen_Item_Class peer_multi_connect_itc;
49
50 Elm_Gen_Item_Class title_conn_failed_itc;
51 Elm_Gen_Item_Class peer_conn_failed_itc;
52
53 /**
54  *      This function let the ug get the label of header
55  *      @return   the label of header
56  *      @param[in] data the pointer to the main data structure
57  *      @param[in] obj the pointer to the evas object
58  *      @param[in] part the pointer to the part of item
59  */
60 static char *_gl_header_label_get(void *data, Evas_Object *obj, const char *part)
61 {
62         __WDUG_LOG_FUNC_ENTER__;
63         struct ug_data *ugd = (struct ug_data *) data;
64         WDUG_LOGI("%s", part);
65
66         if (data == NULL) {
67                 WDUG_LOGE("Incorrect parameter(NULL)\n");
68                 return NULL;
69         }
70
71         if (!strcmp(part, "elm.text.1")) {
72                 WDUG_LOGI("Current text mode [%d]\n", ugd->head_text_mode);
73                 switch (ugd->head_text_mode) {
74                 case HEAD_TEXT_TYPE_DIRECT:
75                 case HEAD_TEXT_TYPE_ACTIVATED:
76                 case HEAD_TEXT_TYPE_SCANING:
77                         return strdup(dgettext("sys_string", "IDS_COM_OPT1_WI_FI_DIRECT"));
78                         break;
79                 case HEAD_TEXT_TYPE_DEACTIVATING:
80                         return strdup(_("IDS_WFD_BODY_DEACTIVATING"));
81                         break;
82                 case HEAD_TEXT_TYPE_ACTIVATING:
83                         return strdup(_("IDS_WFD_BODY_ACTIVATING"));
84                         break;
85                 default:
86                         break;
87                 }
88         } else if (!strcmp(part, "elm.text.1")) {
89                 return strdup(dgettext("sys_string", "IDS_COM_OPT1_WI_FI_DIRECT"));
90         } else if (!strcmp(part, "elm.text.2")) {
91                 return strdup(ugd->dev_name);
92         }
93
94         __WDUG_LOG_FUNC_EXIT__;
95         return NULL;
96 }
97
98 /**
99  *      This function let the ug get the icon of header
100  *      @return   the icon of header
101  *      @param[in] data the pointer to the main data structure
102  *      @param[in] obj the pointer to the evas object
103  *      @param[in] part the pointer to the part of item
104  */
105 static Evas_Object *_gl_header_icon_get(void *data, Evas_Object *obj, const char *part)
106 {
107         __WDUG_LOG_FUNC_ENTER__;
108         struct ug_data *ugd = (struct ug_data *) data;
109         Evas_Object *onoff = NULL;
110
111         if (data == NULL) {
112                 WDUG_LOGE("Incorrect parameter(NULL)\n");
113                 return NULL;
114         }
115
116         if (ugd->head_text_mode == HEAD_TEXT_TYPE_ACTIVATING ||
117                 ugd->head_text_mode == HEAD_TEXT_TYPE_DEACTIVATING) {
118                 return NULL;
119         }
120
121         if (!strcmp(part, "elm.icon")) {
122                 onoff = elm_check_add(obj);
123                 elm_object_style_set(onoff, "on&off");
124                 elm_check_state_set(onoff, ugd->wfd_onoff);
125                 evas_object_show(onoff);
126         }
127
128         __WDUG_LOG_FUNC_EXIT__;
129         return onoff;
130 }
131
132 /**
133  *      This function let the ug get the label of about item
134  *      @return   the label of about item
135  *      @param[in] data the pointer to the main data structure
136  *      @param[in] obj the pointer to the evas object
137  *      @param[in] part the pointer to the part of item
138  */
139 static char *_gl_name_label_get(void *data, Evas_Object *obj, const char *part)
140 {
141         __WDUG_LOG_FUNC_ENTER__;
142         struct ug_data *ugd = (struct ug_data *) data;
143
144         if (data == NULL) {
145                 WDUG_LOGE("Incorrect parameter(NULL)\n");
146                 return NULL;
147         }
148
149         WDUG_LOGI("%s", part);
150
151         if (!strcmp(part, "elm.text")) {
152                 return strdup(IDS_WFD_TITLE_ABOUT_WIFI_DIRECT);
153         } else if (!strcmp(part, "elm.text.2")) {
154                 return strdup(ugd->dev_name);
155         }
156
157         __WDUG_LOG_FUNC_EXIT__;
158         return NULL;
159 }
160
161 /**
162  *      This function let the ug get the label of titile
163  *      @return   the label of titile
164  *      @param[in] data the pointer to the main data structure
165  *      @param[in] obj the pointer to the evas object
166  *      @param[in] part the pointer to the part of item
167  */
168 static char *_gl_title_label_get(void *data, Evas_Object *obj, const char *part)
169 {
170         __WDUG_LOG_FUNC_ENTER__;
171         struct ug_data *ugd = (struct ug_data *) data;
172
173         if (data == NULL) {
174                 WDUG_LOGE("Incorrect parameter(NULL)\n");
175                 return NULL;
176         }
177
178         if (!strcmp(part, "elm.text")) {
179                 if (ugd->multiconn_view_genlist != NULL) {
180                         // It's called at Multi connect view...
181                         if (ugd->gl_available_dev_cnt_at_multiconn_view > 0) {
182                                 return strdup(_("IDS_WFD_BODY_AVAILABLE_DEVICES"));
183                         } else {
184                                 return strdup(_("IDS_WFD_BODY_WIFI_DIRECT_DEVICES"));
185                         }
186                 } else {
187                         // It's called at Main View
188                         if (ugd->gl_available_peer_cnt > 0) {
189                                 return strdup(_("IDS_WFD_BODY_AVAILABLE_DEVICES"));
190                         } else {
191                                 return strdup(_("IDS_WFD_BODY_WIFI_DIRECT_DEVICES"));
192                         }
193                 }
194         }
195
196         __WDUG_LOG_FUNC_EXIT__;
197         return NULL;
198 }
199
200 /**
201  *      This function let the ug get the content of titile
202  *      @return   the content of titile
203  *      @param[in] data the pointer to the main data structure
204  *      @param[in] obj the pointer to the evas object
205  *      @param[in] part the pointer to the part of item
206  */
207 static Evas_Object *_gl_title_content_get(void *data, Evas_Object *obj, const char *part)
208 {
209         Evas_Object *progressbar = NULL;
210         struct ug_data *ugd = (struct ug_data *) data;
211
212         if (data == NULL) {
213             WDUG_LOGE("Incorrect parameter(NULL)\n");
214             return NULL;
215         }
216
217         if (!strcmp(part, "elm.icon")) {
218                 if (HEAD_TEXT_TYPE_SCANING == ugd->head_text_mode) {
219                         progressbar = elm_progressbar_add(obj);
220                         elm_object_style_set(progressbar, "list_process_small");
221                         elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
222                         elm_progressbar_pulse(progressbar, EINA_TRUE);
223                         evas_object_show(progressbar);
224                 } else {
225                         return NULL;
226                 }
227         }
228
229         return progressbar;
230 }
231
232 /**
233  *      This function let the ug get the label of peer item
234  *      @return   the label of peer item
235  *      @param[in] data the pointer to the main data structure
236  *      @param[in] obj the pointer to the evas object
237  *      @param[in] part the pointer to the part of item
238  */
239 static char *_gl_peer_label_get(void *data, Evas_Object *obj, const char *part)
240 {
241         __WDUG_LOG_FUNC_ENTER__;
242         assertm_if(NULL == obj, "NULL!!");
243         assertm_if(NULL == part, "NULL!!");
244         device_type_s *peer = (device_type_s *) data;
245         char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
246         WDUG_LOGI("%s", part);
247
248         if (data == NULL) {
249                 WDUG_LOGE("Incorrect parameter(NULL)\n");
250                 return NULL;
251         }
252
253         if (!strcmp(part, "elm.text.1")) {
254                 __WDUG_LOG_FUNC_EXIT__;
255                 return strdup(peer->ssid);
256         } else if (!strcmp(part, "elm.text.2")) {
257                 switch (peer->conn_status) {
258                 case PEER_CONN_STATUS_DISCONNECTED:
259                         g_strlcpy(buf, _("IDS_WFD_TAP_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
260                         break;
261                 case PEER_CONN_STATUS_CONNECTING:
262                         g_strlcpy(buf, _("IDS_WFD_CONNECTING"), WFD_GLOBALIZATION_STR_LENGTH);
263                         break;
264                 case PEER_CONN_STATUS_CONNECTED:
265                         if (peer->is_group_owner == FALSE) {
266                                 g_strlcpy(buf, _("IDS_WFD_CONNECTED"), WFD_GLOBALIZATION_STR_LENGTH);
267                         } else {
268                                 g_strlcpy(buf, _("IDS_WFD_TAP_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
269                         }
270                         break;
271                 case PEER_CONN_STATUS_FAILED_TO_CONNECT:
272                         g_strlcpy(buf, _("IDS_WFD_FAILED_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
273                         break;
274                 case PEER_CONN_STATUS_WAIT_FOR_CONNECT:
275                         g_strlcpy(buf, _("IDS_WFD_WAITING_FOR_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
276                         break;
277                 default:
278                         g_strlcpy(buf, _("IDS_WFD_TAP_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
279                         break;
280                 }
281         } else {
282                 __WDUG_LOG_FUNC_EXIT__;
283                 return NULL;
284         }
285
286         __WDUG_LOG_FUNC_EXIT__;
287         return strdup(buf);
288 }
289
290 /**
291  *      This function let the ug get the icon of peer item
292  *      @return   the icon of peer item
293  *      @param[in] data the pointer to the main data structure
294  *      @param[in] obj the pointer to the evas object
295  *      @param[in] part the pointer to the part of item
296  */
297 static Evas_Object *_gl_peer_icon_get(void *data, Evas_Object *obj, const char *part)
298 {
299         __WDUG_LOG_FUNC_ENTER__;
300         assertm_if(NULL == obj, "NULL!!");
301         assertm_if(NULL == part, "NULL!!");
302         device_type_s *peer = (device_type_s *) data;
303         Evas_Object *icon = NULL;
304         struct ug_data *ugd = wfd_get_ug_data();
305
306         if (data == NULL) {
307                 WDUG_LOGE("Incorrect parameter(NULL)\n");
308                 return NULL;
309         }
310
311         if (!strcmp(part, "elm.icon.2")) {
312                 WDUG_LOGI("elm.icon.2 - connection status [%d]\n", peer->conn_status);
313                 if (peer->conn_status == PEER_CONN_STATUS_CONNECTING) {
314                         icon = elm_progressbar_add(obj);
315                         elm_object_style_set(icon, "list_process");
316                         elm_progressbar_pulse(icon, EINA_TRUE);
317                 } else if (peer->conn_status == PEER_CONN_STATUS_CONNECTED) {
318                         return NULL;
319                 }
320
321                 evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
322                 elm_icon_resizable_set(icon, 1, 1);
323                 evas_object_show(icon);
324         } else if (!strcmp(part, "elm.icon.1")) {
325                 WDUG_LOGI("elm.icon.1 - category [%d]\n", peer->category);
326                 char *img_path = NULL;
327                 int status = -1;
328
329                 status = wfd_get_device_status(ugd, peer);
330
331                 /*
332                 * the icon of connected device is
333                 * different from available and busy device
334                 */
335                 switch (peer->category) {
336                 case WFD_DEVICE_TYPE_COMPUTER:
337                         if (1 == status) {
338                                 img_path = WFD_ICON_DEVICE_COMPUTER_CONNECT;
339                         } else {
340                                 img_path = WFD_ICON_DEVICE_COMPUTER;
341                         }
342                         break;
343                 case WFD_DEVICE_TYPE_INPUT_DEVICE:
344                         if (1 == status) {
345                                 img_path = WFD_ICON_DEVICE_INPUT_DEVICE_CONNECT;
346                         } else {
347                                 img_path = WFD_ICON_DEVICE_INPUT_DEVICE;
348                         }
349                         break;
350                 case WFD_DEVICE_TYPE_PRINTER:
351                         if (1 == status) {
352                                 img_path = WFD_ICON_DEVICE_PRINTER_CONNECT;
353                         } else {
354                                 img_path = WFD_ICON_DEVICE_PRINTER;
355                         }
356                         break;
357                 case WFD_DEVICE_TYPE_CAMERA:
358                         if (1 == status) {
359                                 img_path = WFD_ICON_DEVICE_CAMERA_CONNECT;
360                         } else {
361                                 img_path = WFD_ICON_DEVICE_CAMERA;
362                         }
363                         break;
364                 case WFD_DEVICE_TYPE_STORAGE:
365                         if (1 == status) {
366                                 img_path = WFD_ICON_DEVICE_STORAGE_CONNECT;
367                         } else {
368                                 img_path = WFD_ICON_DEVICE_STORAGE;
369                         }
370                         break;
371                 case WFD_DEVICE_TYPE_NW_INFRA:
372                         if (1 == status) {
373                                 img_path = WFD_ICON_DEVICE_NETWORK_INFRA_CONNECT;
374                         } else {
375                                 img_path = WFD_ICON_DEVICE_NETWORK_INFRA;
376                         }
377                         break;
378                 case WFD_DEVICE_TYPE_DISPLAYS:
379                         if (1 == status) {
380                                 img_path = WFD_ICON_DEVICE_DISPLAY_CONNECT;
381                         } else {
382                                 img_path = WFD_ICON_DEVICE_DISPLAY;
383                         }
384                         break;
385                 case WFD_DEVICE_TYPE_MM_DEVICES:
386                         if (1 == status) {
387                                 img_path = WFD_ICON_DEVICE_MULTIMEDIA_DEVICE_CONNECT;
388                         } else {
389                                 img_path = WFD_ICON_DEVICE_MULTIMEDIA_DEVICE;
390                         }
391                         break;
392                 case WFD_DEVICE_TYPE_GAME_DEVICES:
393                         if (1 == status) {
394                                 img_path = WFD_ICON_DEVICE_GAMING_DEVICE_CONNECT;
395                         } else {
396                                 img_path = WFD_ICON_DEVICE_GAMING_DEVICE;
397                         }
398                         break;
399                 case WFD_DEVICE_TYPE_TELEPHONE:
400                         if (1 == status) {
401                                 img_path = WFD_ICON_DEVICE_TELEPHONE_CONNECT;
402                         } else {
403                                 img_path = WFD_ICON_DEVICE_TELEPHONE;
404                         }
405                         break;
406                 case WFD_DEVICE_TYPE_AUDIO:
407                         if (1 == status) {
408                                 img_path = WFD_ICON_DEVICE_AUDIO_DEVICE_CONNECT;
409                         } else {
410                                 img_path = WFD_ICON_DEVICE_AUDIO_DEVICE;
411                         }
412                         break;
413                 default:
414                         if (1 == status) {
415                                 img_path = WFD_ICON_DEVICE_COMPUTER_CONNECT;
416                         } else {
417                                 img_path = WFD_ICON_DEVICE_COMPUTER;
418                         }
419                         break;
420                 }
421
422                 if (img_path != NULL) {
423                         icon = elm_icon_add(obj);
424                         elm_icon_file_set(icon, img_path, NULL);
425                         evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
426                         elm_icon_resizable_set(icon, 1, 1);
427                         evas_object_show(icon);
428                 } else {
429                         return NULL;
430                 }
431         }
432
433         __WDUG_LOG_FUNC_EXIT__;
434         return icon;
435 }
436
437 /**
438  *      This function let the ug get the text of no device item
439  *      @return   the text of no device item
440  *      @param[in] data the pointer to the main data structure
441  *      @param[in] obj the pointer to the evas object
442  *      @param[in] part the pointer to the part of item
443  */
444 static char *_gl_noitem_text_get(void *data, Evas_Object *obj, const char *part)
445 {
446         __WDUG_LOG_FUNC_ENTER__;
447
448         if (data == NULL) {
449                 WDUG_LOGE("Incorrect parameter(NULL)\n");
450                 return NULL;
451         }
452
453         __WDUG_LOG_FUNC_EXIT__;
454         return strdup(_("IDS_WFD_NOCONTENT"));
455 }
456
457 /**
458  *      This function let the ug get the multi connect button
459  *      @return   the multi connect button
460  *      @param[in] data the pointer to the main data structure
461  *      @param[in] obj the pointer to the evas object
462  *      @param[in] part the pointer to the part of item
463  */
464 static Evas_Object *_gl_button_get(void *data, Evas_Object *obj, const char *part)
465 {
466         __WDUG_LOG_FUNC_ENTER__;
467         struct ug_data *ugd = (struct ug_data *) data;
468
469         WDUG_LOGI("%s", part);
470         ugd->multi_btn = elm_button_add(obj);
471         wfd_refresh_wifi_direct_state(ugd);
472
473         if (ugd->wfd_status == WIFI_DIRECT_STATE_CONNECTING) {
474                 elm_object_text_set(ugd->multi_btn, _("IDS_WFD_BUTTON_CANCEL"));
475                 WDUG_LOGI("button: Cancel connect\n");
476         } else {
477                 if (ugd->gl_connected_peer_cnt > 1) {
478                         elm_object_text_set(ugd->multi_btn, _("IDS_WFD_BUTTON_DISCONNECT_ALL"));
479                         WDUG_LOGI("button: Disconnect All\n");
480                 } else if (ugd->gl_connected_peer_cnt == 1) {
481                         elm_object_text_set(ugd->multi_btn, _("IDS_WFD_BUTTON_DISCONNECT"));
482                         WDUG_LOGI("button: Disconnect\n");
483                 } else {
484                         elm_object_text_set(ugd->multi_btn, _("IDS_WFD_BUTTON_MULTI"));
485                         WDUG_LOGI("button: Multi connect\n");
486                 }
487         }
488
489         evas_object_smart_callback_add(ugd->multi_btn, "clicked", _wifid_create_multibutton_cb, ugd);
490         evas_object_show(ugd->multi_btn);
491
492         __WDUG_LOG_FUNC_EXIT__;
493         return ugd->multi_btn;
494 }
495
496 /**
497  *      This function let the ug get the title label of connected device list
498  *      @return   the title label of connected device list
499  *      @param[in] data the pointer to the main data structure
500  *      @param[in] obj the pointer to the evas object
501  *      @param[in] part the pointer to the part of item
502  */
503 static char *_gl_conn_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
504 {
505         __WDUG_LOG_FUNC_ENTER__;
506
507         if (data == NULL) {
508                 WDUG_LOGE("Incorrect parameter(NULL)\n");
509                 return NULL;
510         }
511
512         if (!strcmp(part, "elm.text")) {
513                 return strdup(_("IDS_WFD_BODY_CONNECTED_DEVICES"));
514         }
515
516         __WDUG_LOG_FUNC_EXIT__;
517         return NULL;
518 }
519
520 /**
521  *      This function let the ug get the label of connected device
522  *      @return   the label of connected device
523  *      @param[in] data the pointer to the main data structure
524  *      @param[in] obj the pointer to the evas object
525  *      @param[in] part the pointer to the part of item
526  */
527 static char *_gl_peer_conn_dev_label_get(void *data, Evas_Object *obj, const char *part)
528 {
529         __WDUG_LOG_FUNC_ENTER__;
530         assertm_if(NULL == obj, "NULL!!");
531         assertm_if(NULL == part, "NULL!!");
532         device_type_s *peer = (device_type_s *) data;
533         char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
534         WDUG_LOGI("%s", part);
535
536         if (data == NULL) {
537                 WDUG_LOGE("Incorrect parameter(NULL)\n");
538                 return NULL;
539         }
540
541         if (!strcmp(part, "elm.text.1")) {
542                 return strdup(peer->ssid);
543         } else {
544                 g_strlcpy(buf, _("IDS_WFD_CONNECTED"), WFD_GLOBALIZATION_STR_LENGTH);
545                 __WDUG_LOG_FUNC_EXIT__;
546                 return strdup(buf);
547         }
548 }
549
550 /**
551  *      This function let the ug get the title label of connected failed device list
552  *      @return   the label of connected device
553  *      @param[in] data the pointer to the main data structure
554  *      @param[in] obj the pointer to the evas object
555  *      @param[in] part the pointer to the part of item
556  */
557 static char *_gl_conn_failed_dev_title_label_get(void *data, Evas_Object *obj,
558                 const char *part)
559 {
560         __WDUG_LOG_FUNC_ENTER__;
561
562         if (data == NULL) {
563                 WDUG_LOGE("Incorrect parameter(NULL)\n");
564                 return NULL;
565         }
566
567         if (!strcmp(part, "elm.text")) {
568                 return strdup(IDS_WFD_BODY_FAILED_DEVICES);
569         }
570
571         __WDUG_LOG_FUNC_EXIT__;
572         return NULL;
573 }
574
575 /**
576  *      This function let the ug get the label of connected failed device
577  *      @return   the label of connected device
578  *      @param[in] data the pointer to the main data structure
579  *      @param[in] obj the pointer to the evas object
580  *      @param[in] part the pointer to the part of item
581  */
582 static char *_gl_peer_conn_failed_dev_label_get(void *data, Evas_Object *obj, const char *part)
583 {
584         __WDUG_LOG_FUNC_ENTER__;
585         assertm_if(NULL == obj, "NULL!!");
586         assertm_if(NULL == part, "NULL!!");
587         device_type_s *peer = (device_type_s *) data;
588         char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
589         WDUG_LOGI("%s", part);
590
591         if (data == NULL) {
592                 WDUG_LOGE("Incorrect parameter(NULL)\n");
593                 return NULL;
594         }
595
596         if (!strcmp(part, "elm.text.1")) {
597                 return strdup(peer->ssid);
598         } else {
599                 g_strlcpy(buf, _("IDS_WFD_FAILED_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
600                 __WDUG_LOG_FUNC_EXIT__;
601                 return strdup(buf);
602         }
603 }
604
605 /**
606  *      This function let the ug get the title label of multi connect list
607  *      @return   the label of connected device
608  *      @param[in] data the pointer to the main data structure
609  *      @param[in] obj the pointer to the evas object
610  *      @param[in] part the pointer to the part of item
611  */
612 static char *_gl_multi_connect_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
613 {
614         __WDUG_LOG_FUNC_ENTER__;
615         struct ug_data *ugd = wfd_get_ug_data();
616
617         if (data == NULL) {
618                 WDUG_LOGE("Incorrect parameter(NULL)\n");
619                 return NULL;
620         }
621
622         if (!strcmp(part, "elm.text")) {
623                 if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_IN_PROGRESS) {
624                         return strdup(_("IDS_WFD_BODY_AVAILABLE_DEVICES"));
625                 } else if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_COMPLETED) {
626                         return strdup(IDS_WFD_BODY_FAILED_DEVICES);
627                 }
628         }
629
630         __WDUG_LOG_FUNC_EXIT__;
631         return NULL;
632 }
633
634 /**
635  *      This function let the ug get the title label of busy device list
636  *      @return   the label of connected device
637  *      @param[in] data the pointer to the main data structure
638  *      @param[in] obj the pointer to the evas object
639  *      @param[in] part the pointer to the part of item
640  */
641 static char *_gl_busy_dev_title_label_get(void *data, Evas_Object *obj,
642                 const char *part)
643 {
644         __WDUG_LOG_FUNC_ENTER__;
645
646         if (data == NULL) {
647                 WDUG_LOGE("Incorrect parameter(NULL)\n");
648                 return NULL;
649         }
650
651         if (!strcmp(part, "elm.text")) {
652                 return strdup(_("IDS_WFD_BODY_BUSY_DEVICES"));
653         }
654
655         __WDUG_LOG_FUNC_EXIT__;
656         return NULL;
657 }
658
659 /**
660  *      This function let the ug get the label of busy device
661  *      @return   the label of connected device
662  *      @param[in] data the pointer to the main data structure
663  *      @param[in] obj the pointer to the evas object
664  *      @param[in] part the pointer to the part of item
665  */
666 static char *_gl_peer_busy_dev_label_get(void *data, Evas_Object *obj, const char *part)
667 {
668         __WDUG_LOG_FUNC_ENTER__;
669         assertm_if(NULL == obj, "NULL!!");
670         assertm_if(NULL == part, "NULL!!");
671         device_type_s *peer = (device_type_s *) data;
672         char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
673         WDUG_LOGI("%s", part);
674
675         if (data == NULL) {
676                 WDUG_LOGE("Incorrect parameter(NULL)\n");
677                 return NULL;
678         }
679
680         WDUG_LOGI("peer->ssid = %s", peer->ssid);
681
682         if (!strcmp(part, "elm.text.1")) {
683                 return strdup(peer->ssid);
684         } else {
685                 g_strlcpy(buf, _("IDS_WFD_CONNECTED_WITH_OTHER_DEVICE"), WFD_GLOBALIZATION_STR_LENGTH);
686                 __WDUG_LOG_FUNC_EXIT__;
687                 return strdup(buf);
688         }
689 }
690
691 /**
692  *      This function let the ug delete the peer item
693  *      @return   void
694  *      @param[in] data the pointer to the main data structure
695  *      @param[in] obj the pointer to the evas object
696  */
697 static void _gl_peer_del(void *data, Evas_Object *obj)
698 {
699         __WDUG_LOG_FUNC_ENTER__;
700         assertm_if(NULL == obj, "NULL!!");
701         assertm_if(NULL == data, "NULL!!");
702
703         __WDUG_LOG_FUNC_EXIT__;
704         return;
705 }
706
707 /**
708  *      This function let the ug initialize the items of genlist
709  *      @return   void
710  */
711 void initialize_gen_item_class()
712 {
713         __WDUG_LOG_FUNC_ENTER__;
714         head_itc.item_style = "dialogue/2text.1icon.10";
715         head_itc.func.text_get = _gl_header_label_get;
716         head_itc.func.content_get = _gl_header_icon_get;
717         head_itc.func.state_get = NULL;
718
719         name_itc.item_style = "dialogue/1text";
720         name_itc.func.text_get = _gl_name_label_get;
721         name_itc.func.content_get = NULL;
722         name_itc.func.state_get = NULL;
723         name_itc.func.del = NULL;
724
725         title_itc.item_style = "dialogue/title";
726         title_itc.func.text_get = _gl_title_label_get;
727         title_itc.func.content_get = _gl_title_content_get;
728         title_itc.func.state_get = NULL;
729         title_itc.func.del = NULL;
730
731         peer_itc.item_style = "dialogue/2text.2icon.3";
732         peer_itc.func.text_get = _gl_peer_label_get;
733         peer_itc.func.content_get = _gl_peer_icon_get;
734         peer_itc.func.state_get = NULL;
735         peer_itc.func.del = _gl_peer_del;
736
737         noitem_itc.item_style = "dialogue/1text";
738         noitem_itc.func.text_get = _gl_noitem_text_get;
739         noitem_itc.func.content_get = NULL;
740         noitem_itc.func.state_get = NULL;
741         noitem_itc.func.del = NULL;
742
743         button_itc.item_style = "1icon";
744         button_itc.func.text_get = NULL;
745         button_itc.func.content_get = _gl_button_get;
746         button_itc.func.state_get = NULL;
747         button_itc.func.del = NULL;
748
749         title_conn_itc.item_style = "dialogue/title";
750         title_conn_itc.func.text_get = _gl_conn_dev_title_label_get;
751         title_conn_itc.func.content_get = NULL;
752         title_conn_itc.func.state_get = NULL;
753         title_conn_itc.func.del = NULL;
754
755         peer_conn_itc.item_style = "dialogue/2text.2icon.3";
756         peer_conn_itc.func.text_get = _gl_peer_conn_dev_label_get;
757         peer_conn_itc.func.content_get = _gl_peer_icon_get;
758         peer_conn_itc.func.state_get = NULL;
759         peer_conn_itc.func.del = _gl_peer_del;
760
761         title_conn_failed_itc.item_style = "dialogue/title";
762         title_conn_failed_itc.func.text_get = _gl_conn_failed_dev_title_label_get;
763         title_conn_failed_itc.func.content_get = NULL;
764         title_conn_failed_itc.func.state_get = NULL;
765         title_conn_failed_itc.func.del = NULL;
766
767         peer_conn_failed_itc.item_style = "dialogue/2text.2icon.3";
768         peer_conn_failed_itc.func.text_get = _gl_peer_conn_failed_dev_label_get;
769         peer_conn_failed_itc.func.content_get = _gl_peer_icon_get;
770         peer_conn_failed_itc.func.state_get = NULL;
771         peer_conn_failed_itc.func.del = _gl_peer_del;
772
773         title_busy_itc.item_style = "dialogue/title";
774         title_busy_itc.func.text_get = _gl_busy_dev_title_label_get;
775         title_busy_itc.func.content_get = NULL;
776         title_busy_itc.func.state_get = NULL;
777         title_busy_itc.func.del = NULL;
778
779         peer_busy_itc.item_style = "dialogue/2text.2icon.3";
780         peer_busy_itc.func.text_get = _gl_peer_busy_dev_label_get;
781         peer_busy_itc.func.content_get = _gl_peer_icon_get;
782         peer_busy_itc.func.state_get = NULL;
783         peer_busy_itc.func.del = _gl_peer_del;
784
785         title_multi_connect_itc.item_style = "dialogue/title";
786         title_multi_connect_itc.func.text_get = _gl_multi_connect_dev_title_label_get;
787         title_multi_connect_itc.func.content_get = NULL;
788         title_multi_connect_itc.func.state_get = NULL;
789         title_multi_connect_itc.func.del = NULL;
790
791         __WDUG_LOG_FUNC_EXIT__;
792
793 }