4 * Copyright 2012 Samsung Electronics Co., Ltd
6 * Licensed under the Flora License, Version 1.1 (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 #define UG_ADDITIONAL_STR_LEN 32
33 Elm_Gen_Item_Class device_name_title_itc;
34 #ifdef WFD_ON_OFF_GENLIST
35 Elm_Gen_Item_Class wfd_onoff_itc;
37 Elm_Gen_Item_Class device_name_itc;
38 Elm_Gen_Item_Class title_itc;
39 Elm_Gen_Item_Class multi_view_title_itc;
40 Elm_Gen_Item_Class peer_itc;
41 Elm_Gen_Item_Class title_no_device_itc;
42 Elm_Gen_Item_Class noitem_itc;
43 Elm_Gen_Item_Class title_available_itc;
45 Elm_Gen_Item_Class title_conn_itc;
46 Elm_Gen_Item_Class peer_conn_itc;
48 Elm_Gen_Item_Class title_busy_itc;
49 Elm_Gen_Item_Class peer_busy_itc;
51 Elm_Gen_Item_Class title_multi_connect_itc;
52 Elm_Gen_Item_Class peer_multi_connect_itc;
53 Elm_Gen_Item_Class select_all_multi_connect_itc;
55 Elm_Gen_Item_Class title_conn_failed_itc;
56 Elm_Gen_Item_Class peer_conn_failed_itc;
58 #ifdef WFD_ON_OFF_GENLIST
59 static char *_gl_wfd_onoff_text_get(void *data, Evas_Object *obj,
64 struct ug_data *ugd = (struct ug_data *) data;
65 char *dev_name = NULL;
66 DBG(LOG_INFO, "%s", part);
67 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
68 wfd_get_vconf_device_name(ugd);
70 if (!strcmp("elm.text.sub", part)) {
72 return g_strdup(D_("IDS_ST_HEADER_MY_DEVICE_NAME"));
73 } else if (!strcmp("elm.text", part)) {
74 DBG(LOG_INFO, "%s", ugd->dev_name);
76 dev_name = elm_entry_utf8_to_markup(ugd->dev_name);
78 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
86 static Evas_Object *_gl_wfd_onoff_content_get(void *data, Evas_Object *obj,
91 struct ug_data *ugd = (struct ug_data *) data;
92 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
93 Evas_Object *btn = NULL;
94 Evas_Object *icon = NULL;
96 if (!strcmp("elm.swallow.end", part)) {
97 icon = elm_layout_add(obj);
98 elm_layout_theme_set(icon, "layout", "list/C/type.3", "default");
100 /* Wi-Fi on indication button */
101 btn = elm_check_add(icon);
102 elm_object_style_set(btn, "on&off");
103 elm_check_state_set(btn, ugd->wfd_onoff);
104 evas_object_propagate_events_set(btn, EINA_FALSE);
105 evas_object_smart_callback_add(btn, "changed", _onoff_changed_cb, ugd);
106 ugd->on_off_check = btn;
107 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
108 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND,
110 elm_layout_content_set(icon, "elm.swallow.content", btn);
119 * This function let the ug get the label of header
120 * @return the label of header
121 * @param[in] data the pointer to the main data structure
122 * @param[in] obj the pointer to the evas object
123 * @param[in] part the pointer to the part of item
125 static char *_gl_device_name_label_get(void *data, Evas_Object *obj,
130 struct ug_data *ugd = (struct ug_data *) data;
131 DBG(LOG_INFO, "%s", part);
132 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
133 wfd_get_vconf_device_name(ugd);
134 char *dev_name = NULL;
135 char str[WFD_GLOBALIZATION_STR_LENGTH] = {0, };
136 char buf[WFD_GLOBALIZATION_STR_LENGTH + UG_ADDITIONAL_STR_LEN + 1] = {0, };
137 char *format_str = NULL;
139 if (!strcmp("elm.text.multiline", part)) {
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");
149 format_str = D_("IDS_WIFI_BODY_YOUR_DEVICE_HPS_IS_CURRENTLY_VISIBLE_TO_NEARBY_DEVICES");
150 snprintf(str, WFD_GLOBALIZATION_STR_LENGTH, format_str, dev_name);
152 snprintf(buf, sizeof(buf),
153 "<font_size=30>%s</font_size>", str);
155 WFD_IF_FREE_MEM(dev_name);
157 return g_strdup(buf);
165 * This function let the ug get the label of title
166 * @return the label of titile
167 * @param[in] data the pointer to the main data structure
168 * @param[in] obj the pointer to the evas object
169 * @param[in] part the pointer to the part of item
171 static char *_gl_title_label_get(void *data, Evas_Object *obj, const char *part)
175 WFD_RETV_IF(data == NULL, NULL, "Incorrect parameter(NULL)\n");
176 DBG(LOG_INFO, "%s", part);
177 if (!strcmp("elm.text", part))
178 return g_strdup(D_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
185 static char *_gl_title_no_device_label_get(void *data, Evas_Object *obj,
190 WFD_RETV_IF(data == NULL, NULL, "Incorrect parameter(NULL)\n");
191 DBG(LOG_INFO, "%s", part);
192 if (!strcmp("elm.text", part))
193 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"));
211 static Evas_Object *_gl_multi_title_content_get(void *data, Evas_Object *obj, const char *part)
215 Evas_Object *progressbar = NULL;
216 struct ug_data *ugd = (struct ug_data *) data;
217 WFD_RETV_IF(ugd == NULL, NULL, "Incorrect parameter(NULL)\n");
219 if (TITLE_CONTENT_TYPE_SCANNING == ugd->title_content_mode) {
220 progressbar = elm_progressbar_add(obj);
221 elm_object_style_set(progressbar, "process_small");
222 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
223 elm_progressbar_pulse(progressbar, EINA_TRUE);
224 evas_object_show(progressbar);
231 static char *_gl_available_title_label_get(void *data, Evas_Object *obj, const char *part)
236 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
239 DBG(LOG_INFO, "available- %s", part);
240 if (!strcmp("elm.text", part))
241 return g_strdup(D_("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 (TITLE_CONTENT_TYPE_SCANNING == ugd->title_content_mode) {
269 progressbar = elm_progressbar_add(obj);
270 elm_object_style_set(progressbar, "process_small");
271 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
272 elm_progressbar_pulse(progressbar, EINA_TRUE);
273 evas_object_show(progressbar);
281 * This function let the ug get the label of peer item
282 * @return the label of peer item
283 * @param[in] data the pointer to the main data structure
284 * @param[in] obj the pointer to the evas object
285 * @param[in] part the pointer to the part of item
287 static char *_gl_peer_label_get(void *data, Evas_Object *obj, const char *part)
291 assertm_if(NULL == obj, "NULL!!");
292 assertm_if(NULL == part, "NULL!!");
293 device_type_s *peer = (device_type_s *) data;
294 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
297 DBG(LOG_INFO, "%s", part);
300 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
304 if (!strcmp("elm.text", part)) {
305 if (strlen(peer->ssid) != 0) {
306 ssid = elm_entry_utf8_to_markup(peer->ssid);
308 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
315 } else if (!strcmp("elm.text.sub", part)) {
316 switch (peer->conn_status) {
317 case PEER_CONN_STATUS_DISCONNECTED:
318 g_strlcpy(buf, D_("IDS_CHATON_BODY_AVAILABLE"), WFD_GLOBALIZATION_STR_LENGTH);
320 case PEER_CONN_STATUS_CONNECTING:
321 g_strlcpy(buf, D_("IDS_WIFI_BODY_CONNECTING_ING"), WFD_GLOBALIZATION_STR_LENGTH);
323 case PEER_CONN_STATUS_CONNECTED:
324 if (peer->is_group_owner == FALSE)
325 g_strlcpy(buf, D_("IDS_COM_BODY_CONNECTED_M_STATUS"), WFD_GLOBALIZATION_STR_LENGTH);
327 g_strlcpy(buf, D_("IDS_CHATON_BODY_AVAILABLE"), WFD_GLOBALIZATION_STR_LENGTH);
329 case PEER_CONN_STATUS_FAILED_TO_CONNECT:
330 g_strlcpy(buf, D_("IDS_CHATON_HEADER_CONNECTION_FAILED_ABB2"), WFD_GLOBALIZATION_STR_LENGTH);
332 case PEER_CONN_STATUS_WAIT_FOR_CONNECT:
333 g_strlcpy(buf, D_("IDS_WIFI_BODY_WAITING_FOR_CONNECTION_M_STATUS_ABB"), WFD_GLOBALIZATION_STR_LENGTH);
336 g_strlcpy(buf, D_("IDS_CHATON_BODY_AVAILABLE"), WFD_GLOBALIZATION_STR_LENGTH);
345 return g_strdup(buf);
349 * This function let the ug get the icon of peer item
350 * @return the icon of peer item
351 * @param[in] data the pointer to the main data structure
352 * @param[in] obj the pointer to the evas object
353 * @param[in] part the pointer to the part of item
355 static Evas_Object *_gl_peer_icon_get(void *data, Evas_Object *obj, const char *part)
359 assertm_if(NULL == obj, "NULL!!");
360 assertm_if(NULL == part, "NULL!!");
361 device_type_s *peer = (device_type_s *) data;
362 Evas_Object *icon = NULL;
365 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
368 DBG(LOG_INFO, "part = %s", part);
370 if (!strcmp("elm.swallow.icon", part)) {
371 char *img_name = NULL;
372 DBG(LOG_INFO, "elm.swallow.icon - category [%d]\n", peer->category);
374 * the icon of connected device is
375 * different from available and busy device
377 switch (peer->category) {
378 case WFD_DEVICE_TYPE_COMPUTER:
379 img_name = WFD_ICON_DEVICE_COMPUTER;
381 case WFD_DEVICE_TYPE_INPUT_DEVICE:
382 img_name = WFD_ICON_DEVICE_INPUT_DEVICE;
384 case WFD_DEVICE_TYPE_PRINTER:
385 img_name = WFD_ICON_DEVICE_PRINTER;
387 case WFD_DEVICE_TYPE_CAMERA:
388 img_name = WFD_ICON_DEVICE_CAMERA;
390 case WFD_DEVICE_TYPE_STORAGE:
391 img_name = WFD_ICON_DEVICE_STORAGE;
393 case WFD_DEVICE_TYPE_NW_INFRA:
394 img_name = WFD_ICON_DEVICE_NETWORK_INFRA;
396 case WFD_DEVICE_TYPE_DISPLAYS:
397 img_name = WFD_ICON_DEVICE_DISPLAY;
399 case WFD_DEVICE_TYPE_MM_DEVICES:
400 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_STB)
401 img_name = WFD_ICON_DEVICE_STB;
402 else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MS_MA_ME)
403 img_name = WFD_ICON_DEVICE_DONGLE;
404 else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVP)
405 img_name = WFD_ICON_DEVICE_BD;
407 img_name = WFD_ICON_DEVICE_MULTIMEDIA;
409 case WFD_DEVICE_TYPE_GAME_DEVICES:
410 img_name = WFD_ICON_DEVICE_GAMING;
412 case WFD_DEVICE_TYPE_TELEPHONE:
413 img_name = WFD_ICON_DEVICE_TELEPHONE;
415 case WFD_DEVICE_TYPE_AUDIO:
416 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_TUNER)
417 img_name = WFD_ICON_DEVICE_HOME_THEATER;
419 img_name = WFD_ICON_DEVICE_HEADSET;
422 img_name = WFD_ICON_DEVICE_UNKNOWN;
426 icon = elm_image_add(obj);
427 elm_image_file_set(icon, WFD_UG_EDJ_PATH, img_name);
428 evas_object_size_hint_min_set(icon, ELM_SCALE_SIZE(WFD_UG_EDJ_ICON_SIZE),
429 ELM_SCALE_SIZE(WFD_UG_EDJ_ICON_SIZE));
430 evas_object_color_set(icon, 2, 61, 132, 204);
432 DBG(LOG_INFO, "img_name = %s", img_name);
434 } else if (!strcmp("elm.swallow.end", part)) {
435 DBG(LOG_INFO, "elm.icon.2 - connection status [%d]\n", peer->conn_status);
436 if (peer->conn_status == PEER_CONN_STATUS_CONNECTING) {
437 icon = elm_progressbar_add(obj);
438 elm_object_style_set(icon, "process_medium");
439 elm_progressbar_pulse(icon, EINA_TRUE);
440 } else if (peer->conn_status == PEER_CONN_STATUS_CONNECTED) {
451 * This function let the ug get the icon of peer item
452 * @return the icon of peer item
453 * @param[in] data the pointer to the main data structure
454 * @param[in] obj the pointer to the evas object
455 * @param[in] part the pointer to the part of item
457 static Evas_Object *_gl_conn_peer_icon_get(void *data, Evas_Object *obj, const char *part)
460 assertm_if(NULL == obj, "NULL!!");
461 assertm_if(NULL == part, "NULL!!");
462 device_type_s *peer = (device_type_s *) data;
463 Evas_Object *icon = NULL;
466 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
470 DBG(LOG_INFO, "part[%s]\n", part);
471 if (!strcmp("elm.swallow.icon", part)) {
472 DBG(LOG_INFO, "elm.swallow.icon - category [%d]\n", peer->category);
473 char *img_name = NULL;
475 * the icon of connected device is
476 * different from available and busy device
478 switch (peer->category) {
479 case WFD_DEVICE_TYPE_COMPUTER:
480 img_name = WFD_ICON_DEVICE_COMPUTER;
482 case WFD_DEVICE_TYPE_INPUT_DEVICE:
483 img_name = WFD_ICON_DEVICE_INPUT_DEVICE;
485 case WFD_DEVICE_TYPE_PRINTER:
486 img_name = WFD_ICON_DEVICE_PRINTER;
488 case WFD_DEVICE_TYPE_CAMERA:
489 img_name = WFD_ICON_DEVICE_CAMERA;
491 case WFD_DEVICE_TYPE_STORAGE:
492 img_name = WFD_ICON_DEVICE_STORAGE;
494 case WFD_DEVICE_TYPE_NW_INFRA:
495 img_name = WFD_ICON_DEVICE_NETWORK_INFRA;
497 case WFD_DEVICE_TYPE_DISPLAYS:
498 img_name = WFD_ICON_DEVICE_DISPLAY;
500 case WFD_DEVICE_TYPE_MM_DEVICES:
501 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_STB)
502 img_name = WFD_ICON_DEVICE_STB;
503 else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MS_MA_ME)
504 img_name = WFD_ICON_DEVICE_DONGLE;
505 else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVP)
506 img_name = WFD_ICON_DEVICE_BD;
508 img_name = WFD_ICON_DEVICE_MULTIMEDIA;
510 case WFD_DEVICE_TYPE_GAME_DEVICES:
511 img_name = WFD_ICON_DEVICE_GAMING;
513 case WFD_DEVICE_TYPE_TELEPHONE:
514 img_name = WFD_ICON_DEVICE_TELEPHONE;
516 case WFD_DEVICE_TYPE_AUDIO:
517 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_TUNER)
518 img_name = WFD_ICON_DEVICE_HOME_THEATER;
520 img_name = WFD_ICON_DEVICE_HEADSET;
523 img_name = WFD_ICON_DEVICE_UNKNOWN;
527 icon = elm_image_add(obj);
528 elm_image_file_set(icon, WFD_UG_EDJ_PATH, img_name);
529 evas_object_size_hint_min_set(icon, ELM_SCALE_SIZE(WFD_UG_EDJ_ICON_SIZE),
530 ELM_SCALE_SIZE(WFD_UG_EDJ_ICON_SIZE));
531 evas_object_color_set(icon, 2, 61, 132, 204);
539 * This function let the ug get the text of no device item
540 * @return the text of no device item
541 * @param[in] data the pointer to the main data structure
542 * @param[in] obj the pointer to the evas object
543 * @param[in] part the pointer to the part of item
545 static char *_gl_noitem_text_get(void *data, Evas_Object *obj, const char *part)
550 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
554 DBG(LOG_INFO, "part = %s", part);
555 if (!strcmp("elm.text", part))
556 return g_strdup(D_("IDS_BT_BODY_NO_DEVICES_FOUND_ABB"));
563 * This function let the ug get the title label of connected device list
564 * @return the title label of connected device list
565 * @param[in] data the pointer to the main data structure
566 * @param[in] obj the pointer to the evas object
567 * @param[in] part the pointer to the part of item
569 static char *_gl_conn_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
574 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
577 DBG(LOG_INFO, "part = %s", part);
578 if (!strcmp("elm.text", part))
579 return g_strdup(D_("IDS_ST_HEADER_CONNECTED_DEVICES"));
585 char* ConvertRGBAtoHex(int r, int g, int b, int a)
589 string = g_try_malloc0(MAX_HEX_COLOR_LENGTH);
593 hexcolor = (r << 24) + (g << 16) + (b << 8) + a;
594 snprintf(string, MAX_HEX_COLOR_LENGTH, "%08x", hexcolor);
599 * This function let the ug get the label of connected device
600 * @return the label of connected device
601 * @param[in] data the pointer to the main data structure
602 * @param[in] obj the pointer to the evas object
603 * @param[in] part the pointer to the part of item
605 static char *_gl_peer_conn_dev_label_get(void *data, Evas_Object *obj, const char *part)
609 assertm_if(NULL == obj, "NULL!!");
610 assertm_if(NULL == part, "NULL!!");
611 device_type_s *peer = (device_type_s *) data;
612 DBG(LOG_INFO, "%s", part);
616 char *convertedColor = NULL;
619 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
623 if (!strcmp("elm.text", part)) {
624 if (strlen(peer->ssid) != 0) {
625 ssid = elm_entry_utf8_to_markup(peer->ssid);
627 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
634 } else if (!strcmp("elm.text.sub", part)) {
635 det = elm_entry_utf8_to_markup(D_("IDS_COM_BODY_CONNECTED_M_STATUS"));
636 convertedColor = ConvertRGBAtoHex(2, 61, 132, 255);
637 buf = g_strdup_printf("<color=#%s>%s</color>",
638 convertedColor, det);
639 WFD_IF_FREE_MEM(det);
640 g_free(convertedColor);
649 * This function let the ug get the title label of connected failed device list
650 * @return the label of connected device
651 * @param[in] data the pointer to the main data structure
652 * @param[in] obj the pointer to the evas object
653 * @param[in] part the pointer to the part of item
655 static char *_gl_conn_failed_dev_title_label_get(void *data, Evas_Object *obj,
661 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
665 if (!strcmp("elm.text", part))
666 return g_strdup(D_("IDS_WIFI_SBODY_NOT_CONNECTED_M_STATUS_ABB"));
673 * This function let the ug get the label of connected failed device
674 * @return the label of connected device
675 * @param[in] data the pointer to the main data structure
676 * @param[in] obj the pointer to the evas object
677 * @param[in] part the pointer to the part of item
679 static char *_gl_peer_conn_failed_dev_label_get(void *data, Evas_Object *obj, const char *part)
683 assertm_if(NULL == obj, "NULL!!");
684 assertm_if(NULL == part, "NULL!!");
685 device_type_s *peer = (device_type_s *) data;
686 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
688 DBG(LOG_INFO, "%s", part);
691 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
695 if (!strcmp("elm.text", part)) {
696 if (strlen(peer->ssid) != 0) {
697 ssid = elm_entry_utf8_to_markup(peer->ssid);
699 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
706 } else if (!strcmp("elm.text.sub", part)) {
707 g_strlcpy(buf, D_("IDS_CHATON_HEADER_CONNECTION_FAILED_ABB2"),
708 WFD_GLOBALIZATION_STR_LENGTH);
710 return g_strdup(buf);
716 * This function let the ug get the title label of multi connect list
717 * @return the label of connected device
718 * @param[in] data the pointer to the main data structure
719 * @param[in] obj the pointer to the evas object
720 * @param[in] part the pointer to the part of item
722 static char *_gl_multi_connect_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
725 struct ug_data *ugd = wfd_get_ug_data();
728 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
731 DBG(LOG_INFO, "%s", part);
733 if (!strcmp("elm.text", part) && ugd) {
734 if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_IN_PROGRESS)
735 return g_strdup(D_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
736 else if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_COMPLETED)
737 return g_strdup(D_("IDS_WIFI_SBODY_NOT_CONNECTED_M_STATUS_ABB"));
745 * This function let the ug get the title label of select all in multi connect
746 * @return the label of select all string
747 * @param[in] data the pointer to the main data structure
748 * @param[in] obj the pointer to the evas object
749 * @param[in] part the pointer to the part of item
751 static char *_gl_multi_connect_select_all_title_label_get(void *data, Evas_Object *obj, const char *part)
756 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
759 DBG(LOG_INFO, "%s", part);
761 if (!strcmp("elm.text", part)) {
763 return g_strdup(D_("IDS_WIFI_BODY_SELECT_ALL"));
770 * This function let the ug get the icon of select all genlist
771 * @return the icon of select all genlist
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 Evas_Object *_wfd_gl_select_all_icon_get(void *data, Evas_Object *obj, const char *part)
780 struct ug_data *ugd = (struct ug_data *) data;
781 Evas_Object *check = NULL;
782 Evas_Object *icon_layout = NULL;
784 DBG(LOG_INFO, "Part %s", part);
786 if (!strcmp("elm.swallow.end", part)) {
787 icon_layout = elm_layout_add(obj);
788 elm_layout_theme_set(icon_layout, "layout", "list/C/type.2", "default");
789 DBG(LOG_INFO, "Part %s", part);
790 check = elm_check_add(icon_layout);
791 ugd->select_all_icon = check;
792 if (ugd->is_select_all_checked == EINA_TRUE)
793 elm_check_state_set(ugd->select_all_icon, TRUE);
795 elm_object_style_set(check, "default/genlist");
796 evas_object_propagate_events_set(check, EINA_FALSE);
797 evas_object_smart_callback_add(check, "changed",
798 wfd_genlist_select_all_check_changed_cb, (void *)data);
799 elm_layout_content_set(icon_layout, "elm.swallow.content", check);
806 * This function let the ug get the title label of busy device list
807 * @return the label of connected device
808 * @param[in] data the pointer to the main data structure
809 * @param[in] obj the pointer to the evas object
810 * @param[in] part the pointer to the part of item
812 static char *_gl_busy_dev_title_label_get(void *data, Evas_Object *obj,
818 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
821 DBG(LOG_INFO, "%s", part);
823 if (!strcmp("elm.text", part))
824 return g_strdup(D_("IDS_ST_HEADER_BUSY_DEVICES"));
831 * This function let the ug get the label of busy device
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_peer_busy_dev_label_get(void *data, Evas_Object *obj, const char *part)
840 assertm_if(NULL == obj, "NULL!!");
841 assertm_if(NULL == part, "NULL!!");
842 device_type_s *peer = (device_type_s *) data;
843 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
845 DBG(LOG_INFO, "%s", part);
848 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
852 DBG(LOG_INFO, "peer->ssid = %s", peer->ssid);
854 if (!strcmp("elm.text", part)) {
855 if (strlen(peer->ssid) != 0) {
856 ssid = elm_entry_utf8_to_markup(peer->ssid);
858 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
865 } else if (!strcmp("elm.text.sub", part)) {
866 g_strlcpy(buf, D_("IDS_ST_BODY_CONNECTED_WITH_ANOTHER_DEVICE_ABB"),
867 WFD_GLOBALIZATION_STR_LENGTH);
869 return g_strdup(buf);
876 * This function let the ug delete the peer item
878 * @param[in] data the pointer to the main data structure
879 * @param[in] obj the pointer to the evas object
881 static void _gl_peer_del(void *data, Evas_Object *obj)
885 assertm_if(NULL == obj, "NULL!!");
886 assertm_if(NULL == data, "NULL!!");
893 * This function let the ug initialize the items of genlist
896 void initialize_gen_item_class()
898 elm_theme_extension_add(NULL, WFD_UG_EDJ_PATH);
900 device_name_itc.item_style = WFD_GENLIST_MULTILINE_TEXT_STYLE;
901 device_name_itc.func.text_get = _gl_device_name_label_get;
902 device_name_itc.func.content_get = NULL;
903 device_name_itc.func.state_get = NULL;
905 #ifdef WFD_ON_OFF_GENLIST
906 wfd_onoff_itc.item_style = WFD_GENLIST_2LINE_BOTTOM_TEXT_ICON_STYLE;
907 wfd_onoff_itc.func.text_get = _gl_wfd_onoff_text_get;
908 wfd_onoff_itc.func.content_get = _gl_wfd_onoff_content_get;
909 wfd_onoff_itc.func.state_get = NULL;
910 wfd_onoff_itc.func.del = NULL;
913 title_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
914 title_itc.func.text_get = _gl_title_label_get;
915 title_itc.func.content_get = _gl_title_content_get;
916 title_itc.func.state_get = NULL;
917 title_itc.func.del = NULL;
919 multi_view_title_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
920 multi_view_title_itc.func.text_get = _gl_multi_title_label_get;
921 multi_view_title_itc.func.content_get = _gl_multi_title_content_get;
922 multi_view_title_itc.func.state_get = NULL;
923 multi_view_title_itc.func.del = NULL;
925 title_no_device_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
926 title_no_device_itc.func.text_get = _gl_title_no_device_label_get;
927 title_no_device_itc.func.content_get = NULL;
928 title_no_device_itc.func.state_get = NULL;
929 title_no_device_itc.func.del = NULL;
931 title_available_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
932 title_available_itc.func.text_get = _gl_available_title_label_get;
933 title_available_itc.func.content_get = _gl_title_content_get;
934 title_available_itc.func.state_get = NULL;
935 title_available_itc.func.del = NULL;
937 peer_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
938 peer_itc.func.text_get = _gl_peer_label_get;
939 peer_itc.func.content_get = _gl_peer_icon_get;
940 peer_itc.func.state_get = NULL;
941 peer_itc.func.del = _gl_peer_del;
943 noitem_itc.item_style = WFD_GENLIST_1LINE_TEXT_STYLE;
944 noitem_itc.func.text_get = _gl_noitem_text_get;
945 noitem_itc.func.content_get = NULL;
946 noitem_itc.func.state_get = NULL;
947 noitem_itc.func.del = NULL;
949 title_conn_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
950 title_conn_itc.func.text_get = _gl_conn_dev_title_label_get;
951 title_conn_itc.func.content_get = NULL;
952 title_conn_itc.func.state_get = NULL;
953 title_conn_itc.func.del = NULL;
955 peer_conn_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
956 peer_conn_itc.func.text_get = _gl_peer_conn_dev_label_get;
957 peer_conn_itc.func.content_get = _gl_conn_peer_icon_get;
958 peer_conn_itc.func.state_get = NULL;
959 peer_conn_itc.func.del = _gl_peer_del;
961 title_conn_failed_itc.item_style = WFD_GENLIST_1LINE_TEXT_STYLE;
962 title_conn_failed_itc.func.text_get = _gl_conn_failed_dev_title_label_get;
963 title_conn_failed_itc.func.content_get = NULL;
964 title_conn_failed_itc.func.state_get = NULL;
965 title_conn_failed_itc.func.del = NULL;
967 peer_conn_failed_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
968 peer_conn_failed_itc.func.text_get = _gl_peer_conn_failed_dev_label_get;
969 peer_conn_failed_itc.func.content_get = _gl_peer_icon_get;
970 peer_conn_failed_itc.func.state_get = NULL;
971 peer_conn_failed_itc.func.del = _gl_peer_del;
973 title_busy_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
974 title_busy_itc.func.text_get = _gl_busy_dev_title_label_get;
975 title_busy_itc.func.content_get = NULL;
976 title_busy_itc.func.state_get = NULL;
977 title_busy_itc.func.del = NULL;
979 peer_busy_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
980 peer_busy_itc.func.text_get = _gl_peer_busy_dev_label_get;
981 peer_busy_itc.func.content_get = _gl_peer_icon_get;
982 peer_busy_itc.func.state_get = NULL;
983 peer_busy_itc.func.del = _gl_peer_del;
985 title_multi_connect_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
986 title_multi_connect_itc.func.text_get = _gl_multi_connect_dev_title_label_get;
987 title_multi_connect_itc.func.content_get = NULL;
988 title_multi_connect_itc.func.state_get = NULL;
989 title_multi_connect_itc.func.del = NULL;
991 select_all_multi_connect_itc.item_style = WFD_GENLIST_1LINE_TEXT_ICON_STYLE;
992 select_all_multi_connect_itc.func.text_get =
993 _gl_multi_connect_select_all_title_label_get;
994 select_all_multi_connect_itc.func.content_get = _wfd_gl_select_all_icon_get;
995 select_all_multi_connect_itc.func.state_get = NULL;
996 select_all_multi_connect_itc.func.del = NULL;