tizen 2.3.1 release
[apps/home/b2-clocksetting.git] / include / util.h
1 /*
2  *  Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  *  Licensed under the Flora License, Version 1.0 (the License);
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *      http://floralicense.org/license/
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an AS IS BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License.
15  *
16  */
17 #ifndef _UTIL_H_
18 #define _UTIL_H_
19
20 #include <Elementary.h>
21 #include <efl_assist.h>
22 #include <app.h>
23
24 #include "setting_debug.h"
25
26
27
28
29 #ifdef _CIRCLE
30 #define O_TYPE
31 #endif
32
33 #ifdef O_TYPE
34 #include <efl_extension.h>
35 #endif
36
37 #define IMG_DIR         "/usr/apps/org.tizen.clocksetting/data/images/"
38 #define EDJE_PATH       "/usr/apps/org.tizen.clocksetting/res/edje/clocksetting.edj"
39
40 #ifndef FEATURE_SETTING_CHANGEABLE
41 #define FEATURE_SETTING_CHANGEABLE
42 #endif
43
44 #ifdef FEATURE_SETTING_CHANGEABLE
45 #define COLOR_INFO_TABLE "/usr/apps/org.tizen.clocksetting/shared/res/tables/org.tizen.clocksetting_ChangeableColorInfo.xml"
46 #endif
47
48 #define TRUE    1
49 #define FALSE   0
50
51 #define SETTING_PACKAGE                 "clocksetting"
52 #define SYSTEM_PACKAGE                  "sys-string"
53
54 #define _(s)                    setting_gettext(s)
55 #define REPL(s,o,r)     replace(s,o,r)
56 #define ICU_NUM(n)      _get_strnum_from_icu(n)
57
58 #define WIN_SIZE        320
59
60 enum {
61         SETTING_CLOCK,
62         SETTING_NOTIFICATION,
63         SETTING_HOMESCREEN,
64         SETTING_SOUND,
65         SETTING_VOLUME,
66         SETTING_DISPLAY,
67         SETTING_LOCATION,
68         SETTING_BATTERY,
69         SETTING_BLUETOOTH,
70         SETTING_SCREEN_LOCK,
71         SETTING_DOUBLE_PRESSING,
72         SETTING_LANGUAGE,
73         SETTING_SAFETY,
74         SETTING_RESET,
75         SETTING_INFO,
76         SETTING_MAIN,
77         SETTING_VOLUME_2_DEPTH,
78         SETTING_SOUND_RINGTONE,
79         SETTING_SOUND_NOTIFICATION
80 };
81
82 enum {
83         DISABLE,
84         ENABLE
85 };
86
87 enum {
88         NONE,
89         TOUCH_DOWN,
90         TOUCH_UP,
91         TOUCH_MOVE
92 };
93
94 typedef struct _appdata {
95         Evas_Coord root_w;
96         Evas_Coord root_h;
97
98         Evas *evas;
99         Evas_Object *win_main;
100         Evas_Object *conform;
101         Evas_Object *bg;
102         Evas_Object *layout_main;
103         Evas_Object *nf;
104         Evas_Object *datetime;
105         Evas_Object *alert_rdg;
106         Evas_Object *sound_mode_rdg;
107         Evas_Object *ringtone_type_rdg;
108         Evas_Object *notification_rdg;
109         Evas_Object *vibration_rdg;
110         Evas_Object *pref_arm_rdg;
111         Evas_Object *homescreen_rdg;
112         Evas_Object *double_rdg;
113         Evas_Object *safety_interval_trauma_rdg;
114         Evas_Object *safety_interval_no_activity_rdg;
115
116         Evas_Object *screen_timeout_rdg;
117         Evas_Object *font_size_rdg;
118         Evas_Object *font_style_rdg;
119         Evas_Object *popup;
120         Evas_Object *language_rdg;
121         Evas_Object *wake_up_guesture_rdg;
122         Evas_Object *rotate_screen_rdg;
123         Elm_Object_Item *dt_genlist_item_of_time;
124         Elm_Object_Item *dt_genlist_item_of_date;
125         Elm_Object_Item *language_item;
126
127         Evas_Object *main_genlist;
128
129         char *device_name;
130
131         int is_motion_smart_relay_on;
132         int is_motion_wake_up_on;
133
134         int is_show_ringtone_toast;
135         int is_show_noti_toast;
136
137         int is_first_launch;
138
139         int MENU_TYPE;
140
141         Evas_Object *indicator_layout;
142
143 #ifdef FEATURE_SETTING_CHANGEABLE
144         Ea_Theme_Color_Table *color_table;
145 #endif
146
147 #ifdef O_TYPE
148         Eext_Circle_Surface *circle_surface;
149         Evas_Object *rotary;
150 #endif
151 } appdata;
152
153 typedef struct _Item_Data {
154         int index;
155         Elm_Object_Item *item;
156 } Item_Data;
157
158 typedef struct _spin_date spin_date;
159 struct _spin_date {
160         Evas_Object *spinner;
161         Evas_Object *layout;
162
163         double posx1, posy1, posx2, posy2;
164 };
165
166 char *replace(char *str, char *orig, char *repl);
167 char *setting_gettext(const char *s);
168
169 void setting_popup_back_cb(void *data, Evas_Object *obj, void *event_info);
170
171 int is_connected_GM();
172
173 bool colorstr_to_decimal(char *color, int *R, int *G, int *B);
174
175 bool is_file_exist(char *file_path);
176
177 #endif