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.
21 #include <vconf-keys.h>
22 #include <app_control_internal.h>
23 #include <efl_extension.h>
26 #include "view_advanced.h"
27 #include "i18nmanager.h"
28 #include "viewer_manager.h"
29 #include "winset_popup.h"
30 #include "common_utils.h"
32 #define VCONF_SLEEP_POLICY "file/private/wifi/sleep_policy"
33 #define VCONF_SMART_SWITCHING "file/private/wifi/smart_switching"
34 #define VCONF_SMART_SWITCH_CB "file/private/wifi/smart_switch_checkbox"
37 VCONF_SMART_SWITCH_OFF = 0x00,
38 VCONF_SMART_SWITCH_ON,
39 } VCONF_SMART_SWITCH_OPTIONS;
41 struct _private_data {
43 Elm_Object_Item *item_smart_switch;
44 Evas_Object *smart_popup;
45 Elm_Object_Item *item_network_noti;
46 Elm_Object_Item *item_keep_wifi_switch;
47 Evas_Object *keep_wifi_radio_group;
48 Evas_Object *keep_wifi_popup;
50 Elm_Object_Item *item_sort_by;
51 Evas_Object *sort_by_radio_group;
52 Evas_Object *sort_by_popup;
54 Elm_Object_Item *item_install_cert;
57 struct _private_data g_pd;
60 static char *_gl_network_notification_text_get(void *data, Evas_Object *obj, const char *part);
61 static char *_gl_sort_by_text_get(void *data, Evas_Object *obj, const char *part);
62 static char *_gl_sort_by_sub_text_get(void *data, Evas_Object *obj, const char *part);
63 static Evas_Object *_gl_content_get_network_noti(void *data, Evas_Object *obj, const char *part);
64 static Evas_Object *_gl_content_get_sort_by_sub(void *data, Evas_Object *obj, const char *part);
65 static char *_gl_install_certificate_text_get(void *data, Evas_Object *obj, const char *part);
66 #if TIZEN_SLEEP_POLICY
67 static char *_gl_text_get(void *data, Evas_Object *obj, const char *part);
68 static char *_gl_never_text_get(void *data, Evas_Object *obj,const char *part);
69 static char *_gl_keep_wifi_on_during_sleep_text_get(void *data, Evas_Object *obj,const char *part);
70 static Evas_Object *_gl_content_get_keep_wifi_sub(void *data, Evas_Object *obj, const char *part);
73 /* Global variables for elm_genlist itc */
74 static Elm_Genlist_Item_Class itc_network_noti = {
75 .item_style = WIFI_GENLIST_MULTILINE_TEXT_STYLE,
76 .func.text_get = _gl_network_notification_text_get,
77 .func.content_get = _gl_content_get_network_noti
80 #if TIZEN_SLEEP_POLICY
81 static Elm_Genlist_Item_Class itc_keep_wifi = {
82 .item_style = WIFI_GENLIST_2LINE_TOP_TEXT_STYLE,
83 .func.text_get = _gl_keep_wifi_on_during_sleep_text_get,
86 static Elm_Genlist_Item_Class itc_keep_wifi_sub = {
87 .item_style = WIFI_GENLIST_1LINE_TEXT_ICON_STYLE,
88 .func.text_get = _gl_text_get,
89 .func.content_get = _gl_content_get_keep_wifi_sub,
92 static Elm_Genlist_Item_Class itc_keep_wifi_sub_never = {
93 .item_style = WIFI_GENLIST_2LINE_TOP_TEXT_ICON_STYLE,
94 .func.text_get = _gl_never_text_get,
95 .func.content_get = _gl_content_get_keep_wifi_sub,
99 static Elm_Genlist_Item_Class itc_sort_by = {
100 .item_style = WIFI_GENLIST_2LINE_TOP_TEXT_STYLE,
101 .func.text_get = _gl_sort_by_text_get,
104 static Elm_Genlist_Item_Class itc_sort_by_sub = {
105 .item_style = WIFI_GENLIST_1LINE_TEXT_ICON_STYLE,
106 .func.text_get = _gl_sort_by_sub_text_get,
107 .func.content_get = _gl_content_get_sort_by_sub,
110 static Elm_Genlist_Item_Class itc_install_cert = {
111 .item_style = WIFI_GENLIST_1LINE_TEXT_STYLE,
112 .func.text_get = _gl_install_certificate_text_get,
115 static char *_gl_install_certificate_text_get(void *data, Evas_Object *obj,
120 if (!strcmp("elm.text", part)) {
121 snprintf(buf, 1023, "%s", sc(PACKAGE, I18N_TYPE_Install_certificate));
127 static void _launch_cert_select_app(void)
129 int ret = APP_CONTROL_ERROR_NONE;
130 app_control_h app_control;
132 app_control_create(&app_control);
133 app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
134 app_control_set_window(app_control, elm_win_xwindow_get(ug_get_window()));
135 app_control_set_app_id(app_control, "setting-manage-certificates-efl");
137 ret = app_control_send_launch_request(app_control, NULL, NULL);
138 if(ret == APP_CONTROL_ERROR_NONE) {
139 INFO_LOG(UG_NAME_NORMAL, "Launch Cert Success");
141 ERROR_LOG(UG_NAME_NORMAL, "Fail to launch Cert");
144 app_control_destroy(app_control);
147 static void _gl_cert_sel_cb(void *data, Evas_Object *obj, void *event_info)
149 _launch_cert_select_app();
151 elm_genlist_item_selected_set(g_pd.item_install_cert, EINA_FALSE);
154 #if TIZEN_SLEEP_POLICY
155 static int _convert_wifi_keep_value_to_vconf(int i18n_key)
158 case I18N_TYPE_Always:
161 case I18N_TYPE_Plugged:
164 case I18N_TYPE_Donot_Use:
171 static int _convert_vconf_to_wifi_keep_value(int vconf_value)
173 switch (vconf_value) {
175 return I18N_TYPE_Always;
178 return I18N_TYPE_Plugged;
181 return I18N_TYPE_Donot_Use;
188 int _convert_sort_by_value_to_vconf(int i18n_key)
191 case I18N_TYPE_Alphabetical:
194 case I18N_TYPE_Signal_Strength:
201 int _convert_vconf_to_sort_by_value(int vconf_value)
203 switch (vconf_value) {
205 return I18N_TYPE_Alphabetical;
208 return I18N_TYPE_Signal_Strength;
214 static char *_gl_sort_by_text_get(void *data, Evas_Object *obj,
218 if (!strcmp("elm.text", part)) {
219 if ((int) data != 0) {
220 snprintf(buf, 1023, "%s", sc(PACKAGE, (int) data));
223 } else if (!strcmp("elm.text.sub", part)) {
226 value = _convert_vconf_to_sort_by_value(
227 common_util_get_system_registry(VCONF_SORT_BY));
229 snprintf(buf, 1023, "%s", sc(PACKAGE, value));
237 static char *_gl_sort_by_sub_text_get(void *data, Evas_Object *obj, const char *part)
240 if (!strcmp("elm.text", part)) {
241 if ((int) data != 0) {
242 snprintf(buf, 1023, "%s", sc(PACKAGE, (int) data));
249 static char *_gl_network_notification_text_get(void *data, Evas_Object *obj, const char *part)
253 if (!strcmp("elm.text", part)) {
254 snprintf(buf, 1023, "%s", sc(PACKAGE, I18N_TYPE_Network_notification));
256 } else if (!strcmp("elm.text.multiline", part)) {
257 snprintf(buf, 1023, "<font_size=30>%s</font_size>",
258 sc(PACKAGE, I18N_TYPE_Network_notify_me_later));
264 #if TIZEN_SLEEP_POLICY
265 static char *_gl_text_get(void *data, Evas_Object *obj,
269 if (!strcmp("elm.text", part)) {
270 if ((int) data != 0) {
271 snprintf(buf, 1023, "%s", sc(PACKAGE, (int) data));
279 static char *_gl_keep_wifi_on_during_sleep_text_get(void *data, Evas_Object *obj, const char *part)
283 if (!strcmp("elm.text", part)) {
284 snprintf(buf, 1023, "%s", sc(PACKAGE, I18N_TYPE_Keep_WIFI_on_during_sleep));
286 } else if (!strcmp("elm.text.sub", part)) {
288 value = _convert_vconf_to_wifi_keep_value(
289 common_util_get_system_registry(VCONF_SLEEP_POLICY));
291 if (value == I18N_TYPE_Donot_Use) {
292 snprintf(buf, 1023, "%s", sc(PACKAGE, I18N_TYPE_Donot_Use));
295 snprintf(buf, 1023, "%s", sc(PACKAGE, value));
303 static char *_gl_never_text_get(void *data, Evas_Object *obj,
306 if (!strcmp("elm.text", part)) {
307 return g_strdup(sc(PACKAGE, I18N_TYPE_Donot_Use));
308 } else if (!strcmp("elm.text.sub", part)) {
309 return g_strdup(sc(PACKAGE, I18N_TYPE_Increases_Data_Usage));
316 static void _gl_changed_network_noti(void *data, Evas_Object *obj,
320 const char *object_type;
322 __COMMON_FUNC_ENTER__;
324 object_type = evas_object_type_get(obj);
326 INFO_LOG(UG_NAME_SCAN, "object_type is NULL");
330 value = common_util_get_system_registry(VCONFKEY_WIFI_ENABLE_QS);
332 if (g_strcmp0(object_type, "elm_check") == 0) {
333 Eina_Bool check_enable = elm_check_state_get(obj);
335 if (check_enable == TRUE) {
336 value = VCONFKEY_WIFI_QS_ENABLE;
338 value = VCONFKEY_WIFI_QS_DISABLE;
340 } else if (g_strcmp0(object_type, "elm_genlist") == 0) {
341 if (value == VCONFKEY_WIFI_QS_ENABLE) {
342 value = VCONFKEY_WIFI_QS_DISABLE;
344 value = VCONFKEY_WIFI_QS_ENABLE;
348 common_util_set_system_registry(VCONFKEY_WIFI_ENABLE_QS, value);
350 if(g_pd.item_network_noti != NULL)
351 elm_genlist_item_update(g_pd.item_network_noti);
352 elm_genlist_item_selected_set(g_pd.item_network_noti, EINA_FALSE);
354 __COMMON_FUNC_EXIT__;
357 static Evas_Object *_gl_content_get_network_noti(void *data,
358 Evas_Object *obj, const char *part)
360 Evas_Object *toggle_btn = NULL;
363 if (!strcmp("elm.swallow.end", part)) {
364 toggle_btn = elm_check_add(obj);
365 evas_object_size_hint_align_set(toggle_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
366 evas_object_size_hint_weight_set(toggle_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
368 elm_object_style_set(toggle_btn, "on&off");
369 evas_object_propagate_events_set(toggle_btn, EINA_FALSE);
370 #ifdef ACCESSIBLITY_FEATURE
371 Evas_Object *ao = NULL;
373 ao = elm_object_item_access_object_get(g_pd.item_network_noti);
375 g_snprintf(buf, sizeof(buf), "%s%s%s",
376 sc(PACKAGE, I18N_TYPE_On),
377 sc(PACKAGE, I18N_TYPE_Off),
378 sc(PACKAGE, I18N_TYPE_Button));
379 elm_access_info_set(ao, ELM_ACCESS_TYPE, buf);
382 ret = common_util_get_system_registry(VCONFKEY_WIFI_ENABLE_QS);
385 #ifdef ACCESSIBLITY_FEATURE
387 elm_access_info_set(ao, ELM_ACCESS_STATE,
388 sc(PACKAGE, I18N_TYPE_On));
390 elm_check_state_set(toggle_btn, EINA_TRUE);
391 evas_object_smart_callback_add(toggle_btn, "changed",
392 _gl_changed_network_noti, NULL);
395 #ifdef ACCESSIBLITY_FEATURE
397 elm_access_info_set(ao, ELM_ACCESS_STATE,
398 sc(PACKAGE, I18N_TYPE_Off));
400 elm_check_state_set(toggle_btn, EINA_FALSE);
401 evas_object_smart_callback_add(toggle_btn, "changed",
402 _gl_changed_network_noti, NULL);
405 ERROR_LOG(COMMON_NAME_ERR, "Setting fail!!");
412 #if TIZEN_SLEEP_POLICY
413 static void _gl_changed_keep_wifi_sub(void *data, Evas_Object *obj,
416 Elm_Object_Item *item;
417 const char *object_type;
419 Elm_Object_Item *parent = NULL;
421 __COMMON_FUNC_ENTER__;
423 item = (Elm_Object_Item *) event_info;
424 object_type = evas_object_type_get(obj);
426 INFO_LOG(UG_NAME_SCAN, "object_type is NULL");
430 value = _convert_wifi_keep_value_to_vconf((int) data);
433 common_util_set_system_registry(VCONF_SLEEP_POLICY, value);
436 if (g_strcmp0(object_type, "elm_genlist") == 0) {
437 elm_radio_value_set(g_pd.keep_wifi_radio_group, (int) data);
441 elm_genlist_item_update(item);
442 elm_genlist_item_selected_set(item, EINA_FALSE);
444 parent = elm_genlist_item_parent_get(item);
446 elm_genlist_item_update(parent);
449 if(g_pd.item_keep_wifi_switch != NULL)
450 elm_genlist_item_update(g_pd.item_keep_wifi_switch);
452 evas_object_del(g_pd.keep_wifi_popup);
453 __COMMON_FUNC_EXIT__;
456 static Evas_Object *_gl_content_get_keep_wifi_sub(void *data,
457 Evas_Object *obj, const char *part)
459 __COMMON_FUNC_ENTER__;
462 Evas_Object *content = NULL;
464 if (!g_pd.keep_wifi_radio_group) {
465 g_pd.keep_wifi_radio_group = elm_radio_add(obj);
466 elm_radio_state_value_set (g_pd.keep_wifi_radio_group, -1);
469 if (!strcmp("elm.swallow.end", part)) {
470 content = elm_layout_add(obj);
472 elm_layout_theme_set(content, "layout", "list/C/type.2", "default");
473 radio = elm_radio_add(content);
474 #ifdef ACCESSIBLITY_FEATURE
475 elm_access_object_unregister(radio);
477 elm_radio_state_value_set(radio, (int) data);
478 elm_radio_group_add(radio, g_pd.keep_wifi_radio_group);
480 elm_layout_content_set(content, "elm.swallow.content", radio);
482 value = _convert_vconf_to_wifi_keep_value(
483 common_util_get_system_registry(VCONF_SLEEP_POLICY));
484 if (value == (int) data) {
485 elm_radio_value_set(g_pd.keep_wifi_radio_group, (int) data);
488 evas_object_smart_callback_add(radio, "changed", _gl_changed_keep_wifi_sub, data);
491 __COMMON_FUNC_EXIT__;
496 static void _gl_changed_sort_by_sub(void *data, Evas_Object *obj,
499 Elm_Object_Item *item;
500 const char *object_type;
502 Elm_Object_Item *parent = NULL;
504 __COMMON_FUNC_ENTER__;
506 item = (Elm_Object_Item *) event_info;
507 object_type = evas_object_type_get(obj);
509 INFO_LOG(UG_NAME_SCAN, "object_type is NULL");
513 value = _convert_sort_by_value_to_vconf((int) data);
515 common_util_set_system_registry(VCONF_SORT_BY, value);
518 if (g_strcmp0(object_type, "elm_genlist") == 0) {
519 elm_radio_value_set(g_pd.sort_by_radio_group, (int) data);
523 elm_genlist_item_update(item);
524 elm_genlist_item_selected_set(item, EINA_FALSE);
526 parent = elm_genlist_item_parent_get(item);
528 elm_genlist_item_update(parent);
531 if(g_pd.item_sort_by != NULL)
532 elm_genlist_item_update(g_pd.item_sort_by);
534 evas_object_del(g_pd.sort_by_popup);
536 __COMMON_FUNC_EXIT__;
539 static Evas_Object *_gl_content_get_sort_by_sub(void *data,
540 Evas_Object *obj, const char *part)
542 __COMMON_FUNC_ENTER__;
546 Evas_Object *content = NULL;
548 if (!g_pd.sort_by_radio_group) {
549 g_pd.sort_by_radio_group = elm_radio_add(obj);
550 elm_radio_state_value_set (g_pd.sort_by_radio_group, -1);
553 if (!strcmp("elm.swallow.end", part)) {
554 content = elm_layout_add(obj);
556 elm_layout_theme_set(content, "layout", "list/C/type.2", "default");
557 radio = elm_radio_add(content);
558 #ifdef ACCESSIBLITY_FEATURE
559 elm_access_object_unregister(radio);
561 elm_radio_state_value_set(radio, (int) data);
562 elm_radio_group_add(radio, g_pd.sort_by_radio_group);
564 elm_layout_content_set(content, "elm.swallow.content", radio);
566 value = _convert_vconf_to_sort_by_value(
567 common_util_get_system_registry(VCONF_SORT_BY));
569 if (value == (int) data) {
570 elm_radio_value_set(g_pd.sort_by_radio_group, (int) data);
573 evas_object_smart_callback_add(radio, "changed",
574 _gl_changed_sort_by_sub, data);
577 __COMMON_FUNC_EXIT__;
581 static void _block_clicked_cb(void *data, Evas_Object *obj,
584 Evas_Object *popup = (Evas_Object *)data;
587 evas_object_del(popup);
591 #if TIZEN_SLEEP_POLICY
592 static void _gl_keep_wifi(void *data, Evas_Object *obj, void *event_info)
594 __COMMON_FUNC_ENTER__;
595 Evas_Object *genlist;
597 g_pd.keep_wifi_popup = elm_popup_add(obj);
598 eext_object_event_callback_add(g_pd.keep_wifi_popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL);
599 elm_object_domain_translatable_part_text_set(g_pd.keep_wifi_popup,
600 "title,text", PACKAGE, "IDS_ST_BODY_KEEP_WI_FI_ON_DURING_SLEEP");
601 elm_popup_align_set(g_pd.keep_wifi_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
602 evas_object_size_hint_weight_set(g_pd.keep_wifi_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
603 evas_object_smart_callback_add(g_pd.keep_wifi_popup, "block,clicked",
604 _block_clicked_cb, g_pd.keep_wifi_popup);
607 genlist = elm_genlist_add(g_pd.keep_wifi_popup);
608 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
609 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
610 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
611 elm_scroller_content_min_limit(genlist, EINA_FALSE, EINA_TRUE);
614 g_pd.keep_wifi_radio_group = elm_radio_add(genlist);
615 evas_object_data_set(genlist, "radio", g_pd.keep_wifi_radio_group);
617 elm_genlist_item_append(genlist, &itc_keep_wifi_sub,
618 (const void *) I18N_TYPE_Always, NULL, ELM_GENLIST_ITEM_NONE,
619 _gl_changed_keep_wifi_sub, (const void *)I18N_TYPE_Always);
621 elm_genlist_item_append(genlist, &itc_keep_wifi_sub,
622 (const void *) I18N_TYPE_Plugged, NULL, ELM_GENLIST_ITEM_NONE,
623 _gl_changed_keep_wifi_sub, (const void *)I18N_TYPE_Plugged);
625 elm_genlist_item_append(genlist, &itc_keep_wifi_sub_never,
626 (const void *) I18N_TYPE_Donot_Use, NULL, ELM_GENLIST_ITEM_NONE,
627 _gl_changed_keep_wifi_sub, (const void *)I18N_TYPE_Donot_Use);
629 evas_object_show(genlist);
630 elm_object_content_set(g_pd.keep_wifi_popup, genlist);
631 evas_object_show(g_pd.keep_wifi_popup);
633 elm_genlist_item_selected_set(g_pd.item_keep_wifi_switch, EINA_FALSE);
634 __COMMON_FUNC_EXIT__;
638 static void _gl_sort_by(void *data, Evas_Object *obj, void *event_info)
640 __COMMON_FUNC_ENTER__;
641 Evas_Object *genlist = NULL;
643 g_pd.sort_by_popup = elm_popup_add(obj);
644 eext_object_event_callback_add(g_pd.sort_by_popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL);
645 elm_object_domain_translatable_part_text_set(g_pd.sort_by_popup,
646 "title,text", PACKAGE, "IDS_WIFI_BODY_SORT_BY");
647 elm_popup_align_set(g_pd.sort_by_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
648 evas_object_size_hint_weight_set(g_pd.sort_by_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
649 evas_object_smart_callback_add(g_pd.sort_by_popup, "block,clicked",
650 _block_clicked_cb, g_pd.sort_by_popup);
653 genlist = elm_genlist_add(g_pd.sort_by_popup);
654 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
655 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
656 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
657 elm_scroller_content_min_limit(genlist, EINA_FALSE, EINA_TRUE);
660 g_pd.sort_by_radio_group = elm_radio_add(genlist);
661 evas_object_data_set(genlist, "radio", g_pd.sort_by_radio_group);
663 elm_genlist_item_append(genlist, &itc_sort_by_sub,
664 (const void *) I18N_TYPE_Alphabetical, NULL, ELM_GENLIST_ITEM_NONE,
665 _gl_changed_sort_by_sub, (const void *)I18N_TYPE_Alphabetical);
667 elm_genlist_item_append(genlist, &itc_sort_by_sub,
668 (const void *) I18N_TYPE_Signal_Strength, NULL, ELM_GENLIST_ITEM_NONE,
669 _gl_changed_sort_by_sub, (const void *)I18N_TYPE_Signal_Strength);
671 evas_object_show(genlist);
672 elm_object_content_set(g_pd.sort_by_popup, genlist);
673 evas_object_show(g_pd.sort_by_popup);
675 elm_genlist_item_selected_set(g_pd.item_sort_by, EINA_FALSE);
676 __COMMON_FUNC_EXIT__;
679 static Evas_Object *_create_list(Evas_Object *parent)
684 vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
685 INFO_LOG(UG_NAME_NORMAL, "Wi-Fi state %d", wifi_state);
687 gl = elm_genlist_add(parent);
688 assertm_if(NULL == gl, "NULL!!");
690 elm_object_style_set(gl, "dialogue");
691 elm_genlist_mode_set(gl, ELM_LIST_LIMIT);
693 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
694 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
696 elm_genlist_mode_set(gl, ELM_LIST_COMPRESS);
698 /* Network Notification */
699 g_pd.item_network_noti = elm_genlist_item_append(gl, &itc_network_noti,
700 (const void *) I18N_TYPE_Network_notification, NULL,
701 ELM_GENLIST_ITEM_NONE, _gl_changed_network_noti, NULL);
703 #if TIZEN_SLEEP_POLICY
704 /* Keep WI-FI on during sleep */
705 g_pd.item_keep_wifi_switch = elm_genlist_item_append(gl, &itc_keep_wifi,
706 (const void *) I18N_TYPE_Keep_WIFI_on_during_sleep, NULL,
707 ELM_GENLIST_ITEM_NONE, _gl_keep_wifi, NULL);
711 g_pd.item_sort_by= elm_genlist_item_append(gl, &itc_sort_by,
712 (const void *) I18N_TYPE_Sort_by, NULL,
713 ELM_GENLIST_ITEM_NONE, _gl_sort_by, NULL);
715 /* Install Certificate */
716 g_pd.item_install_cert = elm_genlist_item_append(gl, &itc_install_cert,
717 NULL, NULL, ELM_GENLIST_ITEM_NONE, _gl_cert_sel_cb, NULL);
719 evas_object_show(gl);
724 static void __vconf_noti_change_cb(keynode_t *node, void *user_data)
728 vconf_get_int(VCONFKEY_WIFI_ENABLE_QS, &state);
729 INFO_LOG(UG_NAME_NORMAL, "New notification option - %d", state);
731 if (g_pd.item_network_noti != NULL) {
732 elm_genlist_item_update(g_pd.item_network_noti);
736 static void __vconf_sleep_change_cb(keynode_t *node, void *user_data)
740 vconf_get_int(VCONF_SLEEP_POLICY, &state);
741 INFO_LOG(UG_NAME_NORMAL, "New sleep policy - %d", state);
743 if (g_pd.item_keep_wifi_switch != NULL) {
744 elm_genlist_item_update(g_pd.item_keep_wifi_switch);
748 static void __vconf_sort_change_cb(keynode_t *node, void *user_data)
752 vconf_get_int(VCONF_SORT_BY, &state);
753 INFO_LOG(UG_NAME_NORMAL, "New sort by option - %d", state);
755 if (g_pd.item_sort_by != NULL) {
756 elm_genlist_item_update(g_pd.item_sort_by);
760 static void __vconf_smart_switch_change_cb(keynode_t *node, void *user_data)
764 vconf_get_int(VCONF_SMART_SWITCHING, &state);
765 INFO_LOG(UG_NAME_NORMAL, "New smart switch option - %d", state);
767 if (g_pd.item_smart_switch != NULL) {
768 elm_genlist_item_update(g_pd.item_smart_switch);
772 static Eina_Bool __back_key_cb(void *data, Elm_Object_Item *it)
774 __COMMON_FUNC_ENTER__;
776 /* Delete vconf listeners for the different options */
777 vconf_ignore_key_changed(VCONFKEY_WIFI_ENABLE_QS, __vconf_noti_change_cb);
778 vconf_ignore_key_changed(VCONF_SLEEP_POLICY, __vconf_sleep_change_cb);
779 vconf_ignore_key_changed(VCONF_SORT_BY, __vconf_sort_change_cb);
780 vconf_ignore_key_changed(VCONF_SMART_SWITCHING,
781 __vconf_smart_switch_change_cb);
783 __COMMON_FUNC_EXIT__;
788 void view_advanced(void)
790 Evas_Object *layout = NULL;
791 Evas_Object *navi_frame = NULL;
792 Elm_Object_Item *navi_it = NULL;
795 __COMMON_FUNC_ENTER__;
797 memset (&g_pd, 0, sizeof(struct _private_data));
799 navi_frame = viewer_manager_get_naviframe();
800 if (navi_frame == NULL) {
801 ERROR_LOG(UG_NAME_NORMAL, "Failed to get naviframe");
805 layout = common_utils_create_layout(navi_frame);
806 evas_object_show(layout);
808 g_pd.list = _create_list(layout);
809 assertm_if(NULL == g_pd.list, "_create_list failed");
811 elm_object_part_content_set(layout, "elm.swallow.content", g_pd.list);
813 g_strlcpy(title, "IDS_WIFI_BODY_ADVANCED_SETTINGS", sizeof(title));
814 navi_it = elm_naviframe_item_push(navi_frame, title, NULL, NULL,
816 elm_object_item_domain_text_translatable_set(navi_it, PACKAGE, EINA_TRUE);
818 evas_object_data_set(navi_frame, SCREEN_TYPE_ID_KEY,
819 (void *) VIEW_MANAGER_VIEW_TYPE_ADVANCED);
821 elm_naviframe_item_pop_cb_set(navi_it, __back_key_cb, NULL);
823 /* Add vconf listeners for the different options */
824 vconf_notify_key_changed(VCONFKEY_WIFI_ENABLE_QS, __vconf_noti_change_cb,
826 vconf_notify_key_changed(VCONF_SLEEP_POLICY, __vconf_sleep_change_cb,
828 vconf_notify_key_changed(VCONF_SORT_BY, __vconf_sort_change_cb,
830 vconf_notify_key_changed(VCONF_SMART_SWITCHING,
831 __vconf_smart_switch_change_cb, NULL);
833 __COMMON_FUNC_EXIT__;