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>
28 #include "wfd_ug_view.h"
29 #include "wfd_client.h"
31 Elm_Gen_Item_Class device_name_title_itc;
32 #ifdef WFD_ON_OFF_GENLIST
33 Elm_Gen_Item_Class wfd_onoff_itc;
35 Elm_Gen_Item_Class device_name_itc;
36 Elm_Gen_Item_Class title_itc;
37 Elm_Gen_Item_Class multi_view_title_itc;
38 Elm_Gen_Item_Class peer_itc;
39 Elm_Gen_Item_Class title_no_device_itc;
40 Elm_Gen_Item_Class noitem_itc;
41 Elm_Gen_Item_Class title_available_itc;
43 Elm_Gen_Item_Class title_conn_itc;
44 Elm_Gen_Item_Class peer_conn_itc;
46 Elm_Gen_Item_Class title_busy_itc;
47 Elm_Gen_Item_Class peer_busy_itc;
49 Elm_Gen_Item_Class title_multi_connect_itc;
50 Elm_Gen_Item_Class peer_multi_connect_itc;
51 Elm_Gen_Item_Class select_all_multi_connect_itc;
53 Elm_Gen_Item_Class title_conn_failed_itc;
54 Elm_Gen_Item_Class peer_conn_failed_itc;
56 #ifdef WFD_ON_OFF_GENLIST
57 static char *_gl_wfd_onoff_text_get(void *data, Evas_Object *obj,
62 struct ug_data *ugd = (struct ug_data *) data;
63 char *dev_name = NULL;
64 DBG(LOG_INFO, "%s", part);
65 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
66 wfd_get_vconf_device_name(ugd);
68 if (!strcmp("elm.text.sub", part)) {
70 return g_strdup(D_("IDS_ST_HEADER_MY_DEVICE_NAME"));
71 } else if (!strcmp("elm.text", part)) {
72 DBG(LOG_INFO, "%s", ugd->dev_name);
74 dev_name = elm_entry_utf8_to_markup(ugd->dev_name);
75 if (NULL == dev_name) {
76 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
85 static Evas_Object *_gl_wfd_onoff_content_get(void *data,Evas_Object *obj,
90 struct ug_data *ugd = (struct ug_data *) data;
91 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
92 Evas_Object *btn = NULL;
93 Evas_Object *icon = NULL;
95 if (!strcmp("elm.swallow.end", part)) {
96 icon = elm_layout_add(obj);
97 elm_layout_theme_set(icon, "layout", "list/C/type.3", "default");
99 /* Wi-Fi on indication button */
100 btn= elm_check_add(icon);
101 elm_object_style_set(btn, "on&off");
102 elm_check_state_set(btn, ugd->wfd_onoff);
103 evas_object_propagate_events_set(btn, EINA_FALSE);
104 evas_object_smart_callback_add(btn, "changed",_onoff_changed_cb, ugd);
105 ugd->on_off_check = btn;
106 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
107 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND,
109 elm_layout_content_set(icon, "elm.swallow.content", btn);
118 * This function let the ug get the label of header
119 * @return the label of header
120 * @param[in] data the pointer to the main data structure
121 * @param[in] obj the pointer to the evas object
122 * @param[in] part the pointer to the part of item
124 static char *_gl_device_name_label_get(void *data, Evas_Object *obj,
129 struct ug_data *ugd = (struct ug_data *) data;
130 DBG(LOG_INFO, "%s", part);
131 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
132 wfd_get_vconf_device_name(ugd);
133 char *dev_name = NULL;
134 char str[WFD_GLOBALIZATION_STR_LENGTH] = {0, };
135 char buf[WFD_GLOBALIZATION_STR_LENGTH] = {0, };
136 char *format_str = NULL;
138 if (!strcmp("elm.text.multiline", part)) {
139 DBG(LOG_INFO, "%s", ugd->dev_name);
141 dev_name = elm_entry_utf8_to_markup(ugd->dev_name);
142 if (NULL == dev_name) {
143 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
148 format_str = D_("IDS_WIFI_BODY_YOUR_DEVICE_HPS_IS_CURRENTLY_VISIBLE_TO_NEARBY_DEVICES");
149 snprintf(str, WFD_GLOBALIZATION_STR_LENGTH, format_str, dev_name);
151 snprintf(buf, WFD_GLOBALIZATION_STR_LENGTH,
152 "<font_size=30>%s</font_size>", str);
154 WFD_IF_FREE_MEM(dev_name);
156 return g_strdup(buf);
164 * This function let the ug get the label of title
165 * @return the label of titile
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
170 static char *_gl_title_label_get(void *data, Evas_Object *obj, const char *part)
174 WFD_RETV_IF(data == NULL, NULL, "Incorrect parameter(NULL)\n");
175 DBG(LOG_INFO, "%s", part);
176 if (!strcmp("elm.text", part)) {
177 return g_strdup(D_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
184 static char *_gl_title_no_device_label_get(void *data, Evas_Object *obj,
189 WFD_RETV_IF(data == NULL, NULL, "Incorrect parameter(NULL)\n");
190 DBG(LOG_INFO, "%s", part);
191 if (!strcmp("elm.text", part)) {
192 return g_strdup(D_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
199 static char *_gl_multi_title_label_get(void *data, Evas_Object *obj, const char *part)
203 WFD_RETV_IF(data == NULL, NULL, "Incorrect parameter(NULL)\n");
204 if (!strcmp("elm.text", part)) {
205 return g_strdup(D_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
212 static Evas_Object *_gl_multi_title_content_get(void *data, Evas_Object *obj, const char *part)
216 Evas_Object *progressbar = NULL;
217 struct ug_data *ugd = (struct ug_data *) data;
218 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
220 if (TITLE_CONTENT_TYPE_SCANNING == ugd->title_content_mode) {
221 progressbar = elm_progressbar_add(obj);
222 elm_object_style_set(progressbar, "process_small");
223 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
224 elm_progressbar_pulse(progressbar, EINA_TRUE);
225 evas_object_show(progressbar);
232 static char *_gl_available_title_label_get(void *data, Evas_Object *obj, const char *part)
237 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
240 DBG(LOG_INFO, "available- %s", part);
241 if (!strcmp("elm.text", part)) {
242 return g_strdup(D_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
250 * This function let the ug get the content of titile
251 * @return the content of titile
252 * @param[in] data the pointer to the main data structure
253 * @param[in] obj the pointer to the evas object
254 * @param[in] part the pointer to the part of item
256 static Evas_Object *_gl_title_content_get(void *data, Evas_Object *obj, const char *part)
260 Evas_Object *progressbar = NULL;
261 struct ug_data *ugd = (struct ug_data *) data;
264 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
268 DBG(LOG_INFO, "Title content- %s", part);
270 if (TITLE_CONTENT_TYPE_SCANNING == ugd->title_content_mode) {
271 progressbar = elm_progressbar_add(obj);
272 elm_object_style_set(progressbar, "process_small");
273 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
274 elm_progressbar_pulse(progressbar, EINA_TRUE);
275 evas_object_show(progressbar);
283 * This function let the ug get the label of peer item
284 * @return the label of peer item
285 * @param[in] data the pointer to the main data structure
286 * @param[in] obj the pointer to the evas object
287 * @param[in] part the pointer to the part of item
289 static char *_gl_peer_label_get(void *data, Evas_Object *obj, const char *part)
293 assertm_if(NULL == obj, "NULL!!");
294 assertm_if(NULL == part, "NULL!!");
295 device_type_s *peer = (device_type_s *) data;
296 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
299 DBG(LOG_INFO, "%s", part);
302 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
306 if (!strcmp("elm.text", part)) {
307 if (strlen(peer->ssid) != 0) {
308 ssid = elm_entry_utf8_to_markup(peer->ssid);
310 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
317 } else if (!strcmp("elm.text.sub", part)) {
318 switch (peer->conn_status) {
319 case PEER_CONN_STATUS_DISCONNECTED:
320 g_strlcpy(buf, D_("IDS_CHATON_BODY_AVAILABLE"), WFD_GLOBALIZATION_STR_LENGTH);
322 case PEER_CONN_STATUS_CONNECTING:
323 g_strlcpy(buf, D_("IDS_WIFI_BODY_CONNECTING_ING"), WFD_GLOBALIZATION_STR_LENGTH);
325 case PEER_CONN_STATUS_CONNECTED:
326 if (peer->is_group_owner == FALSE) {
327 g_strlcpy(buf, D_("IDS_COM_BODY_CONNECTED_M_STATUS"), WFD_GLOBALIZATION_STR_LENGTH);
329 g_strlcpy(buf, D_("IDS_CHATON_BODY_AVAILABLE"), WFD_GLOBALIZATION_STR_LENGTH);
332 case PEER_CONN_STATUS_FAILED_TO_CONNECT:
333 g_strlcpy(buf, D_("IDS_CHATON_HEADER_CONNECTION_FAILED_ABB2"), WFD_GLOBALIZATION_STR_LENGTH);
335 case PEER_CONN_STATUS_WAIT_FOR_CONNECT:
336 g_strlcpy(buf, D_("IDS_WIFI_BODY_WAITING_FOR_CONNECTION_M_STATUS_ABB"), WFD_GLOBALIZATION_STR_LENGTH);
339 g_strlcpy(buf, D_("IDS_CHATON_BODY_AVAILABLE"), WFD_GLOBALIZATION_STR_LENGTH);
348 return g_strdup(buf);
352 * This function let the ug get the icon of peer item
353 * @return the icon of peer item
354 * @param[in] data the pointer to the main data structure
355 * @param[in] obj the pointer to the evas object
356 * @param[in] part the pointer to the part of item
358 static Evas_Object *_gl_peer_icon_get(void *data, Evas_Object *obj, const char *part)
362 assertm_if(NULL == obj, "NULL!!");
363 assertm_if(NULL == part, "NULL!!");
364 device_type_s *peer = (device_type_s *) data;
365 Evas_Object *icon = NULL;
366 Evas_Object *layout = NULL;
369 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
372 DBG(LOG_INFO, "part = %s", part);
374 if (!strcmp("elm.swallow.icon", part)) {
375 DBG(LOG_INFO, "elm.swallow.icon - category [%d]\n", peer->category);
376 char *img_name = NULL;
377 layout = elm_layout_add(obj);
378 elm_layout_theme_set(layout, "layout", "list/B/type.3", "default");
380 * the icon of connected device is
381 * different from available and busy device
383 switch (peer->category) {
384 case WFD_DEVICE_TYPE_COMPUTER:
385 img_name = WFD_ICON_DEVICE_COMPUTER;
387 case WFD_DEVICE_TYPE_INPUT_DEVICE:
388 img_name = WFD_ICON_DEVICE_INPUT_DEVICE;
390 case WFD_DEVICE_TYPE_PRINTER:
391 img_name = WFD_ICON_DEVICE_PRINTER;
393 case WFD_DEVICE_TYPE_CAMERA:
394 img_name = WFD_ICON_DEVICE_CAMERA;
396 case WFD_DEVICE_TYPE_STORAGE:
397 img_name = WFD_ICON_DEVICE_STORAGE;
399 case WFD_DEVICE_TYPE_NW_INFRA:
400 img_name = WFD_ICON_DEVICE_NETWORK_INFRA;
402 case WFD_DEVICE_TYPE_DISPLAYS:
403 img_name = WFD_ICON_DEVICE_DISPLAY;
405 case WFD_DEVICE_TYPE_MM_DEVICES:
406 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_STB) {
407 img_name = WFD_ICON_DEVICE_STB;
408 } else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MS_MA_ME) {
409 img_name = WFD_ICON_DEVICE_DONGLE;
410 } else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVP) {
411 img_name = WFD_ICON_DEVICE_BD;
413 img_name = WFD_ICON_DEVICE_MULTIMEDIA;
416 case WFD_DEVICE_TYPE_GAME_DEVICES:
417 img_name = WFD_ICON_DEVICE_GAMING;
419 case WFD_DEVICE_TYPE_TELEPHONE:
420 img_name = WFD_ICON_DEVICE_TELEPHONE;
422 case WFD_DEVICE_TYPE_AUDIO:
423 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_TUNER) {
424 img_name = WFD_ICON_DEVICE_HOME_THEATER;
426 img_name = WFD_ICON_DEVICE_HEADSET;
430 img_name = WFD_ICON_DEVICE_UNKNOWN;
434 icon = elm_image_add(layout);
435 elm_image_file_set(icon, WFD_UG_EDJ_PATH, img_name);
436 evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
437 evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
438 evas_object_color_set(icon, 2, 61, 132, 204);
439 evas_object_show(icon);
440 evas_object_propagate_events_set(icon, EINA_FALSE);
441 elm_layout_content_set(layout, "elm.swallow.content", icon);
442 } else if (!strcmp("elm.swallow.end", part)) {
443 DBG(LOG_INFO, "elm.icon.2 - connection status [%d]\n", peer->conn_status);
444 if (peer->conn_status == PEER_CONN_STATUS_CONNECTING) {
445 layout = elm_layout_add(obj);
446 elm_layout_theme_set(layout, "layout", "list/C/type.2", "default");
447 icon = elm_progressbar_add(layout);
448 elm_object_style_set(icon, "process_medium");
449 elm_progressbar_pulse(icon, EINA_TRUE);
450 } else if (peer->conn_status == PEER_CONN_STATUS_CONNECTED) {
453 evas_object_show(icon);
454 elm_layout_content_set(layout, "elm.swallow.content", icon);
458 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");
485 DBG(LOG_INFO, "part[%s]\n", part);
486 if (!strcmp("elm.swallow.icon", part)) {
487 DBG(LOG_INFO, "elm.swallow.icon - category [%d]\n", peer->category);
488 char *img_name = NULL;
489 layout = elm_layout_add(obj);
490 elm_layout_theme_set(layout, "layout", "list/B/type.3", "default");
492 * the icon of connected device is
493 * different from available and busy device
495 switch (peer->category) {
496 case WFD_DEVICE_TYPE_COMPUTER:
497 img_name = WFD_ICON_DEVICE_COMPUTER;
499 case WFD_DEVICE_TYPE_INPUT_DEVICE:
500 img_name = WFD_ICON_DEVICE_INPUT_DEVICE;
502 case WFD_DEVICE_TYPE_PRINTER:
503 img_name = WFD_ICON_DEVICE_PRINTER;
505 case WFD_DEVICE_TYPE_CAMERA:
506 img_name = WFD_ICON_DEVICE_CAMERA;
508 case WFD_DEVICE_TYPE_STORAGE:
509 img_name = WFD_ICON_DEVICE_STORAGE;
511 case WFD_DEVICE_TYPE_NW_INFRA:
512 img_name = WFD_ICON_DEVICE_NETWORK_INFRA;
514 case WFD_DEVICE_TYPE_DISPLAYS:
515 img_name = WFD_ICON_DEVICE_DISPLAY;
517 case WFD_DEVICE_TYPE_MM_DEVICES:
518 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_STB) {
519 img_name = WFD_ICON_DEVICE_STB;
520 } else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MS_MA_ME) {
521 img_name = WFD_ICON_DEVICE_DONGLE;
522 } else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVP) {
523 img_name = WFD_ICON_DEVICE_BD;
525 img_name = WFD_ICON_DEVICE_MULTIMEDIA;
528 case WFD_DEVICE_TYPE_GAME_DEVICES:
529 img_name = WFD_ICON_DEVICE_GAMING;
531 case WFD_DEVICE_TYPE_TELEPHONE:
532 img_name = WFD_ICON_DEVICE_TELEPHONE;
534 case WFD_DEVICE_TYPE_AUDIO:
535 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_TUNER) {
536 img_name = WFD_ICON_DEVICE_HOME_THEATER;
538 img_name = WFD_ICON_DEVICE_HEADSET;
542 img_name = WFD_ICON_DEVICE_UNKNOWN;
546 icon = elm_image_add(layout);
547 elm_image_file_set(icon, WFD_UG_EDJ_PATH, img_name);
548 evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
549 evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
550 evas_object_color_set(icon, 2, 61, 132, 204);
551 evas_object_show(icon);
552 evas_object_propagate_events_set(icon, EINA_FALSE);
553 elm_layout_content_set(layout, "elm.swallow.content", icon);
557 evas_object_show(layout);
564 * This function let the ug get the text of no device item
565 * @return the text of no device item
566 * @param[in] data the pointer to the main data structure
567 * @param[in] obj the pointer to the evas object
568 * @param[in] part the pointer to the part of item
570 static char *_gl_noitem_text_get(void *data, Evas_Object *obj, const char *part)
575 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
579 DBG(LOG_INFO,"part = %s",part);
580 if (!strcmp("elm.text", part)) {
581 return g_strdup(D_("IDS_BT_BODY_NO_DEVICES_FOUND_ABB"));
588 * This function let the ug get the title label of connected device list
589 * @return the title label of connected device list
590 * @param[in] data the pointer to the main data structure
591 * @param[in] obj the pointer to the evas object
592 * @param[in] part the pointer to the part of item
594 static char *_gl_conn_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
599 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
602 DBG(LOG_INFO,"part = %s",part);
603 if (!strcmp("elm.text", part)) {
604 return g_strdup(D_("IDS_ST_HEADER_CONNECTED_DEVICES"));
611 char* ConvertRGBAtoHex(int r, int g, int b, int a)
615 string = g_try_malloc0(MAX_HEX_COLOR_LENGTH);
616 if (string == NULL) {
619 hexcolor = (r << 24) + (g << 16) + (b << 8) + a;
620 snprintf(string, MAX_HEX_COLOR_LENGTH, "%08x", hexcolor );
625 * This function let the ug get the label of connected device
626 * @return the label of connected device
627 * @param[in] data the pointer to the main data structure
628 * @param[in] obj the pointer to the evas object
629 * @param[in] part the pointer to the part of item
631 static char *_gl_peer_conn_dev_label_get(void *data, Evas_Object *obj, const char *part)
635 assertm_if(NULL == obj, "NULL!!");
636 assertm_if(NULL == part, "NULL!!");
637 device_type_s *peer = (device_type_s *) data;
638 DBG(LOG_INFO, "%s", part);
644 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
648 if (!strcmp("elm.text", part)) {
649 if (strlen(peer->ssid) != 0) {
650 ssid = elm_entry_utf8_to_markup(peer->ssid);
652 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
659 } else if (!strcmp("elm.text.sub", part)) {
660 det = elm_entry_utf8_to_markup(D_("IDS_COM_BODY_CONNECTED_M_STATUS"));
661 buf = g_strdup_printf("<color=#%s>%s</color>",
662 ConvertRGBAtoHex(2, 61, 132, 255), det);
663 WFD_IF_FREE_MEM(det);
672 * This function let the ug get the title label of connected failed device list
673 * @return the label of connected device
674 * @param[in] data the pointer to the main data structure
675 * @param[in] obj the pointer to the evas object
676 * @param[in] part the pointer to the part of item
678 static char *_gl_conn_failed_dev_title_label_get(void *data, Evas_Object *obj,
684 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
688 if (!strcmp("elm.text", part)) {
689 return g_strdup(D_("IDS_WIFI_SBODY_NOT_CONNECTED_M_STATUS_ABB"));
697 * This function let the ug get the label of connected failed device
698 * @return the label of connected device
699 * @param[in] data the pointer to the main data structure
700 * @param[in] obj the pointer to the evas object
701 * @param[in] part the pointer to the part of item
703 static char *_gl_peer_conn_failed_dev_label_get(void *data, Evas_Object *obj, const char *part)
707 assertm_if(NULL == obj, "NULL!!");
708 assertm_if(NULL == part, "NULL!!");
709 device_type_s *peer = (device_type_s *) data;
710 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
712 DBG(LOG_INFO, "%s", part);
715 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
719 if (!strcmp("elm.text", part)) {
720 if (strlen(peer->ssid) != 0) {
721 ssid = elm_entry_utf8_to_markup(peer->ssid);
723 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
730 } else if (!strcmp("elm.text.sub", part)) {
731 g_strlcpy(buf, D_("IDS_CHATON_HEADER_CONNECTION_FAILED_ABB2"),
732 WFD_GLOBALIZATION_STR_LENGTH);
734 return g_strdup(buf);
740 * This function let the ug get the title label of multi connect list
741 * @return the label of connected device
742 * @param[in] data the pointer to the main data structure
743 * @param[in] obj the pointer to the evas object
744 * @param[in] part the pointer to the part of item
746 static char *_gl_multi_connect_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
749 struct ug_data *ugd = wfd_get_ug_data();
752 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
755 DBG(LOG_INFO, "%s", part);
757 if (!strcmp("elm.text", part)) {
758 if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_IN_PROGRESS) {
759 return g_strdup(D_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
760 } else if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_COMPLETED) {
761 return g_strdup(D_("IDS_WIFI_SBODY_NOT_CONNECTED_M_STATUS_ABB"));
770 * This function let the ug get the title label of select all in multi connect
771 * @return the label of select all string
772 * @param[in] data the pointer to the main data structure
773 * @param[in] obj the pointer to the evas object
774 * @param[in] part the pointer to the part of item
776 static char *_gl_multi_connect_select_all_title_label_get(void *data, Evas_Object *obj, const char *part)
781 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
784 DBG(LOG_INFO, "%s", part);
786 if (!strcmp("elm.text", part)) {
788 return g_strdup(D_("IDS_WIFI_BODY_SELECT_ALL"));
795 * This function let the ug get the icon of select all genlist
796 * @return the icon of select all genlist
797 * @param[in] data the pointer to the main data structure
798 * @param[in] obj the pointer to the evas object
799 * @param[in] part the pointer to the part of item
801 static Evas_Object *_wfd_gl_select_all_icon_get(void *data, Evas_Object *obj, const char *part)
805 struct ug_data *ugd = (struct ug_data *) data;
806 Evas_Object *check = NULL;
807 Evas_Object *icon_layout = NULL;
809 DBG(LOG_INFO, "Part %s", part);
811 if (!strcmp("elm.swallow.end", part)) {
812 icon_layout = elm_layout_add(obj);
813 elm_layout_theme_set(icon_layout, "layout", "list/C/type.2", "default");
814 DBG(LOG_INFO, "Part %s", part);
815 check = elm_check_add(icon_layout);
816 ugd->select_all_icon = check;
817 if (ugd->is_select_all_checked == EINA_TRUE) {
818 elm_check_state_set(ugd->select_all_icon, TRUE);
820 elm_object_style_set(check, "default/genlist");
821 evas_object_propagate_events_set(check, EINA_FALSE);
822 evas_object_smart_callback_add(check, "changed",
823 wfd_genlist_select_all_check_changed_cb, (void *)data);
824 elm_layout_content_set(icon_layout, "elm.swallow.content", check);
831 * This function let the ug get the title label of busy device list
832 * @return the label of connected device
833 * @param[in] data the pointer to the main data structure
834 * @param[in] obj the pointer to the evas object
835 * @param[in] part the pointer to the part of item
837 static char *_gl_busy_dev_title_label_get(void *data, Evas_Object *obj,
843 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
846 DBG(LOG_INFO, "%s", part);
848 if (!strcmp("elm.text", part)) {
849 return g_strdup(D_("IDS_ST_HEADER_BUSY_DEVICES"));
857 * This function let the ug get the label of busy device
858 * @return the label of connected device
859 * @param[in] data the pointer to the main data structure
860 * @param[in] obj the pointer to the evas object
861 * @param[in] part the pointer to the part of item
863 static char *_gl_peer_busy_dev_label_get(void *data, Evas_Object *obj, const char *part)
866 assertm_if(NULL == obj, "NULL!!");
867 assertm_if(NULL == part, "NULL!!");
868 device_type_s *peer = (device_type_s *) data;
869 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
871 DBG(LOG_INFO, "%s", part);
874 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
878 DBG(LOG_INFO, "peer->ssid = %s", peer->ssid);
880 if (!strcmp("elm.text", part)) {
881 if (strlen(peer->ssid) != 0) {
882 ssid = elm_entry_utf8_to_markup(peer->ssid);
884 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
891 } else if (!strcmp("elm.text.sub", part)) {
892 g_strlcpy(buf, D_("IDS_ST_BODY_CONNECTED_WITH_ANOTHER_DEVICE_ABB"),
893 WFD_GLOBALIZATION_STR_LENGTH);
895 return g_strdup(buf);
902 * This function let the ug delete the peer item
904 * @param[in] data the pointer to the main data structure
905 * @param[in] obj the pointer to the evas object
907 static void _gl_peer_del(void *data, Evas_Object *obj)
911 assertm_if(NULL == obj, "NULL!!");
912 assertm_if(NULL == data, "NULL!!");
919 * This function let the ug initialize the items of genlist
922 void initialize_gen_item_class()
924 elm_theme_extension_add(NULL, WFD_UG_EDJ_PATH);
926 device_name_itc.item_style = WFD_GENLIST_MULTILINE_TEXT_STYLE;
927 device_name_itc.func.text_get = _gl_device_name_label_get;
928 device_name_itc.func.content_get = NULL;
929 device_name_itc.func.state_get = NULL;
931 #ifdef WFD_ON_OFF_GENLIST
932 wfd_onoff_itc.item_style = WFD_GENLIST_2LINE_BOTTOM_TEXT_ICON_STYLE;
933 wfd_onoff_itc.func.text_get = _gl_wfd_onoff_text_get;
934 wfd_onoff_itc.func.content_get = _gl_wfd_onoff_content_get;
935 wfd_onoff_itc.func.state_get = NULL;
936 wfd_onoff_itc.func.del = NULL;
939 title_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
940 title_itc.func.text_get = _gl_title_label_get;
941 title_itc.func.content_get = _gl_title_content_get;
942 title_itc.func.state_get = NULL;
943 title_itc.func.del = NULL;
945 multi_view_title_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
946 multi_view_title_itc.func.text_get = _gl_multi_title_label_get;
947 multi_view_title_itc.func.content_get = _gl_multi_title_content_get;
948 multi_view_title_itc.func.state_get = NULL;
949 multi_view_title_itc.func.del = NULL;
951 title_no_device_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
952 title_no_device_itc.func.text_get = _gl_title_no_device_label_get;
953 title_no_device_itc.func.content_get = NULL;
954 title_no_device_itc.func.state_get = NULL;
955 title_no_device_itc.func.del = NULL;
957 title_available_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
958 title_available_itc.func.text_get = _gl_available_title_label_get;
959 title_available_itc.func.content_get = _gl_title_content_get;
960 title_available_itc.func.state_get = NULL;
961 title_available_itc.func.del = NULL;
963 peer_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
964 peer_itc.func.text_get = _gl_peer_label_get;
965 peer_itc.func.content_get = _gl_peer_icon_get;
966 peer_itc.func.state_get = NULL;
967 peer_itc.func.del = _gl_peer_del;
969 noitem_itc.item_style = WFD_GENLIST_1LINE_TEXT_STYLE;
970 noitem_itc.func.text_get = _gl_noitem_text_get;
971 noitem_itc.func.content_get = NULL;
972 noitem_itc.func.state_get = NULL;
973 noitem_itc.func.del = NULL;
975 title_conn_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
976 title_conn_itc.func.text_get = _gl_conn_dev_title_label_get;
977 title_conn_itc.func.content_get = NULL;
978 title_conn_itc.func.state_get = NULL;
979 title_conn_itc.func.del = NULL;
981 peer_conn_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
982 peer_conn_itc.func.text_get = _gl_peer_conn_dev_label_get;
983 peer_conn_itc.func.content_get = _gl_conn_peer_icon_get;
984 peer_conn_itc.func.state_get = NULL;
985 peer_conn_itc.func.del = _gl_peer_del;
987 title_conn_failed_itc.item_style = WFD_GENLIST_1LINE_TEXT_STYLE;
988 title_conn_failed_itc.func.text_get = _gl_conn_failed_dev_title_label_get;
989 title_conn_failed_itc.func.content_get = NULL;
990 title_conn_failed_itc.func.state_get = NULL;
991 title_conn_failed_itc.func.del = NULL;
993 peer_conn_failed_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
994 peer_conn_failed_itc.func.text_get = _gl_peer_conn_failed_dev_label_get;
995 peer_conn_failed_itc.func.content_get = _gl_peer_icon_get;
996 peer_conn_failed_itc.func.state_get = NULL;
997 peer_conn_failed_itc.func.del = _gl_peer_del;
999 title_busy_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
1000 title_busy_itc.func.text_get = _gl_busy_dev_title_label_get;
1001 title_busy_itc.func.content_get = NULL;
1002 title_busy_itc.func.state_get = NULL;
1003 title_busy_itc.func.del = NULL;
1005 peer_busy_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
1006 peer_busy_itc.func.text_get = _gl_peer_busy_dev_label_get;
1007 peer_busy_itc.func.content_get = _gl_peer_icon_get;
1008 peer_busy_itc.func.state_get = NULL;
1009 peer_busy_itc.func.del = _gl_peer_del;
1011 title_multi_connect_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
1012 title_multi_connect_itc.func.text_get = _gl_multi_connect_dev_title_label_get;
1013 title_multi_connect_itc.func.content_get = NULL;
1014 title_multi_connect_itc.func.state_get = NULL;
1015 title_multi_connect_itc.func.del = NULL;
1017 select_all_multi_connect_itc.item_style = WFD_GENLIST_1LINE_TEXT_ICON_STYLE;
1018 select_all_multi_connect_itc.func.text_get =
1019 _gl_multi_connect_select_all_title_label_get;
1020 select_all_multi_connect_itc.func.content_get = _wfd_gl_select_all_icon_get;
1021 select_all_multi_connect_itc.func.state_get = NULL;
1022 select_all_multi_connect_itc.func.del = NULL;