Initialize Tizen 2.3
[apps/home/b2-clocksetting.git] / include / util.h
1 /*
2  * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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 #define IMG_DIR         "/usr/apps/org.tizen.clocksetting/data/images/"
27 #define EDJE_PATH       "/usr/apps/org.tizen.clocksetting/res/edje/clocksetting.edj"
28
29 #define TRUE    1
30 #define FALSE   0
31
32 #define SETTING_PACKAGE                 "clocksetting"
33 #define SYSTEM_PACKAGE                  "sys-string"
34
35 #define _(s)                    setting_gettext(s)
36 #define REPL(s,o,r)     replace(s,o,r)
37 #define ICU_NUM(n)      _get_strnum_from_icu(n)
38
39 #define WIN_SIZE        320
40
41 enum {
42         SETTING_CLOCK,
43         SETTING_NOTIFICATION,
44         SETTING_HOMESCREEN,
45         SETTING_SOUND,
46         SETTING_VOLUME,
47         SETTING_DISPLAY,
48         SETTING_BATTERY,
49         SETTING_BLUETOOTH,
50         SETTING_SCREEN_LOCK,
51         SETTING_DOUBLE_PRESSING,
52         SETTING_LANGUAGE,
53         SETTING_SAFETY,
54         SETTING_RESET,
55         SETTING_INFO,
56         SETTING_MAIN,
57         SETTING_VOLUME_2_DEPTH,
58         SETTING_SOUND_RINGTONE,
59         SETTING_SOUND_NOTIFICATION
60 };
61
62 enum {
63         DISABLE,
64         ENABLE
65 };
66
67 enum {
68         NONE,
69         TOUCH_DOWN,
70         TOUCH_UP,
71         TOUCH_MOVE
72 };
73
74 typedef struct _appdata
75 {
76         Evas_Coord root_w;
77         Evas_Coord root_h;
78
79         Evas *evas;
80         Evas_Object *win_main;
81         Evas_Object *bg;
82         Evas_Object *conform;
83         Evas_Object *layout_main;
84         Evas_Object *nf;
85         Evas_Object *datetime;
86         Evas_Object *alert_rdg;
87         Evas_Object *sound_mode_rdg;
88         Evas_Object *ringtone_type_rdg;
89         Evas_Object *notification_rdg;
90         Evas_Object *vibration_rdg;
91         Evas_Object *pref_arm_rdg;
92         Evas_Object *homescreen_rdg;
93         Evas_Object *double_rdg;
94         Evas_Object *safety_interval_trauma_rdg;
95         Evas_Object *safety_interval_no_activity_rdg;
96
97         Evas_Object *screen_timeout_rdg;
98         Evas_Object *font_size_rdg;
99         Evas_Object *font_style_rdg;
100         Evas_Object *popup;
101         Evas_Object *language_rdg;
102         Evas_Object *wake_up_guesture_rdg;
103         Evas_Object *rotate_screen_rdg;
104         Elm_Object_Item *dt_genlist_item_of_time;
105         Elm_Object_Item *dt_genlist_item_of_date;
106         Elm_Object_Item *language_item;
107
108         Evas_Object *main_genlist;
109
110         char * device_name;
111
112         int is_motion_smart_relay_on;
113         int is_motion_wake_up_on;
114
115         int is_show_ringtone_toast;
116         int is_show_noti_toast;
117
118         int is_first_launch;
119
120         int MENU_TYPE;
121         
122         Evas_Object *indicator_layout;
123 } appdata;
124
125 typedef struct _Item_Data
126 {
127         int index;
128         Elm_Object_Item *item;
129 } Item_Data;
130
131 typedef struct _spin_date spin_date;
132 struct _spin_date
133 {
134         Evas_Object *spinner;
135         Evas_Object *layout;
136
137         double posx1, posy1, posx2, posy2;
138 };
139
140 char * replace( char * str, char * orig, char * repl);
141 char *setting_gettext(const char *s);
142
143 void setting_popup_back_cb(void *data, Evas_Object *obj, void *event_info);
144
145 int is_connected_GM();
146
147 bool colorstr_to_decimal(char *color, int *R, int *G, int *B);
148
149 bool is_file_exist(char * file_path);
150
151 #endif