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 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;
363 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
366 DBG(LOG_INFO, "part = %s", part);
368 if (!strcmp("elm.swallow.icon", part)) {
369 char *img_name = NULL;
370 DBG(LOG_INFO, "elm.swallow.icon - category [%d]\n", peer->category);
372 * the icon of connected device is
373 * different from available and busy device
375 switch (peer->category) {
376 case WFD_DEVICE_TYPE_COMPUTER:
377 img_name = WFD_ICON_DEVICE_COMPUTER;
379 case WFD_DEVICE_TYPE_INPUT_DEVICE:
380 img_name = WFD_ICON_DEVICE_INPUT_DEVICE;
382 case WFD_DEVICE_TYPE_PRINTER:
383 img_name = WFD_ICON_DEVICE_PRINTER;
385 case WFD_DEVICE_TYPE_CAMERA:
386 img_name = WFD_ICON_DEVICE_CAMERA;
388 case WFD_DEVICE_TYPE_STORAGE:
389 img_name = WFD_ICON_DEVICE_STORAGE;
391 case WFD_DEVICE_TYPE_NW_INFRA:
392 img_name = WFD_ICON_DEVICE_NETWORK_INFRA;
394 case WFD_DEVICE_TYPE_DISPLAYS:
395 img_name = WFD_ICON_DEVICE_DISPLAY;
397 case WFD_DEVICE_TYPE_MM_DEVICES:
398 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_STB)
399 img_name = WFD_ICON_DEVICE_STB;
400 else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MS_MA_ME)
401 img_name = WFD_ICON_DEVICE_DONGLE;
402 else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVP)
403 img_name = WFD_ICON_DEVICE_BD;
405 img_name = WFD_ICON_DEVICE_MULTIMEDIA;
407 case WFD_DEVICE_TYPE_GAME_DEVICES:
408 img_name = WFD_ICON_DEVICE_GAMING;
410 case WFD_DEVICE_TYPE_TELEPHONE:
411 img_name = WFD_ICON_DEVICE_TELEPHONE;
413 case WFD_DEVICE_TYPE_AUDIO:
414 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_TUNER)
415 img_name = WFD_ICON_DEVICE_HOME_THEATER;
417 img_name = WFD_ICON_DEVICE_HEADSET;
420 img_name = WFD_ICON_DEVICE_UNKNOWN;
424 icon = elm_image_add(obj);
425 elm_image_file_set(icon, WFD_UG_EDJ_PATH, img_name);
426 evas_object_size_hint_min_set(icon, ELM_SCALE_SIZE(WFD_UG_EDJ_ICON_SIZE),
427 ELM_SCALE_SIZE(WFD_UG_EDJ_ICON_SIZE));
428 evas_object_color_set(icon, 2, 61, 132, 204);
430 DBG(LOG_INFO, "img_name = %s", img_name);
432 } else if (!strcmp("elm.swallow.end", part)) {
433 DBG(LOG_INFO, "elm.icon.2 - connection status [%d]\n", peer->conn_status);
434 if (peer->conn_status == PEER_CONN_STATUS_CONNECTING) {
435 icon = elm_progressbar_add(obj);
436 elm_object_style_set(icon, "process_medium");
437 elm_progressbar_pulse(icon, EINA_TRUE);
438 } else if (peer->conn_status == PEER_CONN_STATUS_CONNECTED) {
449 * This function let the ug get the icon of peer item
450 * @return the icon of peer item
451 * @param[in] data the pointer to the main data structure
452 * @param[in] obj the pointer to the evas object
453 * @param[in] part the pointer to the part of item
455 static Evas_Object *_gl_conn_peer_icon_get(void *data, Evas_Object *obj, const char *part)
458 assertm_if(NULL == obj, "NULL!!");
459 assertm_if(NULL == part, "NULL!!");
460 device_type_s *peer = (device_type_s *) data;
461 Evas_Object *icon = NULL;
464 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
468 DBG(LOG_INFO, "part[%s]\n", part);
469 if (!strcmp("elm.swallow.icon", part)) {
470 DBG(LOG_INFO, "elm.swallow.icon - category [%d]\n", peer->category);
471 char *img_name = NULL;
473 * the icon of connected device is
474 * different from available and busy device
476 switch (peer->category) {
477 case WFD_DEVICE_TYPE_COMPUTER:
478 img_name = WFD_ICON_DEVICE_COMPUTER;
480 case WFD_DEVICE_TYPE_INPUT_DEVICE:
481 img_name = WFD_ICON_DEVICE_INPUT_DEVICE;
483 case WFD_DEVICE_TYPE_PRINTER:
484 img_name = WFD_ICON_DEVICE_PRINTER;
486 case WFD_DEVICE_TYPE_CAMERA:
487 img_name = WFD_ICON_DEVICE_CAMERA;
489 case WFD_DEVICE_TYPE_STORAGE:
490 img_name = WFD_ICON_DEVICE_STORAGE;
492 case WFD_DEVICE_TYPE_NW_INFRA:
493 img_name = WFD_ICON_DEVICE_NETWORK_INFRA;
495 case WFD_DEVICE_TYPE_DISPLAYS:
496 img_name = WFD_ICON_DEVICE_DISPLAY;
498 case WFD_DEVICE_TYPE_MM_DEVICES:
499 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_STB)
500 img_name = WFD_ICON_DEVICE_STB;
501 else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MS_MA_ME)
502 img_name = WFD_ICON_DEVICE_DONGLE;
503 else if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVP)
504 img_name = WFD_ICON_DEVICE_BD;
506 img_name = WFD_ICON_DEVICE_MULTIMEDIA;
508 case WFD_DEVICE_TYPE_GAME_DEVICES:
509 img_name = WFD_ICON_DEVICE_GAMING;
511 case WFD_DEVICE_TYPE_TELEPHONE:
512 img_name = WFD_ICON_DEVICE_TELEPHONE;
514 case WFD_DEVICE_TYPE_AUDIO:
515 if (peer->sub_category == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_TUNER)
516 img_name = WFD_ICON_DEVICE_HOME_THEATER;
518 img_name = WFD_ICON_DEVICE_HEADSET;
521 img_name = WFD_ICON_DEVICE_UNKNOWN;
525 icon = elm_image_add(obj);
526 elm_image_file_set(icon, WFD_UG_EDJ_PATH, img_name);
527 evas_object_size_hint_min_set(icon, ELM_SCALE_SIZE(WFD_UG_EDJ_ICON_SIZE),
528 ELM_SCALE_SIZE(WFD_UG_EDJ_ICON_SIZE));
529 evas_object_color_set(icon, 2, 61, 132, 204);
537 * This function let the ug get the text of no device item
538 * @return the text of no device item
539 * @param[in] data the pointer to the main data structure
540 * @param[in] obj the pointer to the evas object
541 * @param[in] part the pointer to the part of item
543 static char *_gl_noitem_text_get(void *data, Evas_Object *obj, const char *part)
548 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
552 DBG(LOG_INFO, "part = %s", part);
553 if (!strcmp("elm.text", part))
554 return g_strdup(D_("IDS_BT_BODY_NO_DEVICES_FOUND_ABB"));
561 * This function let the ug get the title label of connected device list
562 * @return the title label of connected device list
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_conn_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
572 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
575 DBG(LOG_INFO, "part = %s", part);
576 if (!strcmp("elm.text", part))
577 return g_strdup(D_("IDS_ST_HEADER_CONNECTED_DEVICES"));
583 char* ConvertRGBAtoHex(int r, int g, int b, int a)
587 string = g_try_malloc0(MAX_HEX_COLOR_LENGTH);
591 hexcolor = (r << 24) + (g << 16) + (b << 8) + a;
592 snprintf(string, MAX_HEX_COLOR_LENGTH, "%08x", hexcolor);
597 * This function let the ug get the label of connected device
598 * @return the label of connected device
599 * @param[in] data the pointer to the main data structure
600 * @param[in] obj the pointer to the evas object
601 * @param[in] part the pointer to the part of item
603 static char *_gl_peer_conn_dev_label_get(void *data, Evas_Object *obj, const char *part)
607 assertm_if(NULL == obj, "NULL!!");
608 assertm_if(NULL == part, "NULL!!");
609 device_type_s *peer = (device_type_s *) data;
610 DBG(LOG_INFO, "%s", part);
614 char *convertedColor = NULL;
617 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
621 if (!strcmp("elm.text", part)) {
622 if (strlen(peer->ssid) != 0) {
623 ssid = elm_entry_utf8_to_markup(peer->ssid);
625 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
632 } else if (!strcmp("elm.text.sub", part)) {
633 det = elm_entry_utf8_to_markup(D_("IDS_COM_BODY_CONNECTED_M_STATUS"));
634 convertedColor = ConvertRGBAtoHex(2, 61, 132, 255);
635 buf = g_strdup_printf("<color=#%s>%s</color>",
636 convertedColor, det);
637 WFD_IF_FREE_MEM(det);
638 g_free(convertedColor);
647 * This function let the ug get the title label of connected failed device list
648 * @return the label of connected device
649 * @param[in] data the pointer to the main data structure
650 * @param[in] obj the pointer to the evas object
651 * @param[in] part the pointer to the part of item
653 static char *_gl_conn_failed_dev_title_label_get(void *data, Evas_Object *obj,
659 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
663 if (!strcmp("elm.text", part))
664 return g_strdup(D_("IDS_WIFI_SBODY_NOT_CONNECTED_M_STATUS_ABB"));
671 * This function let the ug get the label of connected failed device
672 * @return the label of connected device
673 * @param[in] data the pointer to the main data structure
674 * @param[in] obj the pointer to the evas object
675 * @param[in] part the pointer to the part of item
677 static char *_gl_peer_conn_failed_dev_label_get(void *data, Evas_Object *obj, const char *part)
681 assertm_if(NULL == obj, "NULL!!");
682 assertm_if(NULL == part, "NULL!!");
683 device_type_s *peer = (device_type_s *) data;
684 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
686 DBG(LOG_INFO, "%s", part);
689 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
693 if (!strcmp("elm.text", part)) {
694 if (strlen(peer->ssid) != 0) {
695 ssid = elm_entry_utf8_to_markup(peer->ssid);
697 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
704 } else if (!strcmp("elm.text.sub", part)) {
705 g_strlcpy(buf, D_("IDS_CHATON_HEADER_CONNECTION_FAILED_ABB2"),
706 WFD_GLOBALIZATION_STR_LENGTH);
708 return g_strdup(buf);
714 * This function let the ug get the title label of multi connect list
715 * @return the label of connected device
716 * @param[in] data the pointer to the main data structure
717 * @param[in] obj the pointer to the evas object
718 * @param[in] part the pointer to the part of item
720 static char *_gl_multi_connect_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
723 struct ug_data *ugd = wfd_get_ug_data();
726 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
729 DBG(LOG_INFO, "%s", part);
731 if (!strcmp("elm.text", part) && ugd) {
732 if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_IN_PROGRESS)
733 return g_strdup(D_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
734 else if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_COMPLETED)
735 return g_strdup(D_("IDS_WIFI_SBODY_NOT_CONNECTED_M_STATUS_ABB"));
743 * This function let the ug get the title label of select all in multi connect
744 * @return the label of select all string
745 * @param[in] data the pointer to the main data structure
746 * @param[in] obj the pointer to the evas object
747 * @param[in] part the pointer to the part of item
749 static char *_gl_multi_connect_select_all_title_label_get(void *data, Evas_Object *obj, const char *part)
754 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
757 DBG(LOG_INFO, "%s", part);
759 if (!strcmp("elm.text", part)) {
761 return g_strdup(D_("IDS_WIFI_BODY_SELECT_ALL"));
768 * This function let the ug get the icon of select all genlist
769 * @return the icon of select all genlist
770 * @param[in] data the pointer to the main data structure
771 * @param[in] obj the pointer to the evas object
772 * @param[in] part the pointer to the part of item
774 static Evas_Object *_wfd_gl_select_all_icon_get(void *data, Evas_Object *obj, const char *part)
778 struct ug_data *ugd = (struct ug_data *) data;
779 Evas_Object *check = NULL;
780 Evas_Object *icon_layout = NULL;
782 DBG(LOG_INFO, "Part %s", part);
784 if (!strcmp("elm.swallow.end", part)) {
785 icon_layout = elm_layout_add(obj);
786 elm_layout_theme_set(icon_layout, "layout", "list/C/type.2", "default");
787 DBG(LOG_INFO, "Part %s", part);
788 check = elm_check_add(icon_layout);
789 ugd->select_all_icon = check;
790 if (ugd->is_select_all_checked == EINA_TRUE)
791 elm_check_state_set(ugd->select_all_icon, TRUE);
793 elm_object_style_set(check, "default/genlist");
794 evas_object_propagate_events_set(check, EINA_FALSE);
795 evas_object_smart_callback_add(check, "changed",
796 wfd_genlist_select_all_check_changed_cb, (void *)data);
797 elm_layout_content_set(icon_layout, "elm.swallow.content", check);
804 * This function let the ug get the title label of busy device list
805 * @return the label of connected device
806 * @param[in] data the pointer to the main data structure
807 * @param[in] obj the pointer to the evas object
808 * @param[in] part the pointer to the part of item
810 static char *_gl_busy_dev_title_label_get(void *data, Evas_Object *obj,
816 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
819 DBG(LOG_INFO, "%s", part);
821 if (!strcmp("elm.text", part))
822 return g_strdup(D_("IDS_ST_HEADER_BUSY_DEVICES"));
829 * This function let the ug get the label of busy device
830 * @return the label of connected device
831 * @param[in] data the pointer to the main data structure
832 * @param[in] obj the pointer to the evas object
833 * @param[in] part the pointer to the part of item
835 static char *_gl_peer_busy_dev_label_get(void *data, Evas_Object *obj, const char *part)
838 assertm_if(NULL == obj, "NULL!!");
839 assertm_if(NULL == part, "NULL!!");
840 device_type_s *peer = (device_type_s *) data;
841 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
843 DBG(LOG_INFO, "%s", part);
846 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
850 DBG(LOG_INFO, "peer->ssid = %s", peer->ssid);
852 if (!strcmp("elm.text", part)) {
853 if (strlen(peer->ssid) != 0) {
854 ssid = elm_entry_utf8_to_markup(peer->ssid);
856 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
863 } else if (!strcmp("elm.text.sub", part)) {
864 g_strlcpy(buf, D_("IDS_ST_BODY_CONNECTED_WITH_ANOTHER_DEVICE_ABB"),
865 WFD_GLOBALIZATION_STR_LENGTH);
867 return g_strdup(buf);
874 * This function let the ug delete the peer item
876 * @param[in] data the pointer to the main data structure
877 * @param[in] obj the pointer to the evas object
879 static void _gl_peer_del(void *data, Evas_Object *obj)
883 assertm_if(NULL == obj, "NULL!!");
884 assertm_if(NULL == data, "NULL!!");
891 * This function let the ug initialize the items of genlist
894 void initialize_gen_item_class()
896 elm_theme_extension_add(NULL, WFD_UG_EDJ_PATH);
898 device_name_itc.item_style = WFD_GENLIST_MULTILINE_TEXT_STYLE;
899 device_name_itc.func.text_get = _gl_device_name_label_get;
900 device_name_itc.func.content_get = NULL;
901 device_name_itc.func.state_get = NULL;
903 #ifdef WFD_ON_OFF_GENLIST
904 wfd_onoff_itc.item_style = WFD_GENLIST_2LINE_BOTTOM_TEXT_ICON_STYLE;
905 wfd_onoff_itc.func.text_get = _gl_wfd_onoff_text_get;
906 wfd_onoff_itc.func.content_get = _gl_wfd_onoff_content_get;
907 wfd_onoff_itc.func.state_get = NULL;
908 wfd_onoff_itc.func.del = NULL;
911 title_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
912 title_itc.func.text_get = _gl_title_label_get;
913 title_itc.func.content_get = _gl_title_content_get;
914 title_itc.func.state_get = NULL;
915 title_itc.func.del = NULL;
917 multi_view_title_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
918 multi_view_title_itc.func.text_get = _gl_multi_title_label_get;
919 multi_view_title_itc.func.content_get = _gl_multi_title_content_get;
920 multi_view_title_itc.func.state_get = NULL;
921 multi_view_title_itc.func.del = NULL;
923 title_no_device_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
924 title_no_device_itc.func.text_get = _gl_title_no_device_label_get;
925 title_no_device_itc.func.content_get = NULL;
926 title_no_device_itc.func.state_get = NULL;
927 title_no_device_itc.func.del = NULL;
929 title_available_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
930 title_available_itc.func.text_get = _gl_available_title_label_get;
931 title_available_itc.func.content_get = _gl_title_content_get;
932 title_available_itc.func.state_get = NULL;
933 title_available_itc.func.del = NULL;
935 peer_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
936 peer_itc.func.text_get = _gl_peer_label_get;
937 peer_itc.func.content_get = _gl_peer_icon_get;
938 peer_itc.func.state_get = NULL;
939 peer_itc.func.del = _gl_peer_del;
941 noitem_itc.item_style = WFD_GENLIST_1LINE_TEXT_STYLE;
942 noitem_itc.func.text_get = _gl_noitem_text_get;
943 noitem_itc.func.content_get = NULL;
944 noitem_itc.func.state_get = NULL;
945 noitem_itc.func.del = NULL;
947 title_conn_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
948 title_conn_itc.func.text_get = _gl_conn_dev_title_label_get;
949 title_conn_itc.func.content_get = NULL;
950 title_conn_itc.func.state_get = NULL;
951 title_conn_itc.func.del = NULL;
953 peer_conn_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
954 peer_conn_itc.func.text_get = _gl_peer_conn_dev_label_get;
955 peer_conn_itc.func.content_get = _gl_conn_peer_icon_get;
956 peer_conn_itc.func.state_get = NULL;
957 peer_conn_itc.func.del = _gl_peer_del;
959 title_conn_failed_itc.item_style = WFD_GENLIST_1LINE_TEXT_STYLE;
960 title_conn_failed_itc.func.text_get = _gl_conn_failed_dev_title_label_get;
961 title_conn_failed_itc.func.content_get = NULL;
962 title_conn_failed_itc.func.state_get = NULL;
963 title_conn_failed_itc.func.del = NULL;
965 peer_conn_failed_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
966 peer_conn_failed_itc.func.text_get = _gl_peer_conn_failed_dev_label_get;
967 peer_conn_failed_itc.func.content_get = _gl_peer_icon_get;
968 peer_conn_failed_itc.func.state_get = NULL;
969 peer_conn_failed_itc.func.del = _gl_peer_del;
971 title_busy_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
972 title_busy_itc.func.text_get = _gl_busy_dev_title_label_get;
973 title_busy_itc.func.content_get = NULL;
974 title_busy_itc.func.state_get = NULL;
975 title_busy_itc.func.del = NULL;
977 peer_busy_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
978 peer_busy_itc.func.text_get = _gl_peer_busy_dev_label_get;
979 peer_busy_itc.func.content_get = _gl_peer_icon_get;
980 peer_busy_itc.func.state_get = NULL;
981 peer_busy_itc.func.del = _gl_peer_del;
983 title_multi_connect_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
984 title_multi_connect_itc.func.text_get = _gl_multi_connect_dev_title_label_get;
985 title_multi_connect_itc.func.content_get = NULL;
986 title_multi_connect_itc.func.state_get = NULL;
987 title_multi_connect_itc.func.del = NULL;
989 select_all_multi_connect_itc.item_style = WFD_GENLIST_1LINE_TEXT_ICON_STYLE;
990 select_all_multi_connect_itc.func.text_get =
991 _gl_multi_connect_select_all_title_label_get;
992 select_all_multi_connect_itc.func.content_get = _wfd_gl_select_all_icon_get;
993 select_all_multi_connect_itc.func.state_get = NULL;
994 select_all_multi_connect_itc.func.del = NULL;