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);
76 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
84 static Evas_Object *_gl_wfd_onoff_content_get(void *data, Evas_Object *obj,
89 struct ug_data *ugd = (struct ug_data *) data;
90 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
91 Evas_Object *btn = NULL;
92 Evas_Object *icon = NULL;
94 if (!strcmp("elm.swallow.end", part)) {
95 icon = elm_layout_add(obj);
96 elm_layout_theme_set(icon, "layout", "list/C/type.3", "default");
98 /* Wi-Fi on indication button */
99 btn = elm_check_add(icon);
100 elm_object_style_set(btn, "on&off");
101 elm_check_state_set(btn, ugd->wfd_onoff);
102 evas_object_propagate_events_set(btn, EINA_FALSE);
103 evas_object_smart_callback_add(btn, "changed", _onoff_changed_cb, ugd);
104 ugd->on_off_check = btn;
105 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
106 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND,
108 elm_layout_content_set(icon, "elm.swallow.content", btn);
117 * This function let the ug get the label of header
118 * @return the label of header
119 * @param[in] data the pointer to the main data structure
120 * @param[in] obj the pointer to the evas object
121 * @param[in] part the pointer to the part of item
123 static char *_gl_device_name_label_get(void *data, Evas_Object *obj,
128 struct ug_data *ugd = (struct ug_data *) data;
129 DBG(LOG_INFO, "%s", part);
130 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
131 wfd_get_vconf_device_name(ugd);
132 char *dev_name = NULL;
133 char str[WFD_GLOBALIZATION_STR_LENGTH] = {0, };
134 char buf[WFD_GLOBALIZATION_STR_LENGTH] = {0, };
135 char *format_str = NULL;
137 if (!strcmp("elm.text.multiline", part)) {
138 DBG(LOG_INFO, "%s", ugd->dev_name);
140 dev_name = elm_entry_utf8_to_markup(ugd->dev_name);
141 if (NULL == dev_name) {
142 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
147 format_str = D_("IDS_WIFI_BODY_YOUR_DEVICE_HPS_IS_CURRENTLY_VISIBLE_TO_NEARBY_DEVICES");
148 snprintf(str, WFD_GLOBALIZATION_STR_LENGTH, format_str, dev_name);
150 snprintf(buf, WFD_GLOBALIZATION_STR_LENGTH,
151 "<font_size=30>%s</font_size>", str);
153 WFD_IF_FREE_MEM(dev_name);
155 return g_strdup(buf);
163 * This function let the ug get the label of title
164 * @return the label of titile
165 * @param[in] data the pointer to the main data structure
166 * @param[in] obj the pointer to the evas object
167 * @param[in] part the pointer to the part of item
169 static char *_gl_title_label_get(void *data, Evas_Object *obj, const char *part)
173 WFD_RETV_IF(data == NULL, NULL, "Incorrect parameter(NULL)\n");
174 DBG(LOG_INFO, "%s", part);
175 if (!strcmp("elm.text", part))
176 return g_strdup(D_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
183 static char *_gl_title_no_device_label_get(void *data, Evas_Object *obj,
188 WFD_RETV_IF(data == NULL, NULL, "Incorrect parameter(NULL)\n");
189 DBG(LOG_INFO, "%s", part);
190 if (!strcmp("elm.text", part))
191 return g_strdup(D_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
197 static char *_gl_multi_title_label_get(void *data, Evas_Object *obj, const char *part)
201 WFD_RETV_IF(data == NULL, NULL, "Incorrect parameter(NULL)\n");
202 if (!strcmp("elm.text", part))
203 return g_strdup(D_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
209 static Evas_Object *_gl_multi_title_content_get(void *data, Evas_Object *obj, const char *part)
213 Evas_Object *progressbar = NULL;
214 struct ug_data *ugd = (struct ug_data *) data;
215 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
217 if (TITLE_CONTENT_TYPE_SCANNING == ugd->title_content_mode) {
218 progressbar = elm_progressbar_add(obj);
219 elm_object_style_set(progressbar, "process_small");
220 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
221 elm_progressbar_pulse(progressbar, EINA_TRUE);
222 evas_object_show(progressbar);
229 static char *_gl_available_title_label_get(void *data, Evas_Object *obj, const char *part)
234 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
237 DBG(LOG_INFO, "available- %s", part);
238 if (!strcmp("elm.text", part))
239 return g_strdup(D_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
246 * This function let the ug get the content of titile
247 * @return the content of titile
248 * @param[in] data the pointer to the main data structure
249 * @param[in] obj the pointer to the evas object
250 * @param[in] part the pointer to the part of item
252 static Evas_Object *_gl_title_content_get(void *data, Evas_Object *obj, const char *part)
256 Evas_Object *progressbar = NULL;
257 struct ug_data *ugd = (struct ug_data *) data;
260 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
264 DBG(LOG_INFO, "Title content- %s", part);
266 if (TITLE_CONTENT_TYPE_SCANNING == ugd->title_content_mode) {
267 progressbar = elm_progressbar_add(obj);
268 elm_object_style_set(progressbar, "process_small");
269 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
270 elm_progressbar_pulse(progressbar, EINA_TRUE);
271 evas_object_show(progressbar);
279 * This function let the ug get the label of peer item
280 * @return the label of peer item
281 * @param[in] data the pointer to the main data structure
282 * @param[in] obj the pointer to the evas object
283 * @param[in] part the pointer to the part of item
285 static char *_gl_peer_label_get(void *data, Evas_Object *obj, const char *part)
289 assertm_if(NULL == obj, "NULL!!");
290 assertm_if(NULL == part, "NULL!!");
291 device_type_s *peer = (device_type_s *) data;
292 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
295 DBG(LOG_INFO, "%s", part);
298 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
302 if (!strcmp("elm.text", part)) {
303 if (strlen(peer->ssid) != 0) {
304 ssid = elm_entry_utf8_to_markup(peer->ssid);
306 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
313 } else if (!strcmp("elm.text.sub", part)) {
314 switch (peer->conn_status) {
315 case PEER_CONN_STATUS_DISCONNECTED:
316 g_strlcpy(buf, D_("IDS_CHATON_BODY_AVAILABLE"), WFD_GLOBALIZATION_STR_LENGTH);
318 case PEER_CONN_STATUS_CONNECTING:
319 g_strlcpy(buf, D_("IDS_WIFI_BODY_CONNECTING_ING"), WFD_GLOBALIZATION_STR_LENGTH);
321 case PEER_CONN_STATUS_CONNECTED:
322 if (peer->is_group_owner == FALSE)
323 g_strlcpy(buf, D_("IDS_COM_BODY_CONNECTED_M_STATUS"), WFD_GLOBALIZATION_STR_LENGTH);
325 g_strlcpy(buf, D_("IDS_CHATON_BODY_AVAILABLE"), WFD_GLOBALIZATION_STR_LENGTH);
327 case PEER_CONN_STATUS_FAILED_TO_CONNECT:
328 g_strlcpy(buf, D_("IDS_CHATON_HEADER_CONNECTION_FAILED_ABB2"), WFD_GLOBALIZATION_STR_LENGTH);
330 case PEER_CONN_STATUS_WAIT_FOR_CONNECT:
331 g_strlcpy(buf, D_("IDS_WIFI_BODY_WAITING_FOR_CONNECTION_M_STATUS_ABB"), WFD_GLOBALIZATION_STR_LENGTH);
334 g_strlcpy(buf, D_("IDS_CHATON_BODY_AVAILABLE"), WFD_GLOBALIZATION_STR_LENGTH);
343 return g_strdup(buf);
347 * This function let the ug get the icon of peer item
348 * @return the icon of peer item
349 * @param[in] data the pointer to the main data structure
350 * @param[in] obj the pointer to the evas object
351 * @param[in] part the pointer to the part of item
353 static Evas_Object *_gl_peer_icon_get(void *data, Evas_Object *obj, const char *part)
357 assertm_if(NULL == obj, "NULL!!");
358 assertm_if(NULL == part, "NULL!!");
359 device_type_s *peer = (device_type_s *) data;
360 Evas_Object *icon = NULL;
361 Evas_Object *layout = NULL;
364 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
367 DBG(LOG_INFO, "part = %s", part);
369 if (!strcmp("elm.swallow.icon", part)) {
370 DBG(LOG_INFO, "elm.swallow.icon - category [%d]\n", peer->category);
371 char *img_name = NULL;
372 layout = elm_layout_add(obj);
373 elm_layout_theme_set(layout, "layout", "list/B/type.3", "default");
375 * the icon of connected device is
376 * different from available and busy device
378 switch (peer->category) {
379 case WFD_DEVICE_TYPE_COMPUTER:
380 img_name = WFD_ICON_DEVICE_COMPUTER;
382 case WFD_DEVICE_TYPE_INPUT_DEVICE:
383 img_name = WFD_ICON_DEVICE_INPUT_DEVICE;
385 case WFD_DEVICE_TYPE_PRINTER:
386 img_name = WFD_ICON_DEVICE_PRINTER;
388 case WFD_DEVICE_TYPE_CAMERA:
389 img_name = WFD_ICON_DEVICE_CAMERA;
391 case WFD_DEVICE_TYPE_STORAGE:
392 img_name = WFD_ICON_DEVICE_STORAGE;
394 case WFD_DEVICE_TYPE_NW_INFRA:
395 img_name = WFD_ICON_DEVICE_NETWORK_INFRA;
397 case WFD_DEVICE_TYPE_DISPLAYS:
398 img_name = WFD_ICON_DEVICE_DISPLAY;
400 case WFD_DEVICE_TYPE_MM_DEVICES:
401 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_STB)
402 img_name = WFD_ICON_DEVICE_STB;
403 else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MS_MA_ME)
404 img_name = WFD_ICON_DEVICE_DONGLE;
405 else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVP)
406 img_name = WFD_ICON_DEVICE_BD;
408 img_name = WFD_ICON_DEVICE_MULTIMEDIA;
410 case WFD_DEVICE_TYPE_GAME_DEVICES:
411 img_name = WFD_ICON_DEVICE_GAMING;
413 case WFD_DEVICE_TYPE_TELEPHONE:
414 img_name = WFD_ICON_DEVICE_TELEPHONE;
416 case WFD_DEVICE_TYPE_AUDIO:
417 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_TUNER)
418 img_name = WFD_ICON_DEVICE_HOME_THEATER;
420 img_name = WFD_ICON_DEVICE_HEADSET;
423 img_name = WFD_ICON_DEVICE_UNKNOWN;
427 icon = elm_image_add(layout);
428 elm_image_file_set(icon, WFD_UG_EDJ_PATH, img_name);
429 evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
430 evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
431 evas_object_color_set(icon, 2, 61, 132, 204);
432 evas_object_show(icon);
433 evas_object_propagate_events_set(icon, EINA_FALSE);
434 elm_layout_content_set(layout, "elm.swallow.content", icon);
435 } else if (!strcmp("elm.swallow.end", part)) {
436 DBG(LOG_INFO, "elm.icon.2 - connection status [%d]\n", peer->conn_status);
437 if (peer->conn_status == PEER_CONN_STATUS_CONNECTING) {
438 layout = elm_layout_add(obj);
439 elm_layout_theme_set(layout, "layout", "list/C/type.2", "default");
440 icon = elm_progressbar_add(layout);
441 elm_object_style_set(icon, "process_medium");
442 elm_progressbar_pulse(icon, EINA_TRUE);
443 } else if (peer->conn_status == PEER_CONN_STATUS_CONNECTED) {
446 evas_object_show(icon);
447 elm_layout_content_set(layout, "elm.swallow.content", icon);
451 evas_object_show(layout);
458 * This function let the ug get the icon of peer item
459 * @return the icon of peer item
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
464 static Evas_Object *_gl_conn_peer_icon_get(void *data, Evas_Object *obj, const char *part)
467 assertm_if(NULL == obj, "NULL!!");
468 assertm_if(NULL == part, "NULL!!");
469 device_type_s *peer = (device_type_s *) data;
470 Evas_Object *icon = NULL;
471 Evas_Object *layout = NULL;
474 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
478 DBG(LOG_INFO, "part[%s]\n", part);
479 if (!strcmp("elm.swallow.icon", part)) {
480 DBG(LOG_INFO, "elm.swallow.icon - category [%d]\n", peer->category);
481 char *img_name = NULL;
482 layout = elm_layout_add(obj);
483 elm_layout_theme_set(layout, "layout", "list/B/type.3", "default");
485 * the icon of connected device is
486 * different from available and busy device
488 switch (peer->category) {
489 case WFD_DEVICE_TYPE_COMPUTER:
490 img_name = WFD_ICON_DEVICE_COMPUTER;
492 case WFD_DEVICE_TYPE_INPUT_DEVICE:
493 img_name = WFD_ICON_DEVICE_INPUT_DEVICE;
495 case WFD_DEVICE_TYPE_PRINTER:
496 img_name = WFD_ICON_DEVICE_PRINTER;
498 case WFD_DEVICE_TYPE_CAMERA:
499 img_name = WFD_ICON_DEVICE_CAMERA;
501 case WFD_DEVICE_TYPE_STORAGE:
502 img_name = WFD_ICON_DEVICE_STORAGE;
504 case WFD_DEVICE_TYPE_NW_INFRA:
505 img_name = WFD_ICON_DEVICE_NETWORK_INFRA;
507 case WFD_DEVICE_TYPE_DISPLAYS:
508 img_name = WFD_ICON_DEVICE_DISPLAY;
510 case WFD_DEVICE_TYPE_MM_DEVICES:
511 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_STB)
512 img_name = WFD_ICON_DEVICE_STB;
513 else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MS_MA_ME)
514 img_name = WFD_ICON_DEVICE_DONGLE;
515 else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVP)
516 img_name = WFD_ICON_DEVICE_BD;
518 img_name = WFD_ICON_DEVICE_MULTIMEDIA;
520 case WFD_DEVICE_TYPE_GAME_DEVICES:
521 img_name = WFD_ICON_DEVICE_GAMING;
523 case WFD_DEVICE_TYPE_TELEPHONE:
524 img_name = WFD_ICON_DEVICE_TELEPHONE;
526 case WFD_DEVICE_TYPE_AUDIO:
527 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_TUNER)
528 img_name = WFD_ICON_DEVICE_HOME_THEATER;
530 img_name = WFD_ICON_DEVICE_HEADSET;
533 img_name = WFD_ICON_DEVICE_UNKNOWN;
537 icon = elm_image_add(layout);
538 elm_image_file_set(icon, WFD_UG_EDJ_PATH, img_name);
539 evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
540 evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
541 evas_object_color_set(icon, 2, 61, 132, 204);
542 evas_object_show(icon);
543 evas_object_propagate_events_set(icon, EINA_FALSE);
544 elm_layout_content_set(layout, "elm.swallow.content", icon);
548 evas_object_show(layout);
555 * This function let the ug get the text of no device item
556 * @return the text of no device item
557 * @param[in] data the pointer to the main data structure
558 * @param[in] obj the pointer to the evas object
559 * @param[in] part the pointer to the part of item
561 static char *_gl_noitem_text_get(void *data, Evas_Object *obj, const char *part)
566 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
570 DBG(LOG_INFO, "part = %s", part);
571 if (!strcmp("elm.text", part))
572 return g_strdup(D_("IDS_BT_BODY_NO_DEVICES_FOUND_ABB"));
579 * This function let the ug get the title label of connected device list
580 * @return the title label of connected device list
581 * @param[in] data the pointer to the main data structure
582 * @param[in] obj the pointer to the evas object
583 * @param[in] part the pointer to the part of item
585 static char *_gl_conn_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
590 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
593 DBG(LOG_INFO, "part = %s", part);
594 if (!strcmp("elm.text", part))
595 return g_strdup(D_("IDS_ST_HEADER_CONNECTED_DEVICES"));
601 char* ConvertRGBAtoHex(int r, int g, int b, int a)
605 string = g_try_malloc0(MAX_HEX_COLOR_LENGTH);
609 hexcolor = (r << 24) + (g << 16) + (b << 8) + a;
610 snprintf(string, MAX_HEX_COLOR_LENGTH, "%08x", hexcolor);
615 * This function let the ug get the label of connected device
616 * @return the label of connected device
617 * @param[in] data the pointer to the main data structure
618 * @param[in] obj the pointer to the evas object
619 * @param[in] part the pointer to the part of item
621 static char *_gl_peer_conn_dev_label_get(void *data, Evas_Object *obj, const char *part)
625 assertm_if(NULL == obj, "NULL!!");
626 assertm_if(NULL == part, "NULL!!");
627 device_type_s *peer = (device_type_s *) data;
628 DBG(LOG_INFO, "%s", part);
632 char *convertedColor = NULL;
635 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
639 if (!strcmp("elm.text", part)) {
640 if (strlen(peer->ssid) != 0) {
641 ssid = elm_entry_utf8_to_markup(peer->ssid);
643 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
650 } else if (!strcmp("elm.text.sub", part)) {
651 det = elm_entry_utf8_to_markup(D_("IDS_COM_BODY_CONNECTED_M_STATUS"));
652 convertedColor = ConvertRGBAtoHex(2, 61, 132, 255);
653 buf = g_strdup_printf("<color=#%s>%s</color>",
654 convertedColor, det);
655 WFD_IF_FREE_MEM(det);
656 g_free(convertedColor);
665 * This function let the ug get the title label of connected failed device list
666 * @return the label of connected device
667 * @param[in] data the pointer to the main data structure
668 * @param[in] obj the pointer to the evas object
669 * @param[in] part the pointer to the part of item
671 static char *_gl_conn_failed_dev_title_label_get(void *data, Evas_Object *obj,
677 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
681 if (!strcmp("elm.text", part))
682 return g_strdup(D_("IDS_WIFI_SBODY_NOT_CONNECTED_M_STATUS_ABB"));
689 * This function let the ug get the label of connected failed device
690 * @return the label of connected device
691 * @param[in] data the pointer to the main data structure
692 * @param[in] obj the pointer to the evas object
693 * @param[in] part the pointer to the part of item
695 static char *_gl_peer_conn_failed_dev_label_get(void *data, Evas_Object *obj, const char *part)
699 assertm_if(NULL == obj, "NULL!!");
700 assertm_if(NULL == part, "NULL!!");
701 device_type_s *peer = (device_type_s *) data;
702 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
704 DBG(LOG_INFO, "%s", part);
707 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
711 if (!strcmp("elm.text", part)) {
712 if (strlen(peer->ssid) != 0) {
713 ssid = elm_entry_utf8_to_markup(peer->ssid);
715 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
722 } else if (!strcmp("elm.text.sub", part)) {
723 g_strlcpy(buf, D_("IDS_CHATON_HEADER_CONNECTION_FAILED_ABB2"),
724 WFD_GLOBALIZATION_STR_LENGTH);
726 return g_strdup(buf);
732 * This function let the ug get the title label of multi connect list
733 * @return the label of connected device
734 * @param[in] data the pointer to the main data structure
735 * @param[in] obj the pointer to the evas object
736 * @param[in] part the pointer to the part of item
738 static char *_gl_multi_connect_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
741 struct ug_data *ugd = wfd_get_ug_data();
744 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
747 DBG(LOG_INFO, "%s", part);
749 if (!strcmp("elm.text", part) && ugd) {
750 if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_IN_PROGRESS)
751 return g_strdup(D_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
752 else if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_COMPLETED)
753 return g_strdup(D_("IDS_WIFI_SBODY_NOT_CONNECTED_M_STATUS_ABB"));
761 * This function let the ug get the title label of select all in multi connect
762 * @return the label of select all string
763 * @param[in] data the pointer to the main data structure
764 * @param[in] obj the pointer to the evas object
765 * @param[in] part the pointer to the part of item
767 static char *_gl_multi_connect_select_all_title_label_get(void *data, Evas_Object *obj, const char *part)
772 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
775 DBG(LOG_INFO, "%s", part);
777 if (!strcmp("elm.text", part)) {
779 return g_strdup(D_("IDS_WIFI_BODY_SELECT_ALL"));
786 * This function let the ug get the icon of select all genlist
787 * @return the icon of select all genlist
788 * @param[in] data the pointer to the main data structure
789 * @param[in] obj the pointer to the evas object
790 * @param[in] part the pointer to the part of item
792 static Evas_Object *_wfd_gl_select_all_icon_get(void *data, Evas_Object *obj, const char *part)
796 struct ug_data *ugd = (struct ug_data *) data;
797 Evas_Object *check = NULL;
798 Evas_Object *icon_layout = NULL;
800 DBG(LOG_INFO, "Part %s", part);
802 if (!strcmp("elm.swallow.end", part)) {
803 icon_layout = elm_layout_add(obj);
804 elm_layout_theme_set(icon_layout, "layout", "list/C/type.2", "default");
805 DBG(LOG_INFO, "Part %s", part);
806 check = elm_check_add(icon_layout);
807 ugd->select_all_icon = check;
808 if (ugd->is_select_all_checked == EINA_TRUE)
809 elm_check_state_set(ugd->select_all_icon, TRUE);
811 elm_object_style_set(check, "default/genlist");
812 evas_object_propagate_events_set(check, EINA_FALSE);
813 evas_object_smart_callback_add(check, "changed",
814 wfd_genlist_select_all_check_changed_cb, (void *)data);
815 elm_layout_content_set(icon_layout, "elm.swallow.content", check);
822 * This function let the ug get the title label of busy device list
823 * @return the label of connected device
824 * @param[in] data the pointer to the main data structure
825 * @param[in] obj the pointer to the evas object
826 * @param[in] part the pointer to the part of item
828 static char *_gl_busy_dev_title_label_get(void *data, Evas_Object *obj,
834 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
837 DBG(LOG_INFO, "%s", part);
839 if (!strcmp("elm.text", part))
840 return g_strdup(D_("IDS_ST_HEADER_BUSY_DEVICES"));
847 * This function let the ug get the label of busy device
848 * @return the label of connected device
849 * @param[in] data the pointer to the main data structure
850 * @param[in] obj the pointer to the evas object
851 * @param[in] part the pointer to the part of item
853 static char *_gl_peer_busy_dev_label_get(void *data, Evas_Object *obj, const char *part)
856 assertm_if(NULL == obj, "NULL!!");
857 assertm_if(NULL == part, "NULL!!");
858 device_type_s *peer = (device_type_s *) data;
859 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
861 DBG(LOG_INFO, "%s", part);
864 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
868 DBG(LOG_INFO, "peer->ssid = %s", peer->ssid);
870 if (!strcmp("elm.text", part)) {
871 if (strlen(peer->ssid) != 0) {
872 ssid = elm_entry_utf8_to_markup(peer->ssid);
874 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
881 } else if (!strcmp("elm.text.sub", part)) {
882 g_strlcpy(buf, D_("IDS_ST_BODY_CONNECTED_WITH_ANOTHER_DEVICE_ABB"),
883 WFD_GLOBALIZATION_STR_LENGTH);
885 return g_strdup(buf);
892 * This function let the ug delete the peer item
894 * @param[in] data the pointer to the main data structure
895 * @param[in] obj the pointer to the evas object
897 static void _gl_peer_del(void *data, Evas_Object *obj)
901 assertm_if(NULL == obj, "NULL!!");
902 assertm_if(NULL == data, "NULL!!");
909 * This function let the ug initialize the items of genlist
912 void initialize_gen_item_class()
914 elm_theme_extension_add(NULL, WFD_UG_EDJ_PATH);
916 device_name_itc.item_style = WFD_GENLIST_MULTILINE_TEXT_STYLE;
917 device_name_itc.func.text_get = _gl_device_name_label_get;
918 device_name_itc.func.content_get = NULL;
919 device_name_itc.func.state_get = NULL;
921 #ifdef WFD_ON_OFF_GENLIST
922 wfd_onoff_itc.item_style = WFD_GENLIST_2LINE_BOTTOM_TEXT_ICON_STYLE;
923 wfd_onoff_itc.func.text_get = _gl_wfd_onoff_text_get;
924 wfd_onoff_itc.func.content_get = _gl_wfd_onoff_content_get;
925 wfd_onoff_itc.func.state_get = NULL;
926 wfd_onoff_itc.func.del = NULL;
929 title_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
930 title_itc.func.text_get = _gl_title_label_get;
931 title_itc.func.content_get = _gl_title_content_get;
932 title_itc.func.state_get = NULL;
933 title_itc.func.del = NULL;
935 multi_view_title_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
936 multi_view_title_itc.func.text_get = _gl_multi_title_label_get;
937 multi_view_title_itc.func.content_get = _gl_multi_title_content_get;
938 multi_view_title_itc.func.state_get = NULL;
939 multi_view_title_itc.func.del = NULL;
941 title_no_device_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
942 title_no_device_itc.func.text_get = _gl_title_no_device_label_get;
943 title_no_device_itc.func.content_get = NULL;
944 title_no_device_itc.func.state_get = NULL;
945 title_no_device_itc.func.del = NULL;
947 title_available_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
948 title_available_itc.func.text_get = _gl_available_title_label_get;
949 title_available_itc.func.content_get = _gl_title_content_get;
950 title_available_itc.func.state_get = NULL;
951 title_available_itc.func.del = NULL;
953 peer_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
954 peer_itc.func.text_get = _gl_peer_label_get;
955 peer_itc.func.content_get = _gl_peer_icon_get;
956 peer_itc.func.state_get = NULL;
957 peer_itc.func.del = _gl_peer_del;
959 noitem_itc.item_style = WFD_GENLIST_1LINE_TEXT_STYLE;
960 noitem_itc.func.text_get = _gl_noitem_text_get;
961 noitem_itc.func.content_get = NULL;
962 noitem_itc.func.state_get = NULL;
963 noitem_itc.func.del = NULL;
965 title_conn_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
966 title_conn_itc.func.text_get = _gl_conn_dev_title_label_get;
967 title_conn_itc.func.content_get = NULL;
968 title_conn_itc.func.state_get = NULL;
969 title_conn_itc.func.del = NULL;
971 peer_conn_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
972 peer_conn_itc.func.text_get = _gl_peer_conn_dev_label_get;
973 peer_conn_itc.func.content_get = _gl_conn_peer_icon_get;
974 peer_conn_itc.func.state_get = NULL;
975 peer_conn_itc.func.del = _gl_peer_del;
977 title_conn_failed_itc.item_style = WFD_GENLIST_1LINE_TEXT_STYLE;
978 title_conn_failed_itc.func.text_get = _gl_conn_failed_dev_title_label_get;
979 title_conn_failed_itc.func.content_get = NULL;
980 title_conn_failed_itc.func.state_get = NULL;
981 title_conn_failed_itc.func.del = NULL;
983 peer_conn_failed_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
984 peer_conn_failed_itc.func.text_get = _gl_peer_conn_failed_dev_label_get;
985 peer_conn_failed_itc.func.content_get = _gl_peer_icon_get;
986 peer_conn_failed_itc.func.state_get = NULL;
987 peer_conn_failed_itc.func.del = _gl_peer_del;
989 title_busy_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
990 title_busy_itc.func.text_get = _gl_busy_dev_title_label_get;
991 title_busy_itc.func.content_get = NULL;
992 title_busy_itc.func.state_get = NULL;
993 title_busy_itc.func.del = NULL;
995 peer_busy_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
996 peer_busy_itc.func.text_get = _gl_peer_busy_dev_label_get;
997 peer_busy_itc.func.content_get = _gl_peer_icon_get;
998 peer_busy_itc.func.state_get = NULL;
999 peer_busy_itc.func.del = _gl_peer_del;
1001 title_multi_connect_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
1002 title_multi_connect_itc.func.text_get = _gl_multi_connect_dev_title_label_get;
1003 title_multi_connect_itc.func.content_get = NULL;
1004 title_multi_connect_itc.func.state_get = NULL;
1005 title_multi_connect_itc.func.del = NULL;
1007 select_all_multi_connect_itc.item_style = WFD_GENLIST_1LINE_TEXT_ICON_STYLE;
1008 select_all_multi_connect_itc.func.text_get =
1009 _gl_multi_connect_select_all_title_label_get;
1010 select_all_multi_connect_itc.func.content_get = _wfd_gl_select_all_icon_get;
1011 select_all_multi_connect_itc.func.state_get = NULL;
1012 select_all_multi_connect_itc.func.del = NULL;