+++ /dev/null
-#ifndef __SETTING_HANDLER_H__
-#define __SETTING_HANDLER_H__
-
-#include <setting.h>
-
-mainlist_entry *settinig_drawer_hash_find(void *cb, char *search_str);
-void settinig_drawer_hash_init(void *cb);
-void settinig_drawer_hash_deinit(void *cb);
-
-#endif /* __SETTING_HANDLER_H__ */
-
+++ /dev/null
-#ifndef __SETTING_HELPER_H__
-#define __SETTING_HELPER_H__
-
-#include <setting.h>
-
-bool is_searchmode_app(Cfg_Item_Type type);
-
-#endif
Cfg_Item_On = 1 /* same order - vconf 1 (boolean) */
} Cfg_Item_State;
-typedef enum _Cfg_Item_Reset_Type {
- Cfg_Item_unResetable = 0, Cfg_Item_Resetable = 1,
-} Cfg_Item_Reset_Type;
-
-typedef enum _cfg_error_type {
- Cfg_Error_Type_Sucess = 0,
- Cfg_Error_Type_CreateCfg_Failed = -1,
- Cfg_Error_Type_Mkdir_Failed = -2,
- Cfg_Error_Type_RemoveCfg_Failed = -3,
- Cfg_Error_Type_ReadCfg_Failed = -4,
- Cfg_Error_Type_DirPermissionDenied = -5,
- Cfg_Error_Type_FilePermissionDenied = -6,
- Cfg_Error_Type_OutOfMemory = -7,
-} Cfg_Error_Type;
-
/**
* 1, 4, 5, 6 - ug mode
* 2, 3,
*/
typedef enum _Cfg_Item_Type {
- Cfg_Item_Node_Error = 0, /** Error - no action */
- /** no UG, no app launching, just menu name - create Grid */
- Cfg_Item_Ui_Node = 2,
- Cfg_Item_Title_Node = 3, /** view name - create Grid */
- /** app type - by launcher - read doc '4' */
- Cfg_Item_App_Node = 4,
- Cfg_Item_View_Node = 5, /** view name - 2depth search */
- /** app launcher (NOT Ug) - don't create Grid */
- Cfg_Item_AppLauncher_Node = 6,
- /** view name - 2depth search by app-launcher */
- Cfg_Item_AppLauncher_View_Node = 7,
- /** no UG, no app launching, just menu name - create Grid */
- Cfg_Item_Ui_Node_Toggle = Cfg_Item_Ui_Node + 10,
- /** view name - 2depth search with toggle button */
- Cfg_Item_View_Node_Toggle = Cfg_Item_View_Node + 10,
- /** app launcher (NOT Ug) - don't create Grid */
- Cfg_Item_AppLauncher_Node_Toggle = Cfg_Item_AppLauncher_Node + 10,
-
+ Cfg_Item_Node_Error = 0,
+ Cfg_Item_Title_Node = 3,
+ Cfg_Item_AppLauncher_Node = 6
} Cfg_Item_Type;
typedef struct {
typedef struct {
char *key_name; /** key name */
char *icon_path; /** icon path */
- char *ug_args; /** UG path or hyperlink */
+ char *app_ctl_args; /* app control arguments */
int pos; /** position : 1st, 2st -- deprecated */
- Cfg_Item_Reset_Type reset_type; /** if ug supports Reset function */
- int click_times; /** UG menu need to check */
Cfg_Item_Type item_type; /** 0:item 1:header title */
-
- /* app code */
- void *data; /** Setting_GenGroupItem_Data type ptr */
- char *sub_index; /** sub_index */
cfg_func_table *tfunc;
- char *uuid; /** primary key */
- int last_clicked; /** the time of last clicked*/
- char *shortcut_appid; /** appid to add shortcut */
} Setting_Cfg_Node_T;
Setting_Cfg_Node_T *get_cfg_node_first();
int get_cfg_array_size();
-int setting_cfg_create(bool check_ug_exist);
-int setting_cfg_migrate(void);
-
-char *setting_cfg_get_path();
-
-int setting_cfg_init(void);
-
-void setting_cfg_exit(void);
-
-int setting_cfg_get_category_length(void);
-
-char *setting_cfg_get_category_name(int category_index);
-
-int setting_cfg_get_menu_length(int category_index);
-
-char *setting_cfg_get_string_field_idx(int category_index, int menu_index,
- char *field_name);
-
-int setting_cfg_get_int_field_idx(int category_index, int menu_index,
- char *field_name);
-
-char *setting_cfg_get_icon_path_idx(int category_index, int menu_index);
-
-char *setting_cfg_get_ug_args_idx(int category_index, int menu_index);
-
-char *setting_cfg_get_keyname_idx(int category_index, int menu_index);
-
-int setting_cfg_get_click_times_idx(int category_index, int menu_index);
-
-int setting_cfg_get_click_times(char *keyname);
-
-void setting_cfg_set_click_times_idx(int category_index, int menu_index,
- int click_times);
-
-void setting_cfg_set_click_times(char *keyname, int click_times);
-
-int setting_cfg_get_last_clicked_idx(int category_index, int menu_index);
-
-void setting_cfg_set_last_clicked_idx(int category_index, int menu_index,
- int last_clicked);
-
extern char *get_path_from_args(void *data);
extern app_control_h get_svc_from_args(void *data);
extern Setting_Cfg_Node_T *get_cfg_node_by_keystr(const char *keystr);
-extern int set_node_pointer(char *name, void *ptr);
-
#endif
extern Eina_List *setting_get_language_list();
extern void setting_get_language_list_destroy();
-/*------------------------------------------------------------------------- */
-/* export&import function */
-typedef int (*status_handler_fp)(int total, int current, void *data);
-
-extern char *setting_export_json(status_handler_fp fp, void *data);
-extern void setting_import_json(status_handler_fp fp, void *data);
-
-
-
#endif /* __SETTING_COMMON_DATA_SLP_SETTING_H__ */
#define IMG_DateTime SETTING_LIST_ICON_PATH_CFG"settings_date_and_time.png"
#define IMG_AboutDevice SETTING_LIST_ICON_PATH_CFG"settings_about_device.png"
-
-/****Others****/
-
-/* uuid as Setting_Cfg_Node_T primary key */
-#define uuid_Connectivity "1c83e280-3111-42d7-825f-a8f0f2e79577"
-#define uuid_WiFi "14cd6b4c-9133-c571-c11f-8cbca16a025a"
-#define uuid_Bluetooth "beaf505a-d83c-938d-e9f5-44a5638e75db"
-#define uuid_MobileAP "1a9b3432-f7a9-0391-134e-03c5a8cab5ba"
-#define uuid_FlightMode "0f357cea-91bf-0485-2a8b-53569b490827"
-#define uuid_DataUsage "673eda22-db3e-c12b-b0f6-485867760a11"
-#define uuid_Location "86029052-c87e-ab5c-2a09-2c1fef36a524"
-#define uuid_Network "14dacb84-ec2c-d371-1865-a1509d9d95ac"
-#define uuid_NFC "d5a369bc-f241-9ccc-013b-7aab4bf182c8"
-#define uuid_WiFiDirect "6f83b633-dbfe-d056-af33-ff624d48d866"
-#define uuid_SoundDisplay "d22ac480-21b3-e81f-a2fd-f232d06b8a0f"
-#define uuid_Sounds "addd75c8-da64-53ae-e866-019ea8f66f08"
-#define uuid_Display "4340842d-09d1-2dba-ab2a-283763ec4ec2"
-#define uuid_Personal "cca58ed0-53f0-d1ca-3a81-2e3171c9a13f"
-#define uuid_HomeAndLockscreen "1708b9fa-b802-9a30-9ae7-ae3574533b3e"
-#define uuid_HomeScreen "931b0266-c78a-0923-21c0-9ed22b263706"
-#define uuid_LockedScreen "f75bf0dd-744e-3212-c522-a7c25af41c9f"
-#define uuid_Menuscreen "76f9bb4c-fdd8-a1c2-1a36-be5156b32e28"
-#define uuid_Wallpaper "345d2710-13cc-875a-b367-a7b0d6b7ef0b"
-#define uuid_Accessibility "6167dc9e-6c41-7970-bd12-c34ba3c6961e"
-#define uuid_Call "7935d4dc-0ac0-665b-995c-e6d038a34643"
-#define uuid_Motions "0c5981e6-fe5f-fc79-2e75-1389409fbbdb"
-#define uuid_Accounts "af754880-549f-9b0f-2b6e-611e0f824135"
-#define uuid_Reset "a5535088-601b-05bb-3bc6-7b6667f3270a"
-#define uuid_DeviceMange "bc11e5c6-7837-5801-8eac-57504093e285"
-#define uuid_LanguageKeyboard "624e0a2c-10c3-3b46-8665-4f60bf875bbe"
-#define uuid_DateTime "c79eae8d-8eec-5bf8-9f94-4ecfad09e4ee"
-#define uuid_ManageApps "c3e7db1d-cb96-b52e-f8ea-6be02ceebe8d"
-#define uuid_APP "62B00308-89CA-453D-96AC-1C3B6E42BF41"
-#define uuid_Storage "a5a4121c-0c7b-d6ed-81b6-0f4118aad364"
-#define uuid_Security "8a684695-8396-cd24-dd7d-c8a3643beca5"
-#define uuid_DeveloperOption "380f3cfb-0f06-cc99-fe58-96f830e0630e"
-#define uuid_AboutPhone "4d02a807-d0c4-0b0c-8497-5133eebed91a"
-
-
#endif /* end of __SETTING_COMMON_RESOURCE */
#include "setting-cfg.h"
#include "setting-debug.h"
-#include <json-glib/json-glib.h>
#include "setting-common-general-func.h"
#include "setting-common-data-type.h"
#include "setting-common-data-slp-setting.h"
#include <vconf.h>
-JsonParser *parser = NULL;
-JsonNode *root = NULL; /* category_list */
-static char *cfg_dir_path = NULL;
-static char *cfg_file_path = NULL;
-
-EXPORT_PUBLIC
-char *setting_cfg_get_dir_path()
-{
- if (!cfg_dir_path)
- cfg_dir_path = app_get_data_path();
- return cfg_dir_path;
-}
-
-EXPORT_PUBLIC
-char *setting_cfg_get_path()
-{
- if (!cfg_file_path) {
- char *path = setting_cfg_get_dir_path();
- retv_if(!path, NULL);
- char string[PATH_MAX];
- snprintf(string, PATH_MAX - 1, "%s%s", path, "setting.cfg");
- cfg_file_path = strdup(string);
- }
- return cfg_file_path;
-}
-
-int setting_cfg_file_write(JsonNode *node);
-
-#define __create_an_item(item_name, icon_path, ug_args, shortcut_appid, \
- defaultPos, item_type, is_resetable, ug_exist, uuid, \
- click_times, last_clicked) do {\
- menu_item = json_node_new(JSON_NODE_OBJECT); \
- object = json_object_new(); \
- json_node_take_object(menu_item, object); \
- json_object_set_string_member(object, "key_name", item_name); \
- json_object_set_string_member(object, "icon_path", icon_path); \
- json_object_set_string_member(object, "ug_args", ug_args); \
- json_object_set_string_member(object, "shortcut_appid", \
- shortcut_appid); \
- json_object_set_int_member(object, "pos", defaultPos); \
- json_object_set_int_member(object, "click_times", click_times);\
- json_object_set_int_member(object, "item_type", item_type); \
- json_object_set_int_member(object, "is_resetable", \
- is_resetable); \
- json_object_set_int_member(object, "last_clicked", \
- last_clicked); \
- json_object_set_string_member(object, "uuid", uuid); \
- json_array_add_element(menu, menu_item); \
-} while (0);
-
-#define __create_a_menu(menu_name) {\
- category = json_node_new(JSON_NODE_OBJECT);\
- object = json_object_new();\
- json_node_take_object(category, object);\
- json_object_set_string_member(object, "name", menu_name);\
- menu = json_array_new();\
- json_object_set_array_member(object, "menu", menu);\
- json_array_add_element(json_node_get_array(category_list), \
- category);\
-}
-
int wifi_toggle_get_state(Cfg_Item_State *stat, void *data);
int flightmode_toggle_get_state(Cfg_Item_State *stat, void *data);
int bluetooth_toggle_get_state(Cfg_Item_State *stat, void *data);
int drivingmode_toggle_get_state(Cfg_Item_State *stat, void *data);
int network_restriction_mode_toggle_get_state(Cfg_Item_State *stat, void *data);
-int personalmode_toggle_get_state(Cfg_Item_State *stat, void *data);
int nfc_toggle_get_state(Cfg_Item_State *stat, void *data);
/*////////////////////////////////////////////////////////////////////////// */
.set_item_state = NULL,
.set_item_update_ui = NULL, };
-/* driving mode - Done */
-EXPORT_PUBLIC
-cfg_func_table drivingmode_tfunc = {
- .get_item_state = drivingmode_toggle_get_state,
- .set_item_state = NULL,
- .set_item_update_ui = NULL, };
-
-/* network restrictrion mode - Done */
-EXPORT_PUBLIC
-cfg_func_table network_restruction_mode_tfunc = {
- .get_item_state = network_restriction_mode_toggle_get_state,
- .set_item_state = NULL,
- .set_item_update_ui = NULL, };
-
-/* personal mode ?? - partially done */
-EXPORT_PUBLIC
-cfg_func_table personalmode_tfunc = {
- .get_item_state = personalmode_toggle_get_state,
- .set_item_state = NULL,
- .set_item_update_ui = NULL, };
-
/* NFC - ??? */
EXPORT_PUBLIC
cfg_func_table nfc_tfunc = {
/* create config file from scratch */
static Setting_Cfg_Node_T s_cfg_node_array[] = {
{ KeyStr_Connections, NULL, "move://Tab2.top",
- Cfg_Item_Pos_Level0, 0, 0, Cfg_Item_Title_Node,
- NULL, NULL, NULL, uuid_Connectivity, 0, NULL},
-
+ Cfg_Item_Pos_Level0, Cfg_Item_Title_Node, NULL
+ },
{ KeyStr_WiFi,
IMG_WiFi,
"wifi-efl-ug",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Connections,
- &wifi_tfunc,
- uuid_WiFi,
- 0,
- "wifi-efl-ug"},
+ &wifi_tfunc
+ },
{ KeyStr_Bluetooth,
IMG_Bluetooth,
"ug-bluetooth-efl",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Connections,
- &bluetooth_tfunc,
- uuid_Bluetooth,
- 0,
- "ug-bluetooth-efl"},
+ &bluetooth_tfunc
+ },
/*
{ "IDS_SM_HEADER_DATA_USAGE_ABB",
SETTING_LIST_ICON_PATH_CFG"settings_data_usage.png",
KeyStr_Device,
NULL,
"",
- 0,
- "org.tizen.setting-data"},
+ 0},
*/
#ifdef TIZEN_BUILD_TARGET
{ KeyStr_FlightMode,
IMG_FlightMode,
"org.tizen.setting-flightmode",
Cfg_Item_Pos_Level0,
- Cfg_Item_unResetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Connections,
- &flightmode_tfunc,
- uuid_FlightMode,
- 0,
- "org.tizen.setting-flightmode"},
+ &flightmode_tfunc
+ },
#endif
#ifdef TIZEN_BUILD_EMULATOR
{ KeyStr_NFC,
IMG_NFC,
"ug-nfc-efl|type:nfc",
Cfg_Item_Pos_Level0,
- Cfg_Item_unResetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Connections,
- &nfc_tfunc,
- uuid_NFC,
- 0,
- "ug-nfc-efl"},
+ &nfc_tfunc
+ },
#endif
{ KeyStr_MobileAP,
IMG_MobileAP,
"ug-setting-mobileap-efl",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Connections,
- NULL,
- uuid_MobileAP,
- 0,
- NULL},
+ NULL
+ },
#ifdef TIZEN_BUILD_TARGET
{ KeyStr_MobileNetworks,
IMG_Network,
"org.tizen.setting-network",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Connections,
- NULL,
- uuid_Network,
- 0,
- "org.tizen.setting-network"},
+ NULL
+ },
#endif
#ifdef USE_TIZEN_CONNECT
{ KeyStr_Tizenconnect,
IMG_Tizenconnect,
"org.tizen.d2d-conv-setting",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Connections,
- NULL,
- uuid_Network,
- 0,
- "org.tizen.d2d-conv-setting"},
+ NULL
+ },
#endif
/* Group:Device */
{ KeyStr_Device, NULL, "move://Tab3.top", Cfg_Item_Pos_Level0,
- 0, 0, Cfg_Item_Title_Node, NULL, NULL, NULL,
- uuid_SoundDisplay, 0, NULL},
-
+ Cfg_Item_Title_Node, NULL
+ },
{ KeyStr_Sounds,
IMG_Sounds,
"org.tizen.setting-profile",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Device,
- NULL,
- uuid_SoundDisplay,
- 0,
- "org.tizen.setting-profile"},
+ NULL
+ },
{ KeyStr_Display,
IMG_Display,
"org.tizen.setting-display|viewtype:main",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Device,
- NULL,
- uuid_Display,
- 0,
- "org.tizen.setting-display"},
+ NULL
+ },
{ KeyStr_ApplicationsItem,
IMG_Applications,
"org.tizen.setting-applications",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Device,
- NULL,
- uuid_Display,
- 0,
- "org.tizen.setting-applications"},
-
+ NULL
+ },
/* Group: Personal */
{ KeyStr_Personal, NULL, "move://Tab3.top", Cfg_Item_Pos_Level0,
- 0, 0, Cfg_Item_Title_Node, NULL, NULL, NULL, uuid_Personal,
- 0, NULL},
-
+ Cfg_Item_Title_Node, NULL
+ },
{ KeyStr_Wallpaper,
IMG_Wallpaper,
"org.tizen.wallpaper-ui-service",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Personal,
- NULL,
- uuid_HomeAndLockscreen,
- 0,
- "org.tizen.setting.wallpaper-ui-service"},
+ NULL
+ },
{ KeyStr_LockScreen,
IMG_LockedScreen,
"org.tizen.ug-lockscreen-options",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Personal,
- NULL,
- uuid_LockedScreen,
- 0,
- "org.tizen.ug-lockscreen-options"
+ NULL
},
{ KeyStr_Accessibility,
IMG_Accessibility,
"org.tizen.setting-accessibility",
Cfg_Item_Pos_Level0,
- Cfg_Item_unResetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Personal,
- NULL,
- uuid_Accounts,
- 0,
- "org.tizen.setting-accessibility"},
+ NULL
+ },
/*Privacy and security */
{ KeyStr_Privacy,
IMG_Privacy,
"org.tizen.setting-privacy",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Personal,
- NULL,
- uuid_Network,
- 0,
- "org.tizen.setting-privacy"},
+ NULL
+ },
{ KeyStr_Accounts,
IMG_Accounts,
"setting-myaccount-efl|mode:account_list",
Cfg_Item_Pos_Level0,
- Cfg_Item_unResetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_Personal,
- NULL,
- uuid_Accounts,
- 0,
- "setting-myaccount-efl"},
+ NULL
+ },
/* Backup and reset: */
{ "IDS_ST_BODY_BACKUP_AND_RESET",
SETTING_LIST_ICON_PATH_CFG"settings_backup_and_reset.png",
"org.tizen.setting-backup-and-reset",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- "IDS_ST_HEADER_PERSONALISATION",
- NULL,
- uuid_LanguageKeyboard,
- 0,
- "org.tizen.setting-backup-and-reset"
+ NULL
},
/* Group: System */
- { KeyStr_System, NULL, "move://Tab4.top", Cfg_Item_Pos_Level0, 0,
- 0, Cfg_Item_Title_Node, NULL, NULL, NULL, uuid_DeviceMange, 0,
- NULL},
-
+ { KeyStr_System, NULL, "move://Tab4.top", Cfg_Item_Pos_Level0,
+ Cfg_Item_Title_Node, NULL
+ },
{ KeyStr_LanguageInput,
IMG_LanguageInput,
"org.tizen.setting-language-and-input",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_System,
- NULL,
- uuid_LanguageKeyboard,
- 0,
- "org.tizen.setting-language-and-input"},
-
+ NULL
+ },
{ KeyStr_Battery,
IMG_Battery,
-
"org.tizen.setting-battery",
Cfg_Item_Pos_Level0,
-
- Cfg_Item_Resetable,
- 0,
-
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_System,
- NULL,
- uuid_LanguageKeyboard,
- 0,
- "org.tizen.setting-battery"},
+ NULL
+ },
{ "IDS_ST_BODY_DATA",
SETTING_LIST_ICON_PATH_CFG"settings_data_usage.png",
-
"org.tizen.setting-data",
Cfg_Item_Pos_Level0,
-
- Cfg_Item_Resetable,
- 0,
-
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_System,
- NULL,
- uuid_LanguageKeyboard,
- 0,
- "org.tizen.setting-data"},
+ NULL
+ },
#if SUPPORT_STORAGE
{ KeyStr_Storage,
IMG_Storage,
"org.tizen.setting-storage",
Cfg_Item_Pos_Level0,
- Cfg_Item_unResetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_System,
- NULL,
- uuid_Storage,
- 0,
- "org.tizen.setting-storage"},
+ NULL
+ },
#endif
{ KeyStr_DateTime,
IMG_DateTime,
"org.tizen.setting-time",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_System,
- NULL,
- uuid_DateTime,
- 0,
- "org.tizen.setting-time"},
-
+ NULL
+ },
{ KeyStr_AboutDevice,
IMG_AboutDevice,
"org.tizen.setting-about",
Cfg_Item_Pos_Level0,
- Cfg_Item_Resetable,
- 0,
Cfg_Item_AppLauncher_Node,
- NULL,
- KeyStr_System,
- NULL,
- uuid_AboutPhone,
- 0,
- "org.tizen.setting-about"},
+ NULL
+ }
};
EXPORT_PUBLIC Setting_Cfg_Node_T *get_cfg_node_by_keystr(const char *keystr)
return NULL;
}
-EXPORT_PUBLIC int set_node_pointer(char *name, void *ptr)
-{
- int size = get_cfg_array_size();
-
- int i;
- for (i = 0; i < size; i++) {
- if (0 == safeStrCmp(name, s_cfg_node_array[i].key_name)) {
- /*return i; */
- s_cfg_node_array[i].data = ptr;
- return 0;
- }
- }
-
- return -1;
-}
-
EXPORT_PUBLIC
Setting_Cfg_Node_T *get_cfg_node_first()
{
return arr_size / node_size;
}
-/**
- * @brief
-
- Cfg_Item_Title_Node
- Cfg_Item_App_Node
- Cfg_Item_Ui_Node
- Cfg_Item_Ug_Node
- *
- * @param check_ug
- *
- * @return
- */
-EXPORT_PUBLIC
-int setting_cfg_create(bool check_ug_exist)
-{
- SETTING_TRACE_BEGIN;
- JsonNode *category_list, *category, *menu_item;
- JsonArray *menu = NULL;
- JsonObject *object = NULL;
-
- /* Category list */
- category_list = json_node_new(JSON_NODE_ARRAY);
- json_node_take_array(category_list, json_array_new());
-
- Setting_Cfg_Node_T *pitem = get_cfg_node_first(); /* head */
- int size = get_cfg_array_size();
- SETTING_TRACE(" size of array : %d ", size);
-
- int i;
- for (i = 0; i < size; i++) {
- SETTING_TRACE(" index : %d ", i);
- Cfg_Item_Type item_type = pitem[i].item_type % 10;
- if (item_type == Cfg_Item_Title_Node) {
- SETTING_TRACE(" add title : %s ", pitem[i].key_name);
-
- /* __create_a_menu HEADER */
- __create_a_menu(pitem[i].key_name);
-
- } else if (item_type == Cfg_Item_App_Node
- || item_type == Cfg_Item_Ui_Node
- || item_type == Cfg_Item_AppLauncher_Node) {
-
- __create_an_item(pitem[i].key_name, pitem[i].icon_path,
- pitem[i].ug_args,
- pitem[i].shortcut_appid, pitem[i].pos,
- pitem[i].item_type, pitem[i].reset_type,
- false, pitem[i].uuid,
- pitem[i].click_times,
- pitem[i].last_clicked);
- }
- }
- /* write to file */
- int ret = setting_cfg_file_write(category_list);
- json_node_free(category_list);
- return ret;
-}
-
-/* load file */
-EXPORT_PUBLIC
-int setting_cfg_file_read(void)
-{
- struct stat sb;
- memset(&sb, 0, sizeof(struct stat));
- int r = stat(setting_cfg_get_path(), &sb);
- if (0 != r)
- SETTING_TRACE("ERROR, r:%d", r);
-
- SETTING_TRACE("sb.st_size:%d", sb.st_size);
-
- parser = json_parser_new(); /* to be freed on exit */
- /* file -> parser */
- GError *error = NULL;
- /*gboolean ret = json_parser_load_from_file( parser,
- * setting_cfg_get_path(), &error ); */
- if (!sb.st_size
- || FALSE == json_parser_load_from_file(parser,
- setting_cfg_get_path(),
- &error)) {
- if (error)
- SETTING_TRACE_ERROR("error->message:%s",
- (char *)(error->message));
- /*return FALSE; */
-
- /* The file is existing and can be accessed normally, but it was
- * loaded failed as a json script, it means setting.cfg is
- * damaged(not the normal formatting ), we need to remove
- * the file and recreate in next running time*/
- SETTING_TRACE_ERROR(
- "The file[%s] is existing and can be accessed "
- "normally, but it was 0 size or loaded failed "
- "as a json script, it means setting.cfg is "
- "damaged (the formatting ia abnormal), we need "
- "to remove the file and recreate in next "
- "running time!",
- setting_cfg_get_path());
-
- SETTING_TRACE("Trying to removing the damaged file.");
- if (remove(setting_cfg_get_path()) != 0) {
- SETTING_TRACE_ERROR("Error to remove the damaged file");
- return FALSE;
- }
-
- if (FALSE == setting_cfg_create(true)) {
- SETTING_TRACE_ERROR(
- "Error to create a new config file");
- return FALSE;
- }
- /*if the failed is caused by reading the file recursively
- * invoking */
- return setting_cfg_file_read();
- }
-
- /* parser -> root */
- root = json_parser_get_root(parser); /* to be freed on exit*/
- return TRUE;
-}
-
-/**
- * @brief dump JSON to file
- */
-EXPORT_PUBLIC
-int setting_cfg_file_write(JsonNode *node)
-{
- GError *error = NULL;
- JsonGenerator *generator = json_generator_new();
- json_generator_set_root(generator, node);
- /*write file in indent format */
- g_object_set(generator, "pretty", TRUE, NULL);
- gboolean ret = json_generator_to_file(generator, setting_cfg_get_path(),
- &error);
- g_object_unref(generator);
-
- if (FALSE == ret) {
- SETTING_TRACE_ERROR("Error writing file %s!",
- setting_cfg_get_path());
- return FALSE;
- }
- return TRUE;
-}
-
-/* public functions */
-EXPORT_PUBLIC
-int setting_cfg_init(void)
-{
- retv_if(!setting_cfg_get_path(), Cfg_Error_Type_OutOfMemory);
-
- if (!access(setting_cfg_get_path(), R_OK | W_OK | F_OK)) {
- /* succeed to access */
- if (!setting_cfg_file_read()) { /* return FALSE */
- if (remove(setting_cfg_get_path()))
- return Cfg_Error_Type_RemoveCfg_Failed;
-
- return Cfg_Error_Type_ReadCfg_Failed;
- }
-
- return Cfg_Error_Type_Sucess;
- } else { /* fail to access */
- switch (errno) {
- /* file non-existing case */
- case ENOENT:
- SETTING_TRACE_ERROR("non-existing [%s]",
- setting_cfg_get_path());
- if (!ecore_file_is_dir(setting_cfg_get_dir_path())) {
- SETTING_TRACE_ERROR("non-existing [%s]",
- setting_cfg_get_dir_path());
- Eina_Bool flag = ecore_file_mkdir(
- setting_cfg_get_dir_path());
- if (flag == EINA_FALSE) {
- SETTING_TRACE_ERROR(
- ">failed to create dir");
- } else {
- SETTING_TRACE_ERROR(
- ">OK to create dir");
- }
- }
-
- if (!setting_cfg_create(true)) { /* return FALSE */
- SETTING_TRACE_ERROR(
- "Error to create a new config file");
- return Cfg_Error_Type_CreateCfg_Failed;
- }
-
- if (!setting_cfg_file_read()) { /* return FALSE */
- SETTING_TRACE_ERROR(
- "Error to read config file");
- if (remove(setting_cfg_get_path()))
- return Cfg_Error_Type_RemoveCfg_Failed;
-
- return Cfg_Error_Type_ReadCfg_Failed;
- }
-
- return Cfg_Error_Type_Sucess;
- /* other cases */
- case EACCES:
- case EROFS:
- default:
- return Cfg_Error_Type_DirPermissionDenied;
- }
- }
-}
-
-EXPORT_PUBLIC
-void setting_cfg_exit(void)
-{
- free(cfg_dir_path);
- cfg_dir_path = NULL;
-
- free(cfg_file_path);
- cfg_file_path = NULL;
-
- if (parser) {
- g_object_unref(parser);
- parser = NULL;
- }
-}
-
-EXPORT_PUBLIC
-int setting_cfg_get_category_length(void)
-{
- return json_array_get_length(json_node_get_array(root));
-}
-
-EXPORT_PUBLIC
-char *setting_cfg_get_category_name(int category_index)
-{
- JsonObject *category_obj = json_array_get_object_element(
- json_node_get_array(root), category_index);
- return (char *)json_object_get_string_member(category_obj, "name");
-}
-
-EXPORT_PUBLIC
-int setting_cfg_get_menu_length(int category_index)
-{
- JsonObject *category_obj = json_array_get_object_element(
- json_node_get_array(root), category_index);
- JsonArray *menu = json_object_get_array_member(category_obj, "menu");
- return json_array_get_length(menu);
-}
-
-EXPORT_PUBLIC
-char *setting_cfg_get_keyname_idx(int category_index, int menu_index)
-{
- JsonObject *category_obj = json_array_get_object_element(
- json_node_get_array(root), category_index);
- JsonArray *menu = json_object_get_array_member(category_obj, "menu");
- JsonObject *menu_item = json_array_get_object_element(menu, menu_index);
- return (char *)json_object_get_string_member(menu_item, "key_name");
-}
-
-EXPORT_PUBLIC
-char *setting_cfg_get_string_field_idx(int category_index, int menu_index,
- char *field_name)
-{
- JsonObject *category_obj = json_array_get_object_element(
- json_node_get_array(root), category_index);
- JsonArray *menu = json_object_get_array_member(category_obj, "menu");
- JsonObject *menu_item = json_array_get_object_element(menu, menu_index);
-
- char *data = (char *)json_object_get_string_member(menu_item,
- field_name);
- if (!safeStrCmp(data, "(null)")) {
- /* pass NULL to ug_args when create setting.cfg. */
- return NULL;
- }
- return data;
-}
-
-EXPORT_PUBLIC
-int setting_cfg_get_int_field_idx(int category_index, int menu_index,
- char *field_name)
-{
- JsonObject *category_obj = json_array_get_object_element(
- json_node_get_array(root), category_index);
- JsonArray *menu = json_object_get_array_member(category_obj, "menu");
- JsonObject *menu_item = json_array_get_object_element(menu, menu_index);
- return json_object_get_int_member(menu_item, field_name);
-}
-
-EXPORT_PUBLIC
-char *setting_cfg_get_icon_path_idx(int category_index, int menu_index)
-{
- return setting_cfg_get_string_field_idx(category_index, menu_index,
- "icon_path");
-}
-
-EXPORT_PUBLIC
-char *setting_cfg_get_ug_args_idx(int category_index, int menu_index)
-{
- return setting_cfg_get_string_field_idx(category_index, menu_index,
- "ug_args");
-}
-
-EXPORT_PUBLIC
-int setting_cfg_get_last_clicked_idx(int category_index, int menu_index)
-{
- return setting_cfg_get_int_field_idx(category_index, menu_index,
- "last_clicked");
-}
-
-EXPORT_PUBLIC
-void setting_cfg_set_last_clicked_idx(int category_index, int menu_index,
- int last_clicked)
-{
- JsonObject *category_obj = json_array_get_object_element(
- json_node_get_array(root), category_index);
- JsonArray *menu = json_object_get_array_member(category_obj, "menu");
- JsonObject *menu_item = json_array_get_object_element(menu, menu_index);
- json_object_remove_member(menu_item, "last_clicked");
- json_object_set_int_member(menu_item, "last_clicked", last_clicked);
-}
-
-EXPORT_PUBLIC
-int setting_cfg_get_click_times_idx(int category_index, int menu_index)
-{
- return setting_cfg_get_int_field_idx(category_index, menu_index,
- "click_times");
-}
-
-EXPORT_PUBLIC
-int setting_cfg_get_click_times(char *keyname)
-{
- int i, j;
- for (i = 0; i < setting_cfg_get_category_length(); i++) {
- for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
- if (safeStrCmp(setting_cfg_get_keyname_idx(i, j),
- keyname) == 0)
- return setting_cfg_get_click_times_idx(i, j);
- }
- }
- return 0;
-}
-
-EXPORT_PUBLIC
-void setting_cfg_set_click_times_idx(int category_index, int menu_index,
- int click_times)
-{
- JsonObject *category_obj = json_array_get_object_element(
- json_node_get_array(root), category_index);
- JsonArray *menu = json_object_get_array_member(category_obj, "menu");
- JsonObject *menu_item = json_array_get_object_element(menu, menu_index);
- json_object_remove_member(menu_item, "click_times");
- json_object_set_int_member(menu_item, "click_times", click_times);
-}
-
-EXPORT_PUBLIC
-void setting_cfg_set_click_times(char *keyname, int click_times)
-{
- int i, j;
- for (i = 0; i < setting_cfg_get_category_length(); i++) {
- for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
- if (safeStrCmp(setting_cfg_get_keyname_idx(i, j),
- keyname) == 0) {
- setting_cfg_set_click_times_idx(i, j,
- click_times);
- time_t ctime = time(NULL);
- setting_cfg_set_last_clicked_idx(i, j,
- (int)ctime);
- return;
- }
- }
- }
-
-}
-
/*other relative function*/
EXPORT_PUBLIC
char *get_path_from_args(void *data)
return err;
}
-/*////////////////////////////////////////////////////////////////////////// */
-/* personal mode */
-
-EXPORT_PUBLIC
-int personalmode_toggle_get_state(Cfg_Item_State *stat, void *data)
-{
- SETTING_TRACE_BEGIN;
- int err = 0;
- *stat = Cfg_Item_Off;
-
- int value;
- int ret = vconf_get_bool(VCONFKEY_SETAPPL_PERSONAL_MODE_STATUS_BOOL,
- &value);
- if (ret != 0) {
- SETTING_TRACE_ERROR("get vconf failed");
- *stat = Cfg_Item_Error;
- return -1;
- }
-
- *stat = (value) ? Cfg_Item_On : Cfg_Item_Off;
- return err;
-}
-
/*////////////////////////////////////////////////////////////////////////// */
/* NFC */
return safeStrCmp(str1, str2);
}
-EXPORT_PUBLIC
-void setting_import_json(status_handler_fp fp, void *data)
-{
- SETTING_TRACE_BEGIN;
- /*------------------------------------------------------------------ */
- JsonParser *parser;
- JsonNode *root;
- GError *error;
-
- /*---- */
- int bcount = sizeof(g_btable) / sizeof(g_btable[0]) - 1;
- int icount = sizeof(g_itable) / sizeof(g_itable[0]) - 1;
- /* why?? buggy */
- int scount = sizeof(g_stable) / sizeof(g_stable[0]) - 1;
- int total = bcount + icount + scount;
- SETTING_TRACE(" >>> total : %d ", total);
-
- VconfNode *arr3 = (VconfNode *)malloc(sizeof(VconfNode) * total);
- if (!arr3)
- return;
- memcpy(arr3, g_btable, sizeof(VconfNode) * (bcount));
- memcpy(&arr3[bcount - 1], g_itable, sizeof(g_itable));
- memcpy(&arr3[bcount - 1 + icount - 1], g_stable, sizeof(g_stable));
- qsort(arr3, total, sizeof(VconfNode), __compareByCategory);
- /*---- */
-
- g_sortedarr = arr3;
-
- parser = json_parser_new();
-
- error = NULL;
- json_parser_load_from_file(parser, SETTING_CFG_JSON_FILE_PATH, &error);
- if (error) {
- SETTING_TRACE("Unable to parse `%s': %s",
- SETTING_CFG_JSON_FILE_PATH, error->message);
- g_error_free(error);
- g_object_unref(parser);
- return;
- }
-
- root = json_parser_get_root(parser);
- /* manipulate the object tree and then exit */
-
- JsonObject *obj1 = json_node_get_object(root);
- if (json_object_has_member(obj1, "value")) {
- JsonNode *node = json_object_get_member(obj1, "value");
- JsonObject *object2 = json_node_get_object(node);
- /* with g_sortedarr */
- json_object_foreach_member(object2, __func_cb, NULL);
- }
- g_object_unref(parser);
-
- FREE(arr3);
- g_sortedarr = NULL;
-}
-
-/**
- * setting --> cloud : JSON
- *
- * int status_handler(int total, int current, void* data);
- */
-EXPORT_PUBLIC
-char *setting_export_json(status_handler_fp fp, void *data)
-{
- JsonNode *root = NULL;
-
- root = json_node_new(JSON_NODE_OBJECT);
- JsonObject *top = json_object_new();
- json_node_take_object(root, top);
-
- json_object_set_string_member(top, "key",
- "SETTINGS_359617040746834_8592d887-8b97-406e-9cf9-03aebc045f81");
-
- int bcount = sizeof(g_btable) / sizeof(g_btable[0]) - 1;
- int icount = sizeof(g_itable) / sizeof(g_itable[0]) - 1;
- /* why?? buggy */
- int scount = sizeof(g_stable) / sizeof(g_stable[0]) - 1;
-
- int total = bcount + icount + scount;
-
- JsonNode *topnode = json_node_new(JSON_NODE_OBJECT);
- JsonObject *topobj = json_object_new();
- json_node_take_object(topnode, topobj);
-
- json_object_set_member(top, "value", topnode);
-
- VconfNode *arr3 = (VconfNode *)malloc(sizeof(VconfNode) * total);
- if (!arr3)
- return NULL;
- memcpy(arr3, g_btable, sizeof(VconfNode) * (bcount));
- memcpy(&arr3[bcount - 1], g_itable, sizeof(g_itable));
- memcpy(&arr3[bcount - 1 + icount - 1], g_stable, sizeof(g_stable));
- qsort(arr3, total, sizeof(VconfNode), __compareByCategory);
-
- char *public_groupkey = "";
-
- /*JsonArray* array = NULL; */
- JsonObject *obj = NULL;
- JsonNode *node = NULL;
-
- int i;
- for (i = 0; i < total; i++) {
- if (arr3[i].public_key) {
- if (public_groupkey && safeStrCmp(public_groupkey,
- arr3[i].public_groupkey) != 0) {
- public_groupkey = (char *)(arr3[i].public_groupkey);
- /*array = json_array_new(); */
- obj = json_object_new();
- node = json_node_new(JSON_NODE_OBJECT);
- json_node_take_object(node, obj);
- json_object_set_member(topobj, public_groupkey,
- node);
- /*json_array_add_element(array, node); */
- }
-
- /* get data from vconf */
- /* get vconf_get */
- char *val = NULL;
- char arr[1024];
- VconfNode result;
- switch (arr3[i].type) {
- case eBOOL:
- get_vconf(arr3[i], &result);
- if (result.value.b)
- val = "true";
- else
- val = "false";
- break;
- case eINT:
- get_vconf(arr3[i], &result);
- snprintf(arr, 1024, "%d", result.value.i);
- val = arr;
- /*if (val == NULL) val = "-100"; */
- break;
- case eSTRING:
- get_vconf(arr3[i], &result);
- val = result.value.c;
- if (val == NULL)
- val = "";
- break;
- default:
- val = "error";
- }
-
- json_object_set_string_member(obj, arr3[i].public_key,
- val);
- }
- }
-
- /* save data to a file */
- GError *error = NULL;
- JsonGenerator *generator = json_generator_new();
- json_generator_set_root(generator, root/*node*/);
-
- gsize len;
- char *buf = (char *)json_generator_to_data(generator, &len);
-
- /*write file in indent format */
- g_object_set(generator, "pretty", TRUE, NULL);
- gboolean ret = json_generator_to_file(
- generator, SETTING_CFG_JSON_FILE_PATH,
- &error);
- g_object_unref(generator);
-
- if (FALSE == ret) {
- SETTING_TRACE_ERROR("Error writing file %s!",
- SETTING_CFG_JSON_FILE_PATH);
- /*return FALSE; */
- }
-
- json_node_free(root);
- FREE(arr3);
-
- return buf;
-}
int set_vconf(VconfNode node, VconfNode *result)
{
Evas_Smart_Cb btn_click_cb,
void *cb_data)
{
- LAUNCH_SETTING_IN();
retv_if(!parent, NULL);
Evas_Object *button = elm_button_add(parent);
return rsp_type;
}
-#define SUPPORT_STATIC_LOAD 1
-#if SUPPORT_STATIC_LOAD
-static char *system_service_list[MAX_SYSTEM_SERVICE_NUM] = { NULL, };
-#endif
-EXPORT_PUBLIC
-EXPORT_PUBLIC void clear_system_service_data()
-{
-#if SUPPORT_STATIC_LOAD
- int idx;
- for (idx = 0; idx < MAX_SYSTEM_SERVICE_NUM && system_service_list[idx];
- idx++) {
- FREE(system_service_list[idx]);
- }
-#endif
-}
-
/**
* [API] internal API (system-settings)
* should use g_free to free return string
*/
#include "setting-common-init.h"
-#include "setting-handler.h"
+#include "setting-common-general-func.h"
+#include "setting-common-draw-widget.h"
+#include "setting-debug.h"
+#include <efl_extension.h>
static Evas_Object *_create_main_window(char *name)
{
ADD_EXECUTABLE(${PROJECT_NAME}
./setting.c
- ./setting-handler.c
- ./setting-helper.c
./setting-main.c
)
+++ /dev/null
-#include "setting-handler.h"
-#include "setting-helper.h"
-
-extern void setting_main_click_list_cb(void *data, Evas_Object *obj,
- void *event_info);
-
-static Setting_GenGroupItem_Data *__default_handler(void *data, char *keyStr,
- char *icon_path, char *ug_args, Evas_Object *genlist,
- Elm_Object_Item *parent)
-{
- setting_main_appdata *ad = (setting_main_appdata *)data;
- Setting_GenGroupItem_Data *obj = setting_create_Gendial_field_def(
- genlist,
- &(ad->itc_table[GENDIAL_Type_1text_1icon_2]),
- setting_main_click_list_cb,
- ug_args,
- SWALLOW_Type_1ICON_1IMAGE,
- icon_path,
- NULL,
- 0,
- keyStr,
- NULL,
- NULL);
-
- return obj;
-}
-
-/*/////////////////////////////////////////////////////////////////////////// */
-/* list handler */
-static mainlist_entry mainlist_table[] = {
- {
- .title = "Default",
- .ui_handler = __default_handler,
- .type = DEFAULT_UI,
- .item_data = NULL },
- /*-------------------------------------------------------------- */
- {
- .title = NULL,
- .ui_handler = NULL,
- .type = ERROR_STATE,
- .item_data = NULL },
-};
-
-/*--------------------------------------------------------------------------- */
-/* hash table utility */
-static void _list_hash_free_cb(void *obj)
-{
- SETTING_TRACE_BEGIN;
- mainlist_entry *pnode = obj;
- if (pnode)
- SETTING_TRACE_DEBUG("Removing hash bucket for item: %s", pnode->title);
-}
-
-/* hash table utility */
-void settinig_drawer_hash_init(void *cb)
-{
- SETTING_TRACE_BEGIN;
- int i = 0;
- setting_main_appdata *ad = (setting_main_appdata *)cb;
-
- ad->main_list_hash = eina_hash_string_superfast_new(_list_hash_free_cb);
-
- for (i = 0; i < (sizeof(mainlist_table) / sizeof(mainlist_table[0])); i++)
- eina_hash_add(ad->main_list_hash, mainlist_table[i].title,
- &(mainlist_table[i]));
-}
-
-void settinig_drawer_hash_deinit(void *cb)
-{
- setting_main_appdata *ad = (setting_main_appdata *)cb;
- if (ad)
- eina_hash_free(ad->main_list_hash);
-}
-
-/* hash table utility */
-mainlist_entry *settinig_drawer_hash_find(void *cb, char *search_str)
-{
- setting_main_appdata *ad = (setting_main_appdata *)cb;
-
- if (!ad)
- return NULL;
-
- return eina_hash_find(ad->main_list_hash, search_str);
-}
-/*-------------------------------------------------------------------------- */
-
-/* ***************************************************
- *
- *call back func
- *
- ***************************************************/
-
-
-void setting_main_click_list_cb(void *data, Evas_Object *obj, void *event_info)
-{
- SETTING_TRACE_BEGIN;
- Elm_Object_Item *item = NULL;
- Setting_GenGroupItem_Data *selected_item_data = NULL;
- const char *item_name = NULL;
- Setting_Cfg_Node_T *pnode = NULL;
- int click_times = 0;
-
- retm_if(!event_info, "Invalid argument: event info is NULL");
-
- item = (Elm_Object_Item *)event_info;
- elm_genlist_item_selected_set(item, EINA_FALSE);
- selected_item_data = elm_object_item_data_get(item);
- setting_retm_if(!selected_item_data,
- "Setting main list item click, selected_item_data is NULL");
- item_name = _(selected_item_data->keyStr);
- SETTING_TRACE("Setting main list item click: %s", item_name);
- ret_if(!item_name);
-
- pnode = get_cfg_node_by_keystr(selected_item_data->keyStr);
- if (pnode == NULL) {
- SETTING_TRACE_ERROR(" *** pnode is NULL *** ");
- return;
- }
- if (pnode && pnode->item_type == Cfg_Item_AppLauncher_Node) {
- app_launcher(data, NULL, NULL);
- click_times = setting_cfg_get_click_times(selected_item_data->keyStr);
- setting_cfg_set_click_times(selected_item_data->keyStr, ++click_times);
- return;
- }
-}
+++ /dev/null
-#include "setting-helper.h"
-
-bool is_searchmode_app(Cfg_Item_Type type)
-{
- bool ret = false;
-
- switch (type % 10) {
- case Cfg_Item_App_Node: /* docomo run */
- case Cfg_Item_View_Node: /* n-depth search */
- case Cfg_Item_AppLauncher_Node: /* app launch */
- ret = true;
- break;
-
- case Cfg_Item_Ui_Node:
- case Cfg_Item_Title_Node:
- ret = false;
- break;
-
- default:
- ret = false;
- break;
- }
- return ret;
-}
-
*/
#include "setting-main.h"
-#include "setting-handler.h"
-#include "setting-helper.h"
+#include "setting-cfg.h"
#include <system_info.h>
static int setting_main_create(void *cb);
static int setting_main_destroy(void *cb);
+static char *_gl_group_item_text_get(void *data, Evas_Object *genlist,
+ const char *part);
+static void setting_main_click_list_cb(void *data, Evas_Object *obj,
+ void *event_info);
setting_view setting_view_main = {
.create = setting_main_create,
/*/////////////////////////////////////////////////////////////////////////// */
-void __all_gl_realized_cb(void *data, Evas_Object *obj, void *event_info)
-{
- __gl_realized_cb(data, obj, event_info);
- setting_retm_if(event_info == NULL,
- "invalid parameter: event_info is NULL");
- Elm_Object_Item *item = (Elm_Object_Item *)event_info;
- Setting_GenGroupItem_Data *item_data = elm_object_item_data_get(item);
- ret_if(!item_data);
-
- if (item_data->isPlaying)
- elm_object_item_signal_emit(item_data->item,
- "elm,state,expanded", "elm");
-}
-
void _view_list_geter(void *data)
{
SETTING_TRACE_BEGIN;
- int group_dx = GL_Group_Connection;
- int i, j;
- char *keyStr = NULL;
- char *icon_path = NULL;
- char *app_ctl_args = NULL;
- char *group_name = NULL;
- int index = 0;
- mainlist_entry *entry = NULL;
- Setting_GenGroupItem_Data *item_data = NULL;
+ int i = 0;
+ Elm_Object_Item *item = NULL;
setting_main_appdata *ad = (setting_main_appdata *)data;
-
+ Setting_Cfg_Node_T * cfg_node = get_cfg_node_first();
retm_if(ad == NULL, "Invalid argument: data is NULL");
- /*------------------------------------------------------------------ */
- /* category name loop */
- /*------------------------------------------------------------------ */
- for (i = 0; i < setting_cfg_get_category_length(); i++) {
- group_name = setting_cfg_get_category_name(i);
- group_dx++;/*from the first */
- item_data = setting_create_Gendial_field_def(
- ad->md.genlist,
- &(ad->itc_table[GENDIAL_Type_expandable_proc]),
- NULL,
- NULL,
- SWALLOW_Type_INVALID,
- NULL, /* l_icon */
- NULL, /* r_icon */
- 0, group_name,
- NULL, /* r_icon */
- NULL);
- if (item_data) {
- elm_genlist_item_select_mode_set(item_data->item,
- ELM_OBJECT_SELECT_MODE_NONE);
- item_data->isPlaying = TRUE;/*expandable ? */
- item_data->chk_status = group_dx;/*keep the group idx */
- }
- index = 0;
-
- /*---------------------------------------------------------- */
- /* 2. display each items, following category */
- /*---------------------------------------------------------- */
- /* add sub items */
- for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
- keyStr = setting_cfg_get_keyname_idx(i, j);
-
- app_ctl_args = setting_cfg_get_ug_args_idx(i, j);
- icon_path = setting_cfg_get_icon_path_idx(i, j);
-
- entry = settinig_drawer_hash_find(ad, keyStr);
-
- if (entry) {
- if (entry->type == UI_PROC) {
- item_data = entry->ui_handler(ad,
- keyStr, icon_path,
- app_ctl_args, ad->md.genlist, NULL);
- entry->item_data = item_data;
- }
- } else {
- entry = settinig_drawer_hash_find(ad, "Default");
- if (entry) {
- item_data = entry->ui_handler(ad,
- keyStr, icon_path,
- app_ctl_args, ad->md.genlist, NULL);
- entry->item_data = item_data;
- }
- }
-
- /* dupcated code (REFACTORING) */
- if (item_data && item_data->item) {
-
- set_node_pointer(keyStr, item_data->item);
- index++;
- }
+ do {
+ /* Group: */
+ if (cfg_node->item_type == Cfg_Item_Title_Node) {
+ item = elm_genlist_item_append(ad->md.genlist,
+ &(ad->itc_table[GENDIAL_Type_expandable_proc]),
+ _(cfg_node->key_name),
+ NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_NONE);
+ } else { /* Clickable item: */
+ setting_create_Gendial_field_def(
+ ad->md.genlist,
+ &(ad->itc_table[GENDIAL_Type_1text_1icon_2]),
+ setting_main_click_list_cb,
+ cfg_node->app_ctl_args,
+ SWALLOW_Type_1ICON_1IMAGE,
+ cfg_node->icon_path,
+ NULL,
+ 0,
+ cfg_node->key_name,
+ NULL,
+ NULL);
}
- }
+ cfg_node++;
+ } while (++i < get_cfg_array_size());
}
static void _click_softkey_back_cb(void *data, Evas_Object *obj,
setting_main_appdata *ad = (setting_main_appdata *) cb;
/* [UI] create structures for genlist style */
- setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE, &(ad->itc_table[GENDIAL_Type_1text_1icon_2]));
- setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE, &(ad->itc_table[GENDIAL_Type_1icon_2text]));
- setting_create_Gendial_itc(SETTING_GENLIST_GROUP_INDEX_STYLE, &(ad->itc_table[GENDIAL_Type_expandable_proc]));
+ setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE,
+ &(ad->itc_table[GENDIAL_Type_1text_1icon_2]));
+ setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE,
+ &(ad->itc_table[GENDIAL_Type_1icon_2text]));
+
+ ad->itc_table[GENDIAL_Type_expandable_proc].item_style = "group_index";
+ ad->itc_table[GENDIAL_Type_expandable_proc].func.text_get =
+ _gl_group_item_text_get;
}
/**
static int setting_main_create(void *cb)
{
SETTING_TRACE_BEGIN;
- LAUNCH_SETTING_IN();
setting_main_appdata *ad = (setting_main_appdata *) cb;
- int ret = 0;
+
Evas_Object *back_button = NULL;
retv_if(!ad, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
_setting_genlist_itc_init(ad);
- settinig_drawer_hash_init(ad);
-
- ret = view_init(&ad->md, _("IDS_ST_OPT_SETTINGS"));
- if (ret != SETTING_RETURN_SUCCESS)
- return ret;
{
char *profile_string = NULL;
-
int ret = system_info_get_platform_string("tizen.org/feature/profile", &profile_string);
if (ret != SYSTEM_INFO_ERROR_NONE) {
SETTING_TRACE("Setting - reading profile string failed, %d", ret);
elm_naviframe_item_pop_cb_set(ad->md.naviframe_it,
_naviframe_back_pop_cb, ad);
- if (!is_searchmode_app(ad->is_searchmode))
- _view_list_geter(ad);
+ _view_list_geter(ad);
setting_view_main.is_create = 1;
SETTING_TRACE_END;
static int setting_main_destroy(void *cb)
{
SETTING_TRACE_BEGIN;
- setting_main_appdata *ad = (setting_main_appdata *)cb;
retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
if (0 == setting_view_main.is_create)
return SETTING_RETURN_SUCCESS;
- evas_object_data_set(ad->md.window, "conformant", NULL);
-
- settinig_drawer_hash_deinit(ad);
-
setting_view_main.is_create = 0;
SETTING_TRACE_END;
return SETTING_RETURN_SUCCESS;
}
+static char *_gl_group_item_text_get(void *data, Evas_Object *genlist,
+ const char *part)
+{
+ if (!strcmp(part, "elm.text") && data) {
+ return strdup(data);
+ }
+
+ return NULL;
+}
+
+static void setting_main_click_list_cb(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ SETTING_TRACE_BEGIN;
+ Elm_Object_Item *item = NULL;
+ Setting_GenGroupItem_Data *selected_item_data = NULL;
+ const char *item_name = NULL;
+ Setting_Cfg_Node_T *pnode = NULL;
+
+ retm_if(!event_info, "Invalid argument: event info is NULL");
+
+ item = (Elm_Object_Item *)event_info;
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+ selected_item_data = elm_object_item_data_get(item);
+ setting_retm_if(!selected_item_data,
+ "Setting main list item click, selected_item_data is NULL");
+ item_name = _(selected_item_data->keyStr);
+ SETTING_TRACE("Setting main list item click: %s", item_name);
+ ret_if(!item_name);
+
+ pnode = get_cfg_node_by_keystr(selected_item_data->keyStr);
+ if (pnode == NULL) {
+ SETTING_TRACE_ERROR(" *** pnode is NULL *** ");
+ return;
+ }
+ if (pnode && pnode->item_type == Cfg_Item_AppLauncher_Node) {
+ app_launcher(data, NULL, NULL);
+ return;
+ }
+}
+
#include "setting.h"
-#include "setting-helper.h"
#include "setting-main.h"
#include "setting-cfg.h"
#include "setting-common-init.h"
#include <system_settings.h>
-static setting_main_appdata *g_main_ad = NULL;
/**
* The event process when region is changes.
char *localeLanguage = NULL;
retm_if(!data, "Invalid argument: data is NULL");
- setting_main_appdata *ad = g_main_ad;
+ setting_main_appdata *ad = data;
elm_object_item_part_text_set(ad->md.naviframe_it, "elm.text.title",
_("IDS_ST_OPT_SETTINGS"));
*/
static bool setting_main_app_create(void *data)
{
+ int ret = 0;
+ setting_main_appdata *ad = data;
SETTING_TRACE_BEGIN;
- LAUNCH_SETTING_IN();
-
SETTING_TRACE_DEBUG(" **************** COMPILATION TIME: %s %s **************** ", __DATE__, __TIME__);
#if SUPPORT_DRI
setenv("EVAS_DRI_SWAPBUF", "1", 1);
#endif
- setting_main_appdata *ad = data;
-
- /*------------------------------------------------------------------ */
-
if (app_init(&ad->md, SETTING_PACKAGE) != SETTING_RETURN_SUCCESS)
return false;
- /* load config file */
- int cfg_operation_ret = setting_cfg_init();
-
- g_main_ad = ad;
+ ret = view_init(&ad->md, _("IDS_ST_OPT_SETTINGS"));
+ if (ret != SETTING_RETURN_SUCCESS)
+ return false;
setting_view_create(&setting_view_main, ad);
-
- /* error handling */
- if (Cfg_Error_Type_Sucess != cfg_operation_ret) {
- SETTING_TRACE_ERROR("cfg_operation_ret: %d", cfg_operation_ret);
- const char *notifyStr = NULL;
- switch (cfg_operation_ret) {
-
- case Cfg_Error_Type_CreateCfg_Failed: {
- notifyStr = _("failed to create config file, <br>"
- "re-install org.tizen.setting please");
- break;
- }
- case Cfg_Error_Type_Mkdir_Failed: {
- notifyStr = _("file system missed<br>"_TZ_SYS_DATA\
- "/setting, <br>"
- "re-install org.tizen.setting please");
- break;
- }
- case Cfg_Error_Type_RemoveCfg_Failed: {
- notifyStr = _("config file size 0 byte<br>and failed "
- "to re-create it.<br>try to startup "
- "the app again");
- break;
- }
- case Cfg_Error_Type_ReadCfg_Failed: {
- notifyStr = _("failed to read config file, <br>try to "
- "startup the app again");
- break;
- }
- case Cfg_Error_Type_DirPermissionDenied: {
- notifyStr = _("the dir of config file permission "
- "denied");
- break;
- }
- case Cfg_Error_Type_FilePermissionDenied: {
- notifyStr = _("config file permission denied");
- break;
- }
- case Cfg_Error_Type_OutOfMemory: {
- notifyStr = _("out of memory");
- break;
- }
- default: {
- notifyStr = _("Invalid Result, try to startup the app again");
- break;
- }
- }
- setting_create_popup(ad, ad->md.window, NULL,
- (char *)notifyStr, NULL, 10, FALSE, FALSE, 0);
- return SETTING_RETURN_FAIL;
- }
-
return true;
}
setting_main_appdata *ad = data;
vconf_set_bool(VCONFKEY_SETAPPL_ROTATE_HOLD_BOOL, FALSE);
- /*PLUGIN_FINI; */
- setting_cfg_exit();
- clear_system_service_data();
-
SETTING_TRACE("*** SETTING APPLICATION CLOSED ***");
setting_view_destroy(&setting_view_main, ad);
int flight_mode = 0;
setting_main_appdata *ad = data;
- if (is_searchmode_app(ad->is_searchmode))
- evas_object_hide(ad->md.layout);
- else
- evas_object_show(ad->md.layout);
-
evas_object_show(ad->md.window);
elm_win_activate(ad->md.window);