Backup : 0813
[apps/native/sample/adventure.git] / new / src / map.c
1 #include <Elementary.h>
2 #include "main.h"
3 #include "log.h"
4
5 const char *const MAP_EDJE = "map.edj";
6
7
8 static city_info_s cities[] = {
9         {
10                 .id = CITY_HONOLULU,
11                 .timezone = -10.0,
12                 .name = "Honolulu",
13                 .nation = "USA",
14         },
15         {
16                 .id = CITY_LOS_ANGELES,
17                 .timezone = -8.0,
18                 .name = "Los Angeles",
19                 .nation = "USA",
20         },
21         {
22                 .id = CITY_SAN_FRANCISCO,
23                 .timezone = -8.0,
24                 .name = "San Francisco",
25                 .nation = "USA",
26         },
27         {
28                 .id = CITY_VANCOUVER,
29                 .timezone = -8.0,
30                 .name = "Vancouver",
31                 .nation = "Canada",
32         },
33         {
34                 .id = CITY_CHICAGO,
35                 .timezone = -6.0,
36                 .name = "Chicago",
37                 .nation = "USA",
38         },
39         {
40                 .id = CITY_MEICO_CITY,
41                 .timezone = -6.0,
42                 .name = "Mexico City",
43                 .nation = "Mexico",
44         },
45         {
46                 .id = CITY_SAN_JOSE,
47                 .timezone = -6.0,
48                 .name = "San Jose",
49                 .nation = "Costa Rica",
50         },
51         {
52                 .id = CITY_NEW_YORK_CITY,
53                 .timezone = -5.0,
54                 .name = "New York City",
55                 .nation = "USA",
56         },
57         {
58                 .id = CITY_TORONTO,
59                 .timezone = -5.0,
60                 .name = "Toronto",
61                 .nation = "Canada",
62         },
63         {
64                 .id = CITY_WASHINGTON_DC,
65                 .timezone = -5.0,
66                 .name = "Washington DC",
67                 .nation = "USA",
68         },
69         {
70                 .id = CITY_BRASILIA,
71                 .timezone = -3.0,
72                 .name = "Brasilia",
73                 .nation = "Brazil",
74         },
75         {
76                 .id = CITY_BUENOS_AIRES,
77                 .timezone = -3.0,
78                 .name = "Buenos Aires",
79                 .nation = "Argentina",
80         },
81         {
82                 .id = CITY_SAO_PAULO,
83                 .timezone = -3.0,
84                 .name = "Sao Paulo",
85                 .nation = "Brazil",
86         },
87         {
88                 .id = CITY_DUBLIN,
89                 .timezone = 0.0,
90                 .name = "Dublin",
91                 .nation = "Ireland",
92         },
93         {
94                 .id = CITY_LISBON,
95                 .timezone = 0.0,
96                 .name = "Lisbon",
97                 .nation = "Portugal",
98         },
99         {
100                 .id = CITY_LONDON,
101                 .timezone = 0.0,
102                 .name = "London",
103                 .nation = "England",
104         },
105         {
106                 .id = CITY_AMSTERDAM,
107                 .timezone = 1.0,
108                 .name = "Amsterdam",
109                 .nation = "Netherlands",
110         },
111         {
112                 .id = CITY_BARCELONA,
113                 .timezone = 1.0,
114                 .name = "Barcelona",
115                 .nation = "Spain",
116         },
117         {
118                 .id = CITY_BERLIN,
119                 .timezone = 1.0,
120                 .name = "Berlin",
121                 .nation = "Germany",
122         },
123         {
124                 .id = CITY_BRUSSELS,
125                 .timezone = 1.0,
126                 .name = "Brussels",
127                 .nation = "Belgium",
128         },
129         {
130                 .id = CITY_CAPE_TOWN,
131                 .timezone = 1.0,
132                 .name = "Cape Town",
133                 .nation = "South Africa",
134         },
135         {
136                 .id = CITY_GENEVA,
137                 .timezone = 1.0,
138                 .name = "Geneva",
139                 .nation = "Switzerland",
140         },
141         {
142                 .id = CITY_MADRID,
143                 .timezone = 1.0,
144                 .name = "Madrid",
145                 .nation = "Spain",
146         },
147         {
148                 .id = CITY_PARIS,
149                 .timezone = 1.0,
150                 .name = "Paris",
151                 .nation = "France",
152         },
153         {
154                 .id = CITY_ROME,
155                 .timezone = 1.0,
156                 .name = "Rome",
157                 .nation = "Italy",
158         },
159         {
160                 .id = CITY_STOCKHOLM,
161                 .timezone = 1.0,
162                 .name = "Stockholm",
163                 .nation = "Sweden",
164         },
165         {
166                 .id = CITY_WARSAW,
167                 .timezone = 1.0,
168                 .name = "Warsaw",
169                 .nation = "Poland",
170         },
171         {
172                 .id = CITY_ANKARA,
173                 .timezone = 2.0,
174                 .name = "Ankara",
175                 .nation = "Turkey",
176         },
177         {
178                 .id = CITY_ATHENS,
179                 .timezone = 2.0,
180                 .name = "Athens",
181                 .nation = "Greece",
182         },
183         {
184                 .id = CITY_HELSINKI,
185                 .timezone = 2.0,
186                 .name = "Helsinki",
187                 .nation = "Finland",
188         },
189         {
190                 .id = CITY_ISTANBUL,
191                 .timezone = 2.0,
192                 .name = "Istanbul",
193                 .nation = "Turkey",
194         },
195         {
196                 .id = CITY_JERUSALEM,
197                 .timezone = 2.0,
198                 .name = "Jerusalem",
199                 .nation = "Israel",
200         },
201         {
202                 .id = CITY_KAHIRA,
203                 .timezone = 2.0,
204                 .name = "Jerusalem",
205                 .nation = "Egypt",
206         },
207         {
208                 .id = CITY_BAGHDAD,
209                 .timezone = 3.0,
210                 .name = "Baghdad",
211                 .nation = "Iraq",
212         },
213         {
214                 .id = CITY_DUBAI,
215                 .timezone = 3.0,
216                 .name = "Dubai",
217                 .nation = "United Arab Emirates",
218         },
219         {
220                 .id = CITY_MOSCOW,
221                 .timezone = 3.0,
222                 .name = "Moscow",
223                 .nation = "Russia",
224         },
225         {
226                 .id = CITY_ISLAMABAD,
227                 .timezone = 5.0,
228                 .name = "Islamabad",
229                 .nation = "Pakistan",
230         },
231         {
232                 .id = CITY_DELHI,
233                 .timezone = 5.5,
234                 .name = "Delhi",
235                 .nation = "India",
236         },
237         {
238                 .id = CITY_MUMBAI,
239                 .timezone = 5.5,
240                 .name = "Mumbai",
241                 .nation = "India",
242         },
243         {
244                 .id = CITY_DAKA,
245                 .timezone = 6.0,
246                 .name = "Bombay",
247                 .nation = "India",
248         },
249         {
250                 .id = CITY_CALCUTTA,
251                 .timezone = 6.0,
252                 .name = "Calcutta",
253                 .nation = "India",
254         },
255         {
256                 .id = CITY_BANGKOK,
257                 .timezone = 7.0,
258                 .name = "Bangkok",
259                 .nation = "Thailand",
260         },
261         {
262                 .id = CITY_JAKARTA,
263                 .timezone = 7.0,
264                 .name = "Jakarta",
265                 .nation = "Indonesia",
266         },
267         {
268                 .id = CITY_BEIJING,
269                 .timezone = 8.0,
270                 .name = "Beijing",
271                 .nation = "China",
272         },
273         {
274                 .id = CITY_HONG_KONG,
275                 .timezone = 8.0,
276                 .name = "Hong Kong",
277                 .nation = "China",
278         },
279         {
280                 .id = CITY_SINGAPORE,
281                 .timezone = 8.0,
282                 .name = "Singapore",
283                 .nation = "Singapore",
284         },
285         {
286                 .id = CITY_TAIPEI,
287                 .timezone = 8.0,
288                 .name = "Taipei",
289                 .nation = "Thaiwan",
290         },
291         {
292                 .id = CITY_SEOUL,
293                 .timezone = 9.0,
294                 .name = "Seoul",
295                 .nation = "Korea",
296         },
297         {
298                 .id = CITY_TOKYO,
299                 .timezone = 9.0,
300                 .name = "Tokyo",
301                 .nation = "Japan",
302         },
303         {
304                 .id = CITY_SYDNEY,
305                 .timezone = 10.0,
306                 .name = "Sydney",
307                 .nation = "Australia",
308         },
309 };
310
311 Evas_Object *map_create(Evas_Object *parent)
312 {
313         Evas_Object *map = NULL;
314         Evas_Object *button = NULL;
315         char *path = NULL;
316         char full_path[] = {0, };
317
318         retv_if(!parent, NULL);
319
320         path = app_get_resource_path();
321         retv_if(!path, NULL);
322
323         snprintf(full_path, sizeof(full_path), "%s/edje/%s", path, MAP_EDJE);
324         free(path);
325
326         map = elm_layout_add(parent);
327         retv_if(!map, NULL);
328         elm_layout_file_set(map, full_path, "main");
329         evas_object_show(map);
330
331         return map;
332 }
333
334 void map_destroy(Evas_Object *map)
335 {
336         Evas_Object *button = NULL;
337
338         ret_if(!map);
339
340         evas_object_del(map);
341 }