4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
6 * Contact: MyoungJune Park <mj2004.park@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #include <tapi_common.h>
26 #include <setting-main.h>
27 #include <setting-plugin.h>
30 typedef struct DrawAppInfo DrawAppInfo;
31 typedef struct DrawAppInfo
34 //------------------------------------
35 void (*draw_app)(void* arg, char* name, char* pkgname);
39 static int setting_main_create(void *cb);
40 static int setting_main_destroy(void *cb);
41 static int setting_main_update(void *cb);
42 static int setting_main_cleanup(void *cb);
44 setting_view setting_view_main = {
45 .create = setting_main_create,
46 .update = setting_main_update,
47 .destroy = setting_main_destroy,
48 .cleanup = setting_main_cleanup,
51 static void setting_main_tapi_event_cb(TapiHandle *handle, int result, void *data, void *user_data);
52 static int setting_main_refresh(void *data);
53 static void __alternate_flight_mode(Evas_Object *check);
54 static void setting_main_click_Gendial_list_flight_mode_cb(void *data,
57 static void __alternate_flight_mode(Evas_Object *check);
59 void setting_main_click_list_item_ug_cb(void *data, Evas_Object *obj, char *ug_to_load, service_h svc, struct ug_cbs *cbs);
61 setting_main_appdata *g_main_ad;
63 __setting_chk_changed(void *data, Evas_Object *obj, void *event_info)
65 /* SETTING_TRACE_BEGIN; */
66 retm_if(data == NULL, "Data parameter is NULL");
67 Setting_GenGroupItem_Data *list_item =
68 (Setting_GenGroupItem_Data *) data;
69 /* SETTING_TRACE("process item [%s]", _(list_item->keyStr)); */
70 list_item->chk_status = elm_check_state_get(obj);
72 Eina_List *check_list = g_main_ad->item_check_list;
73 Setting_GenGroupItem_Data *item = NULL;
74 bool isFoundNotSelSomeone = FALSE;
75 bool isFoundSelSomeone = FALSE;
77 item = (Setting_GenGroupItem_Data *)
78 eina_list_data_get(check_list);
82 if (!(item->chk_status)) {
83 isFoundNotSelSomeone = TRUE;
85 isFoundSelSomeone = TRUE;
87 if (isFoundNotSelSomeone && isFoundSelSomeone) {
90 check_list = eina_list_next(check_list);
93 if (isFoundNotSelSomeone) {
94 g_main_ad->check_all_item->chk_status = 0; /* for update new state */
96 g_main_ad->check_all_item->chk_status = 1; /* for update new state */
98 elm_object_item_data_set(g_main_ad->check_all_item->item, g_main_ad->check_all_item);
99 elm_genlist_item_update(g_main_ad->check_all_item->item);
101 if (isFoundSelSomeone) {
102 /* SETTING_TRACE("Set it to active"); */
103 elm_object_item_disabled_set(elm_toolbar_last_item_get
104 (g_main_ad->controllbar_all_check),
109 static void __setting_list_changed(void *data, Evas_Object *obj,
115 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
117 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
118 elm_genlist_item_selected_set(item, 0);
119 Setting_GenGroupItem_Data *list_item =
120 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
122 int old_status = elm_check_state_get(list_item->eo_check);
124 list_item->chk_status = !old_status;
125 elm_check_state_set(list_item->eo_check, list_item->chk_status);
127 Eina_List *check_list = g_main_ad->item_check_list;
128 Setting_GenGroupItem_Data *group_item = NULL;
129 bool isFoundNotSelSomeone = FALSE;
130 bool isFoundSelSomeone = FALSE;
132 group_item = (Setting_GenGroupItem_Data *)
133 eina_list_data_get(check_list);
134 if (NULL == group_item) {
137 if (!(group_item->chk_status)) {
138 isFoundNotSelSomeone = TRUE;
141 isFoundSelSomeone = TRUE;
143 if (isFoundNotSelSomeone && isFoundSelSomeone) {
147 check_list = eina_list_next(check_list);
150 if (isFoundNotSelSomeone) {
151 g_main_ad->check_all_item->chk_status = 0; /* for update new state */
153 g_main_ad->check_all_item->chk_status = 1; /* for update new state */
155 elm_object_item_data_set(g_main_ad->check_all_item->item, g_main_ad->check_all_item);
156 elm_genlist_item_update(g_main_ad->check_all_item->item);
158 if (isFoundSelSomeone) {
159 /* SETTING_TRACE("Set it to active"); */
160 elm_object_item_disabled_set(elm_toolbar_last_item_get
161 (g_main_ad->controllbar_all_check),
168 __setting_chk_sel_all_changed(void *data, Evas_Object *obj, void *event_info)
170 /* SETTING_TRACE_BEGIN; */
171 retm_if(data == NULL, "Data parameter is NULL");
172 Setting_GenGroupItem_Data *list_item =
173 (Setting_GenGroupItem_Data *) data;
174 bool is_all_checked = elm_check_state_get(obj);
175 list_item->chk_status = is_all_checked; /* for update new state */
176 /* SETTING_TRACE("is_all_checked:%d", is_all_checked); */
178 Eina_List *check_list = g_main_ad->item_check_list;
181 list_item = (Setting_GenGroupItem_Data *)
182 eina_list_data_get(check_list);
183 if (NULL == list_item) {
186 list_item->chk_status = is_all_checked;
187 elm_object_item_data_set(list_item->item, list_item);
188 elm_genlist_item_update(list_item->item);
189 check_list = eina_list_next(check_list);
191 if (is_all_checked) {
192 elm_object_item_disabled_set(elm_toolbar_last_item_get
193 (g_main_ad->controllbar_all_check),
198 static void __setting_list_sel_all_changed(void *data, Evas_Object *obj,
204 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
205 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
206 elm_genlist_item_selected_set(item, 0);
207 Setting_GenGroupItem_Data *list_item =
208 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
210 int old_status = elm_check_state_get(list_item->eo_check);
212 int is_all_checked = list_item->chk_status = !old_status;
213 elm_check_state_set(list_item->eo_check, list_item->chk_status);
215 Eina_List *check_list = g_main_ad->item_check_list;
218 list_item = (Setting_GenGroupItem_Data *)
219 eina_list_data_get(check_list);
220 if (NULL == list_item) {
223 list_item->chk_status = is_all_checked;
224 /* elm_check_state_set(list_item->eo_check, is_all_checked); */
225 elm_object_item_data_set(list_item->item, list_item);
226 elm_genlist_item_update(list_item->item);
227 check_list = eina_list_next(check_list);
229 if (is_all_checked) {
230 elm_object_item_disabled_set(elm_toolbar_last_item_get
231 (g_main_ad->controllbar_all_check),
237 static void __load_check_list(void *data, Evas_Object **genlist,
241 setting_main_appdata *ad = (setting_main_appdata *) data;
245 Cfg_Item_Position pos = Cfg_Item_Pos_Uninstall;
246 bool isFoundNonSelItem = FALSE;
247 bool isFoundSelSomeoneItem = FALSE;
250 char *icon_path = NULL;
253 setting_create_Gendial_field_def(ad->gl_sel_all,
254 &(ad->itc[GENDIAL_Type_sel_all]),
255 __setting_list_sel_all_changed, ad,
256 SWALLOW_Type_1CHECK, NULL, NULL,
257 state, KeyStr_Select_All, NULL,
258 __setting_chk_sel_all_changed);
259 __BACK_POINTER_SET(ad->check_all_item);
261 Setting_GenGroupItem_Data *item = NULL;
262 Setting_GenGroupItem_Data *category_item = NULL;
263 for (i = 0; i < setting_cfg_get_category_length(); i++) {
264 if (NULL == menuNameKey) {
265 /* SETTING_TRACE("load all the items in config file"); */
268 (setting_cfg_get_category_name(i), menuNameKey)) {
271 char *category_name = setting_cfg_get_category_name(i);
274 setting_create_Gendial_field_group_titleItem(*genlist,
276 [GENDIAL_Type_group_item]),
278 ELM_GENLIST_ITEM_NONE,
282 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
283 keyStr = setting_cfg_get_keyname_idx(i, j);
284 pos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
286 if (Cfg_Item_Pos_Level1 == pos) {
288 isFoundNonSelItem = TRUE;
291 isFoundSelSomeoneItem = TRUE;
294 icon_path = setting_cfg_get_icon_path_idx(i, j);
296 setting_create_Gendial_field_groupitem(*genlist,
298 [GENDIAL_Type_1text_2icon_2]),
300 __setting_list_changed,
302 SWALLOW_Type_1CHECKICON,
307 __setting_chk_changed);
309 ad->item_check_list =
310 eina_list_append(ad->item_check_list, item);
313 SETTING_TRACE_ERROR("category_item is NULL");
317 if (ad->check_all_item) {
318 if (isFoundNonSelItem) {
319 ad->check_all_item->chk_status = 0; /* for update new state */
321 ad->check_all_item->chk_status = 1; /* for update new state */
323 elm_object_item_data_set(ad->check_all_item->item, ad->check_all_item);
324 elm_genlist_item_update(ad->check_all_item->item);
326 SETTING_TRACE_ERROR("ad->check_all_item is NULL");
329 if (isFoundSelSomeoneItem) {
330 elm_object_item_disabled_set(elm_toolbar_last_item_get
331 (ad->controllbar_all_check),
334 elm_object_item_disabled_set(elm_toolbar_last_item_get
335 (ad->controllbar_all_check),
342 static Setting_GenGroupItem_Data * __flightmode_handler(void* data, char* keyStr, char* icon_path, char* ug_name, Evas_Object *genlist)
344 // NOT UG --> it's just UI drawing
346 setting_main_appdata *ad = (setting_main_appdata *)data;
348 setting_get_bool_slp_key (BOOL_SLP_SETTING_FLIGHT_MODE, &value, &err);
350 /* create flight_mode */
351 ad->data_flight = setting_create_Gendial_field_groupitem(genlist,
352 &(ad->itc[GENDIAL_Type_1text_2icon]),
354 setting_main_click_Gendial_list_flight_mode_cb,
356 SWALLOW_Type_1ICON_1RADIO,
362 setting_main_click_list_flight_mode_cb);
363 __BACK_POINTER_SET(ad->data_flight);
365 return ad->data_flight;
368 static Setting_GenGroupItem_Data * __wifi_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
370 setting_main_appdata *ad = (setting_main_appdata *)data;
372 char* pa_wifi = get_pa_Wi_Fi_on_off_str();
373 ad->data_wifi = setting_create_Gendial_field_groupitem(genlist,
374 &(ad->itc[GENDIAL_Type_1icon_2text]),
376 setting_main_click_list_ex_ug_cb,
378 SWALLOW_Type_INVALID,
385 __BACK_POINTER_SET(ad->data_wifi);
388 return ad->data_wifi;
391 static Setting_GenGroupItem_Data * __bluetooth_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
393 setting_main_appdata *ad = (setting_main_appdata *)data;
395 ad->data_bt = setting_create_Gendial_field_groupitem(genlist,
396 &(ad->itc[GENDIAL_Type_1icon_2text]),
398 setting_main_click_list_ex_ug_cb,
400 SWALLOW_Type_INVALID,
408 __BACK_POINTER_SET(ad->data_bt);
413 static Setting_GenGroupItem_Data * __allshare_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
415 setting_main_appdata *ad = (setting_main_appdata *)data;
417 Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
418 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
420 setting_main_click_list_default_ug_cb,
422 SWALLOW_Type_INVALID,
431 static Setting_GenGroupItem_Data * __network_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
433 setting_main_appdata *ad = (setting_main_appdata *)data;
435 Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
436 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
438 setting_main_click_list_network_ug_cb,
440 SWALLOW_Type_INVALID,
450 static Setting_GenGroupItem_Data * __nfc_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
452 setting_main_appdata *ad = (setting_main_appdata *)data;
454 ad->data_nfc = setting_create_Gendial_field_groupitem(genlist,
455 &(ad->itc[GENDIAL_Type_1icon_2text]),
457 setting_main_click_list_ex_ug_cb,
459 SWALLOW_Type_INVALID,
464 get_NFC_on_off_str(),
466 __BACK_POINTER_SET(ad->data_nfc);
468 setting_create_Gendial_field_def(genlist, &itc_multiline_text, NULL,
469 ad, SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
470 NULL, NULL, 0, SETTING_NFC_DESC, NULL, NULL);
471 elm_genlist_item_select_mode_set(elm_genlist_item_append(genlist, &(itc_seperator), NULL, NULL,ELM_GENLIST_ITEM_NONE, NULL, NULL),
472 ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
477 static Setting_GenGroupItem_Data * __default_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
479 setting_main_appdata *ad = (setting_main_appdata *)data;
480 Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
481 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
483 setting_main_click_list_ex_ug_cb,
485 SWALLOW_Type_INVALID,
492 if (!safeStrCmp(KeyStr_WiFiDirect, keyStr)) {
493 setting_create_Gendial_field_def(genlist, &itc_multiline_text, NULL,
494 ad, SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
495 NULL, NULL, 0, SETTING_WIFI_DIRECT_DESC, NULL, NULL);
496 elm_genlist_item_select_mode_set(elm_genlist_item_append(genlist, &(itc_seperator), NULL, NULL,ELM_GENLIST_ITEM_NONE, NULL, NULL),
497 ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
505 typedef struct mainlist_entry mainlist_entry;
507 struct mainlist_entry {
509 Setting_GenGroupItem_Data* (*ui_handler)(void* data, char* title, char* iconpath, char* ugname, Evas_Object *genlist);
514 MAINLIST_ENTRY_FLIGHT_MODE = 0,
517 MAINLIST_ENTRY_ALLSHARE,
518 MAINLIST_ENTRY_NETWORK,
520 MAINLIST_ENTRY_DEFAULT,
524 static mainlist_entry mainlist_table[] = {
525 {KeyStr_FlightMode, __flightmode_handler}, // 0 --> NOT UG
526 {KeyStr_WiFi, __wifi_handler}, // 1 --> UG
527 {KeyStr_Bluetooth, __bluetooth_handler}, // 1 --> UG
528 {KeyStr_AllShare, __allshare_handler}, // NOT UG
529 {KeyStr_Network, __network_handler}, // 1 --> UG
530 {KeyStr_NFC, __nfc_handler}, // 1 --> UG
531 {"Default", __default_handler}, // 1 --> UG
533 //--------------------------------------------------------------
538 // Flight Mode - not UG
539 // All share - not UG
540 // WiFi - added toggle
546 void __load_connectivity_menu_list(void *data, Cfg_Item_Position inputPos, Evas_Object *genlist)
549 setting_main_appdata *ad = data;
550 //group title, only display in setting main view
551 if (SETTING_VIEW_MAIN == ad->view_load) {
552 setting_create_Gendial_field_group_titleItem(ad->main_genlist,
553 &(ad->itc[GENDIAL_Type_group_item]),
555 ELM_GENLIST_ITEM_NONE,
556 KeyStr_Connectivity, NULL);
559 int idx_second_menu = 0;
562 char *icon_path = NULL;
563 char *ug_args = NULL;
564 Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
567 bool is_emulator = isEmulBin();
569 for (i = 0; i < setting_cfg_get_category_length(); i++) {
571 (setting_cfg_get_category_name(i), KeyStr_Connectivity))
574 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
575 keyStr = setting_cfg_get_keyname_idx(i, j);
576 tmpPos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
577 ug_args = setting_cfg_get_ug_args_idx(i, j);
578 icon_path = setting_cfg_get_icon_path_idx(i, j);
579 /* SETTING_TRACE_DEBUG("Got an item[keyStr:%s, ug_args:%s, pos:%d]", */
580 /* keyStr, ug_args, tmpPos); */
583 if (!safeStrCmp(KeyStr_FlightMode, keyStr)) {
584 continue; /* hide Flight Mode in Emulator*/
585 } else if (!safeStrCmp(KeyStr_WiFi, keyStr)) {
586 continue; /* hide WIFI in Emulator*/
587 } else if (!safeStrCmp(KeyStr_WiFiDirect, keyStr)) {
588 continue; /* hide WiFiDirect in Emulator*/
589 } else if (!safeStrCmp(KeyStr_Network, keyStr)) {
590 continue; /* hide Network in Emulator*/
591 } else if (!safeStrCmp(KeyStr_Bluetooth, keyStr)) {
592 continue; /* hide Bluetooth in Emulator*/
598 if (idx_second_menu < MAX_MORE_MENU_NUM
599 && Cfg_Item_Pos_Level1 == tmpPos
600 && SETTING_VIEW_MAIN == ad->view_load
601 && MAIN_PROFILE_PREFERRED == ad->profile_type) {
603 if (is_ug_installed_by_ug_args(ug_args)) {
604 ad->more_connective_menus[idx_second_menu++] = keyStr;
608 if (Cfg_Item_Pos_Level_All == inputPos) {
609 } else if (inputPos != tmpPos) { /* not in the inputPos level */
613 if (!safeStrCmp(KeyStr_FlightMode, keyStr)) { /* load special radio */
615 mainlist_table[MAINLIST_ENTRY_FLIGHT_MODE].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
617 } else if (!safeStrCmp(KeyStr_AllShare, keyStr)) { /* NOT UG */
619 mainlist_table[MAINLIST_ENTRY_ALLSHARE].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
621 } else if (!safeStrCmp(KeyStr_WiFi, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
623 mainlist_table[MAINLIST_ENTRY_WIFI].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
625 } else if (!safeStrCmp(KeyStr_Bluetooth, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
627 mainlist_table[MAINLIST_ENTRY_BT].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
629 } else if (!safeStrCmp(KeyStr_Network, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special UG */
631 mainlist_table[MAINLIST_ENTRY_NETWORK].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
633 } else if (!safeStrCmp(KeyStr_NFC, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
634 int nfc_value = FALSE; //default
635 vconf_get_bool(VCONFKEY_NFC_FEATURE, &nfc_value);
636 if (VCONFKEY_NFC_FEATURE_ON == nfc_value)
638 mainlist_table[MAINLIST_ENTRY_NFC].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
640 } else { /* load other UGs */
641 if (is_ug_installed_by_ug_args(ug_args))
643 mainlist_table[MAINLIST_ENTRY_DEFAULT].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
649 //end group , only display in setting main view
650 #if SUPPORT_MORE_ITEM_FUNCTION
651 if (SETTING_VIEW_MAIN == ad->view_load && MAIN_PROFILE_PREFERRED == ad->profile_type && idx_second_menu > 0)
653 char sub_text[MAX_COMMON_BUFFER_LEN] = {0, };
655 while (idx < MAX_MORE_MENU_NUM && ad->more_connective_menus[idx])
659 safeStrNCat(sub_text, ", ", MAX_COMMON_BUFFER_LEN);
661 safeStrNCat(sub_text, _(ad->more_connective_menus[idx]), MAX_COMMON_BUFFER_LEN);
665 ad->data_moreConnect =
666 setting_create_Gendial_field_groupitem(ad->main_genlist,
667 &(ad->itc[GENDIAL_Type_2text_3]),
669 setting_main_click_list_more_cb,
671 SWALLOW_Type_INVALID,
678 __BACK_POINTER_SET(ad->data_moreConnect);
684 void __load_connectivity_level0_list(void *data)
686 setting_main_appdata *ad = data;
687 __load_connectivity_menu_list(ad, Cfg_Item_Pos_Level0, ad->main_genlist);
690 void __load_connectivity_level_all_list(void *data)
693 setting_main_appdata *ad = data;
694 __load_connectivity_menu_list(ad, Cfg_Item_Pos_Level_All, ad->main_genlist);
697 void __load_system_menu_list(void *data, Cfg_Item_Position inputPos, Evas_Object *genlist)
700 SETTING_TRACE_DEBUG("pos :%d", inputPos);
701 setting_main_appdata *ad = data;
702 //group title, only display in setting main view
703 if (SETTING_VIEW_MAIN == ad->view_load) {
704 setting_create_Gendial_field_group_titleItem(ad->main_genlist,
705 &(ad->itc[GENDIAL_Type_group_item]),
707 ELM_GENLIST_ITEM_NONE,
708 KeyStr_System, NULL);
710 int idx_second_menu = 0;
713 char *icon_path = NULL;
714 char *ug_args = NULL;
716 Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
721 bool is_emulator = isEmulBin();
723 //SETTING_TRACE("setting_cfg_get_category_length() :: %d ", setting_cfg_get_category_length());
724 for (i = 0; i < setting_cfg_get_category_length(); i++) {
725 if (safeStrCmp(setting_cfg_get_category_name(i), KeyStr_System))
728 //SETTING_TRACE(" setting_cfg_get_menu_length(%d) :: %d ",i, setting_cfg_get_menu_length(i) );
729 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
730 keyStr = setting_cfg_get_keyname_idx(i, j);
731 /* sg_path = setting_cfg_get_ugpath_idx(i, j); */
732 tmpPos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
733 icon_path = setting_cfg_get_icon_path_idx(i, j);
734 ug_args = setting_cfg_get_ug_args_idx(i, j);
736 //SETTING_TRACE("KeyString : %s , tmpPos : %d , inputPos : %d ", keyStr, tmpPos, inputPos );
739 if (!safeStrCmp(KeyStr_Security, keyStr)) {
740 continue; /* hide Security in Emulator*/
741 } else if (!safeStrCmp(KeyStr_Motions, keyStr)) {
742 continue; /* hide Motion in Emulator*/
743 } else if (!safeStrCmp(KeyStr_Accessibility, keyStr)) {
744 continue; /* hide Accessibility in Emulator*/
745 } else if (!safeStrCmp(KeyStr_Memory, keyStr)) {
746 continue; /* hide Memory in Emulator*/
747 } else if (!safeStrCmp(KeyStr_Powersaving, keyStr)) {
748 continue; /* hide Powersaving in Emulator*/
754 if (idx_second_menu < MAX_MORE_MENU_NUM
755 && Cfg_Item_Pos_Level1 == tmpPos
756 && SETTING_VIEW_MAIN == ad->view_load
757 && MAIN_PROFILE_PREFERRED == ad->profile_type) {
759 if (is_ug_installed_by_ug_args(ug_args)) {
760 ad->more_system_menus[idx_second_menu++] = keyStr;
764 if (Cfg_Item_Pos_Level_All == inputPos) {
766 //SETTING_TRACE("Cfg_Item_Pos_Level_All == inputPos ---> no draw --- WHY?? ");
767 } else if (inputPos != tmpPos) { /* not in the inputPos level */
768 //SETTING_TRACE("inputPos == tmp Pos ---> no draw --- WHY?? ");
772 if (!safeStrCmp(KeyStr_Landscape, keyStr)) { /* load special UG */
775 (VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, &value);
778 ad->data_rotationMode =
779 setting_create_Gendial_field_groupitem(genlist,
780 &(ad->itc[GENDIAL_Type_1text_2icon]),
782 setting_main_sel_list_mouse_up_cb,
784 SWALLOW_Type_1ICON_1RADIO,
790 setting_main_list_mouse_up_cb);
791 __BACK_POINTER_SET(ad->data_rotationMode);
793 else if (!safeStrCmp(KeyStr_Brightness, keyStr)) {
795 char* pa_bright = get_brightness_mode_str();
797 setting_create_Gendial_field_groupitem(genlist,
798 &(ad->itc[GENDIAL_Type_1icon_2text]),
800 setting_main_click_list_ex_ug_cb,
802 SWALLOW_Type_INVALID,
809 __BACK_POINTER_SET(ad->data_bright);
812 else { /* load other UGs */
814 if (is_ug_installed_by_ug_args(ug_args))
816 setting_create_Gendial_field_groupitem(genlist,
817 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
819 setting_main_click_list_ex_ug_cb,
821 SWALLOW_Type_INVALID,
832 //end group, only display in setting main view
833 #if SUPPORT_MORE_ITEM_FUNCTION
834 if (SETTING_VIEW_MAIN == ad->view_load && MAIN_PROFILE_PREFERRED == ad->profile_type && idx_second_menu > 0)
836 char sub_text[MAX_COMMON_BUFFER_LEN] = {0, };
838 while (idx < MAX_MORE_MENU_NUM && ad->more_system_menus[idx])
842 safeStrNCat(sub_text, ", ", MAX_COMMON_BUFFER_LEN);
844 safeStrNCat(sub_text, _(ad->more_system_menus[idx]), MAX_COMMON_BUFFER_LEN);
848 ad->data_moreSystem =
849 setting_create_Gendial_field_groupitem(ad->main_genlist,
850 &(ad->itc[GENDIAL_Type_2text_3]),
852 setting_main_click_list_more_cb,
854 SWALLOW_Type_INVALID,
861 __BACK_POINTER_SET(ad->data_moreSystem);
866 static void __load_system_level0_list(void *data)
868 setting_main_appdata *ad = data;
869 __load_system_menu_list(ad, Cfg_Item_Pos_Level0, ad->main_genlist);
872 static void __load_system_level_all_list(void *data)
875 setting_main_appdata *ad = data;
876 __load_system_menu_list(ad, Cfg_Item_Pos_Level_All, ad->main_genlist);
879 static void __load_applications_menu_list(void *data,
880 Cfg_Item_Position inputPos)
883 SETTING_TRACE_DEBUG("pos :%d", inputPos);
884 setting_main_appdata *ad = data;
886 bool is_emulator = isEmulBin();
889 setting_create_Gendial_field_group_titleItem(ad->main_genlist,
890 &(ad->itc[GENDIAL_Type_group_item]),
892 ELM_GENLIST_ITEM_NONE,
893 KeyStr_Applications, NULL);
895 char *icon_path = NULL;
896 char *ug_args = NULL;
897 Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
900 for (i = 0; i < setting_cfg_get_category_length(); i++) {
902 (setting_cfg_get_category_name(i), KeyStr_Applications))
905 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
906 keyStr = setting_cfg_get_keyname_idx(i, j);
907 icon_path = setting_cfg_get_icon_path_idx(i, j);
908 ug_args = setting_cfg_get_ug_args_idx(i, j);
910 (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
912 if (Cfg_Item_Pos_Level_All == inputPos) {
913 } else if (inputPos != tmpPos) { /* not in the inputPos level */
918 /* hide all except Email */
919 if (safeStrCmp(KeyStr_Email, keyStr)) {
926 setting_create_Gendial_field_groupitem(ad->main_genlist,
927 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
929 setting_main_click_list_ex_ug_cb,
931 SWALLOW_Type_INVALID,
942 static void __load_applications_level0_list(void *data)
944 setting_main_appdata *ad = data;
945 __load_applications_menu_list(ad, Cfg_Item_Pos_Level0);
948 static void __load_applications_level_all_list(void *data)
951 setting_main_appdata *ad = data;
952 __load_applications_menu_list(ad, Cfg_Item_Pos_Level_All);
955 bool is_3rdapp_installed_setting_cfg(char* pkgname)
961 if (snprintf(path, 512, "/opt/apps/%s/setting/setting.xml", pkgname) < 0)
965 bool result_opt = false;
967 if(stat(path, &st) == 0) {
970 SETTING_TRACE_ERROR(" %s is *NOT* present\n", path);
981 static void draw_3rdapp(void* data, char* name, char* pkgname)
984 SETTING_TRACE(" name : %s", name);
985 SETTING_TRACE(" pkgname : %s", pkgname);
987 setting_main_appdata *ad = data;
992 if (snprintf(fullpath, 512, "/opt/apps/%s/setting/setting.xml", pkgname) < 0)
995 SETTING_TRACE(" fullpath : %s", fullpath);
1001 free(ad->plugin_path);
1002 ad->plugin_path = NULL;
1004 ad->plugin_path = strdup(fullpath);
1006 setting_create_Gendial_field_groupitem(ad->main_genlist,
1007 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
1009 setting_main_click_list_plugin_cb,
1011 SWALLOW_Type_INVALID,
1012 IMG_DefaultIcon, NULL,
1023 static ail_cb_ret_e __download_apps_cb(ail_appinfo_h ai, void* data)
1025 DrawAppInfo* pinfo = (DrawAppInfo*)data;
1028 if (AIL_ERROR_OK == ail_appinfo_get_str(ai, AIL_PROP_PACKAGE_STR, &id))
1030 //SETTING_TRACE(" 3rd party - app name : ----> %s ", id);
1033 ail_appinfo_h handle;
1038 bool nodisplay = false;
1039 bool removable = true;
1041 if (AIL_ERROR_OK == ail_package_get_appinfo(id, &handle))
1043 if (AIL_ERROR_OK != ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &name))
1044 SETTING_TRACE("cannot get name");
1046 if (AIL_ERROR_OK != ail_appinfo_get_str(handle, AIL_PROP_ICON_STR, &icon))
1047 SETTING_TRACE("cannot get icon");
1049 if (AIL_ERROR_OK != ail_appinfo_get_bool(handle, AIL_PROP_NODISPLAY_BOOL, &nodisplay))
1050 SETTING_TRACE("cannot get nodisplay");
1052 if (AIL_ERROR_OK != ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_REMOVABLE_BOOL, &removable))
1053 SETTING_TRACE("cannot get removable");
1055 if (AIL_ERROR_OK != ail_appinfo_get_int(handle, AIL_PROP_X_SLP_INSTALLEDTIME_INT, &installed_time))
1056 SETTING_TRACE("cannot get installed_time");
1058 //SETTING_TRACE("installed_time = %d ", installed_time);
1059 if (installed_time != 0 && is_3rdapp_installed_setting_cfg(id) == true )
1061 SETTING_TRACE(" 3rd party - app name : ----> id : %s --- name : %s ", id, name);
1062 SETTING_TRACE(" 3rd party - icon : ----> %s ", icon);
1063 SETTING_TRACE(" 3rd party - nodisplay : ----> %d ", nodisplay);
1067 if (pinfo->draw_app != NULL)
1069 SETTING_TRACE(">>> pkg name --> %s ", id);
1070 pinfo->draw_app(pinfo->data, strdup(name)/* appname*/, strdup(id)/* pkg_name*/);
1075 return AIL_CB_RET_CONTINUE;
1080 * get 3rd party applist from AIL & searching dir/file by the defined rule
1082 * if data is NULL --> just get how many items are there
1083 * if data is NOT NULL --> draw UI code
1085 static int get_downloadapp_list(void* data)
1087 SETTING_TRACE_BEGIN;
1089 setting_main_appdata *ad = data;
1093 ail_appinfo_h handle;
1095 DrawAppInfo* pinfo = (DrawAppInfo*)malloc(sizeof(DrawAppInfo));
1097 pinfo->draw_app = draw_3rdapp;
1100 if (ail_filter_new(&f) == AIL_ERROR_OK)
1102 if (ail_filter_add_bool(f, AIL_PROP_NODISPLAY_BOOL, false) != AIL_ERROR_OK)
1104 SETTING_TRACE("ail filter error");
1108 ail_filter_list_appinfo_foreach(f, __download_apps_cb, pinfo);
1109 //---------------------------------------------------------------
1110 ail_filter_destroy(f);
1112 ncount = pinfo->ncount;
1123 static int __get_downloaded_apps_num(Cfg_Item_Position inputPos)
1125 SETTING_TRACE_BEGIN;
1126 SETTING_TRACE_DEBUG("pos :%d", inputPos);
1127 int downloaded_apps_num = 0;
1128 Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
1130 for (i = 0; i < setting_cfg_get_category_length(); i++) {
1132 (setting_cfg_get_category_name(i), KeyStr_DownloadedAPPs))
1135 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
1136 tmpPos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
1137 if (Cfg_Item_Pos_Level_All == inputPos) {
1138 } else if (inputPos != tmpPos) { /* not in the inputPos level */
1142 downloaded_apps_num++;
1146 // draw UI with AUL code
1148 downloaded_apps_num = get_downloadapp_list(NULL);
1149 SETTING_TRACE("Exit %s with return[%d]",__FUNCTION__, downloaded_apps_num);
1152 return downloaded_apps_num;
1156 static void __load_downloaded_apps_menu_list(void *data,
1157 Cfg_Item_Position inputPos)
1159 SETTING_TRACE_BEGIN;
1160 SETTING_TRACE_DEBUG("pos :%d", inputPos);
1161 setting_main_appdata *ad = data;
1163 // if the number of download apps is zero, display a bottom seperator
1164 if (0 == __get_downloaded_apps_num(inputPos)) {
1165 Elm_Object_Item *item = NULL;
1166 item = elm_genlist_item_append(ad->main_genlist, &itc_bottom_seperator, NULL, NULL,
1167 ELM_GENLIST_ITEM_NONE, NULL, NULL);
1168 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1173 setting_create_Gendial_field_group_titleItem(ad->main_genlist,
1174 &(ad->itc[GENDIAL_Type_group_item]),
1176 ELM_GENLIST_ITEM_NONE,
1177 KeyStr_DownloadedAPPs,
1180 char *keyStr = NULL;
1181 char *icon_path = NULL;
1182 char *ug_args = NULL;
1184 Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
1186 for (i = 0; i < setting_cfg_get_category_length(); i++) {
1188 (setting_cfg_get_category_name(i), KeyStr_DownloadedAPPs))
1191 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
1192 keyStr = setting_cfg_get_keyname_idx(i, j);
1194 (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
1195 icon_path = setting_cfg_get_icon_path_idx(i, j);
1196 ug_args = setting_cfg_get_ug_args_idx(i, j);
1198 if (Cfg_Item_Pos_Level_All == inputPos) {
1199 } else if (inputPos != tmpPos) { /* not in the inputPos level */
1203 setting_create_Gendial_field_groupitem(ad->main_genlist,
1204 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
1206 setting_main_click_list_ex_ug_cb,
1208 SWALLOW_Type_INVALID,
1221 DIR *dp = opendir (PLUGIN_CFG_DIR);
1228 while (ep = readdir (dp))
1230 memset(fullpath, 0x00, 256);
1231 strncpy(fullpath, PLUGIN_CFG_DIR, 256);
1232 strncat(fullpath, "/", 256);
1233 strncat(fullpath, ep->d_name, 256);
1235 //SETTING_TRACE("ep->d_name:%s", ep->d_name);
1236 if (0 == safeStrCmp(".", ep->d_name)
1237 || 0 == safeStrCmp("..", ep->d_name))
1241 SETTING_TRACE("fullpath: %s", fullpath);
1242 char *p = strrchr(ep->d_name, '.');
1244 setting_create_Gendial_field_groupitem(ad->main_genlist,
1245 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
1247 setting_main_click_list_plugin_cb,
1249 SWALLOW_Type_INVALID,
1250 IMG_DefaultIcon, NULL,
1251 0, ep->d_name, NULL,
1255 (void) closedir (dp);
1258 // TODO: DRAW 3RD PARTY APPS LIST here with EFL code
1259 int downloaded_apps_num = get_downloadapp_list(ad);
1261 // loop condition : 0 ---> ncount
1268 static void __load_downloaded_apps_level0_list(void *data)
1270 setting_main_appdata *ad = data;
1271 __load_downloaded_apps_menu_list(ad, Cfg_Item_Pos_Level0);
1274 static void __load_downloaded_apps_level_all_list(void *data)
1276 SETTING_TRACE_BEGIN;
1277 setting_main_appdata *ad = data;
1278 __load_downloaded_apps_menu_list(ad, Cfg_Item_Pos_Level_All);
1281 static void __check_all_view_clear(void *data)
1283 SETTING_TRACE_BEGIN;
1285 setting_main_appdata *ad = data;
1286 if (ad->item_check_list) {
1287 eina_list_free(ad->item_check_list);
1288 ad->item_check_list = NULL;
1291 ad->gl_sel_all = NULL;
1292 ad->edit_preferred_genlist = NULL;
1293 ad->controllbar_all_check = NULL;
1294 ad->check_all_item =NULL;
1297 static void __prefered_buttons_cb(void *data, Evas_Object *obj, void *event_info)
1299 SETTING_TRACE_BEGIN;
1301 setting_main_appdata *ad = (setting_main_appdata *) data;
1302 const char *key = NULL;
1304 #if SUPPORT_BOTTOM_BTNS
1305 ret_if(!event_info);
1306 Elm_Object_Item *it = event_info;
1307 key = elm_object_item_text_get(it);
1309 key = elm_object_text_get(obj);
1311 setting_retm_if(data == NULL
1312 || key == NULL, "data == NULL || key == NULL");
1314 SETTING_TRACE_DEBUG("press button: %s", key);
1317 if (!safeStrCmp(key, dgettext("sys_string", "IDS_COM_SK_DONE"))) {
1319 if (ad->profile_type == MAIN_PROFILE_ALL) {
1320 SETTING_TRACE_DEBUG("Cancel to hide current view.");
1321 setting_try_save_check_list(ad); /* need to save too */
1322 __check_all_view_clear(ad);
1323 elm_naviframe_item_pop(ad->navibar_main); // pop(preferred) --> main
1327 // MAIN_PROFILE_PREFERRED and Etc
1328 // redraw setting-main
1329 setting_try_save_check_list(ad);
1330 elm_naviframe_item_pop(ad->navibar_main); // pop (preferred) -> main
1332 //After the view is popuped, all the object handlers should be reset NULL.
1333 __check_all_view_clear(ad);
1334 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
1335 ad->load_fns[Func_Type_System] = __load_system_level0_list;
1336 ad->load_fns[Func_Type_Apps] = __load_applications_level0_list;
1337 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level0_list;
1338 int ret = setting_main_refresh(ad);
1339 ret_if(ret != SETTING_RETURN_SUCCESS);
1344 if (!safeStrCmp(key, setting_gettext("IDS_COM_SK_CANCEL"))
1345 || !safeStrCmp(key, dgettext("sys_string", "IDS_COM_BODY_BACK"))) {
1346 SETTING_TRACE_DEBUG("Cancel to hide current view.");
1347 elm_naviframe_item_pop(ad->navibar_main);
1348 //After the view is popuped, all the object handlers should be reset NULL.
1349 __check_all_view_clear(ad);
1354 static void __setting_contorlbar_clicked(void *data, Evas_Object *obj,
1357 SETTING_TRACE_BEGIN;
1358 ret_if(data == NULL || obj == NULL);
1359 setting_main_appdata *ad = (setting_main_appdata *) data;
1361 /* elm_segment_control_selected_segment_get(obj, &index); */
1362 Elm_Object_Item *sel_item = elm_segment_control_item_selected_get(obj);
1363 ret_if(sel_item == NULL);
1364 index = elm_segment_control_item_index_get(sel_item);
1369 SETTING_TRACE("Preferred");
1370 ad->profile_type = MAIN_PROFILE_PREFERRED;
1371 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
1372 ad->load_fns[Func_Type_System] = __load_system_level0_list;
1373 ad->load_fns[Func_Type_Apps] = __load_applications_level0_list;
1374 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level0_list;
1380 SETTING_TRACE("All");
1381 ad->profile_type = MAIN_PROFILE_ALL;
1382 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level_all_list;
1383 ad->load_fns[Func_Type_System] = __load_system_level_all_list;
1384 ad->load_fns[Func_Type_Apps] = __load_applications_level_all_list;
1385 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level_all_list;
1393 int ret = setting_main_refresh(ad);
1394 ret_if(ret != SETTING_RETURN_SUCCESS);
1397 static void __btnback_clicked_cb(void *data, Evas_Object *obj, void *event_info)
1399 SETTING_TRACE_BEGIN;
1401 setting_main_appdata *ad = (setting_main_appdata *) data;
1402 elm_win_lower(ad->win_main);
1405 static void __allFrequent_btn_cb(void *data, Evas_Object *obj, void *event_info)
1407 SETTING_TRACE_BEGIN;
1408 ret_if(!data || !obj);
1409 setting_main_appdata *ad = (setting_main_appdata *) data;
1410 Elm_Object_Item *item = elm_toolbar_first_item_get(obj);
1413 if (MAIN_PROFILE_ALL == ad->profile_type)
1415 SETTING_TRACE("Change to Preferred view");
1416 elm_object_item_text_set(item, _(ALL_STR));
1417 ad->profile_type = MAIN_PROFILE_PREFERRED;
1418 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
1419 ad->load_fns[Func_Type_System] = __load_system_level0_list;
1420 ad->load_fns[Func_Type_Apps] = __load_applications_level0_list;
1421 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level0_list;
1422 setting_main_refresh(ad);
1424 else if (MAIN_PROFILE_PREFERRED == ad->profile_type)
1426 SETTING_TRACE("Change to ALL view");
1427 elm_object_item_text_set(item, _(PREFERRED_STR));
1428 ad->profile_type = MAIN_PROFILE_ALL;
1429 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level_all_list;
1430 ad->load_fns[Func_Type_System] = __load_system_level_all_list;
1431 ad->load_fns[Func_Type_Apps] = __load_applications_level_all_list;
1432 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level_all_list;
1433 setting_main_refresh(ad);
1444 Evas_Object *__create_main_view_widgets(Evas_Object *win_main, void *cb,
1445 Evas_Object *content,
1447 bool isFoundPreferredItem,
1448 Evas_Object **navibar,
1449 Elm_Object_Item **edit_item,
1450 Elm_Object_Item **segment_all,
1451 Elm_Object_Item **segment_preferred)
1453 SETTING_TRACE_BEGIN;
1455 /* add layout to win_main */
1456 Evas_Object *ly = elm_layout_add(win_main);
1457 setting_retvm_if(ly == NULL, FALSE, "layout == NULL");
1458 elm_layout_theme_set(ly, "layout", "application", "default");
1459 evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND,
1461 elm_win_resize_object_add(win_main, ly);
1462 Evas_Object *bg = setting_create_bg(ly, win_main, "group_list");
1463 elm_object_part_content_set(ly, "elm.swallow.bg", bg);
1464 evas_object_show(ly);
1466 /* add navi_bar to the layout */
1467 Evas_Object *navi_bar = elm_naviframe_add(ly);
1469 elm_object_part_content_set(ly, "elm.swallow.content", navi_bar);
1470 evas_object_show(navi_bar);
1471 *navibar = navi_bar;
1473 // create 'back' button on navigaiton bar
1474 Evas_Object* btn_back = elm_button_add(navi_bar);
1475 evas_object_smart_callback_add(btn_back, "clicked", __btnback_clicked_cb, g_main_ad);
1477 Evas_Object *controlbar = elm_toolbar_add(navi_bar);
1478 setting_retvm_if(controlbar == NULL, FALSE, "controlbar == NULL");
1479 elm_toolbar_shrink_mode_set(controlbar, ELM_TOOLBAR_SHRINK_EXPAND);
1480 //elm_object_style_set(controlbar, NAVI_CONTROLBAR_STYLE);
1482 /* add segment control */
1483 Evas_Object *segment = elm_segment_control_add(controlbar);
1484 setting_retvm_if(segment == NULL, FALSE, "segment == NULL");
1486 Elm_Object_Item *seg_preferred = NULL, *seg_all = NULL;
1487 *segment_preferred = seg_preferred = elm_segment_control_item_add(segment, NULL, _(PREFERRED_STR));
1488 *segment_all = seg_all = elm_segment_control_item_add(segment, NULL, _(ALL_STR));
1490 evas_object_show(segment);
1491 evas_object_smart_callback_add(segment, "changed",
1492 __setting_contorlbar_clicked, cb);
1494 #if !SUPPORT_BOTTOM_BTNS
1495 Elm_Object_Item *item = NULL;
1496 Elm_Object_Item *navi_it = elm_naviframe_item_push(navi_bar, title_text, btn_back, NULL, content, NULL);
1497 elm_object_style_set(btn_back, NAVI_BACK_BUTTON_STYLE);
1498 /* add 'Edit preffered' button to controlbar */
1499 Evas_Object *btn_pref = setting_create_button(controlbar, _(EDIT_PREFERRED_STR),
1500 NAVI_DEF_BUTTON_STYLE,
1501 setting_main_click_edit_preferred_cb,cb);
1503 *edit_item = elm_toolbar_item_append(controlbar, NULL, NULL, NULL, NULL);
1504 elm_object_item_part_content_set(*edit_item, "object", btn_pref);
1505 item = elm_toolbar_item_append(controlbar, NULL, NULL, NULL, NULL);
1506 elm_object_item_part_content_set(item, "object", segment);
1507 elm_toolbar_item_append(controlbar, NULL, NULL, NULL, NULL);
1509 elm_object_item_part_content_set(navi_it, "optionheader", controlbar);
1511 Elm_Object_Item *navi_it = elm_naviframe_item_push(navi_bar, title_text, btn_back, NULL, content, "segment/instant");
1512 elm_object_style_set(btn_back, NAVI_BACK_BUTTON_STYLE);
1514 elm_object_item_disabled_set(elm_toolbar_item_append(controlbar, NULL, "", NULL, NULL), EINA_TRUE);
1515 *edit_item = elm_toolbar_item_append(controlbar, NULL, _(EDIT_PREFERRED_STR), setting_main_click_edit_preferred_cb, cb);
1517 elm_object_item_part_content_set(navi_it, "controlbar", controlbar);
1518 elm_object_item_part_content_set(navi_it, "segment", segment);
1522 if (isFoundPreferredItem) {
1523 elm_segment_control_item_selected_set(seg_preferred, EINA_TRUE);
1525 elm_segment_control_item_selected_set(seg_all, EINA_TRUE);
1530 static bool __setting_create_main_view(void *data)
1532 SETTING_TRACE_BEGIN;
1534 setting_retvm_if(data == NULL, FALSE, "data == NULL");
1535 setting_main_appdata *ad = (setting_main_appdata *) data;
1536 #if SUPPORT_MORE_ITEM_FUNCTION
1537 ad->ly_main = setting_create_win_layout(ad->win_main, ad->win_main);
1538 ad->navibar_main = setting_create_navi_bar(ad->ly_main);
1539 /* add controlbar */
1540 Evas_Object *controlbar = elm_toolbar_add(ad->navibar_main);
1541 setting_retvm_if(controlbar == NULL, FALSE, "controlbar == NULL");
1542 elm_toolbar_shrink_mode_set(controlbar, ELM_TOOLBAR_SHRINK_EXPAND);
1544 ad->main_genlist = elm_genlist_add(ad->navibar_main);
1545 elm_object_style_set(ad->main_genlist, "dialogue");
1546 retvm_if(ad->main_genlist == NULL, FALSE,
1547 "Cannot set scroller object as contento of layout");
1548 elm_genlist_clear(ad->main_genlist); /* first to clear list */
1550 setting_create_navi_bar_buttons(_("IDS_COM_BODY_SETTINGS"),
1551 _("IDS_COM_BODY_BACK"), "", _("IDS_ST_OPT_ALL"),
1552 __btnback_clicked_cb, NULL,
1553 __allFrequent_btn_cb, ad, ad->main_genlist,
1554 ad->navibar_main, controlbar);
1555 elm_object_item_disabled_set(elm_toolbar_last_item_get(controlbar), EINA_TRUE);
1557 ad->controlbar = controlbar;
1559 ad->profile_type = MAIN_PROFILE_PREFERRED;
1560 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
1561 ad->load_fns[Func_Type_System] = __load_system_level0_list;
1562 ad->load_fns[Func_Type_Apps] = __load_applications_level_all_list;
1563 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level_all_list;
1564 setting_main_refresh(ad);
1568 ad->main_genlist = elm_genlist_add(ad->win_main);
1569 elm_object_style_set(ad->main_genlist, "dialogue");
1570 elm_genlist_clear(ad->main_genlist); /* first to clear list */
1572 int isFoundPreferredItem = FALSE;
1573 for (i = 0; i < setting_cfg_get_category_length(); i++) {
1574 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
1575 pos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
1576 if (Cfg_Item_Pos_Level0 == pos) {
1577 isFoundPreferredItem = TRUE;
1581 if (isFoundPreferredItem) {
1586 ad->ly_main = __create_main_view_widgets(ad->win_main, ad,
1588 _("IDS_COM_BODY_SETTINGS"),
1589 isFoundPreferredItem,
1593 &ad->segment_preferred);
1594 setting_retvm_if(ad->ly_main == NULL, FALSE, "ad->ly_main == NULL");
1600 static bool __setting_create_prefered_view(void *data)
1602 SETTING_TRACE_BEGIN;
1604 setting_retvm_if(data == NULL, FALSE, "data == NULL");
1605 setting_main_appdata *ad = (setting_main_appdata *) data;
1607 /* the genlist will be destroyed with its parent view, when using elm_naviframe_item_pop() to destroy the view. */
1608 ad->edit_preferred_genlist = elm_genlist_add(ad->win_main);
1609 elm_object_style_set(ad->edit_preferred_genlist, "dialogue");
1610 elm_genlist_clear(ad->edit_preferred_genlist); /* first to clear list */
1612 /* [UI] edit preffered view */
1613 Evas_Object *sub_layout = elm_layout_add(ad->win_main);
1614 elm_object_style_set(sub_layout, "dialogue");
1615 elm_layout_file_set(sub_layout, SETTING_THEME_EDJ_NAME, "search_layout");
1616 evas_object_size_hint_weight_set(sub_layout, EVAS_HINT_EXPAND, 0.0);
1617 evas_object_show(sub_layout);
1619 ad->gl_sel_all = elm_genlist_add(ad->win_main);
1620 elm_genlist_clear(ad->gl_sel_all); /* first to clear list */
1621 elm_genlist_bounce_set(ad->gl_sel_all, 0, 0);
1623 elm_object_part_content_set(sub_layout, "search_bar", ad->gl_sel_all); /* add 'Select all' */
1624 elm_object_part_content_set(sub_layout, "search_list", ad->edit_preferred_genlist); /* add Genlist */
1626 /* push, not create */
1627 setting_push_layout_navi_bar(_(EDIT_PREFERRED_STR),
1628 _("IDS_COM_SK_CANCEL"),
1629 _("IDS_COM_SK_DONE"), NULL,
1630 __prefered_buttons_cb, __prefered_buttons_cb, NULL, ad,
1631 sub_layout, ad->navibar_main,
1632 &(ad->controllbar_all_check));
1637 static void setting_main_tapi_event_cb(TapiHandle *handle, int result, void *data, void *user_data)
1639 SETTING_TRACE_BEGIN;
1641 setting_main_appdata *ad = user_data;
1642 ad->b_fm_requesting = FALSE;
1643 SETTING_TRACE("result:%d", result);
1647 case TAPI_POWER_FLIGHT_MODE_RESP_ON:
1649 setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE,
1650 SETTING_ON_OFF_BTN_ON, &err);
1652 //If Setting has validate operation (fm_waiting_op == FM_LEAVE) to process, process it.
1653 //Otherwise, do nothing
1654 if (FM_LEAVE == ad->fm_waiting_op)
1656 //Send the latest operation
1657 ad->fm_waiting_op = FM_INVALID;
1658 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
1659 setting_retm_if(err != TAPI_API_SUCCESS,
1660 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
1663 ad->b_fm_requesting = TRUE;
1668 case TAPI_POWER_FLIGHT_MODE_RESP_OFF:
1670 setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE,
1671 SETTING_ON_OFF_BTN_OFF, &err);
1673 //If Setting has validate operation (here, fm_waiting_op == FM_ENTER) to process,process it.
1674 //Otherwise, do nothing
1675 if (FM_ENTER == ad->fm_waiting_op)
1677 //Send the latest operation
1678 ad->fm_waiting_op = FM_INVALID;
1679 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
1680 setting_retm_if(err != TAPI_API_SUCCESS,
1681 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
1684 ad->b_fm_requesting = TRUE;
1689 case TAPI_POWER_FLIGHT_MODE_RESP_FAIL:
1690 //Setting has a validate operation to process, Send the operation request
1691 if (FM_ENTER == ad->fm_waiting_op)
1693 ad->fm_waiting_op = FM_INVALID;
1694 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
1696 setting_retm_if(err != TAPI_API_SUCCESS,
1697 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
1698 ad->b_fm_requesting = TRUE;
1700 else if (FM_LEAVE == ad->fm_waiting_op)
1702 ad->fm_waiting_op = FM_INVALID;
1703 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
1705 setting_retm_if(err != TAPI_API_SUCCESS,
1706 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
1707 ad->b_fm_requesting = TRUE;
1709 else //Current requset is the last one, Setting needs to notify user
1711 setting_create_popup_without_btn(ad, ad->win_main,
1712 _("IDS_COM_POP_ERROR"),
1713 _("IDS_ST_POP_UNABLE_TO_TURN_ON_FLIGHT_MODE_VODA"),
1714 NULL, POPUP_INTERVAL,
1717 //It is need to rollback the status,
1718 if (ad->data_flight) {
1719 ad->data_flight->chk_status = !ad->data_flight->chk_status;
1720 elm_check_state_set(ad->data_flight->eo_check, ad->data_flight->chk_status);
1726 ad->b_fm_requesting = TRUE;
1730 case TAPI_POWER_FLIGHT_MODE_RESP_MAX:
1731 setting_create_popup_without_btn(ad, ad->win_main,
1732 _("IDS_COM_POP_ERROR"),
1733 _("IDS_COM_POP_UNEXPECTED_ERROR"),
1734 NULL, POPUP_INTERVAL, FALSE, FALSE);
1736 //It is need to rollback the status,
1737 if (ad->data_flight) {
1738 ad->data_flight->chk_status = !ad->data_flight->chk_status;
1739 elm_check_state_set(ad->data_flight->eo_check, ad->data_flight->chk_status);
1749 static int setting_main_refresh(void *data)
1751 SETTING_TRACE_BEGIN;
1752 setting_main_appdata *ad = (setting_main_appdata *) data;
1753 elm_genlist_clear(ad->main_genlist); /* first to clear list */
1755 if (is_ug_installed_by_ug_args("rcs-config"))
1757 Elm_Object_Item *item = elm_genlist_item_append(ad->main_genlist, &itc_seperator, NULL, NULL,
1758 ELM_GENLIST_ITEM_NONE, NULL, NULL);
1759 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1760 setting_create_Gendial_field_groupitem(ad->main_genlist,
1761 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
1763 setting_main_click_list_ex_ug_cb,
1765 SWALLOW_Type_INVALID,
1767 0, KeyStr_Joyn, NULL,
1772 for(i = Func_Type_Connectivity; i < Func_Type_MAX; i++)
1773 (ad->load_fns[i]) (ad);
1775 memset(ad->load_fns, 0, Func_Type_MAX *sizeof(menu_list_load_fn));
1777 return SETTING_RETURN_SUCCESS;
1780 static int setting_main_create(void *cb)
1782 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1784 setting_main_appdata *ad = (setting_main_appdata *) cb;
1786 //pass NULL to let TAPI access default module
1787 ad->handle = tel_init(NULL);
1789 SETTING_TRACE_ERROR("*** [ERR] tel_init failed ***");
1791 SETTING_TRACE("tel_init ok[handle:%p]", ad->handle);
1793 setting_create_Gendial_itc("dialogue/1text.1icon.2",
1794 &(ad->itc[GENDIAL_Type_1text_1icon_2]));
1795 setting_create_Gendial_itc("dialogue/1text.2icon",
1796 &(ad->itc[GENDIAL_Type_1text_2icon]));
1797 setting_create_Gendial_itc("dialogue/2text.1icon.3",
1798 &(ad->itc[GENDIAL_Type_1icon_2text]));
1799 setting_create_Gendial_itc("dialogue/1text.1icon.2",
1800 &(ad->itc[GENDIAL_Type_1text_2icon_2]));
1801 setting_create_Gendial_itc("dialogue/title",
1802 &(ad->itc[GENDIAL_Type_group_item]));
1803 setting_create_Gendial_itc("select_all",
1804 &(ad->itc[GENDIAL_Type_sel_all]));
1806 setting_create_Gendial_itc("dialogue/2text.3", &(ad->itc[GENDIAL_Type_2text_3]));
1808 ad->view_type = SETTING_VIEW_MAIN;
1809 bool ret = __setting_create_main_view(ad);
1810 SETTING_TRACE(" >>>> ret = %d ", ret);
1811 setting_view_main.is_create = 1;
1813 return SETTING_RETURN_SUCCESS;
1816 static int setting_main_destroy(void *cb)
1818 SETTING_TRACE_BEGIN;
1820 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1822 setting_main_appdata *ad = (setting_main_appdata *) cb;
1823 if (0 == setting_view_main.is_create)
1826 return SETTING_RETURN_SUCCESS;
1830 int tapi_ret = tel_deinit(ad->handle);
1831 if (tapi_ret != TAPI_API_SUCCESS) {
1832 SETTING_TRACE_DEBUG("*** [ERR] tel_deinit. [%d] ***", tapi_ret);
1834 SETTING_TRACE("*** tel_deinit OK ");
1839 /* then destroy the UI object. */
1840 if (ad->item_check_list) {
1841 eina_list_free(ad->item_check_list);
1842 ad->item_check_list = NULL;
1844 SETTING_TRACE("*** ad->item_check_list is NULL - abnormal state ");
1848 evas_object_del(ad->ly_main);
1852 if (ad->flight_popup) {
1853 evas_object_del(ad->flight_popup);
1854 ad->flight_popup = NULL;
1858 if (ad->plugin_node)
1860 setting_plugin_destroy(ad->plugin_node);
1864 setting_view_main.is_create = 0;
1866 return SETTING_RETURN_SUCCESS;
1869 static int setting_main_update(void *cb)
1871 SETTING_TRACE_BEGIN;
1874 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1876 setting_main_appdata *ad = (setting_main_appdata *) cb;
1878 if (ad->ly_main != NULL) {
1879 //evas_object_show(ad->ly_main);
1882 return SETTING_RETURN_SUCCESS;
1885 static int setting_main_cleanup(void *cb)
1887 SETTING_TRACE_BEGIN;
1889 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1891 setting_main_appdata *ad = (setting_main_appdata *) cb;
1893 if (ad->ly_main != NULL) {
1894 //evas_object_hide(ad->ly_main);
1897 return SETTING_RETURN_SUCCESS;
1900 /* ***************************************************
1904 ***************************************************/
1906 void setting_update_gl_item(void* data)
1908 SETTING_TRACE_BEGIN;
1909 setting_main_appdata *ad = data;
1910 retm_if(!data, "Invalid argument: data is NULL");
1913 Eina_Bool bGlUpdate = EINA_FALSE;
1914 Setting_GenGroupItem_Data *item_to_update = NULL;
1916 for(;nDx<GL_ITEM_MAX; nDx++) {
1917 if(EINA_TRUE == ad->updateItems[nDx]) {
1921 item_to_update = ad->data_wifi;
1922 bGlUpdate = EINA_TRUE;
1925 item_to_update = ad->data_bt;
1926 bGlUpdate = EINA_TRUE;
1929 item_to_update = ad->data_nfc;
1930 bGlUpdate = EINA_TRUE;
1932 case GL_ITEM_FLIGHT:
1933 item_to_update = ad->data_flight;
1934 bGlUpdate = EINA_FALSE;
1940 default: // other case
1944 if (item_to_update) {
1945 SETTING_TRACE("gl update [%s], bGlUpdate:%d", _(item_to_update->keyStr), bGlUpdate);
1947 SETTING_TRACE("gl update:%d", nDx);
1948 elm_object_item_data_set(item_to_update->item, item_to_update);
1949 elm_genlist_item_update(item_to_update->item);
1951 SETTING_TRACE("chk update:%d", nDx);
1952 elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
1956 ad->updateItems[nDx] = EINA_FALSE;
1957 } // if(EINA_TRUE == ad->updateItems[nDx])
1965 void setting_main_destroy_ug_cb(ui_gadget_h ug, void *priv)
1967 setting_main_appdata *ad = (setting_main_appdata *) priv;
1969 return; /* do nothing if ad is NULL */
1976 setting_main_click_list_item_reset_data(ad, NULL);
1978 // update main genlist in unloading UG
1979 SETTING_TRACE("update main genlist in unloading UG");
1980 setting_update_gl_item(ad);
1985 void setting_main_result_ug_cb(ui_gadget_h ug, service_h service,
1990 SETTING_TRACE_BEGIN;
1995 void setting_main_layout_ug_cb(ui_gadget_h ug, enum ug_mode mode,
1998 setting_main_appdata *ad = (setting_main_appdata *) priv;
2003 SETTING_TRACE_BEGIN;
2005 base = (Evas_Object *) ug_get_layout(ug);
2010 case UG_MODE_FULLVIEW:
2011 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
2013 elm_win_resize_object_add(ad->win_main, base);
2014 evas_object_show(base);
2023 /* ***************************************************
2027 ***************************************************/
2029 void setting_main_click_list_item_reset_data(void *data,
2032 SETTING_TRACE_BEGIN;
2033 setting_main_appdata *ad = (setting_main_appdata *) data;
2035 ad->isInUGMode = FALSE;
2040 void /* obj is the layout clicked */
2041 setting_main_click_list_item_ug_cb(void *data, Evas_Object *obj,
2042 char *ug_to_load, service_h svc,
2045 SETTING_TRACE_BEGIN;
2046 setting_main_appdata *ad = (setting_main_appdata *) data;
2048 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
2052 char ug_file[PATH_MAX];
2054 (ug_file, PATH_MAX, "%s/libug-%s.so", SETTING_UG_PATH,
2057 SETTING_TRACE("ug_file:%s", ug_file);
2058 if (!ecore_file_exists(ug_file)) {
2059 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
2063 SETTING_TRACE("to create libug-%s.so", ug_to_load);
2064 ad->ug = ug_create(NULL, ug_to_load, UG_MODE_FULLVIEW, svc, cbs);
2066 ad->isInUGMode = TRUE;
2069 evas_object_show(ad->ly_main);
2071 SETTING_TRACE_ERROR("errno:%d", errno);
2072 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
2078 setting_main_click_list_default_ug_cb(void *data, Evas_Object *obj,
2081 setting_main_appdata *ad = data;
2082 setting_create_simple_popup(ad, ad->win_main, NULL,
2086 void setting_main_click_list_more_cb(void *data, Evas_Object *obj, void *event_info)
2088 SETTING_TRACE_BEGIN;
2089 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2090 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2091 elm_genlist_item_selected_set(item, EINA_FALSE);
2092 retm_if(data == NULL, "Invalid argument: data is NULL");
2093 setting_main_appdata *ad = data;
2094 Setting_GenGroupItem_Data *selected_item_data =
2095 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2096 SETTING_TRACE("selected_item_data->keyStr:%s", selected_item_data->keyStr);
2097 if (0 == safeStrCmp(selected_item_data->keyStr, KeyStr_MoreConnect))
2099 ad->view_load = SETTING_VIEW_CONNECTIVE_MORE;
2101 else if (0 == safeStrCmp(selected_item_data->keyStr, KeyStr_MoreSystem))
2103 ad->view_load = SETTING_VIEW_SYSTEM_MORE;
2109 setting_view_change(&setting_view_main, &setting_view_more_menu, ad);
2114 setting_main_click_list_ex_ug_cb(void *data, Evas_Object *obj,
2117 SETTING_TRACE_BEGIN;
2118 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2119 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2121 elm_genlist_item_selected_set(item, EINA_FALSE);
2123 if (g_main_ad->ug) {
2125 ("[ad->ug non-NULL]skip genlist click event!!");
2131 if (NULL == data) { /* pass NULL to ug_args when create setting.cfg. */
2132 setting_create_simple_popup(g_main_ad,
2133 g_main_ad->win_main,
2134 NULL, NO_UG_FOUND_MSG);
2139 setting_main_appdata *ad = g_main_ad;
2141 /* if UG is created by Setting app, setting_main_click_list_ex_ug_cb is diabled. */
2142 if (ad->isInUGMode) {
2143 SETTING_TRACE("isInUGMode : TRUE - another UG is running now.");
2144 ad->isInUGMode = FALSE;
2149 ("isInUGMode : FALSE - another UG is NOT running now.")
2152 Setting_GenGroupItem_Data *selected_item_data =
2153 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2154 setting_main_click_list_item_reset_data(ad, obj);
2155 const char *item_name = _(selected_item_data->keyStr);
2158 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
2159 setting_retm_if(!cbs, "calloc failed");
2160 cbs->layout_cb = setting_main_layout_ug_cb;
2161 cbs->result_cb = setting_main_result_ug_cb;
2162 cbs->destroy_cb = setting_main_destroy_ug_cb;
2163 cbs->priv = (void *)ad;
2165 char *path = get_ug_path_from_ug_args(data);
2166 service_h svc = get_bundle_from_ug_args(data);
2167 setting_main_click_list_item_ug_cb(ad, obj, path, svc, cbs);
2174 service_destroy(svc);
2177 setting_main_click_list_plugin_cb(void *data, Evas_Object *obj,
2180 SETTING_TRACE_BEGIN;
2181 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2182 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2183 elm_genlist_item_selected_set(item, EINA_FALSE);
2185 setting_main_appdata *ad = data;
2187 if (ad->plugin_path)
2189 PluginNode* plugin_node = setting_plugin_create();
2191 plugin_node->plugin_path = strdup(ad->plugin_path);
2193 setting_plugin_load(plugin_node, (const char *)ad->plugin_path);
2194 ad->plugin_node = (void*)plugin_node;
2199 free(ad->plugin_path);
2200 ad->plugin_path = NULL;
2207 void setting_main_list_mouse_up_cb(void *data, Evas_Object *eo,
2210 SETTING_TRACE_BEGIN;
2211 retm_if(data == NULL, "Data parameter is NULL");
2212 Setting_GenGroupItem_Data *list_item =
2213 (Setting_GenGroupItem_Data *) data;
2214 SETTING_TRACE("process item [%s]", list_item->keyStr);
2215 list_item->chk_status = elm_check_state_get(eo); /* for update new state */
2217 SETTING_TRACE("change radio[%s], status is:%d", _(list_item->keyStr),
2218 list_item->chk_status);
2219 /*setting_main_appdata *ad = g_main_ad;*/
2221 if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
2223 if (elm_check_state_get(eo)) {
2224 setting_set_bool_slp_key
2225 (BOOL_SLP_SETTING_USE_PACKET_DATA,
2226 SETTING_ON_OFF_BTN_ON, &err);
2228 setting_set_bool_slp_key
2229 (BOOL_SLP_SETTING_USE_PACKET_DATA,
2230 SETTING_ON_OFF_BTN_OFF, &err);
2233 } else if (!safeStrCmp(KeyStr_Landscape, list_item->keyStr)) {
2234 vconf_set_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, ! list_item->chk_status);
2240 void setting_main_sel_list_mouse_up_cb(void *data, Evas_Object *eo,
2243 SETTING_TRACE_BEGIN;
2244 setting_retm_if(data == NULL, "Data parameter is NULL");
2246 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2247 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2248 elm_genlist_item_selected_set(item, 0);
2249 Setting_GenGroupItem_Data *list_item =
2250 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2252 list_item->chk_status = elm_check_state_get(list_item->eo_check);
2255 /*setting_main_appdata *ad = (setting_main_appdata *) data;*/
2257 if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
2258 /* setting_reset_slp_key_by_status(eo, BOOL_SLP_SETTING_USE_PACKET_DATA); */
2260 setting_set_bool_slp_key(BOOL_SLP_SETTING_USE_PACKET_DATA,
2261 list_item->chk_status, &err);
2263 } else if (!safeStrCmp(KeyStr_Landscape, list_item->keyStr)) {
2264 vconf_set_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, (list_item->chk_status));
2270 void __alternate_flight_mode(Evas_Object *check)
2272 SETTING_TRACE_BEGIN;
2274 Eina_Bool status = elm_check_state_get(check);
2275 SETTING_TRACE("flight mode status : %d", status);
2276 setting_main_appdata *ad = g_main_ad;
2278 //Check whether some requestion is processing by TAPI
2279 if (ad->b_fm_requesting)
2281 //Do nothing, just mark the lastest operation..
2282 SETTING_TRACE("Some requestion is processing by TAPI, wait to process");
2283 ad->fm_waiting_op = status ? FM_ENTER : FM_LEAVE;
2287 //otherwise, invalid waiting operation and send requsetion to TAPI:
2288 ad->fm_waiting_op = FM_INVALID;
2290 ret = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
2291 setting_retm_if(ret != TAPI_API_SUCCESS,
2292 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
2294 ret = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
2295 setting_retm_if(ret != TAPI_API_SUCCESS,
2296 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
2300 ad->b_fm_requesting = TRUE;
2305 setting_main_click_list_network_ug_cb(void *data, Evas_Object *obj,
2308 SETTING_TRACE_BEGIN;
2309 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2310 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2312 elm_genlist_item_selected_set(item, EINA_FALSE);
2314 if (g_main_ad->ug) {
2316 ("[ad->ug non-NULL]skip genlist click event!!");
2322 setting_main_appdata *ad = g_main_ad;
2323 setting_main_click_list_item_reset_data(ad, obj);
2327 setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err);
2328 SETTING_TRACE("value:%d", value);
2330 case VCONFKEY_TELEPHONY_SIM_INSERTED:
2332 struct ug_cbs *cbs =
2333 (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
2334 setting_retm_if(!cbs, "calloc failed");
2335 cbs->layout_cb = setting_main_layout_ug_cb;
2336 cbs->result_cb = setting_main_result_ug_cb;
2337 cbs->destroy_cb = setting_main_destroy_ug_cb;
2338 cbs->priv = (void *)ad;
2339 setting_main_click_list_item_ug_cb(data, obj,
2340 "setting-network-efl",
2345 case VCONFKEY_TELEPHONY_SIM_NOT_PRESENT:
2346 setting_create_simple_popup(NULL, ad->win_main,
2347 NULL, _("IDS_ST_HEADER_INSERT_SIM_CARD_ABB"));
2348 SETTING_TRACE("%s*** [ERR] No SIM. sim_slot_type=%d ***%s",
2349 SETTING_FONT_RED, value, SETTING_FONT_BLACK);
2352 case VCONFKEY_TELEPHONY_SIM_CARD_ERROR:
2353 case VCONFKEY_TELEPHONY_SIM_UNKNOWN:
2354 setting_create_simple_popup(NULL, ad->win_main,
2355 NULL,_("IDS_COM_BODY_INVALID_SIM_CARD"));
2356 SETTING_TRACE("%s*** [ERR] Invalid SIM. sim_slot_type=%d ***%s",
2357 SETTING_FONT_RED, value, SETTING_FONT_BLACK);
2367 setting_main_click_Gendial_list_flight_mode_cb(void *data, Evas_Object *obj,
2371 setting_retm_if(data == NULL, "Data parameter is NULL");
2373 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2374 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2375 elm_genlist_item_selected_set(item, 0);
2376 Setting_GenGroupItem_Data *list_item =
2377 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2378 int old_status = elm_check_state_get(list_item->eo_check);
2380 list_item->chk_status = !old_status;
2381 elm_check_state_set(list_item->eo_check, list_item->chk_status);
2383 __alternate_flight_mode(list_item->eo_check);
2388 setting_main_click_list_flight_mode_cb(void *data, Evas_Object *obj,
2391 SETTING_TRACE_BEGIN;
2392 retm_if(data == NULL, "Data parameter is NULL");
2393 Setting_GenGroupItem_Data *list_item =
2394 (Setting_GenGroupItem_Data *) data;
2395 list_item->chk_status = elm_check_state_get(obj); /* for update new state */
2396 SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2397 list_item->chk_status);
2399 __alternate_flight_mode(obj);
2405 * store current selection in setting.cfg
2407 void setting_try_save_check_list(void *data)
2409 SETTING_TRACE_BEGIN;
2410 setting_main_appdata *ad = (setting_main_appdata *) data;
2412 Eina_List *check_list = ad->item_check_list;
2413 Setting_GenGroupItem_Data *list_item = NULL;
2414 int update_count = 0;
2416 while (check_list) {
2417 list_item = (Setting_GenGroupItem_Data *) eina_list_data_get(check_list);
2418 if (NULL == list_item) continue;
2421 if (list_item->chk_status) {
2422 /* to update config file */
2423 setting_cfg_set_pos(list_item->keyStr, Cfg_Item_Pos_Level0);
2425 /* to update config file */
2426 setting_cfg_set_pos(list_item->keyStr, Cfg_Item_Pos_Level1);
2428 check_list = eina_list_next(check_list);
2431 if (update_count == 0) {
2432 /* to popup tips notify */
2434 setting_cfg_file_update();
2440 setting_main_click_edit_preferred_cb(void *data, Evas_Object *obj, void *event_info)
2442 SETTING_TRACE_BEGIN;
2444 setting_main_appdata *ad = (setting_main_appdata *) data;
2445 ad->view_type = SETTING_VIEW_ALL_CHECK;
2446 __setting_create_prefered_view(ad);
2447 __load_check_list(ad, &(ad->edit_preferred_genlist), NULL);