13e738b29fd248729e20564cb13ab2d232c11db5
[apps/home/volume-app.git] / src / volume.c
1 /*
2  * Copyright 2012  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://www.tizenopensource.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
18 #include <stdio.h>
19
20 #include "volume.h"
21 #include "_util_log.h"
22 #include "_util_efl.h"
23 #include "_logic.h"
24
25 struct text_part {
26         char *part;
27         char *msgid;
28 };
29
30 static int lang_changed(void *data)
31 {
32         return _lang_changed(data);
33 }
34
35 static int app_create(void *data)
36 {
37         struct appdata *ad = data;
38
39         retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
40
41         _app_create(ad);
42
43         lang_changed(ad);
44
45         /* add system event callback */
46         appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE,
47                         lang_changed, ad);
48
49         /* appcore measure time example */
50         printf("from AUL to %s(): %d msec\n", __func__,
51                         appcore_measure_time_from("APP_START_TIME"));
52
53         appcore_measure_start();
54         return 0;
55 }
56
57 static int app_terminate(void *data)
58 {
59         struct appdata *ad = data;
60
61         if (ad->win)
62                 evas_object_del(ad->win);
63
64         return 0;
65 }
66
67 static int app_pause(void *data)
68 {
69         _app_pause(data);
70         return 0;
71 }
72
73 static int app_resume(void *data)
74 {
75         return 0;
76 }
77
78 static int app_reset(bundle *b, void *data)
79 {
80         struct appdata *ad = data;
81
82         if (ad->flag_launching == EINA_TRUE) {
83                 return 0;
84         }
85         ad->flag_launching = EINA_TRUE;
86
87         _app_reset(b, data);
88
89         /* appcore measure time example */
90         printf("from AUL to %s(): %d msec\n", __func__,
91                         appcore_measure_time_from("APP_START_TIME"));
92         printf("from create to %s(): %d msec\n", __func__,
93                         appcore_measure_time());
94
95         if (ad->win)
96                 elm_win_activate(ad->win);
97
98         ad->flag_launching = EINA_FALSE;
99
100         return 0;
101 }
102
103 int main(int argc, char *argv[])
104 {
105         struct appdata ad;
106         struct appcore_ops ops = {
107                 .create = app_create,
108                 .terminate = app_terminate,
109                 .pause = app_pause,
110                 .resume = app_resume,
111                 .reset = app_reset,
112         };
113
114         /* appcore measure time example */
115         printf("from AUL to %s(): %d msec\n", __func__,
116                         appcore_measure_time_from("APP_START_TIME"));
117
118         memset(&ad, 0x0, sizeof(struct appdata));
119         ops.data = &ad;
120
121         return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
122 }
123