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);
674 * This function let the ug get the title label of connected failed device list
675 * @return the label of connected device
676 * @param[in] data the pointer to the main data structure
677 * @param[in] obj the pointer to the evas object
678 * @param[in] part the pointer to the part of item
680 static char *_gl_conn_failed_dev_title_label_get(void *data, Evas_Object *obj,
686 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
690 if (!strcmp("elm.text", part)) {
691 return g_strdup(D_("IDS_WIFI_SBODY_NOT_CONNECTED_M_STATUS_ABB"));
699 * This function let the ug get the label of connected failed device
700 * @return the label of connected device
701 * @param[in] data the pointer to the main data structure
702 * @param[in] obj the pointer to the evas object
703 * @param[in] part the pointer to the part of item
705 static char *_gl_peer_conn_failed_dev_label_get(void *data, Evas_Object *obj, const char *part)
709 assertm_if(NULL == obj, "NULL!!");
710 assertm_if(NULL == part, "NULL!!");
711 device_type_s *peer = (device_type_s *) data;
712 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
714 DBG(LOG_INFO, "%s", part);
717 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
721 if (!strcmp("elm.text", part)) {
722 if (strlen(peer->ssid) != 0) {
723 ssid = elm_entry_utf8_to_markup(peer->ssid);
725 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
732 } else if (!strcmp("elm.text.sub", part)) {
733 g_strlcpy(buf, D_("IDS_CHATON_HEADER_CONNECTION_FAILED_ABB2"),
734 WFD_GLOBALIZATION_STR_LENGTH);
736 return g_strdup(buf);
742 * This function let the ug get the title label of multi connect list
743 * @return the label of connected device
744 * @param[in] data the pointer to the main data structure
745 * @param[in] obj the pointer to the evas object
746 * @param[in] part the pointer to the part of item
748 static char *_gl_multi_connect_dev_title_label_get(void *data, Evas_Object *obj, const char *part)
751 struct ug_data *ugd = wfd_get_ug_data();
754 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
757 DBG(LOG_INFO, "%s", part);
759 if (!strcmp("elm.text", part)) {
760 if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_IN_PROGRESS) {
761 return g_strdup(D_("IDS_WIFI_HEADER_AVAILABLE_DEVICES_ABB"));
762 } else if (ugd->multi_connect_mode == WFD_MULTI_CONNECT_MODE_COMPLETED) {
763 return g_strdup(D_("IDS_WIFI_SBODY_NOT_CONNECTED_M_STATUS_ABB"));
772 * This function let the ug get the title label of select all in multi connect
773 * @return the label of select all string
774 * @param[in] data the pointer to the main data structure
775 * @param[in] obj the pointer to the evas object
776 * @param[in] part the pointer to the part of item
778 static char *_gl_multi_connect_select_all_title_label_get(void *data, Evas_Object *obj, const char *part)
783 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
786 DBG(LOG_INFO, "%s", part);
788 if (!strcmp("elm.text", part)) {
790 return g_strdup(D_("IDS_WIFI_BODY_SELECT_ALL"));
797 * This function let the ug get the icon of select all genlist
798 * @return the icon of select all genlist
799 * @param[in] data the pointer to the main data structure
800 * @param[in] obj the pointer to the evas object
801 * @param[in] part the pointer to the part of item
803 static Evas_Object *_wfd_gl_select_all_icon_get(void *data, Evas_Object *obj, const char *part)
807 struct ug_data *ugd = (struct ug_data *) data;
808 Evas_Object *check = NULL;
809 Evas_Object *icon_layout = NULL;
811 DBG(LOG_INFO, "Part %s", part);
813 if (!strcmp("elm.swallow.end", part)) {
814 icon_layout = elm_layout_add(obj);
815 elm_layout_theme_set(icon_layout, "layout", "list/C/type.2", "default");
816 DBG(LOG_INFO, "Part %s", part);
817 check = elm_check_add(icon_layout);
818 ugd->select_all_icon = check;
819 if (ugd->is_select_all_checked == EINA_TRUE) {
820 elm_check_state_set(ugd->select_all_icon, TRUE);
822 elm_object_style_set(check, "default/genlist");
823 evas_object_propagate_events_set(check, EINA_FALSE);
824 evas_object_smart_callback_add(check, "changed",
825 wfd_genlist_select_all_check_changed_cb, (void *)data);
826 elm_layout_content_set(icon_layout, "elm.swallow.content", check);
833 * This function let the ug get the title label of busy device list
834 * @return the label of connected device
835 * @param[in] data the pointer to the main data structure
836 * @param[in] obj the pointer to the evas object
837 * @param[in] part the pointer to the part of item
839 static char *_gl_busy_dev_title_label_get(void *data, Evas_Object *obj,
845 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
848 DBG(LOG_INFO, "%s", part);
850 if (!strcmp("elm.text", part)) {
851 return g_strdup(D_("IDS_ST_HEADER_BUSY_DEVICES"));
859 * This function let the ug get the label of busy device
860 * @return the label of connected device
861 * @param[in] data the pointer to the main data structure
862 * @param[in] obj the pointer to the evas object
863 * @param[in] part the pointer to the part of item
865 static char *_gl_peer_busy_dev_label_get(void *data, Evas_Object *obj, const char *part)
868 assertm_if(NULL == obj, "NULL!!");
869 assertm_if(NULL == part, "NULL!!");
870 device_type_s *peer = (device_type_s *) data;
871 char buf[WFD_GLOBALIZATION_STR_LENGTH] = { 0, };
873 DBG(LOG_INFO, "%s", part);
876 DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
880 DBG(LOG_INFO, "peer->ssid = %s", peer->ssid);
882 if (!strcmp("elm.text", part)) {
883 if (strlen(peer->ssid) != 0) {
884 ssid = elm_entry_utf8_to_markup(peer->ssid);
886 DBG(LOG_ERROR, "elm_entry_utf8_to_markup failed.\n");
893 } else if (!strcmp("elm.text.sub", part)) {
894 g_strlcpy(buf, D_("IDS_ST_BODY_CONNECTED_WITH_ANOTHER_DEVICE_ABB"),
895 WFD_GLOBALIZATION_STR_LENGTH);
897 return g_strdup(buf);
904 * This function let the ug delete the peer item
906 * @param[in] data the pointer to the main data structure
907 * @param[in] obj the pointer to the evas object
909 static void _gl_peer_del(void *data, Evas_Object *obj)
913 assertm_if(NULL == obj, "NULL!!");
914 assertm_if(NULL == data, "NULL!!");
921 * This function let the ug initialize the items of genlist
924 void initialize_gen_item_class()
926 elm_theme_extension_add(NULL, WFD_UG_EDJ_PATH);
928 device_name_itc.item_style = WFD_GENLIST_MULTILINE_TEXT_STYLE;
929 device_name_itc.func.text_get = _gl_device_name_label_get;
930 device_name_itc.func.content_get = NULL;
931 device_name_itc.func.state_get = NULL;
933 #ifdef WFD_ON_OFF_GENLIST
934 wfd_onoff_itc.item_style = WFD_GENLIST_2LINE_BOTTOM_TEXT_ICON_STYLE;
935 wfd_onoff_itc.func.text_get = _gl_wfd_onoff_text_get;
936 wfd_onoff_itc.func.content_get = _gl_wfd_onoff_content_get;
937 wfd_onoff_itc.func.state_get = NULL;
938 wfd_onoff_itc.func.del = NULL;
941 title_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
942 title_itc.func.text_get = _gl_title_label_get;
943 title_itc.func.content_get = _gl_title_content_get;
944 title_itc.func.state_get = NULL;
945 title_itc.func.del = NULL;
947 multi_view_title_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
948 multi_view_title_itc.func.text_get = _gl_multi_title_label_get;
949 multi_view_title_itc.func.content_get = _gl_multi_title_content_get;
950 multi_view_title_itc.func.state_get = NULL;
951 multi_view_title_itc.func.del = NULL;
953 title_no_device_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
954 title_no_device_itc.func.text_get = _gl_title_no_device_label_get;
955 title_no_device_itc.func.content_get = NULL;
956 title_no_device_itc.func.state_get = NULL;
957 title_no_device_itc.func.del = NULL;
959 title_available_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
960 title_available_itc.func.text_get = _gl_available_title_label_get;
961 title_available_itc.func.content_get = _gl_title_content_get;
962 title_available_itc.func.state_get = NULL;
963 title_available_itc.func.del = NULL;
965 peer_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
966 peer_itc.func.text_get = _gl_peer_label_get;
967 peer_itc.func.content_get = _gl_peer_icon_get;
968 peer_itc.func.state_get = NULL;
969 peer_itc.func.del = _gl_peer_del;
971 noitem_itc.item_style = WFD_GENLIST_1LINE_TEXT_STYLE;
972 noitem_itc.func.text_get = _gl_noitem_text_get;
973 noitem_itc.func.content_get = NULL;
974 noitem_itc.func.state_get = NULL;
975 noitem_itc.func.del = NULL;
977 title_conn_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
978 title_conn_itc.func.text_get = _gl_conn_dev_title_label_get;
979 title_conn_itc.func.content_get = NULL;
980 title_conn_itc.func.state_get = NULL;
981 title_conn_itc.func.del = NULL;
983 peer_conn_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
984 peer_conn_itc.func.text_get = _gl_peer_conn_dev_label_get;
985 peer_conn_itc.func.content_get = _gl_conn_peer_icon_get;
986 peer_conn_itc.func.state_get = NULL;
987 peer_conn_itc.func.del = _gl_peer_del;
989 title_conn_failed_itc.item_style = WFD_GENLIST_1LINE_TEXT_STYLE;
990 title_conn_failed_itc.func.text_get = _gl_conn_failed_dev_title_label_get;
991 title_conn_failed_itc.func.content_get = NULL;
992 title_conn_failed_itc.func.state_get = NULL;
993 title_conn_failed_itc.func.del = NULL;
995 peer_conn_failed_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
996 peer_conn_failed_itc.func.text_get = _gl_peer_conn_failed_dev_label_get;
997 peer_conn_failed_itc.func.content_get = _gl_peer_icon_get;
998 peer_conn_failed_itc.func.state_get = NULL;
999 peer_conn_failed_itc.func.del = _gl_peer_del;
1001 title_busy_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
1002 title_busy_itc.func.text_get = _gl_busy_dev_title_label_get;
1003 title_busy_itc.func.content_get = NULL;
1004 title_busy_itc.func.state_get = NULL;
1005 title_busy_itc.func.del = NULL;
1007 peer_busy_itc.item_style = WFD_GENLIST_2LINE_TOP_TEXT_ICON_STYLE;
1008 peer_busy_itc.func.text_get = _gl_peer_busy_dev_label_get;
1009 peer_busy_itc.func.content_get = _gl_peer_icon_get;
1010 peer_busy_itc.func.state_get = NULL;
1011 peer_busy_itc.func.del = _gl_peer_del;
1013 title_multi_connect_itc.item_style = WFD_GENLIST_GROUP_INDEX_STYLE;
1014 title_multi_connect_itc.func.text_get = _gl_multi_connect_dev_title_label_get;
1015 title_multi_connect_itc.func.content_get = NULL;
1016 title_multi_connect_itc.func.state_get = NULL;
1017 title_multi_connect_itc.func.del = NULL;
1019 select_all_multi_connect_itc.item_style = WFD_GENLIST_1LINE_TEXT_ICON_STYLE;
1020 select_all_multi_connect_itc.func.text_get =
1021 _gl_multi_connect_select_all_title_label_get;
1022 select_all_multi_connect_itc.func.content_get = _wfd_gl_select_all_icon_get;
1023 select_all_multi_connect_itc.func.state_get = NULL;
1024 select_all_multi_connect_itc.func.del = NULL;