35d41035e4881bab5ef68dbb7274fd84a23e7bb7
[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 call it when click header
100  *  @return   void
101  *  @param[in] data the pointer to the main data structure
102  *  @param[in] obj the pointer to the evas object
103  *  @param[in] event_info the pointer to the event information
104  */
105 static void _gl_header_sel(void *data, Evas_Object *obj, void *event_info)
106 {
107         __WDUG_LOG_FUNC_ENTER__;
108         struct ug_data *ugd = (struct ug_data *) data;
109
110         Elm_Object_Item *item = (Elm_Object_Item *)event_info;
111         if (item != NULL)
112                 elm_genlist_item_selected_set(item, EINA_FALSE);
113
114         if (ugd == NULL)
115                 WDUG_LOGE("Incorrect parameter(NULL)\n");
116         else {
117                 if(!ugd->wfd_onoff) {
118                         WDUG_LOGD("Wi-Fi direct switch on\n");
119                         wfd_client_switch_on(ugd);
120                 } else {
121                         WDUG_LOGD("Wi-Fi direct switch off\n");
122                         wfd_client_switch_off(ugd);
123                 }
124         }
125         __WDUG_LOG_FUNC_EXIT__;
126 }
127
128 /**
129  *      This function let the ug get the icon of header
130  *      @return   the icon of header
131  *      @param[in] data the pointer to the main data structure
132  *      @param[in] obj the pointer to the evas object
133  *      @param[in] part the pointer to the part of item
134  */
135 static Evas_Object *_gl_header_icon_get(void *data, Evas_Object *obj, const char *part)
136 {
137         __WDUG_LOG_FUNC_ENTER__;
138         struct ug_data *ugd = (struct ug_data *) data;
139         Evas_Object *onoff = NULL;
140
141         if (data == NULL) {
142                 WDUG_LOGE("Incorrect parameter(NULL)\n");
143                 return NULL;
144         }
145
146         if (ugd->head_text_mode == HEAD_TEXT_TYPE_ACTIVATING ||
147                 ugd->head_text_mode == HEAD_TEXT_TYPE_DEACTIVATING) {
148                 return NULL;
149         }
150
151         if (!strcmp(part, "elm.icon")) {
152                 onoff = elm_check_add(obj);
153                 elm_object_style_set(onoff, "on&off");
154                 elm_check_state_set(onoff, ugd->wfd_onoff);
155                 evas_object_smart_callback_add(onoff, "changed", _gl_header_sel , ugd);
156                 evas_object_show(onoff);
157         }
158
159         __WDUG_LOG_FUNC_EXIT__;
160         return onoff;
161 }
162
163 /**
164  *      This function let the ug get the label of about item
165  *      @return   the label of about item
166  *      @param[in] data the pointer to the main data structure
167  *      @param[in] obj the pointer to the evas object
168  *      @param[in] part the pointer to the part of item
169  */
170 static char *_gl_name_label_get(void *data, Evas_Object *obj, const char *part)
171 {
172         __WDUG_LOG_FUNC_ENTER__;
173         struct ug_data *ugd = (struct ug_data *) data;
174
175         if (data == NULL) {
176                 WDUG_LOGE("Incorrect parameter(NULL)\n");
177                 return NULL;
178         }
179
180         WDUG_LOGI("%s", part);
181
182         if (!strcmp(part, "elm.text")) {
183                 return strdup(IDS_WFD_TITLE_ABOUT_WIFI_DIRECT);
184         } else if (!strcmp(part, "elm.text.2")) {
185                 return strdup(ugd->dev_name);
186         }
187
188         __WDUG_LOG_FUNC_EXIT__;
189         return NULL;
190 }
191
192 /**
193  *      This function let the ug get the label of titile
194  *      @return   the label of titile
195  *      @param[in] data the pointer to the main data structure
196  *      @param[in] obj the pointer to the evas object
197  *      @param[in] part the pointer to the part of item
198  */
199 static char *_gl_title_label_get(void *data, Evas_Object *obj, const char *part)
200 {
201         __WDUG_LOG_FUNC_ENTER__;
202         struct ug_data *ugd = (struct ug_data *) data;
203
204         if (data == NULL) {
205                 WDUG_LOGE("Incorrect parameter(NULL)\n");
206                 return NULL;
207         }
208
209         if (!strcmp(part, "elm.text")) {
210                 if (ugd->multiconn_view_genlist != NULL) {
211                         // It's called at Multi connect view...
212                         if (ugd->gl_available_dev_cnt_at_multiconn_view > 0) {
213                                 return strdup(_("IDS_WFD_BODY_AVAILABLE_DEVICES"));
214                         } else {
215                                 return strdup(_("IDS_WFD_BODY_WIFI_DIRECT_DEVICES"));
216                         }
217                 } else {
218                         // It's called at Main View
219                         if (ugd->gl_available_peer_cnt > 0) {
220                                 return strdup(_("IDS_WFD_BODY_AVAILABLE_DEVICES"));
221                         } else {
222                                 return strdup(_("IDS_WFD_BODY_WIFI_DIRECT_DEVICES"));
223                         }
224                 }
225         }
226
227         __WDUG_LOG_FUNC_EXIT__;
228         return NULL;
229 }
230
231 /**
232  *      This function let the ug get the content of titile
233  *      @return   the content of titile
234  *      @param[in] data the pointer to the main data structure
235  *      @param[in] obj the pointer to the evas object
236  *      @param[in] part the pointer to the part of item
237  */
238 static Evas_Object *_gl_title_content_get(void *data, Evas_Object *obj, const char *part)
239 {
240         Evas_Object *progressbar = NULL;
241         struct ug_data *ugd = (struct ug_data *) data;
242
243         if (data == NULL) {
244             WDUG_LOGE("Incorrect parameter(NULL)\n");
245             return NULL;
246         }
247
248         if (!strcmp(part, "elm.icon")) {
249                 if (HEAD_TEXT_TYPE_SCANING == ugd->head_text_mode) {
250                         progressbar = elm_progressbar_add(obj);
251                         elm_object_style_set(progressbar, "list_process_small");
252                         elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
253                         elm_progressbar_pulse(progressbar, EINA_TRUE);
254                         evas_object_show(progressbar);
255                 } else {
256                         return NULL;
257                 }
258         }
259
260         return progressbar;
261 }
262
263 /**
264  *      This function let the ug get the label of peer item
265  *      @return   the label of peer item
266  *      @param[in] data the pointer to the main data structure
267  *      @param[in] obj the pointer to the evas object
268  *      @param[in] part the pointer to the part of item
269  */
270 static char *_gl_peer_label_get(void *data, Evas_Object *obj, const char *part)
271 {
272         __WDUG_LOG_FUNC_ENTER__;
273         assertm_if(NULL == obj, "NULL!!");
274         assertm_if(NULL == part, "NULL!!");
275         device_type_s *peer = (device_type_s *) data;
276         char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
277         WDUG_LOGI("%s", part);
278
279         if (data == NULL) {
280                 WDUG_LOGE("Incorrect parameter(NULL)\n");
281                 return NULL;
282         }
283
284         if (!strcmp(part, "elm.text.1")) {
285                 __WDUG_LOG_FUNC_EXIT__;
286                 return strdup(peer->ssid);
287         } else if (!strcmp(part, "elm.text.2")) {
288                 switch (peer->conn_status) {
289                 case PEER_CONN_STATUS_DISCONNECTED:
290                         g_strlcpy(buf, _("IDS_WFD_TAP_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
291                         break;
292                 case PEER_CONN_STATUS_CONNECTING:
293                         g_strlcpy(buf, _("IDS_WFD_CONNECTING"), WFD_GLOBALIZATION_STR_LENGTH);
294                         break;
295                 case PEER_CONN_STATUS_CONNECTED:
296                         if (peer->is_group_owner == FALSE) {
297                                 g_strlcpy(buf, _("IDS_WFD_CONNECTED"), WFD_GLOBALIZATION_STR_LENGTH);
298                         } else {
299                                 g_strlcpy(buf, _("IDS_WFD_TAP_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
300                         }
301                         break;
302                 case PEER_CONN_STATUS_FAILED_TO_CONNECT:
303                         g_strlcpy(buf, _("IDS_WFD_FAILED_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
304                         break;
305                 case PEER_CONN_STATUS_WAIT_FOR_CONNECT:
306                         g_strlcpy(buf, _("IDS_WFD_WAITING_FOR_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
307                         break;
308                 default:
309                         g_strlcpy(buf, _("IDS_WFD_TAP_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
310                         break;
311                 }
312         } else {
313                 __WDUG_LOG_FUNC_EXIT__;
314                 return NULL;
315         }
316
317         __WDUG_LOG_FUNC_EXIT__;
318         return strdup(buf);
319 }
320
321 /**
322  *      This function let the ug get the icon of peer item
323  *      @return   the icon of peer item
324  *      @param[in] data the pointer to the main data structure
325  *      @param[in] obj the pointer to the evas object
326  *      @param[in] part the pointer to the part of item
327  */
328 static Evas_Object *_gl_peer_icon_get(void *data, Evas_Object *obj, const char *part)
329 {
330         __WDUG_LOG_FUNC_ENTER__;
331         assertm_if(NULL == obj, "NULL!!");
332         assertm_if(NULL == part, "NULL!!");
333         device_type_s *peer = (device_type_s *) data;
334         Evas_Object *icon = NULL;
335         struct ug_data *ugd = wfd_get_ug_data();
336
337         if (data == NULL) {
338                 WDUG_LOGE("Incorrect parameter(NULL)\n");
339                 return NULL;
340         }
341
342         if (!strcmp(part, "elm.icon.2")) {
343                 WDUG_LOGI("elm.icon.2 - connection status [%d]\n", peer->conn_status);
344                 if (peer->conn_status == PEER_CONN_STATUS_CONNECTING) {
345                         icon = elm_progressbar_add(obj);
346                         elm_object_style_set(icon, "list_process");
347                         elm_progressbar_pulse(icon, EINA_TRUE);
348                 } else if (peer->conn_status == PEER_CONN_STATUS_CONNECTED) {
349                         return NULL;
350                 }
351
352                 evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
353                 elm_icon_resizable_set(icon, 1, 1);
354                 evas_object_show(icon);
355         } else if (!strcmp(part, "elm.icon.1")) {
356                 WDUG_LOGI("elm.icon.1 - category [%d]\n", peer->category);
357                 char *img_path = NULL;
358                 int status = -1;
359
360                 status = wfd_get_device_status(ugd, peer);
361
362                 /*
363                 * the icon of connected device is
364                 * different from available and busy device
365                 */
366                 switch (peer->category) {
367                 case WFD_DEVICE_TYPE_COMPUTER:
368                         if (1 == status) {
369                                 img_path = WFD_ICON_DEVICE_COMPUTER_CONNECT;
370                         } else {
371                                 img_path = WFD_ICON_DEVICE_COMPUTER;
372                         }
373                         break;
374                 case WFD_DEVICE_TYPE_INPUT_DEVICE:
375                         if (1 == status) {
376                                 img_path = WFD_ICON_DEVICE_INPUT_DEVICE_CONNECT;
377                         } else {
378                                 img_path = WFD_ICON_DEVICE_INPUT_DEVICE;
379                         }
380                         break;
381                 case WFD_DEVICE_TYPE_PRINTER:
382                         if (1 == status) {
383                                 img_path = WFD_ICON_DEVICE_PRINTER_CONNECT;
384                         } else {
385                                 img_path = WFD_ICON_DEVICE_PRINTER;
386                         }
387                         break;
388                 case WFD_DEVICE_TYPE_CAMERA:
389                         if (1 == status) {
390                                 img_path = WFD_ICON_DEVICE_CAMERA_CONNECT;
391                         } else {
392                                 img_path = WFD_ICON_DEVICE_CAMERA;
393                         }
394                         break;
395                 case WFD_DEVICE_TYPE_STORAGE:
396                         if (1 == status) {
397                                 img_path = WFD_ICON_DEVICE_STORAGE_CONNECT;
398                         } else {
399                                 img_path = WFD_ICON_DEVICE_STORAGE;
400                         }
401                         break;
402                 case WFD_DEVICE_TYPE_NW_INFRA:
403                         if (1 == status) {
404                                 img_path = WFD_ICON_DEVICE_NETWORK_INFRA_CONNECT;
405                         } else {
406                                 img_path = WFD_ICON_DEVICE_NETWORK_INFRA;
407                         }
408                         break;
409                 case WFD_DEVICE_TYPE_DISPLAYS:
410                         if (1 == status) {
411                                 img_path = WFD_ICON_DEVICE_DISPLAY_CONNECT;
412                         } else {
413                                 img_path = WFD_ICON_DEVICE_DISPLAY;
414                         }
415                         break;
416                 case WFD_DEVICE_TYPE_MM_DEVICES:
417                         if (1 == status) {
418                                 img_path = WFD_ICON_DEVICE_MULTIMEDIA_DEVICE_CONNECT;
419                         } else {
420                                 img_path = WFD_ICON_DEVICE_MULTIMEDIA_DEVICE;
421                         }
422                         break;
423                 case WFD_DEVICE_TYPE_GAME_DEVICES:
424                         if (1 == status) {
425                                 img_path = WFD_ICON_DEVICE_GAMING_DEVICE_CONNECT;
426                         } else {
427                                 img_path = WFD_ICON_DEVICE_GAMING_DEVICE;
428                         }
429                         break;
430                 case WFD_DEVICE_TYPE_TELEPHONE:
431                         if (1 == status) {
432                                 img_path = WFD_ICON_DEVICE_TELEPHONE_CONNECT;
433                         } else {
434                                 img_path = WFD_ICON_DEVICE_TELEPHONE;
435                         }
436                         break;
437                 case WFD_DEVICE_TYPE_AUDIO:
438                         if (1 == status) {
439                                 img_path = WFD_ICON_DEVICE_AUDIO_DEVICE_CONNECT;
440                         } else {
441                                 img_path = WFD_ICON_DEVICE_AUDIO_DEVICE;
442                         }
443                         break;
444                 default:
445                         if (1 == status) {
446                                 img_path = WFD_ICON_DEVICE_COMPUTER_CONNECT;
447                         } else {
448                                 img_path = WFD_ICON_DEVICE_COMPUTER;
449                         }
450                         break;
451                 }
452
453                 if (img_path != NULL) {
454                         icon = elm_icon_add(obj);
455                         elm_icon_file_set(icon, img_path, NULL);
456                         evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
457                         elm_icon_resizable_set(icon, 1, 1);
458                         evas_object_show(icon);
459                 } else {
460                         return NULL;
461                 }
462         }
463
464         __WDUG_LOG_FUNC_EXIT__;
465         return icon;
466 }
467
468 /**
469  *      This function let the ug get the text of no device item
470  *      @return   the text of no device item
471  *      @param[in] data the pointer to the main data structure
472  *      @param[in] obj the pointer to the evas object
473  *      @param[in] part the pointer to the part of item
474  */
475 static char *_gl_noitem_text_get(void *data, Evas_Object *obj, const char *part)
476 {
477         __WDUG_LOG_FUNC_ENTER__;
478
479         if (data == NULL) {
480                 WDUG_LOGE("Incorrect parameter(NULL)\n");
481                 return NULL;
482         }
483
484         __WDUG_LOG_FUNC_EXIT__;
485         return strdup(_("IDS_WFD_NOCONTENT"));
486 }
487
488 /**
489  *      This function let the ug get the multi connect button
490  *      @return   the multi connect button
491  *      @param[in] data the pointer to the main data structure
492  *      @param[in] obj the pointer to the evas object
493  *      @param[in] part the pointer to the part of item
494  */
495 static Evas_Object *_gl_button_get(void *data, Evas_Object *obj, const char *part)
496 {
497         __WDUG_LOG_FUNC_ENTER__;
498         struct ug_data *ugd = (struct ug_data *) data;
499
500         WDUG_LOGI("%s", part);
501         ugd->multi_btn = elm_button_add(obj);
502         wfd_refresh_wifi_direct_state(ugd);
503
504         if (ugd->wfd_status == WIFI_DIRECT_STATE_CONNECTING) {
505                 elm_object_text_set(ugd->multi_btn, _("IDS_WFD_BUTTON_CANCEL"));
506                 WDUG_LOGI("button: Cancel connect\n");
507         } else {
508                 if (ugd->gl_connected_peer_cnt > 1) {
509                         elm_object_text_set(ugd->multi_btn, _("IDS_WFD_BUTTON_DISCONNECT_ALL"));
510                         WDUG_LOGI("button: Disconnect All\n");
511                 } else if (ugd->gl_connected_peer_cnt == 1) {
512                         elm_object_text_set(ugd->multi_btn, _("IDS_WFD_BUTTON_DISCONNECT"));
513                         WDUG_LOGI("button: Disconnect\n");
514                 } else {
515                         elm_object_text_set(ugd->multi_btn, _("IDS_WFD_BUTTON_MULTI"));
516                         WDUG_LOGI("button: Multi connect\n");
517                 }
518         }
519
520         evas_object_smart_callback_add(ugd->multi_btn, "clicked", _wifid_create_multibutton_cb, ugd);
521         evas_object_show(ugd->multi_btn);
522
523         __WDUG_LOG_FUNC_EXIT__;
524         return ugd->multi_btn;
525 }
526
527 /**
528  *      This function let the ug get the title label of connected device list
529  *      @return   the title label of connected device list
530  *      @param[in] data the pointer to the main data structure
531  *      @param[in] obj the pointer to the evas object
532  *      @param[in] part the pointer to the part of item
533  */
534 static char *_gl_conn_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
535 {
536         __WDUG_LOG_FUNC_ENTER__;
537
538         if (data == NULL) {
539                 WDUG_LOGE("Incorrect parameter(NULL)\n");
540                 return NULL;
541         }
542
543         if (!strcmp(part, "elm.text")) {
544                 return strdup(_("IDS_WFD_BODY_CONNECTED_DEVICES"));
545         }
546
547         __WDUG_LOG_FUNC_EXIT__;
548         return NULL;
549 }
550
551 /**
552  *      This function let the ug get the label of connected device
553  *      @return   the label of connected device
554  *      @param[in] data the pointer to the main data structure
555  *      @param[in] obj the pointer to the evas object
556  *      @param[in] part the pointer to the part of item
557  */
558 static char *_gl_peer_conn_dev_label_get(void *data, Evas_Object *obj, const char *part)
559 {
560         __WDUG_LOG_FUNC_ENTER__;
561         assertm_if(NULL == obj, "NULL!!");
562         assertm_if(NULL == part, "NULL!!");
563         device_type_s *peer = (device_type_s *) data;
564         char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
565         WDUG_LOGI("%s", part);
566
567         if (data == NULL) {
568                 WDUG_LOGE("Incorrect parameter(NULL)\n");
569                 return NULL;
570         }
571
572         if (!strcmp(part, "elm.text.1")) {
573                 return strdup(peer->ssid);
574         } else {
575                 g_strlcpy(buf, _("IDS_WFD_CONNECTED"), WFD_GLOBALIZATION_STR_LENGTH);
576                 __WDUG_LOG_FUNC_EXIT__;
577                 return strdup(buf);
578         }
579 }
580
581 /**
582  *      This function let the ug get the title label of connected failed device list
583  *      @return   the label of connected device
584  *      @param[in] data the pointer to the main data structure
585  *      @param[in] obj the pointer to the evas object
586  *      @param[in] part the pointer to the part of item
587  */
588 static char *_gl_conn_failed_dev_title_label_get(void *data, Evas_Object *obj,
589                 const char *part)
590 {
591         __WDUG_LOG_FUNC_ENTER__;
592
593         if (data == NULL) {
594                 WDUG_LOGE("Incorrect parameter(NULL)\n");
595                 return NULL;
596         }
597
598         if (!strcmp(part, "elm.text")) {
599                 return strdup(IDS_WFD_BODY_FAILED_DEVICES);
600         }
601
602         __WDUG_LOG_FUNC_EXIT__;
603         return NULL;
604 }
605
606 /**
607  *      This function let the ug get the label of connected failed device
608  *      @return   the label of connected device
609  *      @param[in] data the pointer to the main data structure
610  *      @param[in] obj the pointer to the evas object
611  *      @param[in] part the pointer to the part of item
612  */
613 static char *_gl_peer_conn_failed_dev_label_get(void *data, Evas_Object *obj, const char *part)
614 {
615         __WDUG_LOG_FUNC_ENTER__;
616         assertm_if(NULL == obj, "NULL!!");
617         assertm_if(NULL == part, "NULL!!");
618         device_type_s *peer = (device_type_s *) data;
619         char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
620         WDUG_LOGI("%s", part);
621
622         if (data == NULL) {
623                 WDUG_LOGE("Incorrect parameter(NULL)\n");
624                 return NULL;
625         }
626
627         if (!strcmp(part, "elm.text.1")) {
628                 return strdup(peer->ssid);
629         } else {
630                 g_strlcpy(buf, _("IDS_WFD_FAILED_TO_CONNECT"), WFD_GLOBALIZATION_STR_LENGTH);
631                 __WDUG_LOG_FUNC_EXIT__;
632                 return strdup(buf);
633         }
634 }
635
636 /**
637  *      This function let the ug get the title label of multi connect list
638  *      @return   the label of connected device
639  *      @param[in] data the pointer to the main data structure
640  *      @param[in] obj the pointer to the evas object
641  *      @param[in] part the pointer to the part of item
642  */
643 static char *_gl_multi_connect_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
644 {
645         __WDUG_LOG_FUNC_ENTER__;
646         struct ug_data *ugd = wfd_get_ug_data();
647
648         if (data == NULL) {
649                 WDUG_LOGE("Incorrect parameter(NULL)\n");
650                 return NULL;
651         }
652
653         if (!strcmp(part, "elm.text")) {
654                 if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_IN_PROGRESS) {
655                         return strdup(_("IDS_WFD_BODY_AVAILABLE_DEVICES"));
656                 } else if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_COMPLETED) {
657                         return strdup(IDS_WFD_BODY_FAILED_DEVICES);
658                 }
659         }
660
661         __WDUG_LOG_FUNC_EXIT__;
662         return NULL;
663 }
664
665 /**
666  *      This function let the ug get the title label of busy device list
667  *      @return   the label of connected device
668  *      @param[in] data the pointer to the main data structure
669  *      @param[in] obj the pointer to the evas object
670  *      @param[in] part the pointer to the part of item
671  */
672 static char *_gl_busy_dev_title_label_get(void *data, Evas_Object *obj,
673                 const char *part)
674 {
675         __WDUG_LOG_FUNC_ENTER__;
676
677         if (data == NULL) {
678                 WDUG_LOGE("Incorrect parameter(NULL)\n");
679                 return NULL;
680         }
681
682         if (!strcmp(part, "elm.text")) {
683                 return strdup(_("IDS_WFD_BODY_BUSY_DEVICES"));
684         }
685
686         __WDUG_LOG_FUNC_EXIT__;
687         return NULL;
688 }
689
690 /**
691  *      This function let the ug get the label of busy device
692  *      @return   the label of connected device
693  *      @param[in] data the pointer to the main data structure
694  *      @param[in] obj the pointer to the evas object
695  *      @param[in] part the pointer to the part of item
696  */
697 static char *_gl_peer_busy_dev_label_get(void *data, Evas_Object *obj, const char *part)
698 {
699         __WDUG_LOG_FUNC_ENTER__;
700         assertm_if(NULL == obj, "NULL!!");
701         assertm_if(NULL == part, "NULL!!");
702         device_type_s *peer = (device_type_s *) data;
703         char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
704         WDUG_LOGI("%s", part);
705
706         if (data == NULL) {
707                 WDUG_LOGE("Incorrect parameter(NULL)\n");
708                 return NULL;
709         }
710
711         WDUG_LOGI("peer->ssid = %s", peer->ssid);
712
713         if (!strcmp(part, "elm.text.1")) {
714                 return strdup(peer->ssid);
715         } else {
716                 g_strlcpy(buf, _("IDS_WFD_CONNECTED_WITH_OTHER_DEVICE"), WFD_GLOBALIZATION_STR_LENGTH);
717                 __WDUG_LOG_FUNC_EXIT__;
718                 return strdup(buf);
719         }
720 }
721
722 /**
723  *      This function let the ug delete the peer item
724  *      @return   void
725  *      @param[in] data the pointer to the main data structure
726  *      @param[in] obj the pointer to the evas object
727  */
728 static void _gl_peer_del(void *data, Evas_Object *obj)
729 {
730         __WDUG_LOG_FUNC_ENTER__;
731         assertm_if(NULL == obj, "NULL!!");
732         assertm_if(NULL == data, "NULL!!");
733
734         __WDUG_LOG_FUNC_EXIT__;
735         return;
736 }
737
738 /**
739  *      This function let the ug initialize the items of genlist
740  *      @return   void
741  */
742 void initialize_gen_item_class()
743 {
744         __WDUG_LOG_FUNC_ENTER__;
745         head_itc.item_style = "dialogue/2text.1icon.10";
746         head_itc.func.text_get = _gl_header_label_get;
747         head_itc.func.content_get = _gl_header_icon_get;
748         head_itc.func.state_get = NULL;
749
750         name_itc.item_style = "dialogue/1text";
751         name_itc.func.text_get = _gl_name_label_get;
752         name_itc.func.content_get = NULL;
753         name_itc.func.state_get = NULL;
754         name_itc.func.del = NULL;
755
756         title_itc.item_style = "dialogue/title";
757         title_itc.func.text_get = _gl_title_label_get;
758         title_itc.func.content_get = _gl_title_content_get;
759         title_itc.func.state_get = NULL;
760         title_itc.func.del = NULL;
761
762         peer_itc.item_style = "dialogue/2text.2icon.3";
763         peer_itc.func.text_get = _gl_peer_label_get;
764         peer_itc.func.content_get = _gl_peer_icon_get;
765         peer_itc.func.state_get = NULL;
766         peer_itc.func.del = _gl_peer_del;
767
768         noitem_itc.item_style = "dialogue/1text";
769         noitem_itc.func.text_get = _gl_noitem_text_get;
770         noitem_itc.func.content_get = NULL;
771         noitem_itc.func.state_get = NULL;
772         noitem_itc.func.del = NULL;
773
774         button_itc.item_style = "1icon";
775         button_itc.func.text_get = NULL;
776         button_itc.func.content_get = _gl_button_get;
777         button_itc.func.state_get = NULL;
778         button_itc.func.del = NULL;
779
780         title_conn_itc.item_style = "dialogue/title";
781         title_conn_itc.func.text_get = _gl_conn_dev_title_label_get;
782         title_conn_itc.func.content_get = NULL;
783         title_conn_itc.func.state_get = NULL;
784         title_conn_itc.func.del = NULL;
785
786         peer_conn_itc.item_style = "dialogue/2text.2icon.3";
787         peer_conn_itc.func.text_get = _gl_peer_conn_dev_label_get;
788         peer_conn_itc.func.content_get = _gl_peer_icon_get;
789         peer_conn_itc.func.state_get = NULL;
790         peer_conn_itc.func.del = _gl_peer_del;
791
792         title_conn_failed_itc.item_style = "dialogue/title";
793         title_conn_failed_itc.func.text_get = _gl_conn_failed_dev_title_label_get;
794         title_conn_failed_itc.func.content_get = NULL;
795         title_conn_failed_itc.func.state_get = NULL;
796         title_conn_failed_itc.func.del = NULL;
797
798         peer_conn_failed_itc.item_style = "dialogue/2text.2icon.3";
799         peer_conn_failed_itc.func.text_get = _gl_peer_conn_failed_dev_label_get;
800         peer_conn_failed_itc.func.content_get = _gl_peer_icon_get;
801         peer_conn_failed_itc.func.state_get = NULL;
802         peer_conn_failed_itc.func.del = _gl_peer_del;
803
804         title_busy_itc.item_style = "dialogue/title";
805         title_busy_itc.func.text_get = _gl_busy_dev_title_label_get;
806         title_busy_itc.func.content_get = NULL;
807         title_busy_itc.func.state_get = NULL;
808         title_busy_itc.func.del = NULL;
809
810         peer_busy_itc.item_style = "dialogue/2text.2icon.3";
811         peer_busy_itc.func.text_get = _gl_peer_busy_dev_label_get;
812         peer_busy_itc.func.content_get = _gl_peer_icon_get;
813         peer_busy_itc.func.state_get = NULL;
814         peer_busy_itc.func.del = _gl_peer_del;
815
816         title_multi_connect_itc.item_style = "dialogue/title";
817         title_multi_connect_itc.func.text_get = _gl_multi_connect_dev_title_label_get;
818         title_multi_connect_itc.func.content_get = NULL;
819         title_multi_connect_itc.func.state_get = NULL;
820         title_multi_connect_itc.func.del = NULL;
821
822         __WDUG_LOG_FUNC_EXIT__;
823
824 }