4 * Copyright 2012 Samsung Electronics Co., Ltd
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
10 * http://www.tizenopensource.org/license
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.
23 #include <Elementary.h>
25 #include <ui-gadget-module.h>
26 #include <wifi-direct.h>
29 #include "wfd_ug_view.h"
30 #include "wfd_client.h"
32 Elm_Gen_Item_Class device_name_title_itc;
33 #ifdef WFD_ON_OFF_GENLIST
34 Elm_Gen_Item_Class wfd_onoff_itc;
36 Elm_Gen_Item_Class device_name_itc;
37 Elm_Gen_Item_Class title_itc;
38 Elm_Gen_Item_Class multi_view_title_itc;
39 Elm_Gen_Item_Class peer_itc;
40 Elm_Gen_Item_Class title_no_device_itc;
41 Elm_Gen_Item_Class noitem_itc;
42 Elm_Gen_Item_Class title_available_itc;
44 Elm_Gen_Item_Class title_conn_itc;
45 Elm_Gen_Item_Class peer_conn_itc;
47 Elm_Gen_Item_Class title_busy_itc;
48 Elm_Gen_Item_Class peer_busy_itc;
50 Elm_Gen_Item_Class title_multi_connect_itc;
51 Elm_Gen_Item_Class peer_multi_connect_itc;
52 Elm_Gen_Item_Class select_all_multi_connect_itc;
54 Elm_Gen_Item_Class title_conn_failed_itc;
55 Elm_Gen_Item_Class peer_conn_failed_itc;
57 #ifdef WFD_ON_OFF_GENLIST
58 static char *_gl_wfd_onoff_text_get(void *data, Evas_Object *obj,
63 struct ug_data *ugd = (struct ug_data *) data;
64 DBG(LOG_INFO, "%s", part);
65 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
66 wfd_get_vconf_device_name(ugd);
69 if (!g_strcmp0(part,"elm.text.main.left.bottom")) {
70 DBG(LOG_INFO, "%s", ugd->dev_name);
72 dev_name = elm_entry_utf8_to_markup(ugd->dev_name);
73 if (NULL == dev_name) {
74 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
81 } else if (!g_strcmp0(part, "elm.text.sub.left.top")) {
82 return g_strdup(_("IDS_ST_HEADER_MY_DEVICE_NAME"));
88 static Evas_Object *_gl_wfd_onoff_content_get(void *data,Evas_Object *obj,
93 struct ug_data *ugd = (struct ug_data *) data;
94 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
95 Evas_Object *btn = NULL;
96 Evas_Object *icon = NULL;
97 icon = elm_layout_add(obj);
99 if (g_strcmp0(part, "elm.icon.2")) {
102 elm_layout_theme_set(icon, "layout", "list/C/type.3", "default");
103 btn = elm_check_add(icon);
104 /* Wi-Fi on indication button */
105 btn= elm_check_add(icon);
106 elm_object_style_set(btn, "on&off");
107 evas_object_propagate_events_set(btn, EINA_FALSE);
108 elm_check_state_set(btn, ugd->wfd_onoff);
109 evas_object_propagate_events_set(btn, EINA_FALSE);
110 evas_object_smart_callback_add(btn, "changed",_onoff_changed_cb, ugd);
111 ugd->on_off_check = btn;
112 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
113 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND,
115 elm_layout_content_set(icon, "elm.swallow.content", btn);
122 * This function let the ug get the label of header
123 * @return the label of header
124 * @param[in] data the pointer to the main data structure
125 * @param[in] obj the pointer to the evas object
126 * @param[in] part the pointer to the part of item
128 static char *_gl_device_name_label_get(void *data, Evas_Object *obj,
133 struct ug_data *ugd = (struct ug_data *) data;
134 DBG(LOG_INFO, "%s", part);
135 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
136 wfd_get_vconf_device_name(ugd);
139 if (!g_strcmp0(part,"elm.text.main.left.bottom")) {
140 DBG(LOG_INFO, "%s", ugd->dev_name);
142 dev_name = elm_entry_utf8_to_markup(ugd->dev_name);
143 if (NULL == dev_name) {
144 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
151 } else if (!g_strcmp0(part, "elm.text.sub.left.top")) {
152 return g_strdup(_("IDS_ST_HEADER_MY_DEVICE_NAME"));
159 * This function let the ug get the label of title
160 * @return the label of titile
161 * @param[in] data the pointer to the main data structure
162 * @param[in] obj the pointer to the evas object
163 * @param[in] part the pointer to the part of item
165 static char *_gl_title_label_get(void *data, Evas_Object *obj, const char *part)
169 WFD_RETV_IF(data == NULL, NULL, "Incorrect parameter(NULL)\n");
170 DBG(LOG_INFO, "%s", part);
171 if (!g_strcmp0(part, "elm.text.main")) {
172 return g_strdup(_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
179 static char *_gl_title_no_device_label_get(void *data, Evas_Object *obj,
184 WFD_RETV_IF(data == NULL, NULL, "Incorrect parameter(NULL)\n");
185 DBG(LOG_INFO, "%s", part);
186 if (!g_strcmp0(part, "elm.text.main")) {
187 return g_strdup(_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
194 static char *_gl_multi_title_label_get(void *data, Evas_Object *obj, const char *part)
198 WFD_RETV_IF(data == NULL, NULL, "Incorrect parameter(NULL)\n");
199 if (!g_strcmp0(part, "elm.text.main")) {
200 return g_strdup(_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
207 static Evas_Object *_gl_multi_title_content_get(void *data, Evas_Object *obj, const char *part)
211 Evas_Object *progressbar = NULL;
212 struct ug_data *ugd = (struct ug_data *) data;
213 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
215 if (!g_strcmp0(part, "elm.icon")) {
216 if (TITLE_CONTENT_TYPE_SCANNING == ugd->title_content_mode) {
217 progressbar = elm_progressbar_add(obj);
218 elm_object_style_set(progressbar, "process_small");
219 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
220 elm_progressbar_pulse(progressbar, EINA_TRUE);
221 evas_object_show(progressbar);
230 static char *_gl_available_title_label_get(void *data, Evas_Object *obj, const char *part)
235 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
238 DBG(LOG_INFO, "available- %s", part);
239 if (!g_strcmp0(part, "elm.text.main")) {
240 return g_strdup(_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
248 * This function let the ug get the content of titile
249 * @return the content of titile
250 * @param[in] data the pointer to the main data structure
251 * @param[in] obj the pointer to the evas object
252 * @param[in] part the pointer to the part of item
254 static Evas_Object *_gl_title_content_get(void *data, Evas_Object *obj, const char *part)
258 Evas_Object *progressbar = NULL;
259 struct ug_data *ugd = (struct ug_data *) data;
262 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
266 DBG(LOG_INFO, "Title content- %s", part);
268 if (!g_strcmp0(part, "elm.icon")) {
269 if (TITLE_CONTENT_TYPE_SCANNING == ugd->title_content_mode) {
270 progressbar = elm_progressbar_add(obj);
271 elm_object_style_set(progressbar, "process_small");
272 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
273 elm_progressbar_pulse(progressbar, EINA_TRUE);
274 evas_object_show(progressbar);
285 * This function let the ug get the label of peer item
286 * @return the label of peer item
287 * @param[in] data the pointer to the main data structure
288 * @param[in] obj the pointer to the evas object
289 * @param[in] part the pointer to the part of item
291 static char *_gl_peer_label_get(void *data, Evas_Object *obj, const char *part)
295 assertm_if(NULL == obj, "NULL!!");
296 assertm_if(NULL == part, "NULL!!");
297 device_type_s *peer = (device_type_s *) data;
298 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
301 DBG(LOG_INFO, "%s", part);
304 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
308 if (!g_strcmp0(part, "elm.text.main.left.top")) {
309 if (strlen(peer->ssid) != 0) {
310 ssid = elm_entry_utf8_to_markup(peer->ssid);
312 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
319 } else if (!g_strcmp0(part, "elm.text.sub.left.bottom")) {
320 switch (peer->conn_status) {
321 case PEER_CONN_STATUS_DISCONNECTED:
322 g_strlcpy(buf, _("IDS_CHATON_BODY_AVAILABLE"), WFD_GLOBALIZATION_STR_LENGTH);
324 case PEER_CONN_STATUS_CONNECTING:
325 g_strlcpy(buf, _("IDS_WIFI_BODY_CONNECTING_ING"), WFD_GLOBALIZATION_STR_LENGTH);
327 case PEER_CONN_STATUS_CONNECTED:
328 if (peer->is_group_owner == FALSE) {
329 g_strlcpy(buf, _("IDS_COM_BODY_CONNECTED_M_STATUS"), WFD_GLOBALIZATION_STR_LENGTH);
331 g_strlcpy(buf, _("IDS_CHATON_BODY_AVAILABLE"), WFD_GLOBALIZATION_STR_LENGTH);
334 case PEER_CONN_STATUS_FAILED_TO_CONNECT:
335 g_strlcpy(buf, _("IDS_CHATON_HEADER_CONNECTION_FAILED_ABB2"), WFD_GLOBALIZATION_STR_LENGTH);
337 case PEER_CONN_STATUS_WAIT_FOR_CONNECT:
338 g_strlcpy(buf, _("IDS_WIFI_BODY_WAITING_FOR_CONNECTION_M_STATUS_ABB"), WFD_GLOBALIZATION_STR_LENGTH);
341 g_strlcpy(buf, _("IDS_CHATON_BODY_AVAILABLE"), WFD_GLOBALIZATION_STR_LENGTH);
350 return g_strdup(buf);
354 * This function let the ug get the icon of peer item
355 * @return the icon of peer item
356 * @param[in] data the pointer to the main data structure
357 * @param[in] obj the pointer to the evas object
358 * @param[in] part the pointer to the part of item
360 static Evas_Object *_gl_peer_icon_get(void *data, Evas_Object *obj, const char *part)
364 assertm_if(NULL == obj, "NULL!!");
365 assertm_if(NULL == part, "NULL!!");
366 device_type_s *peer = (device_type_s *) data;
367 Evas_Object *icon = NULL;
368 Evas_Object *layout = NULL;
371 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
374 DBG(LOG_INFO, "part = %s", part);
375 if (!g_strcmp0(part, "elm.icon.2")) {
376 DBG(LOG_INFO, "elm.icon.2 - connection status [%d]\n", peer->conn_status);
377 if (peer->conn_status == PEER_CONN_STATUS_CONNECTING) {
378 layout = elm_layout_add(obj);
379 elm_layout_theme_set(layout, "layout", "list/C/type.2", "default");
380 icon = elm_progressbar_add(layout);
381 elm_object_style_set(icon, "process_medium");
382 elm_progressbar_pulse(icon, EINA_TRUE);
383 } else if (peer->conn_status == PEER_CONN_STATUS_CONNECTED) {
386 evas_object_show(icon);
387 elm_layout_content_set(layout, "elm.swallow.content", icon);
388 } else if (!g_strcmp0(part, "elm.icon.1")) {
389 DBG(LOG_INFO, "elm.icon.1 - category [%d]\n", peer->category);
390 char *img_name = NULL;
391 layout = elm_layout_add(obj);
392 elm_layout_theme_set(layout, "layout", "list/B/type.3", "default");
394 * the icon of connected device is
395 * different from available and busy device
397 switch (peer->category) {
398 case WFD_DEVICE_TYPE_COMPUTER:
399 img_name = WFD_ICON_DEVICE_COMPUTER;
401 case WFD_DEVICE_TYPE_INPUT_DEVICE:
402 img_name = WFD_ICON_DEVICE_INPUT_DEVICE;
404 case WFD_DEVICE_TYPE_PRINTER:
405 img_name = WFD_ICON_DEVICE_PRINTER;
407 case WFD_DEVICE_TYPE_CAMERA:
408 img_name = WFD_ICON_DEVICE_CAMERA;
410 case WFD_DEVICE_TYPE_STORAGE:
411 img_name = WFD_ICON_DEVICE_STORAGE;
413 case WFD_DEVICE_TYPE_NW_INFRA:
414 img_name = WFD_ICON_DEVICE_NETWORK_INFRA;
416 case WFD_DEVICE_TYPE_DISPLAYS:
417 img_name = WFD_ICON_DEVICE_DISPLAY;
419 case WFD_DEVICE_TYPE_MM_DEVICES:
420 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_STB) {
421 img_name = WFD_ICON_DEVICE_STB;
422 } else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MS_MA_ME) {
423 img_name = WFD_ICON_DEVICE_DONGLE;
424 } else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVP) {
425 img_name = WFD_ICON_DEVICE_BD;
427 img_name = WFD_ICON_DEVICE_MULTIMEDIA;
430 case WFD_DEVICE_TYPE_GAME_DEVICES:
431 img_name = WFD_ICON_DEVICE_GAMING;
433 case WFD_DEVICE_TYPE_TELEPHONE:
434 img_name = WFD_ICON_DEVICE_TELEPHONE;
436 case WFD_DEVICE_TYPE_AUDIO:
437 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_TUNER) {
438 img_name = WFD_ICON_DEVICE_HOME_THEATER;
440 img_name = WFD_ICON_DEVICE_HEADSET;
444 img_name = WFD_ICON_DEVICE_UNKNOWN;
448 icon = elm_image_add(layout);
449 elm_image_file_set(icon, WFD_UG_EDJ_PATH, img_name);
450 evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
451 evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
452 evas_object_color_set(icon, 2, 61, 132, 204);
453 evas_object_show(icon);
454 evas_object_propagate_events_set(icon, EINA_FALSE);
455 elm_layout_content_set(layout, "elm.swallow.content", icon);
459 evas_object_show(layout);
465 * This function let the ug get the icon of peer item
466 * @return the icon of peer item
467 * @param[in] data the pointer to the main data structure
468 * @param[in] obj the pointer to the evas object
469 * @param[in] part the pointer to the part of item
471 static Evas_Object *_gl_conn_peer_icon_get(void *data, Evas_Object *obj, const char *part)
474 assertm_if(NULL == obj, "NULL!!");
475 assertm_if(NULL == part, "NULL!!");
476 device_type_s *peer = (device_type_s *) data;
477 Evas_Object *icon = NULL;
478 Evas_Object *layout = NULL;
481 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
484 DBG(LOG_INFO, "part[%s]\n", part);
485 if (!g_strcmp0(part, "elm.icon.1")) {
486 DBG(LOG_INFO, "elm.icon.1 - category [%d]\n", peer->category);
487 char *img_name = NULL;
488 layout = elm_layout_add(obj);
489 elm_layout_theme_set(layout, "layout", "list/B/type.3", "default");
491 * the icon of connected device is
492 * different from available and busy device
494 switch (peer->category) {
495 case WFD_DEVICE_TYPE_COMPUTER:
496 img_name = WFD_ICON_DEVICE_COMPUTER;
498 case WFD_DEVICE_TYPE_INPUT_DEVICE:
499 img_name = WFD_ICON_DEVICE_INPUT_DEVICE;
501 case WFD_DEVICE_TYPE_PRINTER:
502 img_name = WFD_ICON_DEVICE_PRINTER;
504 case WFD_DEVICE_TYPE_CAMERA:
505 img_name = WFD_ICON_DEVICE_CAMERA;
507 case WFD_DEVICE_TYPE_STORAGE:
508 img_name = WFD_ICON_DEVICE_STORAGE;
510 case WFD_DEVICE_TYPE_NW_INFRA:
511 img_name = WFD_ICON_DEVICE_NETWORK_INFRA;
513 case WFD_DEVICE_TYPE_DISPLAYS:
514 img_name = WFD_ICON_DEVICE_DISPLAY;
516 case WFD_DEVICE_TYPE_MM_DEVICES:
517 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_STB) {
518 img_name = WFD_ICON_DEVICE_STB;
519 } else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MS_MA_ME) {
520 img_name = WFD_ICON_DEVICE_DONGLE;
521 } else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVP) {
522 img_name = WFD_ICON_DEVICE_BD;
524 img_name = WFD_ICON_DEVICE_MULTIMEDIA;
527 case WFD_DEVICE_TYPE_GAME_DEVICES:
528 img_name = WFD_ICON_DEVICE_GAMING;
530 case WFD_DEVICE_TYPE_TELEPHONE:
531 img_name = WFD_ICON_DEVICE_TELEPHONE;
533 case WFD_DEVICE_TYPE_AUDIO:
534 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_TUNER) {
535 img_name = WFD_ICON_DEVICE_HOME_THEATER;
537 img_name = WFD_ICON_DEVICE_HEADSET;
541 img_name = WFD_ICON_DEVICE_UNKNOWN;
545 icon = elm_image_add(layout);
546 elm_image_file_set(icon, WFD_UG_EDJ_PATH, img_name);
547 evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
548 evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
549 evas_object_color_set(icon, 2, 61, 132, 204);
550 evas_object_show(icon);
551 evas_object_propagate_events_set(icon, EINA_FALSE);
552 elm_layout_content_set(layout, "elm.swallow.content", icon);
555 evas_object_show(layout);
561 * This function let the ug get the text of no device item
562 * @return the text of no device item
563 * @param[in] data the pointer to the main data structure
564 * @param[in] obj the pointer to the evas object
565 * @param[in] part the pointer to the part of item
567 static char *_gl_noitem_text_get(void *data, Evas_Object *obj, const char *part)
572 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
576 DBG(LOG_INFO,"part = %s",part);
577 if (!g_strcmp0(part, "elm.text.main.left")) {
578 return g_strdup(_("IDS_BT_BODY_NO_DEVICES_FOUND_ABB"));
585 * This function let the ug get the title label of connected device list
586 * @return the title label of connected device list
587 * @param[in] data the pointer to the main data structure
588 * @param[in] obj the pointer to the evas object
589 * @param[in] part the pointer to the part of item
591 static char *_gl_conn_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
596 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
599 DBG(LOG_INFO,"part = %s",part);
600 if (!g_strcmp0(part, "elm.text.main")) {
601 return g_strdup(_("IDS_ST_HEADER_CONNECTED_DEVICES"));
608 char* ConvertRGBAtoHex(int r, int g, int b, int a)
612 string = g_try_malloc0(sizeof(char )* 255);
613 if (string == NULL) {
616 hexcolor = (r << 24) + (g << 16) + (b << 8) + a;
617 sprintf(string, "%08x", hexcolor );
622 * This function let the ug get the label of connected device
623 * @return the label of connected device
624 * @param[in] data the pointer to the main data structure
625 * @param[in] obj the pointer to the evas object
626 * @param[in] part the pointer to the part of item
628 static char *_gl_peer_conn_dev_label_get(void *data, Evas_Object *obj, const char *part)
632 assertm_if(NULL == obj, "NULL!!");
633 assertm_if(NULL == part, "NULL!!");
634 device_type_s *peer = (device_type_s *) data;
635 DBG(LOG_INFO, "%s", part);
640 int r = 0, g = 0, b = 0, a = 0;
643 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
647 if (!g_strcmp0(part, "elm.text.main.left.top")) {
648 if (strlen(peer->ssid) != 0) {
649 ssid = elm_entry_utf8_to_markup(peer->ssid);
651 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
658 } else if(!g_strcmp0(part, "elm.text.sub.left.bottom")){
659 det = elm_entry_utf8_to_markup(_("IDS_COM_BODY_CONNECTED_M_STATUS"));
660 edje_color_class_get("T024S",&r, &g, &b, &a,
661 NULL, NULL, NULL, NULL,
662 NULL, NULL, NULL, NULL);
663 str = ConvertRGBAtoHex(r, g, b, a);
664 buf = g_strdup_printf("<color=#%s>%s</color>",
680 * This function let the ug get the title label of connected failed device list
681 * @return the label of connected device
682 * @param[in] data the pointer to the main data structure
683 * @param[in] obj the pointer to the evas object
684 * @param[in] part the pointer to the part of item
686 static char *_gl_conn_failed_dev_title_label_get(void *data, Evas_Object *obj,
692 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
696 if (!g_strcmp0(part, "elm.text")) {
697 return g_strdup(_("IDS_WIFI_SBODY_NOT_CONNECTED_M_STATUS_ABB"));
705 * This function let the ug get the label of connected failed device
706 * @return the label of connected device
707 * @param[in] data the pointer to the main data structure
708 * @param[in] obj the pointer to the evas object
709 * @param[in] part the pointer to the part of item
711 static char *_gl_peer_conn_failed_dev_label_get(void *data, Evas_Object *obj, const char *part)
715 assertm_if(NULL == obj, "NULL!!");
716 assertm_if(NULL == part, "NULL!!");
717 device_type_s *peer = (device_type_s *) data;
718 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
720 DBG(LOG_INFO, "%s", part);
723 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
727 if (!g_strcmp0(part, "elm.text.1")) {
728 if (strlen(peer->ssid) != 0) {
729 ssid = elm_entry_utf8_to_markup(peer->ssid);
731 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
739 g_strlcpy(buf, _("IDS_CHATON_HEADER_CONNECTION_FAILED_ABB2"),
740 WFD_GLOBALIZATION_STR_LENGTH);
742 return g_strdup(buf);
748 * This function let the ug get the title label of multi connect list
749 * @return the label of connected device
750 * @param[in] data the pointer to the main data structure
751 * @param[in] obj the pointer to the evas object
752 * @param[in] part the pointer to the part of item
754 static char *_gl_multi_connect_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
757 struct ug_data *ugd = wfd_get_ug_data();
760 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
763 DBG(LOG_INFO, "%s", part);
765 if (!g_strcmp0(part, "elm.text.main")) {
766 if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_IN_PROGRESS) {
767 return g_strdup(_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
768 } else if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_COMPLETED) {
769 return g_strdup(_("IDS_WIFI_SBODY_NOT_CONNECTED_M_STATUS_ABB"));
778 * This function let the ug get the title label of select all in multi connect
779 * @return the label of select all string
780 * @param[in] data the pointer to the main data structure
781 * @param[in] obj the pointer to the evas object
782 * @param[in] part the pointer to the part of item
784 static char *_gl_multi_connect_select_all_title_label_get(void *data, Evas_Object *obj, const char *part)
789 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
792 DBG(LOG_INFO, "%s", part);
794 if (!g_strcmp0(part, "elm.text.main.left")) {
796 return g_strdup(_("IDS_WIFI_BODY_SELECT_ALL"));
803 * This function let the ug get the icon of select all genlist
804 * @return the icon of select all genlist
805 * @param[in] data the pointer to the main data structure
806 * @param[in] obj the pointer to the evas object
807 * @param[in] part the pointer to the part of item
809 static Evas_Object *_wfd_gl_select_all_icon_get(void *data, Evas_Object *obj, const char *part)
813 struct ug_data *ugd = (struct ug_data *) data;
814 Evas_Object *check = NULL;
815 Evas_Object *icon_layout = NULL;
817 DBG(LOG_INFO, "Part %s", part);
819 if (!g_strcmp0(part, "elm.icon.2")) {
820 icon_layout = elm_layout_add(obj);
821 elm_layout_theme_set(icon_layout, "layout", "list/C/type.2", "default");
822 DBG(LOG_INFO, "Part %s", part);
823 check = elm_check_add(icon_layout);
824 ugd->select_all_icon = check;
825 if (ugd->is_select_all_checked == EINA_TRUE) {
826 elm_check_state_set(ugd->select_all_icon, TRUE);
828 elm_object_style_set(check, "default/genlist");
829 evas_object_propagate_events_set(check, EINA_FALSE);
830 evas_object_smart_callback_add(check, "changed",
831 wfd_genlist_select_all_check_changed_cb, (void *)data);
832 elm_layout_content_set(icon_layout, "elm.swallow.content", check);
839 * This function let the ug get the title label of busy device list
840 * @return the label of connected device
841 * @param[in] data the pointer to the main data structure
842 * @param[in] obj the pointer to the evas object
843 * @param[in] part the pointer to the part of item
845 static char *_gl_busy_dev_title_label_get(void *data, Evas_Object *obj,
851 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
854 DBG(LOG_INFO, "%s", part);
856 if (!g_strcmp0(part,"elm.text.main")) {
857 return g_strdup(_("IDS_ST_HEADER_BUSY_DEVICES"));
865 * This function let the ug get the label of busy device
866 * @return the label of connected device
867 * @param[in] data the pointer to the main data structure
868 * @param[in] obj the pointer to the evas object
869 * @param[in] part the pointer to the part of item
871 static char *_gl_peer_busy_dev_label_get(void *data, Evas_Object *obj, const char *part)
874 assertm_if(NULL == obj, "NULL!!");
875 assertm_if(NULL == part, "NULL!!");
876 device_type_s *peer = (device_type_s *) data;
877 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
879 DBG(LOG_INFO, "%s", part);
882 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
886 DBG(LOG_INFO, "peer->ssid = %s", peer->ssid);
888 if (!g_strcmp0(part, "elm.text.main.left.top")) {
889 if (strlen(peer->ssid) != 0) {
890 ssid = elm_entry_utf8_to_markup(peer->ssid);
892 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
899 } else if (!g_strcmp0(part, "elm.text.sub.left.bottom")) {
900 g_strlcpy(buf, _("IDS_ST_BODY_CONNECTED_WITH_ANOTHER_DEVICE_ABB"),
901 WFD_GLOBALIZATION_STR_LENGTH);
903 return g_strdup(buf);
910 * This function let the ug delete the peer item
912 * @param[in] data the pointer to the main data structure
913 * @param[in] obj the pointer to the evas object
915 static void _gl_peer_del(void *data, Evas_Object *obj)
919 assertm_if(NULL == obj, "NULL!!");
920 assertm_if(NULL == data, "NULL!!");
927 * This function let the ug initialize the items of genlist
930 void initialize_gen_item_class()
932 elm_theme_extension_add(NULL, WFD_UG_EDJ_PATH);
934 device_name_itc.item_style = "dialogue/2text.2";
935 device_name_itc.func.text_get = NULL;
936 device_name_itc.func.content_get = NULL;
937 device_name_itc.func.state_get = NULL;
939 #ifdef WFD_ON_OFF_GENLIST
940 wfd_onoff_itc.item_style = "2line.bottom";
941 wfd_onoff_itc.func.text_get = _gl_wfd_onoff_text_get;
942 wfd_onoff_itc.func.content_get = _gl_wfd_onoff_content_get;
943 wfd_onoff_itc.func.state_get = NULL;
944 wfd_onoff_itc.func.del = NULL;
948 title_itc.item_style = "groupindex";
949 title_itc.func.text_get = _gl_title_label_get;
950 title_itc.func.content_get = _gl_title_content_get;
951 title_itc.func.state_get = NULL;
952 title_itc.func.del = NULL;
954 multi_view_title_itc.item_style = "groupindex";
955 multi_view_title_itc.func.text_get = _gl_multi_title_label_get;
956 multi_view_title_itc.func.content_get = _gl_multi_title_content_get;
957 multi_view_title_itc.func.state_get = NULL;
958 multi_view_title_itc.func.del = NULL;
960 title_no_device_itc.item_style = "groupindex";
961 title_no_device_itc.func.text_get = _gl_title_no_device_label_get;
962 title_no_device_itc.func.content_get = NULL;
963 title_no_device_itc.func.state_get = NULL;
964 title_no_device_itc.func.del = NULL;
966 title_available_itc.item_style = "groupindex";
967 title_available_itc.func.text_get = _gl_available_title_label_get;
968 title_available_itc.func.content_get = _gl_title_content_get;
969 title_available_itc.func.state_get = NULL;
970 title_available_itc.func.del = NULL;
972 peer_itc.item_style = "2line.top";
973 peer_itc.func.text_get = _gl_peer_label_get;
974 peer_itc.func.content_get = _gl_peer_icon_get;
975 peer_itc.func.state_get = NULL;
976 peer_itc.func.del = _gl_peer_del;
978 noitem_itc.item_style = "1line";
979 noitem_itc.func.text_get = _gl_noitem_text_get;
980 noitem_itc.func.content_get = NULL;
981 noitem_itc.func.state_get = NULL;
982 noitem_itc.func.del = NULL;
984 title_conn_itc.item_style = "groupindex";
985 title_conn_itc.func.text_get = _gl_conn_dev_title_label_get;
986 title_conn_itc.func.content_get = NULL;
987 title_conn_itc.func.state_get = NULL;
988 title_conn_itc.func.del = NULL;
990 peer_conn_itc.item_style = "2line.top";
991 peer_conn_itc.func.text_get = _gl_peer_conn_dev_label_get;
992 peer_conn_itc.func.content_get = _gl_conn_peer_icon_get;
993 peer_conn_itc.func.state_get = NULL;
994 peer_conn_itc.func.del = _gl_peer_del;
996 title_conn_failed_itc.item_style = "dialogue/title";
997 title_conn_failed_itc.func.text_get = _gl_conn_failed_dev_title_label_get;
998 title_conn_failed_itc.func.content_get = NULL;
999 title_conn_failed_itc.func.state_get = NULL;
1000 title_conn_failed_itc.func.del = NULL;
1002 peer_conn_failed_itc.item_style = "dialogue/2text.2icon.3";
1003 peer_conn_failed_itc.func.text_get = _gl_peer_conn_failed_dev_label_get;
1004 peer_conn_failed_itc.func.content_get = _gl_peer_icon_get;
1005 peer_conn_failed_itc.func.state_get = NULL;
1006 peer_conn_failed_itc.func.del = _gl_peer_del;
1008 title_busy_itc.item_style = "groupindex";
1009 title_busy_itc.func.text_get = _gl_busy_dev_title_label_get;
1010 title_busy_itc.func.content_get = NULL;
1011 title_busy_itc.func.state_get = NULL;
1012 title_busy_itc.func.del = NULL;
1014 peer_busy_itc.item_style = "2line.top";
1015 peer_busy_itc.func.text_get = _gl_peer_busy_dev_label_get;
1016 peer_busy_itc.func.content_get = _gl_peer_icon_get;
1017 peer_busy_itc.func.state_get = NULL;
1018 peer_busy_itc.func.del = _gl_peer_del;
1020 title_multi_connect_itc.item_style = "groupindex";
1021 title_multi_connect_itc.func.text_get = _gl_multi_connect_dev_title_label_get;
1022 title_multi_connect_itc.func.content_get = NULL;
1023 title_multi_connect_itc.func.state_get = NULL;
1024 title_multi_connect_itc.func.del = NULL;
1026 select_all_multi_connect_itc.item_style = "1line";
1027 select_all_multi_connect_itc.func.text_get =
1028 _gl_multi_connect_select_all_title_label_get;
1029 select_all_multi_connect_itc.func.content_get = _wfd_gl_select_all_icon_get;
1030 select_all_multi_connect_itc.func.state_get = NULL;
1031 select_all_multi_connect_itc.func.del = NULL;