Fixed BS(assertion from indicator_icon_list_free)
[apps/home/indicator-win.git] / modules / modules.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 "modules.h"
19
20 /* Home */
21 extern Indicator_Icon_Object home;
22
23 /* Network */
24 extern Indicator_Icon_Object rssi;
25 extern Indicator_Icon_Object roaming;
26
27 /* Connection */
28 extern Indicator_Icon_Object usb;
29 extern Indicator_Icon_Object wifi;
30 extern Indicator_Icon_Object mobile_hotspot;
31 extern Indicator_Icon_Object conn;
32
33 /* Processing */
34 extern Indicator_Icon_Object trnsfr;
35 extern Indicator_Icon_Object sos;
36 extern Indicator_Icon_Object call;
37 extern Indicator_Icon_Object call_divert;
38 extern Indicator_Icon_Object active_sync;
39
40 /* Information */
41 extern Indicator_Icon_Object mmc;
42 extern Indicator_Icon_Object noti;
43
44 /* message */
45 /* extern Indicator_Icon_Object message; */
46
47 /* voice mail*/
48 /* extern Indicator_Icon_Object voice_mail; */
49
50 /*
51 extern Indicator_Icon_Object missed_call;
52 extern Indicator_Icon_Object im;
53 */
54
55 /* alarm */
56 extern Indicator_Icon_Object useralarm;
57
58 /* playing */
59 extern Indicator_Icon_Object fm_radio;
60 extern Indicator_Icon_Object mp3_play;
61 extern Indicator_Icon_Object voice_recorder;
62
63 /* Setting */
64 extern Indicator_Icon_Object silent;
65 extern Indicator_Icon_Object bluetooth;
66 extern Indicator_Icon_Object rotate;
67 extern Indicator_Icon_Object gps;
68 extern Indicator_Icon_Object nfc;
69 extern Indicator_Icon_Object wifi_direct;
70
71 /* Clock */
72 extern Indicator_Icon_Object sysclock;
73
74 /* Power */
75 extern Indicator_Icon_Object battery;
76
77 /* Smart stay */
78 extern Indicator_Icon_Object smart_stay;
79
80 static Indicator_Icon_Object *modules[] = {
81         /* Home */
82         &home,
83         /* Network */
84         &rssi,
85         &roaming,
86         /* Connection */
87         &sos,
88         &usb,
89         &wifi,
90         &mobile_hotspot,
91         &conn,
92         /* Processing */
93         &trnsfr,
94         &call,
95         &call_divert,
96
97         /*
98         &active_sync,
99          */
100
101         /* Information */
102         /* &message, */
103         /* &voice_mail, */
104         &mmc,
105         &noti,
106         &useralarm,
107         &fm_radio,
108         &mp3_play,
109         &voice_recorder,
110
111         /* Setting */
112         &silent,
113         &bluetooth,
114         &rotate,
115         &gps,
116         &nfc,
117         &wifi_direct,
118
119         /* Clock */
120         &sysclock,
121         /* Power */
122         &battery,
123         /*Smart Stay*/
124     &smart_stay,
125 /* Add your module object here */
126         NULL
127 };
128
129 void indicator_init_modules(void *data)
130 {
131         int i;
132         /* add items to list */
133         for (i = 0; modules[i]; i++) {
134                 indicator_icon_list_insert(modules[i]);
135                 modules[i]->ad = data;
136                 if (modules[i]->init)
137                         modules[i]->init(data);
138         }
139 }
140
141 void indicator_fini_modules(void *data)
142 {
143         int i;
144         /* add items to list */
145         for (i = 0; modules[i]; i++) {
146                 if (modules[i]->fini)
147                         modules[i]->fini();
148         }
149         /* delete modules */
150         indicator_icon_list_free();
151 }
152
153 void indicator_hib_enter_modules(void *data)
154 {
155         int i;
156         /* add items to list */
157         for (i = 0; modules[i]; i++) {
158                 if (modules[i]->hib_enter)
159                         modules[i]->hib_enter();
160         }
161 }
162
163 void indicator_hib_leave_modules(void *data)
164 {
165         int i;
166         /* add items to list */
167         for (i = 0; modules[i]; i++) {
168                 if (modules[i]->hib_leave)
169                         modules[i]->hib_leave(data);
170         }
171 }
172
173 void indicator_lang_changed_modules(void *data)
174 {
175         int i;
176         /* add items to list */
177         for (i = 0; modules[i]; i++) {
178                 if (modules[i]->lang_changed)
179                         modules[i]->lang_changed(data);
180         }
181 }
182
183 void indicator_region_changed_modules(void *data)
184 {
185         int i;
186         /* add items to list */
187         for (i = 0; modules[i]; i++) {
188                 if (modules[i]->region_changed)
189                         modules[i]->region_changed(data);
190         }
191 }