Merge "[Bug] free per node while freeing eina_list in Setting >Storage ."
[apps/core/preloaded/settings.git] / setting-common / include / setting-common-data-type.h
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  */
21
22 /**
23  *@defgroup common-data-type
24  *common data type
25  */
26
27 #ifndef __SETTING_COMMON_DATA_TYPE_H__
28 #define __SETTING_COMMON_DATA_TYPE_H__
29
30 #include <Elementary.h>         /* including Elementary lib */
31 #include <setting-debug.h>      /*  including debuging type */
32 #include <setting-common-resource.h>    /* including one class of data type */
33 #include <setting-common-data-error.h>  /* including another class of data type */
34
35 #ifndef PREFIX
36 #define PREFIX "/opt"
37 #endif
38
39 #ifndef bool
40 #define bool Eina_Bool
41 #endif
42 #define PWD_FILE "/opt/data/setting/set_info"
43 //#define PLUGIN_CFG_DIR "/opt/data/setting/plugin-cfg"
44 #define PLUGIN_CFG_DIR "/opt/data/setting/plugin-xml"
45
46 #define SETTING_POSTINST_FILE "/var/lib/dpkg/info/org.tizen.setting.postinst"
47 #define SETTING_PACKAGE                 "setting"
48 #define SYSTEM_PACKAGE                  "sys_string"
49 #define SETTING_LOCALEDIR               "/usr/apps/org.tizen.setting/res/locale"
50
51 #define SYSTEM_ICON_PATH                "/usr/apps/org.tizen.setting/res/icons"
52 #define SETTING_ICON_PATH               "/usr/apps/org.tizen.setting/res/icons"
53 #define SETTING_UG_ICON_PATH    "/usr/ug/res/icon/org.tizen.setting"
54 #define SETTING_UG_PATH                 "/usr/ug/lib"
55 #define SETTING_UG_PATH_USR             "/usr/ug/lib"
56
57 #define SETTING_UG_PATH_OPT                     "/opt/ug/lib"
58 #define SETTING_UG_PATH_USR_OPT         "/opt/ug/lib"
59
60 #define SETTING_EDJ_PATH                EDJDIR
61 #define SETTING_MEMORY_EDJ_NAME         SETTING_EDJ_PATH"/setting-memory.edj"
62 #define SETTING_THEME_EDJ_NAME          SETTING_EDJ_PATH"/setting-theme.edj"
63 #define SETTING_SOUND_EDJ_NAME          SETTING_EDJ_PATH"/setting-sound.edj"
64
65 /* inoti (broadcasting without data */
66 #define SETTING_TIME_CHANGED    "setting_time_changed"
67
68 /* anci c color type */
69 #define SETTING_FONT_RED "\033[31m"
70 #define SETTING_FONT_BLACK "\033[0m"
71 #define SETTING_FONT_BGREEN "\033[36m"
72
73 #define THEME_STYLE "beat"
74
75 #define IMG_EC_ARROW_OPEN  SETTING_ICON_PATH"/00_button_expand_opened.png"
76 #define IMG_EC_ARROW_CLOSE SETTING_ICON_PATH"/00_button_expand_closed.png"
77
78 #define SETTING_IDLE_IMAGE_PATH "/etc/idle_image/"
79
80 #ifdef SUPPORT_NAVIGATIONBAR
81 #define NAVI_CONTROLBAR_STYLE "navigationbar"
82 #define NAVI_DEF_BUTTON_STYLE "navigationbar_control/center"
83 #define NAVI_BACK_BUTTON_STYLE "navigationbar_backbutton/default"
84 #else
85 #define NAVI_CONTROLBAR_STYLE "naviframe"
86 #define NAVI_DEF_BUTTON_STYLE  "naviframe_control/default"
87 #define NAVI_BACK_BUTTON_STYLE "naviframe/back_btn/default"
88 #endif
89
90 #if SUPPORT_BOTTOM_BTNS
91 #define NAVI_CONTROLBAR_PART "controlbar"
92 #else
93 #define NAVI_CONTROLBAR_PART "optionheader"
94 #endif
95 #define BTN_STYLE_DEF "naviframe/title/default"
96 #define NAVI_BTN_STYLE_LEFT "title_left_btn"
97 #define NAVI_BTN_STYLE_RIGHT "title_right_btn"
98 #define NAVI_BTN_STYLE_MORE "title_more_btn"
99 #define NAVI_BTN_STYLE_PREV "prev_btn"
100
101 #define SETTING_FONT_CONF_FILE "/opt/etc/fonts/conf.avail/99-slp.conf"
102
103 /**
104 * @brief slider, button, and etc.
105 *
106 * @param data application context
107 * @param obj Evas Object
108 * @param event_info even type
109 *
110 * @return vo return
111 */
112 typedef void (*setting_call_back_func) (void *data, Evas_Object *obj, void *event_info);
113
114 #define WIDGET_SCALE_FACTOR                             (get_widgets_factor())
115 #define SETTING_PADDING_WIDTH                   (8 * WIDGET_SCALE_FACTOR)
116 #define SETTING_PADDING_HEIGHT                  (8 * WIDGET_SCALE_FACTOR)
117 #define SETTING_HALF_SCREEN_WIDTH \
118                             (SETTING_PADDING_WIDTH * 22 * WIDGET_SCALE_FACTOR)
119
120 #define SYS_NOTI_NAME_LEN                                       128
121 #define MAX_DISPLAY_NAME_LEN_ON_UI                      128
122 #define MAX_COMMON_BUFFER_LEN                           1024
123
124 #define MAX_SEARCH_STR_LEN 20
125
126 #define HELP_MSG_BUFF_SIZE                              1000
127 #define MAX_SPECIALIZITION_LEN                          1000
128 #define SPECIALIZITION_FONT                                     25
129 #define HELP_TITLE_SIZE                                         30
130 #define HELP_CONTENT_SIZE                                       28
131
132 #define PHONE_LOCK_ATTEMPS_MAX                          5
133 #define SIM_LOCK_ATTEMPS_MAX                            5
134 #define PHONE_LOCK_BLOCK_SECONDS                        30
135 #define SIM_LOCK_BLOCK_SECONDS                          30
136 #define LOCK_TIMESTAMP_LEN                                      64
137 #define MAX_DATETIME_FORMAT_LEN                         64
138 #define MAX_DATE_FORMAT_LEN                             10
139
140 #define SMALL_FONT_DPI                                          (-80)
141 #define MIDDLE_FONT_DPI                                         (-100)
142 #define LARGE_FONT_DPI                                          (-144)
143 #define HUGE_FONT_DPI                                           (-184)
144 #define GIANT_FONT_DPI                                          (-240)
145
146 #define LABEL_FONT_SIZE_SMALL                                   24
147 #define LABEL_FONT_SIZE_NORMAL                                  35
148 #define LABEL_FONT_SIZE_LARGE                                   55
149 #define LABEL_FONT_SIZE_HUGE                                    75
150 #define LABEL_FONT_SIZE_GIANT                                   92
151
152 #define __STR_EMUL                                                      "emul"
153 #define __LEN_STR_EMUL                                          4
154
155 #define MAX_SYSTEM_SERVICE_NUM                          30
156 #define SYSTEM_SERVICE_LIST_PATH "/opt/osp/system/configuration/system-services.list"
157 #define MAX_PKG_NAME_LEN                        128
158
159
160 typedef struct
161 {
162         char* locale;                           // ex) "en_US.UTF"
163         char* title;                            // "United Kingdom"
164         int number;                             // no -  UI
165 } setting_lang_entry;
166
167
168
169 typedef enum _Theme_Type {
170         Theme_Invalid = -1,
171         Theme_Tizen = 0,
172         Theme_Tizen_Black = 1,
173         Theme_Tizen_Blue,
174         Theme_ERROR
175 } Theme_Type;
176
177 typedef enum _GENDIAL_Type {
178         GENDIAL_Type_1text_1icon_2 = 0,
179         GENDIAL_Type_1text_2icon = 1,
180         GENDIAL_Type_1icon_2text = 2,
181         GENDIAL_Type_2text_2icon_4 = 3,
182         GENDIAL_Type_1text_2icon_2 = 4,
183         GENDIAL_Type_sel_all,
184
185         GENDIAL_Type_1line_icontext,
186         GENDIAL_Type_group_item,
187         GENDIAL_Type_2text_3,
188         GENDIAL_Type_MAX
189 } GENDIAL_Type;
190
191 typedef enum _SWALLOW_Type {
192         SWALLOW_Type_INVALID = -1,
193         SWALLOW_Type_2ICON = 0,
194         SWALLOW_Type_1ICON_1CHECK = 1,
195         SWALLOW_Type_1ICON_1RADIO = 2,
196         SWALLOW_Type_1CHECK = 3,
197         SWALLOW_Type_1CHECKICON = 4,
198         SWALLOW_Type_1RADIO = 5,
199         SWALLOW_Type_1TOGGLE = 6,
200         SWALLOW_Type_MULTILINE_1TOGGLE,
201
202         SWALLOW_Type_1ICON_1IMAGE,
203         SWALLOW_Type_1BUTTON,
204         SWALLOW_Type_1PROCESS,
205
206         SWALLOW_Type_1RADIO_SUB,
207         SWALLOW_Type_1RADIO_1PROCESS,
208         SWALLOW_Type_1RADIO_1SEARCH,
209         SWALLOW_Type_1RADIO_1LABLE,
210         SWALLOW_Type_1SEARCH,
211
212         SWALLOW_Type_1LINE_LAYOUT = 20,
213         SWALLOW_Type_1LINE_LAYOUT_1RADIO,
214         SWALLOW_Type_1LINE_LAYOUT_1TOGGLE,
215         SWALLOW_Type_1LINE_LAYOUT_1CHECK,
216         SWALLOW_Type_LAYOUT_ENTRY,
217         SWALLOW_Type_LAYOUT_SIMPLE_PASSWORD, // for simple password
218         SWALLOW_Type_LAYOUT_DATEFIELD,
219         SWALLOW_Type_LAYOUT_SLIDER,
220         SWALLOW_Type_LAYOUT_SPECIALIZTION,
221         SWALLOW_Type_LAYOUT_SPECIALIZTION_X,//extension
222
223         SWALLOW_Type_MAX
224 } SWALLOW_Type;
225
226 typedef enum {
227         UNDEFINED_LIB_SYMBOL = -2,/*  undefined symbol : -2 */
228         LOAD_LIB_FAILED = -1,/*  load failed : -1 */
229         OPERATE_LIB_SUCESS = 0,
230 } OPERATE_LIB_ERROR;
231
232 typedef enum _POPUP_BTN_RESPONSE_TYPE{
233         POPUP_RESPONSE_INVALID = -1,
234         POPUP_RESPONSE_OK = 0,
235         POPUP_RESPONSE_CANCEL = 1,
236 } POPUP_BTN_RESPONSE_TYPE;
237 /**
238  *an item node in genlist
239  * @todo begings_to is requried?
240  * @todo isItemDisableFlag is required?
241  * @todo isSinglelineFlag is requred?
242  */
243
244
245 typedef struct Setting_GenGroupItem_Data Setting_GenGroupItem_Data;
246
247 typedef struct Setting_GenGroupItem_Data {
248
249         void **pBack;
250
251         Elm_Object_Item *item;
252         SWALLOW_Type swallow_type;
253         const char *l_swallow_path;
254         const char *r_swallow_path;
255
256         Evas_Object *win_main;
257         Evas *evas;
258
259         /* radio button */
260         Evas_Object *rgd;                                               /**< radio button */
261         int usb_index;                                                          /**< usb_index number of radio buttons, ex) USB setting */
262
263         /* output */
264         Evas_Object *eo_check;                                  /**< slider, button, check, editfield, datefield */
265         setting_call_back_func chk_change_cb;
266
267         int chk_status;                                                 /**< represent check value, slider value, datefield value etc.. */
268         char *keyStr;                                                   /**< title */
269         char *sub_desc;                                                 /**< sub text */
270
271         /* to swallow a whole layout (genlist item is 1line-layout or 2line-layout) */
272         char *item_style;                                               /**< itc style name */
273
274         /*  for slider control */
275         bool isIndicatorVisible;                                /**< indicator option (displaying number) */
276         double slider_min;                                              /**< to swallow a slider */
277         double slider_max;                                              /**< to swallow a slider */
278         setting_call_back_func start_change_cb;
279         setting_call_back_func stop_change_cb;
280
281         /* sound/vibration */
282         int belongs_to;                                                 /**< 1: slider belongs to sound group. 0: slider belongs to vibration group */
283
284         /*  input panel  */
285         Elm_Input_Panel_Layout input_type;              /**< input panel type */
286         bool input_panel_disable_flag;          /** do not show the input panel automatically when the widget is clicked or has focus*/
287
288         void *userdata;                                                 /**< just a reference, do not need release. */
289
290         bool isPasswordFlag;
291         bool isFocusFlag;
292         bool isItemDisableFlag;                                 /**< date/time UG only */
293         bool isSinglelineFlag;
294
295         int int_slp_setting_binded;                     /**< its relative vconf value must increase from 0, and step is 1. eg, 0, 1, 2, 3.. */
296
297
298         /* popup */
299         Evas_Object *notify;                                    /**< act as any popup to show user any message */
300
301         Elm_Entry_Filter_Accept_Set *digits_filter_data;
302         Elm_Entry_Filter_Limit_Size *limit_filter_data;
303
304         Eina_List* childs;              /**< child nodes if this node has child nodes for handling radio buttons */
305 };
306
307 typedef enum {
308         SETTING_VCONF_INT_TYPE = 0,
309         SETTING_VCONF_BOOL_TYPE,
310         SETTING_VCONF_STR_TYPE
311 } setting_vconf_type;
312
313 #define MAX_RESET_MENU_NUM 50
314
315 typedef struct _item_table {
316         char *item_name;        /* pointer to the key string */
317         char *ug_args;
318         Setting_GenGroupItem_Data *data_GenItem;
319 } Item_Table;
320
321 /**
322  * @todo is 50 sufficient value?
323  */
324 typedef struct _Setting_Done_List_Data {
325         /* external input arguements */
326         Evas_Object *win_main;
327         void *UG_data;
328         Evas_Object *ly_parent;
329         Evas_Object *controllbar;
330
331         /* internal output%input arguements */
332         Item_Table chk_items[MAX_RESET_MENU_NUM];
333         int cur_item_num;
334         Evas_Object *selInfoPop;
335         Evas_Object *selInfoPop_layout;
336         Elm_Genlist_Item_Class itc_1text_1icon;
337         Elm_Genlist_Item_Class itc_seperator;
338         Elm_Genlist_Item_Class itc_sel_all;
339         Evas_Object *select_all_checkbox;
340         Eina_Bool select_all_checked;
341 } Setting_Done_List_Data;
342
343 #endif                          /* __SETTING_COMMON_DATA_TYPE_H__ */